--- /dev/null
+[Apr.20 2009] 2.1.2-1 Shinya TAKEBAYASHI
+ - Removed cookie modules
+
+[Mar. 9 2009] 2.1.2-0 Shinya TAKEBAYASHI
+ - Added protocol modules(recently supported):
+ * cpassive(Cookie passive)
+ * crewrite(Cookie rewrite)
+ * ip(Source IP)
+ * pfilter(Packet filter)
+ - Implemented replication spec to sslid module.
+
+[Jan. 27 2009] 2.1.1-0 Shinya TAKEBAYASHI
+ - Added option for FAST SCHEDULE to sessionless module.
+ Establishing connection when clinent connection was established.
+ - Updated l7directord man file.
+ - Changed methods for sslid module.(liner list -> hash list)
+
+[Dec. 17 2008] 2.1.0-0 Shinya TAKEBAYASHI
+ - Implemented access logger (CLIENT - DESTINATION mapping).
+ - Optimized event listener.
+ - Fixed algorithms for some check type.
+ - "Checkcount" has been enabled.
+ - Created "man" page.(Japanese(UTF-8) only ;))
+ - Implemented flow control logic(server).
+ - Eliminated flow control logic(client).
+
+[May. 26 2008] 2.0.0-0 Shinya TAKEBAYASHI
+ - Changed logger library(vanessa_logger -> log4cxx)
+ - Implemented configuration function(using configuration file: /etc/l7vs/l7vs.cf)
+ - Implemented replication system(for HA clustering)
+ - Added new protocol module(sessionless - Layer-4 LB like module)
+
+[Dec. 11 2007] 1.0.0-1 Shinya TAKEBAYASHI
+ - Implemented blocking mode switching function
+
+[Oct. 11 2007] 1.0.0-0 Shinya TAKEBAYASHI
+ - Change liblary from GLib1.2 to GLib2.0 (memory leak fix)
+ - Change from select() to epoll ET.
+ - Change bloking mode to non-blocking mode(recv() and send()).
+ - Change from service conn list to service conn hash.
+ - Change from iomux-list to hash-map and available list.
+ - Add QoS Control.
+ - Add Weighted Round-Robin scheduler.
+ - Add real server weight.
+ - Fixed some bugs.
+
+ * Following members helped us. Thanks!
+
+ Hideaki KONDO
+ Shunji FUKUSHIMA
+ Norihisa NAKAI
+ Hajime OKADA
+ Akira TAKAMARU
+ Hiroyuki BAN
+ Toru MORISHITA
+ Kouhei TANUMA
+ Tetsuya TAKATSURU
+ Masahiro SAKAMOTO
+ Yumi KITANI
+
+[May. 9 2007] 0.6.0-0 Shinya TAKEBAYASHI
+ - Extended maximum client connections.
+ - Fixed some bugs.
+
+[Feb. 19, 2007] 0.5.0-3 Shinya TAKEBAYASHI
+ - Fixed syntax errors.(umagent/umagent.c, umagent/Makefile)
+
+[Dec. 26, 2006] 0.5.0-2 Takahiro Kurosawa / Hideaki Kondo
+ - Rewrote to fix bug about Segmentation Fault.(conn.c)
+
--- /dev/null
+Layer-7 Loadbalancing Framework "UltraMonkey-L7"
+Installation manual for debian system.
+
+Copyright (C) 2008 Shinya TAKEBAYASHI
+
+--------------------------------------------------------------
+
+INTRODUCTION
+
+ This document describes how to install UltraMonkey-L7 on your
+ Debian system.
+
+
+REQUIRE
+
+ First, to compile and install l7vs on debian, these packages
+ must be installed on your system.
+
+ - automake
+ - autoconf
+ - libglib-dev
+ - libtool
+ - libapr1-dev and libaprutil1-dev(includes libapr1 and libaprutil1)
+ - log4cxx 0.10 or higher
+
+ To install these packages, run the following command:
+
+ # apt-get install automake autoconf libglib-dev libtool libapr1-dev libaprutil1-dev
+
+ $ tar zxf apache-log4cxx-0.10.0.tar.gz
+ $ cd apache-log4cxx-0.10.0
+ $ ./autogen.sh
+ $ ./configure && make
+ $ su
+ # make install
+
+
+INSTALL
+
+ To compile and install l7vs, run the following commands:
+
+ $ ./configure
+ $ make
+ $ su
+ # make install
+
--- /dev/null
+UltraMonkey-L7 インストールマニュアル v1.6【v2.1.0-x対応版】
+
+--------------------------------------------------------------------------------
+
+[変更履歴]
+2005.10.18 [v1.0] 初版
+2005.11.15 [v1.1] マニュアルの不備を修正
+2006.07.07 [v1.2] tcps 非カーネルパッチ版公開に伴う修正
+2007.01.19 [v1.3] 追加機能に伴う修正
+2007.10.12 [v1.3.1] l7vs-0.6.1 公開に伴う一部関連修正
+2007.10.12 [v1.4] l7vs-1.0.0 公開に伴う一部関連修正
+2008.05.30 [v1.5] v2.0.0-x 公開に伴う一部関連修正
+2008.07.09 [v1.5.1] l7vs インストール時注意事項追記
+2008.12.16 [v1.5.2] tar.gz ファイル名誤記修正
+2008.12.16 [v1.6] v2.1.0-0 公開に伴う一部関連修正
+
+--------------------------------------------------------------------------------
+
+ 1 前提条件
+ 1.1 主な仕様
+ 1.2 事前準備
+ 2 L7 フレームワーク (l7vs) のインストールと設定
+ 2.1 L7 負荷分散フレームワークのインストール
+ 2.2 L7 負荷分散フレームワークの起動方法
+ 2.3 L7 負荷分散フレームワークの動作確認
+ 3 L7 サーバ監視設定ツール (l7directord) の設定
+ 3.1 l7directord の設定方法
+ 3.2 l7directord の起動方法
+ 3.3 l7directord の動作確認
+
+--------------------------------------------------------------------------------
+
+ 1 前提条件
+ 本マニュアルが想定する環境を以下に示します。
+
+ 1.1 主な仕様
+ 1.1.1 ハードウェア(推奨)
+ CPU: Xeon 2.8GHz x2 相当、メモリ: 2GB 相当、HDD: 10GB 相当
+ Ethernet: 1000BASE-T、1000BASE-SX
+
+ 1.1.2 主なソフトウェア
+ OS:Red Hat Enterprise Linux 5.1 (kernel2.6.18-xx) x86 版, x86_64 版
+ L7 負荷分散フレームワーク (l7vsd)
+ L7 サーバ監視設定ツール (l7directord)
+
+ 1.1.3 本マニュアルで使用するソース
+ ultramonkey-l7-2.1.0-0.tar.gz
+ log4cxx-0.10.0
+ apr-1.2.12.tar.gz
+ apr-util-1.2.12.tar.gz
+
+ (※) 本マニュアルでは、上記のソースを使用することとして記述しております。
+ 異なるバージョン等使用する際には注意願います。
+
+ 1.2 事前準備
+ 1.2.1 ライブラリ編
+ log4cxx-0.10.0 を以下のサイトよりダウンロードします。
+ http://logging.apache.org/log4cxx/download.html
+
+ また、log4cxx で必要となる apr ライブラリを以下のサイトよりダウンロー
+ ドします。
+ http://apr.apache.org/download
+
+ (※) OS 付属のメディアや yum を使って RPM パッケージでインストールする場合
+ はダウンロードする必要はありません
+
+
+ 1.2.1.1 apr ライブラリのインストール
+ apr ライブラリを解凍してインストールを行います。
+
+ # tar xvfz- apr-1.2.12.tar.gz
+ # cd apr-1.2.12
+ # ./configure --prefix=/usr --libdir=/usr/lib64
+
+ (※) ただし、32bit 環境の場合は /usr/lib64 を /usr/lib に変更してください
+
+ # make
+ # make install
+ これで apr ライブラリのインストールは終了です。
+
+ RPM パッケージでインストールする場合は、apr-devel.i386 をインストール
+ してください。(x86_64 環境では apr-devel.x86_64)
+ # rpm -ivh apr-devel-1.2.7-11.i386.rpm
+ # rpm -ivh apr-devel-1.2.7-11.x86_64.rpm
+ または
+ # yum install apr-devel.i386
+ # yum install apr-devel.x86_64
+
+ 1.2.1.2 apr-util ライブラリのインストール
+ apr-util ライブラリを解凍してインストールを行います。
+
+ # tar xvfz- apr-util-1.2.12.tar.gz
+ # cd apr-util-1.2.12
+ # ./configure --prefix=/usr --libdir=/usr/lib64 --with-apr=/usr
+
+ (※) ただし、32bit 環境の場合は /usr/lib64 を /usr/lib に変更してください
+
+ 64bit 構成の場合にはそのまま作成された Makefile ではエラーになります
+ ので、Makefile を編集します。32bit 環境の場合には追加は必要ありません
+ # vi Makefile
+ (変更前)
+ APRUTIL_LIBS = ...
+ (変更後: -L/usr/lib64を追加)
+ APRUTIL_LIBS = -L/usr/lib64 ...
+
+ # make
+ # make install
+ これで apr-util のライブラリのインストールは終了です。
+
+ RPM パッケージでインストールする場合は、apr-util-devel.i386 をインス
+ トールしてください。(x86_64 環境では apr-util-devel.x86_64)
+ # rpm -ivh apr-util-devel-1.2.7-6.i386.rpm
+ # rpm -ivh apr-util-devel-1.2.7-6.x86_64.rpm
+ または
+ # yum install apr-util-devel.i386
+ # yum install apr-util-devel.x86_64
+
+ 1.2.1.3 log4cxx のインストール
+ log4cxx ライブラリを解凍してインストールを行います。
+
+ # tar xvfz- apache-log4cxx-0.10.0.tar.gz
+ # cd apache-log4cxx-0.10.0
+ # ./autogen.sh
+ # ./configure --prefix=/usr --libdir=/usr/lib64
+
+ (※) ただし、32bit 環境の場合は /usr/lib64 を /usr/lib に変更してください
+
+ # make
+ # make install
+ これで log4cxx のライブラリインストールは終了です。
+
+ 1.2.1.4 Perl モジュールのインストール
+ ヘルスチェックに必要な Perl モジュールをインストールします。使用する
+ 監視方法によって必要となるモジュールが異なりますので、以下に従って必
+ 要なモジュールをインストールします。(括弧なしは CPAN 経由のみ、括弧あ
+ りは RHEL5.1 のメディアから RPM パッケージでインストールもできます)
+
+ 1. HTTP 監視に必要なモジュール
+ libwww-perl (perl-libwww-perl)
+
+ 2. HTTPS 監視に必要なモジュール
+ libwww-perl (perl-libwww-perl)
+ Crypt::SSLeay (perl-Crypt-SSLeay)
+
+ 3. IMAP
+ Mail::IMAPClient
+
+ 4. LDAP
+ Net::LDAP
+
+ 5. DNS
+ Net::DNS (perl-Net-DNS)
+
+ 6. MySQL
+ DBI (perl-DBI)
+ DBD::mysql (perl-DBD-MySQL)
+
+ 7. PostgreSQL
+ DBI (perl-DBI)
+ DBD::Pg (perl-DBD-Pg)
+
+ (※) CPAN 経由でインストールする場合の例
+ # cpan -i Crypt::SSLeay
+
+ (※) RPM パッケージでインストールする場合の例
+ # rpm -ivh perl-Crypt-SSLeay-0.51-11.el5.x86_64.rpm
+ yum でインストールする場合の例
+ # yum install perl-Crypt-SSLeay
+
+--------------------------------------------------------------------------------
+
+ 2 フレームワークのインストールと設定
+
+ 2.1 L7 負荷分散フレームワークのインストール
+
+ 2.1.1 L7 負荷分散フレームワークのインストール
+ 2.1.1.1 l7vsd のインストール
+ ultramonkey-l7-2.1.0-0.tar.gz を展開します。
+ # tar zxvf ultramonkey-l7-2.1.0-0.tar.gz
+ # cd ultramonkey-l7-2.1.0-0
+ # ./configure
+ # make
+ # make install
+
+ 注意:
+ make 実行時に次のようなエラーが発生する場合、
+
+ src/Makefile.am: required file './compile' not found
+ make: *** [Makefile.in] Error 1
+
+ 一度
+ # automake --add-missing --copy
+ を実行した後、再度
+ # ./configure
+ から実行して下さい。
+
+ 補足:
+ configure マクロには以下のオプションがあります。
+
+ --with-l7vs_moddir=[MODULE DIRECTORY]
+ プロトコルモジュール及びスケジュールモジュールをインストールする
+ ディレクトリを指定します。デフォルトは /usr/(libdir)/l7vs です。
+ libdir は ILP64 や ILP32 だとlib、LP64 や LLP64 だと /usr/lib64
+ です。
+
+ --with-l7vsadm-sockdir=[SOCKET DIRECTORY]
+ l7vsadm と l7vsd の通信に使用するソケットファイルを格納するディレ
+ クトリを指定します。デフォルトは /var/run/l7vs です。
+
+ --with-l7vs-maxvs=[NUM]
+ l7vsd の VirtualService の上限を指定します。デフォルトは 64 個で
+ す。これは 32bit 環境と 64bit 環境で登録できる最大数が変動するた
+ め、その差異を埋めるためにどちらの環境でも登録できる 64 個で制限
+ しています。もし、64bit 環境でかつ 64 個以上の VirtualService を
+ 登録する必要がある場合には、この数字を増やすことで対応可能です。
+ 32bit 環境でも増やすことは出来ますが、その数について保証出来ませ
+ ん。 (予期しない挙動をすることがあります)
+
+ 2.2.1 L7 負荷分散フレームワークの起動
+ # /etc/init.d/l7vsd start
+
+ 2.3 L7 負荷分散フレームワークの動作確認
+
+ 2.3.1 l7vsd の正常起動を確認
+ # /etc/init.d/l7vsd status
+ l7vsd running with pid: (PID)
+ が表示されていることを確認します。
+
+--------------------------------------------------------------------------------
+
+ 3 L7 サーバ監視設定ツールのインストールと設定
+
+ 3.1 l7directord の設定方法
+ l7directord は設定ファイルを /etc/ha.d/conf/l7directord.cf に持ちます。
+ UltraMonkey-L7 管理マニュアル (uml7-administration_manual_2.1.0-0_ja) 参照
+ し、適宜設定を行ってください。
+
+ 3.2 l7directord の起動方法
+ # /etc/init.d/l7directord start
+
+ 3.3 l7directord の動作確認
+ # /etc/init.d/l7directord status
+ を実行し、無事に起動できているかを確認してください。
+
--- /dev/null
+######################################################################
+# Makefile August 2005
+#
+# L7VSD: Linux Virtual Server for Layer7 Load Balancing
+# Copyright (C) 2005 NTT COMWARE Corporation.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 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
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+# 02110-1301 USA
+#
+######################################################################
+
+SUBDIRS = logger parameter src module conf init.d l7directord man
+AUTOMAKE_OPTIONS = foreign
+
--- /dev/null
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+######################################################################
+# Makefile August 2005
+#
+# L7VSD: Linux Virtual Server for Layer7 Load Balancing
+# Copyright (C) 2005 NTT COMWARE Corporation.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 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
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+# 02110-1301 USA
+#
+######################################################################
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = .
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \
+ $(srcdir)/Makefile.in $(srcdir)/config.h.in \
+ $(srcdir)/ultramonkeyl7.spec.in $(top_srcdir)/configure \
+ 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_HEADER = config.h
+CONFIG_CLEAN_FILES = ultramonkeyl7.spec
+SOURCES =
+DIST_SOURCES =
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+ html-recursive info-recursive install-data-recursive \
+ install-exec-recursive install-info-recursive \
+ install-recursive installcheck-recursive installdirs-recursive \
+ pdf-recursive ps-recursive uninstall-info-recursive \
+ uninstall-recursive
+ETAGS = etags
+CTAGS = ctags
+DIST_SUBDIRS = $(SUBDIRS)
+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 = @ACLOCAL@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+GLIB_CFLAGS = @GLIB_CFLAGS@
+GLIB_GENMARSHAL = @GLIB_GENMARSHAL@
+GLIB_LIBS = @GLIB_LIBS@
+GLIB_MKENUMS = @GLIB_MKENUMS@
+GOBJECT_QUERY = @GOBJECT_QUERY@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MANDIR = @MANDIR@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PKG_CONFIG = @PKG_CONFIG@
+RANLIB = @RANLIB@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+ac_ct_RANLIB = @ac_ct_RANLIB@
+ac_ct_STRIP = @ac_ct_STRIP@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+l7vs_maxvs = @l7vs_maxvs@
+l7vs_moddir = @l7vs_moddir@
+l7vsadm_sockdir = @l7vsadm_sockdir@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+snmpagent_libs = @snmpagent_libs@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+SUBDIRS = logger parameter src module conf init.d l7directord man
+AUTOMAKE_OPTIONS = foreign
+all: config.h
+ $(MAKE) $(AM_MAKEFLAGS) all-recursive
+
+.SUFFIXES:
+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) --foreign '; \
+ cd $(srcdir) && $(AUTOMAKE) --foreign \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign 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)
+
+config.h: stamp-h1
+ @if test ! -f $@; then \
+ rm -f stamp-h1; \
+ $(MAKE) stamp-h1; \
+ else :; fi
+
+stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status
+ @rm -f stamp-h1
+ cd $(top_builddir) && $(SHELL) ./config.status config.h
+$(srcdir)/config.h.in: $(am__configure_deps)
+ cd $(top_srcdir) && $(AUTOHEADER)
+ rm -f stamp-h1
+ touch $@
+
+distclean-hdr:
+ -rm -f config.h stamp-h1
+ultramonkeyl7.spec: $(top_builddir)/config.status $(srcdir)/ultramonkeyl7.spec.in
+ cd $(top_builddir) && $(SHELL) ./config.status $@
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+distclean-libtool:
+ -rm -f libtool
+uninstall-info-am:
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+# (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+$(RECURSIVE_TARGETS):
+ @failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ target=`echo $@ | sed s/-recursive//`; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ dot_seen=yes; \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done; \
+ if test "$$dot_seen" = "no"; then \
+ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+ fi; test -z "$$fail"
+
+mostlyclean-recursive clean-recursive distclean-recursive \
+maintainer-clean-recursive:
+ @failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ case "$@" in \
+ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+ *) list='$(SUBDIRS)' ;; \
+ esac; \
+ rev=''; for subdir in $$list; do \
+ if test "$$subdir" = "."; then :; else \
+ rev="$$subdir $$rev"; \
+ fi; \
+ done; \
+ rev="$$rev ."; \
+ target=`echo $@ | sed s/-recursive//`; \
+ for subdir in $$rev; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done && test -z "$$fail"
+tags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+ done
+ctags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+ 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: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
+ include_option=--etags-include; \
+ empty_fix=.; \
+ else \
+ include_option=--include; \
+ empty_fix=; \
+ fi; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test ! -f $$subdir/TAGS || \
+ tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
+ fi; \
+ done; \
+ list='$(SOURCES) $(HEADERS) config.h.in $(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: ctags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) config.h.in $(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)
+ $(mkdir_p) $(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
+ list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test -d "$(distdir)/$$subdir" \
+ || $(mkdir_p) "$(distdir)/$$subdir" \
+ || exit 1; \
+ distdir=`$(am__cd) $(distdir) && pwd`; \
+ top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
+ (cd $$subdir && \
+ $(MAKE) $(AM_MAKEFLAGS) \
+ top_distdir="$$top_distdir" \
+ distdir="$$distdir/$$subdir" \
+ distdir) \
+ || 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-recursive
+all-am: Makefile config.h
+installdirs: installdirs-recursive
+installdirs-am:
+install: install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+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-recursive
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-recursive
+ -rm -f $(am__CONFIG_DISTCLEAN_FILES)
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic distclean-hdr \
+ distclean-libtool distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+html: html-recursive
+
+info: info-recursive
+
+info-am:
+
+install-data-am:
+
+install-exec-am:
+
+install-info: install-info-recursive
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-recursive
+ -rm -f $(am__CONFIG_DISTCLEAN_FILES)
+ -rm -rf $(top_srcdir)/autom4te.cache
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-recursive
+
+pdf-am:
+
+ps: ps-recursive
+
+ps-am:
+
+uninstall-am: uninstall-info-am
+
+uninstall-info: uninstall-info-recursive
+
+.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am am--refresh check \
+ check-am clean clean-generic clean-libtool clean-recursive \
+ ctags ctags-recursive dist dist-all dist-bzip2 dist-gzip \
+ dist-shar dist-tarZ dist-zip distcheck distclean \
+ distclean-generic distclean-hdr distclean-libtool \
+ distclean-recursive 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-man \
+ install-strip installcheck installcheck-am installdirs \
+ installdirs-am maintainer-clean maintainer-clean-generic \
+ maintainer-clean-recursive mostlyclean mostlyclean-generic \
+ mostlyclean-libtool mostlyclean-recursive pdf pdf-am ps ps-am \
+ tags tags-recursive uninstall uninstall-am uninstall-info-am
+
+# 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:
--- /dev/null
+About UltraMonkey-L7\r
+---------------------------------------------------------------------------\r
+\r
+Welcome\r
+=======\r
+ UltraMonkey-L7 is a opensource layer-7 load balancing software.\r
+ \r
+\r
+ <<< Notes concerning the use of this software package >>>\r
+\r
+ Due to a possible conflict with an U.S. patent owned by F5 Networks,\r
+ the use of the cookie-based persistence module included in this package\r
+ is restricted to Japan.\r
+\r
+\r
+System requirements\r
+===================\r
+\r
+ OS : Linux 2.6.9(or later)on x86 and x86_64 architecture\r
+ We recommend to use Redhat Enterprise Linux.\r
+\r
+ CPU : Intel x86 and x86_64 or compatible architecture processors\r
+\r
+ Memory : 2 GB(recommended)\r
+\r
+ Libraries : gcc4(or higher), glib2.x, perl, apache log4cxx(0.10 or higher)\r
+ \r
+\r
+License\r
+=======\r
+\r
+ UltraMonkey-L7 is distributed using LGPL License.\r
+\r
+\r
+About UltraMonkey-L7 Project\r
+============================\r
+\r
+ To get more information about UltraMonkey-L7, please visit our project\r
+ Web Site.\r
+\r
+ Project Web Site - http://ultramonkey-l7.sourceforge.jp/\r
+ Software repository - http://sourceforge.jp/projects/ultramonkey-l7/\r
--- /dev/null
+# generated automatically by aclocal 1.9.6 -*- Autoconf -*-
+
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
+# 2005 Free Software Foundation, Inc.
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+# Configure paths for GLIB
+# Owen Taylor 1997-2001
+
+dnl AM_PATH_GLIB_2_0([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]])
+dnl Test for GLIB, and define GLIB_CFLAGS and GLIB_LIBS, if gmodule, gobject or
+dnl gthread is specified in MODULES, pass to pkg-config
+dnl
+AC_DEFUN([AM_PATH_GLIB_2_0],
+[dnl
+dnl Get the cflags and libraries from pkg-config
+dnl
+AC_ARG_ENABLE(glibtest, [ --disable-glibtest do not try to compile and run a test GLIB program],
+ , enable_glibtest=yes)
+
+ pkg_config_args=glib-2.0
+ for module in . $4
+ do
+ case "$module" in
+ gmodule)
+ pkg_config_args="$pkg_config_args gmodule-2.0"
+ ;;
+ gmodule-no-export)
+ pkg_config_args="$pkg_config_args gmodule-no-export-2.0"
+ ;;
+ gobject)
+ pkg_config_args="$pkg_config_args gobject-2.0"
+ ;;
+ gthread)
+ pkg_config_args="$pkg_config_args gthread-2.0"
+ ;;
+ esac
+ done
+
+ AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
+
+ no_glib=""
+
+ if test x$PKG_CONFIG != xno ; then
+ if $PKG_CONFIG --atleast-pkgconfig-version 0.7 ; then
+ :
+ else
+ echo *** pkg-config too old; version 0.7 or better required.
+ no_glib=yes
+ PKG_CONFIG=no
+ fi
+ else
+ no_glib=yes
+ fi
+
+ min_glib_version=ifelse([$1], ,2.0.0,$1)
+ AC_MSG_CHECKING(for GLIB - version >= $min_glib_version)
+
+ if test x$PKG_CONFIG != xno ; then
+ ## don't try to run the test against uninstalled libtool libs
+ if $PKG_CONFIG --uninstalled $pkg_config_args; then
+ echo "Will use uninstalled version of GLib found in PKG_CONFIG_PATH"
+ enable_glibtest=no
+ fi
+
+ if $PKG_CONFIG --atleast-version $min_glib_version $pkg_config_args; then
+ :
+ else
+ no_glib=yes
+ fi
+ fi
+
+ if test x"$no_glib" = x ; then
+ GLIB_GENMARSHAL=`$PKG_CONFIG --variable=glib_genmarshal glib-2.0`
+ GOBJECT_QUERY=`$PKG_CONFIG --variable=gobject_query glib-2.0`
+ GLIB_MKENUMS=`$PKG_CONFIG --variable=glib_mkenums glib-2.0`
+
+ GLIB_CFLAGS=`$PKG_CONFIG --cflags $pkg_config_args`
+ GLIB_LIBS=`$PKG_CONFIG --libs $pkg_config_args`
+ glib_config_major_version=`$PKG_CONFIG --modversion glib-2.0 | \
+ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
+ glib_config_minor_version=`$PKG_CONFIG --modversion glib-2.0 | \
+ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
+ glib_config_micro_version=`$PKG_CONFIG --modversion glib-2.0 | \
+ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
+ if test "x$enable_glibtest" = "xyes" ; then
+ ac_save_CFLAGS="$CFLAGS"
+ ac_save_LIBS="$LIBS"
+ CFLAGS="$CFLAGS $GLIB_CFLAGS"
+ LIBS="$GLIB_LIBS $LIBS"
+dnl
+dnl Now check if the installed GLIB is sufficiently new. (Also sanity
+dnl checks the results of pkg-config to some extent)
+dnl
+ rm -f conf.glibtest
+ AC_TRY_RUN([
+#include <glib.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+int
+main ()
+{
+ int major, minor, micro;
+ char *tmp_version;
+
+ system ("touch conf.glibtest");
+
+ /* HP/UX 9 (%@#!) writes to sscanf strings */
+ tmp_version = g_strdup("$min_glib_version");
+ if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) {
+ printf("%s, bad version string\n", "$min_glib_version");
+ exit(1);
+ }
+
+ if ((glib_major_version != $glib_config_major_version) ||
+ (glib_minor_version != $glib_config_minor_version) ||
+ (glib_micro_version != $glib_config_micro_version))
+ {
+ printf("\n*** 'pkg-config --modversion glib-2.0' returned %d.%d.%d, but GLIB (%d.%d.%d)\n",
+ $glib_config_major_version, $glib_config_minor_version, $glib_config_micro_version,
+ glib_major_version, glib_minor_version, glib_micro_version);
+ printf ("*** was found! If pkg-config was correct, then it is best\n");
+ printf ("*** to remove the old version of GLib. You may also be able to fix the error\n");
+ printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n");
+ printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n");
+ printf("*** required on your system.\n");
+ printf("*** If pkg-config was wrong, set the environment variable PKG_CONFIG_PATH\n");
+ printf("*** to point to the correct configuration files\n");
+ }
+ else if ((glib_major_version != GLIB_MAJOR_VERSION) ||
+ (glib_minor_version != GLIB_MINOR_VERSION) ||
+ (glib_micro_version != GLIB_MICRO_VERSION))
+ {
+ printf("*** GLIB header files (version %d.%d.%d) do not match\n",
+ GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION, GLIB_MICRO_VERSION);
+ printf("*** library (version %d.%d.%d)\n",
+ glib_major_version, glib_minor_version, glib_micro_version);
+ }
+ else
+ {
+ if ((glib_major_version > major) ||
+ ((glib_major_version == major) && (glib_minor_version > minor)) ||
+ ((glib_major_version == major) && (glib_minor_version == minor) && (glib_micro_version >= micro)))
+ {
+ return 0;
+ }
+ else
+ {
+ printf("\n*** An old version of GLIB (%d.%d.%d) was found.\n",
+ glib_major_version, glib_minor_version, glib_micro_version);
+ printf("*** You need a version of GLIB newer than %d.%d.%d. The latest version of\n",
+ major, minor, micro);
+ printf("*** GLIB is always available from ftp://ftp.gtk.org.\n");
+ printf("***\n");
+ printf("*** If you have already installed a sufficiently new version, this error\n");
+ printf("*** probably means that the wrong copy of the pkg-config shell script is\n");
+ printf("*** being found. The easiest way to fix this is to remove the old version\n");
+ printf("*** of GLIB, but you can also set the PKG_CONFIG environment to point to the\n");
+ printf("*** correct copy of pkg-config. (In this case, you will have to\n");
+ printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
+ printf("*** so that the correct libraries are found at run-time))\n");
+ }
+ }
+ return 1;
+}
+],, no_glib=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
+ CFLAGS="$ac_save_CFLAGS"
+ LIBS="$ac_save_LIBS"
+ fi
+ fi
+ if test "x$no_glib" = x ; then
+ AC_MSG_RESULT(yes (version $glib_config_major_version.$glib_config_minor_version.$glib_config_micro_version))
+ ifelse([$2], , :, [$2])
+ else
+ AC_MSG_RESULT(no)
+ if test "$PKG_CONFIG" = "no" ; then
+ echo "*** A new enough version of pkg-config was not found."
+ echo "*** See http://www.freedesktop.org/software/pkgconfig/"
+ else
+ if test -f conf.glibtest ; then
+ :
+ else
+ echo "*** Could not run GLIB test program, checking why..."
+ ac_save_CFLAGS="$CFLAGS"
+ ac_save_LIBS="$LIBS"
+ CFLAGS="$CFLAGS $GLIB_CFLAGS"
+ LIBS="$LIBS $GLIB_LIBS"
+ AC_TRY_LINK([
+#include <glib.h>
+#include <stdio.h>
+], [ return ((glib_major_version) || (glib_minor_version) || (glib_micro_version)); ],
+ [ echo "*** The test program compiled, but did not run. This usually means"
+ echo "*** that the run-time linker is not finding GLIB or finding the wrong"
+ echo "*** version of GLIB. If it is not finding GLIB, you'll need to set your"
+ echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
+ echo "*** to the installed location Also, make sure you have run ldconfig if that"
+ echo "*** is required on your system"
+ echo "***"
+ echo "*** If you have an old version installed, it is best to remove it, although"
+ echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" ],
+ [ echo "*** The test program failed to compile or link. See the file config.log for the"
+ echo "*** exact error that occured. This usually means GLIB is incorrectly installed."])
+ CFLAGS="$ac_save_CFLAGS"
+ LIBS="$ac_save_LIBS"
+ fi
+ fi
+ GLIB_CFLAGS=""
+ GLIB_LIBS=""
+ GLIB_GENMARSHAL=""
+ GOBJECT_QUERY=""
+ GLIB_MKENUMS=""
+ ifelse([$3], , :, [$3])
+ fi
+ AC_SUBST(GLIB_CFLAGS)
+ AC_SUBST(GLIB_LIBS)
+ AC_SUBST(GLIB_GENMARSHAL)
+ AC_SUBST(GOBJECT_QUERY)
+ AC_SUBST(GLIB_MKENUMS)
+ rm -f conf.glibtest
+])
+
+# libtool.m4 - Configure libtool for the host system. -*-Autoconf-*-
+
+# serial 48 AC_PROG_LIBTOOL
+
+
+# AC_PROVIDE_IFELSE(MACRO-NAME, IF-PROVIDED, IF-NOT-PROVIDED)
+# -----------------------------------------------------------
+# If this macro is not defined by Autoconf, define it here.
+m4_ifdef([AC_PROVIDE_IFELSE],
+ [],
+ [m4_define([AC_PROVIDE_IFELSE],
+ [m4_ifdef([AC_PROVIDE_$1],
+ [$2], [$3])])])
+
+
+# AC_PROG_LIBTOOL
+# ---------------
+AC_DEFUN([AC_PROG_LIBTOOL],
+[AC_REQUIRE([_AC_PROG_LIBTOOL])dnl
+dnl If AC_PROG_CXX has already been expanded, run AC_LIBTOOL_CXX
+dnl immediately, otherwise, hook it in at the end of AC_PROG_CXX.
+ AC_PROVIDE_IFELSE([AC_PROG_CXX],
+ [AC_LIBTOOL_CXX],
+ [define([AC_PROG_CXX], defn([AC_PROG_CXX])[AC_LIBTOOL_CXX
+ ])])
+dnl And a similar setup for Fortran 77 support
+ AC_PROVIDE_IFELSE([AC_PROG_F77],
+ [AC_LIBTOOL_F77],
+ [define([AC_PROG_F77], defn([AC_PROG_F77])[AC_LIBTOOL_F77
+])])
+
+dnl Quote A][M_PROG_GCJ so that aclocal doesn't bring it in needlessly.
+dnl If either AC_PROG_GCJ or A][M_PROG_GCJ have already been expanded, run
+dnl AC_LIBTOOL_GCJ immediately, otherwise, hook it in at the end of both.
+ AC_PROVIDE_IFELSE([AC_PROG_GCJ],
+ [AC_LIBTOOL_GCJ],
+ [AC_PROVIDE_IFELSE([A][M_PROG_GCJ],
+ [AC_LIBTOOL_GCJ],
+ [AC_PROVIDE_IFELSE([LT_AC_PROG_GCJ],
+ [AC_LIBTOOL_GCJ],
+ [ifdef([AC_PROG_GCJ],
+ [define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[AC_LIBTOOL_GCJ])])
+ ifdef([A][M_PROG_GCJ],
+ [define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[AC_LIBTOOL_GCJ])])
+ ifdef([LT_AC_PROG_GCJ],
+ [define([LT_AC_PROG_GCJ],
+ defn([LT_AC_PROG_GCJ])[AC_LIBTOOL_GCJ])])])])
+])])# AC_PROG_LIBTOOL
+
+
+# _AC_PROG_LIBTOOL
+# ----------------
+AC_DEFUN([_AC_PROG_LIBTOOL],
+[AC_REQUIRE([AC_LIBTOOL_SETUP])dnl
+AC_BEFORE([$0],[AC_LIBTOOL_CXX])dnl
+AC_BEFORE([$0],[AC_LIBTOOL_F77])dnl
+AC_BEFORE([$0],[AC_LIBTOOL_GCJ])dnl
+
+# This can be used to rebuild libtool when needed
+LIBTOOL_DEPS="$ac_aux_dir/ltmain.sh"
+
+# Always use our own libtool.
+LIBTOOL='$(SHELL) $(top_builddir)/libtool'
+AC_SUBST(LIBTOOL)dnl
+
+# Prevent multiple expansion
+define([AC_PROG_LIBTOOL], [])
+])# _AC_PROG_LIBTOOL
+
+
+# AC_LIBTOOL_SETUP
+# ----------------
+AC_DEFUN([AC_LIBTOOL_SETUP],
+[AC_PREREQ(2.50)dnl
+AC_REQUIRE([AC_ENABLE_SHARED])dnl
+AC_REQUIRE([AC_ENABLE_STATIC])dnl
+AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl
+AC_REQUIRE([AC_CANONICAL_HOST])dnl
+AC_REQUIRE([AC_CANONICAL_BUILD])dnl
+AC_REQUIRE([AC_PROG_CC])dnl
+AC_REQUIRE([AC_PROG_LD])dnl
+AC_REQUIRE([AC_PROG_LD_RELOAD_FLAG])dnl
+AC_REQUIRE([AC_PROG_NM])dnl
+
+AC_REQUIRE([AC_PROG_LN_S])dnl
+AC_REQUIRE([AC_DEPLIBS_CHECK_METHOD])dnl
+# Autoconf 2.13's AC_OBJEXT and AC_EXEEXT macros only works for C compilers!
+AC_REQUIRE([AC_OBJEXT])dnl
+AC_REQUIRE([AC_EXEEXT])dnl
+dnl
+
+AC_LIBTOOL_SYS_MAX_CMD_LEN
+AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE
+AC_LIBTOOL_OBJDIR
+
+AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl
+_LT_AC_PROG_ECHO_BACKSLASH
+
+case $host_os in
+aix3*)
+ # AIX sometimes has problems with the GCC collect2 program. For some
+ # reason, if we set the COLLECT_NAMES environment variable, the problems
+ # vanish in a puff of smoke.
+ if test "X${COLLECT_NAMES+set}" != Xset; then
+ COLLECT_NAMES=
+ export COLLECT_NAMES
+ fi
+ ;;
+esac
+
+# Sed substitution that helps us do robust quoting. It backslashifies
+# metacharacters that are still active within double-quoted strings.
+Xsed='sed -e 1s/^X//'
+[sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g']
+
+# Same as above, but do not quote variable references.
+[double_quote_subst='s/\([\\"\\`\\\\]\)/\\\1/g']
+
+# Sed substitution to delay expansion of an escaped shell variable in a
+# double_quote_subst'ed string.
+delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g'
+
+# Sed substitution to avoid accidental globbing in evaled expressions
+no_glob_subst='s/\*/\\\*/g'
+
+# Constants:
+rm="rm -f"
+
+# Global variables:
+default_ofile=libtool
+can_build_shared=yes
+
+# All known linkers require a `.a' archive for static linking (except MSVC,
+# which needs '.lib').
+libext=a
+ltmain="$ac_aux_dir/ltmain.sh"
+ofile="$default_ofile"
+with_gnu_ld="$lt_cv_prog_gnu_ld"
+
+AC_CHECK_TOOL(AR, ar, false)
+AC_CHECK_TOOL(RANLIB, ranlib, :)
+AC_CHECK_TOOL(STRIP, strip, :)
+
+old_CC="$CC"
+old_CFLAGS="$CFLAGS"
+
+# Set sane defaults for various variables
+test -z "$AR" && AR=ar
+test -z "$AR_FLAGS" && AR_FLAGS=cru
+test -z "$AS" && AS=as
+test -z "$CC" && CC=cc
+test -z "$LTCC" && LTCC=$CC
+test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS
+test -z "$DLLTOOL" && DLLTOOL=dlltool
+test -z "$LD" && LD=ld
+test -z "$LN_S" && LN_S="ln -s"
+test -z "$MAGIC_CMD" && MAGIC_CMD=file
+test -z "$NM" && NM=nm
+test -z "$SED" && SED=sed
+test -z "$OBJDUMP" && OBJDUMP=objdump
+test -z "$RANLIB" && RANLIB=:
+test -z "$STRIP" && STRIP=:
+test -z "$ac_objext" && ac_objext=o
+
+# Determine commands to create old-style static archives.
+old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs$old_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
+])# AC_LIBTOOL_SETUP
+
+
+# _LT_AC_SYS_COMPILER
+# -------------------
+AC_DEFUN([_LT_AC_SYS_COMPILER],
+[AC_REQUIRE([AC_PROG_CC])dnl
+
+# If no C compiler was specified, use CC.
+LTCC=${LTCC-"$CC"}
+
+# If no C compiler flags were specified, use CFLAGS.
+LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
+
+# Allow CC to be a program name with arguments.
+compiler=$CC
+])# _LT_AC_SYS_COMPILER
+
+
+# _LT_CC_BASENAME(CC)
+# -------------------
+# Calculate cc_basename. Skip known compiler wrappers and cross-prefix.
+AC_DEFUN([_LT_CC_BASENAME],
+[for cc_temp in $1""; do
+ case $cc_temp in
+ compile | *[[\\/]]compile | ccache | *[[\\/]]ccache ) ;;
+ distcc | *[[\\/]]distcc | purify | *[[\\/]]purify ) ;;
+ \-*) ;;
+ *) break;;
+ esac
+done
+cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"`
+])
+
+
+# _LT_COMPILER_BOILERPLATE
+# ------------------------
+# Check for compiler boilerplate output or warnings with
+# the simple compiler test code.
+AC_DEFUN([_LT_COMPILER_BOILERPLATE],
+[ac_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
+# 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 <<EOF
+[$]*
+EOF
+ exit 0
+fi
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+if test -z "$ECHO"; then
+if test "X${echo_test_string+set}" != Xset; then
+# find a string as large as possible, as long as the shell can cope with it
+ for cmd in 'sed 50q "[$]0"' 'sed 20q "[$]0"' 'sed 10q "[$]0"' 'sed 2q "[$]0"' 'echo test'; do
+ # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ...
+ if (echo_test_string=`eval $cmd`) 2>/dev/null &&
+ echo_test_string=`eval $cmd` &&
+ (test "X$echo_test_string" = "X$echo_test_string") 2>/dev/null
+ then
+ break
+ fi
+ done
+fi
+
+if test "X`($echo '\t') 2>/dev/null`" = 'X\t' &&
+ echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` &&
+ test "X$echo_testing_string" = "X$echo_test_string"; then
+ :
+else
+ # The Solaris, AIX, and Digital Unix default echo programs unquote
+ # backslashes. This makes it impossible to quote backslashes using
+ # echo "$something" | sed 's/\\/\\\\/g'
+ #
+ # So, first we look for a working echo in the user's PATH.
+
+ lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+ for dir in $PATH /usr/ucb; do
+ IFS="$lt_save_ifs"
+ if (test -f $dir/echo || test -f $dir/echo$ac_exeext) &&
+ test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' &&
+ echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` &&
+ test "X$echo_testing_string" = "X$echo_test_string"; then
+ echo="$dir/echo"
+ break
+ fi
+ done
+ IFS="$lt_save_ifs"
+
+ if test "X$echo" = Xecho; then
+ # We didn't find a better echo, so look for alternatives.
+ if test "X`(print -r '\t') 2>/dev/null`" = 'X\t' &&
+ echo_testing_string=`(print -r "$echo_test_string") 2>/dev/null` &&
+ test "X$echo_testing_string" = "X$echo_test_string"; then
+ # This shell has a builtin print -r that does the trick.
+ echo='print -r'
+ elif (test -f /bin/ksh || test -f /bin/ksh$ac_exeext) &&
+ test "X$CONFIG_SHELL" != X/bin/ksh; then
+ # If we have ksh, try running configure again with it.
+ ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
+ export ORIGINAL_CONFIG_SHELL
+ CONFIG_SHELL=/bin/ksh
+ export CONFIG_SHELL
+ exec $CONFIG_SHELL "[$]0" --no-reexec ${1+"[$]@"}
+ else
+ # Try using printf.
+ echo='printf %s\n'
+ if test "X`($echo '\t') 2>/dev/null`" = 'X\t' &&
+ echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` &&
+ test "X$echo_testing_string" = "X$echo_test_string"; then
+ # Cool, printf works
+ :
+ elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` &&
+ test "X$echo_testing_string" = 'X\t' &&
+ echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` &&
+ test "X$echo_testing_string" = "X$echo_test_string"; then
+ CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL
+ export CONFIG_SHELL
+ SHELL="$CONFIG_SHELL"
+ export SHELL
+ echo="$CONFIG_SHELL [$]0 --fallback-echo"
+ elif echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` &&
+ test "X$echo_testing_string" = 'X\t' &&
+ echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` &&
+ test "X$echo_testing_string" = "X$echo_test_string"; then
+ echo="$CONFIG_SHELL [$]0 --fallback-echo"
+ else
+ # maybe with a smaller string...
+ prev=:
+
+ for cmd in 'echo test' 'sed 2q "[$]0"' 'sed 10q "[$]0"' 'sed 20q "[$]0"' 'sed 50q "[$]0"'; do
+ if (test "X$echo_test_string" = "X`eval $cmd`") 2>/dev/null
+ then
+ break
+ fi
+ prev="$cmd"
+ done
+
+ if test "$prev" != 'sed 50q "[$]0"'; then
+ echo_test_string=`eval $prev`
+ export echo_test_string
+ exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "[$]0" ${1+"[$]@"}
+ else
+ # Oops. We lost completely, so just stick with echo.
+ echo=echo
+ fi
+ fi
+ fi
+ fi
+fi
+fi
+
+# Copy echo and quote the copy suitably for passing to libtool from
+# the Makefile, instead of quoting the original, which is used later.
+ECHO=$echo
+if test "X$ECHO" = "X$CONFIG_SHELL [$]0 --fallback-echo"; then
+ ECHO="$CONFIG_SHELL \\\$\[$]0 --fallback-echo"
+fi
+
+AC_SUBST(ECHO)
+])])# _LT_AC_PROG_ECHO_BACKSLASH
+
+
+# _LT_AC_LOCK
+# -----------
+AC_DEFUN([_LT_AC_LOCK],
+[AC_ARG_ENABLE([libtool-lock],
+ [AC_HELP_STRING([--disable-libtool-lock],
+ [avoid locking (might break parallel builds)])])
+test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes
+
+# Some flags need to be propagated to the compiler or linker for good
+# libtool support.
+case $host in
+ia64-*-hpux*)
+ # Find out which ABI we are using.
+ echo 'int i;' > conftest.$ac_ext
+ if AC_TRY_EVAL(ac_compile); then
+ case `/usr/bin/file conftest.$ac_objext` in
+ *ELF-32*)
+ HPUX_IA64_MODE="32"
+ ;;
+ *ELF-64*)
+ HPUX_IA64_MODE="64"
+ ;;
+ esac
+ fi
+ rm -rf conftest*
+ ;;
+*-*-irix6*)
+ # Find out which ABI we are using.
+ echo '[#]line __oline__ "configure"' > conftest.$ac_ext
+ if AC_TRY_EVAL(ac_compile); then
+ if test "$lt_cv_prog_gnu_ld" = yes; then
+ case `/usr/bin/file conftest.$ac_objext` in
+ *32-bit*)
+ LD="${LD-ld} -melf32bsmip"
+ ;;
+ *N32*)
+ LD="${LD-ld} -melf32bmipn32"
+ ;;
+ *64-bit*)
+ LD="${LD-ld} -melf64bmip"
+ ;;
+ esac
+ else
+ case `/usr/bin/file conftest.$ac_objext` in
+ *32-bit*)
+ LD="${LD-ld} -32"
+ ;;
+ *N32*)
+ LD="${LD-ld} -n32"
+ ;;
+ *64-bit*)
+ LD="${LD-ld} -64"
+ ;;
+ esac
+ fi
+ fi
+ rm -rf conftest*
+ ;;
+
+x86_64-*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"
+
+])# _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}\{0,1\} :&$lt_compiler_flag :; t' \
+ -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \
+ -e 's:$: $lt_compiler_flag:'`
+ (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD)
+ (eval "$lt_compile" 2>conftest.err)
+ ac_status=$?
+ cat conftest.err >&AS_MESSAGE_LOG_FD
+ echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
+ if (exit $ac_status) && test -s "$ac_outfile"; then
+ # The compiler can only warn and ignore the option if not recognized
+ # So say no if there are warnings other than the usual output.
+ $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp
+ $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+ if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
+ $2=yes
+ fi
+ fi
+ $rm conftest*
+])
+
+if test x"[$]$2" = xyes; then
+ ifelse([$5], , :, [$5])
+else
+ ifelse([$6], , :, [$6])
+fi
+])# AC_LIBTOOL_COMPILER_OPTION
+
+
+# AC_LIBTOOL_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS,
+# [ACTION-SUCCESS], [ACTION-FAILURE])
+# ------------------------------------------------------------
+# Check whether the given compiler option works
+AC_DEFUN([AC_LIBTOOL_LINKER_OPTION],
+[AC_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
+])# AC_LIBTOOL_LINKER_OPTION
+
+
+# AC_LIBTOOL_SYS_MAX_CMD_LEN
+# --------------------------
+AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN],
+[# find the maximum length of command line arguments
+AC_MSG_CHECKING([the maximum length of command line arguments])
+AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl
+ i=0
+ teststring="ABCD"
+
+ case $build_os in
+ msdosdjgpp*)
+ # On DJGPP, this test can blow up pretty badly due to problems in libc
+ # (any single argument exceeding 2000 bytes causes a buffer overrun
+ # during glob expansion). Even if it were fixed, the result of this
+ # check would be larger than it should be.
+ lt_cv_sys_max_cmd_len=12288; # 12K is about right
+ ;;
+
+ gnu*)
+ # Under GNU Hurd, this test is not required because there is
+ # no limit to the length of command line arguments.
+ # Libtool will interpret -1 as no limit whatsoever
+ lt_cv_sys_max_cmd_len=-1;
+ ;;
+
+ cygwin* | mingw*)
+ # On Win9x/ME, this test blows up -- it succeeds, but takes
+ # about 5 minutes as the teststring grows exponentially.
+ # Worse, since 9x/ME are not pre-emptively multitasking,
+ # you end up with a "frozen" computer, even though with patience
+ # the test eventually succeeds (with a max line length of 256k).
+ # Instead, let's just punt: use the minimum linelength reported by
+ # all of the supported platforms: 8192 (on NT/2K/XP).
+ lt_cv_sys_max_cmd_len=8192;
+ ;;
+
+ amigaos*)
+ # On AmigaOS with pdksh, this test takes hours, literally.
+ # So we just punt and use a minimum line length of 8192.
+ lt_cv_sys_max_cmd_len=8192;
+ ;;
+
+ netbsd* | freebsd* | openbsd* | darwin* | dragonfly*)
+ # This has been around since 386BSD, at least. Likely further.
+ if test -x /sbin/sysctl; then
+ lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax`
+ elif test -x /usr/sbin/sysctl; then
+ lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax`
+ else
+ lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs
+ fi
+ # And add a safety zone
+ lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
+ lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3`
+ ;;
+
+ interix*)
+ # We know the value 262144 and hardcode it with a safety zone (like BSD)
+ lt_cv_sys_max_cmd_len=196608
+ ;;
+
+ osf*)
+ # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure
+ # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not
+ # nice to cause kernel panics so lets avoid the loop below.
+ # First set a reasonable default.
+ lt_cv_sys_max_cmd_len=16384
+ #
+ if test -x /sbin/sysconfig; then
+ case `/sbin/sysconfig -q proc exec_disable_arg_limit` in
+ *1*) lt_cv_sys_max_cmd_len=-1 ;;
+ esac
+ fi
+ ;;
+ sco3.2v5*)
+ lt_cv_sys_max_cmd_len=102400
+ ;;
+ sysv5* | sco5v6* | sysv4.2uw2*)
+ kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null`
+ if test -n "$kargmax"; then
+ lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[[ ]]//'`
+ else
+ lt_cv_sys_max_cmd_len=32768
+ fi
+ ;;
+ *)
+ # 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
+])# 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 <<EOF
+[#line __oline__ "configure"
+#include "confdefs.h"
+
+#if HAVE_DLFCN_H
+#include <dlfcn.h>
+#endif
+
+#include <stdio.h>
+
+#ifdef RTLD_GLOBAL
+# define LT_DLGLOBAL RTLD_GLOBAL
+#else
+# ifdef DL_GLOBAL
+# define LT_DLGLOBAL DL_GLOBAL
+# else
+# define LT_DLGLOBAL 0
+# endif
+#endif
+
+/* We may have to define LT_DLLAZY_OR_NOW in the command line if we
+ find out it does not work in some platform. */
+#ifndef LT_DLLAZY_OR_NOW
+# ifdef RTLD_LAZY
+# define LT_DLLAZY_OR_NOW RTLD_LAZY
+# else
+# ifdef DL_LAZY
+# define LT_DLLAZY_OR_NOW DL_LAZY
+# else
+# ifdef RTLD_NOW
+# define LT_DLLAZY_OR_NOW RTLD_NOW
+# else
+# ifdef DL_NOW
+# define LT_DLLAZY_OR_NOW DL_NOW
+# else
+# define LT_DLLAZY_OR_NOW 0
+# endif
+# endif
+# endif
+# endif
+#endif
+
+#ifdef __cplusplus
+extern "C" void exit (int);
+#endif
+
+void fnord() { int i=42;}
+int main ()
+{
+ void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
+ int status = $lt_dlunknown;
+
+ if (self)
+ {
+ if (dlsym (self,"fnord")) status = $lt_dlno_uscore;
+ else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore;
+ /* dlclose (self); */
+ }
+ else
+ puts (dlerror ());
+
+ exit (status);
+}]
+EOF
+ if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then
+ (./conftest; exit; ) >&AS_MESSAGE_LOG_FD 2>/dev/null
+ lt_status=$?
+ case x$lt_status in
+ x$lt_dlno_uscore) $1 ;;
+ x$lt_dlneed_uscore) $2 ;;
+ x$lt_dlunknown|x*) $3 ;;
+ esac
+ else :
+ # compilation failed
+ $3
+ fi
+fi
+rm -fr conftest*
+])# _LT_AC_TRY_DLOPEN_SELF
+
+
+# AC_LIBTOOL_DLOPEN_SELF
+# ----------------------
+AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF],
+[AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl
+if test "x$enable_dlopen" != xyes; then
+ enable_dlopen=unknown
+ enable_dlopen_self=unknown
+ enable_dlopen_self_static=unknown
+else
+ lt_cv_dlopen=no
+ lt_cv_dlopen_libs=
+
+ case $host_os in
+ beos*)
+ lt_cv_dlopen="load_add_on"
+ lt_cv_dlopen_libs=
+ lt_cv_dlopen_self=yes
+ ;;
+
+ mingw* | pw32*)
+ lt_cv_dlopen="LoadLibrary"
+ lt_cv_dlopen_libs=
+ ;;
+
+ cygwin*)
+ lt_cv_dlopen="dlopen"
+ lt_cv_dlopen_libs=
+ ;;
+
+ darwin*)
+ # if libdl is installed we need to link against it
+ AC_CHECK_LIB([dl], [dlopen],
+ [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],[
+ lt_cv_dlopen="dyld"
+ lt_cv_dlopen_libs=
+ lt_cv_dlopen_self=yes
+ ])
+ ;;
+
+ *)
+ AC_CHECK_FUNC([shl_load],
+ [lt_cv_dlopen="shl_load"],
+ [AC_CHECK_LIB([dld], [shl_load],
+ [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-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
+])# 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}\{0,1\} :&$lt_compiler_flag :; t' \
+ -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \
+ -e 's:$: $lt_compiler_flag:'`
+ (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD)
+ (eval "$lt_compile" 2>out/conftest.err)
+ ac_status=$?
+ cat out/conftest.err >&AS_MESSAGE_LOG_FD
+ echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
+ if (exit $ac_status) && test -s out/conftest2.$ac_objext
+ then
+ # The compiler can only warn and ignore the option if not recognized
+ # So say no if there are warnings
+ $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp
+ $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
+ if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
+ _LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes
+ fi
+ fi
+ chmod u+w . 2>&AS_MESSAGE_LOG_FD
+ $rm conftest*
+ # SGI C++ compiler will create directory out/ii_files/ for
+ # template instantiation
+ test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files
+ $rm out/* && rmdir out
+ cd ..
+ rmdir conftest
+ $rm conftest*
+])
+])# AC_LIBTOOL_PROG_CC_C_O
+
+
+# AC_LIBTOOL_SYS_HARD_LINK_LOCKS([TAGNAME])
+# -----------------------------------------
+# Check to see if we can do hard links to lock some files if needed
+AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS],
+[AC_REQUIRE([_LT_AC_LOCK])dnl
+
+hard_links="nottested"
+if test "$_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)" = no && test "$need_locks" != no; then
+ # do not overwrite the value of need_locks provided by the user
+ AC_MSG_CHECKING([if we can lock with hard links])
+ hard_links=yes
+ $rm conftest*
+ ln conftest.a conftest.b 2>/dev/null && hard_links=no
+ touch conftest.a
+ ln conftest.a conftest.b 2>&5 || hard_links=no
+ ln conftest.a conftest.b 2>/dev/null && hard_links=no
+ AC_MSG_RESULT([$hard_links])
+ if test "$hard_links" = no; then
+ AC_MSG_WARN([`$CC' does not support `-c -o', so `make -j' may be unsafe])
+ need_locks=warn
+ fi
+else
+ need_locks=no
+fi
+])# AC_LIBTOOL_SYS_HARD_LINK_LOCKS
+
+
+# AC_LIBTOOL_OBJDIR
+# -----------------
+AC_DEFUN([AC_LIBTOOL_OBJDIR],
+[AC_CACHE_CHECK([for objdir], [lt_cv_objdir],
+[rm -f .libs 2>/dev/null
+mkdir .libs 2>/dev/null
+if test -d .libs; then
+ lt_cv_objdir=.libs
+else
+ # MS-DOS does not allow filenames that begin with a dot.
+ lt_cv_objdir=_libs
+fi
+rmdir .libs 2>/dev/null])
+objdir=$lt_cv_objdir
+])# AC_LIBTOOL_OBJDIR
+
+
+# AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH([TAGNAME])
+# ----------------------------------------------
+# Check hardcoding attributes.
+AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH],
+[AC_MSG_CHECKING([how to hardcode library paths into programs])
+_LT_AC_TAGVAR(hardcode_action, $1)=
+if test -n "$_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)" || \
+ test -n "$_LT_AC_TAGVAR(runpath_var, $1)" || \
+ test "X$_LT_AC_TAGVAR(hardcode_automatic, $1)" = "Xyes" ; then
+
+ # We can hardcode non-existant directories.
+ if test "$_LT_AC_TAGVAR(hardcode_direct, $1)" != no &&
+ # If the only mechanism to avoid hardcoding is shlibpath_var, we
+ # have to relink, otherwise we might link with an installed library
+ # when we should be linking with a yet-to-be-installed one
+ ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, $1)" != no &&
+ test "$_LT_AC_TAGVAR(hardcode_minus_L, $1)" != no; then
+ # Linking always hardcodes the temporary library directory.
+ _LT_AC_TAGVAR(hardcode_action, $1)=relink
+ else
+ # We can link without hardcoding, and we can hardcode nonexisting dirs.
+ _LT_AC_TAGVAR(hardcode_action, $1)=immediate
+ fi
+else
+ # We cannot hardcode anything, or else we can only hardcode existing
+ # directories.
+ _LT_AC_TAGVAR(hardcode_action, $1)=unsupported
+fi
+AC_MSG_RESULT([$_LT_AC_TAGVAR(hardcode_action, $1)])
+
+if test "$_LT_AC_TAGVAR(hardcode_action, $1)" = relink; then
+ # Fast installation is not supported
+ enable_fast_install=no
+elif test "$shlibpath_overrides_runpath" = yes ||
+ test "$enable_shared" = no; then
+ # Fast installation is not necessary
+ enable_fast_install=needless
+fi
+])# AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH
+
+
+# AC_LIBTOOL_SYS_LIB_STRIP
+# ------------------------
+AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP],
+[striplib=
+old_striplib=
+AC_MSG_CHECKING([whether stripping libraries is possible])
+if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then
+ test -z "$old_striplib" && old_striplib="$STRIP --strip-debug"
+ test -z "$striplib" && striplib="$STRIP --strip-unneeded"
+ AC_MSG_RESULT([yes])
+else
+# FIXME - insert some real tests, host_os isn't really good enough
+ case $host_os in
+ darwin*)
+ if test -n "$STRIP" ; then
+ striplib="$STRIP -x"
+ 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<name>.so
+ # instead of lib<name>.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
+])# 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
+ if test -z "$LTCFLAGS"; then
+ eval "`$SHELL ${ofile} --config | grep '^LTCFLAGS='`"
+ fi
+
+ # Extract list of available tagged configurations in $ofile.
+ # Note that this assumes the entire list is on one line.
+ available_tags=`grep "^available_tags=" "${ofile}" | $SED -e 's/available_tags=\(.*$\)/\1/' -e 's/\"//g'`
+
+ lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+ for tagname in $tagnames; do
+ IFS="$lt_save_ifs"
+ # Check whether tagname contains only valid characters
+ case `$echo "X$tagname" | $Xsed -e 's:[[-_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890,/]]::g'` in
+ "") ;;
+ *) AC_MSG_ERROR([invalid tag name: $tagname])
+ ;;
+ esac
+
+ if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "${ofile}" > /dev/null
+ then
+ AC_MSG_ERROR([tag name \"$tagname\" already exists])
+ fi
+
+ # Update the list of available tags.
+ if test -n "$tagname"; then
+ echo appending configuration tag \"$tagname\" to $ofile
+
+ case $tagname in
+ CXX)
+ if test -n "$CXX" && ( test "X$CXX" != "Xno" &&
+ ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) ||
+ (test "X$CXX" != "Xg++"))) ; then
+ AC_LIBTOOL_LANG_CXX_CONFIG
+ else
+ tagname=""
+ fi
+ ;;
+
+ F77)
+ if test -n "$F77" && test "X$F77" != "Xno"; then
+ AC_LIBTOOL_LANG_F77_CONFIG
+ else
+ tagname=""
+ fi
+ ;;
+
+ GCJ)
+ if test -n "$GCJ" && test "X$GCJ" != "Xno"; then
+ AC_LIBTOOL_LANG_GCJ_CONFIG
+ else
+ tagname=""
+ fi
+ ;;
+
+ RC)
+ AC_LIBTOOL_LANG_RC_CONFIG
+ ;;
+
+ *)
+ AC_MSG_ERROR([Unsupported tag name: $tagname])
+ ;;
+ esac
+
+ # Append the new tag name to the list of available tags.
+ if test -n "$tagname" ; then
+ available_tags="$available_tags $tagname"
+ fi
+ fi
+ done
+ IFS="$lt_save_ifs"
+
+ # Now substitute the updated list of available tags.
+ if eval "sed -e 's/^available_tags=.*\$/available_tags=\"$available_tags\"/' \"$ofile\" > \"${ofile}T\""; then
+ mv "${ofile}T" "$ofile"
+ chmod +x "$ofile"
+ else
+ rm -f "${ofile}T"
+ AC_MSG_ERROR([unable to update list of available tagged configurations.])
+ fi
+fi
+])# _LT_AC_TAGCONFIG
+
+
+# AC_LIBTOOL_DLOPEN
+# -----------------
+# enable checks for dlopen support
+AC_DEFUN([AC_LIBTOOL_DLOPEN],
+ [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])
+])# AC_LIBTOOL_DLOPEN
+
+
+# AC_LIBTOOL_WIN32_DLL
+# --------------------
+# declare package support for building win32 DLLs
+AC_DEFUN([AC_LIBTOOL_WIN32_DLL],
+[AC_BEFORE([$0], [AC_LIBTOOL_SETUP])
+])# AC_LIBTOOL_WIN32_DLL
+
+
+# AC_ENABLE_SHARED([DEFAULT])
+# ---------------------------
+# implement the --enable-shared flag
+# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'.
+AC_DEFUN([AC_ENABLE_SHARED],
+[define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl
+AC_ARG_ENABLE([shared],
+ [AC_HELP_STRING([--enable-shared@<:@=PKGS@:>@],
+ [build shared libraries @<:@default=]AC_ENABLE_SHARED_DEFAULT[@:>@])],
+ [p=${PACKAGE-default}
+ case $enableval in
+ yes) enable_shared=yes ;;
+ no) enable_shared=no ;;
+ *)
+ enable_shared=no
+ # Look at the argument we got. We use all the common list separators.
+ lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+ for pkg in $enableval; do
+ IFS="$lt_save_ifs"
+ if test "X$pkg" = "X$p"; then
+ enable_shared=yes
+ fi
+ done
+ IFS="$lt_save_ifs"
+ ;;
+ esac],
+ [enable_shared=]AC_ENABLE_SHARED_DEFAULT)
+])# AC_ENABLE_SHARED
+
+
+# AC_DISABLE_SHARED
+# -----------------
+# set the default shared flag to --disable-shared
+AC_DEFUN([AC_DISABLE_SHARED],
+[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+AC_ENABLE_SHARED(no)
+])# AC_DISABLE_SHARED
+
+
+# AC_ENABLE_STATIC([DEFAULT])
+# ---------------------------
+# implement the --enable-static flag
+# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'.
+AC_DEFUN([AC_ENABLE_STATIC],
+[define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl
+AC_ARG_ENABLE([static],
+ [AC_HELP_STRING([--enable-static@<:@=PKGS@:>@],
+ [build static libraries @<:@default=]AC_ENABLE_STATIC_DEFAULT[@:>@])],
+ [p=${PACKAGE-default}
+ case $enableval in
+ yes) enable_static=yes ;;
+ no) enable_static=no ;;
+ *)
+ enable_static=no
+ # Look at the argument we got. We use all the common list separators.
+ lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+ for pkg in $enableval; do
+ IFS="$lt_save_ifs"
+ if test "X$pkg" = "X$p"; then
+ enable_static=yes
+ fi
+ done
+ IFS="$lt_save_ifs"
+ ;;
+ esac],
+ [enable_static=]AC_ENABLE_STATIC_DEFAULT)
+])# AC_ENABLE_STATIC
+
+
+# AC_DISABLE_STATIC
+# -----------------
+# set the default static flag to --disable-static
+AC_DEFUN([AC_DISABLE_STATIC],
+[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+AC_ENABLE_STATIC(no)
+])# AC_DISABLE_STATIC
+
+
+# AC_ENABLE_FAST_INSTALL([DEFAULT])
+# ---------------------------------
+# implement the --enable-fast-install flag
+# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'.
+AC_DEFUN([AC_ENABLE_FAST_INSTALL],
+[define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl
+AC_ARG_ENABLE([fast-install],
+ [AC_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@],
+ [optimize for fast installation @<:@default=]AC_ENABLE_FAST_INSTALL_DEFAULT[@:>@])],
+ [p=${PACKAGE-default}
+ case $enableval in
+ yes) enable_fast_install=yes ;;
+ no) enable_fast_install=no ;;
+ *)
+ enable_fast_install=no
+ # Look at the argument we got. We use all the common list separators.
+ lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+ for pkg in $enableval; do
+ IFS="$lt_save_ifs"
+ if test "X$pkg" = "X$p"; then
+ enable_fast_install=yes
+ fi
+ done
+ IFS="$lt_save_ifs"
+ ;;
+ esac],
+ [enable_fast_install=]AC_ENABLE_FAST_INSTALL_DEFAULT)
+])# AC_ENABLE_FAST_INSTALL
+
+
+# AC_DISABLE_FAST_INSTALL
+# -----------------------
+# set the default to --disable-fast-install
+AC_DEFUN([AC_DISABLE_FAST_INSTALL],
+[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+AC_ENABLE_FAST_INSTALL(no)
+])# AC_DISABLE_FAST_INSTALL
+
+
+# AC_LIBTOOL_PICMODE([MODE])
+# --------------------------
+# implement the --with-pic flag
+# MODE is either `yes' or `no'. If omitted, it defaults to `both'.
+AC_DEFUN([AC_LIBTOOL_PICMODE],
+[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+pic_mode=ifelse($#,1,$1,default)
+])# AC_LIBTOOL_PICMODE
+
+
+# AC_PROG_EGREP
+# -------------
+# This is predefined starting with Autoconf 2.54, so this conditional
+# definition can be removed once we require Autoconf 2.54 or later.
+m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP],
+[AC_CACHE_CHECK([for egrep], [ac_cv_prog_egrep],
+ [if echo a | (grep -E '(a|b)') >/dev/null 2>&1
+ then ac_cv_prog_egrep='grep -E'
+ else ac_cv_prog_egrep='egrep'
+ fi])
+ EGREP=$ac_cv_prog_egrep
+ AC_SUBST([EGREP])
+])])
+
+
+# AC_PATH_TOOL_PREFIX
+# -------------------
+# find a file program which can 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 <<EOF 1>&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 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 </dev/null` in
+ *GNU* | *'with BFD'*)
+ test "$with_gnu_ld" != no && break
+ ;;
+ *)
+ test "$with_gnu_ld" != yes && break
+ ;;
+ esac
+ fi
+ done
+ IFS="$lt_save_ifs"
+else
+ lt_cv_path_LD="$LD" # Let the user override the test with a path.
+fi])
+LD="$lt_cv_path_LD"
+if test -n "$LD"; then
+ AC_MSG_RESULT($LD)
+else
+ AC_MSG_RESULT(no)
+fi
+test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
+AC_PROG_LD_GNU
+])# AC_PROG_LD
+
+
+# AC_PROG_LD_GNU
+# --------------
+AC_DEFUN([AC_PROG_LD_GNU],
+[AC_REQUIRE([AC_PROG_EGREP])dnl
+AC_CACHE_CHECK([if the linker ($LD) is GNU ld], lt_cv_prog_gnu_ld,
+[# I'd rather use --version here, but apparently some GNU lds only accept -v.
+case `$LD -v 2>&1 </dev/null` in
+*GNU* | *'with BFD'*)
+ lt_cv_prog_gnu_ld=yes
+ ;;
+*)
+ lt_cv_prog_gnu_ld=no
+ ;;
+esac])
+with_gnu_ld=$lt_cv_prog_gnu_ld
+])# AC_PROG_LD_GNU
+
+
+# AC_PROG_LD_RELOAD_FLAG
+# ----------------------
+# find reload flag for linker
+# -- PORTME Some linkers may need a different reload flag.
+AC_DEFUN([AC_PROG_LD_RELOAD_FLAG],
+[AC_CACHE_CHECK([for $LD option to reload object files],
+ lt_cv_ld_reload_flag,
+ [lt_cv_ld_reload_flag='-r'])
+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
+])# AC_PROG_LD_RELOAD_FLAG
+
+
+# AC_DEPLIBS_CHECK_METHOD
+# -----------------------
+# how to check for library dependencies
+# -- PORTME fill in with the dynamic library characteristics
+AC_DEFUN([AC_DEPLIBS_CHECK_METHOD],
+[AC_CACHE_CHECK([how to recognise dependent libraries],
+lt_cv_deplibs_check_method,
+[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
+])
+file_magic_cmd=$lt_cv_file_magic_cmd
+deplibs_check_method=$lt_cv_deplibs_check_method
+test -z "$deplibs_check_method" && deplibs_check_method=unknown
+])# AC_DEPLIBS_CHECK_METHOD
+
+
+# AC_PROG_NM
+# ----------
+# find the pathname to a BSD-compatible name lister
+AC_DEFUN([AC_PROG_NM],
+[AC_CACHE_CHECK([for BSD-compatible nm], lt_cv_path_NM,
+[if test -n "$NM"; then
+ # Let the user override the test.
+ lt_cv_path_NM="$NM"
+else
+ lt_nm_to_check="${ac_tool_prefix}nm"
+ if test -n "$ac_tool_prefix" && test "$build" = "$host"; then
+ lt_nm_to_check="$lt_nm_to_check nm"
+ fi
+ for lt_tmp_nm in $lt_nm_to_check; do
+ lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+ for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do
+ IFS="$lt_save_ifs"
+ test -z "$ac_dir" && ac_dir=.
+ tmp_nm="$ac_dir/$lt_tmp_nm"
+ if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then
+ # Check to see if the nm accepts a BSD-compat flag.
+ # Adding the `sed 1q' prevents false positives on HP-UX, which says:
+ # nm: unknown option "B" ignored
+ # Tru64's nm complains that /dev/null is an invalid object file
+ case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in
+ */dev/null* | *'Invalid file or object type'*)
+ lt_cv_path_NM="$tmp_nm -B"
+ break
+ ;;
+ *)
+ case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in
+ */dev/null*)
+ lt_cv_path_NM="$tmp_nm -p"
+ break
+ ;;
+ *)
+ lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but
+ continue # so that we can try to find one that supports BSD flags
+ ;;
+ esac
+ ;;
+ esac
+ fi
+ done
+ IFS="$lt_save_ifs"
+ done
+ test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm
+fi])
+NM="$lt_cv_path_NM"
+])# AC_PROG_NM
+
+
+# AC_CHECK_LIBM
+# -------------
+# check for math library
+AC_DEFUN([AC_CHECK_LIBM],
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+LIBM=
+case $host in
+*-*-beos* | *-*-cygwin* | *-*-pw32* | *-*-darwin*)
+ # These system don't have libm, or don't need it
+ ;;
+*-ncr-sysv4.3*)
+ AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw")
+ AC_CHECK_LIB(m, cos, LIBM="$LIBM -lm")
+ ;;
+*)
+ AC_CHECK_LIB(m, cos, LIBM="-lm")
+ ;;
+esac
+])# AC_CHECK_LIBM
+
+
+# AC_LIBLTDL_CONVENIENCE([DIRECTORY])
+# -----------------------------------
+# sets LIBLTDL to the link flags for the libltdl convenience library and
+# LTDLINCL to the include flags for the libltdl header and adds
+# --enable-ltdl-convenience to the configure arguments. Note that
+# AC_CONFIG_SUBDIRS is not called here. If DIRECTORY is not provided,
+# it is assumed to be `libltdl'. LIBLTDL will be prefixed with
+# '${top_builddir}/' and LTDLINCL will be prefixed with '${top_srcdir}/'
+# (note the single quotes!). If your package is not flat and you're not
+# using automake, define top_builddir and top_srcdir appropriately in
+# the Makefiles.
+AC_DEFUN([AC_LIBLTDL_CONVENIENCE],
+[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+ case $enable_ltdl_convenience in
+ no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;;
+ "") enable_ltdl_convenience=yes
+ ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;;
+ esac
+ LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdlc.la
+ LTDLINCL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl'])
+ # For backwards non-gettext consistent compatibility...
+ INCLTDL="$LTDLINCL"
+])# AC_LIBLTDL_CONVENIENCE
+
+
+# AC_LIBLTDL_INSTALLABLE([DIRECTORY])
+# -----------------------------------
+# sets LIBLTDL to the link flags for the libltdl installable library and
+# LTDLINCL to the include flags for the libltdl header and adds
+# --enable-ltdl-install to the configure arguments. Note that
+# AC_CONFIG_SUBDIRS is not called here. If DIRECTORY is not provided,
+# and an installed libltdl is not found, it is assumed to be `libltdl'.
+# LIBLTDL will be prefixed with '${top_builddir}/'# and LTDLINCL with
+# '${top_srcdir}/' (note the single quotes!). If your package is not
+# flat and you're not using automake, define top_builddir and top_srcdir
+# appropriately in the Makefiles.
+# In the future, this macro may have to be called after AC_PROG_LIBTOOL.
+AC_DEFUN([AC_LIBLTDL_INSTALLABLE],
+[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+ AC_CHECK_LIB(ltdl, lt_dlinit,
+ [test x"$enable_ltdl_install" != xyes && enable_ltdl_install=no],
+ [if test x"$enable_ltdl_install" = xno; then
+ AC_MSG_WARN([libltdl not installed, but installation disabled])
+ else
+ enable_ltdl_install=yes
+ fi
+ ])
+ if test x"$enable_ltdl_install" = x"yes"; then
+ ac_configure_args="$ac_configure_args --enable-ltdl-install"
+ LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdl.la
+ LTDLINCL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl'])
+ else
+ ac_configure_args="$ac_configure_args --enable-ltdl-install=no"
+ LIBLTDL="-lltdl"
+ LTDLINCL=
+ fi
+ # For backwards non-gettext consistent compatibility...
+ INCLTDL="$LTDLINCL"
+])# AC_LIBLTDL_INSTALLABLE
+
+
+# AC_LIBTOOL_CXX
+# --------------
+# enable support for C++ libraries
+AC_DEFUN([AC_LIBTOOL_CXX],
+[AC_REQUIRE([_LT_AC_LANG_CXX])
+])# AC_LIBTOOL_CXX
+
+
+# _LT_AC_LANG_CXX
+# ---------------
+AC_DEFUN([_LT_AC_LANG_CXX],
+[AC_REQUIRE([AC_PROG_CXX])
+AC_REQUIRE([_LT_AC_PROG_CXXCPP])
+_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}CXX])
+])# _LT_AC_LANG_CXX
+
+# _LT_AC_PROG_CXXCPP
+# ------------------
+AC_DEFUN([_LT_AC_PROG_CXXCPP],
+[
+AC_REQUIRE([AC_PROG_CXX])
+if test -n "$CXX" && ( test "X$CXX" != "Xno" &&
+ ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) ||
+ (test "X$CXX" != "Xg++"))) ; then
+ AC_PROG_CXXCPP
+fi
+])# _LT_AC_PROG_CXXCPP
+
+# AC_LIBTOOL_F77
+# --------------
+# enable support for Fortran 77 libraries
+AC_DEFUN([AC_LIBTOOL_F77],
+[AC_REQUIRE([_LT_AC_LANG_F77])
+])# AC_LIBTOOL_F77
+
+
+# _LT_AC_LANG_F77
+# ---------------
+AC_DEFUN([_LT_AC_LANG_F77],
+[AC_REQUIRE([AC_PROG_F77])
+_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}F77])
+])# _LT_AC_LANG_F77
+
+
+# AC_LIBTOOL_GCJ
+# --------------
+# enable support for GCJ libraries
+AC_DEFUN([AC_LIBTOOL_GCJ],
+[AC_REQUIRE([_LT_AC_LANG_GCJ])
+])# AC_LIBTOOL_GCJ
+
+
+# _LT_AC_LANG_GCJ
+# ---------------
+AC_DEFUN([_LT_AC_LANG_GCJ],
+[AC_PROVIDE_IFELSE([AC_PROG_GCJ],[],
+ [AC_PROVIDE_IFELSE([A][M_PROG_GCJ],[],
+ [AC_PROVIDE_IFELSE([LT_AC_PROG_GCJ],[],
+ [ifdef([AC_PROG_GCJ],[AC_REQUIRE([AC_PROG_GCJ])],
+ [ifdef([A][M_PROG_GCJ],[AC_REQUIRE([A][M_PROG_GCJ])],
+ [AC_REQUIRE([A][C_PROG_GCJ_OR_A][M_PROG_GCJ])])])])])])
+_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}GCJ])
+])# _LT_AC_LANG_GCJ
+
+
+# AC_LIBTOOL_RC
+# -------------
+# enable support for Windows resource files
+AC_DEFUN([AC_LIBTOOL_RC],
+[AC_REQUIRE([LT_AC_PROG_RC])
+_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}RC])
+])# AC_LIBTOOL_RC
+
+
+# AC_LIBTOOL_LANG_C_CONFIG
+# ------------------------
+# Ensure that the configuration vars for the C compiler are
+# suitably defined. Those variables are subsequently used by
+# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'.
+AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG], [_LT_AC_LANG_C_CONFIG])
+AC_DEFUN([_LT_AC_LANG_C_CONFIG],
+[lt_save_CC="$CC"
+AC_LANG_PUSH(C)
+
+# Source file extension for C test sources.
+ac_ext=c
+
+# Object file extension for compiled C test sources.
+objext=o
+_LT_AC_TAGVAR(objext, $1)=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="int some_variable = 0;\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
+
+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"
+])# AC_LIBTOOL_LANG_C_CONFIG
+
+
+# AC_LIBTOOL_LANG_CXX_CONFIG
+# --------------------------
+# Ensure that the configuration vars for the C compiler are
+# suitably defined. Those variables are subsequently used by
+# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'.
+AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG], [_LT_AC_LANG_CXX_CONFIG(CXX)])
+AC_DEFUN([_LT_AC_LANG_CXX_CONFIG],
+[AC_LANG_PUSH(C++)
+AC_REQUIRE([AC_PROG_CXX])
+AC_REQUIRE([_LT_AC_PROG_CXXCPP])
+
+_LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+_LT_AC_TAGVAR(allow_undefined_flag, $1)=
+_LT_AC_TAGVAR(always_export_symbols, $1)=no
+_LT_AC_TAGVAR(archive_expsym_cmds, $1)=
+_LT_AC_TAGVAR(export_dynamic_flag_spec, $1)=
+_LT_AC_TAGVAR(hardcode_direct, $1)=no
+_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)=
+_LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)=
+_LT_AC_TAGVAR(hardcode_libdir_separator, $1)=
+_LT_AC_TAGVAR(hardcode_minus_L, $1)=no
+_LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
+_LT_AC_TAGVAR(hardcode_automatic, $1)=no
+_LT_AC_TAGVAR(module_cmds, $1)=
+_LT_AC_TAGVAR(module_expsym_cmds, $1)=
+_LT_AC_TAGVAR(link_all_deplibs, $1)=unknown
+_LT_AC_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
+_LT_AC_TAGVAR(no_undefined_flag, $1)=
+_LT_AC_TAGVAR(whole_archive_flag_spec, $1)=
+_LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=no
+
+# Dependencies to place before and after the object being linked:
+_LT_AC_TAGVAR(predep_objects, $1)=
+_LT_AC_TAGVAR(postdep_objects, $1)=
+_LT_AC_TAGVAR(predeps, $1)=
+_LT_AC_TAGVAR(postdeps, $1)=
+_LT_AC_TAGVAR(compiler_lib_search_path, $1)=
+
+# 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 <jrb3@best.com> 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"
+
+AC_LIBTOOL_POSTDEP_PREDEP($1)
+AC_LIBTOOL_PROG_COMPILER_PIC($1)
+AC_LIBTOOL_PROG_CC_C_O($1)
+AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1)
+AC_LIBTOOL_PROG_LD_SHLIBS($1)
+AC_LIBTOOL_SYS_DYNAMIC_LINKER($1)
+AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1)
+
+AC_LIBTOOL_CONFIG($1)
+
+AC_LANG_POP
+CC=$lt_save_CC
+LDCXX=$LD
+LD=$lt_save_LD
+GCC=$lt_save_GCC
+with_gnu_ldcxx=$with_gnu_ld
+with_gnu_ld=$lt_save_with_gnu_ld
+lt_cv_path_LDCXX=$lt_cv_path_LD
+lt_cv_path_LD=$lt_save_path_LD
+lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld
+lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld
+])# AC_LIBTOOL_LANG_CXX_CONFIG
+
+# AC_LIBTOOL_POSTDEP_PREDEP([TAGNAME])
+# ------------------------------------
+# Figure out "hidden" library dependencies from verbose
+# compiler output when linking a shared library.
+# Parse the compiler output and extract the necessary
+# objects, libraries and library flags.
+AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP],[
+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 <<EOF
+int a;
+void foo (void) { a = 0; }
+EOF
+],[$1],[CXX],[cat > conftest.$ac_ext <<EOF
+class Foo
+{
+public:
+ Foo (void) { a = 0; }
+private:
+ int a;
+};
+EOF
+],[$1],[F77],[cat > conftest.$ac_ext <<EOF
+ subroutine foo
+ implicit none
+ integer*4 a
+ a=0
+ return
+ end
+EOF
+],[$1],[GCJ],[cat > conftest.$ac_ext <<EOF
+public class foo {
+ private int a;
+ public void bar (void) {
+ a = 0;
+ }
+};
+EOF
+])
+dnl Parse the compiler output and extract the necessary
+dnl objects, libraries and library flags.
+if AC_TRY_EVAL(ac_compile); 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 "$_LT_AC_TAGVAR(compiler_lib_search_path, $1)"; then
+ _LT_AC_TAGVAR(compiler_lib_search_path, $1)="${prev}${p}"
+ else
+ _LT_AC_TAGVAR(compiler_lib_search_path, $1)="${_LT_AC_TAGVAR(compiler_lib_search_path, $1)} ${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 "$_LT_AC_TAGVAR(postdeps, $1)"; then
+ _LT_AC_TAGVAR(postdeps, $1)="${prev}${p}"
+ else
+ _LT_AC_TAGVAR(postdeps, $1)="${_LT_AC_TAGVAR(postdeps, $1)} ${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 "$_LT_AC_TAGVAR(predep_objects, $1)"; then
+ _LT_AC_TAGVAR(predep_objects, $1)="$p"
+ else
+ _LT_AC_TAGVAR(predep_objects, $1)="$_LT_AC_TAGVAR(predep_objects, $1) $p"
+ fi
+ else
+ if test -z "$_LT_AC_TAGVAR(postdep_objects, $1)"; then
+ _LT_AC_TAGVAR(postdep_objects, $1)="$p"
+ else
+ _LT_AC_TAGVAR(postdep_objects, $1)="$_LT_AC_TAGVAR(postdep_objects, $1) $p"
+ fi
+ fi
+ ;;
+
+ *) ;; # Ignore the rest.
+
+ esac
+ done
+
+ # Clean up.
+ rm -f a.out a.exe
+else
+ echo "libtool.m4: error: problem compiling $1 test program"
+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'.
+AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG], [_LT_AC_LANG_F77_CONFIG(F77)])
+AC_DEFUN([_LT_AC_LANG_F77_CONFIG],
+[AC_REQUIRE([AC_PROG_F77])
+AC_LANG_PUSH(Fortran 77)
+
+_LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+_LT_AC_TAGVAR(allow_undefined_flag, $1)=
+_LT_AC_TAGVAR(always_export_symbols, $1)=no
+_LT_AC_TAGVAR(archive_expsym_cmds, $1)=
+_LT_AC_TAGVAR(export_dynamic_flag_spec, $1)=
+_LT_AC_TAGVAR(hardcode_direct, $1)=no
+_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)=
+_LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)=
+_LT_AC_TAGVAR(hardcode_libdir_separator, $1)=
+_LT_AC_TAGVAR(hardcode_minus_L, $1)=no
+_LT_AC_TAGVAR(hardcode_automatic, $1)=no
+_LT_AC_TAGVAR(module_cmds, $1)=
+_LT_AC_TAGVAR(module_expsym_cmds, $1)=
+_LT_AC_TAGVAR(link_all_deplibs, $1)=unknown
+_LT_AC_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
+_LT_AC_TAGVAR(no_undefined_flag, $1)=
+_LT_AC_TAGVAR(whole_archive_flag_spec, $1)=
+_LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=no
+
+# Source file extension for f77 test sources.
+ac_ext=f
+
+# Object file extension for compiled f77 test sources.
+objext=o
+_LT_AC_TAGVAR(objext, $1)=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code=" subroutine t\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.
+_LT_AC_SYS_COMPILER
+
+# save warnings/boilerplate of simple test code
+_LT_COMPILER_BOILERPLATE
+_LT_LINKER_BOILERPLATE
+
+# Allow CC to be a program name with arguments.
+lt_save_CC="$CC"
+CC=${F77-"f77"}
+compiler=$CC
+_LT_AC_TAGVAR(compiler, $1)=$CC
+_LT_CC_BASENAME([$compiler])
+
+AC_MSG_CHECKING([if libtool supports shared libraries])
+AC_MSG_RESULT([$can_build_shared])
+
+AC_MSG_CHECKING([whether to build shared libraries])
+test "$can_build_shared" = "no" && enable_shared=no
+
+# On AIX, shared libraries and static libraries use the same namespace, and
+# are all built from PIC.
+case $host_os in
+aix3*)
+ test "$enable_shared" = yes && enable_static=no
+ if test -n "$RANLIB"; then
+ archive_cmds="$archive_cmds~\$RANLIB \$lib"
+ postinstall_cmds='$RANLIB $lib'
+ fi
+ ;;
+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])
+
+_LT_AC_TAGVAR(GCC, $1)="$G77"
+_LT_AC_TAGVAR(LD, $1)="$LD"
+
+AC_LIBTOOL_PROG_COMPILER_PIC($1)
+AC_LIBTOOL_PROG_CC_C_O($1)
+AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1)
+AC_LIBTOOL_PROG_LD_SHLIBS($1)
+AC_LIBTOOL_SYS_DYNAMIC_LINKER($1)
+AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1)
+
+AC_LIBTOOL_CONFIG($1)
+
+AC_LANG_POP
+CC="$lt_save_CC"
+])# AC_LIBTOOL_LANG_F77_CONFIG
+
+
+# AC_LIBTOOL_LANG_GCJ_CONFIG
+# --------------------------
+# Ensure that the configuration vars for the C compiler are
+# suitably defined. Those variables are subsequently used by
+# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'.
+AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG], [_LT_AC_LANG_GCJ_CONFIG(GCJ)])
+AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG],
+[AC_LANG_SAVE
+
+# Source file extension for Java test sources.
+ac_ext=java
+
+# Object file extension for compiled Java test sources.
+objext=o
+_LT_AC_TAGVAR(objext, $1)=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="class foo {}\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.
+_LT_AC_SYS_COMPILER
+
+# save warnings/boilerplate of simple test code
+_LT_COMPILER_BOILERPLATE
+_LT_LINKER_BOILERPLATE
+
+# Allow CC to be a program name with arguments.
+lt_save_CC="$CC"
+CC=${GCJ-"gcj"}
+compiler=$CC
+_LT_AC_TAGVAR(compiler, $1)=$CC
+_LT_CC_BASENAME([$compiler])
+
+# GCJ did not exist at the time GCC didn't implicitly link libc in.
+_LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+
+_LT_AC_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
+
+AC_LIBTOOL_PROG_COMPILER_NO_RTTI($1)
+AC_LIBTOOL_PROG_COMPILER_PIC($1)
+AC_LIBTOOL_PROG_CC_C_O($1)
+AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1)
+AC_LIBTOOL_PROG_LD_SHLIBS($1)
+AC_LIBTOOL_SYS_DYNAMIC_LINKER($1)
+AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1)
+
+AC_LIBTOOL_CONFIG($1)
+
+AC_LANG_RESTORE
+CC="$lt_save_CC"
+])# AC_LIBTOOL_LANG_GCJ_CONFIG
+
+
+# AC_LIBTOOL_LANG_RC_CONFIG
+# -------------------------
+# Ensure that the configuration vars for the Windows resource compiler are
+# suitably defined. Those variables are subsequently used by
+# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'.
+AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG], [_LT_AC_LANG_RC_CONFIG(RC)])
+AC_DEFUN([_LT_AC_LANG_RC_CONFIG],
+[AC_LANG_SAVE
+
+# Source file extension for RC test sources.
+ac_ext=rc
+
+# Object file extension for compiled RC test sources.
+objext=o
+_LT_AC_TAGVAR(objext, $1)=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }\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.
+_LT_AC_SYS_COMPILER
+
+# save warnings/boilerplate of simple test code
+_LT_COMPILER_BOILERPLATE
+_LT_LINKER_BOILERPLATE
+
+# Allow CC to be a program name with arguments.
+lt_save_CC="$CC"
+CC=${RC-"windres"}
+compiler=$CC
+_LT_AC_TAGVAR(compiler, $1)=$CC
+_LT_CC_BASENAME([$compiler])
+_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes
+
+AC_LIBTOOL_CONFIG($1)
+
+AC_LANG_RESTORE
+CC="$lt_save_CC"
+])# AC_LIBTOOL_LANG_RC_CONFIG
+
+
+# AC_LIBTOOL_CONFIG([TAGNAME])
+# ----------------------------
+# If TAGNAME is not passed, then create an initial libtool script
+# with a default configuration from the untagged config vars. Otherwise
+# add code to config.status for appending the configuration named by
+# TAGNAME from the matching tagged config vars.
+AC_DEFUN([AC_LIBTOOL_CONFIG],
+[# The else clause should only fire when bootstrapping the
+# libtool distribution, otherwise you forgot to ship ltmain.sh
+# with your package, and you will get complaints that there are
+# no rules to generate ltmain.sh.
+if test -f "$ltmain"; then
+ # See if we are running on zsh, and set the options which allow our commands through
+ # without removal of \ escapes.
+ if test -n "${ZSH_VERSION+set}" ; then
+ setopt NO_GLOB_SUBST
+ fi
+ # Now quote all the things that may contain metacharacters while being
+ # careful not to overquote the AC_SUBSTed values. We take copies of the
+ # variables and quote the copies for generation of the libtool script.
+ for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC LTCFLAGS NM \
+ SED SHELL STRIP \
+ libname_spec library_names_spec soname_spec extract_expsyms_cmds \
+ old_striplib striplib file_magic_cmd finish_cmds finish_eval \
+ deplibs_check_method reload_flag reload_cmds need_locks \
+ lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \
+ lt_cv_sys_global_symbol_to_c_name_address \
+ sys_lib_search_path_spec sys_lib_dlsearch_path_spec \
+ old_postinstall_cmds old_postuninstall_cmds \
+ _LT_AC_TAGVAR(compiler, $1) \
+ _LT_AC_TAGVAR(CC, $1) \
+ _LT_AC_TAGVAR(LD, $1) \
+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1) \
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1) \
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1) \
+ _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) \
+ _LT_AC_TAGVAR(export_dynamic_flag_spec, $1) \
+ _LT_AC_TAGVAR(thread_safe_flag_spec, $1) \
+ _LT_AC_TAGVAR(whole_archive_flag_spec, $1) \
+ _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1) \
+ _LT_AC_TAGVAR(old_archive_cmds, $1) \
+ _LT_AC_TAGVAR(old_archive_from_new_cmds, $1) \
+ _LT_AC_TAGVAR(predep_objects, $1) \
+ _LT_AC_TAGVAR(postdep_objects, $1) \
+ _LT_AC_TAGVAR(predeps, $1) \
+ _LT_AC_TAGVAR(postdeps, $1) \
+ _LT_AC_TAGVAR(compiler_lib_search_path, $1) \
+ _LT_AC_TAGVAR(archive_cmds, $1) \
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1) \
+ _LT_AC_TAGVAR(postinstall_cmds, $1) \
+ _LT_AC_TAGVAR(postuninstall_cmds, $1) \
+ _LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1) \
+ _LT_AC_TAGVAR(allow_undefined_flag, $1) \
+ _LT_AC_TAGVAR(no_undefined_flag, $1) \
+ _LT_AC_TAGVAR(export_symbols_cmds, $1) \
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) \
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1) \
+ _LT_AC_TAGVAR(hardcode_libdir_separator, $1) \
+ _LT_AC_TAGVAR(hardcode_automatic, $1) \
+ _LT_AC_TAGVAR(module_cmds, $1) \
+ _LT_AC_TAGVAR(module_expsym_cmds, $1) \
+ _LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1) \
+ _LT_AC_TAGVAR(exclude_expsyms, $1) \
+ _LT_AC_TAGVAR(include_expsyms, $1); do
+
+ case $var in
+ _LT_AC_TAGVAR(old_archive_cmds, $1) | \
+ _LT_AC_TAGVAR(old_archive_from_new_cmds, $1) | \
+ _LT_AC_TAGVAR(archive_cmds, $1) | \
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1) | \
+ _LT_AC_TAGVAR(module_cmds, $1) | \
+ _LT_AC_TAGVAR(module_expsym_cmds, $1) | \
+ _LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1) | \
+ _LT_AC_TAGVAR(export_symbols_cmds, $1) | \
+ extract_expsyms_cmds | reload_cmds | finish_cmds | \
+ postinstall_cmds | postuninstall_cmds | \
+ old_postinstall_cmds | old_postuninstall_cmds | \
+ sys_lib_search_path_spec | sys_lib_dlsearch_path_spec)
+ # Double-quote double-evaled strings.
+ eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\""
+ ;;
+ *)
+ eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\""
+ ;;
+ esac
+ done
+
+ case $lt_echo in
+ *'\[$]0 --fallback-echo"')
+ lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\[$]0 --fallback-echo"[$]/[$]0 --fallback-echo"/'`
+ ;;
+ esac
+
+ifelse([$1], [],
+ [cfgfile="${ofile}T"
+ trap "$rm \"$cfgfile\"; exit 1" 1 2 15
+ $rm -f "$cfgfile"
+ AC_MSG_NOTICE([creating $ofile])],
+ [cfgfile="$ofile"])
+
+ cat <<__EOF__ >> "$cfgfile"
+ifelse([$1], [],
+[#! $SHELL
+
+# `$echo "$cfgfile" | sed 's%^.*/%%'` - Provide generalized library-building support services.
+# Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP)
+# NOTE: Changes made to this file will be lost: look at ltmain.sh.
+#
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001
+# Free Software Foundation, Inc.
+#
+# This file is part of GNU Libtool:
+# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 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
+])# 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 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 <<EOF
+#ifdef __cplusplus
+extern "C" {
+#endif
+char nm_test_var;
+void nm_test_func(){}
+#ifdef __cplusplus
+}
+#endif
+int main(){nm_test_var='a';nm_test_func();return(0);}
+EOF
+
+ if AC_TRY_EVAL(ac_compile); then
+ # Now try to grab the symbols.
+ nlist=conftest.nm
+ if AC_TRY_EVAL(NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) && test -s "$nlist"; then
+ # 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 <<EOF > 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 <<EOF >> 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)=
+ ;;
+ 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)=])
+])
+
+
+# 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 '\''/^[[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 <<EOF 1>&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 <kc5tja@dolphin.openprojects.net> 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 <jrb3@best.com> 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 <<EOF 1>&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
+])# 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 <windows.h>
+# #undef WIN32_LEAN_AND_MEAN
+# #include <stdio.h>
+#
+# #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 <cygwin/cygwin_dll.h>
+# 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
+IFS=$as_save_IFS
+lt_ac_max=0
+lt_ac_count=0
+# Add /usr/xpg4/bin/sed as it is typically found on Solaris
+# along with /bin/sed that truncates output.
+for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do
+ test ! -f $lt_ac_sed && continue
+ cat /dev/null > conftest.in
+ lt_ac_count=0
+ echo $ECHO_N "0123456789$ECHO_C" >conftest.in
+ # Check for GNU sed and select it if it is found.
+ if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then
+ lt_cv_path_SED=$lt_ac_sed
+ break
+ fi
+ while true; do
+ cat conftest.in conftest.in >conftest.tmp
+ mv conftest.tmp conftest.in
+ cp conftest.in conftest.nl
+ echo >>conftest.nl
+ $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break
+ cmp -s conftest.out conftest.nl || break
+ # 10000 chars as input seems more than enough
+ test $lt_ac_count -gt 10 && break
+ lt_ac_count=`expr $lt_ac_count + 1`
+ if test $lt_ac_count -gt $lt_ac_max; then
+ lt_ac_max=$lt_ac_count
+ lt_cv_path_SED=$lt_ac_sed
+ fi
+ done
+done
+])
+SED=$lt_cv_path_SED
+AC_SUBST([SED])
+AC_MSG_RESULT([$SED])
+])
+
+# Copyright (C) 2002, 2003, 2005 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_AUTOMAKE_VERSION(VERSION)
+# ----------------------------
+# Automake X.Y traces this macro to ensure aclocal.m4 has been
+# generated from the m4 files accompanying Automake X.Y.
+AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version="1.9"])
+
+# AM_SET_CURRENT_AUTOMAKE_VERSION
+# -------------------------------
+# Call AM_AUTOMAKE_VERSION so it can be traced.
+# This function is AC_REQUIREd by AC_INIT_AUTOMAKE.
+AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
+ [AM_AUTOMAKE_VERSION([1.9.6])])
+
+# AM_AUX_DIR_EXPAND -*- Autoconf -*-
+
+# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
+# $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to
+# `$srcdir', `$srcdir/..', or `$srcdir/../..'.
+#
+# Of course, Automake must honor this variable whenever it calls a
+# tool from the auxiliary directory. The problem is that $srcdir (and
+# therefore $ac_aux_dir as well) can be either absolute or relative,
+# depending on how configure is run. This is pretty annoying, since
+# it makes $ac_aux_dir quite unusable in subdirectories: in the top
+# source directory, any form will work fine, but in subdirectories a
+# relative path needs to be adjusted first.
+#
+# $ac_aux_dir/missing
+# fails when called from a subdirectory if $ac_aux_dir is relative
+# $top_srcdir/$ac_aux_dir/missing
+# fails if $ac_aux_dir is absolute,
+# fails when called from a subdirectory in a VPATH build with
+# a relative $ac_aux_dir
+#
+# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
+# are both prefixed by $srcdir. In an in-source build this is usually
+# harmless because $srcdir is `.', but things will broke when you
+# start a VPATH build or use an absolute $srcdir.
+#
+# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
+# iff we strip the leading $srcdir from $ac_aux_dir. That would be:
+# am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
+# and then we would define $MISSING as
+# MISSING="\${SHELL} $am_aux_dir/missing"
+# This will work as long as MISSING is not called from configure, because
+# unfortunately $(top_srcdir) has no meaning in configure.
+# However there are other variables, like CC, which are often used in
+# configure, and could therefore not use this "fixed" $ac_aux_dir.
+#
+# Another solution, used here, is to always expand $ac_aux_dir to an
+# absolute PATH. The drawback is that using absolute paths prevent a
+# configured tree to be moved without reconfiguration.
+
+AC_DEFUN([AM_AUX_DIR_EXPAND],
+[dnl Rely on autoconf to set up CDPATH properly.
+AC_PREREQ([2.50])dnl
+# expand $ac_aux_dir to an absolute path
+am_aux_dir=`cd $ac_aux_dir && pwd`
+])
+
+# AM_CONDITIONAL -*- Autoconf -*-
+
+# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 7
+
+# AM_CONDITIONAL(NAME, SHELL-CONDITION)
+# -------------------------------------
+# Define a conditional.
+AC_DEFUN([AM_CONDITIONAL],
+[AC_PREREQ(2.52)dnl
+ ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])],
+ [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
+AC_SUBST([$1_TRUE])
+AC_SUBST([$1_FALSE])
+if $2; then
+ $1_TRUE=
+ $1_FALSE='#'
+else
+ $1_TRUE='#'
+ $1_FALSE=
+fi
+AC_CONFIG_COMMANDS_PRE(
+[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
+ AC_MSG_ERROR([[conditional "$1" was never defined.
+Usually this means the macro was only invoked conditionally.]])
+fi])])
+
+
+# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 8
+
+# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
+# written in clear, in which case automake, when reading aclocal.m4,
+# will think it sees a *use*, and therefore will trigger all it's
+# C support machinery. Also note that it means that autoscan, seeing
+# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
+
+
+# _AM_DEPENDENCIES(NAME)
+# ----------------------
+# See how the compiler implements dependency checking.
+# NAME is "CC", "CXX", "GCJ", or "OBJC".
+# We try a few techniques and use that to set a single cache variable.
+#
+# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
+# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
+# dependency, and given that the user is not expected to run this macro,
+# just rely on AC_PROG_CC.
+AC_DEFUN([_AM_DEPENDENCIES],
+[AC_REQUIRE([AM_SET_DEPDIR])dnl
+AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
+AC_REQUIRE([AM_MAKE_INCLUDE])dnl
+AC_REQUIRE([AM_DEP_TRACK])dnl
+
+ifelse([$1], CC, [depcc="$CC" am_compiler_list=],
+ [$1], CXX, [depcc="$CXX" am_compiler_list=],
+ [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
+ [$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'],
+ [depcc="$$1" am_compiler_list=])
+
+AC_CACHE_CHECK([dependency style of $depcc],
+ [am_cv_$1_dependencies_compiler_type],
+[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
+ # We make a subdir and do the tests there. Otherwise we can end up
+ # making bogus files that we don't know about and never remove. For
+ # instance it was reported that on HP-UX the gcc test will end up
+ # making a dummy file named `D' -- because `-MD' means `put the output
+ # in D'.
+ mkdir conftest.dir
+ # Copy depcomp to subdir because otherwise we won't find it if we're
+ # using a relative directory.
+ cp "$am_depcomp" conftest.dir
+ cd conftest.dir
+ # We will build objects and dependencies in a subdirectory because
+ # it helps to detect inapplicable dependency modes. For instance
+ # both Tru64's cc and ICC support -MD to output dependencies as a
+ # side effect of compilation, but ICC will put the dependencies in
+ # the current directory while Tru64 will put them in the object
+ # directory.
+ mkdir sub
+
+ am_cv_$1_dependencies_compiler_type=none
+ if test "$am_compiler_list" = ""; then
+ am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
+ fi
+ for depmode in $am_compiler_list; do
+ # Setup a source with many dependencies, because some compilers
+ # like to wrap large dependency lists on column 80 (with \), and
+ # we should not choose a depcomp mode which is confused by this.
+ #
+ # We need to recreate these files for each test, as the compiler may
+ # overwrite some of them when testing with obscure command lines.
+ # This happens at least with the AIX C compiler.
+ : > sub/conftest.c
+ for i in 1 2 3 4 5 6; do
+ echo '#include "conftst'$i'.h"' >> sub/conftest.c
+ # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
+ # Solaris 8's {/usr,}/bin/sh.
+ touch sub/conftst$i.h
+ done
+ echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
+
+ case $depmode in
+ nosideeffect)
+ # after this tag, mechanisms are not by side-effect, so they'll
+ # only be used when explicitly requested
+ if test "x$enable_dependency_tracking" = xyes; then
+ continue
+ else
+ break
+ fi
+ ;;
+ none) break ;;
+ esac
+ # We check with `-c' and `-o' for the sake of the "dashmstdout"
+ # mode. It turns out that the SunPro C++ compiler does not properly
+ # handle `-M -o', and we need to detect this.
+ if depmode=$depmode \
+ source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \
+ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
+ $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \
+ >/dev/null 2>conftest.err &&
+ grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
+ grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 &&
+ ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
+ # icc doesn't choke on unknown options, it will just issue warnings
+ # or remarks (even with -Werror). So we grep stderr for any message
+ # that says an option was ignored or not supported.
+ # When given -MP, icc 7.0 and 7.1 complain thusly:
+ # icc: Command line warning: ignoring option '-M'; no argument required
+ # The diagnosis changed in icc 8.0:
+ # icc: Command line remark: option '-MP' not supported
+ if (grep 'ignoring option' conftest.err ||
+ grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
+ am_cv_$1_dependencies_compiler_type=$depmode
+ break
+ fi
+ fi
+ done
+
+ cd ..
+ rm -rf conftest.dir
+else
+ am_cv_$1_dependencies_compiler_type=none
+fi
+])
+AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
+AM_CONDITIONAL([am__fastdep$1], [
+ test "x$enable_dependency_tracking" != xno \
+ && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
+])
+
+
+# AM_SET_DEPDIR
+# -------------
+# Choose a directory name for dependency files.
+# This macro is AC_REQUIREd in _AM_DEPENDENCIES
+AC_DEFUN([AM_SET_DEPDIR],
+[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
+AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
+])
+
+
+# AM_DEP_TRACK
+# ------------
+AC_DEFUN([AM_DEP_TRACK],
+[AC_ARG_ENABLE(dependency-tracking,
+[ --disable-dependency-tracking speeds up one-time build
+ --enable-dependency-tracking do not reject slow dependency extractors])
+if test "x$enable_dependency_tracking" != xno; then
+ am_depcomp="$ac_aux_dir/depcomp"
+ AMDEPBACKSLASH='\'
+fi
+AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
+AC_SUBST([AMDEPBACKSLASH])
+])
+
+# Generate code to set up dependency tracking. -*- Autoconf -*-
+
+# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+#serial 3
+
+# _AM_OUTPUT_DEPENDENCY_COMMANDS
+# ------------------------------
+AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
+[for mf in $CONFIG_FILES; do
+ # Strip MF so we end up with the name of the file.
+ mf=`echo "$mf" | sed -e 's/:.*$//'`
+ # Check whether this is an Automake generated Makefile or not.
+ # We used to match only the files named `Makefile.in', but
+ # some people rename them; so instead we look at the file content.
+ # Grep'ing the first line is not enough: some people post-process
+ # each Makefile.in and add a new line on top of each file to say so.
+ # So let's grep whole file.
+ if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then
+ dirpart=`AS_DIRNAME("$mf")`
+ else
+ continue
+ fi
+ # Extract the definition of DEPDIR, am__include, and am__quote
+ # from the Makefile without running `make'.
+ DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
+ test -z "$DEPDIR" && continue
+ am__include=`sed -n 's/^am__include = //p' < "$mf"`
+ test -z "am__include" && continue
+ am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
+ # When using ansi2knr, U may be empty or an underscore; expand it
+ U=`sed -n 's/^U = //p' < "$mf"`
+ # Find all dependency output files, they are included files with
+ # $(DEPDIR) in their names. We invoke sed twice because it is the
+ # simplest approach to changing $(DEPDIR) to its actual value in the
+ # expansion.
+ for file in `sed -n "
+ s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
+ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
+ # Make sure the directory exists.
+ test -f "$dirpart/$file" && continue
+ fdir=`AS_DIRNAME(["$file"])`
+ AS_MKDIR_P([$dirpart/$fdir])
+ # echo "creating $dirpart/$file"
+ echo '# dummy' > "$dirpart/$file"
+ done
+done
+])# _AM_OUTPUT_DEPENDENCY_COMMANDS
+
+
+# AM_OUTPUT_DEPENDENCY_COMMANDS
+# -----------------------------
+# This macro should only be invoked once -- use via AC_REQUIRE.
+#
+# This code is only required when automatic dependency tracking
+# is enabled. FIXME. This creates each `.P' file that we will
+# need in order to bootstrap the dependency handling code.
+AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
+[AC_CONFIG_COMMANDS([depfiles],
+ [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
+ [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
+])
+
+# Do all the work for Automake. -*- Autoconf -*-
+
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 12
+
+# This macro actually does too much. Some checks are only needed if
+# your package does certain things. But this isn't really a big deal.
+
+# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
+# AM_INIT_AUTOMAKE([OPTIONS])
+# -----------------------------------------------
+# The call with PACKAGE and VERSION arguments is the old style
+# call (pre autoconf-2.50), which is being phased out. PACKAGE
+# and VERSION should now be passed to AC_INIT and removed from
+# the call to AM_INIT_AUTOMAKE.
+# We support both call styles for the transition. After
+# the next Automake release, Autoconf can make the AC_INIT
+# arguments mandatory, and then we can depend on a new Autoconf
+# release and drop the old call support.
+AC_DEFUN([AM_INIT_AUTOMAKE],
+[AC_PREREQ([2.58])dnl
+dnl Autoconf wants to disallow AM_ names. We explicitly allow
+dnl the ones we care about.
+m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
+AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
+AC_REQUIRE([AC_PROG_INSTALL])dnl
+# test to see if srcdir already configured
+if test "`cd $srcdir && pwd`" != "`pwd`" &&
+ test -f $srcdir/config.status; then
+ AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
+fi
+
+# test whether we have cygpath
+if test -z "$CYGPATH_W"; then
+ if (cygpath --version) >/dev/null 2>/dev/null; then
+ CYGPATH_W='cygpath -w'
+ else
+ CYGPATH_W=echo
+ fi
+fi
+AC_SUBST([CYGPATH_W])
+
+# Define the identity of the package.
+dnl Distinguish between old-style and new-style calls.
+m4_ifval([$2],
+[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
+ AC_SUBST([PACKAGE], [$1])dnl
+ AC_SUBST([VERSION], [$2])],
+[_AM_SET_OPTIONS([$1])dnl
+ AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
+ AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
+
+_AM_IF_OPTION([no-define],,
+[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
+ AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl
+
+# Some tools Automake needs.
+AC_REQUIRE([AM_SANITY_CHECK])dnl
+AC_REQUIRE([AC_ARG_PROGRAM])dnl
+AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version})
+AM_MISSING_PROG(AUTOCONF, autoconf)
+AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version})
+AM_MISSING_PROG(AUTOHEADER, autoheader)
+AM_MISSING_PROG(MAKEINFO, makeinfo)
+AM_PROG_INSTALL_SH
+AM_PROG_INSTALL_STRIP
+AC_REQUIRE([AM_PROG_MKDIR_P])dnl
+# We need awk for the "check" target. The system "awk" is bad on
+# some platforms.
+AC_REQUIRE([AC_PROG_AWK])dnl
+AC_REQUIRE([AC_PROG_MAKE_SET])dnl
+AC_REQUIRE([AM_SET_LEADING_DOT])dnl
+_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
+ [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
+ [_AM_PROG_TAR([v7])])])
+_AM_IF_OPTION([no-dependencies],,
+[AC_PROVIDE_IFELSE([AC_PROG_CC],
+ [_AM_DEPENDENCIES(CC)],
+ [define([AC_PROG_CC],
+ defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
+AC_PROVIDE_IFELSE([AC_PROG_CXX],
+ [_AM_DEPENDENCIES(CXX)],
+ [define([AC_PROG_CXX],
+ defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
+])
+])
+
+
+# When config.status generates a header, we must update the stamp-h file.
+# This file resides in the same directory as the config header
+# that is generated. The stamp files are numbered to have different names.
+
+# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
+# loop where config.status creates the headers, so we can generate
+# our stamp files there.
+AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
+[# Compute $1's index in $config_headers.
+_am_stamp_count=1
+for _am_header in $config_headers :; do
+ case $_am_header in
+ $1 | $1:* )
+ break ;;
+ * )
+ _am_stamp_count=`expr $_am_stamp_count + 1` ;;
+ esac
+done
+echo "timestamp for $1" >`AS_DIRNAME([$1])`/stamp-h[]$_am_stamp_count])
+
+# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_PROG_INSTALL_SH
+# ------------------
+# Define $install_sh.
+AC_DEFUN([AM_PROG_INSTALL_SH],
+[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
+install_sh=${install_sh-"$am_aux_dir/install-sh"}
+AC_SUBST(install_sh)])
+
+# Copyright (C) 2003, 2005 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 2
+
+# Check whether the underlying file-system supports filenames
+# with a leading dot. For instance MS-DOS doesn't.
+AC_DEFUN([AM_SET_LEADING_DOT],
+[rm -rf .tst 2>/dev/null
+mkdir .tst 2>/dev/null
+if test -d .tst; then
+ am__leading_dot=.
+else
+ am__leading_dot=_
+fi
+rmdir .tst 2>/dev/null
+AC_SUBST([am__leading_dot])])
+
+# Check to see how 'make' treats includes. -*- Autoconf -*-
+
+# Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 3
+
+# AM_MAKE_INCLUDE()
+# -----------------
+# Check to see how make treats includes.
+AC_DEFUN([AM_MAKE_INCLUDE],
+[am_make=${MAKE-make}
+cat > confinc << 'END'
+am__doit:
+ @echo done
+.PHONY: am__doit
+END
+# If we don't find an include directive, just comment out the code.
+AC_MSG_CHECKING([for style of include used by $am_make])
+am__include="#"
+am__quote=
+_am_result=none
+# First try GNU make style include.
+echo "include confinc" > confmf
+# We grep out `Entering directory' and `Leaving directory'
+# messages which can occur if `w' ends up in MAKEFLAGS.
+# In particular we don't look at `^make:' because GNU make might
+# be invoked under some other name (usually "gmake"), in which
+# case it prints its new name instead of `make'.
+if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then
+ am__include=include
+ am__quote=
+ _am_result=GNU
+fi
+# Now try BSD make style include.
+if test "$am__include" = "#"; then
+ echo '.include "confinc"' > confmf
+ if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then
+ am__include=.include
+ am__quote="\""
+ _am_result=BSD
+ fi
+fi
+AC_SUBST([am__include])
+AC_SUBST([am__quote])
+AC_MSG_RESULT([$_am_result])
+rm -f confinc confmf
+])
+
+# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*-
+
+# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2005
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 4
+
+# AM_MISSING_PROG(NAME, PROGRAM)
+# ------------------------------
+AC_DEFUN([AM_MISSING_PROG],
+[AC_REQUIRE([AM_MISSING_HAS_RUN])
+$1=${$1-"${am_missing_run}$2"}
+AC_SUBST($1)])
+
+
+# AM_MISSING_HAS_RUN
+# ------------------
+# Define MISSING if not defined so far and test if it supports --run.
+# If it does, set am_missing_run to use it, otherwise, to nothing.
+AC_DEFUN([AM_MISSING_HAS_RUN],
+[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
+test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing"
+# Use eval to expand $SHELL
+if eval "$MISSING --run true"; then
+ am_missing_run="$MISSING --run "
+else
+ am_missing_run=
+ AC_MSG_WARN([`missing' script is too old or missing])
+fi
+])
+
+# Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_PROG_MKDIR_P
+# ---------------
+# Check whether `mkdir -p' is supported, fallback to mkinstalldirs otherwise.
+#
+# Automake 1.8 used `mkdir -m 0755 -p --' to ensure that directories
+# created by `make install' are always world readable, even if the
+# installer happens to have an overly restrictive umask (e.g. 077).
+# This was a mistake. There are at least two reasons why we must not
+# use `-m 0755':
+# - it causes special bits like SGID to be ignored,
+# - it may be too restrictive (some setups expect 775 directories).
+#
+# Do not use -m 0755 and let people choose whatever they expect by
+# setting umask.
+#
+# We cannot accept any implementation of `mkdir' that recognizes `-p'.
+# Some implementations (such as Solaris 8's) are not thread-safe: if a
+# parallel make tries to run `mkdir -p a/b' and `mkdir -p a/c'
+# concurrently, both version can detect that a/ is missing, but only
+# one can create it and the other will error out. Consequently we
+# restrict ourselves to GNU make (using the --version option ensures
+# this.)
+AC_DEFUN([AM_PROG_MKDIR_P],
+[if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then
+ # We used to keeping the `.' as first argument, in order to
+ # allow $(mkdir_p) to be used without argument. As in
+ # $(mkdir_p) $(somedir)
+ # where $(somedir) is conditionally defined. However this is wrong
+ # for two reasons:
+ # 1. if the package is installed by a user who cannot write `.'
+ # make install will fail,
+ # 2. the above comment should most certainly read
+ # $(mkdir_p) $(DESTDIR)$(somedir)
+ # so it does not work when $(somedir) is undefined and
+ # $(DESTDIR) is not.
+ # To support the latter case, we have to write
+ # test -z "$(somedir)" || $(mkdir_p) $(DESTDIR)$(somedir),
+ # so the `.' trick is pointless.
+ mkdir_p='mkdir -p --'
+else
+ # On NextStep and OpenStep, the `mkdir' command does not
+ # recognize any option. It will interpret all options as
+ # directories to create, and then abort because `.' already
+ # exists.
+ for d in ./-p ./--version;
+ do
+ test -d $d && rmdir $d
+ done
+ # $(mkinstalldirs) is defined by Automake if mkinstalldirs exists.
+ if test -f "$ac_aux_dir/mkinstalldirs"; then
+ mkdir_p='$(mkinstalldirs)'
+ else
+ mkdir_p='$(install_sh) -d'
+ fi
+fi
+AC_SUBST([mkdir_p])])
+
+# Helper functions for option handling. -*- Autoconf -*-
+
+# Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 3
+
+# _AM_MANGLE_OPTION(NAME)
+# -----------------------
+AC_DEFUN([_AM_MANGLE_OPTION],
+[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
+
+# _AM_SET_OPTION(NAME)
+# ------------------------------
+# Set option NAME. Presently that only means defining a flag for this option.
+AC_DEFUN([_AM_SET_OPTION],
+[m4_define(_AM_MANGLE_OPTION([$1]), 1)])
+
+# _AM_SET_OPTIONS(OPTIONS)
+# ----------------------------------
+# OPTIONS is a space-separated list of Automake options.
+AC_DEFUN([_AM_SET_OPTIONS],
+[AC_FOREACH([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
+
+# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
+# -------------------------------------------
+# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
+AC_DEFUN([_AM_IF_OPTION],
+[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
+
+# Check to make sure that the build environment is sane. -*- Autoconf -*-
+
+# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 4
+
+# AM_SANITY_CHECK
+# ---------------
+AC_DEFUN([AM_SANITY_CHECK],
+[AC_MSG_CHECKING([whether build environment is sane])
+# Just in case
+sleep 1
+echo timestamp > conftest.file
+# Do `set' in a subshell so we don't clobber the current shell's
+# arguments. Must try -L first in case configure is actually a
+# symlink; some systems play weird games with the mod time of symlinks
+# (eg FreeBSD returns the mod time of the symlink's containing
+# directory).
+if (
+ set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null`
+ if test "$[*]" = "X"; then
+ # -L didn't work.
+ set X `ls -t $srcdir/configure conftest.file`
+ fi
+ rm -f conftest.file
+ if test "$[*]" != "X $srcdir/configure conftest.file" \
+ && test "$[*]" != "X conftest.file $srcdir/configure"; then
+
+ # If neither matched, then we have a broken ls. This can happen
+ # if, for instance, CONFIG_SHELL is bash and it inherits a
+ # broken ls alias from the environment. This has actually
+ # happened. Such a system could not be considered "sane".
+ AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken
+alias in your environment])
+ fi
+
+ test "$[2]" = conftest.file
+ )
+then
+ # Ok.
+ :
+else
+ AC_MSG_ERROR([newly created file is older than distributed files!
+Check your system clock])
+fi
+AC_MSG_RESULT(yes)])
+
+# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_PROG_INSTALL_STRIP
+# ---------------------
+# One issue with vendor `install' (even GNU) is that you can't
+# specify the program used to strip binaries. This is especially
+# annoying in cross-compiling environments, where the build's strip
+# is unlikely to handle the host's binaries.
+# Fortunately install-sh will honor a STRIPPROG variable, so we
+# always use install-sh in `make install-strip', and initialize
+# STRIPPROG with the value of the STRIP variable (set by the user).
+AC_DEFUN([AM_PROG_INSTALL_STRIP],
+[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
+# Installed binaries are usually stripped using `strip' when the user
+# run `make install-strip'. However `strip' might not be the right
+# tool to use in cross-compilation environments, therefore Automake
+# will honor the `STRIP' environment variable to overrule this program.
+dnl Don't test for $cross_compiling = yes, because it might be `maybe'.
+if test "$cross_compiling" != no; then
+ AC_CHECK_TOOL([STRIP], [strip], :)
+fi
+INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s"
+AC_SUBST([INSTALL_STRIP_PROGRAM])])
+
+# Check how to create a tarball. -*- Autoconf -*-
+
+# Copyright (C) 2004, 2005 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 2
+
+# _AM_PROG_TAR(FORMAT)
+# --------------------
+# Check how to create a tarball in format FORMAT.
+# FORMAT should be one of `v7', `ustar', or `pax'.
+#
+# Substitute a variable $(am__tar) that is a command
+# writing to stdout a FORMAT-tarball containing the directory
+# $tardir.
+# tardir=directory && $(am__tar) > result.tar
+#
+# Substitute a variable $(am__untar) that extract such
+# a tarball read from stdin.
+# $(am__untar) < result.tar
+AC_DEFUN([_AM_PROG_TAR],
+[# Always define AMTAR for backward compatibility.
+AM_MISSING_PROG([AMTAR], [tar])
+m4_if([$1], [v7],
+ [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'],
+ [m4_case([$1], [ustar],, [pax],,
+ [m4_fatal([Unknown tar format])])
+AC_MSG_CHECKING([how to create a $1 tar archive])
+# Loop over all known methods to create a tar archive until one works.
+_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
+_am_tools=${am_cv_prog_tar_$1-$_am_tools}
+# Do not fold the above two line into one, because Tru64 sh and
+# Solaris sh will not grok spaces in the rhs of `-'.
+for _am_tool in $_am_tools
+do
+ case $_am_tool in
+ gnutar)
+ for _am_tar in tar gnutar gtar;
+ do
+ AM_RUN_LOG([$_am_tar --version]) && break
+ done
+ am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
+ am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
+ am__untar="$_am_tar -xf -"
+ ;;
+ plaintar)
+ # Must skip GNU tar: if it does not support --format= it doesn't create
+ # ustar tarball either.
+ (tar --version) >/dev/null 2>&1 && continue
+ am__tar='tar chf - "$$tardir"'
+ am__tar_='tar chf - "$tardir"'
+ am__untar='tar xf -'
+ ;;
+ pax)
+ am__tar='pax -L -x $1 -w "$$tardir"'
+ am__tar_='pax -L -x $1 -w "$tardir"'
+ am__untar='pax -r'
+ ;;
+ cpio)
+ am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
+ am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
+ am__untar='cpio -i -H $1 -d'
+ ;;
+ none)
+ am__tar=false
+ am__tar_=false
+ am__untar=false
+ ;;
+ esac
+
+ # If the value was cached, stop now. We just wanted to have am__tar
+ # and am__untar set.
+ test -n "${am_cv_prog_tar_$1}" && break
+
+ # tar/untar a dummy directory, and stop if the command works
+ rm -rf conftest.dir
+ mkdir conftest.dir
+ echo GrepMe > conftest.dir/file
+ AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
+ rm -rf conftest.dir
+ if test -s conftest.tar; then
+ AM_RUN_LOG([$am__untar <conftest.tar])
+ grep GrepMe conftest.dir/file >/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
+
--- /dev/null
+#! /bin/sh
+# Wrapper for compilers which do not understand `-c -o'.
+
+scriptversion=2005-05-14.22
+
+# Copyright (C) 1999, 2000, 2003, 2004, 2005 Free Software Foundation, Inc.
+# Written by Tom Tromey <tromey@cygnus.com>.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# This file is maintained in Automake, please report
+# bugs to <bug-automake@gnu.org> or send patches to
+# <automake-patches@gnu.org>.
+
+case $1 in
+ '')
+ echo "$0: No command. Try \`$0 --help' for more information." 1>&2
+ exit 1;
+ ;;
+ -h | --h*)
+ cat <<\EOF
+Usage: compile [--help] [--version] PROGRAM [ARGS]
+
+Wrapper for compilers which do not understand `-c -o'.
+Remove `-o dest.o' from ARGS, run PROGRAM with the remaining
+arguments, and rename the output as expected.
+
+If you are trying to build a whole package this is not the
+right script to run: please start by reading the file `INSTALL'.
+
+Report bugs to <bug-automake@gnu.org>.
+EOF
+ exit $?
+ ;;
+ -v | --v*)
+ echo "compile $scriptversion"
+ exit $?
+ ;;
+esac
+
+ofile=
+cfile=
+eat=
+
+for arg
+do
+ if test -n "$eat"; then
+ eat=
+ else
+ case $1 in
+ -o)
+ # configure might choose to run compile as `compile cc -o foo foo.c'.
+ # So we strip `-o arg' only if arg is an object.
+ eat=1
+ case $2 in
+ *.o | *.obj)
+ ofile=$2
+ ;;
+ *)
+ set x "$@" -o "$2"
+ shift
+ ;;
+ esac
+ ;;
+ *.c)
+ cfile=$1
+ set x "$@" "$1"
+ shift
+ ;;
+ *)
+ set x "$@" "$1"
+ shift
+ ;;
+ esac
+ fi
+ shift
+done
+
+if test -z "$ofile" || test -z "$cfile"; then
+ # If no `-o' option was seen then we might have been invoked from a
+ # pattern rule where we don't need one. That is ok -- this is a
+ # normal compilation that the losing compiler can handle. If no
+ # `.c' file was seen then we are probably linking. That is also
+ # ok.
+ exec "$@"
+fi
+
+# Name of file we expect compiler to create.
+cofile=`echo "$cfile" | sed -e 's|^.*/||' -e 's/\.c$/.o/'`
+
+# Create the lock directory.
+# Note: use `[/.-]' here to ensure that we don't use the same name
+# that we are using for the .o file. Also, base the name on the expected
+# object file name, since that is what matters with a parallel build.
+lockdir=`echo "$cofile" | sed -e 's|[/.-]|_|g'`.d
+while true; do
+ if mkdir "$lockdir" >/dev/null 2>&1; then
+ break
+ fi
+ sleep 1
+done
+# FIXME: race condition here if user kills between mkdir and trap.
+trap "rmdir '$lockdir'; exit 1" 1 2 15
+
+# Run the compile.
+"$@"
+ret=$?
+
+if test -f "$cofile"; then
+ mv "$cofile" "$ofile"
+elif test -f "${cofile}bj"; then
+ mv "${cofile}bj" "$ofile"
+fi
+
+rmdir "$lockdir"
+exit $ret
+
+# Local Variables:
+# mode: shell-script
+# sh-indentation: 2
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-end: "$"
+# End:
--- /dev/null
+AUTOMAKE_OPTIONS = foreign
+
+install:
+ $(INSTALL) -b -m 644 -D ./l7vs.cf /etc/l7vs/l7vs.cf
--- /dev/null
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = conf
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+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)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+GLIB_CFLAGS = @GLIB_CFLAGS@
+GLIB_GENMARSHAL = @GLIB_GENMARSHAL@
+GLIB_LIBS = @GLIB_LIBS@
+GLIB_MKENUMS = @GLIB_MKENUMS@
+GOBJECT_QUERY = @GOBJECT_QUERY@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MANDIR = @MANDIR@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PKG_CONFIG = @PKG_CONFIG@
+RANLIB = @RANLIB@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+ac_ct_RANLIB = @ac_ct_RANLIB@
+ac_ct_STRIP = @ac_ct_STRIP@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+l7vs_maxvs = @l7vs_maxvs@
+l7vs_moddir = @l7vs_moddir@
+l7vsadm_sockdir = @l7vsadm_sockdir@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+snmpagent_libs = @snmpagent_libs@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+AUTOMAKE_OPTIONS = foreign
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign conf/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign conf/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+distclean-libtool:
+ -rm -f libtool
+uninstall-info-am:
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+ list='$(DISTFILES)'; for file in $$list; do \
+ case $$file in \
+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+ esac; \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ dir="/$$dir"; \
+ $(mkdir_p) "$(distdir)$$dir"; \
+ else \
+ dir=''; \
+ fi; \
+ if test -d $$d/$$file; then \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile
+installdirs:
+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-libtool mostlyclean-am
+
+distclean: distclean-am
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic distclean-libtool
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-exec-am:
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-info-am
+
+.PHONY: all all-am check check-am clean clean-generic clean-libtool \
+ distclean distclean-generic distclean-libtool distdir dvi \
+ dvi-am html html-am info info-am install install-am \
+ install-data install-data-am install-exec install-exec-am \
+ install-info install-info-am install-man install-strip \
+ installcheck installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-generic \
+ mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am \
+ uninstall-info-am
+
+
+install:
+ $(INSTALL) -b -m 644 -D ./l7vs.cf /etc/l7vs/l7vs.cf
+# 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:
--- /dev/null
+#
+# UltraMonkey - L7 configuration file
+# 2008 (C) NTT Comware
+# License: GNU General Public License (GPL)
+#
+# 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
+
+#
+# Rivision History.
+# 2.1.0-0 Add some performance settings.
+# - 2008/MM/DD NAME
+# 2.0.0-1 Change default log level `info' to `warn'.
+# - 2008/07/29 Hideaki KONDO.
+# 2.0.0-0 First verion release.(version was put together l7vsd)
+# - 2008/03/26 Norihisa NAKAI.
+
+#
+# l7vs performance setting
+#
+[iomux]
+max_events = 1024
+
+[conn]
+# recv/send buffer size
+read_bufsize = 20480
+
+#
+# l7vs log setting
+#
+[logger]
+# l7vsd logfile base name
+l7vsd_log_filename = "/var/log/l7vs/l7vsd.log"
+# l7vsd log rotate pattern
+l7vsd_rotation = "size"
+# l7vsd rotate max backup number
+l7vsd_max_backup_index = "10"
+# l7vsd rotate file size
+l7vsd_max_filesize = "10M"
+
+# l7vsd log categories level
+l7vsd_network = "warn"
+l7vsd_network.bandwidth = "warn"
+l7vsd_network.num_connection = "warn"
+l7vsd_network.qos = "warn"
+l7vsd_virtual_service = "warn"
+l7vsd_real_server = "warn"
+l7vsd_sorry_server = "warn"
+l7vsd_real_server.balancing = "warn"
+l7vsd_replication = "warn"
+l7vsd_start_stop = "warn"
+l7vsd_system = "warn"
+l7vsd_system.memory = "warn"
+l7vsd_system.socket = "warn"
+l7vsd_system.signal = "warn"
+l7vsd_environment = "warn"
+l7vsd_environment.parameter = "warn"
+l7vsd_logger = "warn"
+l7vsd_parameter = "warn"
+l7vsd_event = "warn"
+l7vsd_schedule = "warn"
+l7vsd_program = "warn"
+l7vsd_protocol = "warn"
+l7vsd_module = "warn"
+
+# l7vsadm log file base name
+l7vsadm_log_filename = "/var/log/l7vs/l7vsadm.log"
+# l7vsadm rotate pattern
+l7vsadm_rotation = "date"
+# l7vsadm rotate max backup number
+l7vsadm_max_backup_index = "10"
+# l7vsadm rotate timing ( every month rotate )
+l7vsadm_rotation_timing = "month"
+# l7vsadm rotate timing ( day and time )
+l7vsadm_rotation_timing_value = "1 0:01"
+
+# l7vsadm log categories level
+l7vsadm_parse = "warn"
+l7vsadm_operate = "warn"
+l7vsadm_communicate = "warn"
+l7vsadm_config_result = "warn"
+l7vsadm_common = "warn"
+l7vsadm_logger = "warn"
+l7vsadm_parameter = "warn"
+l7vsadm_protocol = "warn"
+l7vsadm_module = "warn"
+
+# snmpagent log file base name
+snmpagent_log_filename = "/var/log/l7vs/snmpagent.log"
+# snmpagent log rotate pattern
+snmpagent_rotation = "datesize"
+# snmpagent log rotate max backup num
+snmpagent_max_backup_index = "10"
+# snmpagent max logfile size
+snmpagent_max_filesize = "30M"
+# snmpagent log rotate timing ( every week )
+snmpagent_rotation_timing = "week"
+# snmpagent log rotate timing ( a day of week and time )
+snmpagent_rotation_timing_value = "wed 23:59"
+
+# snmpagent log categories level
+snmpagent_start_stop = "warn"
+snmpagent_manager_receive = "warn"
+snmpagent_manager_send = "warn"
+snmpagent_l7vsd_receive = "warn"
+snmpagent_l7vsd_send = "warn"
+snmpagent_logger = "warn"
+snmpagent_parameter = "warn"
+
+#
+# l7vsadm setting
+#
+[l7vsadm]
+cmd_interval = 1
+cmd_count = 10
+con_interval = 1
+con_count = 10
+
+#
+# l7vsd replication setting
+#
+[replication]
+#ip_addr = "192.168.0.254"
+#service_name = "40000"
+#nic = "eth0"
+#interval = 1000
+#compulsorily_interval = 40
+#cmponent_id_00 = "virtualservice"
+#cmponent_size_00 = 64
+#cmponent_id_01 = "chash"
+#cmponent_size_01 = 1
+#cmponent_id_02 = "sslid"
+#cmponent_size_02 = 200
+
+#
+# snmpagent settings
+#
+[snmpagent]
+#nic = "eth0"
+#ip_addr = "127.0.0.1"
+#port = 60162
+#interval = 1000
+#status = 0
--- /dev/null
+#! /bin/sh
+# Attempt to guess a canonical system name.
+# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
+# 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+
+timestamp='2005-07-08'
+
+# This file is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
+# 02110-1301, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+
+# Originally written by Per Bothner <per@bothner.com>.
+# Please send patches to <config-patches@gnu.org>. Submit a context
+# diff and a properly formatted ChangeLog entry.
+#
+# This script attempts to guess a canonical system name similar to
+# config.sub. If it succeeds, it prints the system name on stdout, and
+# exits with 0. Otherwise, it exits with 1.
+#
+# The plan is that this can be called by configure scripts if you
+# don't specify an explicit build system type.
+
+me=`echo "$0" | sed -e 's,.*/,,'`
+
+usage="\
+Usage: $0 [OPTION]
+
+Output the configuration name of the system \`$me' is run on.
+
+Operation modes:
+ -h, --help print this help, then exit
+ -t, --time-stamp print date of last modification, then exit
+ -v, --version print version number, then exit
+
+Report bugs and patches to <config-patches@gnu.org>."
+
+version="\
+GNU config.guess ($timestamp)
+
+Originally written by Per Bothner.
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
+Free Software Foundation, Inc.
+
+This is free software; see the source for copying conditions. There is NO
+warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
+
+help="
+Try \`$me --help' for more information."
+
+# Parse command line
+while test $# -gt 0 ; do
+ case $1 in
+ --time-stamp | --time* | -t )
+ echo "$timestamp" ; exit ;;
+ --version | -v )
+ echo "$version" ; exit ;;
+ --help | --h* | -h )
+ echo "$usage"; exit ;;
+ -- ) # Stop option processing
+ shift; break ;;
+ - ) # Use stdin as input.
+ break ;;
+ -* )
+ echo "$me: invalid option $1$help" >&2
+ exit 1 ;;
+ * )
+ break ;;
+ esac
+done
+
+if test $# != 0; then
+ echo "$me: too many arguments$help" >&2
+ exit 1
+fi
+
+trap 'exit 1' 1 2 15
+
+# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
+# compiler to aid in system detection is discouraged as it requires
+# temporary files to be created and, as you can see below, it is a
+# headache to deal with in a portable fashion.
+
+# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
+# use `HOST_CC' if defined, but it is deprecated.
+
+# Portable tmp directory creation inspired by the Autoconf team.
+
+set_cc_for_build='
+trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
+trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
+: ${TMPDIR=/tmp} ;
+ { tmp=`(umask 077 && mktemp -d -q "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
+ { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
+ { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } ||
+ { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
+dummy=$tmp/dummy ;
+tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ;
+case $CC_FOR_BUILD,$HOST_CC,$CC in
+ ,,) echo "int x;" > $dummy.c ;
+ for c in cc gcc c89 c99 ; do
+ if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then
+ CC_FOR_BUILD="$c"; break ;
+ fi ;
+ done ;
+ if test x"$CC_FOR_BUILD" = x ; then
+ CC_FOR_BUILD=no_compiler_found ;
+ fi
+ ;;
+ ,,*) CC_FOR_BUILD=$CC ;;
+ ,*,*) CC_FOR_BUILD=$HOST_CC ;;
+esac ; set_cc_for_build= ;'
+
+# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
+# (ghazi@noc.rutgers.edu 1994-08-24)
+if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
+ PATH=$PATH:/.attbin ; export PATH
+fi
+
+UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
+UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
+UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
+UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
+
+# Note: order is significant - the case branches are not exclusive.
+
+case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
+ *:NetBSD:*:*)
+ # NetBSD (nbsd) targets should (where applicable) match one or
+ # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*,
+ # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently
+ # switched to ELF, *-*-netbsd* would select the old
+ # object file format. This provides both forward
+ # compatibility and a consistent mechanism for selecting the
+ # object file format.
+ #
+ # Note: NetBSD doesn't particularly care about the vendor
+ # portion of the name. We always set it to "unknown".
+ sysctl="sysctl -n hw.machine_arch"
+ UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \
+ /usr/sbin/$sysctl 2>/dev/null || echo unknown)`
+ case "${UNAME_MACHINE_ARCH}" in
+ armeb) machine=armeb-unknown ;;
+ arm*) machine=arm-unknown ;;
+ sh3el) machine=shl-unknown ;;
+ sh3eb) machine=sh-unknown ;;
+ *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
+ esac
+ # The Operating System including object format, if it has switched
+ # to ELF recently, or will in the future.
+ case "${UNAME_MACHINE_ARCH}" in
+ arm*|i386|m68k|ns32k|sh3*|sparc|vax)
+ eval $set_cc_for_build
+ if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
+ | grep __ELF__ >/dev/null
+ then
+ # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
+ # Return netbsd for either. FIX?
+ os=netbsd
+ else
+ os=netbsdelf
+ fi
+ ;;
+ *)
+ os=netbsd
+ ;;
+ esac
+ # The OS release
+ # Debian GNU/NetBSD machines have a different userland, and
+ # thus, need a distinct triplet. However, they do not need
+ # kernel version information, so it can be replaced with a
+ # suitable tag, in the style of linux-gnu.
+ case "${UNAME_VERSION}" in
+ Debian*)
+ release='-gnu'
+ ;;
+ *)
+ release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
+ ;;
+ esac
+ # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
+ # contains redundant information, the shorter form:
+ # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
+ echo "${machine}-${os}${release}"
+ exit ;;
+ *:OpenBSD:*:*)
+ UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
+ echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
+ exit ;;
+ *:ekkoBSD:*:*)
+ echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
+ exit ;;
+ macppc:MirBSD:*:*)
+ echo powerppc-unknown-mirbsd${UNAME_RELEASE}
+ exit ;;
+ *:MirBSD:*:*)
+ echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
+ exit ;;
+ alpha:OSF1:*:*)
+ case $UNAME_RELEASE in
+ *4.0)
+ UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
+ ;;
+ *5.*)
+ UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
+ ;;
+ esac
+ # According to Compaq, /usr/sbin/psrinfo has been available on
+ # OSF/1 and Tru64 systems produced since 1995. I hope that
+ # covers most systems running today. This code pipes the CPU
+ # types through head -n 1, so we only detect the type of CPU 0.
+ ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1`
+ case "$ALPHA_CPU_TYPE" in
+ "EV4 (21064)")
+ UNAME_MACHINE="alpha" ;;
+ "EV4.5 (21064)")
+ UNAME_MACHINE="alpha" ;;
+ "LCA4 (21066/21068)")
+ UNAME_MACHINE="alpha" ;;
+ "EV5 (21164)")
+ UNAME_MACHINE="alphaev5" ;;
+ "EV5.6 (21164A)")
+ UNAME_MACHINE="alphaev56" ;;
+ "EV5.6 (21164PC)")
+ UNAME_MACHINE="alphapca56" ;;
+ "EV5.7 (21164PC)")
+ UNAME_MACHINE="alphapca57" ;;
+ "EV6 (21264)")
+ UNAME_MACHINE="alphaev6" ;;
+ "EV6.7 (21264A)")
+ UNAME_MACHINE="alphaev67" ;;
+ "EV6.8CB (21264C)")
+ UNAME_MACHINE="alphaev68" ;;
+ "EV6.8AL (21264B)")
+ UNAME_MACHINE="alphaev68" ;;
+ "EV6.8CX (21264D)")
+ UNAME_MACHINE="alphaev68" ;;
+ "EV6.9A (21264/EV69A)")
+ UNAME_MACHINE="alphaev69" ;;
+ "EV7 (21364)")
+ UNAME_MACHINE="alphaev7" ;;
+ "EV7.9 (21364A)")
+ UNAME_MACHINE="alphaev79" ;;
+ esac
+ # A Pn.n version is a patched version.
+ # A Vn.n version is a released version.
+ # A Tn.n version is a released field test version.
+ # A Xn.n version is an unreleased experimental baselevel.
+ # 1.2 uses "1.2" for uname -r.
+ echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+ exit ;;
+ Alpha\ *:Windows_NT*:*)
+ # How do we know it's Interix rather than the generic POSIX subsystem?
+ # Should we change UNAME_MACHINE based on the output of uname instead
+ # of the specific Alpha model?
+ echo alpha-pc-interix
+ exit ;;
+ 21064:Windows_NT:50:3)
+ echo alpha-dec-winnt3.5
+ exit ;;
+ Amiga*:UNIX_System_V:4.0:*)
+ echo m68k-unknown-sysv4
+ exit ;;
+ *:[Aa]miga[Oo][Ss]:*:*)
+ echo ${UNAME_MACHINE}-unknown-amigaos
+ exit ;;
+ *:[Mm]orph[Oo][Ss]:*:*)
+ echo ${UNAME_MACHINE}-unknown-morphos
+ exit ;;
+ *:OS/390:*:*)
+ echo i370-ibm-openedition
+ exit ;;
+ *:z/VM:*:*)
+ echo s390-ibm-zvmoe
+ exit ;;
+ *:OS400:*:*)
+ echo powerpc-ibm-os400
+ exit ;;
+ arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
+ echo arm-acorn-riscix${UNAME_RELEASE}
+ exit ;;
+ arm:riscos:*:*|arm:RISCOS:*:*)
+ echo arm-unknown-riscos
+ exit ;;
+ SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
+ echo hppa1.1-hitachi-hiuxmpp
+ exit ;;
+ Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
+ # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
+ if test "`(/bin/universe) 2>/dev/null`" = att ; then
+ echo pyramid-pyramid-sysv3
+ else
+ echo pyramid-pyramid-bsd
+ fi
+ exit ;;
+ NILE*:*:*:dcosx)
+ echo pyramid-pyramid-svr4
+ exit ;;
+ DRS?6000:unix:4.0:6*)
+ echo sparc-icl-nx6
+ exit ;;
+ DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
+ case `/usr/bin/uname -p` in
+ sparc) echo sparc-icl-nx7; exit ;;
+ esac ;;
+ sun4H:SunOS:5.*:*)
+ echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit ;;
+ sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
+ echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit ;;
+ i86pc:SunOS:5.*:*)
+ echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit ;;
+ sun4*:SunOS:6*:*)
+ # According to config.sub, this is the proper way to canonicalize
+ # SunOS6. Hard to guess exactly what SunOS6 will be like, but
+ # it's likely to be more like Solaris than SunOS4.
+ echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit ;;
+ sun4*:SunOS:*:*)
+ case "`/usr/bin/arch -k`" in
+ Series*|S4*)
+ UNAME_RELEASE=`uname -v`
+ ;;
+ esac
+ # Japanese Language versions have a version number like `4.1.3-JL'.
+ echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
+ exit ;;
+ sun3*:SunOS:*:*)
+ echo m68k-sun-sunos${UNAME_RELEASE}
+ exit ;;
+ sun*:*:4.2BSD:*)
+ UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
+ test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
+ case "`/bin/arch`" in
+ sun3)
+ echo m68k-sun-sunos${UNAME_RELEASE}
+ ;;
+ sun4)
+ echo sparc-sun-sunos${UNAME_RELEASE}
+ ;;
+ esac
+ exit ;;
+ aushp:SunOS:*:*)
+ echo sparc-auspex-sunos${UNAME_RELEASE}
+ exit ;;
+ # The situation for MiNT is a little confusing. The machine name
+ # can be virtually everything (everything which is not
+ # "atarist" or "atariste" at least should have a processor
+ # > m68000). The system name ranges from "MiNT" over "FreeMiNT"
+ # to the lowercase version "mint" (or "freemint"). Finally
+ # the system name "TOS" denotes a system which is actually not
+ # MiNT. But MiNT is downward compatible to TOS, so this should
+ # be no problem.
+ atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
+ echo m68k-atari-mint${UNAME_RELEASE}
+ exit ;;
+ atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
+ echo m68k-atari-mint${UNAME_RELEASE}
+ exit ;;
+ *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
+ echo m68k-atari-mint${UNAME_RELEASE}
+ exit ;;
+ milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
+ echo m68k-milan-mint${UNAME_RELEASE}
+ exit ;;
+ hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
+ echo m68k-hades-mint${UNAME_RELEASE}
+ exit ;;
+ *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
+ echo m68k-unknown-mint${UNAME_RELEASE}
+ exit ;;
+ m68k:machten:*:*)
+ echo m68k-apple-machten${UNAME_RELEASE}
+ exit ;;
+ powerpc:machten:*:*)
+ echo powerpc-apple-machten${UNAME_RELEASE}
+ exit ;;
+ RISC*:Mach:*:*)
+ echo mips-dec-mach_bsd4.3
+ exit ;;
+ RISC*:ULTRIX:*:*)
+ echo mips-dec-ultrix${UNAME_RELEASE}
+ exit ;;
+ VAX*:ULTRIX*:*:*)
+ echo vax-dec-ultrix${UNAME_RELEASE}
+ exit ;;
+ 2020:CLIX:*:* | 2430:CLIX:*:*)
+ echo clipper-intergraph-clix${UNAME_RELEASE}
+ exit ;;
+ mips:*:*:UMIPS | mips:*:*:RISCos)
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
+#ifdef __cplusplus
+#include <stdio.h> /* for printf() prototype */
+ int main (int argc, char *argv[]) {
+#else
+ int main (argc, argv) int argc; char *argv[]; {
+#endif
+ #if defined (host_mips) && defined (MIPSEB)
+ #if defined (SYSTYPE_SYSV)
+ printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
+ #endif
+ #if defined (SYSTYPE_SVR4)
+ printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
+ #endif
+ #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
+ printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
+ #endif
+ #endif
+ exit (-1);
+ }
+EOF
+ $CC_FOR_BUILD -o $dummy $dummy.c &&
+ dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` &&
+ SYSTEM_NAME=`$dummy $dummyarg` &&
+ { echo "$SYSTEM_NAME"; exit; }
+ echo mips-mips-riscos${UNAME_RELEASE}
+ exit ;;
+ Motorola:PowerMAX_OS:*:*)
+ echo powerpc-motorola-powermax
+ exit ;;
+ Motorola:*:4.3:PL8-*)
+ echo powerpc-harris-powermax
+ exit ;;
+ Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
+ echo powerpc-harris-powermax
+ exit ;;
+ Night_Hawk:Power_UNIX:*:*)
+ echo powerpc-harris-powerunix
+ exit ;;
+ m88k:CX/UX:7*:*)
+ echo m88k-harris-cxux7
+ exit ;;
+ m88k:*:4*:R4*)
+ echo m88k-motorola-sysv4
+ exit ;;
+ m88k:*:3*:R3*)
+ echo m88k-motorola-sysv3
+ exit ;;
+ AViiON:dgux:*:*)
+ # DG/UX returns AViiON for all architectures
+ UNAME_PROCESSOR=`/usr/bin/uname -p`
+ if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
+ then
+ if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
+ [ ${TARGET_BINARY_INTERFACE}x = x ]
+ then
+ echo m88k-dg-dgux${UNAME_RELEASE}
+ else
+ echo m88k-dg-dguxbcs${UNAME_RELEASE}
+ fi
+ else
+ echo i586-dg-dgux${UNAME_RELEASE}
+ fi
+ exit ;;
+ M88*:DolphinOS:*:*) # DolphinOS (SVR3)
+ echo m88k-dolphin-sysv3
+ exit ;;
+ M88*:*:R3*:*)
+ # Delta 88k system running SVR3
+ echo m88k-motorola-sysv3
+ exit ;;
+ XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
+ echo m88k-tektronix-sysv3
+ exit ;;
+ Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
+ echo m68k-tektronix-bsd
+ exit ;;
+ *:IRIX*:*:*)
+ echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
+ exit ;;
+ ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
+ echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id
+ exit ;; # Note that: echo "'`uname -s`'" gives 'AIX '
+ i*86:AIX:*:*)
+ echo i386-ibm-aix
+ exit ;;
+ ia64:AIX:*:*)
+ if [ -x /usr/bin/oslevel ] ; then
+ IBM_REV=`/usr/bin/oslevel`
+ else
+ IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
+ fi
+ echo ${UNAME_MACHINE}-ibm-aix${IBM_REV}
+ exit ;;
+ *:AIX:2:3)
+ if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
+ #include <sys/systemcfg.h>
+
+ main()
+ {
+ if (!__power_pc())
+ exit(1);
+ puts("powerpc-ibm-aix3.2.5");
+ exit(0);
+ }
+EOF
+ if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy`
+ then
+ echo "$SYSTEM_NAME"
+ else
+ echo rs6000-ibm-aix3.2.5
+ fi
+ elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
+ echo rs6000-ibm-aix3.2.4
+ else
+ echo rs6000-ibm-aix3.2
+ fi
+ exit ;;
+ *:AIX:*:[45])
+ IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
+ if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
+ IBM_ARCH=rs6000
+ else
+ IBM_ARCH=powerpc
+ fi
+ if [ -x /usr/bin/oslevel ] ; then
+ IBM_REV=`/usr/bin/oslevel`
+ else
+ IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
+ fi
+ echo ${IBM_ARCH}-ibm-aix${IBM_REV}
+ exit ;;
+ *:AIX:*:*)
+ echo rs6000-ibm-aix
+ exit ;;
+ ibmrt:4.4BSD:*|romp-ibm:BSD:*)
+ echo romp-ibm-bsd4.4
+ exit ;;
+ ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and
+ echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to
+ exit ;; # report: romp-ibm BSD 4.3
+ *:BOSX:*:*)
+ echo rs6000-bull-bosx
+ exit ;;
+ DPX/2?00:B.O.S.:*:*)
+ echo m68k-bull-sysv3
+ exit ;;
+ 9000/[34]??:4.3bsd:1.*:*)
+ echo m68k-hp-bsd
+ exit ;;
+ hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
+ echo m68k-hp-bsd4.4
+ exit ;;
+ 9000/[34678]??:HP-UX:*:*)
+ HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
+ case "${UNAME_MACHINE}" in
+ 9000/31? ) HP_ARCH=m68000 ;;
+ 9000/[34]?? ) HP_ARCH=m68k ;;
+ 9000/[678][0-9][0-9])
+ if [ -x /usr/bin/getconf ]; then
+ sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
+ sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
+ case "${sc_cpu_version}" in
+ 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
+ 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
+ 532) # CPU_PA_RISC2_0
+ case "${sc_kernel_bits}" in
+ 32) HP_ARCH="hppa2.0n" ;;
+ 64) HP_ARCH="hppa2.0w" ;;
+ '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20
+ esac ;;
+ esac
+ fi
+ if [ "${HP_ARCH}" = "" ]; then
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
+
+ #define _HPUX_SOURCE
+ #include <stdlib.h>
+ #include <unistd.h>
+
+ int main ()
+ {
+ #if defined(_SC_KERNEL_BITS)
+ long bits = sysconf(_SC_KERNEL_BITS);
+ #endif
+ long cpu = sysconf (_SC_CPU_VERSION);
+
+ switch (cpu)
+ {
+ case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
+ case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
+ case CPU_PA_RISC2_0:
+ #if defined(_SC_KERNEL_BITS)
+ switch (bits)
+ {
+ case 64: puts ("hppa2.0w"); break;
+ case 32: puts ("hppa2.0n"); break;
+ default: puts ("hppa2.0"); break;
+ } break;
+ #else /* !defined(_SC_KERNEL_BITS) */
+ puts ("hppa2.0"); break;
+ #endif
+ default: puts ("hppa1.0"); break;
+ }
+ exit (0);
+ }
+EOF
+ (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
+ test -z "$HP_ARCH" && HP_ARCH=hppa
+ fi ;;
+ esac
+ if [ ${HP_ARCH} = "hppa2.0w" ]
+ then
+ eval $set_cc_for_build
+
+ # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
+ # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler
+ # generating 64-bit code. GNU and HP use different nomenclature:
+ #
+ # $ CC_FOR_BUILD=cc ./config.guess
+ # => hppa2.0w-hp-hpux11.23
+ # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
+ # => hppa64-hp-hpux11.23
+
+ if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |
+ grep __LP64__ >/dev/null
+ then
+ HP_ARCH="hppa2.0w"
+ else
+ HP_ARCH="hppa64"
+ fi
+ fi
+ echo ${HP_ARCH}-hp-hpux${HPUX_REV}
+ exit ;;
+ ia64:HP-UX:*:*)
+ HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
+ echo ia64-hp-hpux${HPUX_REV}
+ exit ;;
+ 3050*:HI-UX:*:*)
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
+ #include <unistd.h>
+ int
+ main ()
+ {
+ long cpu = sysconf (_SC_CPU_VERSION);
+ /* The order matters, because CPU_IS_HP_MC68K erroneously returns
+ true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct
+ results, however. */
+ if (CPU_IS_PA_RISC (cpu))
+ {
+ switch (cpu)
+ {
+ case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
+ case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
+ case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
+ default: puts ("hppa-hitachi-hiuxwe2"); break;
+ }
+ }
+ else if (CPU_IS_HP_MC68K (cpu))
+ puts ("m68k-hitachi-hiuxwe2");
+ else puts ("unknown-hitachi-hiuxwe2");
+ exit (0);
+ }
+EOF
+ $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` &&
+ { echo "$SYSTEM_NAME"; exit; }
+ echo unknown-hitachi-hiuxwe2
+ exit ;;
+ 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
+ echo hppa1.1-hp-bsd
+ exit ;;
+ 9000/8??:4.3bsd:*:*)
+ echo hppa1.0-hp-bsd
+ exit ;;
+ *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
+ echo hppa1.0-hp-mpeix
+ exit ;;
+ hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
+ echo hppa1.1-hp-osf
+ exit ;;
+ hp8??:OSF1:*:*)
+ echo hppa1.0-hp-osf
+ exit ;;
+ i*86:OSF1:*:*)
+ if [ -x /usr/sbin/sysversion ] ; then
+ echo ${UNAME_MACHINE}-unknown-osf1mk
+ else
+ echo ${UNAME_MACHINE}-unknown-osf1
+ fi
+ exit ;;
+ parisc*:Lites*:*:*)
+ echo hppa1.1-hp-lites
+ exit ;;
+ C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
+ echo c1-convex-bsd
+ exit ;;
+ C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
+ if getsysinfo -f scalar_acc
+ then echo c32-convex-bsd
+ else echo c2-convex-bsd
+ fi
+ exit ;;
+ C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
+ echo c34-convex-bsd
+ exit ;;
+ C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
+ echo c38-convex-bsd
+ exit ;;
+ C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
+ echo c4-convex-bsd
+ exit ;;
+ CRAY*Y-MP:*:*:*)
+ echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+ exit ;;
+ CRAY*[A-Z]90:*:*:*)
+ echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
+ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
+ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
+ -e 's/\.[^.]*$/.X/'
+ exit ;;
+ CRAY*TS:*:*:*)
+ echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+ exit ;;
+ CRAY*T3E:*:*:*)
+ echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+ exit ;;
+ CRAY*SV1:*:*:*)
+ echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+ exit ;;
+ *:UNICOS/mp:*:*)
+ echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+ exit ;;
+ F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
+ FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+ FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
+ FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
+ echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
+ exit ;;
+ 5000:UNIX_System_V:4.*:*)
+ FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
+ FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
+ echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
+ exit ;;
+ i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
+ echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
+ exit ;;
+ sparc*:BSD/OS:*:*)
+ echo sparc-unknown-bsdi${UNAME_RELEASE}
+ exit ;;
+ *:BSD/OS:*:*)
+ echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
+ exit ;;
+ *:FreeBSD:*:*)
+ echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
+ exit ;;
+ i*:CYGWIN*:*)
+ echo ${UNAME_MACHINE}-pc-cygwin
+ exit ;;
+ i*:MINGW*:*)
+ echo ${UNAME_MACHINE}-pc-mingw32
+ exit ;;
+ i*:windows32*:*)
+ # uname -m includes "-pc" on this system.
+ echo ${UNAME_MACHINE}-mingw32
+ exit ;;
+ i*:PW*:*)
+ echo ${UNAME_MACHINE}-pc-pw32
+ exit ;;
+ x86:Interix*:[34]*)
+ echo i586-pc-interix${UNAME_RELEASE}|sed -e 's/\..*//'
+ exit ;;
+ [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
+ echo i${UNAME_MACHINE}-pc-mks
+ exit ;;
+ i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
+ # How do we know it's Interix rather than the generic POSIX subsystem?
+ # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
+ # UNAME_MACHINE based on the output of uname instead of i386?
+ echo i586-pc-interix
+ exit ;;
+ i*:UWIN*:*)
+ echo ${UNAME_MACHINE}-pc-uwin
+ exit ;;
+ amd64:CYGWIN*:*:*)
+ echo x86_64-unknown-cygwin
+ exit ;;
+ p*:CYGWIN*:*)
+ echo powerpcle-unknown-cygwin
+ exit ;;
+ prep*:SunOS:5.*:*)
+ echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit ;;
+ *:GNU:*:*)
+ # the GNU system
+ echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
+ exit ;;
+ *:GNU/*:*:*)
+ # other systems with GNU libc and userland
+ echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu
+ exit ;;
+ i*86:Minix:*:*)
+ echo ${UNAME_MACHINE}-pc-minix
+ exit ;;
+ arm*:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit ;;
+ cris:Linux:*:*)
+ echo cris-axis-linux-gnu
+ exit ;;
+ crisv32:Linux:*:*)
+ echo crisv32-axis-linux-gnu
+ exit ;;
+ frv:Linux:*:*)
+ echo frv-unknown-linux-gnu
+ exit ;;
+ ia64:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit ;;
+ m32r*:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit ;;
+ m68*:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit ;;
+ mips:Linux:*:*)
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
+ #undef CPU
+ #undef mips
+ #undef mipsel
+ #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
+ CPU=mipsel
+ #else
+ #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
+ CPU=mips
+ #else
+ CPU=
+ #endif
+ #endif
+EOF
+ eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=`
+ test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
+ ;;
+ mips64:Linux:*:*)
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
+ #undef CPU
+ #undef mips64
+ #undef mips64el
+ #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
+ CPU=mips64el
+ #else
+ #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
+ CPU=mips64
+ #else
+ CPU=
+ #endif
+ #endif
+EOF
+ eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=`
+ test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
+ ;;
+ ppc:Linux:*:*)
+ echo powerpc-unknown-linux-gnu
+ exit ;;
+ ppc64:Linux:*:*)
+ echo powerpc64-unknown-linux-gnu
+ exit ;;
+ alpha:Linux:*:*)
+ case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
+ EV5) UNAME_MACHINE=alphaev5 ;;
+ EV56) UNAME_MACHINE=alphaev56 ;;
+ PCA56) UNAME_MACHINE=alphapca56 ;;
+ PCA57) UNAME_MACHINE=alphapca56 ;;
+ EV6) UNAME_MACHINE=alphaev6 ;;
+ EV67) UNAME_MACHINE=alphaev67 ;;
+ EV68*) UNAME_MACHINE=alphaev68 ;;
+ esac
+ objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null
+ if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
+ echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
+ exit ;;
+ parisc:Linux:*:* | hppa:Linux:*:*)
+ # Look for CPU level
+ case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
+ PA7*) echo hppa1.1-unknown-linux-gnu ;;
+ PA8*) echo hppa2.0-unknown-linux-gnu ;;
+ *) echo hppa-unknown-linux-gnu ;;
+ esac
+ exit ;;
+ parisc64:Linux:*:* | hppa64:Linux:*:*)
+ echo hppa64-unknown-linux-gnu
+ exit ;;
+ s390:Linux:*:* | s390x:Linux:*:*)
+ echo ${UNAME_MACHINE}-ibm-linux
+ exit ;;
+ sh64*:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit ;;
+ sh*:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit ;;
+ sparc:Linux:*:* | sparc64:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit ;;
+ x86_64:Linux:*:*)
+ echo x86_64-unknown-linux-gnu
+ exit ;;
+ i*86:Linux:*:*)
+ # The BFD linker knows what the default object file format is, so
+ # first see if it will tell us. cd to the root directory to prevent
+ # problems with other programs or directories called `ld' in the path.
+ # Set LC_ALL=C to ensure ld outputs messages in English.
+ ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \
+ | sed -ne '/supported targets:/!d
+ s/[ ][ ]*/ /g
+ s/.*supported targets: *//
+ s/ .*//
+ p'`
+ case "$ld_supported_targets" in
+ elf32-i386)
+ TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu"
+ ;;
+ a.out-i386-linux)
+ echo "${UNAME_MACHINE}-pc-linux-gnuaout"
+ exit ;;
+ coff-i386)
+ echo "${UNAME_MACHINE}-pc-linux-gnucoff"
+ exit ;;
+ "")
+ # Either a pre-BFD a.out linker (linux-gnuoldld) or
+ # one that does not give us useful --help.
+ echo "${UNAME_MACHINE}-pc-linux-gnuoldld"
+ exit ;;
+ esac
+ # Determine whether the default compiler is a.out or elf
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
+ #include <features.h>
+ #ifdef __ELF__
+ # ifdef __GLIBC__
+ # if __GLIBC__ >= 2
+ LIBC=gnu
+ # else
+ LIBC=gnulibc1
+ # endif
+ # else
+ LIBC=gnulibc1
+ # endif
+ #else
+ #ifdef __INTEL_COMPILER
+ LIBC=gnu
+ #else
+ LIBC=gnuaout
+ #endif
+ #endif
+ #ifdef __dietlibc__
+ LIBC=dietlibc
+ #endif
+EOF
+ eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=`
+ test x"${LIBC}" != x && {
+ echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
+ exit
+ }
+ test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; }
+ ;;
+ i*86:DYNIX/ptx:4*:*)
+ # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
+ # earlier versions are messed up and put the nodename in both
+ # sysname and nodename.
+ echo i386-sequent-sysv4
+ exit ;;
+ i*86:UNIX_SV:4.2MP:2.*)
+ # Unixware is an offshoot of SVR4, but it has its own version
+ # number series starting with 2...
+ # I am not positive that other SVR4 systems won't match this,
+ # I just have to hope. -- rms.
+ # Use sysv4.2uw... so that sysv4* matches it.
+ echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
+ exit ;;
+ i*86:OS/2:*:*)
+ # If we were able to find `uname', then EMX Unix compatibility
+ # is probably installed.
+ echo ${UNAME_MACHINE}-pc-os2-emx
+ exit ;;
+ i*86:XTS-300:*:STOP)
+ echo ${UNAME_MACHINE}-unknown-stop
+ exit ;;
+ i*86:atheos:*:*)
+ echo ${UNAME_MACHINE}-unknown-atheos
+ exit ;;
+ i*86:syllable:*:*)
+ echo ${UNAME_MACHINE}-pc-syllable
+ exit ;;
+ i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)
+ echo i386-unknown-lynxos${UNAME_RELEASE}
+ exit ;;
+ i*86:*DOS:*:*)
+ echo ${UNAME_MACHINE}-pc-msdosdjgpp
+ exit ;;
+ i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
+ UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
+ if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
+ echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL}
+ else
+ echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
+ fi
+ exit ;;
+ i*86:*:5:[678]*)
+ # UnixWare 7.x, OpenUNIX and OpenServer 6.
+ case `/bin/uname -X | grep "^Machine"` in
+ *486*) UNAME_MACHINE=i486 ;;
+ *Pentium) UNAME_MACHINE=i586 ;;
+ *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
+ esac
+ echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
+ exit ;;
+ i*86:*:3.2:*)
+ if test -f /usr/options/cb.name; then
+ UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
+ echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
+ elif /bin/uname -X 2>/dev/null >/dev/null ; then
+ UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
+ (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
+ (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
+ && UNAME_MACHINE=i586
+ (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
+ && UNAME_MACHINE=i686
+ (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
+ && UNAME_MACHINE=i686
+ echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
+ else
+ echo ${UNAME_MACHINE}-pc-sysv32
+ fi
+ exit ;;
+ pc:*:*:*)
+ # Left here for compatibility:
+ # uname -m prints for DJGPP always 'pc', but it prints nothing about
+ # the processor, so we play safe by assuming i386.
+ echo i386-pc-msdosdjgpp
+ exit ;;
+ Intel:Mach:3*:*)
+ echo i386-pc-mach3
+ exit ;;
+ paragon:*:*:*)
+ echo i860-intel-osf1
+ exit ;;
+ i860:*:4.*:*) # i860-SVR4
+ if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
+ echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
+ else # Add other i860-SVR4 vendors below as they are discovered.
+ echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4
+ fi
+ exit ;;
+ mini*:CTIX:SYS*5:*)
+ # "miniframe"
+ echo m68010-convergent-sysv
+ exit ;;
+ mc68k:UNIX:SYSTEM5:3.51m)
+ echo m68k-convergent-sysv
+ exit ;;
+ M680?0:D-NIX:5.3:*)
+ echo m68k-diab-dnix
+ exit ;;
+ M68*:*:R3V[5678]*:*)
+ test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;;
+ 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0)
+ OS_REL=''
+ test -r /etc/.relid \
+ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
+ /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+ && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
+ /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
+ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
+ 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
+ /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+ && { echo i486-ncr-sysv4; exit; } ;;
+ m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
+ echo m68k-unknown-lynxos${UNAME_RELEASE}
+ exit ;;
+ mc68030:UNIX_System_V:4.*:*)
+ echo m68k-atari-sysv4
+ exit ;;
+ TSUNAMI:LynxOS:2.*:*)
+ echo sparc-unknown-lynxos${UNAME_RELEASE}
+ exit ;;
+ rs6000:LynxOS:2.*:*)
+ echo rs6000-unknown-lynxos${UNAME_RELEASE}
+ exit ;;
+ PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*)
+ echo powerpc-unknown-lynxos${UNAME_RELEASE}
+ exit ;;
+ SM[BE]S:UNIX_SV:*:*)
+ echo mips-dde-sysv${UNAME_RELEASE}
+ exit ;;
+ RM*:ReliantUNIX-*:*:*)
+ echo mips-sni-sysv4
+ exit ;;
+ RM*:SINIX-*:*:*)
+ echo mips-sni-sysv4
+ exit ;;
+ *:SINIX-*:*:*)
+ if uname -p 2>/dev/null >/dev/null ; then
+ UNAME_MACHINE=`(uname -p) 2>/dev/null`
+ echo ${UNAME_MACHINE}-sni-sysv4
+ else
+ echo ns32k-sni-sysv
+ fi
+ exit ;;
+ PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
+ # says <Richard.M.Bartel@ccMail.Census.GOV>
+ echo i586-unisys-sysv4
+ exit ;;
+ *:UNIX_System_V:4*:FTX*)
+ # From Gerald Hewes <hewes@openmarket.com>.
+ # How about differentiating between stratus architectures? -djm
+ echo hppa1.1-stratus-sysv4
+ exit ;;
+ *:*:*:FTX*)
+ # From seanf@swdc.stratus.com.
+ echo i860-stratus-sysv4
+ exit ;;
+ i*86:VOS:*:*)
+ # From Paul.Green@stratus.com.
+ echo ${UNAME_MACHINE}-stratus-vos
+ exit ;;
+ *:VOS:*:*)
+ # From Paul.Green@stratus.com.
+ echo hppa1.1-stratus-vos
+ exit ;;
+ mc68*:A/UX:*:*)
+ echo m68k-apple-aux${UNAME_RELEASE}
+ exit ;;
+ news*:NEWS-OS:6*:*)
+ echo mips-sony-newsos6
+ exit ;;
+ R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
+ if [ -d /usr/nec ]; then
+ echo mips-nec-sysv${UNAME_RELEASE}
+ else
+ echo mips-unknown-sysv${UNAME_RELEASE}
+ fi
+ exit ;;
+ BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only.
+ echo powerpc-be-beos
+ exit ;;
+ BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only.
+ echo powerpc-apple-beos
+ exit ;;
+ BePC:BeOS:*:*) # BeOS running on Intel PC compatible.
+ echo i586-pc-beos
+ exit ;;
+ SX-4:SUPER-UX:*:*)
+ echo sx4-nec-superux${UNAME_RELEASE}
+ exit ;;
+ SX-5:SUPER-UX:*:*)
+ echo sx5-nec-superux${UNAME_RELEASE}
+ exit ;;
+ SX-6:SUPER-UX:*:*)
+ echo sx6-nec-superux${UNAME_RELEASE}
+ exit ;;
+ Power*:Rhapsody:*:*)
+ echo powerpc-apple-rhapsody${UNAME_RELEASE}
+ exit ;;
+ *:Rhapsody:*:*)
+ echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
+ exit ;;
+ *:Darwin:*:*)
+ UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
+ case $UNAME_PROCESSOR in
+ *86) UNAME_PROCESSOR=i686 ;;
+ unknown) UNAME_PROCESSOR=powerpc ;;
+ esac
+ echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
+ exit ;;
+ *:procnto*:*:* | *:QNX:[0123456789]*:*)
+ UNAME_PROCESSOR=`uname -p`
+ if test "$UNAME_PROCESSOR" = "x86"; then
+ UNAME_PROCESSOR=i386
+ UNAME_MACHINE=pc
+ fi
+ echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE}
+ exit ;;
+ *:QNX:*:4*)
+ echo i386-pc-qnx
+ exit ;;
+ NSE-?:NONSTOP_KERNEL:*:*)
+ echo nse-tandem-nsk${UNAME_RELEASE}
+ exit ;;
+ NSR-?:NONSTOP_KERNEL:*:*)
+ echo nsr-tandem-nsk${UNAME_RELEASE}
+ exit ;;
+ *:NonStop-UX:*:*)
+ echo mips-compaq-nonstopux
+ exit ;;
+ BS2000:POSIX*:*:*)
+ echo bs2000-siemens-sysv
+ exit ;;
+ DS/*:UNIX_System_V:*:*)
+ echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}
+ exit ;;
+ *:Plan9:*:*)
+ # "uname -m" is not consistent, so use $cputype instead. 386
+ # is converted to i386 for consistency with other x86
+ # operating systems.
+ if test "$cputype" = "386"; then
+ UNAME_MACHINE=i386
+ else
+ UNAME_MACHINE="$cputype"
+ fi
+ echo ${UNAME_MACHINE}-unknown-plan9
+ exit ;;
+ *:TOPS-10:*:*)
+ echo pdp10-unknown-tops10
+ exit ;;
+ *:TENEX:*:*)
+ echo pdp10-unknown-tenex
+ exit ;;
+ KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
+ echo pdp10-dec-tops20
+ exit ;;
+ XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
+ echo pdp10-xkl-tops20
+ exit ;;
+ *:TOPS-20:*:*)
+ echo pdp10-unknown-tops20
+ exit ;;
+ *:ITS:*:*)
+ echo pdp10-unknown-its
+ exit ;;
+ SEI:*:*:SEIUX)
+ echo mips-sei-seiux${UNAME_RELEASE}
+ exit ;;
+ *:DragonFly:*:*)
+ echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
+ exit ;;
+ *:*VMS:*:*)
+ UNAME_MACHINE=`(uname -p) 2>/dev/null`
+ case "${UNAME_MACHINE}" in
+ A*) echo alpha-dec-vms ; exit ;;
+ I*) echo ia64-dec-vms ; exit ;;
+ V*) echo vax-dec-vms ; exit ;;
+ esac ;;
+ *:XENIX:*:SysV)
+ echo i386-pc-xenix
+ exit ;;
+ i*86:skyos:*:*)
+ echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//'
+ exit ;;
+esac
+
+#echo '(No uname command or uname output not recognized.)' 1>&2
+#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
+
+eval $set_cc_for_build
+cat >$dummy.c <<EOF
+#ifdef _SEQUENT_
+# include <sys/types.h>
+# include <sys/utsname.h>
+#endif
+main ()
+{
+#if defined (sony)
+#if defined (MIPSEB)
+ /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed,
+ I don't know.... */
+ printf ("mips-sony-bsd\n"); exit (0);
+#else
+#include <sys/param.h>
+ printf ("m68k-sony-newsos%s\n",
+#ifdef NEWSOS4
+ "4"
+#else
+ ""
+#endif
+ ); exit (0);
+#endif
+#endif
+
+#if defined (__arm) && defined (__acorn) && defined (__unix)
+ printf ("arm-acorn-riscix\n"); exit (0);
+#endif
+
+#if defined (hp300) && !defined (hpux)
+ printf ("m68k-hp-bsd\n"); exit (0);
+#endif
+
+#if defined (NeXT)
+#if !defined (__ARCHITECTURE__)
+#define __ARCHITECTURE__ "m68k"
+#endif
+ int version;
+ version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
+ if (version < 4)
+ printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
+ else
+ printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
+ exit (0);
+#endif
+
+#if defined (MULTIMAX) || defined (n16)
+#if defined (UMAXV)
+ printf ("ns32k-encore-sysv\n"); exit (0);
+#else
+#if defined (CMU)
+ printf ("ns32k-encore-mach\n"); exit (0);
+#else
+ printf ("ns32k-encore-bsd\n"); exit (0);
+#endif
+#endif
+#endif
+
+#if defined (__386BSD__)
+ printf ("i386-pc-bsd\n"); exit (0);
+#endif
+
+#if defined (sequent)
+#if defined (i386)
+ printf ("i386-sequent-dynix\n"); exit (0);
+#endif
+#if defined (ns32000)
+ printf ("ns32k-sequent-dynix\n"); exit (0);
+#endif
+#endif
+
+#if defined (_SEQUENT_)
+ struct utsname un;
+
+ uname(&un);
+
+ if (strncmp(un.version, "V2", 2) == 0) {
+ printf ("i386-sequent-ptx2\n"); exit (0);
+ }
+ if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
+ printf ("i386-sequent-ptx1\n"); exit (0);
+ }
+ printf ("i386-sequent-ptx\n"); exit (0);
+
+#endif
+
+#if defined (vax)
+# if !defined (ultrix)
+# include <sys/param.h>
+# if defined (BSD)
+# if BSD == 43
+ printf ("vax-dec-bsd4.3\n"); exit (0);
+# else
+# if BSD == 199006
+ printf ("vax-dec-bsd4.3reno\n"); exit (0);
+# else
+ printf ("vax-dec-bsd\n"); exit (0);
+# endif
+# endif
+# else
+ printf ("vax-dec-bsd\n"); exit (0);
+# endif
+# else
+ printf ("vax-dec-ultrix\n"); exit (0);
+# endif
+#endif
+
+#if defined (alliant) && defined (i860)
+ printf ("i860-alliant-bsd\n"); exit (0);
+#endif
+
+ exit (1);
+}
+EOF
+
+$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` &&
+ { echo "$SYSTEM_NAME"; exit; }
+
+# Apollos put the system type in the environment.
+
+test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; }
+
+# Convex versions that predate uname can use getsysinfo(1)
+
+if [ -x /usr/convex/getsysinfo ]
+then
+ case `getsysinfo -f cpu_type` in
+ c1*)
+ echo c1-convex-bsd
+ exit ;;
+ c2*)
+ if getsysinfo -f scalar_acc
+ then echo c32-convex-bsd
+ else echo c2-convex-bsd
+ fi
+ exit ;;
+ c34*)
+ echo c34-convex-bsd
+ exit ;;
+ c38*)
+ echo c38-convex-bsd
+ exit ;;
+ c4*)
+ echo c4-convex-bsd
+ exit ;;
+ esac
+fi
+
+cat >&2 <<EOF
+$0: unable to guess system type
+
+This script, last modified $timestamp, has failed to recognize
+the operating system you are using. It is advised that you
+download the most up to date version of the config scripts from
+
+ http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.guess
+and
+ http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.sub
+
+If the version you run ($0) is already up to date, please
+send the following data and any information you think might be
+pertinent to <config-patches@gnu.org> in order to provide the needed
+information to handle your system.
+
+config.guess timestamp = $timestamp
+
+uname -m = `(uname -m) 2>/dev/null || echo unknown`
+uname -r = `(uname -r) 2>/dev/null || echo unknown`
+uname -s = `(uname -s) 2>/dev/null || echo unknown`
+uname -v = `(uname -v) 2>/dev/null || echo unknown`
+
+/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
+/bin/uname -X = `(/bin/uname -X) 2>/dev/null`
+
+hostinfo = `(hostinfo) 2>/dev/null`
+/bin/universe = `(/bin/universe) 2>/dev/null`
+/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null`
+/bin/arch = `(/bin/arch) 2>/dev/null`
+/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null`
+/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
+
+UNAME_MACHINE = ${UNAME_MACHINE}
+UNAME_RELEASE = ${UNAME_RELEASE}
+UNAME_SYSTEM = ${UNAME_SYSTEM}
+UNAME_VERSION = ${UNAME_VERSION}
+EOF
+
+exit 1
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "timestamp='"
+# time-stamp-format: "%:y-%02m-%02d"
+# time-stamp-end: "'"
+# End:
--- /dev/null
+/* config.h.in. Generated from configure.in by autoheader. */
+
+/* Define to 1 if you have the <dlfcn.h> header file. */
+#undef HAVE_DLFCN_H
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#undef HAVE_INTTYPES_H
+
+/* Define to 1 if you have the `dl' library (-ldl). */
+#undef HAVE_LIBDL
+
+/* Define to 1 if your system has a GNU libc compatible `malloc' function, and
+ to 0 otherwise. */
+#undef HAVE_MALLOC
+
+/* Define to 1 if you have the <memory.h> header file. */
+#undef HAVE_MEMORY_H
+
+/* Define to 1 if you have the `select' function. */
+#undef HAVE_SELECT
+
+/* Define to 1 if you have the `socket' function. */
+#undef HAVE_SOCKET
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#undef HAVE_STDINT_H
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#undef HAVE_STDLIB_H
+
+/* Define to 1 if you have the `strdup' function. */
+#undef HAVE_STRDUP
+
+/* Define to 1 if you have the `strerror' function. */
+#undef HAVE_STRERROR
+
+/* Define to 1 if you have the <strings.h> header file. */
+#undef HAVE_STRINGS_H
+
+/* Define to 1 if you have the <string.h> header file. */
+#undef HAVE_STRING_H
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#undef HAVE_SYS_STAT_H
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#undef HAVE_SYS_TYPES_H
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#undef HAVE_UNISTD_H
+
+/* Define to the address where bug reports for this package should be sent. */
+#undef PACKAGE_BUGREPORT
+
+/* Define to the full name of this package. */
+#undef PACKAGE_NAME
+
+/* Define to the full name and version of this package. */
+#undef PACKAGE_STRING
+
+/* Define to the one symbol short name of this package. */
+#undef PACKAGE_TARNAME
+
+/* Define to the version of this package. */
+#undef PACKAGE_VERSION
+
+/* Define to 1 if you have the ANSI C header files. */
+#undef STDC_HEADERS
+
+/* Define to rpl_malloc if the replacement function should be used. */
+#undef malloc
--- /dev/null
+#! /bin/sh
+# Configuration validation subroutine script.
+# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
+# 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+
+timestamp='2005-07-08'
+
+# This file is (in principle) common to ALL GNU software.
+# The presence of a machine in this file suggests that SOME GNU software
+# can handle that machine. It does not imply ALL GNU software can.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
+# 02110-1301, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+
+# Please send patches to <config-patches@gnu.org>. Submit a context
+# diff and a properly formatted ChangeLog entry.
+#
+# Configuration subroutine to validate and canonicalize a configuration type.
+# Supply the specified configuration type as an argument.
+# If it is invalid, we print an error message on stderr and exit with code 1.
+# Otherwise, we print the canonical config type on stdout and succeed.
+
+# This file is supposed to be the same for all GNU packages
+# and recognize all the CPU types, system types and aliases
+# that are meaningful with *any* GNU software.
+# Each package is responsible for reporting which valid configurations
+# it does not support. The user should be able to distinguish
+# a failure to support a valid configuration from a meaningless
+# configuration.
+
+# The goal of this file is to map all the various variations of a given
+# machine specification into a single specification in the form:
+# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
+# or in some cases, the newer four-part form:
+# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
+# It is wrong to echo any other type of specification.
+
+me=`echo "$0" | sed -e 's,.*/,,'`
+
+usage="\
+Usage: $0 [OPTION] CPU-MFR-OPSYS
+ $0 [OPTION] ALIAS
+
+Canonicalize a configuration name.
+
+Operation modes:
+ -h, --help print this help, then exit
+ -t, --time-stamp print date of last modification, then exit
+ -v, --version print version number, then exit
+
+Report bugs and patches to <config-patches@gnu.org>."
+
+version="\
+GNU config.sub ($timestamp)
+
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
+Free Software Foundation, Inc.
+
+This is free software; see the source for copying conditions. There is NO
+warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
+
+help="
+Try \`$me --help' for more information."
+
+# Parse command line
+while test $# -gt 0 ; do
+ case $1 in
+ --time-stamp | --time* | -t )
+ echo "$timestamp" ; exit ;;
+ --version | -v )
+ echo "$version" ; exit ;;
+ --help | --h* | -h )
+ echo "$usage"; exit ;;
+ -- ) # Stop option processing
+ shift; break ;;
+ - ) # Use stdin as input.
+ break ;;
+ -* )
+ echo "$me: invalid option $1$help"
+ exit 1 ;;
+
+ *local*)
+ # First pass through any local machine types.
+ echo $1
+ exit ;;
+
+ * )
+ break ;;
+ esac
+done
+
+case $# in
+ 0) echo "$me: missing argument$help" >&2
+ exit 1;;
+ 1) ;;
+ *) echo "$me: too many arguments$help" >&2
+ exit 1;;
+esac
+
+# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any).
+# Here we must recognize all the valid KERNEL-OS combinations.
+maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
+case $maybe_os in
+ nto-qnx* | linux-gnu* | linux-dietlibc | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | \
+ kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | storm-chaos* | os2-emx* | rtmk-nova*)
+ os=-$maybe_os
+ basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
+ ;;
+ *)
+ basic_machine=`echo $1 | sed 's/-[^-]*$//'`
+ if [ $basic_machine != $1 ]
+ then os=`echo $1 | sed 's/.*-/-/'`
+ else os=; fi
+ ;;
+esac
+
+### Let's recognize common machines as not being operating systems so
+### that things like config.sub decstation-3100 work. We also
+### recognize some manufacturers as not being operating systems, so we
+### can provide default operating systems below.
+case $os in
+ -sun*os*)
+ # Prevent following clause from handling this invalid input.
+ ;;
+ -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \
+ -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \
+ -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \
+ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
+ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
+ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
+ -apple | -axis | -knuth | -cray)
+ os=
+ basic_machine=$1
+ ;;
+ -sim | -cisco | -oki | -wec | -winbond)
+ os=
+ basic_machine=$1
+ ;;
+ -scout)
+ ;;
+ -wrs)
+ os=-vxworks
+ basic_machine=$1
+ ;;
+ -chorusos*)
+ os=-chorusos
+ basic_machine=$1
+ ;;
+ -chorusrdb)
+ os=-chorusrdb
+ basic_machine=$1
+ ;;
+ -hiux*)
+ os=-hiuxwe2
+ ;;
+ -sco5)
+ os=-sco3.2v5
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -sco4)
+ os=-sco3.2v4
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -sco3.2.[4-9]*)
+ os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -sco3.2v[4-9]*)
+ # Don't forget version if it is 3.2v4 or newer.
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -sco*)
+ os=-sco3.2v2
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -udk*)
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -isc)
+ os=-isc2.2
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -clix*)
+ basic_machine=clipper-intergraph
+ ;;
+ -isc*)
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -lynx*)
+ os=-lynxos
+ ;;
+ -ptx*)
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'`
+ ;;
+ -windowsnt*)
+ os=`echo $os | sed -e 's/windowsnt/winnt/'`
+ ;;
+ -psos*)
+ os=-psos
+ ;;
+ -mint | -mint[0-9]*)
+ basic_machine=m68k-atari
+ os=-mint
+ ;;
+esac
+
+# Decode aliases for certain CPU-COMPANY combinations.
+case $basic_machine in
+ # Recognize the basic CPU types without company name.
+ # Some are omitted here because they have special meanings below.
+ 1750a | 580 \
+ | a29k \
+ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
+ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
+ | am33_2.0 \
+ | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \
+ | bfin \
+ | c4x | clipper \
+ | d10v | d30v | dlx | dsp16xx \
+ | fr30 | frv \
+ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
+ | i370 | i860 | i960 | ia64 \
+ | ip2k | iq2000 \
+ | m32r | m32rle | m68000 | m68k | m88k | maxq | mcore \
+ | mips | mipsbe | mipseb | mipsel | mipsle \
+ | mips16 \
+ | mips64 | mips64el \
+ | mips64vr | mips64vrel \
+ | mips64orion | mips64orionel \
+ | mips64vr4100 | mips64vr4100el \
+ | mips64vr4300 | mips64vr4300el \
+ | mips64vr5000 | mips64vr5000el \
+ | mips64vr5900 | mips64vr5900el \
+ | mipsisa32 | mipsisa32el \
+ | mipsisa32r2 | mipsisa32r2el \
+ | mipsisa64 | mipsisa64el \
+ | mipsisa64r2 | mipsisa64r2el \
+ | mipsisa64sb1 | mipsisa64sb1el \
+ | mipsisa64sr71k | mipsisa64sr71kel \
+ | mipstx39 | mipstx39el \
+ | mn10200 | mn10300 \
+ | ms1 \
+ | msp430 \
+ | ns16k | ns32k \
+ | or32 \
+ | pdp10 | pdp11 | pj | pjl \
+ | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
+ | pyramid \
+ | sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \
+ | sh64 | sh64le \
+ | sparc | sparc64 | sparc64b | sparc86x | sparclet | sparclite \
+ | sparcv8 | sparcv9 | sparcv9b \
+ | strongarm \
+ | tahoe | thumb | tic4x | tic80 | tron \
+ | v850 | v850e \
+ | we32k \
+ | x86 | xscale | xscalee[bl] | xstormy16 | xtensa \
+ | z8k)
+ basic_machine=$basic_machine-unknown
+ ;;
+ m32c)
+ basic_machine=$basic_machine-unknown
+ ;;
+ m6811 | m68hc11 | m6812 | m68hc12)
+ # Motorola 68HC11/12.
+ basic_machine=$basic_machine-unknown
+ os=-none
+ ;;
+ m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k)
+ ;;
+
+ # We use `pc' rather than `unknown'
+ # because (1) that's what they normally are, and
+ # (2) the word "unknown" tends to confuse beginning users.
+ i*86 | x86_64)
+ basic_machine=$basic_machine-pc
+ ;;
+ # Object if more than one company name word.
+ *-*-*)
+ echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
+ exit 1
+ ;;
+ # Recognize the basic CPU types with company name.
+ 580-* \
+ | a29k-* \
+ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
+ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
+ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
+ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \
+ | avr-* \
+ | bfin-* | bs2000-* \
+ | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \
+ | clipper-* | craynv-* | cydra-* \
+ | d10v-* | d30v-* | dlx-* \
+ | elxsi-* \
+ | f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \
+ | h8300-* | h8500-* \
+ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
+ | i*86-* | i860-* | i960-* | ia64-* \
+ | ip2k-* | iq2000-* \
+ | m32r-* | m32rle-* \
+ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
+ | m88110-* | m88k-* | maxq-* | mcore-* \
+ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
+ | mips16-* \
+ | mips64-* | mips64el-* \
+ | mips64vr-* | mips64vrel-* \
+ | mips64orion-* | mips64orionel-* \
+ | mips64vr4100-* | mips64vr4100el-* \
+ | mips64vr4300-* | mips64vr4300el-* \
+ | mips64vr5000-* | mips64vr5000el-* \
+ | mips64vr5900-* | mips64vr5900el-* \
+ | mipsisa32-* | mipsisa32el-* \
+ | mipsisa32r2-* | mipsisa32r2el-* \
+ | mipsisa64-* | mipsisa64el-* \
+ | mipsisa64r2-* | mipsisa64r2el-* \
+ | mipsisa64sb1-* | mipsisa64sb1el-* \
+ | mipsisa64sr71k-* | mipsisa64sr71kel-* \
+ | mipstx39-* | mipstx39el-* \
+ | mmix-* \
+ | ms1-* \
+ | msp430-* \
+ | none-* | np1-* | ns16k-* | ns32k-* \
+ | orion-* \
+ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
+ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
+ | pyramid-* \
+ | romp-* | rs6000-* \
+ | sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | shbe-* \
+ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
+ | sparc-* | sparc64-* | sparc64b-* | sparc86x-* | sparclet-* \
+ | sparclite-* \
+ | sparcv8-* | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \
+ | tahoe-* | thumb-* \
+ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
+ | tron-* \
+ | v850-* | v850e-* | vax-* \
+ | we32k-* \
+ | x86-* | x86_64-* | xps100-* | xscale-* | xscalee[bl]-* \
+ | xstormy16-* | xtensa-* \
+ | ymp-* \
+ | z8k-*)
+ ;;
+ m32c-*)
+ ;;
+ # Recognize the various machine names and aliases which stand
+ # for a CPU type and a company and sometimes even an OS.
+ 386bsd)
+ basic_machine=i386-unknown
+ os=-bsd
+ ;;
+ 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
+ basic_machine=m68000-att
+ ;;
+ 3b*)
+ basic_machine=we32k-att
+ ;;
+ a29khif)
+ basic_machine=a29k-amd
+ os=-udi
+ ;;
+ abacus)
+ basic_machine=abacus-unknown
+ ;;
+ adobe68k)
+ basic_machine=m68010-adobe
+ os=-scout
+ ;;
+ alliant | fx80)
+ basic_machine=fx80-alliant
+ ;;
+ altos | altos3068)
+ basic_machine=m68k-altos
+ ;;
+ am29k)
+ basic_machine=a29k-none
+ os=-bsd
+ ;;
+ amd64)
+ basic_machine=x86_64-pc
+ ;;
+ amd64-*)
+ basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ amdahl)
+ basic_machine=580-amdahl
+ os=-sysv
+ ;;
+ amiga | amiga-*)
+ basic_machine=m68k-unknown
+ ;;
+ amigaos | amigados)
+ basic_machine=m68k-unknown
+ os=-amigaos
+ ;;
+ amigaunix | amix)
+ basic_machine=m68k-unknown
+ os=-sysv4
+ ;;
+ apollo68)
+ basic_machine=m68k-apollo
+ os=-sysv
+ ;;
+ apollo68bsd)
+ basic_machine=m68k-apollo
+ os=-bsd
+ ;;
+ aux)
+ basic_machine=m68k-apple
+ os=-aux
+ ;;
+ balance)
+ basic_machine=ns32k-sequent
+ os=-dynix
+ ;;
+ c90)
+ basic_machine=c90-cray
+ os=-unicos
+ ;;
+ convex-c1)
+ basic_machine=c1-convex
+ os=-bsd
+ ;;
+ convex-c2)
+ basic_machine=c2-convex
+ os=-bsd
+ ;;
+ convex-c32)
+ basic_machine=c32-convex
+ os=-bsd
+ ;;
+ convex-c34)
+ basic_machine=c34-convex
+ os=-bsd
+ ;;
+ convex-c38)
+ basic_machine=c38-convex
+ os=-bsd
+ ;;
+ cray | j90)
+ basic_machine=j90-cray
+ os=-unicos
+ ;;
+ craynv)
+ basic_machine=craynv-cray
+ os=-unicosmp
+ ;;
+ cr16c)
+ basic_machine=cr16c-unknown
+ os=-elf
+ ;;
+ crds | unos)
+ basic_machine=m68k-crds
+ ;;
+ crisv32 | crisv32-* | etraxfs*)
+ basic_machine=crisv32-axis
+ ;;
+ cris | cris-* | etrax*)
+ basic_machine=cris-axis
+ ;;
+ crx)
+ basic_machine=crx-unknown
+ os=-elf
+ ;;
+ da30 | da30-*)
+ basic_machine=m68k-da30
+ ;;
+ decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn)
+ basic_machine=mips-dec
+ ;;
+ decsystem10* | dec10*)
+ basic_machine=pdp10-dec
+ os=-tops10
+ ;;
+ decsystem20* | dec20*)
+ basic_machine=pdp10-dec
+ os=-tops20
+ ;;
+ delta | 3300 | motorola-3300 | motorola-delta \
+ | 3300-motorola | delta-motorola)
+ basic_machine=m68k-motorola
+ ;;
+ delta88)
+ basic_machine=m88k-motorola
+ os=-sysv3
+ ;;
+ djgpp)
+ basic_machine=i586-pc
+ os=-msdosdjgpp
+ ;;
+ dpx20 | dpx20-*)
+ basic_machine=rs6000-bull
+ os=-bosx
+ ;;
+ dpx2* | dpx2*-bull)
+ basic_machine=m68k-bull
+ os=-sysv3
+ ;;
+ ebmon29k)
+ basic_machine=a29k-amd
+ os=-ebmon
+ ;;
+ elxsi)
+ basic_machine=elxsi-elxsi
+ os=-bsd
+ ;;
+ encore | umax | mmax)
+ basic_machine=ns32k-encore
+ ;;
+ es1800 | OSE68k | ose68k | ose | OSE)
+ basic_machine=m68k-ericsson
+ os=-ose
+ ;;
+ fx2800)
+ basic_machine=i860-alliant
+ ;;
+ genix)
+ basic_machine=ns32k-ns
+ ;;
+ gmicro)
+ basic_machine=tron-gmicro
+ os=-sysv
+ ;;
+ go32)
+ basic_machine=i386-pc
+ os=-go32
+ ;;
+ h3050r* | hiux*)
+ basic_machine=hppa1.1-hitachi
+ os=-hiuxwe2
+ ;;
+ h8300hms)
+ basic_machine=h8300-hitachi
+ os=-hms
+ ;;
+ h8300xray)
+ basic_machine=h8300-hitachi
+ os=-xray
+ ;;
+ h8500hms)
+ basic_machine=h8500-hitachi
+ os=-hms
+ ;;
+ harris)
+ basic_machine=m88k-harris
+ os=-sysv3
+ ;;
+ hp300-*)
+ basic_machine=m68k-hp
+ ;;
+ hp300bsd)
+ basic_machine=m68k-hp
+ os=-bsd
+ ;;
+ hp300hpux)
+ basic_machine=m68k-hp
+ os=-hpux
+ ;;
+ hp3k9[0-9][0-9] | hp9[0-9][0-9])
+ basic_machine=hppa1.0-hp
+ ;;
+ hp9k2[0-9][0-9] | hp9k31[0-9])
+ basic_machine=m68000-hp
+ ;;
+ hp9k3[2-9][0-9])
+ basic_machine=m68k-hp
+ ;;
+ hp9k6[0-9][0-9] | hp6[0-9][0-9])
+ basic_machine=hppa1.0-hp
+ ;;
+ hp9k7[0-79][0-9] | hp7[0-79][0-9])
+ basic_machine=hppa1.1-hp
+ ;;
+ hp9k78[0-9] | hp78[0-9])
+ # FIXME: really hppa2.0-hp
+ basic_machine=hppa1.1-hp
+ ;;
+ hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893)
+ # FIXME: really hppa2.0-hp
+ basic_machine=hppa1.1-hp
+ ;;
+ hp9k8[0-9][13679] | hp8[0-9][13679])
+ basic_machine=hppa1.1-hp
+ ;;
+ hp9k8[0-9][0-9] | hp8[0-9][0-9])
+ basic_machine=hppa1.0-hp
+ ;;
+ hppa-next)
+ os=-nextstep3
+ ;;
+ hppaosf)
+ basic_machine=hppa1.1-hp
+ os=-osf
+ ;;
+ hppro)
+ basic_machine=hppa1.1-hp
+ os=-proelf
+ ;;
+ i370-ibm* | ibm*)
+ basic_machine=i370-ibm
+ ;;
+# I'm not sure what "Sysv32" means. Should this be sysv3.2?
+ i*86v32)
+ basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+ os=-sysv32
+ ;;
+ i*86v4*)
+ basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+ os=-sysv4
+ ;;
+ i*86v)
+ basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+ os=-sysv
+ ;;
+ i*86sol2)
+ basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+ os=-solaris2
+ ;;
+ i386mach)
+ basic_machine=i386-mach
+ os=-mach
+ ;;
+ i386-vsta | vsta)
+ basic_machine=i386-unknown
+ os=-vsta
+ ;;
+ iris | iris4d)
+ basic_machine=mips-sgi
+ case $os in
+ -irix*)
+ ;;
+ *)
+ os=-irix4
+ ;;
+ esac
+ ;;
+ isi68 | isi)
+ basic_machine=m68k-isi
+ os=-sysv
+ ;;
+ m88k-omron*)
+ basic_machine=m88k-omron
+ ;;
+ magnum | m3230)
+ basic_machine=mips-mips
+ os=-sysv
+ ;;
+ merlin)
+ basic_machine=ns32k-utek
+ os=-sysv
+ ;;
+ mingw32)
+ basic_machine=i386-pc
+ os=-mingw32
+ ;;
+ miniframe)
+ basic_machine=m68000-convergent
+ ;;
+ *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*)
+ basic_machine=m68k-atari
+ os=-mint
+ ;;
+ mips3*-*)
+ basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
+ ;;
+ mips3*)
+ basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
+ ;;
+ monitor)
+ basic_machine=m68k-rom68k
+ os=-coff
+ ;;
+ morphos)
+ basic_machine=powerpc-unknown
+ os=-morphos
+ ;;
+ msdos)
+ basic_machine=i386-pc
+ os=-msdos
+ ;;
+ mvs)
+ basic_machine=i370-ibm
+ os=-mvs
+ ;;
+ ncr3000)
+ basic_machine=i486-ncr
+ os=-sysv4
+ ;;
+ netbsd386)
+ basic_machine=i386-unknown
+ os=-netbsd
+ ;;
+ netwinder)
+ basic_machine=armv4l-rebel
+ os=-linux
+ ;;
+ news | news700 | news800 | news900)
+ basic_machine=m68k-sony
+ os=-newsos
+ ;;
+ news1000)
+ basic_machine=m68030-sony
+ os=-newsos
+ ;;
+ news-3600 | risc-news)
+ basic_machine=mips-sony
+ os=-newsos
+ ;;
+ necv70)
+ basic_machine=v70-nec
+ os=-sysv
+ ;;
+ next | m*-next )
+ basic_machine=m68k-next
+ case $os in
+ -nextstep* )
+ ;;
+ -ns2*)
+ os=-nextstep2
+ ;;
+ *)
+ os=-nextstep3
+ ;;
+ esac
+ ;;
+ nh3000)
+ basic_machine=m68k-harris
+ os=-cxux
+ ;;
+ nh[45]000)
+ basic_machine=m88k-harris
+ os=-cxux
+ ;;
+ nindy960)
+ basic_machine=i960-intel
+ os=-nindy
+ ;;
+ mon960)
+ basic_machine=i960-intel
+ os=-mon960
+ ;;
+ nonstopux)
+ basic_machine=mips-compaq
+ os=-nonstopux
+ ;;
+ np1)
+ basic_machine=np1-gould
+ ;;
+ nsr-tandem)
+ basic_machine=nsr-tandem
+ ;;
+ op50n-* | op60c-*)
+ basic_machine=hppa1.1-oki
+ os=-proelf
+ ;;
+ openrisc | openrisc-*)
+ basic_machine=or32-unknown
+ ;;
+ os400)
+ basic_machine=powerpc-ibm
+ os=-os400
+ ;;
+ OSE68000 | ose68000)
+ basic_machine=m68000-ericsson
+ os=-ose
+ ;;
+ os68k)
+ basic_machine=m68k-none
+ os=-os68k
+ ;;
+ pa-hitachi)
+ basic_machine=hppa1.1-hitachi
+ os=-hiuxwe2
+ ;;
+ paragon)
+ basic_machine=i860-intel
+ os=-osf
+ ;;
+ pbd)
+ basic_machine=sparc-tti
+ ;;
+ pbb)
+ basic_machine=m68k-tti
+ ;;
+ pc532 | pc532-*)
+ basic_machine=ns32k-pc532
+ ;;
+ pentium | p5 | k5 | k6 | nexgen | viac3)
+ basic_machine=i586-pc
+ ;;
+ pentiumpro | p6 | 6x86 | athlon | athlon_*)
+ basic_machine=i686-pc
+ ;;
+ pentiumii | pentium2 | pentiumiii | pentium3)
+ basic_machine=i686-pc
+ ;;
+ pentium4)
+ basic_machine=i786-pc
+ ;;
+ pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
+ basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ pentiumpro-* | p6-* | 6x86-* | athlon-*)
+ basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*)
+ basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ pentium4-*)
+ basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ pn)
+ basic_machine=pn-gould
+ ;;
+ power) basic_machine=power-ibm
+ ;;
+ ppc) basic_machine=powerpc-unknown
+ ;;
+ ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ ppcle | powerpclittle | ppc-le | powerpc-little)
+ basic_machine=powerpcle-unknown
+ ;;
+ ppcle-* | powerpclittle-*)
+ basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ ppc64) basic_machine=powerpc64-unknown
+ ;;
+ ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ ppc64le | powerpc64little | ppc64-le | powerpc64-little)
+ basic_machine=powerpc64le-unknown
+ ;;
+ ppc64le-* | powerpc64little-*)
+ basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ ps2)
+ basic_machine=i386-ibm
+ ;;
+ pw32)
+ basic_machine=i586-unknown
+ os=-pw32
+ ;;
+ rom68k)
+ basic_machine=m68k-rom68k
+ os=-coff
+ ;;
+ rm[46]00)
+ basic_machine=mips-siemens
+ ;;
+ rtpc | rtpc-*)
+ basic_machine=romp-ibm
+ ;;
+ s390 | s390-*)
+ basic_machine=s390-ibm
+ ;;
+ s390x | s390x-*)
+ basic_machine=s390x-ibm
+ ;;
+ sa29200)
+ basic_machine=a29k-amd
+ os=-udi
+ ;;
+ sb1)
+ basic_machine=mipsisa64sb1-unknown
+ ;;
+ sb1el)
+ basic_machine=mipsisa64sb1el-unknown
+ ;;
+ sei)
+ basic_machine=mips-sei
+ os=-seiux
+ ;;
+ sequent)
+ basic_machine=i386-sequent
+ ;;
+ sh)
+ basic_machine=sh-hitachi
+ os=-hms
+ ;;
+ sh64)
+ basic_machine=sh64-unknown
+ ;;
+ sparclite-wrs | simso-wrs)
+ basic_machine=sparclite-wrs
+ os=-vxworks
+ ;;
+ sps7)
+ basic_machine=m68k-bull
+ os=-sysv2
+ ;;
+ spur)
+ basic_machine=spur-unknown
+ ;;
+ st2000)
+ basic_machine=m68k-tandem
+ ;;
+ stratus)
+ basic_machine=i860-stratus
+ os=-sysv4
+ ;;
+ sun2)
+ basic_machine=m68000-sun
+ ;;
+ sun2os3)
+ basic_machine=m68000-sun
+ os=-sunos3
+ ;;
+ sun2os4)
+ basic_machine=m68000-sun
+ os=-sunos4
+ ;;
+ sun3os3)
+ basic_machine=m68k-sun
+ os=-sunos3
+ ;;
+ sun3os4)
+ basic_machine=m68k-sun
+ os=-sunos4
+ ;;
+ sun4os3)
+ basic_machine=sparc-sun
+ os=-sunos3
+ ;;
+ sun4os4)
+ basic_machine=sparc-sun
+ os=-sunos4
+ ;;
+ sun4sol2)
+ basic_machine=sparc-sun
+ os=-solaris2
+ ;;
+ sun3 | sun3-*)
+ basic_machine=m68k-sun
+ ;;
+ sun4)
+ basic_machine=sparc-sun
+ ;;
+ sun386 | sun386i | roadrunner)
+ basic_machine=i386-sun
+ ;;
+ sv1)
+ basic_machine=sv1-cray
+ os=-unicos
+ ;;
+ symmetry)
+ basic_machine=i386-sequent
+ os=-dynix
+ ;;
+ t3e)
+ basic_machine=alphaev5-cray
+ os=-unicos
+ ;;
+ t90)
+ basic_machine=t90-cray
+ os=-unicos
+ ;;
+ tic54x | c54x*)
+ basic_machine=tic54x-unknown
+ os=-coff
+ ;;
+ tic55x | c55x*)
+ basic_machine=tic55x-unknown
+ os=-coff
+ ;;
+ tic6x | c6x*)
+ basic_machine=tic6x-unknown
+ os=-coff
+ ;;
+ tx39)
+ basic_machine=mipstx39-unknown
+ ;;
+ tx39el)
+ basic_machine=mipstx39el-unknown
+ ;;
+ toad1)
+ basic_machine=pdp10-xkl
+ os=-tops20
+ ;;
+ tower | tower-32)
+ basic_machine=m68k-ncr
+ ;;
+ tpf)
+ basic_machine=s390x-ibm
+ os=-tpf
+ ;;
+ udi29k)
+ basic_machine=a29k-amd
+ os=-udi
+ ;;
+ ultra3)
+ basic_machine=a29k-nyu
+ os=-sym1
+ ;;
+ v810 | necv810)
+ basic_machine=v810-nec
+ os=-none
+ ;;
+ vaxv)
+ basic_machine=vax-dec
+ os=-sysv
+ ;;
+ vms)
+ basic_machine=vax-dec
+ os=-vms
+ ;;
+ vpp*|vx|vx-*)
+ basic_machine=f301-fujitsu
+ ;;
+ vxworks960)
+ basic_machine=i960-wrs
+ os=-vxworks
+ ;;
+ vxworks68)
+ basic_machine=m68k-wrs
+ os=-vxworks
+ ;;
+ vxworks29k)
+ basic_machine=a29k-wrs
+ os=-vxworks
+ ;;
+ w65*)
+ basic_machine=w65-wdc
+ os=-none
+ ;;
+ w89k-*)
+ basic_machine=hppa1.1-winbond
+ os=-proelf
+ ;;
+ xbox)
+ basic_machine=i686-pc
+ os=-mingw32
+ ;;
+ xps | xps100)
+ basic_machine=xps100-honeywell
+ ;;
+ ymp)
+ basic_machine=ymp-cray
+ os=-unicos
+ ;;
+ z8k-*-coff)
+ basic_machine=z8k-unknown
+ os=-sim
+ ;;
+ none)
+ basic_machine=none-none
+ os=-none
+ ;;
+
+# Here we handle the default manufacturer of certain CPU types. It is in
+# some cases the only manufacturer, in others, it is the most popular.
+ w89k)
+ basic_machine=hppa1.1-winbond
+ ;;
+ op50n)
+ basic_machine=hppa1.1-oki
+ ;;
+ op60c)
+ basic_machine=hppa1.1-oki
+ ;;
+ romp)
+ basic_machine=romp-ibm
+ ;;
+ mmix)
+ basic_machine=mmix-knuth
+ ;;
+ rs6000)
+ basic_machine=rs6000-ibm
+ ;;
+ vax)
+ basic_machine=vax-dec
+ ;;
+ pdp10)
+ # there are many clones, so DEC is not a safe bet
+ basic_machine=pdp10-unknown
+ ;;
+ pdp11)
+ basic_machine=pdp11-dec
+ ;;
+ we32k)
+ basic_machine=we32k-att
+ ;;
+ sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele)
+ basic_machine=sh-unknown
+ ;;
+ sparc | sparcv8 | sparcv9 | sparcv9b)
+ basic_machine=sparc-sun
+ ;;
+ cydra)
+ basic_machine=cydra-cydrome
+ ;;
+ orion)
+ basic_machine=orion-highlevel
+ ;;
+ orion105)
+ basic_machine=clipper-highlevel
+ ;;
+ mac | mpw | mac-mpw)
+ basic_machine=m68k-apple
+ ;;
+ pmac | pmac-mpw)
+ basic_machine=powerpc-apple
+ ;;
+ *-unknown)
+ # Make sure to match an already-canonicalized machine name.
+ ;;
+ *)
+ echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
+ exit 1
+ ;;
+esac
+
+# Here we canonicalize certain aliases for manufacturers.
+case $basic_machine in
+ *-digital*)
+ basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'`
+ ;;
+ *-commodore*)
+ basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'`
+ ;;
+ *)
+ ;;
+esac
+
+# Decode manufacturer-specific aliases for certain operating systems.
+
+if [ x"$os" != x"" ]
+then
+case $os in
+ # First match some system type aliases
+ # that might get confused with valid system types.
+ # -solaris* is a basic system type, with this one exception.
+ -solaris1 | -solaris1.*)
+ os=`echo $os | sed -e 's|solaris1|sunos4|'`
+ ;;
+ -solaris)
+ os=-solaris2
+ ;;
+ -svr4*)
+ os=-sysv4
+ ;;
+ -unixware*)
+ os=-sysv4.2uw
+ ;;
+ -gnu/linux*)
+ os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
+ ;;
+ # First accept the basic system types.
+ # The portable systems comes first.
+ # Each alternative MUST END IN A *, to match a version number.
+ # -sysv* is not here because it comes later, after sysvr4.
+ -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
+ | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\
+ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \
+ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
+ | -aos* \
+ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
+ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
+ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* | -openbsd* \
+ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
+ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
+ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
+ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
+ | -chorusos* | -chorusrdb* \
+ | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
+ | -mingw32* | -linux-gnu* | -linux-uclibc* | -uxpv* | -beos* | -mpeix* | -udk* \
+ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
+ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
+ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
+ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
+ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
+ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
+ | -skyos* | -haiku*)
+ # Remember, each alternative MUST END IN *, to match a version number.
+ ;;
+ -qnx*)
+ case $basic_machine in
+ x86-* | i*86-*)
+ ;;
+ *)
+ os=-nto$os
+ ;;
+ esac
+ ;;
+ -nto-qnx*)
+ ;;
+ -nto*)
+ os=`echo $os | sed -e 's|nto|nto-qnx|'`
+ ;;
+ -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
+ | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \
+ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*)
+ ;;
+ -mac*)
+ os=`echo $os | sed -e 's|mac|macos|'`
+ ;;
+ -linux-dietlibc)
+ os=-linux-dietlibc
+ ;;
+ -linux*)
+ os=`echo $os | sed -e 's|linux|linux-gnu|'`
+ ;;
+ -sunos5*)
+ os=`echo $os | sed -e 's|sunos5|solaris2|'`
+ ;;
+ -sunos6*)
+ os=`echo $os | sed -e 's|sunos6|solaris3|'`
+ ;;
+ -opened*)
+ os=-openedition
+ ;;
+ -os400*)
+ os=-os400
+ ;;
+ -wince*)
+ os=-wince
+ ;;
+ -osfrose*)
+ os=-osfrose
+ ;;
+ -osf*)
+ os=-osf
+ ;;
+ -utek*)
+ os=-bsd
+ ;;
+ -dynix*)
+ os=-bsd
+ ;;
+ -acis*)
+ os=-aos
+ ;;
+ -atheos*)
+ os=-atheos
+ ;;
+ -syllable*)
+ os=-syllable
+ ;;
+ -386bsd)
+ os=-bsd
+ ;;
+ -ctix* | -uts*)
+ os=-sysv
+ ;;
+ -nova*)
+ os=-rtmk-nova
+ ;;
+ -ns2 )
+ os=-nextstep2
+ ;;
+ -nsk*)
+ os=-nsk
+ ;;
+ # Preserve the version number of sinix5.
+ -sinix5.*)
+ os=`echo $os | sed -e 's|sinix|sysv|'`
+ ;;
+ -sinix*)
+ os=-sysv4
+ ;;
+ -tpf*)
+ os=-tpf
+ ;;
+ -triton*)
+ os=-sysv3
+ ;;
+ -oss*)
+ os=-sysv3
+ ;;
+ -svr4)
+ os=-sysv4
+ ;;
+ -svr3)
+ os=-sysv3
+ ;;
+ -sysvr4)
+ os=-sysv4
+ ;;
+ # This must come after -sysvr4.
+ -sysv*)
+ ;;
+ -ose*)
+ os=-ose
+ ;;
+ -es1800*)
+ os=-ose
+ ;;
+ -xenix)
+ os=-xenix
+ ;;
+ -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
+ os=-mint
+ ;;
+ -aros*)
+ os=-aros
+ ;;
+ -kaos*)
+ os=-kaos
+ ;;
+ -zvmoe)
+ os=-zvmoe
+ ;;
+ -none)
+ ;;
+ *)
+ # Get rid of the `-' at the beginning of $os.
+ os=`echo $os | sed 's/[^-]*-//'`
+ echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2
+ exit 1
+ ;;
+esac
+else
+
+# Here we handle the default operating systems that come with various machines.
+# The value should be what the vendor currently ships out the door with their
+# machine or put another way, the most popular os provided with the machine.
+
+# Note that if you're going to try to match "-MANUFACTURER" here (say,
+# "-sun"), then you have to tell the case statement up towards the top
+# that MANUFACTURER isn't an operating system. Otherwise, code above
+# will signal an error saying that MANUFACTURER isn't an operating
+# system, and we'll never get to this point.
+
+case $basic_machine in
+ *-acorn)
+ os=-riscix1.2
+ ;;
+ arm*-rebel)
+ os=-linux
+ ;;
+ arm*-semi)
+ os=-aout
+ ;;
+ c4x-* | tic4x-*)
+ os=-coff
+ ;;
+ # This must come before the *-dec entry.
+ pdp10-*)
+ os=-tops20
+ ;;
+ pdp11-*)
+ os=-none
+ ;;
+ *-dec | vax-*)
+ os=-ultrix4.2
+ ;;
+ m68*-apollo)
+ os=-domain
+ ;;
+ i386-sun)
+ os=-sunos4.0.2
+ ;;
+ m68000-sun)
+ os=-sunos3
+ # This also exists in the configure program, but was not the
+ # default.
+ # os=-sunos4
+ ;;
+ m68*-cisco)
+ os=-aout
+ ;;
+ mips*-cisco)
+ os=-elf
+ ;;
+ mips*-*)
+ os=-elf
+ ;;
+ or32-*)
+ os=-coff
+ ;;
+ *-tti) # must be before sparc entry or we get the wrong os.
+ os=-sysv3
+ ;;
+ sparc-* | *-sun)
+ os=-sunos4.1.1
+ ;;
+ *-be)
+ os=-beos
+ ;;
+ *-haiku)
+ os=-haiku
+ ;;
+ *-ibm)
+ os=-aix
+ ;;
+ *-knuth)
+ os=-mmixware
+ ;;
+ *-wec)
+ os=-proelf
+ ;;
+ *-winbond)
+ os=-proelf
+ ;;
+ *-oki)
+ os=-proelf
+ ;;
+ *-hp)
+ os=-hpux
+ ;;
+ *-hitachi)
+ os=-hiux
+ ;;
+ i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
+ os=-sysv
+ ;;
+ *-cbm)
+ os=-amigaos
+ ;;
+ *-dg)
+ os=-dgux
+ ;;
+ *-dolphin)
+ os=-sysv3
+ ;;
+ m68k-ccur)
+ os=-rtu
+ ;;
+ m88k-omron*)
+ os=-luna
+ ;;
+ *-next )
+ os=-nextstep
+ ;;
+ *-sequent)
+ os=-ptx
+ ;;
+ *-crds)
+ os=-unos
+ ;;
+ *-ns)
+ os=-genix
+ ;;
+ i370-*)
+ os=-mvs
+ ;;
+ *-next)
+ os=-nextstep3
+ ;;
+ *-gould)
+ os=-sysv
+ ;;
+ *-highlevel)
+ os=-bsd
+ ;;
+ *-encore)
+ os=-bsd
+ ;;
+ *-sgi)
+ os=-irix
+ ;;
+ *-siemens)
+ os=-sysv4
+ ;;
+ *-masscomp)
+ os=-rtu
+ ;;
+ f30[01]-fujitsu | f700-fujitsu)
+ os=-uxpv
+ ;;
+ *-rom68k)
+ os=-coff
+ ;;
+ *-*bug)
+ os=-coff
+ ;;
+ *-apple)
+ os=-macos
+ ;;
+ *-atari*)
+ os=-mint
+ ;;
+ *)
+ os=-none
+ ;;
+esac
+fi
+
+# Here we handle the case where we know the os, and the CPU type, but not the
+# manufacturer. We pick the logical manufacturer.
+vendor=unknown
+case $basic_machine in
+ *-unknown)
+ case $os in
+ -riscix*)
+ vendor=acorn
+ ;;
+ -sunos*)
+ vendor=sun
+ ;;
+ -aix*)
+ vendor=ibm
+ ;;
+ -beos*)
+ vendor=be
+ ;;
+ -hpux*)
+ vendor=hp
+ ;;
+ -mpeix*)
+ vendor=hp
+ ;;
+ -hiux*)
+ vendor=hitachi
+ ;;
+ -unos*)
+ vendor=crds
+ ;;
+ -dgux*)
+ vendor=dg
+ ;;
+ -luna*)
+ vendor=omron
+ ;;
+ -genix*)
+ vendor=ns
+ ;;
+ -mvs* | -opened*)
+ vendor=ibm
+ ;;
+ -os400*)
+ vendor=ibm
+ ;;
+ -ptx*)
+ vendor=sequent
+ ;;
+ -tpf*)
+ vendor=ibm
+ ;;
+ -vxsim* | -vxworks* | -windiss*)
+ vendor=wrs
+ ;;
+ -aux*)
+ vendor=apple
+ ;;
+ -hms*)
+ vendor=hitachi
+ ;;
+ -mpw* | -macos*)
+ vendor=apple
+ ;;
+ -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
+ vendor=atari
+ ;;
+ -vos*)
+ vendor=stratus
+ ;;
+ esac
+ basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
+ ;;
+esac
+
+echo $basic_machine$os
+exit
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "timestamp='"
+# time-stamp-format: "%:y-%02m-%02d"
+# time-stamp-end: "'"
+# End:
--- /dev/null
+#! /bin/sh
+# Guess values for system-dependent variables and create Makefiles.
+# 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.
+## --------------------- ##
+## 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 <<EOF
+$*
+EOF
+ exit 0
+fi
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+if test -z "$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=
+PACKAGE_TARNAME=
+PACKAGE_VERSION=
+PACKAGE_STRING=
+PACKAGE_BUGREPORT=
+
+ac_unique_file="l7vsd"
+ac_unique_file="config.h.in"
+# Factoring default headers for most tests.
+ac_includes_default="\
+#include <stdio.h>
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+#if STDC_HEADERS
+# include <stdlib.h>
+# include <stddef.h>
+#else
+# if HAVE_STDLIB_H
+# include <stdlib.h>
+# endif
+#endif
+#if HAVE_STRING_H
+# if !STDC_HEADERS && HAVE_MEMORY_H
+# include <memory.h>
+# endif
+# include <string.h>
+#endif
+#if HAVE_STRINGS_H
+# include <strings.h>
+#endif
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+# include <stdint.h>
+# endif
+#endif
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif"
+
+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir 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 CXX CXXFLAGS LDFLAGS CPPFLAGS ac_ct_CXX EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE build build_cpu build_vendor build_os host host_cpu host_vendor host_os CC CFLAGS ac_ct_CC CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE SED EGREP LN_S ECHO AR ac_ct_AR RANLIB ac_ct_RANLIB CPP CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL PKG_CONFIG GLIB_CFLAGS GLIB_LIBS GLIB_GENMARSHAL GOBJECT_QUERY GLIB_MKENUMS LIBOBJS l7vsadm_sockdir l7vs_moddir l7vs_maxvs MANDIR snmpagent_libs 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_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_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_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_CPP_set=${CPP+set}
+ac_env_CPP_value=$CPP
+ac_cv_env_CPP_set=${CPP+set}
+ac_cv_env_CPP_value=$CPP
+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 this package to adapt to many kinds of systems.
+
+Usage: $0 [OPTION]... [VAR=VALUE]...
+
+To assign environment variables (e.g., CC, CFLAGS...), specify them as
+VAR=VALUE. See below for descriptions of some of the useful variables.
+
+Defaults for the options are specified in brackets.
+
+Configuration:
+ -h, --help display this help and exit
+ --help=short display options specific to this package
+ --help=recursive display the short help of all the included packages
+ -V, --version display version information and exit
+ -q, --quiet, --silent do not print \`checking...' messages
+ --cache-file=FILE cache test results in FILE [disabled]
+ -C, --config-cache alias for \`--cache-file=config.cache'
+ -n, --no-create do not create output files
+ --srcdir=DIR find the sources in DIR [configure dir or \`..']
+
+_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
+
+ 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)
+ --disable-glibtest do not try to compile and run a test GLIB program
+
+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-l7vs-moddir=DIR l7vs modules is to be installed in DIR.
+ default=LIBDIR/l7vs
+ --with-l7vsadm-sockdir=DIR l7vsadm sockfile path.
+ default=/var/run/l7vs
+ --with-l7vs-maxvs=NUM l7vsd virtual service max size in NUM.
+ default=64
+
+Some influential environment variables:
+ CXX C++ compiler command
+ CXXFLAGS C++ compiler flags
+ LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a
+ nonstandard directory <lib dir>
+ CPPFLAGS C/C++ preprocessor flags, e.g. -I<include dir> if you have
+ headers in a nonstandard directory <include dir>
+ CC C compiler command
+ CFLAGS C compiler flags
+ CPP C preprocessor
+ CXXCPP C++ preprocessor
+ F77 Fortran 77 compiler command
+ FFLAGS Fortran 77 compiler flags
+
+Use these variables to override the choices made by `configure' or to help
+it to find libraries and programs with nonstandard names/locations.
+
+_ACEOF
+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
+
+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 $as_me, 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
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+PACKAGENAME=l7vsd
+VERSION=2.1.1-0
+GLIB_REQUIRED_VERSION=2.0.0
+
+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=$PACKAGENAME
+ VERSION=$VERSION
+
+
+# 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 -'
+
+
+
+
+
+
+ ac_config_headers="$ac_config_headers config.h"
+
+
+# Checks for programs.
+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 </dev/null >&5\"") >&5
+ (eval $ac_compiler --version </dev/null >&5) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }
+{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v </dev/null >&5\"") >&5
+ (eval $ac_compiler -v </dev/null >&5) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }
+{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V </dev/null >&5\"") >&5
+ (eval $ac_compiler -V </dev/null >&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_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 <stdlib.h>
+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=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="$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
+
+
+# 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/'`
+
+
+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 </dev/null >&5\"") >&5
+ (eval $ac_compiler --version </dev/null >&5) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }
+{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v </dev/null >&5\"") >&5
+ (eval $ac_compiler -v </dev/null >&5) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }
+{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V </dev/null >&5\"") >&5
+ (eval $ac_compiler -V </dev/null >&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_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 <stdarg.h>
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */
+struct buf { int x; };
+FILE * (*rcsopen) (struct buf *, struct stat *, int);
+static char *e (p, i)
+ char **p;
+ int i;
+{
+ return p[i];
+}
+static char *f (char * (*g) (char **, int), char **p, ...)
+{
+ char *s;
+ va_list v;
+ va_start (v,p);
+ s = g (p, va_arg (v,int));
+ va_end (v);
+ return s;
+}
+
+/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has
+ function prototypes and stuff, but not '\xHH' hex character constants.
+ These don't provoke an error unfortunately, instead are silently treated
+ as 'x'. The following induces an error, until -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 <stdlib.h>
+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
+
+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
+
+
+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 </dev/null` in
+ *GNU* | *'with BFD'*)
+ test "$with_gnu_ld" != no && break
+ ;;
+ *)
+ test "$with_gnu_ld" != yes && break
+ ;;
+ esac
+ fi
+ done
+ IFS="$lt_save_ifs"
+else
+ lt_cv_path_LD="$LD" # Let the user override the test with a path.
+fi
+fi
+
+LD="$lt_cv_path_LD"
+if test -n "$LD"; then
+ echo "$as_me:$LINENO: result: $LD" >&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 </dev/null` in
+*GNU* | *'with BFD'*)
+ lt_cv_prog_gnu_ld=yes
+ ;;
+*)
+ lt_cv_prog_gnu_ld=no
+ ;;
+esac
+fi
+echo "$as_me:$LINENO: result: $lt_cv_prog_gnu_ld" >&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 4132 "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 <limits.h> to <assert.h> if __STDC__ is defined, since
+ # <limits.h> exists even on freestanding compilers.
+ # On the NeXT, cc -E runs the code through the compiler's parser,
+ # not just through cpp. "Syntax error" is here to catch this case.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+ Syntax error
+_ACEOF
+if { (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 <ac_nonexistent.h>
+_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 <limits.h> to <assert.h> if __STDC__ is defined, since
+ # <limits.h> exists even on freestanding compilers.
+ # On the NeXT, cc -E runs the code through the compiler's parser,
+ # not just through cpp. "Syntax error" is here to catch this case.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+ Syntax error
+_ACEOF
+if { (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 <ac_nonexistent.h>
+_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 <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <float.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_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 <string.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ $EGREP "memchr" >/dev/null 2>&1; then
+ :
+else
+ ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+ # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <stdlib.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ $EGREP "free" >/dev/null 2>&1; then
+ :
+else
+ ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+ # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
+ if test "$cross_compiling" = yes; then
+ :
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <ctype.h>
+#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 the AC_PACKAGE_NAME lists. ##
+## ------------------------------------------ ##
+_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
+
+
+
+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 <limits.h> to <assert.h> if __STDC__ is defined, since
+ # <limits.h> exists even on freestanding compilers.
+ # On the NeXT, cc -E runs the code through the compiler's parser,
+ # not just through cpp. "Syntax error" is here to catch this case.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+ Syntax error
+_ACEOF
+if { (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 <ac_nonexistent.h>
+_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 <limits.h> to <assert.h> if __STDC__ is defined, since
+ # <limits.h> exists even on freestanding compilers.
+ # On the NeXT, cc -E runs the code through the compiler's parser,
+ # not just through cpp. "Syntax error" is here to catch this case.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+ Syntax error
+_ACEOF
+if { (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 <ac_nonexistent.h>
+_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:5267:" \
+ "checking for Fortran 77 compiler version" >&5
+ac_compiler=`set X $ac_compile; echo $2`
+{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version </dev/null >&5\"") >&5
+ (eval $ac_compiler --version </dev/null >&5) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }
+{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v </dev/null >&5\"") >&5
+ (eval $ac_compiler -v </dev/null >&5) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }
+{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V </dev/null >&5\"") >&5
+ (eval $ac_compiler -V </dev/null >&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 <<EOF
+#ifdef __cplusplus
+extern "C" {
+#endif
+char nm_test_var;
+void nm_test_func(){}
+#ifdef __cplusplus
+}
+#endif
+int main(){nm_test_var='a';nm_test_func();return(0);}
+EOF
+
+ 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
+ # 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 <<EOF > 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 <<EOF >> 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 <<EOF 1>&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 <<EOF 1>&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:6330: $lt_compile\"" >&5)
+ (eval "$lt_compile" 2>conftest.err)
+ ac_status=$?
+ cat conftest.err >&5
+ echo "$as_me:6334: \$? = $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:6598: $lt_compile\"" >&5)
+ (eval "$lt_compile" 2>conftest.err)
+ ac_status=$?
+ cat conftest.err >&5
+ echo "$as_me:6602: \$? = $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:6702: $lt_compile\"" >&5)
+ (eval "$lt_compile" 2>out/conftest.err)
+ ac_status=$?
+ cat out/conftest.err >&5
+ echo "$as_me:6706: \$? = $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 <<EOF 1>&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 <kc5tja@dolphin.openprojects.net> 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 <jrb3@best.com> 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 <<EOF 1>&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<name>.so
+ # instead of lib<name>.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 8171 "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 <limits.h> declares shl_load.
+ For example, HP-UX 11i <limits.h> 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 <limits.h> to <assert.h> if __STDC__ is defined, since
+ <limits.h> exists even on freestanding compilers. */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#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 <limits.h> declares dlopen.
+ For example, HP-UX 11i <limits.h> declares gettimeofday. */
+#define dlopen innocuous_dlopen
+
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char dlopen (); below.
+ Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ <limits.h> exists even on freestanding compilers. */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#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 <<EOF
+#line 9068 "configure"
+#include "confdefs.h"
+
+#if HAVE_DLFCN_H
+#include <dlfcn.h>
+#endif
+
+#include <stdio.h>
+
+#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 <<EOF
+#line 9168 "configure"
+#include "confdefs.h"
+
+#if HAVE_DLFCN_H
+#include <dlfcn.h>
+#endif
+
+#include <stdio.h>
+
+#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 <gord@gnu.ai.mit.edu>, 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 </dev/null` in
+ *GNU* | *'with BFD'*)
+ test "$with_gnu_ld" != no && break
+ ;;
+ *)
+ test "$with_gnu_ld" != yes && break
+ ;;
+ esac
+ fi
+ done
+ IFS="$lt_save_ifs"
+else
+ lt_cv_path_LD="$LD" # Let the user override the test with a path.
+fi
+fi
+
+LD="$lt_cv_path_LD"
+if test -n "$LD"; then
+ echo "$as_me:$LINENO: result: $LD" >&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 </dev/null` in
+*GNU* | *'with BFD'*)
+ lt_cv_prog_gnu_ld=yes
+ ;;
+*)
+ lt_cv_prog_gnu_ld=no
+ ;;
+esac
+fi
+echo "$as_me:$LINENO: result: $lt_cv_prog_gnu_ld" >&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 <jrb3@best.com> 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 <<EOF
+class Foo
+{
+public:
+ Foo (void) { a = 0; }
+private:
+ int a;
+};
+EOF
+
+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
+ # 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:11511: $lt_compile\"" >&5)
+ (eval "$lt_compile" 2>conftest.err)
+ ac_status=$?
+ cat conftest.err >&5
+ echo "$as_me:11515: \$? = $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:11615: $lt_compile\"" >&5)
+ (eval "$lt_compile" 2>out/conftest.err)
+ ac_status=$?
+ cat out/conftest.err >&5
+ echo "$as_me:11619: \$? = $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<name>.so
+ # instead of lib<name>.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 12151 "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:13209: $lt_compile\"" >&5)
+ (eval "$lt_compile" 2>conftest.err)
+ ac_status=$?
+ cat conftest.err >&5
+ echo "$as_me:13213: \$? = $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:13313: $lt_compile\"" >&5)
+ (eval "$lt_compile" 2>out/conftest.err)
+ ac_status=$?
+ cat out/conftest.err >&5
+ echo "$as_me:13317: \$? = $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 <<EOF 1>&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 <kc5tja@dolphin.openprojects.net> 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 <jrb3@best.com> 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 <<EOF 1>&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<name>.so
+ # instead of lib<name>.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 14762 "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:15540: $lt_compile\"" >&5)
+ (eval "$lt_compile" 2>conftest.err)
+ ac_status=$?
+ cat conftest.err >&5
+ echo "$as_me:15544: \$? = $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:15808: $lt_compile\"" >&5)
+ (eval "$lt_compile" 2>conftest.err)
+ ac_status=$?
+ cat conftest.err >&5
+ echo "$as_me:15812: \$? = $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:15912: $lt_compile\"" >&5)
+ (eval "$lt_compile" 2>out/conftest.err)
+ ac_status=$?
+ cat out/conftest.err >&5
+ echo "$as_me:15916: \$? = $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 <<EOF 1>&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 <kc5tja@dolphin.openprojects.net> 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 <jrb3@best.com> 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 <<EOF 1>&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<name>.so
+ # instead of lib<name>.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 17381 "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
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# Checks for libraries.
+# Check whether --enable-glibtest or --disable-glibtest was given.
+if test "${enable_glibtest+set}" = set; then
+ enableval="$enable_glibtest"
+
+else
+ enable_glibtest=yes
+fi;
+
+ pkg_config_args=glib-2.0
+ for module in . gobject
+ do
+ case "$module" in
+ gmodule)
+ pkg_config_args="$pkg_config_args gmodule-2.0"
+ ;;
+ gmodule-no-export)
+ pkg_config_args="$pkg_config_args gmodule-no-export-2.0"
+ ;;
+ gobject)
+ pkg_config_args="$pkg_config_args gobject-2.0"
+ ;;
+ gthread)
+ pkg_config_args="$pkg_config_args gthread-2.0"
+ ;;
+ esac
+ done
+
+ # Extract the first word of "pkg-config", so it can be a program name with args.
+set dummy pkg-config; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_path_PKG_CONFIG+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ case $PKG_CONFIG in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+ test -z "$ac_cv_path_PKG_CONFIG" && ac_cv_path_PKG_CONFIG="no"
+ ;;
+esac
+fi
+PKG_CONFIG=$ac_cv_path_PKG_CONFIG
+
+if test -n "$PKG_CONFIG"; then
+ echo "$as_me:$LINENO: result: $PKG_CONFIG" >&5
+echo "${ECHO_T}$PKG_CONFIG" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+
+ no_glib=""
+
+ if test x$PKG_CONFIG != xno ; then
+ if $PKG_CONFIG --atleast-pkgconfig-version 0.7 ; then
+ :
+ else
+ echo *** pkg-config too old; version 0.7 or better required.
+ no_glib=yes
+ PKG_CONFIG=no
+ fi
+ else
+ no_glib=yes
+ fi
+
+ min_glib_version=$GLIB_REQUIRED_VERSION
+ echo "$as_me:$LINENO: checking for GLIB - version >= $min_glib_version" >&5
+echo $ECHO_N "checking for GLIB - version >= $min_glib_version... $ECHO_C" >&6
+
+ if test x$PKG_CONFIG != xno ; then
+ ## don't try to run the test against uninstalled libtool libs
+ if $PKG_CONFIG --uninstalled $pkg_config_args; then
+ echo "Will use uninstalled version of GLib found in PKG_CONFIG_PATH"
+ enable_glibtest=no
+ fi
+
+ if $PKG_CONFIG --atleast-version $min_glib_version $pkg_config_args; then
+ :
+ else
+ no_glib=yes
+ fi
+ fi
+
+ if test x"$no_glib" = x ; then
+ GLIB_GENMARSHAL=`$PKG_CONFIG --variable=glib_genmarshal glib-2.0`
+ GOBJECT_QUERY=`$PKG_CONFIG --variable=gobject_query glib-2.0`
+ GLIB_MKENUMS=`$PKG_CONFIG --variable=glib_mkenums glib-2.0`
+
+ GLIB_CFLAGS=`$PKG_CONFIG --cflags $pkg_config_args`
+ GLIB_LIBS=`$PKG_CONFIG --libs $pkg_config_args`
+ glib_config_major_version=`$PKG_CONFIG --modversion glib-2.0 | \
+ sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\1/'`
+ glib_config_minor_version=`$PKG_CONFIG --modversion glib-2.0 | \
+ sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\2/'`
+ glib_config_micro_version=`$PKG_CONFIG --modversion glib-2.0 | \
+ sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\3/'`
+ if test "x$enable_glibtest" = "xyes" ; then
+ ac_save_CFLAGS="$CFLAGS"
+ ac_save_LIBS="$LIBS"
+ CFLAGS="$CFLAGS $GLIB_CFLAGS"
+ LIBS="$GLIB_LIBS $LIBS"
+ rm -f conf.glibtest
+ if test "$cross_compiling" = yes; then
+ echo $ac_n "cross compiling; assumed OK... $ac_c"
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+#include <glib.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+int
+main ()
+{
+ int major, minor, micro;
+ char *tmp_version;
+
+ system ("touch conf.glibtest");
+
+ /* HP/UX 9 (%@#!) writes to sscanf strings */
+ tmp_version = g_strdup("$min_glib_version");
+ if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) {
+ printf("%s, bad version string\n", "$min_glib_version");
+ exit(1);
+ }
+
+ if ((glib_major_version != $glib_config_major_version) ||
+ (glib_minor_version != $glib_config_minor_version) ||
+ (glib_micro_version != $glib_config_micro_version))
+ {
+ printf("\n*** 'pkg-config --modversion glib-2.0' returned %d.%d.%d, but GLIB (%d.%d.%d)\n",
+ $glib_config_major_version, $glib_config_minor_version, $glib_config_micro_version,
+ glib_major_version, glib_minor_version, glib_micro_version);
+ printf ("*** was found! If pkg-config was correct, then it is best\n");
+ printf ("*** to remove the old version of GLib. You may also be able to fix the error\n");
+ printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n");
+ printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n");
+ printf("*** required on your system.\n");
+ printf("*** If pkg-config was wrong, set the environment variable PKG_CONFIG_PATH\n");
+ printf("*** to point to the correct configuration files\n");
+ }
+ else if ((glib_major_version != GLIB_MAJOR_VERSION) ||
+ (glib_minor_version != GLIB_MINOR_VERSION) ||
+ (glib_micro_version != GLIB_MICRO_VERSION))
+ {
+ printf("*** GLIB header files (version %d.%d.%d) do not match\n",
+ GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION, GLIB_MICRO_VERSION);
+ printf("*** library (version %d.%d.%d)\n",
+ glib_major_version, glib_minor_version, glib_micro_version);
+ }
+ else
+ {
+ if ((glib_major_version > major) ||
+ ((glib_major_version == major) && (glib_minor_version > minor)) ||
+ ((glib_major_version == major) && (glib_minor_version == minor) && (glib_micro_version >= micro)))
+ {
+ return 0;
+ }
+ else
+ {
+ printf("\n*** An old version of GLIB (%d.%d.%d) was found.\n",
+ glib_major_version, glib_minor_version, glib_micro_version);
+ printf("*** You need a version of GLIB newer than %d.%d.%d. The latest version of\n",
+ major, minor, micro);
+ printf("*** GLIB is always available from ftp://ftp.gtk.org.\n");
+ printf("***\n");
+ printf("*** If you have already installed a sufficiently new version, this error\n");
+ printf("*** probably means that the wrong copy of the pkg-config shell script is\n");
+ printf("*** being found. The easiest way to fix this is to remove the old version\n");
+ printf("*** of GLIB, but you can also set the PKG_CONFIG environment to point to the\n");
+ printf("*** correct copy of pkg-config. (In this case, you will have to\n");
+ printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
+ printf("*** so that the correct libraries are found at run-time))\n");
+ }
+ }
+ return 1;
+}
+
+_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 )
+no_glib=yes
+fi
+rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+ CFLAGS="$ac_save_CFLAGS"
+ LIBS="$ac_save_LIBS"
+ fi
+ fi
+ if test "x$no_glib" = x ; then
+ echo "$as_me:$LINENO: result: yes (version $glib_config_major_version.$glib_config_minor_version.$glib_config_micro_version)" >&5
+echo "${ECHO_T}yes (version $glib_config_major_version.$glib_config_minor_version.$glib_config_micro_version)" >&6
+ :
+ else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+ if test "$PKG_CONFIG" = "no" ; then
+ echo "*** A new enough version of pkg-config was not found."
+ echo "*** See http://www.freedesktop.org/software/pkgconfig/"
+ else
+ if test -f conf.glibtest ; then
+ :
+ else
+ echo "*** Could not run GLIB test program, checking why..."
+ ac_save_CFLAGS="$CFLAGS"
+ ac_save_LIBS="$LIBS"
+ CFLAGS="$CFLAGS $GLIB_CFLAGS"
+ LIBS="$LIBS $GLIB_LIBS"
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+#include <glib.h>
+#include <stdio.h>
+
+int
+main ()
+{
+ return ((glib_major_version) || (glib_minor_version) || (glib_micro_version));
+ ;
+ 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
+ echo "*** The test program compiled, but did not run. This usually means"
+ echo "*** that the run-time linker is not finding GLIB or finding the wrong"
+ echo "*** version of GLIB. If it is not finding GLIB, you'll need to set your"
+ echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
+ echo "*** to the installed location Also, make sure you have run ldconfig if that"
+ echo "*** is required on your system"
+ echo "***"
+ echo "*** If you have an old version installed, it is best to remove it, although"
+ echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ echo "*** The test program failed to compile or link. See the file config.log for the"
+ echo "*** exact error that occured. This usually means GLIB is incorrectly installed."
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+ CFLAGS="$ac_save_CFLAGS"
+ LIBS="$ac_save_LIBS"
+ fi
+ fi
+ GLIB_CFLAGS=""
+ GLIB_LIBS=""
+ GLIB_GENMARSHAL=""
+ GOBJECT_QUERY=""
+ GLIB_MKENUMS=""
+ { { echo "$as_me:$LINENO: error: Test for GLib failed." >&5
+echo "$as_me: error: Test for GLib failed." >&2;}
+ { (exit 1); exit 1; }; }
+ fi
+
+
+
+
+
+ rm -f conf.glibtest
+
+echo "$as_me:$LINENO: checking for g_list_append in -lglib-2.0" >&5
+echo $ECHO_N "checking for g_list_append in -lglib-2.0... $ECHO_C" >&6
+if test "${ac_cv_lib_glib_2_0_g_list_append+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lglib-2.0 $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 g_list_append ();
+int
+main ()
+{
+g_list_append ();
+ ;
+ 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_glib_2_0_g_list_append=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_glib_2_0_g_list_append=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_glib_2_0_g_list_append" >&5
+echo "${ECHO_T}$ac_cv_lib_glib_2_0_g_list_append" >&6
+if test $ac_cv_lib_glib_2_0_g_list_append = yes; then
+ :
+else
+ { { echo "$as_me:$LINENO: error: l7vsd require GLib2.0 or later " >&5
+echo "$as_me: error: l7vsd require GLib2.0 or later " >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+
+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
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBDL 1
+_ACEOF
+
+ LIBS="-ldl $LIBS"
+
+fi
+
+echo "$as_me:$LINENO: checking for main in -llog4cxx" >&5
+echo $ECHO_N "checking for main in -llog4cxx... $ECHO_C" >&6
+if test "${ac_cv_lib_log4cxx_main+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-llog4cxx $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+
+int
+main ()
+{
+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
+ ac_cv_lib_log4cxx_main=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_log4cxx_main=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_log4cxx_main" >&5
+echo "${ECHO_T}$ac_cv_lib_log4cxx_main" >&6
+if test $ac_cv_lib_log4cxx_main = yes; then
+ :
+else
+ { { echo "$as_me:$LINENO: error: l7vsd require log4cxx library. " >&5
+echo "$as_me: error: l7vsd require log4cxx library. " >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+#AC_CHECK_LIB(netsnmp, snmp_pdu_create, :,
+# [AC_MSG_ERROR( l7vsd require net-snmp library. )] )
+
+# Checks for header files.
+echo "$as_me:$LINENO: checking for ANSI C header files" >&5
+echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6
+if test "${ac_cv_header_stdc+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <float.h>
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (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 <string.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ $EGREP "memchr" >/dev/null 2>&1; then
+ :
+else
+ ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+ # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <stdlib.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ $EGREP "free" >/dev/null 2>&1; then
+ :
+else
+ ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+ # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
+ if test "$cross_compiling" = yes; then
+ :
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <ctype.h>
+#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
+
+
+
+for ac_header in stdlib.h unistd.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 the AC_PACKAGE_NAME lists. ##
+## ------------------------------------------ ##
+_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
+
+# Checks for library functions.
+
+for ac_header in stdlib.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 the AC_PACKAGE_NAME lists. ##
+## ------------------------------------------ ##
+_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 for GNU libc compatible malloc" >&5
+echo $ECHO_N "checking for GNU libc compatible malloc... $ECHO_C" >&6
+if test "${ac_cv_func_malloc_0_nonnull+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test "$cross_compiling" = yes; then
+ ac_cv_func_malloc_0_nonnull=no
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#if STDC_HEADERS || HAVE_STDLIB_H
+# include <stdlib.h>
+#else
+char *malloc ();
+#endif
+
+int
+main ()
+{
+exit (malloc (0) ? 0 : 1);
+ ;
+ return 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
+ ac_cv_func_malloc_0_nonnull=yes
+else
+ echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+ac_cv_func_malloc_0_nonnull=no
+fi
+rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+fi
+echo "$as_me:$LINENO: result: $ac_cv_func_malloc_0_nonnull" >&5
+echo "${ECHO_T}$ac_cv_func_malloc_0_nonnull" >&6
+if test $ac_cv_func_malloc_0_nonnull = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_MALLOC 1
+_ACEOF
+
+else
+ cat >>confdefs.h <<\_ACEOF
+#define HAVE_MALLOC 0
+_ACEOF
+
+ case $LIBOBJS in
+ "malloc.$ac_objext" | \
+ *" malloc.$ac_objext" | \
+ "malloc.$ac_objext "* | \
+ *" malloc.$ac_objext "* ) ;;
+ *) LIBOBJS="$LIBOBJS malloc.$ac_objext" ;;
+esac
+
+
+cat >>confdefs.h <<\_ACEOF
+#define malloc rpl_malloc
+_ACEOF
+
+fi
+
+
+
+
+
+
+
+for ac_func in select socket strdup strerror
+do
+as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for $ac_func" >&5
+echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
+if 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 <limits.h> declares $ac_func.
+ For example, HP-UX 11i <limits.h> 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 <limits.h> to <assert.h> if __STDC__ is defined, since
+ <limits.h> exists even on freestanding compilers. */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#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
+
+
+# application-specific option
+if test `uname -m` == "x86_64"; then
+ libdir=/usr/lib64
+
+# SNMP_CONFIG_COMMAND="net-snmp-config-x86_64"
+else
+ libdir=/usr/lib
+
+# SNMP_CONFIG_COMMAND="net-snmp-config"
+fi
+
+mandir=/usr/share/man
+
+
+
+# Check whether --with-l7vs-moddir or --without-l7vs-moddir was given.
+if test "${with_l7vs_moddir+set}" = set; then
+ withval="$with_l7vs_moddir"
+ l7vs_moddir="$withval"
+else
+ l7vs_moddir="${libdir}/l7vs"
+
+fi;
+
+
+# Check whether --with-l7vsadm-sockdir or --without-l7vsadm-sockdir was given.
+if test "${with_l7vsadm_sockdir+set}" = set; then
+ withval="$with_l7vsadm_sockdir"
+ l7vsadm_sockdir="$withval"
+else
+ l7vsadm_sockdir="/var/run/l7vs"
+
+fi;
+
+
+# Check whether --with-l7vs-maxvs or --without-l7vs-maxvs was given.
+if test "${with_l7vs_maxvs+set}" = set; then
+ withval="$with_l7vs_maxvs"
+ l7vs_maxvs="$withval"
+else
+ l7vs_maxvs="64"
+
+fi;
+
+#AC_CHECK_PROG( snmpagent_libs, $SNMP_CONFIG_COMMAND, `$SNMP_CONFIG_COMMAND --agent-libs` )
+#if test "x$snmpagent_libs" = x; then
+# AC_MSG_ERROR([ cannot found $SNMP_CONFIG_COMMAND command. ])
+#fi
+
+CC=g++
+
+exec_prefix=/usr
+
+mandir=/usr/share/man
+
+
+
+
+
+
+ ac_config_files="$ac_config_files parameter/Makefile logger/Makefile Makefile debian/Makefile module/Makefile module/protocol/Makefile module/schedule/Makefile src/Makefile conf/Makefile init.d/Makefile l7directord/Makefile man/Makefile"
+
+ ac_config_files="$ac_config_files ultramonkeyl7.spec"
+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
+
+DEFS=-DHAVE_CONFIG_H
+
+ac_libobjs=
+ac_ltlibobjs=
+for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue
+ # 1. Remove the extension, and $U if already installed.
+ ac_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
+LIBOBJS=$ac_libobjs
+
+LTLIBOBJS=$ac_ltlibobjs
+
+
+if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then
+ { { echo "$as_me:$LINENO: error: conditional \"AMDEP\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"AMDEP\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+if test -z "${am__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 "${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
+
+: ${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 $as_me, 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
+ --header=FILE[:TEMPLATE]
+ instantiate the configuration header FILE
+
+Configuration files:
+$config_files
+
+Configuration headers:
+$config_headers
+
+Configuration commands:
+$config_commands
+
+Report bugs to <bug-autoconf@gnu.org>."
+_ACEOF
+
+cat >>$CONFIG_STATUS <<_ACEOF
+ac_cs_version="\\
+config.status
+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.
+ "parameter/Makefile" ) CONFIG_FILES="$CONFIG_FILES parameter/Makefile" ;;
+ "logger/Makefile" ) CONFIG_FILES="$CONFIG_FILES logger/Makefile" ;;
+ "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;;
+ "debian/Makefile" ) CONFIG_FILES="$CONFIG_FILES debian/Makefile" ;;
+ "module/Makefile" ) CONFIG_FILES="$CONFIG_FILES module/Makefile" ;;
+ "module/protocol/Makefile" ) CONFIG_FILES="$CONFIG_FILES module/protocol/Makefile" ;;
+ "module/schedule/Makefile" ) CONFIG_FILES="$CONFIG_FILES module/schedule/Makefile" ;;
+ "src/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/Makefile" ;;
+ "conf/Makefile" ) CONFIG_FILES="$CONFIG_FILES conf/Makefile" ;;
+ "init.d/Makefile" ) CONFIG_FILES="$CONFIG_FILES init.d/Makefile" ;;
+ "l7directord/Makefile" ) CONFIG_FILES="$CONFIG_FILES l7directord/Makefile" ;;
+ "man/Makefile" ) CONFIG_FILES="$CONFIG_FILES man/Makefile" ;;
+ "ultramonkeyl7.spec" ) CONFIG_FILES="$CONFIG_FILES ultramonkeyl7.spec" ;;
+ "depfiles" ) CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;;
+ "config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;;
+ *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5
+echo "$as_me: error: invalid argument: $ac_config_target" >&2;}
+ { (exit 1); exit 1; }; };;
+ esac
+done
+
+# If the user did not use the arguments to specify the items to instantiate,
+# then the envvar interface is used. Set only those that are not.
+# We use the long form for the default assignment because of an extremely
+# bizarre bug on SunOS 4.1.3.
+if $ac_need_defaults; then
+ test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files
+ test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers
+ test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands
+fi
+
+# Have a temporary directory for convenience. Make it in the build tree
+# simply because there is no reason 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,@CXX@,$CXX,;t t
+s,@CXXFLAGS@,$CXXFLAGS,;t t
+s,@LDFLAGS@,$LDFLAGS,;t t
+s,@CPPFLAGS@,$CPPFLAGS,;t t
+s,@ac_ct_CXX@,$ac_ct_CXX,;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,@CXXDEPMODE@,$CXXDEPMODE,;t t
+s,@am__fastdepCXX_TRUE@,$am__fastdepCXX_TRUE,;t t
+s,@am__fastdepCXX_FALSE@,$am__fastdepCXX_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,@CC@,$CC,;t t
+s,@CFLAGS@,$CFLAGS,;t t
+s,@ac_ct_CC@,$ac_ct_CC,;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,@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,@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,@PKG_CONFIG@,$PKG_CONFIG,;t t
+s,@GLIB_CFLAGS@,$GLIB_CFLAGS,;t t
+s,@GLIB_LIBS@,$GLIB_LIBS,;t t
+s,@GLIB_GENMARSHAL@,$GLIB_GENMARSHAL,;t t
+s,@GOBJECT_QUERY@,$GOBJECT_QUERY,;t t
+s,@GLIB_MKENUMS@,$GLIB_MKENUMS,;t t
+s,@LIBOBJS@,$LIBOBJS,;t t
+s,@l7vsadm_sockdir@,$l7vsadm_sockdir,;t t
+s,@l7vs_moddir@,$l7vs_moddir,;t t
+s,@l7vs_maxvs@,$l7vs_maxvs,;t t
+s,@MANDIR@,$MANDIR,;t t
+s,@snmpagent_libs@,$snmpagent_libs,;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_HEADER section.
+#
+
+# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where
+# NAME is the cpp macro being defined and VALUE is the value it is being given.
+#
+# ac_d sets the value in "#define NAME VALUE" lines.
+ac_dA='s,^\([ ]*\)#\([ ]*define[ ][ ]*\)'
+ac_dB='[ ].*$,\1#\2'
+ac_dC=' '
+ac_dD=',;t'
+# ac_u turns "#undef NAME" without trailing blanks into "#define NAME VALUE".
+ac_uA='s,^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)'
+ac_uB='$,\1#\2define\3'
+ac_uC=' '
+ac_uD=',;t'
+
+for ac_file in : $CONFIG_HEADERS; 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
+
+ test x"$ac_file" != x- && { echo "$as_me:$LINENO: creating $ac_file" >&5
+echo "$as_me: creating $ac_file" >&6;}
+
+ # 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; }; }
+ # Do quote $f, to prevent DOS paths from being IFS'd.
+ 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; }
+ # Remove the trailing spaces.
+ sed 's/[ ]*$//' $ac_file_inputs >$tmp/in
+
+_ACEOF
+
+# Transform confdefs.h into two sed scripts, `conftest.defines' and
+# `conftest.undefs', that substitutes the proper values into
+# config.h.in to produce config.h. The first handles `#define'
+# templates, and the second `#undef' templates.
+# And first: Protect against being on the right side of a sed subst in
+# config.status. Protect against being in an unquoted here document
+# in config.status.
+rm -f conftest.defines conftest.undefs
+# Using a here document instead of a string reduces the quoting nightmare.
+# Putting comments in sed scripts is not portable.
+#
+# `end' is used to avoid that the second main sed command (meant for
+# 0-ary CPP macros) applies to n-ary macro definitions.
+# See the Autoconf documentation for `clear'.
+cat >confdef2sed.sed <<\_ACEOF
+s/[\\&,]/\\&/g
+s,[\\$`],\\&,g
+t clear
+: clear
+s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*\)\(([^)]*)\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1\2${ac_dC}\3${ac_dD},gp
+t end
+s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD},gp
+: end
+_ACEOF
+# If some macros were called several times there might be several times
+# the same #defines, which is useless. Nevertheless, we may not want to
+# sort them, since we want the *last* AC-DEFINE to be honored.
+uniq confdefs.h | sed -n -f confdef2sed.sed >conftest.defines
+sed 's/ac_d/ac_u/g' conftest.defines >conftest.undefs
+rm -f confdef2sed.sed
+
+# This sed command replaces #undef with comments. This is necessary, for
+# example, in the case of _POSIX_SOURCE, which is predefined and required
+# on some systems where configure will not decide to define it.
+cat >>conftest.undefs <<\_ACEOF
+s,^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */,
+_ACEOF
+
+# Break up conftest.defines because some shells have a limit on the size
+# of here documents, and old seds have small limits too (100 cmds).
+echo ' # Handle all the #define templates only if necessary.' >>$CONFIG_STATUS
+echo ' if grep "^[ ]*#[ ]*define" $tmp/in >/dev/null; then' >>$CONFIG_STATUS
+echo ' # If there are no defines, we may have an empty if/fi' >>$CONFIG_STATUS
+echo ' :' >>$CONFIG_STATUS
+rm -f conftest.tail
+while grep . conftest.defines >/dev/null
+do
+ # Write a limited-size here document to $tmp/defines.sed.
+ echo ' cat >$tmp/defines.sed <<CEOF' >>$CONFIG_STATUS
+ # Speed up: don't consider the non `#define' lines.
+ echo '/^[ ]*#[ ]*define/!b' >>$CONFIG_STATUS
+ # Work around the forget-to-reset-the-flag bug.
+ echo 't clr' >>$CONFIG_STATUS
+ echo ': clr' >>$CONFIG_STATUS
+ sed ${ac_max_here_lines}q conftest.defines >>$CONFIG_STATUS
+ echo 'CEOF
+ sed -f $tmp/defines.sed $tmp/in >$tmp/out
+ rm -f $tmp/in
+ mv $tmp/out $tmp/in
+' >>$CONFIG_STATUS
+ sed 1,${ac_max_here_lines}d conftest.defines >conftest.tail
+ rm -f conftest.defines
+ mv conftest.tail conftest.defines
+done
+rm -f conftest.defines
+echo ' fi # grep' >>$CONFIG_STATUS
+echo >>$CONFIG_STATUS
+
+# Break up conftest.undefs because some shells have a limit on the size
+# of here documents, and old seds have small limits too (100 cmds).
+echo ' # Handle all the #undef templates' >>$CONFIG_STATUS
+rm -f conftest.tail
+while grep . conftest.undefs >/dev/null
+do
+ # Write a limited-size here document to $tmp/undefs.sed.
+ echo ' cat >$tmp/undefs.sed <<CEOF' >>$CONFIG_STATUS
+ # Speed up: don't consider the non `#undef'
+ echo '/^[ ]*#[ ]*undef/!b' >>$CONFIG_STATUS
+ # Work around the forget-to-reset-the-flag bug.
+ echo 't clr' >>$CONFIG_STATUS
+ echo ': clr' >>$CONFIG_STATUS
+ sed ${ac_max_here_lines}q conftest.undefs >>$CONFIG_STATUS
+ echo 'CEOF
+ sed -f $tmp/undefs.sed $tmp/in >$tmp/out
+ rm -f $tmp/in
+ mv $tmp/out $tmp/in
+' >>$CONFIG_STATUS
+ sed 1,${ac_max_here_lines}d conftest.undefs >conftest.tail
+ rm -f conftest.undefs
+ mv conftest.tail conftest.undefs
+done
+rm -f conftest.undefs
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+ # 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
+ echo "/* Generated by configure. */" >$tmp/config.h
+ else
+ echo "/* $ac_file. Generated by configure. */" >$tmp/config.h
+ fi
+ cat $tmp/in >>$tmp/config.h
+ rm -f $tmp/in
+ if test x"$ac_file" != x-; then
+ if diff $ac_file $tmp/config.h >/dev/null 2>&1; then
+ { echo "$as_me:$LINENO: $ac_file is unchanged" >&5
+echo "$as_me: $ac_file is unchanged" >&6;}
+ else
+ 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; }; }; }
+
+ rm -f $ac_file
+ mv $tmp/config.h $ac_file
+ fi
+ else
+ cat $tmp/config.h
+ rm -f $tmp/config.h
+ fi
+# Compute $ac_file's index in $config_headers.
+_am_stamp_count=1
+for _am_header in $config_headers :; do
+ case $_am_header in
+ $ac_file | $ac_file:* )
+ break ;;
+ * )
+ _am_stamp_count=`expr $_am_stamp_count + 1` ;;
+ esac
+done
+echo "timestamp for $ac_file" >`(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'`/stamp-h$_am_stamp_count
+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
+
+
--- /dev/null
+AC_PREREQ(2.59)
+AC_INIT(l7vsd)
+PACKAGENAME=l7vsd
+VERSION=2.1.2-1
+GLIB_REQUIRED_VERSION=2.0.0
+
+AM_INIT_AUTOMAKE($PACKAGENAME, $VERSION, no-define )
+AC_CONFIG_SRCDIR([config.h.in])
+AC_CONFIG_HEADER([config.h])
+
+# Checks for programs.
+AC_PROG_CXX
+AC_PROG_LIBTOOL
+
+# Checks for libraries.
+AM_PATH_GLIB_2_0($GLIB_REQUIRED_VERSION,,
+ [AC_MSG_ERROR(Test for GLib failed.)],
+ gobject)
+AC_CHECK_LIB(glib-2.0, g_list_append, :,
+ [AC_MSG_ERROR( l7vsd require GLib2.0 or later )])
+AC_CHECK_LIB(dl, dlopen)
+AC_CHECK_LIB(log4cxx, main, :,
+ [AC_MSG_ERROR( l7vsd require log4cxx library. )] )
+#AC_CHECK_LIB(netsnmp, snmp_pdu_create, :,
+# [AC_MSG_ERROR( l7vsd require net-snmp library. )] )
+
+# Checks for header files.
+AC_HEADER_STDC
+AC_CHECK_HEADERS([stdlib.h unistd.h])
+# Checks for library functions.
+AC_FUNC_MALLOC
+AC_CHECK_FUNCS(select socket strdup strerror)
+
+# application-specific option
+if test `uname -m` == "x86_64"; then
+ AC_SUBST( libdir, [/usr/lib64] )
+# SNMP_CONFIG_COMMAND="net-snmp-config-x86_64"
+else
+ AC_SUBST( libdir, [/usr/lib] )
+# SNMP_CONFIG_COMMAND="net-snmp-config"
+fi
+
+AC_SUBST(mandir, [/usr/share/man])
+
+AC_ARG_WITH(
+ l7vs-moddir,
+ [ --with-l7vs-moddir=DIR l7vs modules is to be installed in DIR.
+ [default=LIBDIR/l7vs] ],
+ [ l7vs_moddir="$withval" ],
+ [ l7vs_moddir="${libdir}/l7vs" ]
+)
+
+AC_ARG_WITH(
+ l7vsadm-sockdir,
+ [ --with-l7vsadm-sockdir=DIR l7vsadm sockfile path.
+ [default=/var/run/l7vs] ],
+ [ l7vsadm_sockdir="$withval" ],
+ [ l7vsadm_sockdir="/var/run/l7vs" ]
+)
+
+AC_ARG_WITH(
+ l7vs-maxvs,
+ [ --with-l7vs-maxvs=NUM l7vsd virtual service max size in NUM.
+ [default=64] ],
+ [ l7vs_maxvs="$withval" ],
+ [ l7vs_maxvs="64" ]
+)
+
+#AC_CHECK_PROG( snmpagent_libs, $SNMP_CONFIG_COMMAND, `$SNMP_CONFIG_COMMAND --agent-libs` )
+#if test "x$snmpagent_libs" = x; then
+# AC_MSG_ERROR([ cannot found $SNMP_CONFIG_COMMAND command. ])
+#fi
+
+AC_SUBST(CC,g++)
+AC_SUBST(exec_prefix, [/usr] )
+AC_SUBST(mandir, [/usr/share/man] )
+AC_SUBST(l7vsadm_sockdir)
+AC_SUBST(l7vs_moddir)
+AC_SUBST(l7vs_maxvs)
+AC_SUBST(MANDIR)
+AC_SUBST(snmpagent_libs)
+AC_CONFIG_FILES([parameter/Makefile]
+ [logger/Makefile]
+ [Makefile]
+ [debian/Makefile]
+ [module/Makefile]
+ [module/protocol/Makefile]
+ [module/schedule/Makefile]
+ [src/Makefile]
+ [conf/Makefile]
+ [init.d/Makefile]
+ [l7directord/Makefile]
+ [man/Makefile])
+AC_OUTPUT(ultramonkeyl7.spec)
+
--- /dev/null
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# debian/Makefile. Generated from Makefile.in by configure.
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+
+srcdir = .
+top_srcdir = ..
+
+pkgdatadir = $(datadir)/l7vsd
+pkglibdir = $(libdir)/l7vsd
+pkgincludedir = $(includedir)/l7vsd
+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
+subdir = debian
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+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)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = ${SHELL} /usr/src/redhat/SOURCES/ultramonkey-l7-2.1.1/missing --run aclocal-1.9
+AMDEP_FALSE = #
+AMDEP_TRUE =
+AMTAR = ${SHELL} /usr/src/redhat/SOURCES/ultramonkey-l7-2.1.1/missing --run tar
+AR = ar
+AUTOCONF = ${SHELL} /usr/src/redhat/SOURCES/ultramonkey-l7-2.1.1/missing --run autoconf
+AUTOHEADER = ${SHELL} /usr/src/redhat/SOURCES/ultramonkey-l7-2.1.1/missing --run autoheader
+AUTOMAKE = ${SHELL} /usr/src/redhat/SOURCES/ultramonkey-l7-2.1.1/missing --run automake-1.9
+AWK = gawk
+CC = g++
+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 = -DHAVE_CONFIG_H
+DEPDIR = .deps
+ECHO = echo
+ECHO_C =
+ECHO_N = -n
+ECHO_T =
+EGREP = grep -E
+EXEEXT =
+F77 = f95
+FFLAGS = -g -O2
+GLIB_CFLAGS = -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include
+GLIB_GENMARSHAL = glib-genmarshal
+GLIB_LIBS = -L/lib -lgobject-2.0 -lglib-2.0
+GLIB_MKENUMS = glib-mkenums
+GOBJECT_QUERY = gobject-query
+INSTALL_DATA = ${INSTALL} -m 644
+INSTALL_PROGRAM = ${INSTALL}
+INSTALL_SCRIPT = ${INSTALL}
+INSTALL_STRIP_PROGRAM = ${SHELL} $(install_sh) -c -s
+LDFLAGS =
+LIBOBJS =
+LIBS = -ldl
+LIBTOOL = $(SHELL) $(top_builddir)/libtool
+LN_S = ln -s
+LTLIBOBJS =
+MAKEINFO = ${SHELL} /usr/src/redhat/SOURCES/ultramonkey-l7-2.1.1/missing --run makeinfo
+MANDIR =
+OBJEXT = o
+PACKAGE = l7vsd
+PACKAGE_BUGREPORT =
+PACKAGE_NAME =
+PACKAGE_STRING =
+PACKAGE_TARNAME =
+PACKAGE_VERSION =
+PATH_SEPARATOR = :
+PKG_CONFIG = /usr/bin/pkg-config
+RANLIB = ranlib
+SED = /bin/sed
+SET_MAKE =
+SHELL = /bin/sh
+STRIP = strip
+VERSION = 2.1.1-0
+ac_ct_AR = ar
+ac_ct_CC = gcc
+ac_ct_CXX = g++
+ac_ct_F77 = f95
+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 = /usr
+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/redhat/SOURCES/ultramonkey-l7-2.1.1/install-sh
+l7vs_maxvs = 64
+l7vs_moddir = /usr/lib/l7vs
+l7vsadm_sockdir = /var/run/l7vs
+libdir = /usr/lib
+libexecdir = ${exec_prefix}/libexec
+localstatedir = ${prefix}/var
+mandir = /usr/share/man
+mkdir_p = mkdir -p --
+oldincludedir = /usr/include
+prefix = /usr/local
+program_transform_name = s,x,x,
+sbindir = ${exec_prefix}/sbin
+sharedstatedir = ${prefix}/com
+snmpagent_libs =
+sysconfdir = ${prefix}/etc
+target_alias =
+EXTRA_DIST = \
+changelog \
+compat \
+control \
+copyright \
+rules \
+dirs \
+docs
+
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu debian/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --gnu debian/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+distclean-libtool:
+ -rm -f libtool
+uninstall-info-am:
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+ list='$(DISTFILES)'; for file in $$list; do \
+ case $$file in \
+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+ esac; \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ dir="/$$dir"; \
+ $(mkdir_p) "$(distdir)$$dir"; \
+ else \
+ dir=''; \
+ fi; \
+ if test -d $$d/$$file; then \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile
+installdirs:
+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-libtool clean-local mostlyclean-am
+
+distclean: distclean-am
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic distclean-libtool
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-exec-am:
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-info-am
+
+.PHONY: all all-am check check-am clean clean-generic clean-libtool \
+ clean-local distclean distclean-generic distclean-libtool \
+ distdir dvi dvi-am html html-am info info-am install \
+ install-am install-data install-data-am install-exec \
+ install-exec-am install-info install-info-am install-man \
+ install-strip installcheck installcheck-am installdirs \
+ maintainer-clean maintainer-clean-generic mostlyclean \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ uninstall uninstall-am uninstall-info-am
+
+
+clean-local:
+ rm -f *.substvars *.debhelper files
+ rm -r -f l7vs tmp
+# 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:
--- /dev/null
+EXTRA_DIST = \
+changelog \
+compat \
+control \
+copyright \
+rules \
+dirs \
+docs
+
+clean-local:
+ rm -f *.substvars *.debhelper files
+ rm -r -f l7vs tmp
--- /dev/null
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = debian
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+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)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+GLIB_CFLAGS = @GLIB_CFLAGS@
+GLIB_GENMARSHAL = @GLIB_GENMARSHAL@
+GLIB_LIBS = @GLIB_LIBS@
+GLIB_MKENUMS = @GLIB_MKENUMS@
+GOBJECT_QUERY = @GOBJECT_QUERY@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MANDIR = @MANDIR@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PKG_CONFIG = @PKG_CONFIG@
+RANLIB = @RANLIB@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+ac_ct_RANLIB = @ac_ct_RANLIB@
+ac_ct_STRIP = @ac_ct_STRIP@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+l7vs_maxvs = @l7vs_maxvs@
+l7vs_moddir = @l7vs_moddir@
+l7vsadm_sockdir = @l7vsadm_sockdir@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+snmpagent_libs = @snmpagent_libs@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+EXTRA_DIST = \
+changelog \
+compat \
+control \
+copyright \
+rules \
+dirs \
+docs
+
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu debian/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --gnu debian/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+distclean-libtool:
+ -rm -f libtool
+uninstall-info-am:
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+ list='$(DISTFILES)'; for file in $$list; do \
+ case $$file in \
+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+ esac; \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ dir="/$$dir"; \
+ $(mkdir_p) "$(distdir)$$dir"; \
+ else \
+ dir=''; \
+ fi; \
+ if test -d $$d/$$file; then \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile
+installdirs:
+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-libtool clean-local mostlyclean-am
+
+distclean: distclean-am
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic distclean-libtool
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-exec-am:
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-info-am
+
+.PHONY: all all-am check check-am clean clean-generic clean-libtool \
+ clean-local distclean distclean-generic distclean-libtool \
+ distdir dvi dvi-am html html-am info info-am install \
+ install-am install-data install-data-am install-exec \
+ install-exec-am install-info install-info-am install-man \
+ install-strip installcheck installcheck-am installdirs \
+ maintainer-clean maintainer-clean-generic mostlyclean \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ uninstall uninstall-am uninstall-info-am
+
+
+clean-local:
+ rm -f *.substvars *.debhelper files
+ rm -r -f l7vs tmp
+# 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:
--- /dev/null
+ultramonkey-l7-2.0.0 (2-1) unstable; urgency=low
+
+ * Initial release (Closes: #850)
+ *
+
+ -- Shinya TAKEBAYASHI <makoto@kanon-net.jp> Mon, 25 Aug 2008 09:10:53 +0900
+
--- /dev/null
+Source: ultramonkey-l7-2.0.0
+Section: Network
+Priority: extra
+Maintainer: Shinya TAKEBAYASHI <makoto@kanon-net.jp>
+Build-Depends: debhelper (>= 5), autotools-dev, libglib2.0-dev, libsnmp9-dev, libboost-dev,
+Standards-Version: 3.7.2
+
+Package: ultramonkey-l7-2.0.0
+Architecture: any
+Depends: ${shlibs:Depends}, ${misc:Depends}
+Description: Layer-7 load balancer daemon
+
--- /dev/null
+This package was debianized by Makoto SAWATARI <makoto@suigintoh> on
+Mon, 25 Aug 2008 09:04:46 +0900.
+
+It was downloaded from http://sourceforge.jp/projects/ultramonkey-l7/
+
+Copyright: (C) 2008, UltraMonkey-L7 proj.
+
+License:
+
+ 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 3 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, see <http://www.gnu.org/licenses/>.
+
+
+The Debian packaging is (C) 2008, Shinya TAKEBAYASHI <makoto@kanon-net.jp> and
+is licensed under the GPL, see `/usr/share/common-licenses/GPL'.
+
+
+# Please also look if there are files or directories which have a
+# different copyright/license attached and list them here.
+
--- /dev/null
+usr/bin
+usr/sbin
--- /dev/null
+#!/usr/bin/perl -w
+# GPL copyright 2001 by Joey Hess <joeyh@debian.org>
+
+use strict;
+use Getopt::Long;
+
+sub usage {
+ print STDERR <<EOF;
+Usage: dpkg-checkbuild [-B] [control-file]
+ -B binary-only, ignore -Indep
+ control-file control file to process [Default: debian/control]
+EOF
+}
+
+my ($me)=$0=~m:.*/(.+):;
+
+my $binary_only=0;
+if (! GetOptions('-B' => \$binary_only)) {
+ usage();
+ exit(2);
+}
+my $control=shift || "debian/control";
+
+open (CONTROL, $control) || die "$control: $!\n";
+my @status=parse_status();
+my (@unmet, @conflicts);
+while (<CONTROL>) {
+ chomp;
+ last if $_ eq ''; # end of first stanza
+
+ if (/^Build-Depends:\s+(.*)/i) {
+ push @unmet, build_depends($1, @status);
+ }
+ elsif (/^Build-Conflicts:\s+(.*)/i) {
+ push @conflicts, build_conflicts($1, @status);
+ }
+ elsif (! $binary_only && /^Build-Depends-Indep:\s+(.*)/i) {
+ push @unmet, build_depends($1, @status);
+ }
+ elsif (! $binary_only && /^Build-Conflicts-Indep:\s+(.*)/i) {
+ push @conflicts, build_conflicts($1, @status);
+ }
+}
+close CONTROL;
+
+if (@unmet) {
+ print STDERR "$me: Unmet build dependancies: ";
+ print STDERR join(", ", @unmet), "\n";
+}
+if (@conflicts) {
+ print STDERR "$me: Build conflicts: ";
+ print STDERR join(", ", @conflicts), "\n";
+}
+exit 1 if @unmet || @conflicts;
+
+# This part could be replaced. Silly little status file parser.
+# thanks to Matt Zimmerman. Returns two hash references that
+# are exactly what the other functions need...
+sub parse_status {
+ my $status=shift || "/var/lib/dpkg/status";
+
+ my %providers;
+ my %version;
+ local $/ = '';
+ open(STATUS, "<$status") || die "$status: $!\n";
+ while (<STATUS>) {
+ next unless /^Status: .*ok installed$/m;
+
+ my ($package) = /^Package: (.*)$/m;
+ push @{$providers{$package}}, $package;
+ ($version{$package}) = /^Version: (.*)$/m;
+
+ if (/^Provides: (.*)$/m) {
+ foreach (split(/,\s+/, $1)) {
+ push @{$providers{$_}}, $package;
+ }
+ }
+ }
+ close STATUS;
+
+ return \%version, \%providers;
+}
+
+# This function checks the build dependancies passed in as the first
+# parameter. If they are satisfied, returns false. If they are unsatisfied,
+# an list of the unsatisfied depends is returned.
+#
+# Additional parameters that must be passed:
+# * A reference to a hash of all "ok installed" the packages on the system,
+# with the hash key being the package name, and the value being the
+# installed version.
+# * A reference to a hash, where the keys are package names, and the
+# value is a true value iff some package installed on the system provides
+# that package (all installed packages provide themselves)
+#
+# Optionally, the architecture the package is to be built for can be passed
+# in as the 4th parameter. If not set, dpkg will be queried for the build
+# architecture.
+sub build_depends {
+ return check_line(1, @_);
+}
+
+# This function is exactly like unmet_build_depends, except it
+# checks for build conflicts, and returns a list of the packages
+# that are installed and are conflicted with.
+sub build_conflicts {
+ return check_line(0, @_);
+}
+
+# This function does all the work. The first parameter is 1 to check build
+# deps, and 0 to check build conflicts.
+sub check_line {
+ my $build_depends=shift;
+ my $line=shift;
+ my %version=%{shift()};
+ my %providers=%{shift()};
+ my $build_arch=shift || `dpkg --print-architecture`;
+ chomp $build_arch;
+
+ my @unmet=();
+ foreach my $dep (split(/,\s+/, $line)) {
+ my $ok=0;
+ my @possibles=();
+ALTERNATE: foreach my $alternate (split(/\s*\|\s*/, $dep)) {
+ my ($package, $rest)=split(/\s+/, $alternate, 2);
+
+ # Check arch specifications.
+ if (defined $rest && $rest=~m/\[(.*?)\]/) {
+ my $arches=lc($1);
+ my $seen_arch='';
+ foreach my $arch (split(' ', $arches)) {
+ if ($arch eq $build_arch) {
+ $seen_arch=1;
+ next;
+ }
+ elsif ($arch eq "!$build_arch") {
+ next ALTERNATE;
+ }
+ elsif ($arch =~ /!/) {
+ # This is equivilant to
+ # having seen the current arch,
+ # unless the current arch
+ # is also listed..
+ $seen_arch=1;
+ }
+ }
+ if (! $seen_arch) {
+ next;
+ }
+ }
+
+ # This is a possibile way to meet the dependancy.
+ # Remove the arch stuff from $alternate.
+ $alternate=~s/\s+\[.*?\]//;
+ push @possibles, $alternate;
+
+ # Check version.
+ if (defined $rest && $rest=~m/\((..)\s+(.*?)\)/) {
+ my $relation=$1;
+ my $version=$2;
+
+ if (! exists $version{$package}) {
+ # Not installed at all, so fail.
+ next;
+ }
+ else {
+ # Compare installed and needed
+ # version number.
+ system("dpkg", "--compare-versions",
+ $version{$package}, $relation,
+ $version);
+ if (($? >> 8) != 0) {
+ next; # fail
+ }
+ }
+ }
+ elsif (! defined $providers{$package}) {
+ # It's not a versioned dependancy, and
+ # nothing provides it, so fail.
+ next;
+ }
+
+ # If we get to here, the dependancy was met.
+ $ok=1;
+ }
+
+ if (@possibles && (($build_depends && ! $ok) ||
+ (! $build_depends && $ok))) {
+ # TODO: this could return a more complex
+ # data structure instead to save re-parsing.
+ push @unmet, join (" | ", @possibles);
+ }
+ }
+
+ return @unmet;
+}
--- /dev/null
+#!/bin/sh
+# Start/Stop script for l7vsd
+#
+# chkconfig: 2345 95 34
+# description: Start and stop l7vsd
+#
+# processname: l7vsd
+#
+# Author: Shinya TAKEBAYASHI
+# Released: October 2007
+# Licence: GNU General Public Licence
+
+# Source function library.
+#. /etc/rc.d/init.d/functions
+
+[ -f /usr/sbin/l7vsd ] || exit 0
+
+PROG="l7vsd"
+DAEMON="/usr/sbin/l7vsd"
+SOCKFILE=/var/run/l7vs/l7vs
+
+start() {
+ RETVAL=0
+ if [ -a $SOCKFILE ]; then
+ echo "$PROG is already running."
+ RETVAL=-1
+ else
+ echo -n $"Starting $PROG: "
+ start-stop-daemon --start --quiet --nicelevel +19 --exec $DAEMON
+ RETVAL=$?
+ fi
+ echo
+ return $RETVAL
+}
+
+stop() {
+ echo -n $"Stopping $PROG: "
+ start-stop-daemon --stop --quiet --exec $DAEMON
+ echo
+ RETVAL=$?
+ if [ $RETVAL -eq 0 ]; then
+ rm -rf $SOCKFILE
+ fi
+
+ return $RETVAL
+}
+
+status() {
+ PID=`pidof $DAEMON`
+ RETVAL=$?
+ if [ $RETVAL != 0 ]; then
+ echo "l7vsd is not running."
+ else
+ echo "l7vsd is running with pid: $PID"
+ fi
+}
+
+case "$1" in
+ start)
+ start
+ ;;
+
+ stop)
+ stop
+ ;;
+
+ status)
+ status l7vsd
+ ;;
+
+ restart)
+ stop
+ start
+ ;;
+
+ condrestart)
+ if test "x`pidof l7vsd`" != x; then
+ stop
+ start
+ fi
+ ;;
+
+ *)
+ echo $"Usage: $0 {start|stop|restart|condrestart|status}"
+ RETVAL=1
+
+esac
+
+exit $RETVAL
--- /dev/null
+var/run/l7vs
--- /dev/null
+usr/sbin/l7vsd
+usr/sbin/l7vsadm
+usr/lib/l7vs/protomod_cinsert.so
+usr/lib/l7vs/protomod_url.so
+usr/lib/l7vs/sched_rr.so
+usr/lib/l7vs/sched_lc.so
+usr/lib/l7vs/sched_wrr.so
+
--- /dev/null
+#! /bin/sh
+# postinst script for l7vs
+
+#DEBHELPER#
+
+if [ "$1" = "configure" ]; then
+ #update-rc.d l7vs defaults >/dev/null
+ :
+fi
+
+exit 0
+
+
--- /dev/null
+#! /bin/sh
+# postrm script for l7vs
+
+#DEBHELPER#
+
+if [ "$1" = "remove" ]; then
+ #update-rc.d -f l7vs remove >/dev/null
+ rm -f /var/run/l7vs/*
+fi
+
+exit 0
--- /dev/null
+#!/usr/bin/make -f
+# -*- makefile -*-
+# Sample debian/rules that uses debhelper.
+# This file was originally written by Joey Hess and Craig Small.
+# As a special exception, when this file is copied by dh-make into a
+# dh-make output file, you may use that output file without restriction.
+# This special exception was added by Craig Small in version 0.37 of dh-make.
+
+# Uncomment this to turn on verbose mode.
+#export DH_VERBOSE=1
+
+
+# These are used for cross-compiling and for saving the configure script
+# from having to guess our platform (since we know it already)
+DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
+DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
+
+
+CFLAGS = -Wall -g
+
+ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
+ CFLAGS += -O0
+else
+ CFLAGS += -O2
+endif
+
+config.status: configure
+ dh_testdir
+ # Add here commands to configure the package.
+ ./configure --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) --prefix=/usr --mandir=\$${prefix}/share/man --infodir=\$${prefix}/share/info CFLAGS="$(CFLAGS)" LDFLAGS="-Wl,-z,defs"
+
+
+build: build-stamp
+
+build-stamp: config.status
+ dh_testdir
+
+ # Add here commands to compile the package.
+ $(MAKE)
+ #docbook-to-man debian/ultramonkey-l7-2.0.0.sgml > ultramonkey-l7-2.0.0.1
+
+ touch $@
+
+clean:
+ dh_testdir
+ dh_testroot
+ rm -f build-stamp
+
+ # Add here commands to clean up after the build process.
+ -$(MAKE) distclean
+ifneq "$(wildcard /usr/share/misc/config.sub)" ""
+ cp -f /usr/share/misc/config.sub config.sub
+endif
+ifneq "$(wildcard /usr/share/misc/config.guess)" ""
+ cp -f /usr/share/misc/config.guess config.guess
+endif
+
+
+ dh_clean
+
+install: build
+ dh_testdir
+ dh_testroot
+ dh_clean -k
+ dh_installdirs
+
+ # Add here commands to install the package into debian/ultramonkey-l7-2.0.0.
+ $(MAKE) DESTDIR=$(CURDIR)/debian/ultramonkey-l7-2.0.0 install
+
+
+# Build architecture-independent files here.
+binary-indep: build install
+# We have nothing to do by default.
+
+# Build architecture-dependent files here.
+binary-arch: build install
+ dh_testdir
+ dh_testroot
+ dh_installchangelogs CHANGES
+ dh_installdocs
+ dh_installexamples
+# dh_install
+# dh_installmenu
+# dh_installdebconf
+# dh_installlogrotate
+# dh_installemacsen
+# dh_installpam
+# dh_installmime
+# dh_python
+# dh_installinit
+# dh_installcron
+# dh_installinfo
+ dh_installman
+ dh_link
+ dh_strip
+ dh_compress
+ dh_fixperms
+# dh_perl
+# dh_makeshlibs
+ dh_installdeb
+ dh_shlibdeps
+ dh_gencontrol
+ dh_md5sums
+ dh_builddeb
+
+binary: binary-indep binary-arch
+.PHONY: build clean binary-indep binary-arch binary install
--- /dev/null
+#! /bin/sh
+# depcomp - compile a program generating dependencies as side-effects
+
+scriptversion=2005-07-09.11
+
+# Copyright (C) 1999, 2000, 2003, 2004, 2005 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+# 02110-1301, USA.
+
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
+
+case $1 in
+ '')
+ echo "$0: No command. Try \`$0 --help' for more information." 1>&2
+ exit 1;
+ ;;
+ -h | --h*)
+ cat <<\EOF
+Usage: depcomp [--help] [--version] PROGRAM [ARGS]
+
+Run PROGRAMS ARGS to compile a file, generating dependencies
+as side-effects.
+
+Environment variables:
+ depmode Dependency tracking mode.
+ source Source file read by `PROGRAMS ARGS'.
+ object Object file output by `PROGRAMS ARGS'.
+ DEPDIR directory where to store dependencies.
+ depfile Dependency file to output.
+ tmpdepfile Temporary file to use when outputing dependencies.
+ libtool Whether libtool is used (yes/no).
+
+Report bugs to <bug-automake@gnu.org>.
+EOF
+ exit $?
+ ;;
+ -v | --v*)
+ echo "depcomp $scriptversion"
+ exit $?
+ ;;
+esac
+
+if test -z "$depmode" || test -z "$source" || test -z "$object"; then
+ echo "depcomp: Variables source, object and depmode must be set" 1>&2
+ exit 1
+fi
+
+# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po.
+depfile=${depfile-`echo "$object" |
+ sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`}
+tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
+
+rm -f "$tmpdepfile"
+
+# Some modes work just like other modes, but use different flags. We
+# parameterize here, but still list the modes in the big case below,
+# to make depend.m4 easier to write. Note that we *cannot* use a case
+# here, because this file can only contain one case statement.
+if test "$depmode" = hp; then
+ # HP compiler uses -M and no extra arg.
+ gccflag=-M
+ depmode=gcc
+fi
+
+if test "$depmode" = dashXmstdout; then
+ # This is just like dashmstdout with a different argument.
+ dashmflag=-xM
+ depmode=dashmstdout
+fi
+
+case "$depmode" in
+gcc3)
+## gcc 3 implements dependency tracking that does exactly what
+## we want. Yay! Note: for some reason libtool 1.4 doesn't like
+## it if -MD -MP comes after the -MF stuff. Hmm.
+ "$@" -MT "$object" -MD -MP -MF "$tmpdepfile"
+ stat=$?
+ if test $stat -eq 0; then :
+ else
+ rm -f "$tmpdepfile"
+ exit $stat
+ fi
+ mv "$tmpdepfile" "$depfile"
+ ;;
+
+gcc)
+## There are various ways to get dependency output from gcc. Here's
+## why we pick this rather obscure method:
+## - Don't want to use -MD because we'd like the dependencies to end
+## up in a subdir. Having to rename by hand is ugly.
+## (We might end up doing this anyway to support other compilers.)
+## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
+## -MM, not -M (despite what the docs say).
+## - Using -M directly means running the compiler twice (even worse
+## than renaming).
+ if test -z "$gccflag"; then
+ gccflag=-MD,
+ fi
+ "$@" -Wp,"$gccflag$tmpdepfile"
+ stat=$?
+ if test $stat -eq 0; then :
+ else
+ rm -f "$tmpdepfile"
+ exit $stat
+ fi
+ rm -f "$depfile"
+ echo "$object : \\" > "$depfile"
+ alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
+## The second -e expression handles DOS-style file names with drive letters.
+ sed -e 's/^[^:]*: / /' \
+ -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
+## This next piece of magic avoids the `deleted header file' problem.
+## The problem is that when a header file which appears in a .P file
+## is deleted, the dependency causes make to die (because there is
+## typically no way to rebuild the header). We avoid this by adding
+## dummy dependencies for each header file. Too bad gcc doesn't do
+## this for us directly.
+ tr ' ' '
+' < "$tmpdepfile" |
+## Some versions of gcc put a space before the `:'. On the theory
+## that the space means something, we add a space to the output as
+## well.
+## Some versions of the HPUX 10.20 sed can't process this invocation
+## correctly. Breaking it into two sed invocations is a workaround.
+ sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
+ rm -f "$tmpdepfile"
+ ;;
+
+hp)
+ # This case exists only to let depend.m4 do its work. It works by
+ # looking at the text of this script. This case will never be run,
+ # since it is checked for above.
+ exit 1
+ ;;
+
+sgi)
+ if test "$libtool" = yes; then
+ "$@" "-Wp,-MDupdate,$tmpdepfile"
+ else
+ "$@" -MDupdate "$tmpdepfile"
+ fi
+ stat=$?
+ if test $stat -eq 0; then :
+ else
+ rm -f "$tmpdepfile"
+ exit $stat
+ fi
+ rm -f "$depfile"
+
+ if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files
+ echo "$object : \\" > "$depfile"
+
+ # Clip off the initial element (the dependent). Don't try to be
+ # clever and replace this with sed code, as IRIX sed won't handle
+ # lines with more than a fixed number of characters (4096 in
+ # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines;
+ # the IRIX cc adds comments like `#:fec' to the end of the
+ # dependency line.
+ tr ' ' '
+' < "$tmpdepfile" \
+ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
+ tr '
+' ' ' >> $depfile
+ echo >> $depfile
+
+ # The second pass generates a dummy entry for each header file.
+ tr ' ' '
+' < "$tmpdepfile" \
+ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
+ >> $depfile
+ else
+ # The sourcefile does not contain any dependencies, so just
+ # store a dummy comment line, to avoid errors with the Makefile
+ # "include basename.Plo" scheme.
+ echo "#dummy" > "$depfile"
+ fi
+ rm -f "$tmpdepfile"
+ ;;
+
+aix)
+ # The C for AIX Compiler uses -M and outputs the dependencies
+ # in a .u file. In older versions, this file always lives in the
+ # current directory. Also, the AIX compiler puts `$object:' at the
+ # start of each line; $object doesn't have directory information.
+ # Version 6 uses the directory in both cases.
+ stripped=`echo "$object" | sed 's/\(.*\)\..*$/\1/'`
+ tmpdepfile="$stripped.u"
+ if test "$libtool" = yes; then
+ "$@" -Wc,-M
+ else
+ "$@" -M
+ fi
+ stat=$?
+
+ if test -f "$tmpdepfile"; then :
+ else
+ stripped=`echo "$stripped" | sed 's,^.*/,,'`
+ tmpdepfile="$stripped.u"
+ fi
+
+ if test $stat -eq 0; then :
+ else
+ rm -f "$tmpdepfile"
+ exit $stat
+ fi
+
+ if test -f "$tmpdepfile"; then
+ outname="$stripped.o"
+ # Each line is of the form `foo.o: dependent.h'.
+ # Do two passes, one to just change these to
+ # `$object: dependent.h' and one to simply `dependent.h:'.
+ sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile"
+ sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile"
+ else
+ # The sourcefile does not contain any dependencies, so just
+ # store a dummy comment line, to avoid errors with the Makefile
+ # "include basename.Plo" scheme.
+ echo "#dummy" > "$depfile"
+ fi
+ rm -f "$tmpdepfile"
+ ;;
+
+icc)
+ # Intel's C compiler understands `-MD -MF file'. However on
+ # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c
+ # ICC 7.0 will fill foo.d with something like
+ # foo.o: sub/foo.c
+ # foo.o: sub/foo.h
+ # which is wrong. We want:
+ # sub/foo.o: sub/foo.c
+ # sub/foo.o: sub/foo.h
+ # sub/foo.c:
+ # sub/foo.h:
+ # ICC 7.1 will output
+ # foo.o: sub/foo.c sub/foo.h
+ # and will wrap long lines using \ :
+ # foo.o: sub/foo.c ... \
+ # sub/foo.h ... \
+ # ...
+
+ "$@" -MD -MF "$tmpdepfile"
+ stat=$?
+ if test $stat -eq 0; then :
+ else
+ rm -f "$tmpdepfile"
+ exit $stat
+ fi
+ rm -f "$depfile"
+ # Each line is of the form `foo.o: dependent.h',
+ # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
+ # Do two passes, one to just change these to
+ # `$object: dependent.h' and one to simply `dependent.h:'.
+ sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
+ # Some versions of the HPUX 10.20 sed can't process this invocation
+ # correctly. Breaking it into two sed invocations is a workaround.
+ sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" |
+ sed -e 's/$/ :/' >> "$depfile"
+ rm -f "$tmpdepfile"
+ ;;
+
+tru64)
+ # The Tru64 compiler uses -MD to generate dependencies as a side
+ # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
+ # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
+ # dependencies in `foo.d' instead, so we check for that too.
+ # Subdirectories are respected.
+ dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
+ test "x$dir" = "x$object" && dir=
+ base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
+
+ if test "$libtool" = yes; then
+ # With Tru64 cc, shared objects can also be used to make a
+ # static library. This mecanism is used in libtool 1.4 series to
+ # handle both shared and static libraries in a single compilation.
+ # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d.
+ #
+ # With libtool 1.5 this exception was removed, and libtool now
+ # generates 2 separate objects for the 2 libraries. These two
+ # compilations output dependencies in in $dir.libs/$base.o.d and
+ # in $dir$base.o.d. We have to check for both files, because
+ # one of the two compilations can be disabled. We should prefer
+ # $dir$base.o.d over $dir.libs/$base.o.d because the latter is
+ # automatically cleaned when .libs/ is deleted, while ignoring
+ # the former would cause a distcleancheck panic.
+ tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4
+ tmpdepfile2=$dir$base.o.d # libtool 1.5
+ tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5
+ tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504
+ "$@" -Wc,-MD
+ else
+ tmpdepfile1=$dir$base.o.d
+ tmpdepfile2=$dir$base.d
+ tmpdepfile3=$dir$base.d
+ tmpdepfile4=$dir$base.d
+ "$@" -MD
+ fi
+
+ stat=$?
+ if test $stat -eq 0; then :
+ else
+ rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
+ exit $stat
+ fi
+
+ for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
+ do
+ test -f "$tmpdepfile" && break
+ done
+ if test -f "$tmpdepfile"; then
+ sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
+ # That's a tab and a space in the [].
+ sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
+ else
+ echo "#dummy" > "$depfile"
+ fi
+ rm -f "$tmpdepfile"
+ ;;
+
+#nosideeffect)
+ # This comment above is used by automake to tell side-effect
+ # dependency tracking mechanisms from slower ones.
+
+dashmstdout)
+ # Important note: in order to support this mode, a compiler *must*
+ # always write the preprocessed file to stdout, regardless of -o.
+ "$@" || exit $?
+
+ # Remove the call to Libtool.
+ if test "$libtool" = yes; then
+ while test $1 != '--mode=compile'; do
+ shift
+ done
+ shift
+ fi
+
+ # Remove `-o $object'.
+ IFS=" "
+ for arg
+ do
+ case $arg in
+ -o)
+ shift
+ ;;
+ $object)
+ shift
+ ;;
+ *)
+ set fnord "$@" "$arg"
+ shift # fnord
+ shift # $arg
+ ;;
+ esac
+ done
+
+ test -z "$dashmflag" && dashmflag=-M
+ # Require at least two characters before searching for `:'
+ # in the target name. This is to cope with DOS-style filenames:
+ # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise.
+ "$@" $dashmflag |
+ sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile"
+ rm -f "$depfile"
+ cat < "$tmpdepfile" > "$depfile"
+ tr ' ' '
+' < "$tmpdepfile" | \
+## Some versions of the HPUX 10.20 sed can't process this invocation
+## correctly. Breaking it into two sed invocations is a workaround.
+ sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
+ rm -f "$tmpdepfile"
+ ;;
+
+dashXmstdout)
+ # This case only exists to satisfy depend.m4. It is never actually
+ # run, as this mode is specially recognized in the preamble.
+ exit 1
+ ;;
+
+makedepend)
+ "$@" || exit $?
+ # Remove any Libtool call
+ if test "$libtool" = yes; then
+ while test $1 != '--mode=compile'; do
+ shift
+ done
+ shift
+ fi
+ # X makedepend
+ shift
+ cleared=no
+ for arg in "$@"; do
+ case $cleared in
+ no)
+ set ""; shift
+ cleared=yes ;;
+ esac
+ case "$arg" in
+ -D*|-I*)
+ set fnord "$@" "$arg"; shift ;;
+ # Strip any option that makedepend may not understand. Remove
+ # the object too, otherwise makedepend will parse it as a source file.
+ -*|$object)
+ ;;
+ *)
+ set fnord "$@" "$arg"; shift ;;
+ esac
+ done
+ obj_suffix="`echo $object | sed 's/^.*\././'`"
+ touch "$tmpdepfile"
+ ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
+ rm -f "$depfile"
+ cat < "$tmpdepfile" > "$depfile"
+ sed '1,2d' "$tmpdepfile" | tr ' ' '
+' | \
+## Some versions of the HPUX 10.20 sed can't process this invocation
+## correctly. Breaking it into two sed invocations is a workaround.
+ sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
+ rm -f "$tmpdepfile" "$tmpdepfile".bak
+ ;;
+
+cpp)
+ # Important note: in order to support this mode, a compiler *must*
+ # always write the preprocessed file to stdout.
+ "$@" || exit $?
+
+ # Remove the call to Libtool.
+ if test "$libtool" = yes; then
+ while test $1 != '--mode=compile'; do
+ shift
+ done
+ shift
+ fi
+
+ # Remove `-o $object'.
+ IFS=" "
+ for arg
+ do
+ case $arg in
+ -o)
+ shift
+ ;;
+ $object)
+ shift
+ ;;
+ *)
+ set fnord "$@" "$arg"
+ shift # fnord
+ shift # $arg
+ ;;
+ esac
+ done
+
+ "$@" -E |
+ sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
+ -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
+ sed '$ s: \\$::' > "$tmpdepfile"
+ rm -f "$depfile"
+ echo "$object : \\" > "$depfile"
+ cat < "$tmpdepfile" >> "$depfile"
+ sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
+ rm -f "$tmpdepfile"
+ ;;
+
+msvisualcpp)
+ # Important note: in order to support this mode, a compiler *must*
+ # always write the preprocessed file to stdout, regardless of -o,
+ # because we must use -o when running libtool.
+ "$@" || exit $?
+ IFS=" "
+ for arg
+ do
+ case "$arg" in
+ "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
+ set fnord "$@"
+ shift
+ shift
+ ;;
+ *)
+ set fnord "$@" "$arg"
+ shift
+ shift
+ ;;
+ esac
+ done
+ "$@" -E |
+ sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile"
+ rm -f "$depfile"
+ echo "$object : \\" > "$depfile"
+ . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile"
+ echo " " >> "$depfile"
+ . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile"
+ rm -f "$tmpdepfile"
+ ;;
+
+none)
+ exec "$@"
+ ;;
+
+*)
+ echo "Unknown depmode $depmode" 1>&2
+ exit 1
+ ;;
+esac
+
+exit 0
+
+# Local Variables:
+# mode: shell-script
+# sh-indentation: 2
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-end: "$"
+# End:
--- /dev/null
+/*!
+ * @file l7vs.h
+ * @brief UltraMonkey-L7 main header
+ * @author nakai norihisa
+ *
+ * L7VSD: Linux Virtual Server for Layer7 Load Balancing
+ * Copyright (C) 2005 NTT COMWARE Corporation.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ **********************************************************************/
+
+#ifndef L7VS_H
+#define L7VS_H
+
+#define L7VS_VERSION_STRING VERSION
+
+/*!
+ * default module path
+ */
+#ifndef L7VS_MODULE_PATH
+ #define L7VS_MODULE_PATH "."
+#endif //L7VS_MODULE_PATH
+
+#define L7VS_IPADDR_LEN (16)
+#define L7VS_MODNAME_LEN (16) /*! Module name length*/
+#define L7VS_PROTOMOD_MAX_BUFSIZE (256) /*! protocol module max buffer size */
+#define L7VS_PROTOMOD_MAX_ADD_BUFSIZE (256) /*! protocol module max addbuffer size */
+#define L7VS_PROTOMOD_MAX_SERVICE_ARG (256) /*! protocol module max service argument size */
+#define L7VS_PROTOMOD_OPT_LEN (512)
+#define L7VS_PROTOMOD_KEY_LEN (256)
+
+extern char l7vs_module_path[]; /*! protocol module path */
+
+#endif /* L7VS_H */
--- /dev/null
+ /*!
+ * @file l7vs_config.h
+ * @brief configulation module header file.
+ * @auther nakai norihisa
+ *
+ * L7VSD: Linux Virtual Server for Layer7 Load Balancing
+ * Copyright (C) 2005 NTT COMWARE Corporation.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ **********************************************************************/
+#ifndef L7VS_CONFIG_H
+#define L7VS_CONFIG_H
+
+#include "logger_wrapper.h"
+#include "parameter_wrapper.h"
+#include "l7vs_replication.h"
+#include "l7vs_snmpbridge.h"
+
+#include "l7vs_dest.h"
+
+
+/*!
+ * config socket file path
+ */
+#ifndef L7VS_CONFIG_SOCK_PATH
+ #define L7VS_CONFIG_SOCK_PATH "/var/run/l7vs"
+#endif
+#define L7VS_CONFIG_SOCKNAME L7VS_CONFIG_SOCK_PATH "/l7vs"
+
+
+
+/*!
+ * configulation module error type
+ *
+ */
+enum l7vs_config_err_type{
+ L7VS_CONFIG_NOERR = 0, /*! command error none. default value */
+ L7VS_CONFIG_ERR_INVALID_COMMAND = 1, /*! command is invalid */
+ L7VS_CONFIG_ERR_NOMEM = 2, /*! don't allocate memory */
+ L7VS_CONFIG_ERR_VS_EXISTS = 3, /*! virtual service exists */
+ L7VS_CONFIG_ERR_RS_EXISTS = 4, /*! real server exists */
+ L7VS_CONFIG_ERR_NOVS = 5, /*! no virtual service */
+ L7VS_CONFIG_ERR_NORS = 6, /*! no real server */
+ L7VS_CONFIG_ERR_NOSCHED = 7, /*! no schedule module */
+ L7VS_CONFIG_ERR_NOSOCK = 8, /*! no socket */
+ L7VS_CONFIG_ERR_QOSSET = 9, /*! set QoS threshold failure */
+ L7VS_CONFIG_ERR_SORRYSET = 10, /*! modify Sorry-Server Values failure */
+ L7VS_CONFIG_ERR_SENDMSG = 11, /*! send message failure */
+ L7VS_CONFIG_ERR_MAXVS_EXISTS = 12 /*! max service instance is exists */
+};
+
+/*!
+ * configulation command type
+ *
+ */
+enum l7vs_config_command{
+ L7VS_CONFIG_LIST_VS, /*! virtual service list up */
+ L7VS_CONFIG_LIST_RS, /*! real server list up */
+ L7VS_CONFIG_ADD_VS, /*! virtual service add */
+ L7VS_CONFIG_ADD_RS, /*! real server add */
+ L7VS_CONFIG_DEL_VS, /*! virtual service delete */
+ L7VS_CONFIG_DEL_RS, /*! real server delete */
+ L7VS_CONFIG_EDIT_VS, /*! virtual service edit */
+ L7VS_CONFIG_EDIT_RS, /*! real server edit */
+ L7VS_CONFIG_FLUSH_VS, /*! virtual service flush */
+ L7VS_CONFIG_GET_REPLICATION_INFO, /*! get replication information */
+ L7VS_CONFIG_REPLICATION, /*! modify replication information */
+ L7VS_CONFIG_GET_LOG_INFO, /*! get log information */
+ L7VS_CONFIG_SET_LOG_LEVEL, /*! modify log information */
+ L7VS_CONFIG_SET_LOG_LEVEL_ALL, /*! modify log information */
+ L7VS_CONFIG_GET_SNMP_LOG_INFO, /*! get SNMP information */
+ L7VS_CONFIG_GET_SNMP_CONNECT_STATUS, /*! get SNMP information */
+ L7VS_CONFIG_SET_SNMP_LOG_LEVEL, /*! modify SNMP information */
+ L7VS_CONFIG_SET_SNMP_LOG_LEVEL_ALL, /*! get SNMP information(connect status)*/
+ L7VS_CONFIG_PARAMETER, /*! modify parameter */
+ L7VS_CONFIG_NONE /*! no config */
+};
+
+
+/*!
+ * config request for virtual service
+ */
+struct l7vs_config_req_list_vs{
+ enum l7vs_config_command cmd; /*! request command */
+};
+
+/*!
+ * config request for real server
+ */
+struct l7vs_config_req_list_rs{
+ enum l7vs_config_command cmd; /*! request command */
+ // service_arg follows
+};
+
+/*!
+ * config request for operation virtual service
+ */
+struct l7vs_config_req_operate_vs{
+ enum l7vs_config_command cmd; /*! request command */
+ // service_arg follows
+};
+
+/*!
+ * config request for operation
+ */
+struct l7vs_config_req_operate_rs{
+ enum l7vs_config_command cmd; /*! request comand */
+ struct l7vs_dest_arg darg; /*! real server data */
+ //service_arg follows
+};
+
+/*!
+ * config request for virtual service flash
+ */
+struct l7vs_config_req_flush_vs{
+ enum l7vs_config_command cmd; /*! request command */
+};
+
+/*!
+ * config message for replication kind
+ */
+enum REPLICATION_KIND_TAG{
+ L7VS_CONFIG_REPLICATION_DUMP=0, /*! replication dump */
+ L7VS_CONFIG_REPLICATION_START, /*! raplication start */
+ L7VS_CONFIG_REPLICATION_STOP, /*! replication stop */
+ L7VS_CONFIG_REPLICATION_COMPULSORILY /*! compulsion replication */
+};
+
+/*!
+ * config message for replication
+ */
+struct l7vs_config_msg_replication{
+ enum l7vs_config_command cmd; /*! request command */
+ int code; /*! error code number */
+ enum REPLICATION_KIND_TAG kind; /*! replication action */
+ enum REPLICATION_MODE_TAG replication_mode; /*! replication mode */
+};
+
+
+/*!
+ * config message for log
+ */
+struct l7vs_config_msg_log{
+ enum l7vs_config_command cmd; /* request command */
+ int code; /* error code number */
+ LOG_CATEGORY_TAG kind; /* kind of log action */
+ LOG_LEVEL_TAG vsd_log_level; /* log category of network */
+};
+
+/*!
+ * config message for SNMP
+ */
+struct l7vs_config_msg_snmp{
+ enum l7vs_config_command cmd; /* request command */
+ int code; /* error code number */
+ enum LOG_CATEGORY_TAG kind; /* kind of action */
+ enum LOG_LEVEL_TAG snmp_log_level; /* SNMP Loglevel */
+ int connection_status; /* connection information */
+};
+
+/*!
+ * config message for parameter
+ */
+struct l7vs_config_msg_parameter{
+ enum l7vs_config_command cmd; /* request command */
+ int code; /* error code number */
+ enum PARAMETER_COMPONENT_TAG category; /* parameter category */
+};
+
+/*!
+ * config request union.
+ * this union is extend class like.
+ * but, memory management is not.
+ */
+union l7vs_config_req{
+ enum l7vs_config_command cmd;
+ struct l7vs_config_req_list_vs list_vs;
+ struct l7vs_config_req_list_rs list_rs;
+ struct l7vs_config_req_operate_vs operate_vs;
+ struct l7vs_config_req_operate_rs operate_rs;
+ struct l7vs_config_req_flush_vs flush_vs;
+ struct l7vs_config_msg_replication msg_replication;
+ struct l7vs_config_msg_log msg_log;
+ struct l7vs_config_msg_snmp msg_snmp;
+ struct l7vs_config_msg_parameter msg_parameter;
+ char _buf[2048];
+};
+
+
+/*!
+ * config response list virtual service
+ */
+struct l7vs_config_rsp_list_vs{
+ enum l7vs_config_command cmd; /*! response command */
+ int code; /*! virtual service code */
+ int num; /*! number */
+ // number of "num" l7vs_service_arg follow
+};
+
+/*!
+ * config response list real server
+ */
+struct l7vs_config_rsp_list_rs{
+ enum l7vs_config_command cmd; /*! response command */
+ int code; /*! real server code */
+ int num; /*! number */
+ //number of "num" l7vs_dest_args_follow
+};
+
+/*!
+ * config response operation virual service
+ */
+struct l7vs_config_rsp_operate_vs {
+ enum l7vs_config_command cmd; /*! response commnad */
+ int code; /*! response code */
+};
+
+/*!
+ * config response operation real server
+ */
+struct l7vs_config_rsp_operate_rs {
+ enum l7vs_config_command cmd; /*! response command */
+ int code; /*! response code */
+};
+
+/*!
+ * config response flush virtual service
+ */
+struct l7vs_config_rsp_flush_vs{
+ enum l7vs_config_command cmd; /*! response command */
+ int code; /*! response code */
+};
+
+ /*!
+ * config unknown command response
+ */
+struct l7vs_config_rsp_unknown_cmd{
+ enum l7vs_config_command cmd; /*! response command */
+ int code; /*! response code */
+};
+
+//
+// functions
+//
+
+/*! l7vs_config_init
+ * configration module initialize function.
+ * @return success return is 0, else error code
+ */
+extern int l7vs_config_init();
+
+/*!
+ * l7vs_config_fini()
+ * configuration module finalize function.
+ */
+extern void l7vs_config_fini();
+
+#endif //L7VS_CONFIG_H
--- /dev/null
+/*
+ * @file l7vs_conn.h
+ * @bref Connection is managed.
+ * @bref The previous substance becomes one conn though two iom is registered
+ * @bref in sets of imoux so that conn may have sockaddr for a real server
+ * @bref and sockaddr for the client internally.
+ *
+ * L7VSD: Linux Virtual Server for Layer7 Load Balancing
+ * Copyright (C) 2005 NTT COMWARE Corporation.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ **********************************************************************/
+#ifndef L7VS_CONN_H
+#define L7VS_CONN_H
+
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include "l7vs_iom.h"
+#include "l7vs_iomuxlist.h"
+#include "l7vs_dest.h"
+#include "logger_wrapper.h"
+
+#define FDSET_SIZE (8192)
+struct my_fd_set{
+ char x[FDSET_SIZE];
+};
+#undef FD_ZERO
+#define FD_ZERO(ptr) memset((ptr), 0, FDSET_SIZE)
+
+// connection management datatype
+#define L7VS_CLDATA_CHUNKSIZE (512)
+#define L7VS_CLDATA_BUFSIZE(L) (((L)->cldata_len + L7VS_CLDATA_CHUNKSIZE - 1) & ~(L7VS_CLDATA_CHUNKSIZE - 1))
+#define L7VS_CLDATA_REST(L) (L7VS_CLDATA_BUFSIZE(L) - (L)->cldata_len)
+
+#define L7VS_CONN_S_CL_CONNECTED 0
+#define L7VS_CONN_S_RS_CONNECTING 1
+#define L7VS_CONN_S_RS_CONNECTED 2
+
+#define QOS_UP 1
+#define QOS_DOWN 2
+
+#define L7VS_CONN_READ_BUFSIZE_MAX 262144 //minimum l7vs_conn_read_bufsize 262144Byte = 256KByte
+#define L7VS_CONN_READ_BUFSIZE_MIN 2048 //minimum l7vs_conn_read_bufsize
+
+struct l7vs_conn{
+ struct l7vs_lsock* lsock; //! l7vs_lsock pointer
+ struct l7vs_service* srv; //! l7vs_service pointer
+ struct l7vs_dest* dest; //! real server pointer
+ int splice; //! tcp splice handle (don't use)
+ struct sockaddr_in caddr; //! client sockaddr struct
+ struct sockaddr_in raddr; //! real server sockaddr struct
+ struct sockaddr_in vaddr; //!
+ struct sockaddr_in laddr; //!
+ struct l7vs_iomux* ciom; //! client-side socket
+ struct l7vs_iomux* riom; //! realserver-side socket
+ uint8_t proto; //!
+ uint32_t state; //! connn status
+ char* cldata; //! client data buffer
+ size_t cldata_len; //! client data buffer length
+ size_t cldata_bufsize; //! client buffer size
+ int cmss; //! cmess??
+ int sorry_conn_flag; //! sorry connection flag
+ struct l7vs_dest* old_dest; //! old destination
+};
+
+//
+// functions.
+//
+extern struct l7vs_conn* l7vs_conn_create( int, struct l7vs_lsock* );
+extern void l7vs_conn_destroy( struct l7vs_conn* );
+//extern int l7vs_conn_recv_client( struct l7vs_conn* );
+extern int l7vs_conn_connect_rs( struct l7vs_conn*, struct l7vs_dest* );
+//extern int l7vs_conn_splice( struct l7vs_conn* );
+extern void l7vs_conn_close_csock( struct l7vs_conn* );
+extern void l7vs_conn_close_rsock( struct l7vs_conn* );
+extern int l7vs_conn_closed( struct l7vs_conn* );
+/*! l7vs_conn_init
+ * @return success return is 0, else error code
+ */
+extern int l7vs_conn_init();
+/*!
+ * serialize struct sockaddr_in
+ *
+ * @param[out] ret serialized string
+ * @param[in] conn source sockaddr_in
+ * @return void
+ */
+inline void l7vs_conn_sockaddr_in_c_str(char* ret, const struct sockaddr_in* addr)
+{
+ if (!ret) {
+ return;
+ }
+
+ if (!addr) {
+ snprintf(ret, DEBUG_STR_LEN, "(nil)");
+ return;
+ }
+
+ snprintf(ret, DEBUG_STR_LEN,
+ "sockaddr_in="
+ "{sin_addr=%s: "
+ "sin_port=%d}"
+ , inet_ntoa(addr->sin_addr)
+ , ntohs(addr->sin_port));
+}
+
+/*!
+ * serialize struct l7vs_conn
+ *
+ * @param[out] ret serialized string
+ * @param[in] conn source l7vs_conn
+ * @return void
+ */
+inline void l7vs_conn_c_str(char* ret, const struct l7vs_conn* conn)
+{
+ if (!ret) {
+ return;
+ }
+
+ char dest_str[DEBUG_STR_LEN];
+ char caddr_str[DEBUG_STR_LEN];
+ char raddr_str[DEBUG_STR_LEN];
+ char ciom_str[DEBUG_STR_LEN];
+ char riom_str[DEBUG_STR_LEN];
+ char old_dest_str[DEBUG_STR_LEN];
+
+ if (!conn) {
+ snprintf(ret, DEBUG_STR_LEN, "(nil)");
+ return;
+ }
+
+ l7vs_conn_sockaddr_in_c_str(caddr_str, &conn->caddr);
+ l7vs_conn_sockaddr_in_c_str(raddr_str, &conn->raddr);
+ l7vs_dest_c_str(dest_str, conn->dest);
+ l7vs_iomux_c_str(ciom_str, conn->ciom);
+ l7vs_iomux_c_str(riom_str, conn->riom);
+ l7vs_dest_c_str(old_dest_str, conn->old_dest);
+
+ snprintf(ret, DEBUG_STR_LEN,
+ "l7vs_conn="
+ "{lsock=%p: "
+ "srv=%p: "
+ "dest=%s: "
+ "caddr=%s: "
+ "raddr=%s: "
+ "ciom=%s: "
+ "riom=%s: "
+ "proto=%x: "
+ "cldata=%s: "
+ "cldata_len=%zu: "
+ "cldata_bufsize=%zu: "
+ "cmss=%d: "
+ "sorry_conn_flag=%d: "
+ "old_dest=%s}"
+ , conn->lsock
+ , conn->srv
+ , dest_str
+ , caddr_str
+ , raddr_str
+ , ciom_str
+ , riom_str
+ , conn->proto
+ , conn->cldata
+ , conn->cldata_len
+ , conn->cldata_bufsize
+ , conn->cmss
+ , conn->sorry_conn_flag
+ , old_dest_str);
+}
+
+#endif //L7VS_CONN_H
--- /dev/null
+/*!
+ * @file l7vs_dest.h
+ * @brief RealServer component.
+ * @brief
+ *
+ *
+ */
+
+#ifndef L7VS_DEST_H
+#define L7VS_DEST_H
+
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include "logger_wrapper.h"
+
+//
+// ! real-server datatype
+//
+//
+struct l7vs_dest{
+ struct sockaddr_in addr; //! sockaddr
+ int weight; //! schedule weight use
+ int nactive; //! nactive
+ int ninact; //! ninactive
+};
+
+//
+// ! real-server datatype, external representation
+//
+//
+struct l7vs_dest_arg{
+ struct sockaddr_in addr;
+ int weight;
+ int nactive;
+ int ninact;
+};
+
+//
+// functions.
+//
+extern struct l7vs_dest* l7vs_dest_create( struct sockaddr_in*, int );
+extern void l7vs_dest_destroy( struct l7vs_dest* );
+extern void l7vs_dest_to_arg( struct l7vs_dest*, struct l7vs_dest_arg* );
+
+/*!
+ * serialize struct sockaddr_in
+ * @param[out] ret serialized string
+ * @param[in] dest source sockaddr_in
+ * @return void
+ */
+inline void l7vs_dest_sockaddr_in_c_str(char* ret, const struct sockaddr_in* addr)
+{
+ if (!addr) {
+ snprintf(ret, DEBUG_STR_LEN, "(nil)");
+ return;
+ }
+
+ snprintf(ret, DEBUG_STR_LEN,
+ "sockaddr_in="
+ "{sin_addr=%s: "
+ "sin_port=%d}"
+ , inet_ntoa(addr->sin_addr)
+ , ntohs(addr->sin_port));
+}
+
+
+/*!
+ * serialize struct l7vs_dest
+ * @param[out] ret serialized string
+ * @param[in] dest source l7vs_dest
+ * @return void
+ */
+inline void l7vs_dest_c_str(char *ret,const struct l7vs_dest *dest)
+{
+ char addr_str[DEBUG_STR_LEN];
+
+ if(!dest){
+ snprintf(ret, DEBUG_STR_LEN, "(nil)");
+ return;
+ }
+
+ l7vs_dest_sockaddr_in_c_str(addr_str,&(dest->addr));
+ snprintf(ret, DEBUG_STR_LEN,
+ "dest = %p: "
+ "addr = %s: "
+ "weight= %d: "
+ "nactive= %d: "
+ "ninact= %d: ",
+ dest,
+ addr_str,
+ dest->weight,
+ dest->nactive,
+ dest->ninact);
+}
+
+/*!
+ * serialize struct l7vs_darg
+ * @param[out] ret serialized string
+ * @param[in] dest source l7vs_dest_arg
+ * @return void
+ */
+inline void l7vs_darg_c_str(char *ret,const struct l7vs_dest_arg *darg)
+{
+ char addr_str[DEBUG_STR_LEN];
+
+ if(!darg){
+ snprintf(ret, DEBUG_STR_LEN, "(nil)");
+ return;
+ }
+
+ l7vs_dest_sockaddr_in_c_str(addr_str,&(darg->addr));
+ snprintf(ret, DEBUG_STR_LEN,
+ "addr = %s: "
+ "weight= %d: "
+ "nactive= %d: "
+ "ninact= %d: ",
+ addr_str,
+ darg->weight,
+ darg->nactive,
+ darg->ninact);
+}
+
+#endif //L7VS_DEST_H
--- /dev/null
+/*!
+ * @file @l7vs_iom.h
+ * @bried Iom is controlled.
+ *
+ * L7VSD: Linux Virtual Server for Layer7 Load Balancing
+ * Copyright (C) 2005 NTT COMWARE Corporation.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ **********************************************************************/
+#ifndef L7VS_IOM_H
+#define L7VS_IOM_H
+
+// I/O multiplexing support
+//#define L7VS_IOMUX_READ 0x0001
+//#define L7VS_IOMUX_WRITE 0x0002
+//#define L7VS_IOMUX_EXCEPT 0x0004
+
+enum iomaction{
+ iom_read = 0,
+ iom_write = 1,
+ iom_hup = 3
+};
+
+enum iomstatus{
+ iomux_none = 0,
+ iomux_create,
+ iomux_disabled,
+
+ //config_common
+ iomux_config_init, //! config before initialize
+ iomux_config_initialized, //! config was initialized
+ iomux_config_command_waiting, //! command waiting
+ iomux_config_command_response_sent, //! command response sent
+ iomux_config_signal_received, //! signal received
+ iomux_config_destroyed, //! config finishing process was executed
+
+ //config_list_vs
+ iomux_config_command_list_vs_received, //! LIST_VS command received
+ iomux_config_command_list_vs_succeeded, //! LIST_VS command succeeded
+
+ //config_list_rs
+ iomux_config_command_list_rs_received, //! LIST_RS command received
+ iomux_config_command_list_rs_vs_found, //! virtual service was found
+ iomux_config_command_list_rs_succeeded, //! LIST_RS command succeeded
+
+ //config_add_vs
+ iomux_config_command_add_vs_received, //! ADD_VS command received
+ iomux_config_command_add_vs_vs_not_found, //! virtual service was not found
+ iomux_config_command_add_vs_lsock_not_found, //! listening socket was not found
+ iomux_config_command_add_vs_lsock_created, //! listening socket was created
+ iomux_config_command_add_vs_lsock_got, //! listening socket got
+ iomux_config_command_add_vs_protomod_not_found, //! protocol module was not found
+ iomux_config_command_add_vs_protomod_loaded, //! protocol module was loaded
+ iomux_config_command_add_vs_protomod_got, //! protocol module got
+ iomux_config_command_add_vs_sched_not_found, //! schedule module was not found
+ iomux_config_command_add_vs_sched_loaded, //! schedule module was loaded
+ iomux_config_command_add_vs_sched_got, //! schedule module got
+ iomux_config_command_add_vs_pmod_created, //! protocol module was created
+ iomux_config_command_add_vs_dup_checked, //! virtual service duplication check done
+ iomux_config_command_add_vs_vs_created, //! virtual service has created
+ iomux_config_command_add_vs_succeeded, //! ADD_VS command succeeded
+
+ //config_del_vs
+ iomux_config_command_del_vs_received, //! DEL_VS command received
+ iomux_config_command_del_vs_vs_found, //! virtual service was found
+ iomux_config_command_del_vs_dest_destroyed, //! destination was destroyed
+ iomux_config_command_del_vs_succeeded, //! DELVS command succeeded
+
+ //config_edit_vs
+ iomux_config_command_edit_vs_received, //! EDIT_VS command received
+ iomux_config_command_edit_vs_vs_found, //! virtual serveice was found
+ iomux_config_command_edit_vs_sched_not_found, //! schedule module not found
+ iomux_config_command_edit_vs_sched_loaded, //! schedule module was loaded
+ iomux_config_command_edit_vs_sched_got, //! schedule module got
+ iomux_config_command_edit_vs_succeeded, //! EDIT_VS command succeeded
+
+ //config_add_rs
+ iomux_config_command_add_rs_received, //! ADD_RS command received
+ iomux_config_command_add_rs_vs_found, //! virtual servece was found
+ iomux_config_command_add_rs_rs_not_found, //! real server was not found
+ iomux_config_command_add_rs_succeeded, //! ADD_RS command succeeded
+
+ //config_del_rs
+ iomux_config_command_del_rs_received, //! DEL_RS command recdeived
+ iomux_config_command_del_rs_vs_found, //! virtual service was found
+ iomux_config_command_del_rs_rs_found, //! real service was found
+ iomux_config_command_del_rs_succeeded, //! DEL_RS command succeeed
+
+ //config_edit_rs
+ iomux_config_command_edit_rs_received, //! EDIT_RS command received
+ iomux_config_command_edit_rs_rs_found, //! real service found
+ iomux_config_command_edit_rs_vs_found, //! virtual service found
+ iomux_config_command_edit_rs_succeeded, //! EDIT_RS command succeeded
+
+ //config_flush_vs
+ iomux_config_command_flush_vs_received, //! FLUSH_VS command received
+ iomux_config_command_flush_vs_succeeded, //! FLUSH_VS command succeeded
+
+ //config_sync_initialize
+ iomux_config_command_sync_initialize_received, //! SYNC_INIT command received
+ iomux_config_command_sync_initialize_succeeded, //! SYNC_INIT command succeeded
+
+ //config_sync_initialize
+ iomux_config_command_sync_finalize_received, //! SYNC_FINI command received
+ iomux_config_command_sync_finalize_succeeded, //! SYNC_FINI command succeeded
+
+ //config_error
+ iomux_config_command_recv_error, //! command receive error
+ iomux_config_command_nomem_error, //! no memory error
+ iomux_config_command_novs_error, //! virtual service was not found error
+ iomux_config_command_nors_error, //! real server was not found error
+ iomux_config_command_vs_exist_error, //! virtual service already exist error
+ iomux_config_command_rs_exist_error, //! real service already exist error
+ iomux_config_command_nosock_error, //! listening socket was not found error
+ iomux_config_command_noprotomod_error, //! protocol module was not found error
+ iomux_config_command_nosched_error, //! scheduler module was not found error
+ iomux_config_command_vs_create_error, //! virtual service create error
+ iomux_config_command_set_qos_error, //! set qos error
+ iomux_config_command_set_sorry_server_error, //! set sorry server error
+
+ //lsock_initialize
+ iomux_lsock_init, //! listening socket before initialize
+ iomux_lsock_initalized, //! listening socket was initialized
+
+ //lsock_create
+ iomux_lsock_not_found, //! listening socket was not found
+ iomux_lsock_created, //! listening socket was created
+ iomux_lsock_got, //! listening socket got
+
+ //lsock_connect_waiting
+ iomux_lsock_connect_waiting, //! wait for client connection
+ iomux_lsock_accepted, //! listening socket was accepted
+ iomux_lsock_conn_created, //! connection was created
+
+ //lsock_destroy
+ iomux_lsock_released, //! listeing socket was released
+ iomux_lsock_destroyed, //! listeing socket was destroyed
+
+ //lsock_error
+ iomux_lsock_create_error, //! listening socket error
+ iomux_lsock_conn_create_error, //! create conn error
+
+ //conn_initialize
+ iomux_conn_init, //! connection befor initialize
+ iomux_conn_created, //! connection was created
+
+ //conn_data_excahnge
+ iomux_conn_receive_ready, //! data receive ready
+ iomux_conn_receiving, //! data receiving now
+ iomux_conn_received, //! data receiving finished
+ iomux_conn_send_ready, //! data sending ready
+ iomux_conn_send_ready_busy, //! data sending ready and was connected
+ iomux_conn_sending, //! data sending
+ iomux_conn_sending_busy, //! data sending and was connected
+ iomux_conn_sent, //! data sent
+ iomux_conn_sent_busy, //! data send and was connected
+
+ //conn_data_read_control
+ iomux_conn_block, //! can not receive nor sent becase of buffer in use
+ iomux_conn_busy, //! connect action happened during block state
+
+ //conn_process_status
+ iomux_conn_dest_absent, //! destination was absent
+ iomux_conn_dest_decided, //! destination was decided
+ iomux_conn_service_selected, //! virtual service was selected
+ iomux_conn_rs_connected, //! real server was connected
+ iomux_conn_rsdata_modified, //! data from real server was modified
+
+ //conn_disconnected
+ iomux_conn_disconnected, //! connection was disconnected
+
+ //conn_destroy
+ iomux_conn_destroyed, //! connection was destroyed
+
+ //conn_error
+ iomux_conn_create_error, //! create connection error
+ iomux_conn_buffer_realloc_error, //! buffer re-allocation error
+
+ iomux_conn_receive_error, //! data receive error
+ iomux_conn_send_error, //! data send error
+ iomux_conn_rs_connect_error, //! real server connect error
+ iomux_conn_rsdata_modify_error, //! data from real server modify error
+
+ //sync_send
+ iomux_sync_sending, //! sending data
+
+ //sync_recv
+ iomux_sync_receving, //! recevind data
+
+ //sync_error
+ iomux_sync_modeerr, //! mode error
+
+ //sync__destroy
+ iomux_sync_destroy, //! sync finish
+
+ //replication_status
+ iomux_replication_sending, //! replication data is sending
+ iomux_replication_receving, //! replication data is reciveing
+ iomux_replication_send_wait, //! replication data is send wait
+ iomux_replication_recv_wait, //! replication data is recv wait
+ iomux_replication_send_stop, //! send is stop
+ iomux_replication_recv_stop, //! recive is stop
+ iomux_replication_out, //! mode is nothing
+
+
+ // snmpbridge_status
+ iomux_snmp_waiting, //! snmp connection waiting
+ iomux_snmp_receive_ready, //! snmp data receive ready
+ iomux_snmp_send_ready, //! snmp data send ready
+
+ //replication_status
+ iomux_replication_error, //! mode error
+
+ //sync__destroy
+ iomux_replication_destroy //! sync finish
+
+};
+
+struct l7vs_iomux{
+ int fd;
+ int (*callback)(struct l7vs_iomux* iom );
+ enum iomstatus status;
+ void* data;
+};
+
+#endif //L7VS_IOM
--- /dev/null
+/*!
+ * @file l7vs_iomuxlist.c
+ * @brief This file manages sets of iomux.
+ * @brief It becomes the foundation of the event call of FD using sets of iomux
+ * @bried and epoll.
+ * L7VSD: Linux Virtual Server for Layer7 Load Balancing
+ * Copyright (C) 2005 NTT COMWARE Corporation.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ **********************************************************************/
+#ifndef L7VS_IOMUXLIST_H
+#define L7VS_IOMUXLIST_H
+
+#define L7VS_IOMUX_LIST_UNCHANGED 0
+#define L7VS_IOMUX_LIST_REMOVED_MYSELF 1
+#define L7VS_IOMUX_LIST_REMOVED_OTHER 2
+
+#include <stdint.h>
+#include "l7vs_iom.h"
+#include "logger_wrapper.h"
+
+extern int l7vs_iomux_init();
+extern void l7vs_iomux_fini();
+extern struct l7vs_iomux* l7vs_iomux_get_from_avail_list();
+extern void l7vs_iomux_put_to_avail_list(struct l7vs_iomux*);
+extern void l7vs_iomux_add( struct l7vs_iomux*, enum iomaction );
+extern void l7vs_iomux_remove( struct l7vs_iomux* );
+extern void l7vs_iomux_mod( struct l7vs_iomux*, enum iomaction );
+extern void l7vs_iomux_removeall();
+extern int l7vs_iomux_poll( struct timeval*, int blocking );
+
+/*!
+ * serialize struct l7vs_iomux
+ *
+ * @param[out] ret serialized string
+ * @param[in] conn source l7vs_iomux
+ * @return void
+ */
+inline void l7vs_iomux_c_str(char* ret, const struct l7vs_iomux* iom)
+{
+ if (!ret) {
+ return;
+ }
+
+ if (!iom) {
+ snprintf(ret, DEBUG_STR_LEN, "(nil)");
+ return;
+ }
+
+ snprintf(ret, DEBUG_STR_LEN,
+ "l7vs_iomux={fd = %d: "
+ "callback = %p: "
+ "status = %d: "
+ "data = %p}"
+ , iom->fd
+ , iom->callback
+ , iom->status
+ , iom->data);
+}
+
+#endif //L7VS_IOMUXLIST_H
--- /dev/null
+/*!
+ * @file l7vs_lsock.h
+ * @brief The listening socket is managed.
+ *
+ *
+ * L7VSD: Linux Virtual Server for Layer7 Load Balancing
+ * Copyright (C) 2005 NTT COMWARE Corporation.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ **********************************************************************/
+#ifndef L7VS_LSOCK_H
+#define L7VS_LSOCK_H
+
+#include <netinet/in.h>
+#include <glib.h>
+#include <stdint.h>
+#include "l7vs_iom.h"
+
+// listen socket datatype. accepts client connections.
+struct l7vs_lsock{
+ struct sockaddr_in addr;
+ uint8_t proto;
+ struct l7vs_iomux* iom;
+ int refcnt;
+ int fast_schedule;
+ GList* srv_list;
+};
+
+struct l7vs_service;
+struct l7vs_conn;
+struct l7vs_dest;
+
+//
+// functions
+//
+extern int l7vs_lsock_init();
+extern void l7vs_lsock_fini();
+extern struct l7vs_lsock* l7vs_lsock_get( struct sockaddr_in*, uint8_t, int );
+extern void l7vs_lsock_put( struct l7vs_lsock* );
+extern struct l7vs_lsock* l7vs_lsock_table_lookup( struct sockaddr_in*, uint8_t );
+extern void l7vs_lsock_add_service( struct l7vs_lsock*, struct l7vs_service* );
+extern void l7vs_lsock_remove_service( struct l7vs_lsock*, struct l7vs_service* );
+
+extern int l7vs_lsock_select_service(
+ struct l7vs_lsock*,
+ struct l7vs_conn*,
+ char*,
+ size_t,
+ struct l7vs_service**,
+ struct l7vs_dest**,
+ int* );
+/*!
+ * serialize struct sockaddr_in
+ *
+ * @param[out] ret serialized string
+ * @param[in] dest source sockaddr_in
+ * @return void
+ */
+inline void l7vs_lsock_sockaddr_in_c_str(char* ret, const struct sockaddr_in* addr)
+{
+ if (!addr) {
+ snprintf(ret, DEBUG_STR_LEN, "(nil)");
+ return;
+ }
+
+ snprintf(ret, DEBUG_STR_LEN,
+ "sockaddr_in="
+ "{sin_addr=%s: "
+ "sin_port=%d}"
+ , inet_ntoa(addr->sin_addr)
+ , ntohs(addr->sin_port));
+}
+
+/*!
+ * serialize struct l7vs_lsock
+ *
+ * @param[out] ret serialized string
+ * @param[in] lsock source l7vs_lsock
+ * @return void
+ */
+inline void l7vs_lsock_c_str(char* ret, const struct l7vs_lsock* lsock)
+{
+ char addr_str[DEBUG_STR_LEN];
+ char iomux_str[DEBUG_STR_LEN];
+
+ if(!lsock){
+ snprintf(ret, DEBUG_STR_LEN, "(nil)");
+ return;
+ }
+
+ l7vs_lsock_sockaddr_in_c_str(addr_str,&(lsock->addr));
+ l7vs_iomux_c_str(iomux_str,lsock->iom);
+ snprintf(ret, DEBUG_STR_LEN,
+ "lsock = %p"
+ "addr = %s: "
+ "proto= %d: "
+ "iom= %s: "
+ "refcnt= %d: "
+ "srv_list= %p: ",
+ lsock,
+ addr_str,
+ lsock->proto,
+ iomux_str,
+ lsock->refcnt,
+ lsock->srv_list);
+}
+
+#endif //L7VS_LSOCK_H
+
--- /dev/null
+/**********************************************************************
+ * l7vs_module.h May 2007
+ *
+ * L7VSD: Linux Virtual Server for Layer7 Load Balancing
+ * Copyright (C) 2005 NTT COMWARE Corporation.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ **********************************************************************/
+#ifndef L7VS_MODULE_H
+#define L7VS_MODULE_H
+
+#include <stdint.h>
+#include <glib.h>
+#include "l7vs.h"
+#include "l7vs_service.h"
+#include "logger_wrapper.h"
+
+struct l7vs_conn;
+struct l7vs_service;
+struct l7vs_service_arg;
+struct l7vs_dest;
+
+struct l7vs_protomod{
+ void* handle;
+ char modname[L7VS_MODNAME_LEN+1];
+ int refcnt;
+ int fast_schedule;
+
+ //member functions
+ int ( *create )( void*, uint32_t );
+ int ( *compare )( uint32_t, uint32_t );
+ int ( *match_cldata )( struct l7vs_service*, struct l7vs_conn*, char*, size_t*, struct l7vs_dest**, int* );
+ int ( *analyze_rsdata )( struct l7vs_service*, struct l7vs_conn*, char*, size_t* );
+ int ( *destroy )( uint32_t );
+ void ( *fini )();
+ void* ( *create_sa )( struct l7vs_service_arg* );
+ int ( *service_arg )( struct l7vs_service_arg_multi*, uint32_t );
+ int ( *parse )( void*, int, char** );
+ void ( *destroy_sa )( void** );
+ int ( *initialize )( struct l7vs_service*, struct l7vs_conn*, char*, size_t, struct l7vs_dest** );
+ int ( *finalize )( struct l7vs_service*, struct l7vs_conn*, char*, size_t, struct l7vs_dest**, int );
+ enum LOG_LEVEL_TAG ( *get_log_level )( const enum LOG_CATEGORY_TAG );
+ void ( *put_log_debug )( const enum LOG_CATEGORY_TAG, const unsigned int, char*, int, const char* );
+ void ( *put_log_info )( const enum LOG_CATEGORY_TAG, const unsigned int, char*, int, const char* );
+ void ( *put_log_warn )( const enum LOG_CATEGORY_TAG, const unsigned int, char*, int, const char* );
+ void ( *put_log_error )( const enum LOG_CATEGORY_TAG, const unsigned int, char*, int, const char* );
+ void ( *put_log_fatal )( const enum LOG_CATEGORY_TAG, const unsigned int, char*, int, const char* );
+ void* ( *replication_pay_memory )( char*, unsigned int* );
+};
+
+extern char l7vs_module_path[];
+
+//
+// functions
+//
+
+extern struct l7vs_protomod* l7vs_protomod_get( char* );
+extern void l7vs_protomod_put( struct l7vs_protomod* );
+extern struct l7vs_protomod* l7vs_protomod_lookup( char* );
+extern int l7vs_module_init( char* );
+extern void l7vs_module_fini();
+extern void* l7vs_module_load( char*, char* );
+extern void l7vs_module_unload( void* );
+extern void l7vs_module_register( GList**, void* );
+extern void l7vs_module_remove( GList**, void* );
+extern void* l7vs_module_lookup( GList*, void*, GCompareFunc );
+
+#define PUT_LOG_FATAL(mod, cat, message_id, message, arg...) { \
+ if (mod.get_log_level != NULL && mod.put_log_fatal != NULL && \
+ LOG_LV_FATAL >= mod.get_log_level(cat)) { \
+ char buf[BUF_LEN]; \
+ snprintf(buf, BUF_LEN, message, ##arg); \
+ mod.put_log_fatal(cat, message_id, __FILE__, __LINE__, buf); }}
+
+#define PUT_LOG_ERROR(mod, cat, message_id, message, arg...) { \
+ if (mod.get_log_level != NULL && mod.put_log_error != NULL && \
+ LOG_LV_ERROR >= mod.get_log_level(cat)) { \
+ char buf[BUF_LEN]; \
+ snprintf(buf, BUF_LEN, message, ##arg); \
+ mod.put_log_error(cat, message_id, __FILE__, __LINE__, buf); }}
+
+#define PUT_LOG_WARN(mod, cat, message_id, message, arg...) { \
+ if (mod.get_log_level != NULL && mod.put_log_warn != NULL && \
+ LOG_LV_WARN >= mod.get_log_level(cat)) { \
+ char buf[BUF_LEN]; \
+ snprintf(buf, BUF_LEN, message, ##arg); \
+ mod.put_log_warn(cat, message_id, __FILE__, __LINE__, buf); }}
+
+#define PUT_LOG_INFO(mod, cat, message_id, message, arg...) { \
+ if (mod.get_log_level != NULL && mod.put_log_info != NULL && \
+ LOG_LV_INFO >= mod.get_log_level(cat)) { \
+ char buf[BUF_LEN]; \
+ snprintf(buf, BUF_LEN, message, ##arg); \
+ mod.put_log_info(cat, message_id, __FILE__, __LINE__, buf); }}
+
+#define PUT_LOG_DEBUG(mod, cat, message_id, message, arg...) { \
+ if (mod.put_log_debug != NULL) { \
+ char buf[BUF_LEN]; \
+ snprintf(buf, BUF_LEN, message, ##arg); \
+ mod.put_log_debug(cat, message_id, __FILE__, __LINE__, buf); }}
+
+template <typename T> enum LOG_LEVEL_TAG IS_DEBUG( const T &obj, enum LOG_CATEGORY_TAG tag ){
+ if( obj.get_log_level ){
+ return obj.get_log_level(tag);
+ }
+ if( obj.put_log_debug ){
+ obj.put_log_debug( tag, 0 , __FILE__, __LINE__, "opps pointer is NULL!!" );
+ }
+ return LOG_LV_DEBUG;
+}
+
+/*!
+ * Extract struct l7vs_protomod to strings for debug log.
+ * @param string
+ * @return l7vs_protomod struct
+ */
+inline void l7vs_protomod_c_str(char* buf, struct l7vs_protomod* proto) {
+ if (proto == NULL) {
+ snprintf(buf, DEBUG_STR_LEN, "NULL");
+ }
+ else {
+ snprintf(buf, DEBUG_STR_LEN, "handle: %p, modname: %s, refcnt: %d, create: %p, compare: %p, "
+ "match_cldata: %p, analyze_rsdata: %p, destroy: %p, fini: %p, create_sa: %p, service_arg: %p, "
+ "parse: %p, destroy_sa: %p, initialize: %p, finalize: %p, get_log_level: %p, put_log_debug: %p, "
+ "put_log_info: %p, put_log_warn: %p, put_log_error: %p, put_log_fatal: %p",
+ proto->handle, proto->modname, proto->refcnt, proto->create, proto->compare, proto->match_cldata,
+ proto->analyze_rsdata, proto->destroy, proto->fini, proto->create_sa, proto->service_arg,
+ proto->parse, proto->destroy_sa, proto->initialize, proto->finalize, proto->get_log_level,
+ proto->put_log_debug, proto->put_log_info, proto->put_log_warn, proto->put_log_error,
+ proto->put_log_fatal);
+ }
+}
+
+#endif //L7VS_MODULE_H
--- /dev/null
+/*
+ * @file l7vs_replication.h
+ * @bref The Replication of data between ACT and STB.
+ *
+ * L7VSD: Linux Virtual Server for Layer7 Load Balancing
+ * Copyright (C) 2005 NTT COMWARE Corporation.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ **********************************************************************/
+#ifndef L7VS_REPLICATION_H
+#define L7VS_REPLICATION_H
+
+
+//! Max Number of Components
+#define CMP_MAX (100)
+
+//! Max Size of Components
+#define CMP_BLOCK_MAX (100000)
+
+//! Key's length of Component ID
+#define ID_LENGTH (17)
+
+//! REPLICATION_SLAVE of Component SIZE
+#define CMP_SIZE_LENGTH (17)
+
+//! Maximum size of input/output raw data
+#define DATA_SIZE (480)
+
+//! Maximum size of input/output raw data
+#define SEND_DATA_SIZE (512)
+
+//! Min Interval
+#define MIN_INTERVAL (10)
+
+//! Max Interval
+#define MAX_INTERVAL (10000)
+
+//! Min Compulsorily Interval
+#define MIN_COMPULSORILRY_INTERVAL (4)
+
+//! Max Compulsorily Interval
+#define MAX_COMPULSORILRY_INTERVAL (400)
+
+//! Set nic length
+#define NIC_LENGTH (128)
+
+//! Dump log data's width
+#define LOG_DATA_WIDTH (16)
+
+//! Replication data ID
+#define REPLICATION_ID (37)
+
+#include <netdb.h>
+#include <stdint.h>
+
+//! Mode Type
+enum REPLICATION_MODE_TAG{
+ REPLICATION_OUT, //!< Initial
+ REPLICATION_SINGLE, //!< Single
+ REPLICATION_MASTER, //!< Master isActive
+ REPLICATION_SLAVE, //!< Slave isActive
+ REPLICATION_MASTER_STOP, //!< Master isStop
+ REPLICATION_SLAVE_STOP //!< Slave isStop
+};
+
+//! Transfer data between active server and standby server.
+struct l7vs_replication_data{
+ unsigned short id; //!< ID of Replication Function
+ char pad1[6];
+ unsigned long long serial; //!< Serial Number
+ unsigned int block_num; //!< Block Number in Replication memory
+ char pad2[4];
+ uint64_t size; //!< Data size for checking packet loss
+ char data[DATA_SIZE];//!< Raw data
+};
+
+//! Component information set to SG file.
+struct l7vs_replication_component{
+ char id[ID_LENGTH]; //!< ID distinguishes Component
+ unsigned int block_head; //!< The first Block Number of Component's memory
+ unsigned int block_size; //!< Number of Block allocated in component memory
+};
+
+//! State Infomation struct to execute Replication.
+struct l7vs_replication_state{
+ enum REPLICATION_MODE_TAG service_status; //!< States Type of Replication Function
+ unsigned long long send_time; //!< Completion last time to send data
+ unsigned int last_send_block; //!< Completion last Block Number to send data
+ unsigned int last_recv_block; //!< Completion last Block Number to receive data
+ unsigned int total_block; //!< The maximum Block Number of Components memory
+ void * replication_memory; //!< Top address in Replication memory
+ void * component_memory; //!< Top address in Component memory
+ uint64_t sarface_block_no; //!< Serial number for respect switch
+ uint64_t * sarface_block_array_ptr;//!< Serial number in received respect at every block
+};
+
+//! Essential information set to SG file.
+struct l7vs_replication_info{
+ char ip_addr[NI_MAXHOST]; //!< Destination IP address (IPv4 or IPv6)
+ char service_name[NI_MAXSERV]; //!< Destination service name or port number
+ char nic[NIC_LENGTH]; //!< Network device (ex. eth0, bond0, hme0, etc.)
+ unsigned short interval; //!< Interval when data of one block is sent
+ int component_num; //!< Number of components read setting
+ struct l7vs_replication_component component_info[CMP_MAX]; //!< Information on individual component
+};
+
+
+// External function
+
+// Initialize of Replication Function
+extern int l7vs_replication_init();
+
+// Finalize of Replication Function
+extern void l7vs_replication_fini();
+
+// Switches Slave to Master ( VirtualService is added )
+extern void l7vs_replication_switch_to_master();
+
+// Switches Master to Slave ( VirtualService is deleted )
+extern void l7vs_replication_switch_to_slave();
+
+// Allocate the memory of the component.
+extern void *l7vs_replication_pay_memory( char* component_id, unsigned int* size );
+
+// Replication Callback
+extern int l7vs_replication_send_callback( struct l7vs_iomux *iom );
+
+// Replication Callback
+extern int l7vs_replication_recv_callback( struct l7vs_iomux *iom );
+
+// Dump Replication info to the Log.
+extern void l7vs_replication_dump_memory();
+
+// Starting the Replication
+extern void l7vs_replication_start();
+
+// Stopping the Replication
+extern void l7vs_replication_stop();
+
+// Compulsorily executes the replication.
+extern void l7vs_replication_compulsorily();
+
+// Re-Sets the Interval
+extern void l7vs_replication_reset();
+
+// Acquires the state
+extern enum REPLICATION_MODE_TAG l7vs_replication_get_status();
+
+// Check the interval time
+extern int l7vs_replication_checkinterval();
+
+
+#endif
--- /dev/null
+/**********************************************************************
+ * l7vs_sched.h May 2007
+ *
+ * L7VSD: Linux Virtual Server for Layer7 Load Balancing
+ * Copyright (C) 2005 NTT COMWARE Corporation.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ **********************************************************************/
+#ifndef L7VS_SCHED_H
+#define L7VS_SCHED_H
+
+#include "l7vs_module.h"
+#include "logger_wrapper.h"
+
+struct l7vs_service;
+struct l7vs_conn;
+struct l7vs_dest;
+
+// scheduler datatype
+struct l7vs_scheduler{
+ void* handle;
+ char modname[L7VS_MODNAME_LEN+1];
+ int refcnt;
+ struct l7vs_dest* (*schedule)( struct l7vs_service*, struct l7vs_conn*);
+ void (*bind)( struct l7vs_service*);
+ void (*unbind)(struct l7vs_service*);
+ void (*fini)();
+ enum LOG_LEVEL_TAG (*get_log_level)(const enum LOG_CATEGORY_TAG);
+ void (*put_log_debug)(const enum LOG_CATEGORY_TAG, const unsigned int, char*, int, const char*);
+ void (*put_log_info)(const enum LOG_CATEGORY_TAG, const unsigned int, char*, int, const char*);
+ void (*put_log_warn)(const enum LOG_CATEGORY_TAG, const unsigned int, char*, int, const char*);
+ void (*put_log_error)(const enum LOG_CATEGORY_TAG, const unsigned int, char*, int, const char*);
+ void (*put_log_fatal)(const enum LOG_CATEGORY_TAG, const unsigned int, char*, int, const char*);
+};
+
+//
+// finctions.
+//
+extern struct l7vs_scheduler* l7vs_sched_get(char*);
+extern void l7vs_sched_put( struct l7vs_scheduler* );
+extern void l7vs_sched_bind( struct l7vs_scheduler*, struct l7vs_service* );
+extern void l7vs_sched_unbind( struct l7vs_scheduler*, struct l7vs_service* );
+extern int l7vs_sched_sorry_check(struct l7vs_service*, int);
+extern struct l7vs_dest* l7vs_sched_sorry_dest(struct l7vs_service*, struct l7vs_conn*, int);
+
+#endif //L7VS_SCHED_H
--- /dev/null
+/*
+ * @file l7vs_service.h
+ * @bref service that brings function of l7vsd together.
+ * @bref It has sets of conn of ther service.
+ * @bref and sets of read servers.
+ * @bref and protocol module
+ * @bref and schedulers.
+ *
+ *
+ * L7VSD: Linux Virtual Server for Layer7 Load Balancing
+ * Copyright (C) 2005 NTT COMWARE Corporation.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ **********************************************************************/
+#ifndef L7VS_SERVICE_H
+#define L7VS_SERVICE_H
+
+#include <stdint.h>
+#include <glib.h>
+#include "l7vs_conn.h"
+#include "l7vs.h"
+
+struct l7vs_lsock;
+struct l7vs_scheduler;
+struct l7vs_protomod;
+struct l7vs_dest;
+struct l7vs_dest_arg;
+
+typedef uint32_t handle_t;
+
+#define TEMP_SERVICEHANDLE UINT32_MAX
+#define BPS_DEFAULT_INTERVAL 1000000ULL
+
+// virtual service definition datatype
+struct l7vs_service{
+ handle_t handle; //! l7vs_service_handle
+ struct l7vs_lsock* lsock; //! listen socket struct pointer
+ GList* dest_list; //! real server list
+// GList* conn_list;
+ GHashTable* conn_hash; //! connection table
+ struct l7vs_scheduler* scheduler; //! scheduler pointer
+ void* sched_data; //! scheduler data pointer
+ struct l7vs_protomod* pm; //! protocol module pointer
+
+ // ...and per-module match-data follows
+ char protomod_opt_string[L7VS_PROTOMOD_OPT_LEN]; //! protocol module option string
+ char protomod_key_string[L7VS_PROTOMOD_KEY_LEN]; //! protocol module key string
+ int reschedule; //! reschedule flag
+ int sorry_cc; //! sorry connection count limit
+ struct l7vs_dest* sorry_dest; //! sorry-server destination
+ int sorry_flag; //! sorry flag
+
+ unsigned long long qos_threshold_up; //! QoS threshold value from client to real server (UP Direction)
+ unsigned long long qos_threshold_down; //! QoS threshold value from real server to client (DOWN Direction)
+ unsigned long long throughput_to_server; //! Throughput to real server
+ unsigned long long throughput_to_client; //! Throughput to client
+ size_t pre_recvsize_from_client; //! data recive size from client (before 1 sec)
+ size_t cur_recvsize_from_client; //! data recive size from client (current)
+ unsigned long long pre_recvtime_from_client; //! Receiving time from client
+ size_t pre_recvsize_from_server; //! data recive size from real server (before 1 sec)
+ size_t cur_recvsize_from_server; //! data recive size from real server (current)
+ unsigned long long pre_recvtime_from_server; //! Receiving time from real server
+ int qos_up_flag; //! QoS to real server intervention flag (UP Direction)
+ int qos_down_flag; //! QoS to client intervention flag (DOWN Direction)
+};
+
+// virtual service definition, external representation.
+struct l7vs_service_arg{
+ size_t len; //! structure size
+ struct sockaddr_in addr; //! server address
+ uint8_t proto; //! server transport protocol
+ int persist; //! persistency
+ int backlog; //! listen(2) backlog length
+
+ char protomod[L7VS_MODNAME_LEN]; //! protocol module name
+ char schedmod[L7VS_MODNAME_LEN]; //! scheduler
+
+ // ... and protocol-module defined data follows
+ char protomod_opt_string[L7VS_PROTOMOD_OPT_LEN]; //! protocol module option string
+ char protomod_key_string[L7VS_PROTOMOD_KEY_LEN]; //! protocol module key string
+ int reschedule; //! reshcedule
+ int sorry_cc; //! sorry connection count limit
+ struct sockaddr_storage sorry_addr; //! sorry-server address
+ int sorry_flag; //! sorry flag
+
+ unsigned long long qos_threshold_up; //! QoS Threshold value from client to real server (UP Direction)
+ unsigned long long qos_threshold_down; //! QoS Threshold value from real server to client (DOWN Direction)
+ unsigned long long throughput_to_server; //! Throughput to real server
+ unsigned long long throughput_to_client; //! Throughput to client
+};
+
+// message of virtual service and protocol module definition, external representation.
+struct l7vs_service_arg_multi{
+ struct l7vs_service_arg srv_arg;
+ char protomod_arg[L7VS_PROTOMOD_MAX_SERVICE_ARG];
+};
+
+// replication data
+struct l7vs_service_repdata{
+ struct sockaddr_in addr; //! server address
+ uint8_t proto; //! server transport protocol
+
+ char protomod[L7VS_MODNAME_LEN]; //! protocol module name
+ char protomod_arg[L7VS_PROTOMOD_MAX_SERVICE_ARG];
+
+ int sorry_cc; //! sorry connection count limit
+ struct sockaddr_storage sorry_addr; //! sorry-server address
+ int sorry_flag; //! sorry flag
+
+ unsigned long long qos_threshold_up; //! QoS Threshold value from client to real server
+ unsigned long long qos_threshold_down; //! QoS Threshold value from real server to client
+};
+
+//
+// functions
+//
+extern struct l7vs_service* l7vs_service_create( struct l7vs_service_arg_multi*, int* );
+extern int l7vs_service_destroy( struct l7vs_service* );
+extern struct l7vs_service* l7vs_service_lookup( struct l7vs_service_arg_multi* );
+extern int l7vs_service_add_dest( struct l7vs_service*, struct l7vs_dest_arg* );
+extern int l7vs_service_remove_dest( struct l7vs_service*, struct l7vs_dest_arg* );
+extern int l7vs_service_schedule( struct l7vs_service*, struct l7vs_conn* );
+extern int l7vs_service_establish( struct l7vs_service*, struct l7vs_conn* );
+extern struct l7vs_dest* l7vs_service_lookup_dest( struct l7vs_service*, struct sockaddr_in* );
+extern int l7vs_service_list_service_arg( struct l7vs_service_arg_multi**, int* );
+extern int l7vs_service_list_dest_arg( struct l7vs_service*, struct l7vs_dest_arg** );
+extern int l7vs_service_register_conn( struct l7vs_service*, struct l7vs_conn* );
+extern int l7vs_service_remove_conn( struct l7vs_service*, struct l7vs_conn* );
+extern void l7vs_service_flush_all();
+extern int l7vs_service_set_QoS_Threshold( struct l7vs_service*, struct l7vs_service_arg_multi* );
+extern int l7vs_service_set_SorryServer_Values( struct l7vs_service*, struct l7vs_service_arg_multi* );
+extern unsigned int l7vs_service_get_VSnum();
+extern struct l7vs_service* l7vs_service_get_VSInfo_byNum( unsigned int );
+extern struct l7vs_service* l7vs_service_get_VSInfo_byHandler( const handle_t );
+extern void l7vs_service_update_throughput( struct l7vs_service*, unsigned long long );
+extern struct l7vs_service_arg_multi * l7vs_service_get_service_arg(struct l7vs_service *);
+
+/*!
+ * make l7vs_service struct dump string
+ * @param[out] retstr char pointer
+ * @param[in] srv l7vs_service struct pointer
+ */
+inline void
+l7vs_service_c_str( char* retstr, struct l7vs_service* srv )
+{
+ if (srv == NULL) {
+ snprintf(retstr, DEBUG_STR_LEN, "NULL");
+ }else{
+ //handle
+ sprintf( retstr, "%s handle = %d", retstr, srv->handle );
+ //lsock pointer
+ //scheduler pointer
+ //scheduler data pointer
+ //protocol module pointer
+ //protocol module option string
+ sprintf( retstr, "%s protomod option string = %s", retstr, srv->protomod_opt_string );
+ //protocol module key string
+ sprintf( retstr, "%s protomod key string = %s", retstr, srv->protomod_key_string );
+ //reschedule
+ sprintf( retstr, "%s reschedule = %d", retstr, srv->reschedule );
+ //sorry
+ sprintf( retstr, "%s sorry conn count limit = %d", retstr, srv->sorry_cc );
+ sprintf( retstr, "%s sorry flag = %d", retstr, srv->sorry_flag );
+ //QoS
+ sprintf( retstr, "%s QoS to server = %llu", retstr, srv->qos_threshold_up );
+ sprintf( retstr, "%s QoS to client = %llu", retstr, srv->qos_threshold_down );
+ //throughput
+ sprintf( retstr, "%s Throughput to server = %llu", retstr, srv->throughput_to_server );
+ sprintf( retstr, "%s Throughput to client = %llu", retstr, srv->throughput_to_client );
+ if( NULL != srv->sorry_dest ){
+ switch( srv->sorry_dest->addr.sin_family ){
+ case AF_UNIX:
+ sprintf( retstr, "%s socket family = AF_UNIX(PF_UNIX)", retstr );
+ break;
+ case AF_INET:
+ sprintf( retstr, "%s socket family = AF_INET(PF_INET)", retstr );
+ break;
+ default:
+ sprintf( retstr, "%s socket family = %d", retstr, srv->sorry_dest->addr.sin_family );
+ }
+ sprintf( retstr, "%s port no = %d", retstr, ntohs( srv->sorry_dest->addr.sin_port ) );
+ sprintf( retstr, "%s address = %s", retstr, inet_ntoa( srv->sorry_dest->addr.sin_addr ) );
+ }
+ //The last receiving time
+ sprintf( retstr, "%s recv time from client = %llu", retstr, srv->pre_recvtime_from_client );
+ sprintf( retstr, "%s recv time from server = %llu", retstr, srv->pre_recvtime_from_server );
+ //The last receiving size
+ sprintf( retstr, "%s pre recv size from client = %zu", retstr, srv->pre_recvsize_from_client );
+ sprintf( retstr, "%s pre recv size from server = %zu", retstr, srv->pre_recvsize_from_server );
+ sprintf( retstr, "%s recv size from client = %zu", retstr, srv->cur_recvsize_from_client );
+ sprintf( retstr, "%s recv size from server = %zu", retstr, srv->cur_recvsize_from_server );
+ }
+}
+
+/*!
+ * make l7vs_service_arg struct dump string
+ * @param[out] retstr char pointer
+ * @param[in] srv_arg l7vs_service_arg struct pointer
+ */
+inline void
+l7vs_service_arg_c_str( char* retstr, struct l7vs_service_arg* srv_arg )
+{
+ if (srv_arg == NULL) {
+ snprintf(retstr, DEBUG_STR_LEN, "NULL");
+ }else{
+ //data length
+ sprintf( retstr, "%s struct data length = %zu", retstr, srv_arg->len );
+ //service address dump
+ switch( srv_arg->addr.sin_family ){
+ case AF_UNIX:
+ sprintf( retstr, "%s socket family = AF_UNIX(PF_UNIX)", retstr );
+ break;
+ case AF_INET:
+ sprintf( retstr, "%s socket family = AF_INET(PF_INET)", retstr );
+ break;
+ default:
+ sprintf( retstr, "%s socket family = %d", retstr, srv_arg->addr.sin_family );
+ }
+ sprintf( retstr, "%s port no = %d", retstr, ntohs( srv_arg->addr.sin_port ) );
+ sprintf( retstr, "%s address = %s", retstr, inet_ntoa( srv_arg->addr.sin_addr ) );
+ //proto
+ switch( srv_arg->proto ){
+ case IPPROTO_TCP:
+ sprintf( retstr, "%s proto = IPPROTO_TCP", retstr );
+ break;
+ case IPPROTO_UDP:
+ sprintf( retstr, "%s proto = IPPROTO_UDP", retstr );
+ break;
+ default:
+ sprintf( retstr, "%s proto = %d", retstr, ntohs( srv_arg->proto ) );
+ }
+ //persist
+ sprintf( retstr, "%s proto = %d", retstr, srv_arg->proto );
+ //backlog
+ sprintf( retstr, "%s backlog = %d", retstr, srv_arg->backlog );
+ //protomod name
+ sprintf( retstr, "%s protomod name = %s", retstr, srv_arg->protomod );
+ //scheduler name
+ sprintf( retstr, "%s scheduler name = %s", retstr, srv_arg->schedmod );
+ //protomod option string
+ sprintf( retstr, "%s protomod option string = %s", retstr, srv_arg->protomod_opt_string );
+ //protomod key string
+ sprintf( retstr, "%s protomod key string = %s", retstr, srv_arg->protomod_key_string );
+ //reschedule
+ sprintf( retstr, "%s backlog = %d", retstr, srv_arg->reschedule );
+ //sorry_cc
+ sprintf( retstr, "%s sorry conn count limit = %d", retstr, srv_arg->sorry_cc );
+ //sorry address dump
+ struct sockaddr_in* sorryaddr = (struct sockaddr_in*)&(srv_arg->sorry_addr);
+ if( NULL != sorryaddr ){
+ switch( sorryaddr->sin_family ){
+ case AF_UNIX:
+ sprintf( retstr, "%s sorry server socket family = AF_UNIX(PF_UNIX)", retstr );
+ break;
+ case AF_INET:
+ sprintf( retstr, "%s sorry server socket family = AF_INET(PF_INET)", retstr );
+ break;
+ default:
+ sprintf( retstr, "%s sorry server socket family = %d", retstr, sorryaddr->sin_family );
+ }
+ sprintf( retstr, "%s sorry server port no = %d", retstr, ntohs( sorryaddr->sin_port ) );
+ sprintf( retstr, "%s sorry server address = %s", retstr, inet_ntoa( sorryaddr->sin_addr ) );
+ }
+ //sorry_flag
+ sprintf( retstr, "%s sorry flag = %d", retstr, srv_arg->sorry_flag );
+ //QoS setting value
+ sprintf( retstr, "%s QoS control to server = %llu", retstr, srv_arg->qos_threshold_up );
+ sprintf( retstr, "%s QoS control to client = %llu", retstr, srv_arg->qos_threshold_down );
+ //throughput
+ sprintf( retstr, "%s Throughput to server = %llu", retstr, srv_arg->throughput_to_server );
+ sprintf( retstr, "%s Throughput to client = %llu", retstr, srv_arg->throughput_to_client );
+ }
+}
+
+/*!
+ * make l7vs_service_arg_multi struct dump string
+ * @param[out] retstr char pointer
+ * @param[in] srv_arg_multi l7vs_service_repdata struct pointer
+ */
+inline void
+l7vs_service_arg_multi_c_str( char* retstr, struct l7vs_service_arg_multi* srv_arg_multi )
+{
+ if (srv_arg_multi == NULL) {
+ snprintf(retstr, DEBUG_STR_LEN, "NULL");
+ }else{
+ //service_arg dump
+ l7vs_service_arg_c_str( retstr, &srv_arg_multi->srv_arg );
+ //protomodarg
+ sprintf( retstr, "%s protomod args = %s", retstr, srv_arg_multi->protomod_arg );
+ }
+}
+
+/*!
+ * make l7vs_service_repdata struct dump string
+ * @param[out] retstr char pointer
+ * @param[in] srv_repdata l7vs_service_repdata struct pointer
+ */
+inline void
+l7vs_service_repdata_c_str( char* retstr, struct l7vs_service_repdata* srv_repdata )
+{
+ if (srv_repdata == NULL) {
+ snprintf(retstr, DEBUG_STR_LEN, "NULL");
+ }else{
+ //addr dump
+ switch( srv_repdata->addr.sin_family ){
+ case AF_UNIX:
+ sprintf( retstr, "%s socket family = AF_UNIX(PF_UNIX)", retstr );
+ break;
+ case AF_INET:
+ sprintf( retstr, "%s socket family = AF_INET(PF_INET)", retstr );
+ break;
+ default:
+ sprintf( retstr, "%s socket family = %d", retstr, srv_repdata->addr.sin_family );
+ }
+ sprintf( retstr, "%s port no = %d", retstr, ntohs( srv_repdata->addr.sin_port ) );
+ sprintf( retstr, "%s address = %s", retstr, inet_ntoa( srv_repdata->addr.sin_addr ) );
+ //proto
+ switch( srv_repdata->proto ){
+ case IPPROTO_TCP:
+ sprintf( retstr, "%s proto = IPPROTO_TCP", retstr );
+ break;
+ case IPPROTO_UDP:
+ sprintf( retstr, "%s proto = IPPROTO_UDP", retstr );
+ break;
+ default:
+ sprintf( retstr, "%s proto = %d", retstr, ntohs( srv_repdata->proto ) );
+ }
+ //protocol module name
+ sprintf( retstr, "%s protomod name = %s", retstr, srv_repdata->protomod );
+ //protomod argument
+ sprintf( retstr, "%s protomod args = %s", retstr, srv_repdata->protomod_arg );
+ //number of connection limit
+ sprintf( retstr, "%s sorry conn count limit = %d", retstr, srv_repdata->sorry_cc );
+ //sorry addr dump
+ struct sockaddr_in* sorryaddr = (struct sockaddr_in*)&(srv_repdata->sorry_addr);
+ switch( sorryaddr->sin_family ){
+ case AF_UNIX:
+ sprintf( retstr, "%s socket family = AF_UNIX(PF_UNIX)", retstr );
+ break;
+ case AF_INET:
+ sprintf( retstr, "%s socket family = AF_INET(PF_INET)", retstr );
+ break;
+ default:
+ sprintf( retstr, "%s socket family = %d", retstr, sorryaddr->sin_family );
+ }
+ sprintf( retstr, "%s port no = %d", retstr, ntohs( sorryaddr->sin_port ) );
+ sprintf( retstr, "%s address = %s", retstr, inet_ntoa( sorryaddr->sin_addr ) );
+ //sorry flag
+ sprintf( retstr, "%s sorry flag = %d", retstr, srv_repdata->sorry_flag );
+ //QoS setting value
+ sprintf( retstr, "%s QoS control to server = %llu", retstr, srv_repdata->qos_threshold_up );
+ sprintf( retstr, "%s QoS control to client = %llu", retstr, srv_repdata->qos_threshold_down );
+ }
+}
+
+#endif //L7VS_SERVICE_H
--- /dev/null
+#ifndef __L7VS_SNMPBRIDGE_H__
+#define __L7VS_SNMPBRIDGE_H__
+
+#include <stdint.h>
+#include "l7vs.h"
+#include "l7vs_iom.h"
+#include "tag_trapid.h"
+#include "logger_wrapper.h"
+
+
+struct bridge_mibdata{
+
+};
+
+//初期化処理
+extern int l7vs_snmpbridge_initialize();
+//終了処理
+extern void l7vs_snmpbridge_finalize();
+//TRAP送信要求
+extern int l7vs_snmpbridge_send_trap( TRAPID_TAG trapid, char* message );
+//パラメータファイル再読込み指示
+extern void l7vs_snmpbridge_reload_config();
+//ログレベル設定指示
+extern int l7vs_snmpbridge_change_loglevel( LOG_CATEGORY_TAG snmp_log_category, LOG_LEVEL_TAG loglevel );
+//ログレベル設定指示(カテゴリ全指定)
+extern int l7vs_snmpbridge_change_loglevel_allcategory( LOG_LEVEL_TAG loglevel );
+//接続状態取得
+extern int l7vs_snmpbridge_get_connectionstate();
+//ログレベル取得
+extern LOG_LEVEL_TAG l7vs_snmpbridge_get_loglevel( LOG_CATEGORY_TAG snmp_log_category );
+//コールバック
+extern int l7vs_snmpbridge_callback( l7vs_iomux* iom );
+
+#endif //__L7VS_SNMPBRIDGE_H__
--- /dev/null
+/*
+ * @file l7vsadm.h
+ * @brief l7vsadm header file.
+ *
+ * L7VSADM: Virtual Server Administration Program for L7vsd
+ * Copyright (C) 2005 NTT COMWARE Corporation.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ **********************************************************************/
+
+#ifndef __L7VSADM_H__
+#define __L7VSADM_H__
+
+#include <glib.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netdb.h>
+
+#include "l7vs_module.h"
+#include "l7vs_service.h"
+
+#include "logger_wrapper.h"
+#include "parameter_wrapper.h"
+
+#define L7VSADM_NAME "l7vsadm" //!< L7vsadm name string
+#define L7VSADM_COMPONENT PARAM_COMP_L7VSADM //!< L7vsadm component
+#define L7VSADM_DEFAULT_LIST_VS_BUFSIZE (4096) //!< Default vs buffer size
+#define L7VSADM_DEFAULT_LIST_RS_RSNUM (16) //!< Default number of rs
+#define L7VSADM_DEFAULT_BACKLOG (127) //!< Default backlog size
+#define L7VSADM_DEFAULT_SCHEDULER "rr" //!< Default scheduler name
+#define L7VSADM_DEFAULT_WAIT_INTERVAL (1) //!< Default wait interval
+#define L7VSADM_DEFAULT_WAIT_COUNT (10) //!< Default wait count
+#define L7VSADM_MAX_WAIT (60) //!< Max wait value
+#define L7VSADM_INIT_ENDPOINT_STR "0.0.0.0:0" //!< Endpoint string for initialize
+
+#define L7VSADM_RECV_FAILED (-1) //!< Receive faild
+#define L7VSADM_RECV_TOO_LARGE (-2) //!< Receive size too large
+
+//! L7vsadm command code.
+enum L7VSADM_COMMAND_CODE_TAG {
+ CMD_LIST, //!< List command(-l)
+ CMD_LIST_VERBOSE, //!< Verbose list command(-V)
+ CMD_LIST_KEY, //!< Key list command(-K)
+ CMD_ADD_VS, //!< Add VirtualService command(-A)
+ CMD_DEL_VS, //!< Delete VirtualService command(-D)
+ CMD_EDIT_VS, //!< Edit VirtualService command(-E)
+ CMD_FLUSH_VS, //!< Flush VirtualService command(-C)
+ CMD_ADD_RS, //!< Add RealServer command(-a)
+ CMD_DEL_RS, //!< Delete RealServer command(-d)
+ CMD_EDIT_RS, //!< Edit RealServer command(-e)
+ CMD_REPLICATION, //!< Replication command(-R)
+ CMD_LOG, //!< Logger command(-L)
+ CMD_SNMP, //!< SNMPAgent command(-S)
+ CMD_PARAMETER, //!< Parameter command(-P)
+ CMD_HELP, //!< Help command(-h)
+ CMD_NONE //!< No command
+};
+
+//! L7vsadm option code.
+enum L7VSADM_OPTION_CODE_TAG {
+ OPT_TCP_SERVICE, //!< VirtualService option(-t)
+ OPT_PROTO_MODULE, //!< ProtocolModule option(-m)
+ OPT_SCHEDULER, //!< ScheduleModule option(-s)
+ OPT_UPPER, //!< Sorry max connection option(-u)
+ OPT_BYPASS, //!< SorryServer option(-b)
+ OPT_FLAG, //!< Sorry flag option(-f)
+ OPT_QOS_UP, //!< QoS-UP option(-Q)
+ OPT_QOS_DOWN, //!< QoS-DOWN option(-q)
+ OPT_REAL_SERVER, //!< RealServer option(-r)
+ OPT_WEIGHT, //!< RealServer weight option(-w)
+ OPT_SWITCH, //!< Replication switching option(-s)
+ OPT_FORCE, //!< Force Replication option(-f)
+ OPT_DUMP, //!< Replication data dump option(-d)
+ OPT_CATEGORY, //!< Log-Category option(-c)
+ OPT_LEVEL, //!< Log-Level option(-l)
+ OPT_RELOAD, //!< Reload Parameter option(-r)
+ OPT_NUMERIC, //!< Numeric list option(-n)
+ OPT_NONE //!< No option
+};
+
+//! L7vsadm parameter code.
+enum L7VSADM_PARAMETER_TAG {
+ PARA_CMD_INTERVAL, //!< Command wait interval parameter
+ PARA_CMD_COUNT, //!< Command wait count parameter
+ PARA_CON_INTERVAL, //!< Connect wait interval parameter
+ PARA_CON_COUNT, //!< Connect wait count parameter
+ PARA_NONE //!< No parameter
+};
+
+//! L7vsadm parsed option data.
+struct l7vsadm_option_data {
+ enum L7VSADM_COMMAND_CODE_TAG command_code; //!< Command code
+ int (*parse_func)(int argc, char *argv[]); //!< Parse function pointer
+ int (*operate_func)(void); //!< Operate function pointer
+ struct sockaddr_in vs_addr; //!< VirtualService endpoint
+ struct sockaddr_in rs_addr; //!< RealServer endpoint
+ char protomod_name[L7VS_MODNAME_LEN]; //!< ProtocolModule name
+ char schedmod_name[L7VS_MODNAME_LEN]; //!< ScheduleModule name
+ struct l7vs_protomod *protomod; //!< ProtocolModule data
+ int persist; //!< Persist
+ int backlog; //!< Backlog
+ int weight; //!< RealServer weight
+ int isnumeric; //!< Numeric list
+ GArray *protomod_options; //!< ProtocolModule option
+ struct l7vs_service_arg_multi protomod_sarg; //!< Service_arg_multi
+ int max_connection; //!< Sorry max connection
+ struct sockaddr_storage sorry_addr; //!< SorryServer endpoint
+ int sorry_flag; //!< Sorry flag
+ unsigned long long qos_threshold_up; //!< QoS threshold to real server (UP Direction)
+ unsigned long long qos_threshold_down; //!< QoS threshold to client (DOWN Direction)
+ enum L7VSADM_OPTION_CODE_TAG control_code; //!< Control code(Sub command)
+ enum LOG_CATEGORY_TAG log_category; //!< Log-Category
+ enum LOG_LEVEL_TAG log_level; //!< Log-Level
+ int category_all_flag; //!< All Log-Category flag
+ int replication_start_flag; //!< Start Replication flag
+ enum PARAMETER_COMPONENT_TAG reload_param; //!< Parameter Reload Componet
+};
+
+//! L7vsadm command code list.
+struct l7vsadm_command_list {
+ enum L7VSADM_COMMAND_CODE_TAG command_code; //!< Command code
+ const char *command_name; //!< Command name
+ const char *command_name_long; //!< Command long name
+ int (*parse_func)(int argc, char *argv[]); //!< Parse function pointer
+ int (*operate_func)(void); //!< Operate function pointer
+};
+
+//! L7vsadm option code list.
+struct l7vsadm_option_list {
+ enum L7VSADM_OPTION_CODE_TAG option_code; //!< Option code
+ const char *option_name; //!< Option name
+ const char *option_name_long; //!< Option long name
+ int check_flag; //!< Conflict check flag
+};
+
+//! L7vsadm parameter code list.
+struct l7vsadm_parameter_list {
+ enum L7VSADM_PARAMETER_TAG parameter_code; //!< Parameter code
+ const char *parameter_name; //!< Parameter name
+};
+
+//! L7vsadm log-category code list.
+struct l7vsadm_category_name_list {
+ enum LOG_CATEGORY_TAG category_code; //!< Log-Category code
+ const char *category_name; //!< Log-Category name
+ const char *category_name_short; //!< Log-Category short name
+};
+
+//! L7vsadm log-level code list.
+struct l7vsadm_level_name_list {
+ enum LOG_LEVEL_TAG level_code; //!< Log-Level code
+ const char *level_name; //!< Log-Level name
+};
+
+//! L7vsadm component code list.
+struct l7vsadm_component_name_list {
+ enum PARAMETER_COMPONENT_TAG component_code; //!< Component code
+ const char *component_name; //!< Component name
+};
+
+//! L7vsadm io vector data.
+struct l7vsadm_iov_data {
+ struct iovec req_iov[2]; //!< Request io-vector
+ int req_cnt; //!< Request io-vector count
+ struct iovec rsp_iov[2]; //!< Response io-vector
+ int rsp_cnt; //!< Response io-vector count
+};
+
+//! L7vsadm signal list.
+struct l7vsadm_sig_list {
+ int sig; //!< Signal number
+ void (*sig_func)(int sig); //!< Signal hander pointer
+};
+
+//! Debug functions.
+extern void endpoint_c_str(char* ep_str, void *addr);
+extern void argc_argv_c_str(char* arg_str, int argc, char *argv[]);
+extern void l7vsadm_option_data_c_str(char* parse_str);
+
+#endif //__L7VSADM_H__
--- /dev/null
+AUTOMAKE_OPTIONS = foreign
+
+install:
+ $(INSTALL) -m 755 -D ./l7vsd /etc/init.d/l7vsd
--- /dev/null
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = init.d
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+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)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+GLIB_CFLAGS = @GLIB_CFLAGS@
+GLIB_GENMARSHAL = @GLIB_GENMARSHAL@
+GLIB_LIBS = @GLIB_LIBS@
+GLIB_MKENUMS = @GLIB_MKENUMS@
+GOBJECT_QUERY = @GOBJECT_QUERY@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MANDIR = @MANDIR@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PKG_CONFIG = @PKG_CONFIG@
+RANLIB = @RANLIB@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+ac_ct_RANLIB = @ac_ct_RANLIB@
+ac_ct_STRIP = @ac_ct_STRIP@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+l7vs_maxvs = @l7vs_maxvs@
+l7vs_moddir = @l7vs_moddir@
+l7vsadm_sockdir = @l7vsadm_sockdir@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+snmpagent_libs = @snmpagent_libs@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+AUTOMAKE_OPTIONS = foreign
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign init.d/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign init.d/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+distclean-libtool:
+ -rm -f libtool
+uninstall-info-am:
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+ list='$(DISTFILES)'; for file in $$list; do \
+ case $$file in \
+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+ esac; \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ dir="/$$dir"; \
+ $(mkdir_p) "$(distdir)$$dir"; \
+ else \
+ dir=''; \
+ fi; \
+ if test -d $$d/$$file; then \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile
+installdirs:
+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-libtool mostlyclean-am
+
+distclean: distclean-am
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic distclean-libtool
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-exec-am:
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-info-am
+
+.PHONY: all all-am check check-am clean clean-generic clean-libtool \
+ distclean distclean-generic distclean-libtool distdir dvi \
+ dvi-am html html-am info info-am install install-am \
+ install-data install-data-am install-exec install-exec-am \
+ install-info install-info-am install-man install-strip \
+ installcheck installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-generic \
+ mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am \
+ uninstall-info-am
+
+
+install:
+ $(INSTALL) -m 755 -D ./l7vsd /etc/init.d/l7vsd
+# 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:
--- /dev/null
+#!/bin/sh
+# Start/Stop script for l7vsd
+#
+# chkconfig: 2345 95 34
+# description: Start and stop l7vsd
+#
+# processname: l7vsd
+#
+# Author: Shinya TAKEBAYASHI
+# Released: January 2008
+# Licence: GNU General Public Licence
+
+#L7VSD_OPTIONS="" # run as non-blocking mode
+L7VSD_OPTIONS="-b" # run as blocking mode
+
+PROG="l7vsd"
+DAEMON="/usr/sbin/l7vsd"
+SOCKFILE="/var/run/l7vs/l7vs"
+PIDFILE="/var/run/l7vsd.pid"
+
+start() {
+ if [ -e $PIDFILE ]; then
+ PROCS=`ps ax | grep $DAEMON | grep -v grep | wc -l`
+ if [ $PROCS -ne 0 ]; then
+ echo "$PROG is running."
+ RETVAL=-1
+ return
+ fi
+ cleanup
+ fi
+
+ ulimit -n 65536
+ echo -n "Starting $PROG: "
+ `$DAEMON $L7VSD_OPTIONS`
+ RETVAL=$?
+
+ if [ $RETVAL -ne 0 ]; then
+ echo "error occured."
+ echo "$PROG was not started."
+ else
+ echo "done."
+ pidof $PROG > $PIDFILE
+ fi
+
+ return $RETVAL
+}
+
+stop() {
+ PID=`pidof l7vsd`
+ if [ -z $PID ]; then
+ echo "$PROG is not running."
+ RETVAL=-1
+ cleanup
+ return
+ fi
+
+ echo -n "Stopping $PROG: "
+ kill $PID
+ RETVAL=$?
+
+ if [ $RETVAL -eq 0 ]; then
+ echo "done."
+ cleanup
+ fi
+
+ return $RETVAL
+}
+
+status() {
+ if [ ! -e $PIDFILE ]; then
+ echo "$PROG is not running."
+ RETVAL=-1
+ else
+ echo -n "$PROG running with pid: "
+ cat $PIDFILE
+ RETVAL=$?
+ fi
+ return $RETVAL
+}
+
+cleanup() {
+ rm -rf $PIDFILE
+ rm -rf $SOCKFILE
+}
+
+
+# Prefer for Running script
+if [ ! -x $DAEMON ]; then
+ echo "$DAEMON does not exist!"
+ exit -1
+fi
+
+# Privilege check
+
+if [ `id -u` -ne '0' ]; then
+ echo "This script must run as root."
+ exit -1
+fi
+
+case "$1" in
+ start)
+ start
+ ;;
+
+ stop)
+ stop
+ ;;
+
+ status)
+ status
+ ;;
+
+ restart)
+ stop
+ sleep 1
+ start
+ ;;
+
+ condrestart)
+ stop
+ sleep 1
+ start
+ ;;
+
+ *)
+ echo "Usage: $0 {start|stop|restart|condrestart|status}"
+ RETVAL=-1
+
+esac
+
+exit $RETVAL
--- /dev/null
+#!/bin/sh
+# install - install a program, script, or datafile
+
+scriptversion=2006-10-14.15
+
+# This originates from X11R5 (mit/util/scripts/install.sh), which was
+# later released in X11R6 (xc/config/util/install.sh) with the
+# following copyright and license.
+#
+# Copyright (C) 1994 X Consortium
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to
+# deal in the Software without restriction, including without limitation the
+# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+# sell copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
+# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#
+# Except as contained in this notice, the name of the X Consortium shall not
+# be used in advertising or otherwise to promote the sale, use or other deal-
+# ings in this Software without prior written authorization from the X Consor-
+# tium.
+#
+#
+# FSF changes to this file are in the public domain.
+#
+# Calling this script install-sh is preferred over install.sh, to prevent
+# `make' implicit rules from creating a file called install from it
+# when there is no Makefile.
+#
+# This script is compatible with the BSD install script, but was written
+# from scratch.
+
+nl='
+'
+IFS=" "" $nl"
+
+# set DOITPROG to echo to test this script
+
+# Don't use :- since 4.3BSD and earlier shells don't like it.
+doit="${DOITPROG-}"
+if test -z "$doit"; then
+ doit_exec=exec
+else
+ doit_exec=$doit
+fi
+
+# Put in absolute file names if you don't have them in your path;
+# or use environment vars.
+
+mvprog="${MVPROG-mv}"
+cpprog="${CPPROG-cp}"
+chmodprog="${CHMODPROG-chmod}"
+chownprog="${CHOWNPROG-chown}"
+chgrpprog="${CHGRPPROG-chgrp}"
+stripprog="${STRIPPROG-strip}"
+rmprog="${RMPROG-rm}"
+mkdirprog="${MKDIRPROG-mkdir}"
+
+posix_glob=
+posix_mkdir=
+
+# Desired mode of installed file.
+mode=0755
+
+chmodcmd=$chmodprog
+chowncmd=
+chgrpcmd=
+stripcmd=
+rmcmd="$rmprog -f"
+mvcmd="$mvprog"
+src=
+dst=
+dir_arg=
+dstarg=
+no_target_directory=
+
+usage="Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
+ or: $0 [OPTION]... SRCFILES... DIRECTORY
+ or: $0 [OPTION]... -t DIRECTORY SRCFILES...
+ or: $0 [OPTION]... -d DIRECTORIES...
+
+In the 1st form, copy SRCFILE to DSTFILE.
+In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
+In the 4th, create DIRECTORIES.
+
+Options:
+-c (ignored)
+-d create directories instead of installing files.
+-g GROUP $chgrpprog installed files to GROUP.
+-m MODE $chmodprog installed files to MODE.
+-o USER $chownprog installed files to USER.
+-s $stripprog installed files.
+-t DIRECTORY install into DIRECTORY.
+-T report an error if DSTFILE is a directory.
+--help display this help and exit.
+--version display version info and exit.
+
+Environment variables override the default commands:
+ CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG
+"
+
+while test $# -ne 0; do
+ case $1 in
+ -c) shift
+ continue;;
+
+ -d) dir_arg=true
+ shift
+ continue;;
+
+ -g) chgrpcmd="$chgrpprog $2"
+ shift
+ shift
+ continue;;
+
+ --help) echo "$usage"; exit $?;;
+
+ -m) mode=$2
+ shift
+ shift
+ case $mode in
+ *' '* | *' '* | *'
+'* | *'*'* | *'?'* | *'['*)
+ echo "$0: invalid mode: $mode" >&2
+ exit 1;;
+ esac
+ continue;;
+
+ -o) chowncmd="$chownprog $2"
+ shift
+ shift
+ continue;;
+
+ -s) stripcmd=$stripprog
+ shift
+ continue;;
+
+ -t) dstarg=$2
+ shift
+ shift
+ continue;;
+
+ -T) no_target_directory=true
+ shift
+ continue;;
+
+ --version) echo "$0 $scriptversion"; exit $?;;
+
+ --) shift
+ break;;
+
+ -*) echo "$0: invalid option: $1" >&2
+ exit 1;;
+
+ *) break;;
+ esac
+done
+
+if test $# -ne 0 && test -z "$dir_arg$dstarg"; then
+ # When -d is used, all remaining arguments are directories to create.
+ # When -t is used, the destination is already specified.
+ # Otherwise, the last argument is the destination. Remove it from $@.
+ for arg
+ do
+ if test -n "$dstarg"; then
+ # $@ is not empty: it contains at least $arg.
+ set fnord "$@" "$dstarg"
+ shift # fnord
+ fi
+ shift # arg
+ dstarg=$arg
+ done
+fi
+
+if test $# -eq 0; then
+ if test -z "$dir_arg"; then
+ echo "$0: no input file specified." >&2
+ exit 1
+ fi
+ # It's OK to call `install-sh -d' without argument.
+ # This can happen when creating conditional directories.
+ exit 0
+fi
+
+if test -z "$dir_arg"; then
+ trap '(exit $?); exit' 1 2 13 15
+
+ # Set umask so as not to create temps with too-generous modes.
+ # However, 'strip' requires both read and write access to temps.
+ case $mode in
+ # Optimize common cases.
+ *644) cp_umask=133;;
+ *755) cp_umask=22;;
+
+ *[0-7])
+ if test -z "$stripcmd"; then
+ u_plus_rw=
+ else
+ u_plus_rw='% 200'
+ fi
+ cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
+ *)
+ if test -z "$stripcmd"; then
+ u_plus_rw=
+ else
+ u_plus_rw=,u+rw
+ fi
+ cp_umask=$mode$u_plus_rw;;
+ esac
+fi
+
+for src
+do
+ # Protect names starting with `-'.
+ case $src in
+ -*) src=./$src ;;
+ esac
+
+ if test -n "$dir_arg"; then
+ dst=$src
+ dstdir=$dst
+ test -d "$dstdir"
+ dstdir_status=$?
+ else
+
+ # Waiting for this to be detected by the "$cpprog $src $dsttmp" command
+ # might cause directories to be created, which would be especially bad
+ # if $src (and thus $dsttmp) contains '*'.
+ if test ! -f "$src" && test ! -d "$src"; then
+ echo "$0: $src does not exist." >&2
+ exit 1
+ fi
+
+ if test -z "$dstarg"; then
+ echo "$0: no destination specified." >&2
+ exit 1
+ fi
+
+ dst=$dstarg
+ # Protect names starting with `-'.
+ case $dst in
+ -*) dst=./$dst ;;
+ esac
+
+ # If destination is a directory, append the input filename; won't work
+ # if double slashes aren't ignored.
+ if test -d "$dst"; then
+ if test -n "$no_target_directory"; then
+ echo "$0: $dstarg: Is a directory" >&2
+ exit 1
+ fi
+ dstdir=$dst
+ dst=$dstdir/`basename "$src"`
+ dstdir_status=0
+ else
+ # Prefer dirname, but fall back on a substitute if dirname fails.
+ dstdir=`
+ (dirname "$dst") 2>/dev/null ||
+ expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$dst" : 'X\(//\)[^/]' \| \
+ X"$dst" : 'X\(//\)$' \| \
+ X"$dst" : 'X\(/\)' \| . 2>/dev/null ||
+ echo X"$dst" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'
+ `
+
+ test -d "$dstdir"
+ dstdir_status=$?
+ fi
+ fi
+
+ obsolete_mkdir_used=false
+
+ if test $dstdir_status != 0; then
+ case $posix_mkdir in
+ '')
+ # Create intermediate dirs using mode 755 as modified by the umask.
+ # This is like FreeBSD 'install' as of 1997-10-28.
+ umask=`umask`
+ case $stripcmd.$umask in
+ # Optimize common cases.
+ *[2367][2367]) mkdir_umask=$umask;;
+ .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;
+
+ *[0-7])
+ mkdir_umask=`expr $umask + 22 \
+ - $umask % 100 % 40 + $umask % 20 \
+ - $umask % 10 % 4 + $umask % 2
+ `;;
+ *) mkdir_umask=$umask,go-w;;
+ esac
+
+ # With -d, create the new directory with the user-specified mode.
+ # Otherwise, rely on $mkdir_umask.
+ if test -n "$dir_arg"; then
+ mkdir_mode=-m$mode
+ else
+ mkdir_mode=
+ fi
+
+ posix_mkdir=false
+ case $umask in
+ *[123567][0-7][0-7])
+ # POSIX mkdir -p sets u+wx bits regardless of umask, which
+ # is incompatible with FreeBSD 'install' when (umask & 300) != 0.
+ ;;
+ *)
+ tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
+ trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0
+
+ if (umask $mkdir_umask &&
+ exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1
+ then
+ if test -z "$dir_arg" || {
+ # Check for POSIX incompatibilities with -m.
+ # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
+ # other-writeable bit of parent directory when it shouldn't.
+ # FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
+ ls_ld_tmpdir=`ls -ld "$tmpdir"`
+ case $ls_ld_tmpdir in
+ d????-?r-*) different_mode=700;;
+ d????-?--*) different_mode=755;;
+ *) false;;
+ esac &&
+ $mkdirprog -m$different_mode -p -- "$tmpdir" && {
+ ls_ld_tmpdir_1=`ls -ld "$tmpdir"`
+ test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
+ }
+ }
+ then posix_mkdir=:
+ fi
+ rmdir "$tmpdir/d" "$tmpdir"
+ else
+ # Remove any dirs left behind by ancient mkdir implementations.
+ rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null
+ fi
+ trap '' 0;;
+ esac;;
+ esac
+
+ if
+ $posix_mkdir && (
+ umask $mkdir_umask &&
+ $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
+ )
+ then :
+ else
+
+ # The umask is ridiculous, or mkdir does not conform to POSIX,
+ # or it failed possibly due to a race condition. Create the
+ # directory the slow way, step by step, checking for races as we go.
+
+ case $dstdir in
+ /*) prefix=/ ;;
+ -*) prefix=./ ;;
+ *) prefix= ;;
+ esac
+
+ case $posix_glob in
+ '')
+ if (set -f) 2>/dev/null; then
+ posix_glob=true
+ else
+ posix_glob=false
+ fi ;;
+ esac
+
+ oIFS=$IFS
+ IFS=/
+ $posix_glob && set -f
+ set fnord $dstdir
+ shift
+ $posix_glob && set +f
+ IFS=$oIFS
+
+ prefixes=
+
+ for d
+ do
+ test -z "$d" && continue
+
+ prefix=$prefix$d
+ if test -d "$prefix"; then
+ prefixes=
+ else
+ if $posix_mkdir; then
+ (umask=$mkdir_umask &&
+ $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
+ # Don't fail if two instances are running concurrently.
+ test -d "$prefix" || exit 1
+ else
+ case $prefix in
+ *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
+ *) qprefix=$prefix;;
+ esac
+ prefixes="$prefixes '$qprefix'"
+ fi
+ fi
+ prefix=$prefix/
+ done
+
+ if test -n "$prefixes"; then
+ # Don't fail if two instances are running concurrently.
+ (umask $mkdir_umask &&
+ eval "\$doit_exec \$mkdirprog $prefixes") ||
+ test -d "$dstdir" || exit 1
+ obsolete_mkdir_used=true
+ fi
+ fi
+ fi
+
+ if test -n "$dir_arg"; then
+ { test -z "$chowncmd" || $doit $chowncmd "$dst"; } &&
+ { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } &&
+ { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false ||
+ test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1
+ else
+
+ # Make a couple of temp file names in the proper directory.
+ dsttmp=$dstdir/_inst.$$_
+ rmtmp=$dstdir/_rm.$$_
+
+ # Trap to clean up those temp files at exit.
+ trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
+
+ # Copy the file name to the temp name.
+ (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") &&
+
+ # and set any options; do chmod last to preserve setuid bits.
+ #
+ # If any of these fail, we abort the whole thing. If we want to
+ # ignore errors from any of these, just make sure not to ignore
+ # errors from the above "$doit $cpprog $src $dsttmp" command.
+ #
+ { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \
+ && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \
+ && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \
+ && { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
+
+ # Now rename the file to the real destination.
+ { $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null \
+ || {
+ # The rename failed, perhaps because mv can't rename something else
+ # to itself, or perhaps because mv is so ancient that it does not
+ # support -f.
+
+ # Now remove or move aside any old file at destination location.
+ # We try this two ways since rm can't unlink itself on some
+ # systems and the destination file might be busy for other
+ # reasons. In this case, the final cleanup might fail but the new
+ # file should still install successfully.
+ {
+ if test -f "$dst"; then
+ $doit $rmcmd -f "$dst" 2>/dev/null \
+ || { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null \
+ && { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }; }\
+ || {
+ echo "$0: cannot unlink or rename $dst" >&2
+ (exit 1); exit 1
+ }
+ else
+ :
+ fi
+ } &&
+
+ # Now rename the file to the real destination.
+ $doit $mvcmd "$dsttmp" "$dst"
+ }
+ } || exit 1
+
+ trap '' 0
+ fi
+done
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-end: "$"
+# End:
--- /dev/null
+#AUTOMAKE_OPTIONS = foreign
+SBINDIR = @sbindir@
+L7DIRECTORD_CONFDIR = /etc/ha.d/conf
+RCDIR = /etc/init.d
+
+install:
+ $(INSTALL) -m 644 -D ./conf/l7directord.cf.sample $(L7DIRECTORD_CONFDIR)/l7directord.cf.sample
+ $(INSTALL) -m 755 -D ./l7directord $(SBINDIR)/l7directord
+ $(INSTALL) -m 755 -D ./init.d/l7directord $(RCDIR)/l7directord
+
--- /dev/null
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = l7directord
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+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)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+GLIB_CFLAGS = @GLIB_CFLAGS@
+GLIB_GENMARSHAL = @GLIB_GENMARSHAL@
+GLIB_LIBS = @GLIB_LIBS@
+GLIB_MKENUMS = @GLIB_MKENUMS@
+GOBJECT_QUERY = @GOBJECT_QUERY@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MANDIR = @MANDIR@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PKG_CONFIG = @PKG_CONFIG@
+RANLIB = @RANLIB@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+ac_ct_RANLIB = @ac_ct_RANLIB@
+ac_ct_STRIP = @ac_ct_STRIP@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+l7vs_maxvs = @l7vs_maxvs@
+l7vs_moddir = @l7vs_moddir@
+l7vsadm_sockdir = @l7vsadm_sockdir@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+snmpagent_libs = @snmpagent_libs@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+
+#AUTOMAKE_OPTIONS = foreign
+SBINDIR = @sbindir@
+L7DIRECTORD_CONFDIR = /etc/ha.d/conf
+RCDIR = /etc/init.d
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu l7directord/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --gnu l7directord/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+distclean-libtool:
+ -rm -f libtool
+uninstall-info-am:
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+ list='$(DISTFILES)'; for file in $$list; do \
+ case $$file in \
+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+ esac; \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ dir="/$$dir"; \
+ $(mkdir_p) "$(distdir)$$dir"; \
+ else \
+ dir=''; \
+ fi; \
+ if test -d $$d/$$file; then \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile
+installdirs:
+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-libtool mostlyclean-am
+
+distclean: distclean-am
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic distclean-libtool
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-exec-am:
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-info-am
+
+.PHONY: all all-am check check-am clean clean-generic clean-libtool \
+ distclean distclean-generic distclean-libtool distdir dvi \
+ dvi-am html html-am info info-am install install-am \
+ install-data install-data-am install-exec install-exec-am \
+ install-info install-info-am install-man install-strip \
+ installcheck installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-generic \
+ mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am \
+ uninstall-info-am
+
+
+install:
+ $(INSTALL) -m 644 -D ./conf/l7directord.cf.sample $(L7DIRECTORD_CONFDIR)/l7directord.cf.sample
+ $(INSTALL) -m 755 -D ./l7directord $(SBINDIR)/l7directord
+ $(INSTALL) -m 755 -D ./init.d/l7directord $(RCDIR)/l7directord
+# 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:
--- /dev/null
+##
+## This is the l7directord configuration file.
+## See `l7directord --help' for detailed information.
+##
+
+# = GLOBAL DIRECTIVES
+
+# - Monitor Settings
+checktimeout = 5
+negotiatetimeout = 5
+checkinterval = 10
+retryinterval = 5
+checkcount = 3
+
+# - Logging
+logfile = /var/log/l7vs/l7directord.log
+#logfile = local0
+#supervised
+
+# - Real Server Operation
+quiescent = yes
+#fallback = 127.0.0.1:80
+
+# - Monitor Configuration File
+configinterval = 10
+autoreload = no
+#callback = /opt/config_change.sh
+
+# = VIRTUAL DIRECTIVES
+# - A sample virual section with a sorry server.
+# - checkcount and quiescent settings are override the global settings.
+virtual = 192.168.0.50:80
+ real = 192.168.0.51:8080 masq 1
+ real = 192.168.0.52:8080 masq 2
+ module = sessionless
+ scheduler = rr
+ sorryserver = 192.168.0.53:8080
+ maxconn = 1000
+ qosup = 100M
+ qosdown = 100M
+ checktype = negotiate
+ service = http
+ request = "index.html"
+ receive = "html"
+ quiescent = no
+ checkcount = 2
+ #realdowncallback = /opt/down.sh
+ #realrecovercallback = /opt/recover.sh
+ #customcheck = ping -c1 -w1 _IP_
--- /dev/null
+#!/bin/sh
+#
+# Start/Stop script for l7directord
+#
+# chkconfig: 2345 96 36
+# description: Start and stop l7directord on non-heartbeat systems
+# Using the config file /etc/ha.d/conf/l7directord.cf
+#
+# processname: l7directord
+# config: /etc/ha.d/conf/l7directord.cf
+#
+# Author: NTT COMWARE
+# Released: August 2005
+# Licence: GNU General Public Licence
+
+# Source function library.
+if
+ [ -f /etc/rc.d/init.d/functions ]
+then
+ . /etc/rc.d/init.d/functions
+else
+ action() {
+ echo "$1"
+ shift
+ $@
+ }
+fi
+
+[ -x /usr/sbin/l7directord ] || exit 0
+
+
+######################################################################
+# Read arument and take action as appropriate
+######################################################################
+
+case "$1" in
+ start)
+ action "Starting l7directord ... " /usr/sbin/l7directord start
+ ;;
+ stop)
+ echo -n "Stopping l7directord ... "
+ /usr/sbin/l7directord stop
+ if
+ [ $? != 0 ]
+ then
+ action "" /bin/false
+ else
+ while [ -f /var/run/l7directord.l7directord.pid ]
+ do
+ sleep 1
+ done
+ action "" /bin/true
+ fi
+ ;;
+ restart)
+ $0 stop
+ $0 start
+ ;;
+ try-restart)
+ action "Try restarting l7directord ... " /usr/sbin/l7directord try-restart
+ ;;
+ status)
+ /usr/sbin/l7directord status
+ ;;
+ reload)
+ /usr/sbin/l7directord reload
+ ;;
+ configtest)
+ /usr/sbin/l7directord configtest
+ ;;
+ *)
+ echo "Usage: l7directord
+ {start|stop|restart|try-restart|status|reload|configtest}"
+ exit 1
+esac
+
+exit 0
--- /dev/null
+#!/usr/bin/perl
+######################################################################
+# l7directord
+# Linux Director Daemon - run "perldoc l7directord" for details
+#
+# 2005-2008 (C) NTT COMWARE
+#
+# License: GNU General Public License (GPL)
+#
+# This program is developed on similar lines of ldirectord. It handles
+# l7vsadm and monitoring of real servers.
+#
+# The version of ldirectord used as a reference for this l7directord is
+# ldirectord,v 1.77.2.32 2005/09/21 04:00:41
+#
+# Note : * The existing code of ldirectord that is not required for
+# l7directord is also maintained in the program but is
+# commented out.
+#
+# 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
+######################################################################
+
+# Revision History :
+# 0.5.0-0: Added code related to Sorry server and Max connection
+# - 2006/11/03 NTT COMWARE
+# 1.0.0-0: Added code related to weight of real server and QoS
+# - 2007/10/12 NTT COMWARE
+# 1.0.1-0: Added the code below.
+# configuration of realdowncallback, realrecovercallback,
+# and sessionless module.
+# - 2007/12/28 NTT COMWARE
+# 1.0.2-0: Added the code below.
+# cookie insert with X-Forwarded-For module(cinsert_xf)
+# - 2008/1/14 Shinya TAKEBAYASHI
+# 2.0.0-0: Added code related to sslid module.
+# cinsert_xf module is marged into cinsert module.
+# Added code related to syntax test of configuration.
+# Expanded checkcount setting to all service check.
+# - 2008/03/25 Norihisa NAKAI
+# 2.1.0-0: Changed helthcheck logic to multi-process.
+# - 2008/12/17 NTT COMWARE
+# 2.1.1-0: Fix 'Range iterator outside integer range' in parse_real.
+# - 2009/01/06 NTT COMWARE
+# 2.1.2-0: Added code related to some module. See below.
+# (cpassive, crewrite, pfilter, url, ip)
+# Add custom healthcheck.
+# (checktype=custom, customcheck=exec_command)
+# - 2009/02/14 NTT COMWARE
+
+use 5.006;
+use strict;
+use warnings;
+use Getopt::Long qw(:config posix_default);
+use Sys::Hostname;
+use POSIX qw(:sys_wait_h :signal_h);
+use Sys::Syslog qw(:DEFAULT setlogsock);
+use English;
+use Fatal qw(open close);
+use Cwd qw(abs_path);
+use Data::Dumper;
+use Time::HiRes qw(sleep);
+use IO::Handle;
+
+# current version
+our $VERSION = '2.1.2-0';
+our $COPYRIGHT = 'Copyright (C) 2009 NTT COMWARE CORPORATION';
+
+# default global config values
+our %GLOBAL = (
+ logfile => '/var/log/l7vs/l7directord.log',
+ autoreload => 0,
+ checkcount => 1,
+ checkinterval => 10,
+ retryinterval => 10,
+ configinterval => 5,
+ checktimeout => 5,
+ negotiatetimeout => 5,
+ supervised => 0,
+ quiescent => 1,
+ virtual => undef,
+ execute => undef,
+ fallback => undef,
+ callback => undef,
+ );
+
+# default virtual config values
+our %VIRTUAL = (
+ real => undef,
+ module => { name => 'sessionless', key => q{} },
+ scheduler => 'rr',
+ protocol => 'tcp',
+ checktype => 'negotiate',
+ service => undef,
+ checkport => undef,
+ maxconn => 0,
+ qosup => 0,
+ qosdown => 0,
+ sorryserver => undef,
+ request => undef,
+ receive => undef,
+ httpmethod => 'GET',
+ virtualhost => undef,
+ login => q{},
+ passwd => q{},
+ database => q{},
+ realdowncallback => undef,
+ realrecovercallback => undef,
+ customcheck => undef,
+ # can override
+ checkcount => undef,
+ checkinterval => undef,
+ retryinterval => undef,
+ checktimeout => undef,
+ negotiatetimeout => undef,
+ quiescent => undef,
+ fallback => undef,
+ );
+
+# default real config values
+our %REAL = (
+ weight => 1,
+ forward => 'masq',
+ # can override
+ request => undef,
+ receive => undef,
+ );
+
+# current config data
+our %CONFIG = %GLOBAL;
+
+# config file data
+our %CONFIG_FILE = (
+ path => undef,
+ filename => undef,
+ checksum => undef,
+ stattime => undef,
+ );
+
+# process environment
+our %PROC_ENV = (
+ l7directord => $0,
+ l7vsadm => undef,
+ pid_prefix => '/var/run/l7directord',
+ hostname => undef,
+ );
+
+# process status
+our %PROC_STAT = (
+ pid => $PID,
+ initialized => 0,
+ log_opened => 0,
+ health_checked => 0,
+ halt => undef,
+ reload => undef,
+ );
+
+# debug level
+our $DEBUG_LEVEL = 0;
+
+# health check process data
+our %HEALTH_CHECK = ();
+
+# real server health flag
+our $SERVICE_UP = 0;
+our $SERVICE_DOWN = 1;
+
+# section virtual sub config prefix
+our $SECTION_VIRTUAL_PREFIX = " ";
+
+main();
+
+# main
+# Main method of this program.
+# parse command line and run each command method.
+sub main {
+ my $cmd_func = {
+ start => \&cmd_start,
+ stop => \&cmd_stop,
+ restart => \&cmd_restart,
+ 'try-restart' => \&cmd_try_restart,
+ reload => \&cmd_reload,
+ status => \&cmd_status,
+ configtest => \&cmd_configtest,
+ version => \&cmd_version,
+ help => \&cmd_help,
+ usage => \&cmd_usage,
+ };
+
+ # change program name for removing `perl' string from `ps' command result.
+ my $ps_name = @ARGV ? $PROGRAM_NAME . " @ARGV"
+ : $PROGRAM_NAME;
+ $PROGRAM_NAME = $ps_name;
+
+ my $cmd_mode = parse_cmd();
+ if ( !defined $cmd_mode || !exists $cmd_func->{$cmd_mode} ) {
+ $cmd_mode = 'usage';
+ }
+ if ($cmd_mode ne 'help' && $cmd_mode ne 'version' && $cmd_mode ne 'usage') {
+ initial_setting();
+ }
+
+ # execute command.
+ my $cmd_result = &{ $cmd_func->{$cmd_mode} }();
+
+ ld_exit( $cmd_result, _message_only('INF0008') );
+}
+
+# parse_cmd
+# Parse command line (ARGV)
+sub parse_cmd {
+ # configtest or help command
+ my $cmd_mode = parse_option();
+
+ # other command
+ if (!defined $cmd_mode && @ARGV) {
+ $cmd_mode = pop @ARGV;
+ }
+ return $cmd_mode;
+}
+
+# parse_option
+# Parse option strings by Getopt::Long
+sub parse_option {
+ my $cmd_mode = undef;
+
+ # default option value
+ my $debug = undef;
+ my $help = undef;
+ my $test = undef;
+ my $version = undef;
+
+ # parse command line options
+ my $result = GetOptions(
+ 'd:3' => \$debug, # debug mode, arg: debug level (default 3)
+ 'h|help' => \$help, # show help message
+ 't' => \$test, # config syntax test
+ 'v|version' => \$version, # show version
+ );
+
+ if ($result) {
+ # set debug level
+ if (defined $debug) {
+ $DEBUG_LEVEL = $debug;
+ }
+
+ # set command mode
+ if (defined $help) {
+ $cmd_mode = 'help';
+ }
+ elsif (defined $version) {
+ $cmd_mode = 'version';
+ }
+ elsif (defined $test) {
+ $cmd_mode = 'configtest';
+ }
+ }
+ else {
+ $cmd_mode = 'usage';
+ }
+
+ return $cmd_mode;
+}
+
+# initial_setting
+# Initialize file path settings.
+sub initial_setting {
+ # search config and l7vsadm
+ $PROC_ENV{l7vsadm} = search_l7vsadm_file();
+ $CONFIG_FILE{path} = search_config_file();
+
+ # get config file name exclude `.cf' or `.conf'
+ ( $CONFIG_FILE{filename} )
+ = $CONFIG_FILE{path} =~ m{([^/]+?)(?:\.cf|\.conf)?$};
+
+ # get hostname
+ $PROC_ENV{hostname}
+ = defined $ENV{HOSTNAME} ? $ENV{HOSTNAME}
+ : ( POSIX::uname() )[1]
+ ;
+}
+
+# search_config_file
+# Search l7directord.cf file from search path.
+sub search_config_file {
+ my $config_file = undef;
+ my @search_path = qw(
+ ./l7directord.cf
+ /etc/ha.d/l7directord.cf
+ /etc/ha.d/conf/l7directord.cf
+ );
+
+ if (@ARGV) {
+ $config_file = $ARGV[0];
+ if (!-f $ARGV[0]) {
+ init_error( _message_only('ERR0404', $config_file) );
+ }
+ }
+ else {
+ for my $file (@search_path) {
+ if (-f $file) {
+ $config_file = $file;
+ last;
+ }
+ }
+ if (!defined $config_file) {
+ init_error( _message_only('ERR0405', $config_file) );
+ }
+ }
+
+ return abs_path($config_file);
+}
+
+# search_l7vsadm_file
+# Search l7vsadm file from search path.
+sub search_l7vsadm_file {
+ my $l7vsadm_file = undef;
+ my @search_path = qw(
+ ./l7vsadm
+ /usr/sbin/l7vsadm
+ /sbin/l7vsadm
+ );
+
+ for my $file (@search_path) {
+ if (-x $file) {
+ $l7vsadm_file = $file;
+ last;
+ }
+ }
+ if (!defined $l7vsadm_file) {
+ init_error( _message_only('ERR0406', $l7vsadm_file) );
+ }
+
+ return abs_path($l7vsadm_file);
+}
+
+# cmd_start
+# Start process
+# Called if command argument is start
+# return: 0 if success
+# 1 if old process id is found.
+sub cmd_start {
+ set_ld_handler();
+ read_config();
+
+ ld_log( _message('INF0001', $PROGRAM_NAME) );
+
+ ld_setup();
+
+ my $oldpid = read_pid();
+
+ # already other process is running
+ if ($oldpid) {
+ print {*STDERR} _message_only('INF0103', $oldpid) . "\n";
+ return 1;
+ }
+
+ # supervised or debug mode (not daemon)
+ if ($CONFIG{supervised} || $DEBUG_LEVEL > 0) {
+ ld_log( _message( 'INF0002', $VERSION, $PID, $CONFIG_FILE{path} ) );
+ }
+ # otherwise (daemon)
+ else {
+ ld_daemon();
+ ld_log( _message( 'INF0003', $VERSION, $CONFIG_FILE{path} ) );
+ }
+
+ write_pid( $PROC_STAT{pid} );
+ ld_cmd_children('start');
+ ld_main();
+ ld_cmd_children('stop');
+ remove_pid();
+
+ return 0;
+}
+
+# cmd_stop
+# Send stop signal (TERM)
+# Called if command argument is stop
+# return: 0 if success
+# 2 if old process id is not found.
+# 3 if signal failed.
+sub cmd_stop {
+ my ($oldpid, $stalepid) = read_pid();
+
+ # process is not running
+ if (!$oldpid) {
+ if ($stalepid) {
+ my $pid_file = $PROC_ENV{pid_prefix} . q{.} . $CONFIG_FILE{filename} . '.pid';
+ print {*STDERR} _message_only('INF0102', $pid_file, $CONFIG_FILE{path}) . "\n";
+ }
+ print {*STDERR} _message_only('INF0104') . "\n";
+ return 2;
+ }
+
+ # signal TERM
+ my $signaled = kill 15, $oldpid;
+ if ($signaled != 1) {
+ print {*STDERR} _message('WRN0003', $oldpid);
+ return 3;
+ }
+ return 0;
+}
+
+# cmd_restart
+# Restart process
+# Called if command argument is try-restart
+# return: see cmd_start return
+sub cmd_restart {
+ # stop and ignore result
+ cmd_stop();
+
+ # wait for pid file
+ sleep 1;
+
+ # start
+ my $status = cmd_start();
+
+ return $status;
+}
+
+# cmd_try_restart
+# Trying restart process
+# Called if command argument is try-restart
+# return: see cmd_start, cmd_stop return
+sub cmd_try_restart {
+ # stop
+ my $stop_result = cmd_stop();
+
+ # start only if stop succeed
+ if ($stop_result != 0) {
+ return $stop_result;
+ }
+
+ # wait for pid file
+ sleep 1;
+
+ # start
+ my $status = cmd_start();
+
+ return $status;
+}
+
+# cmd_reload
+# Send reload signal (HUP)
+# Called if command argument is reload
+# return: 0 if success
+# 2 if old process id is not found.
+# 3 if signal failed.
+sub cmd_reload {
+ read_config();
+ my ($oldpid, $stalepid) = read_pid();
+ if (!$oldpid) {
+ if ($stalepid) {
+ my $pid_file = $PROC_ENV{pid_prefix} . q{.} . $CONFIG_FILE{filename} . '.pid';
+ print {*STDERR} _message_only( 'INF0102', $pid_file, $CONFIG_FILE{path} ) . "\n";
+ }
+ print {*STDERR} _message_only('INF0104') . "\n";
+ return 2;
+ }
+
+ # signal HUP
+ my $signaled = kill 1, $oldpid;
+ if ($signaled != 1) {
+ print {*STDERR} _message('WRN0004', $oldpid);
+ return 3;
+ }
+ return 0;
+}
+
+# cmd_status
+# Show process id of running
+# Called if command argument is status
+# return: 0 if success
+# 2 if old process id is not found.
+sub cmd_status {
+ my ($oldpid, $stalepid) = read_pid();
+ if (!$oldpid) {
+ if ($stalepid) {
+ my $pid_file = $PROC_ENV{pid_prefix} . q{.} . $CONFIG_FILE{filename} . '.pid';
+ print {*STDERR} _message_only('INF0102', $pid_file, $CONFIG_FILE{path}) . "\n";
+ }
+ print {*STDERR} _message_only('INF0104') . "\n";
+ ld_cmd_children('status');
+
+ return 2;
+ }
+
+ print {*STDERR} _message_only('INF0101', $CONFIG_FILE{path}, $oldpid) . "\n";
+
+ read_config();
+ ld_cmd_children('status');
+
+ return 0;
+}
+
+# cmd_version
+# Configuration syntax check
+# Called if command argument is configtest
+# return: 0 if syntax ok
+# otherwise, exit by read_config
+sub cmd_configtest {
+ read_config();
+ print {*STDOUT} "Syntax OK\n";
+ return 0;
+}
+
+# cmd_version
+# Show program version.
+# Called if command argument is version
+# return: 0
+sub cmd_version {
+ print {*STDOUT} "l7directord, version $VERSION\n$COPYRIGHT\n";
+ return 0;
+}
+
+# cmd_help
+# Show command manual.
+# Called if command argument is help
+# return: 0
+sub cmd_help {
+ system_wrapper( '/usr/bin/perldoc ' . $PROC_ENV{l7directord} );
+ return 0;
+}
+
+# cmd_usage
+# Show command usage.
+# Called if command argument is unknown or not specified.
+# return: 0
+sub cmd_usage {
+ print {*STDERR}
+ "Usage: l7directord {start|stop|restart|try-restart|reload|status|configtest}\n"
+ . "Try `l7directord --help' for more information.\n";
+ return 0;
+}
+
+# set_ld_handler
+# Set signal handler function.
+sub set_ld_handler {
+ $SIG{ INT } = \&ld_handler_term;
+ $SIG{ QUIT } = \&ld_handler_term;
+ $SIG{ ILL } = \&ld_handler_term;
+ $SIG{ ABRT } = \&ld_handler_term;
+ $SIG{ FPE } = \&ld_handler_term;
+ $SIG{ SEGV } = \&ld_handler_term;
+ $SIG{ TERM } = \&ld_handler_term;
+ $SIG{ BUS } = \&ld_handler_term;
+ $SIG{ SYS } = \&ld_handler_term;
+ $SIG{ XCPU } = \&ld_handler_term;
+ $SIG{ XFSZ } = \&ld_handler_term;
+ # HUP is actually used
+ $SIG{ HUP } = \&ld_handler_hup;
+ # This used to call a signal handler, that logged a message
+ # However, this typically goes to syslog and if syslog
+ # is playing up a loop will occur.
+ $SIG{ PIPE } = 'IGNORE';
+ # handle perl warn signal
+ $SIG{__WARN__} = \&ld_handler_perl_warn;
+}
+
+# ld_handler_perl_warn
+# Handle Perl warnings for logging file.
+sub ld_handler_perl_warn {
+ my $warning = join q{, }, @_;
+ $warning =~ s/[\r\n]//g;
+ ld_log( _message('WRN0301', $warning) );
+}
+
+# read_pid
+# Read pid file and check if pid (l7directord) is still running
+sub read_pid {
+ my $old_pid = undef;
+ my $file_pid = undef;
+ my $pid_file = $PROC_ENV{pid_prefix} . q{.} . $CONFIG_FILE{filename} . '.pid';
+ eval {
+ open my $pid_handle, '<', $pid_file;
+ $file_pid = <$pid_handle>;
+ close $pid_handle;
+ chomp $file_pid;
+
+ # Check to make sure this isn't a stale pid file
+ my $proc_file = "/proc/$file_pid/cmdline";
+ open my $proc_handle, '<', $proc_file;
+ my $line = <$proc_handle>;
+ if ($line =~ /l7directord/) {
+ $old_pid = $file_pid;
+ }
+ close $proc_handle;
+ };
+
+ return wantarray ? ($old_pid, $file_pid) : $old_pid;
+}
+
+# write_pid
+# Write pid number to pid file.
+sub write_pid {
+ my $pid = shift;
+
+ my $pid_file = $PROC_ENV{pid_prefix} . q{.} . $CONFIG_FILE{filename} . '.pid';
+ if (!defined $pid || $pid !~ /^\d+$/ || $pid < 1) {
+ $pid = defined $pid ? $pid : 'undef';
+ init_error( _message_only('ERR0412', $pid) );
+ }
+ eval {
+ open my $pid_handle, '>', $pid_file;
+ print {$pid_handle} $pid . "\n";
+ close $pid_handle;
+ };
+ if ($EVAL_ERROR) {
+ init_error( _message_only('ERR0409', $pid_file, $EVAL_ERROR) );
+ }
+}
+
+# remove_pid
+# Remove pid file.
+sub remove_pid {
+ my $pid_file = $PROC_ENV{pid_prefix} . q{.} . $CONFIG_FILE{filename} . '.pid';
+ ld_rm_file($pid_file);
+}
+
+# init_error
+# Handle error during initialization and exit.
+sub init_error {
+ my $msg = shift;
+ if (defined $msg) {
+ if ($DEBUG_LEVEL == 0) {
+ print {*STDERR} $msg . "\n";
+ }
+ ld_log( _message('ERR0001', $msg) );
+ }
+ ld_exit( 4, _message_only('INF0004') );
+}
+
+# ld_handler_term
+# If we get a sinal then put a halt flag up
+sub ld_handler_term {
+ my $signal = shift;
+ $PROC_STAT{halt} = defined $signal ? $signal : 'undef';
+}
+
+# ld_handler_hup
+# If we get a sinal then put a reload flag up
+sub ld_handler_hup {
+ my $signal = shift;
+ $PROC_STAT{reload} = defined $signal ? $signal : 'undef';
+}
+
+# reread_config
+# Re-read config, and then re-setup l7vsd and child process.
+sub reread_config {
+ my $old_virtual = defined $CONFIG{virtual} ? [ @{ $CONFIG{virtual} } ]
+ : []
+ ;
+ my %old_sub_config = defined $CONFIG{execute} ? %{ $CONFIG{execute} }
+ : ()
+ ;
+
+ %CONFIG = %GLOBAL;
+ $CONFIG{old_virtual} = $old_virtual;
+
+ # analyze config and catch format error
+ eval {
+ read_config();
+ ld_setup();
+ ld_start();
+ };
+ if ($EVAL_ERROR) {
+ my $exception = $EVAL_ERROR;
+ chomp $exception;
+ ld_log( _message('ERR0122', $exception) );
+ $CONFIG{virtual} = [ @{ $CONFIG{old_virtual} } ];
+ $CONFIG{execute} = \%old_sub_config;
+ }
+
+ my %new_sub_config = defined $CONFIG{execute} ? %{ $CONFIG{execute} }
+ : ()
+ ;
+ for my $sub_config ( keys %old_sub_config ) {
+ if ( exists $new_sub_config{$sub_config} ) {
+ if ( system_wrapper($PROC_ENV{l7directord} . " $sub_config reload") ) {
+ system_wrapper($PROC_ENV{l7directord} . " $sub_config start");
+ }
+ delete $new_sub_config{$sub_config};
+ delete $old_sub_config{$sub_config};
+ }
+ }
+ ld_cmd_children('stop', \%old_sub_config);
+ ld_cmd_children('start', \%new_sub_config);
+}
+
+# read_config
+# Read configuration and parse settings.
+sub read_config {
+ my $line = 0;
+ my $current_global_name = q{};
+ my $config_handle;
+
+ eval {
+ open $config_handle, '<', $CONFIG_FILE{path};
+ };
+ if ($EVAL_ERROR) {
+ config_error( 0, 'ERR0407', $CONFIG_FILE{path} );
+ }
+
+ while (my $config_line = <$config_handle>) {
+ $line++;
+ chomp $config_line;
+ $config_line =~ s/#.*//mg; # remove comment (FIXME optimize regex for "foo='#'")
+ $config_line =~ s/^\t/$SECTION_VIRTUAL_PREFIX/mg; # convert tab to prefix
+
+ next if ($config_line =~ /^(?:$SECTION_VIRTUAL_PREFIX)?\s*$/);
+
+ # section global
+ if ($config_line !~ /^$SECTION_VIRTUAL_PREFIX/) {
+ my ($name, $value) = validate_config($line, $config_line);
+ $current_global_name = $name;
+ if ($name eq 'virtual') {
+ my %virtual = %VIRTUAL;
+ $virtual{server} = $value;
+ push @{ $CONFIG{virtual} }, \%virtual;
+ _ld_service_resolve(\%virtual, $value->{port});
+ }
+ elsif ($name eq 'execute') {
+ $CONFIG{execute}{$value} = 1;
+ }
+ else {
+ $CONFIG{$name} = $value;
+ }
+ }
+ # section virtual
+ else {
+ if ($current_global_name ne 'virtual') {
+ config_error($line, 'ERR0119', $config_line);
+ }
+ my ($name, $value) = validate_config($line, $config_line);
+ if ($name eq 'real' && defined $value) {
+ push @{ $CONFIG{virtual}[-1]{real} }, @$value;
+ }
+ elsif (defined $value) {
+ $CONFIG{virtual}[-1]{$name} = $value;
+ }
+ }
+ }
+
+ eval {
+ close $config_handle;
+ };
+ if ($EVAL_ERROR) {
+ config_error( 0, 'ERR0408', $CONFIG_FILE{path} );
+ }
+
+ ld_openlog( $CONFIG{logfile} ) if !$PROC_STAT{log_opened};
+ check_require_module();
+ undef $CONFIG_FILE{checksum};
+ undef $CONFIG_FILE{stattime};
+ check_cfgfile();
+
+ $PROC_STAT{initialized} = 1;
+}
+
+# validate_config
+# Validation check of configuration.
+sub validate_config {
+ my ($line, $config) = @_;
+ my ($name, $value) = split /\s*=\s*/, $config, 2;
+ if (defined $value) {
+ $value =~ s/\s*$//;
+ $value =~ s/^("|')(.*)\1$/$2/;
+ }
+
+ # section global validate
+ if ($name !~ /^$SECTION_VIRTUAL_PREFIX/) {
+ if (!exists $GLOBAL{$name}) {
+ config_error($line, 'ERR0120', $config);
+ }
+ if ($name eq 'virtual') {
+ $value = ld_gethostservbyname($value, 'tcp');
+ if (!defined $value) {
+ config_error($line, 'ERR0114', $config);
+ }
+ }
+ elsif ( $name eq 'checktimeout'
+ || $name eq 'negotiatetimeout'
+ || $name eq 'checkinterval'
+ || $name eq 'retryinterval'
+ || $name eq 'configinterval'
+ || $name eq 'checkcount' ) {
+ if (!defined $value || $value !~ /^\d+$/ || $value == 0 ) {
+ config_error($line, 'ERR0101', $config);
+ }
+ }
+ elsif ( $name eq 'autoreload'
+ || $name eq 'quiescent' ) {
+ $value = defined $value && $value =~ /^yes$/i ? 1
+ : defined $value && $value =~ /^no$/i ? 0
+ : undef
+ ;
+ if (!defined $value) {
+ config_error($line, 'ERR0102', $config);
+ }
+ }
+ elsif ($name eq 'fallback') {
+ my $fallback = parse_fallback($line, $value, $config);
+ $value = {tcp => $fallback};
+ }
+ elsif ($name eq 'callback') {
+ if (!defined $value || !-f $value || !-x $value) {
+ config_error($line, 'ERR0117', $config);
+ }
+ }
+ elsif ($name eq 'execute') {
+ if (!defined $value || !-f $value) {
+ config_error($line, 'ERR0116', $config);
+ }
+ }
+ elsif ($name eq 'logfile') {
+ if (!defined $value || ld_openlog($value) ) {
+ config_error($line, 'ERR0118', $config);
+ }
+ }
+ elsif ($name eq 'supervised') {
+ $value = 1;
+ }
+ }
+ # section virtual validate
+ else {
+ $name =~ s/^$SECTION_VIRTUAL_PREFIX\s*//g;
+ if (!exists $VIRTUAL{$name}) {
+ config_error($line, 'ERR0120', $config);
+ }
+ if ($name eq 'real') {
+ $value = parse_real($line, $value, $config);
+ }
+ elsif ( $name eq 'request'
+ || $name eq 'receive'
+ || $name eq 'login'
+ || $name eq 'passwd'
+ || $name eq 'database'
+ || $name eq 'customcheck'
+ || $name eq 'virtualhost' ) {
+ if (!defined $value || $value !~ /^.+$/) {
+ config_error($line, 'ERR0103', $config);
+ }
+ }
+ elsif ($name eq 'checktype') {
+ my $valid_type = qr{custom|connect|negotiate|ping|off|on|\d+};
+ $value = lc $value;
+ if (!defined $value || $value !~ /^(?:$valid_type)$/) {
+ config_error($line, 'ERR0104', $config);
+ }
+ if ($value =~ /^\d+$/ && $value == 0) {
+ config_error($line, 'ERR0104', $config);
+ }
+ }
+ elsif ( $name eq 'checktimeout'
+ || $name eq 'negotiatetimeout'
+ || $name eq 'checkinterval'
+ || $name eq 'retryinterval'
+ || $name eq 'checkcount'
+ || $name eq 'maxconn' ) {
+ if (!defined $value || $value !~ /^\d+$/ || ($name ne 'maxconn' && $value == 0) ) {
+ config_error($line, 'ERR0101', $config);
+ }
+ }
+ elsif ($name eq 'checkport') {
+ if (!defined $value || $value !~ /^\d+$/ || $value == 0 || $value > 65535) {
+ config_error($line, 'ERR0108', $config);
+ }
+ }
+ elsif ($name eq 'scheduler') {
+ my $valid_scheduler = qr{lc|rr|wrr};
+ $value = lc $value;
+ if (!defined $value || $value !~ /^(?:$valid_scheduler)$/) {
+ config_error($line, 'ERR0105', $config);
+ }
+ }
+ elsif ($name eq 'protocol') {
+ $value = lc $value;
+ if (!defined $value || $value !~ /^tcp$/) {
+ config_error($line, 'ERR0109', $config);
+ }
+ }
+ elsif ($name eq 'service') {
+ $value = lc $value;
+ my $valid_service = qr{http|https|ldap|ftp|smtp|pop|imap|nntp|dns|mysql|pgsql|sip|none};
+ if (!defined $value || $value !~ /^(?:$valid_service)$/) {
+ config_error($line, 'ERR0106', $config);
+ }
+ }
+ elsif ($name eq 'httpmethod') {
+ my $valid_method = qr{GET|HEAD};
+ $value = uc $value;
+ if (!defined $value || $value !~ /^(?:$valid_method)$/) {
+ config_error($line, 'ERR0110', $config);
+ }
+ }
+ elsif ($name eq 'fallback') {
+ my $fallback = parse_fallback($line, $value, $config);
+ $value = {tcp => $fallback};
+ }
+ elsif ($name eq 'quiescent') {
+ $value = defined $value && $value =~ /^yes$/i ? 1
+ : defined $value && $value =~ /^no$/i ? 0
+ : undef
+ ;
+ if (!defined $value) {
+ config_error($line, 'ERR0102', $config);
+ }
+ }
+ elsif ($name eq 'module') {
+ my %key_option = ( url => ['--pattern-match', '--uri-pattern-match', '--host-pattern-match'],
+ pfilter => ['--pattern-match'],
+ sessionless => [],
+ ip => [],
+ sslid => [],
+ );
+ my $module = undef;
+ my $option = undef;
+ my $key = q{};
+ if (defined $value) {
+ $value =~ s/["']//g;
+ ($module, $option) = split /\s+/, $value, 2;
+ }
+ $module = lc $module;
+ if ( !defined $module || !exists $key_option{$module} ) {
+ config_error($line, 'ERR0111', $config);
+ }
+ for my $key_opt ( @{$key_option{$module}} ) {
+ if (defined $option && $option =~ /$key_opt\s+(\S+)/) {
+ $key .= q{ } if $key;
+ $key .= $key_opt . q{ } . $1;
+ }
+ }
+ if ( !$key && @{$key_option{$module}} ) {
+ # when omit cookie module key option
+ my $key_opt = join q{' or `}, @{$key_option{$module}};
+ config_error($line, 'ERR0112', $module, $key_opt, $config);
+ }
+ $value = {name => $module, option => $option, key => $key};
+ }
+ elsif ($name eq 'sorryserver') {
+ my $sorry_server = ld_gethostservbyname($value, 'tcp');
+ if (!defined $sorry_server) {
+ config_error($line, 'ERR0114', $config);
+ }
+ $value = $sorry_server;
+ }
+ elsif ( $name eq 'qosup'
+ || $name eq 'qosdown' ) {
+ $value = uc $value;
+ if ( !defined $value || ($value ne '0' && $value !~ /^[1-9]\d{0,2}[KMG]$/) ) {
+ config_error($line, 'ERR0113', $config);
+ }
+ }
+ elsif ( $name eq 'realdowncallback'
+ || $name eq 'realrecovercallback' ) {
+ if (!defined $value || !-f $value || !-x $value) {
+ config_error($line, 'ERR0117', $config);
+ }
+ }
+ }
+
+ return ($name, $value);
+}
+
+# check_require_module
+# Check service setting and require module.
+sub check_require_module {
+ my %require_module = (
+ http => [ qw( LWP::UserAgent LWP::Debug ) ],
+ https => [ qw( LWP::UserAgent LWP::Debug Crypt::SSLeay ) ],
+ ftp => [ qw( Net::FTP ) ],
+ smtp => [ qw( Net::SMTP ) ],
+ pop => [ qw( Net::POP3 ) ],
+ imap => [ qw( Mail::IMAPClient ) ],
+ ldap => [ qw( Net::LDAP ) ],
+ nntp => [ qw( IO::Socket IO::Select ) ],
+ dns => [ qw( Net::DNS ) ],
+ mysql => [ qw( DBI DBD::mysql ) ],
+ pgsql => [ qw( DBI DBD::Pg ) ],
+ sip => [ qw( IO::Socket::INET ) ],
+ ping => [ qw( Net::Ping ) ],
+ connect => [ qw( IO::Socket::INET ) ],
+ );
+
+ for my $v ( @{ $CONFIG{virtual} } ) {
+ next if !defined $v;
+ next if ( !defined $v->{service} || !defined $v->{checktype} );
+ my $check_service = q{};
+ if ( $v->{checktype} eq 'negotiate' && $require_module{ $v->{service} } ) {
+ $check_service = $v->{service};
+ }
+ elsif ($v->{checktype} eq 'ping' || $v->{checktype} eq 'connect') {
+ $check_service = $v->{checktype};
+ }
+ else {
+ next;
+ }
+ for my $module ( @{ $require_module{$check_service} } ) {
+ my $module_path = $module . '.pm';
+ $module_path =~ s{::}{/}g;
+ eval {
+ require $module_path;
+ };
+ if ($EVAL_ERROR) {
+ config_error(0, 'ERR0123', $module, $check_service);
+ }
+ }
+ }
+}
+
+# _ld_service_resolve
+# Set service name from port number
+# pre: vsrv: Virtual Service to resolve port
+# port: port in the form
+# post: If $vsrv->{service} is not set, then set it to "http",
+# "https", "ftp", "smtp", "pop", "imap", "ldap", "nntp" or "none"
+# if $vsrv->{port} is 80, 443, 21, 25, 110, 143, 389 or
+# any other value, respectivley
+# return: none
+sub _ld_service_resolve {
+ my ($vsrv, $port) = @_;
+
+ my %servname;
+ my @p = qw( 80 443 21 25 110 119 143 389 53 3306 5432 5060 );
+ my @s = qw( http https ftp smtp pop nntp imap ldap dns mysql pgsql sip );
+ @servname{@p} = @s;
+
+ if (defined $vsrv && !defined $vsrv->{service} && defined $port) {
+ $vsrv->{service} = exists $servname{$port} ? $servname{$port}
+ : 'none'
+ ;
+ }
+}
+
+# parse_fallback
+# Parse a fallback server
+# pre: line: line number fallback server was read from
+# fallback: Should be of the form
+# ip_address|hostname[:port|:service_name] masq
+# config_line: line read from configuration file
+# post: fallback is parsed
+# return: Reference to hash of the form
+# { server => blah, forward => blah }
+# Debugging message will be reported and programme will exit
+# on error.
+sub parse_fallback {
+ my ($line, $fallback, $config_line) = @_;
+
+ if (!defined $fallback || $fallback !~ /^(\S+)(?:\s+(\S+))?$/) {
+ config_error($line, 'ERR0114', $config_line);
+ }
+ my ($ip_port, $forward) = ($1, $2);
+ $ip_port = ld_gethostservbyname($ip_port, 'tcp');
+ if ( !defined $ip_port ) {
+ config_error($line, 'ERR0114', $config_line);
+ }
+ if (defined $forward && $forward !~ /^masq$/i) {
+ config_error($line, 'ERR0107', $config_line);
+ }
+
+ my %fallback = %REAL;
+ $fallback{server} = $ip_port;
+ if (defined $forward) {
+ $fallback{forward} = $forward;
+ }
+
+ return \%fallback;
+}
+
+# parse_real
+# Parse a real server
+# pre: line: line number real server was read from
+# real: Should be of the form
+# ip_address|hostname[:port|:service_name] masq
+# config_line: line read from configuration file
+# post: real is parsed
+# return: Reference to array include real server hash reference
+# [ {server...}, {server...} ... ]
+# Debugging message will be reported and programme will exit
+# on error.
+sub parse_real {
+ my ($line, $real, $config_line) = @_;
+
+ my $ip_host = qr{\d+\.\d+\.\d+\.\d+|[a-z0-9.-]+};
+ my $port_service = qr{\d+|[a-z0-9-]+};
+ if ( !defined $real
+ || $real !~ /^
+ ($ip_host) # ip or host
+ (?:->($ip_host))? # range (optional)
+ (?::($port_service))? # port or service (optional)
+ (?:\s+([a-z]+))? # forwarding mode (optional)
+ (?:\s+(\d+))? # weight (optional)
+ (?:\s+
+ ([^,\s]+) # "request
+ \s*[ ,]\s* # separater
+ (\S+) # receive"
+ )? # (optional)
+ $/ix) {
+ config_error($line, 'ERR0114', $config_line);
+ }
+ my ($ip1, $ip2, $port, $forward, $weight, $request, $receive)
+ = ( $1, $2, $3, $4, $5, $6, $7);
+
+ # set forward, weight and request-receive pair.
+ my %real = %REAL;
+ if (defined $forward) {
+ $forward = lc $forward;
+ if ($forward !~ /^masq$/) {
+ config_error($line, 'ERR0107', $config_line);
+ }
+ $real{forward} = $forward;
+ }
+ if (defined $weight) {
+ $real{weight} = $weight;
+ }
+ if (defined $request && defined $receive) {
+ $request =~ s/^\s*("|')(.*)\1\s*/$2/;
+ $receive =~ s/^\s*("|')(.*)\1\s*/$2/;
+ $real{request} = $request;
+ $real{receive} = $receive;
+ }
+
+ my $resolved_port = undef;
+ if (defined $port) {
+ $resolved_port = ld_getservbyname($port);
+ if (!defined $resolved_port) {
+ config_error($line, 'ERR0108', $config_line);
+ }
+ }
+
+ my $resolved_ip1 = ld_gethostbyname($ip1);
+ if (!defined $resolved_ip1) {
+ config_error($line, 'ERR0114', $config_line);
+ }
+
+ my $resolved_ip2 = $resolved_ip1;
+ if (defined $ip2) {
+ $resolved_ip2 = ld_gethostbyname($ip2);
+ if (!defined $resolved_ip2) {
+ config_error($line, 'ERR0114', $config_line);
+ }
+ }
+
+ my $int_ip1 = ip_to_int($resolved_ip1);
+ my $int_ip2 = ip_to_int($resolved_ip2);
+ if ($int_ip1 > $int_ip2) {
+ config_error($line, 'ERR0115', $resolved_ip1, $resolved_ip2, $config_line);
+ }
+
+ my @reals = ();
+ for (my $int_ip = $int_ip1; $int_ip <= $int_ip2; $int_ip++) {
+ my %new_real = %real;
+ $new_real{server}{ip } = int_to_ip($int_ip);
+ $new_real{server}{port} = $resolved_port;
+ push @reals, \%new_real;
+ }
+ return \@reals;
+}
+
+# config_error
+# Handle error during read configuration and validation check
+sub config_error {
+ my ($line, $msg_code, @msg_args) = @_;
+
+ if ($DEBUG_LEVEL > 0 || $PROC_STAT{initialized} == 0) {
+ my $msg = _message_only($msg_code, @msg_args);
+ if (defined $line && $line > 0) {
+ print {*STDERR} _message_only('ERR0121', $CONFIG_FILE{path}, $line, $msg) . "\n";
+ }
+ else {
+ print {*STDERR} $msg . "\n";
+ }
+ }
+ else {
+ if ($line > 0) {
+ ld_log( _message('ERR0121', $CONFIG_FILE{path}, $line, q{}) );
+ }
+ ld_log( _message($msg_code, @msg_args) );
+ }
+ if ( $PROC_STAT{initialized} == 0 ) {
+ ld_exit(5, _message_only('ERR0002') );
+ }
+ else {
+ die "Configuration error.\n";
+ }
+}
+
+# ld_setup
+# Check configuration value and set default value, overwrite global config value and so on.
+sub ld_setup {
+ if ( defined $CONFIG{virtual} ) {
+ for my $v ( @{ $CONFIG{virtual} } ) {
+ next if !defined $v;
+ if (defined $v->{protocol} && $v->{protocol} eq 'tcp') {
+ $v->{option}{protocol} = "-t";
+ }
+
+ if ( defined $v->{option} && defined $v->{option}{protocol} && defined $v->{module} && defined $v->{module}{name} ) {
+ my $module_option = $v->{module}{name};
+ if ( defined $v->{module}{option} ) {
+ $module_option .= q{ } . $v->{module}{option};
+ }
+ $v->{option}{main} = sprintf "%s %s -m %s", $v->{option}{protocol}, get_ip_port($v), $module_option;
+ $v->{option}{flags} = $v->{option}{main};
+ if ( defined $v->{scheduler} ) {
+ $v->{option}{flags} .= ' -s ' . $v->{scheduler};
+ }
+ if ( defined $v->{maxconn} ) {
+ $v->{option}{flags} .= ' -u ' . $v->{maxconn};
+ }
+ if ( defined $v->{sorryserver} && defined $v->{sorryserver}{ip} && defined $v->{sorryserver}{port} ) {
+ $v->{option}{flags} .= ' -b ' . $v->{sorryserver}{ip} . ':' . $v->{sorryserver}{port};
+ }
+ if ( defined $v->{qosup} ) {
+ $v->{option}{flags} .= ' -Q ' . $v->{qosup};
+ }
+ if ( defined $v->{qosdown} ) {
+ $v->{option}{flags} .= ' -q ' . $v->{qosdown};
+ }
+ }
+
+ if ( !defined $v->{fallback} && defined $CONFIG{fallback} ) {
+ $v->{fallback} = { %{ $CONFIG{fallback} } };
+ }
+ if ( defined $v->{fallback} ) {
+ for my $proto ( keys %{ $v->{fallback} } ) {
+ $v->{fallback}{$proto}{option}{flags} = '-r ' . get_ip_port( $v->{fallback}{$proto} );
+ }
+ }
+ if (defined $v->{checktype} && $v->{checktype} =~ /^\d+$/) {
+ $v->{num_connects} = $v->{checktype};
+ $v->{checktype} = 'combined';
+ }
+
+ if ( defined $v->{login} && $v->{login} eq q{} ) {
+ $v->{login} = defined $v->{service} && $v->{service} eq 'ftp' ? 'anonymous'
+ : defined $v->{service} && $v->{service} eq 'sip' ? 'l7directord@' . $PROC_ENV{hostname}
+ : q{}
+ ;
+ }
+ if ( defined $v->{passwd} && $v->{passwd} eq q{} ) {
+ $v->{passwd} = defined $v->{service} && $v->{service} eq 'ftp' ? 'l7directord@' . $PROC_ENV{hostname}
+ : q{}
+ ;
+ }
+
+ if ( defined $v->{real} ) {
+ for my $r ( @{ $v->{real} } ) {
+ next if !defined $r;
+ if ( defined $r->{forward} ) {
+ $r->{option}{forward} = get_forward_flag( $r->{forward} );
+ }
+ if ( !defined $r->{weight} || $r->{weight} !~ /^\d+$/ ) {
+ $r->{weight} = 1;
+ }
+
+ if ( !defined $r->{server}{port} ) {
+ $r->{server}{port} = $v->{server}{port};
+ }
+
+ $r->{option}{flags} = '-r ' . get_ip_port($r);
+
+ # build request URL
+ if ( defined $v->{service} && defined $r->{server} ) {
+ my $port = defined $v->{checkport} ? $v->{checkport} : $r->{server}{port};
+ $r->{url} = sprintf "%s://%s:%s/",
+ $v->{service}, $r->{server}{ip}, $port;
+ }
+ if ( !defined $r->{request} && defined $v->{request} ) {
+ $r->{request} = $v->{request};
+ }
+ if ( !defined $r->{receive} && defined $v->{receive} ) {
+ $r->{receive} = $v->{receive};
+ }
+ if ( defined $r->{request} ) {
+ my $uri = $r->{request};
+ my $service = $v->{service};
+ if ( defined $v->{service} && $uri =~ m{^$service://} ) {
+ $r->{url} = $uri;
+ }
+ else {
+ $uri =~ s{^/+}{}g;
+ $r->{url} .= $uri;
+ }
+ }
+
+ # set connect count for combine check
+ if (defined $v->{checktype} && $v->{checktype} eq 'combined') {
+ $r->{num_connects} = undef;
+ }
+
+ $r->{fail_counts} = 0;
+ $r->{healthchecked} = 0;
+ }
+ }
+ if ( !defined $v->{checkcount} || $v->{checkcount} <= 0 ) {
+ $v->{checkcount} = $CONFIG{checkcount};
+ }
+ if ( !defined $v->{checktimeout} || $v->{checktimeout} <= 0 ) {
+ $v->{checktimeout} = $CONFIG{checktimeout};
+ }
+ if ( !defined $v->{negotiatetimeout} || $v->{negotiatetimeout} <= 0 ) {
+ $v->{negotiatetimeout} = $CONFIG{negotiatetimeout};
+ }
+ if ( !defined $v->{checkinterval} || $v->{checkinterval} <= 0 ) {
+ $v->{checkinterval} = $CONFIG{checkinterval};
+ }
+ if ( !defined $v->{retryinterval} || $v->{retryinterval} <= 0 ) {
+ $v->{retryinterval} = $CONFIG{retryinterval};
+ }
+ if ( !defined $v->{quiescent} ) {
+ $v->{quiescent} = $CONFIG{quiescent};
+ }
+ }
+ }
+
+ if (defined $CONFIG{fallback}) {
+ $CONFIG{fallback}{tcp}{option}{flags} = '-r ' . get_ip_port( $CONFIG{fallback}{tcp} );
+ }
+}
+
+# Removed persistent and netmask related hash entries from the structure of l7vsadm since it is not used - NTT COMWARE
+# ld_read_l7vsadm
+# Parses the output of "l7vsadm -K -n" and puts into a structure of
+# the following from:
+#
+# {
+# (vip_address:vport) protocol module_name module_key_value => {
+# "scheduler" => scheduler,
+# "real" => {
+# rip_address:rport => {
+# "forward" => forwarding_mechanism,
+# "weight" => weight
+# },
+# ...
+# }
+# },
+# ...
+# }
+#
+# where:
+# vip_address: IP address of virtual service
+# vport: Port of virtual service
+# module_name: Depicts the name of the module (For example, pfilter)
+# module_key_value: Depicts the module key values (For example, --path-match xxxx)
+# scheduler: Scheduler for virtual service
+#
+# rip_address: IP address of real server
+# rport: Port of real server
+# forwarding_mechanism: Forwarding mechanism for real server. This would be only masq.
+# weight: Weight of real server
+#
+# pre: none
+# post: l7vsadm -K -n is parsed
+# result: reference to structure detailed above.
+sub ld_read_l7vsadm {
+ my $current_service = {};
+ my $vip_id;
+
+ if ( !-f $PROC_ENV{l7vsadm} || !-x $PROC_ENV{l7vsadm} ) {
+ ld_log( _message( 'FTL0101', $PROC_ENV{l7vsadm} ) );
+ return $current_service;
+ }
+ # read status of current l7vsadm -K -n
+ # -K indicates Key parameters of the module included.
+ my $list_command = $PROC_ENV{l7vsadm} . " -K -n";
+ my $cmd_result = qx{$list_command};
+ my @list_line = split /\n/, $cmd_result;
+
+ # skip below header
+ # [cf] Layer-7 Virtual Server version 2.0.0-0
+ # [cf] Prot LocalAddress:Port ProtoMod Scheduler Reschedule Protomod_key_string
+ # [cf] -> RemoteAddress:Port Forward Weight ActiveConn InactConn
+ shift @list_line; shift @list_line; shift @list_line;
+
+ for my $line (@list_line) {
+ # check virtual service line format
+ # [cf] TCP 192.168.0.4:12121 cinsert rr 0 --cookie-name CookieName
+ if ($line =~ /
+ ^ # top
+ (\w+) \s+ # 'TCP'
+ (\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}:\d{1,5}) \s+ # ip port
+ (\w+) \s+ # protocol module
+ \w+ \s+ # scheduler
+ (?:0|1) \s+ # reschedule flag
+ (.*) # module key
+ $ # end
+ /x
+ ) {
+ my ($proto, $ip_port, $module, $key) = ($1, $2, $3, $4);
+ # vip_id MUST be same format as get_virtual_id_str
+ $proto = lc $proto;
+ $vip_id = "$proto:$ip_port:$module $key";
+ $vip_id =~ s/\s+$//;
+ $current_service->{$vip_id} = undef;
+ next;
+ }
+ # check real server line format
+ # [cf] -> 192.168.0.4:7780 Masq 1 10 123456
+ if (defined $vip_id && $line =~ /
+ ^ # top
+ \s+ -> \s+ # arrow
+ (\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}):(\d{1,5}) \s+ # ip port
+ (\w+) \s+ # 'Masq'
+ (\d+) \s+ # weight
+ \d+ \s+ # active connections
+ \d+ \s* # inactive connections
+ $ # end
+ /x
+ ) {
+ my ($ip, $port, $forward, $weight) = ($1, $2, $3, $4);
+ my $ip_port = "$ip:$port";
+ my $real = {
+ server => { ip => $ip, port => $port },
+ weight => $weight,
+ forward => $forward,
+ option => {
+ flags => "-r $ip_port",
+ forward => get_forward_flag($forward),
+ },
+ };
+ $current_service->{$vip_id}{$ip_port} = $real;
+ }
+ }
+
+ return $current_service;
+}
+
+# ld_operate_virtual
+# Operate virtual service on l7vsd by l7vsadm command.
+sub ld_operate_virtual {
+ my ($v, $option, $success_code, $error_code) = @_;
+ if (!defined $v || !defined $option || !defined $success_code || !defined $error_code) {
+ ld_log( _message('ERR0501') );
+ return;
+ }
+
+ my $command = $PROC_ENV{l7vsadm} . " $option ";
+ if ($option ne '-D') {
+ $command .= $v->{option}{flags};
+ }
+ else {
+ $command .= $v->{option}{main};
+ }
+ $command .= ' 2>&1';
+
+ my ($result, $output) = command_wrapper($command);
+
+ my $module_key = $v->{module}{name};
+ if ( defined $v->{module}{key} ) {
+ $module_key .= q{ } . $v->{module}{key};
+ }
+ if ($result == 0) {
+ ld_log( _message($success_code, get_ip_port($v), $module_key) );
+ }
+ else {
+ ($output) = split /\n/, $output, 2;
+ ld_log( _message($error_code, get_ip_port($v), $module_key, $output) );
+ }
+}
+
+# ld_add_virtual
+# Call operate virtual with add option.
+sub ld_add_virtual {
+ my $v = shift;
+ ld_operate_virtual($v, '-A', 'INF0201', 'ERR0201');
+}
+
+# ld_edit_virtual
+# Call operate virtual with edit option.
+sub ld_edit_virtual {
+ my $v = shift;
+ ld_operate_virtual($v, '-E', 'INF0202', 'ERR0202');
+}
+
+# ld_delete_virtual
+# Call operate virtual with delete option.
+sub ld_delete_virtual {
+ my $v = shift;
+ ld_operate_virtual($v, '-D', 'INF0203', 'ERR0203');
+}
+
+# ld_operate_real
+# Operate real server on l7vsd by l7vsadm command.
+sub ld_operate_real {
+ my ($v, $r, $weight, $option, $success_code, $error_code) = @_;
+ if (!defined $v || !defined $r || !defined $option || !defined $success_code || !defined $error_code) {
+ ld_log( _message('ERR0501') );
+ return;
+ }
+
+ my $command
+ = $PROC_ENV{l7vsadm} . " $option " . $v->{option}{main} . q{ } . $r->{option}{flags};
+
+ # replace weight value
+ if (defined $weight) {
+ $command .= ' -w ' . $weight;
+ }
+ $command .= ' 2>&1';
+
+ my ($result, $output) = command_wrapper($command);
+
+ my $module_key = $v->{module}{name};
+ if ( defined $v->{module}{key} ) {
+ $module_key .= q{ } . $v->{module}{key};
+ }
+ if ($result == 0) {
+ ld_log( _message($success_code, get_ip_port($r), get_ip_port($v), $module_key, $weight) );
+ }
+ else {
+ ($output) = split /\n/, $output, 2;
+ ld_log( _message($error_code, get_ip_port($r), get_ip_port($v), $module_key, $output) );
+ }
+}
+
+# ld_add_real
+# Call operate real with add option.
+sub ld_add_real {
+ my ($v, $r, $weight) = @_;
+ ld_operate_real($v, $r, $weight, '-a', 'INF0204', 'ERR0204');
+}
+
+# ld_edit_real
+# Call operate real with edit option.
+sub ld_edit_real {
+ my ($v, $r, $weight) = @_;
+ ld_operate_real($v, $r, $weight, '-e', 'INF0205', 'ERR0205');
+}
+
+# ld_delete_real
+# Call operate real with delete option.
+sub ld_delete_real {
+ my ($v, $r) = @_;
+ ld_operate_real($v, $r, undef, '-d', 'INF0206', 'ERR0206');
+}
+
+# ld_start
+# Check l7vsd by l7vsadm command and create virtual service on l7vsd.
+sub ld_start {
+ # read status of current l7vsadm -K -n
+ my $current_service = ld_read_l7vsadm();
+ if (!defined $current_service) {
+ ld_log( _message('FTL0201') );
+ return;
+ }
+
+ my %old_health_check = %HEALTH_CHECK;
+ %HEALTH_CHECK = ();
+
+ # make sure virtual servers are up to date
+ if ( defined $CONFIG{virtual} ) {
+ for my $nv ( @{ $CONFIG{virtual} } ) {
+ my $vip_id = get_virtual_id_str($nv);
+ if (!defined $vip_id) {
+ ld_log( _message('ERR0502') );
+ return;
+ }
+
+ if ( exists( $current_service->{$vip_id} ) ) {
+ # service already exists, modify it
+ ld_edit_virtual($nv);
+ }
+ else {
+ # no such service, create a new one
+ ld_add_virtual($nv);
+ }
+
+ my $or = $current_service->{$vip_id} || {};
+
+ # Not delete fallback server from l7vsd if exist
+ my $fallback = fallback_find($nv);
+ if (defined $fallback) {
+ my $fallback_ip_port = get_ip_port( $fallback->{ $nv->{protocol} } );
+ delete $or->{$fallback_ip_port};
+ fallback_on($nv);
+ }
+
+ if ( defined $nv->{real} ) {
+ CHECK_REAL:
+ for my $nr ( @{ $nv->{real} } ) {
+ delete $or->{ get_ip_port($nr) };
+
+ my $health_check_id = get_health_check_id_str($nv, $nr);
+ if (!defined $health_check_id) {
+ ld_log( _message('ERR0503') );
+ return;
+ }
+
+ # search same health check process
+ if ( exists $HEALTH_CHECK{$health_check_id} ) {
+ # same health check process exist
+ # then check real server and virtual service ($r, $v)
+ for my $v_r_pair ( @{ $HEALTH_CHECK{$health_check_id}{manage} } ) {
+ # completely same. check next real server
+ next CHECK_REAL if ($nv eq $v_r_pair->[0] && $nr eq $v_r_pair->[1]);
+ }
+
+ # add real server and virtual service to management list
+ push @{ $HEALTH_CHECK{$health_check_id}{manage} }, [$nv, $nr];
+ }
+ else {
+ # add to health check process list
+ $HEALTH_CHECK{$health_check_id}{manage} = [ [$nv, $nr] ];
+ }
+ }
+ }
+
+ # remove remaining entries for real servers
+ for my $remove_real_ip_port (keys %$or) {
+ ld_delete_real( $nv, $or->{$remove_real_ip_port} );
+ delete $or->{$remove_real_ip_port};
+ }
+
+ delete $current_service->{$vip_id};
+ }
+ }
+
+ # terminate old health check process
+ # TODO should compare old and new, and only if different then re-create process...
+ for my $id (keys %old_health_check) {
+ # kill old health check process
+ if ( defined $old_health_check{$id}{pid} ) {
+ # TODO cannot kill process during pinging to unreachable host?
+ {
+ local $SIG{ALRM} = sub { die; };
+ kill 15, $old_health_check{$id}{pid};
+ eval {
+ alarm 3;
+ waitpid $old_health_check{$id}{pid}, 0;
+ alarm 0;
+ };
+ alarm 0;
+ if ($EVAL_ERROR) {
+ kill 9, $old_health_check{$id}{pid};
+ waitpid $old_health_check{$id}{pid}, WNOHANG;
+ }
+ }
+ }
+ }
+
+ # remove remaining entries for virtual servers
+ if ( defined $CONFIG{old_virtual} ) {
+ for my $nv ( @{ $CONFIG{old_virtual} } ) {
+ my $vip_id = get_virtual_id_str($nv);
+ if ( exists $current_service->{$vip_id} ) {
+ # service still exists, remove it
+ ld_delete_virtual($nv);
+ }
+ }
+ }
+ delete $CONFIG{old_virtual};
+}
+
+# ld_cmd_children
+# Run l7directord command to child process.
+# Child process is not health check process,
+# but sub config (specified by configuration with `execute') process.
+sub ld_cmd_children {
+ my $command_type = shift;
+ my $execute = shift;
+
+ # instantiate other l7directord, if specified
+ if (!defined $execute) {
+ if ( defined $CONFIG{execute} ) {
+ for my $sub_config ( keys %{ $CONFIG{execute} } ) {
+ if (defined $command_type && defined $sub_config) {
+ my $command = $PROC_ENV{l7directord} . " $sub_config $command_type";
+ system_wrapper($command);
+ }
+ }
+ }
+ }
+ else {
+ for my $sub_config ( keys %$execute ) {
+ if (defined $command_type && defined $sub_config) {
+ my $command = $PROC_ENV{l7directord} . " $sub_config $command_type";
+ system_wrapper($command);
+ }
+ }
+ }
+}
+
+# ld_stop
+# Remove virtual service for stopping this program.
+sub ld_stop {
+ my $srv = ld_read_l7vsadm();
+ if (!defined $srv) {
+ ld_log( _message('FTL0201') );
+ return;
+ }
+ if ( defined $CONFIG{virtual} ) {
+ for my $v ( @{ $CONFIG{virtual} } ) {
+ my $vid = get_virtual_id_str($v);
+ if (!defined $vid) {
+ ld_log( _message('ERR0502') );
+ return;
+ }
+ if ( exists $srv->{$vid} ) {
+ for my $rid ( keys %{ $srv->{$vid} } ) {
+ ld_delete_real( $v, $srv->{$vid}{$rid} );
+ }
+ }
+ ld_delete_virtual($v);
+ }
+ }
+}
+
+# ld_main
+# Main function of this program.
+# Create virtual service and loop below 3 steps.
+# 1. Check health check sub process and (re-)create sub process as needed
+# 2. Check signal in sleep and start to terminate program or reload config as needed
+# 3. Check config file and reload config as needed
+sub ld_main {
+ ld_start();
+
+ # Main failover checking code
+ MAIN_LOOP:
+ while (1) {
+ # manage real server check process.
+ REAL_CHECK:
+ while (1) {
+ my @id_lists = check_child_process();
+ # if child process is not running
+ if (@id_lists) {
+ create_check_process(@id_lists);
+ }
+ my $signal = sleep_and_check_signal( $CONFIG{configinterval} );
+ last MAIN_LOOP if defined $signal && $signal eq 'halt';
+ last REAL_CHECK if defined $signal && $signal eq 'reload';
+ last REAL_CHECK if check_cfgfile();
+ }
+
+ # reload config
+ reread_config();
+ }
+
+ # signal TERM to child process
+ for my $id (keys %HEALTH_CHECK) {
+ if ( defined $HEALTH_CHECK{$id}{pid} ) {
+ # TODO cannot kill process during pinging to unreachable host?
+ {
+ local $SIG{ALRM} = sub { die; };
+ kill 15, $HEALTH_CHECK{$id}{pid};
+ eval {
+ alarm 3;
+ waitpid $HEALTH_CHECK{$id}{pid}, 0;
+ alarm 0;
+ };
+ alarm 0;
+ if ($EVAL_ERROR) {
+ kill 9, $HEALTH_CHECK{$id}{pid};
+ waitpid $HEALTH_CHECK{$id}{pid}, WNOHANG;
+ }
+ }
+ }
+ }
+ ld_stop();
+}
+
+# check_child_process
+# Check health check process by signal zero.
+# return: Health check id list that (re-)created later.
+sub check_child_process {
+ my @down_process_ids = ();
+ for my $id (sort keys %HEALTH_CHECK) {
+ if ( !defined $HEALTH_CHECK{$id}{pid} ) {
+ # not create ever
+ ld_log( _message('INF0401', $id) );
+ push @down_process_ids, $id;
+ next;
+ }
+ # non-blocking wait for zombie process
+ waitpid(-1, WNOHANG); # TODO should move to sigchld handler?
+ # signal 0
+ my $signaled = kill 0, $HEALTH_CHECK{$id}{pid};
+ if ($signaled != 1) {
+ # maybe killed from outside
+ ld_log( _message('ERR0603', $HEALTH_CHECK{$id}{pid}, $id) );
+ push @down_process_ids, $id;
+ next;
+ }
+ }
+ return @down_process_ids;
+}
+
+# create_check_process
+# Fork health check sub process.
+# And health check sub process run health_check sub function.
+sub create_check_process {
+ my @id_lists = @_;
+ for my $health_check_id (@id_lists) {
+ my $pid = fork();
+ if ($pid > 0) {
+ ld_log( _message('INF0402', $pid, $health_check_id) );
+ $HEALTH_CHECK{$health_check_id}{pid} = $pid;
+ }
+ elsif ($pid == 0) {
+ $PROC_STAT{parent_pid} = $PROC_STAT{pid};
+ $PROC_STAT{pid} = $PID;
+ health_check( $HEALTH_CHECK{$health_check_id}{manage} );
+ }
+ else {
+ ld_log( _message('ERR0604', $health_check_id) );
+ }
+ sleep 1;
+ }
+}
+
+# health_check
+# Main function of health check process.
+# Loop below.
+# 1. Health check.
+# 2. Status change and reflect to l7vsd as needed.
+# 3. Check signal in sleep.
+# pre: v_r_list: reference list of virtual service and real server pair
+# $v_r_list = [ [$virtual, $real], [$virtual, $real], ... ];
+# return: none
+# MUST use POSIX::_exit when terminate sub process.
+sub health_check {
+ my $v_r_list = shift;
+ if (!defined $v_r_list) {
+ ld_log( _message('ERR0501') );
+ ld_log( _message('FTL0001') );
+ POSIX::_exit(1);
+ }
+
+ # you can use any virtual, real pair in $v_r_list.
+ my ($v, $r) = @{ $v_r_list->[0] };
+ if (!defined $v || !defined $r) {
+ ld_log( _message('FTL0002') );
+ POSIX::_exit(2);
+ }
+
+ my $health_check_func = get_check_func($v);
+ my $current_status = get_status($v_r_list);
+
+ my $status = 'STARTING';
+ my $type = $v->{checktype} eq 'negotiate' ? $v->{service}
+ : $v->{checktype} eq 'combined' ? $v->{service} . '(combined)'
+ : $v->{checktype}
+ ;
+ $PROGRAM_NAME = 'l7directord: ' . $type . ':' . get_ip_port($r) . ':' . $status;
+
+ while (1) {
+ # health check
+ my $service_status = &$health_check_func($v, $r);
+
+ if ($service_status == $SERVICE_DOWN) {
+ if (!defined $current_status || $current_status == $SERVICE_UP) {
+ $r->{fail_counts}++;
+ undef $r->{num_connects};
+ if ($r->{fail_counts} >= $v->{checkcount}) {
+ ld_log( _message( 'ERR0602', get_ip_port($r) ) );
+ service_set($v_r_list, 'down');
+ $current_status = $SERVICE_DOWN;
+ $status = 'DOWN';
+ $r->{fail_counts} = 0;
+ }
+ else {
+ ld_log( _message( 'WRN1001', get_ip_port($r), $v->{checkcount} - $r->{fail_counts} ) );
+ $status = sprintf "NG[%d/%d]", $r->{fail_counts}, $v->{checkcount};
+ }
+ }
+ }
+ if ($service_status == $SERVICE_UP) {
+ $r->{fail_counts} = 0;
+ if (!defined $current_status || $current_status == $SERVICE_DOWN) {
+ ld_log( _message( 'ERR0601', get_ip_port($r) ) );
+ service_set($v_r_list, 'up');
+ $current_status = $SERVICE_UP;
+ }
+ $status = 'UP';
+ }
+
+ $PROGRAM_NAME = 'l7directord: ' . $type . ':' . get_ip_port($r) . ':' . $status;
+
+ my $sleeptime = $r->{fail_counts} ? $v->{retryinterval} : $v->{checkinterval};
+ last if (sleep_and_check_signal($sleeptime, 1) eq 'halt');
+
+ my $parent_process = kill 0, $PROC_STAT{parent_pid};
+ if ($parent_process != 1) {
+ ld_log( _message( 'FTL0003', $PROC_STAT{parent_pid} ) );
+ POSIX::_exit(3);
+ }
+ }
+
+ ld_log( _message('INF0007') );
+ POSIX::_exit(0);
+}
+
+# sleep_and_check_signal
+# Check signal flag each 0.1 secound with sleeping specified seconds.
+sub sleep_and_check_signal {
+ my ($sec, $is_child) = @_;
+ if (!defined $sec || $sec !~ /^\d+$/) {
+ ld_log( _message('ERR0501') );
+ return 'halt';
+ }
+
+ my $sleeped = 0;
+ while ($sec > $sleeped) {
+ if ($is_child) {
+ if ( defined $PROC_STAT{halt} ) {
+ ld_log( _message( 'WRN0001', $CONFIG_FILE{path}, $PROC_STAT{halt} ) );
+ return 'halt';
+ }
+ }
+ else {
+ if ( defined $PROC_STAT{halt} ) {
+ ld_log( _message( 'WRN0001', $CONFIG_FILE{path}, $PROC_STAT{halt} ) );
+ return 'halt';
+ }
+ if ( defined $PROC_STAT{reload} ) {
+ ld_log( _message( 'WRN0002', $CONFIG_FILE{path}, $PROC_STAT{reload} ) );
+ undef $PROC_STAT{reload};
+ return 'reload';
+ }
+ }
+ sleep 0.1;
+ $sleeped += 0.1;
+ }
+ return 'run';
+}
+
+# get_check_func
+# Determine check function by checktype and service.
+sub get_check_func {
+ my $v = shift;
+ if (!defined $v) {
+ ld_log( _message('ERR0501') );
+ return \&check_off;
+ }
+
+ my $type = $v->{checktype};
+ my $service_func = {
+ http => \&check_http,
+ https => \&check_http,
+ pop => \&check_pop,
+ imap => \&check_imap,
+ smtp => \&check_smtp,
+ ftp => \&check_ftp,
+ ldap => \&check_ldap,
+ nntp => \&check_nntp,
+ dns => \&check_dns,
+ sip => \&check_sip,
+ mysql => \&check_mysql,
+ pgsql => \&check_pgsql,
+ };
+
+ if ( defined $type && ($type eq 'negotiate' || $type eq 'combined') ) {
+ if (defined $v->{service} && exists $service_func->{ $v->{service} } ) {
+ my $negotiate_func = $service_func->{ $v->{service} };
+ if ($type eq 'negotiate') {
+ return $negotiate_func;
+ }
+ elsif ($type eq 'combined') {
+ my $combined_func = make_combined_func($negotiate_func);
+ return $combined_func;
+ }
+ }
+ else {
+ return \&check_none;
+ }
+ }
+
+ if (defined $type && $type eq 'custom') {
+ my $custom_func = make_custom_func( $v->{customcheck} );
+ return $custom_func;
+ }
+
+ if (defined $type && $type eq 'connect') {
+ if (defined $v->{protocol} && $v->{protocol} eq 'tcp') {
+ return \&check_connect;
+ }
+ else {
+ return \&check_ping;
+ }
+ }
+
+ if (defined $type && $type eq 'ping') {
+ return \&check_ping;
+ }
+
+ if (defined $type && $type eq 'off') {
+ return \&check_off;
+ }
+
+ if (defined $type && $type eq 'on') {
+ return \&check_on;
+ }
+
+ return \&check_none;
+}
+
+# make_combined_func
+# Create combined function.
+sub make_combined_func {
+ my $negotiate_func = shift;
+ if (!defined $negotiate_func) {
+ ld_log( _message('ERR0504') );
+ return \&check_connect;
+ }
+
+ # closure
+ my $combined_func = sub {
+ my ($v, $r) = @_;
+ my $timing = $v->{num_connects};
+ my $connected = $r->{num_connects};
+
+ if (!defined $connected ||
+ (defined $timing && $timing <= $connected) ) {
+ $r->{num_connects} = 0;
+ return &$negotiate_func($v, $r);
+ }
+ else {
+ $r->{num_connects}++;
+ return check_connect($v, $r);
+ }
+ };
+
+ return $combined_func;
+}
+
+# make_custom_func
+# Create custom check function.
+sub make_custom_func {
+ my $customcheck = shift;
+ if (!defined $customcheck) {
+ ld_log( _message('ERR0505') );
+ return \&check_off;
+ }
+
+ # closure
+ my $custom_func = sub {
+ my ($v, $r) = @_;
+ my $status = get_status([[$v, $r]]);
+ my $port = defined $v->{checkport} ? $v->{checkport} : $r->{server}{port};
+ my $ip_port = $r->{server}{ip} . ':' . $port;
+
+ # expand macro
+ $customcheck =~ s/_IP_/$r->{server}{ip}/g;
+ $customcheck =~ s/_PORT_/$port/g;
+
+ my $res;
+ {
+ local $SIG{__DIE__} = 'DEFAULT';
+ local $SIG{ALRM} = sub { die "custom check timeout\n"; };
+ eval {
+ alarm $v->{negotiatetimeout};
+ $res = system_wrapper($customcheck);
+ alarm 0;
+ };
+ alarm 0;
+ if ($EVAL_ERROR) {
+ ld_log( _message('WRN3301', $v->{checktimeout}, $ip_port) ) if (!defined $status || $status eq $SERVICE_UP);
+ return $SERVICE_DOWN;
+ }
+ }
+ if ($res) {
+ ld_log( _message('WRN3302', $customcheck, $res) ) if (!defined $status || $status eq $SERVICE_UP);
+ return $SERVICE_DOWN;
+ }
+ ld_log( _message('WRN0215', $ip_port) ) if (!defined $status || $status eq $SERVICE_DOWN || $r->{fail_counts} > 0);
+ return $SERVICE_UP;
+ };
+
+ return $custom_func;
+}
+
+# check_http
+# HTTP service health check.
+# Send GET/HEAD request, and check response
+sub check_http {
+ require LWP::UserAgent;
+ require LWP::Debug;
+ if ( $DEBUG_LEVEL > 2 ) {
+ LWP::Debug::level('+');
+ }
+ my ( $v, $r ) = @_;
+ my $status = get_status([[$v, $r]]);
+
+ my $port = defined $v->{checkport} ? $v->{checkport} : $r->{server}{port};
+
+ if ( $r->{url} !~ m{^https?://([^:/]+)} ) {
+ ld_log( _message( 'WRN1101', $r->{url}, $r->{server}{ip}, $port ) ) if (!defined $status || $status eq $SERVICE_UP);
+ return $SERVICE_DOWN;
+ }
+ my $host = $1;
+ my $virtualhost = defined $v->{virtualhost} ? $v->{virtualhost} : $host;
+
+ ld_debug(2, "check_http: url=\"$r->{url}\" " . "virtualhost=\"$virtualhost\"");
+
+ my $ua = LWP::UserAgent->new( timeout => $v->{negotiatetimeout} );
+ my $req = new HTTP::Request( $v->{httpmethod}, $r->{url}, [ Host => $virtualhost ] );
+ my $res;
+ {
+ # LWP makes ungaurded calls to eval
+ # which throw a fatal exception if they fail
+ local $SIG{__DIE__} = 'DEFAULT';
+ local $SIG{ALRM} = sub { die "Can't connect to $r->{server}{ip}:$port (connect: timeout)\n"; };
+ eval {
+ alarm $v->{negotiatetimeout};
+ $res = $ua->request($req);
+ alarm 0;
+ };
+ alarm 0;
+ }
+
+ my $status_line = $res->status_line;
+ $status_line =~ s/[\r\n]//g;
+
+ my $recstr = $r->{receive};
+ if (!$res->is_success) {
+ ld_log( _message( 'WRN1102', $status_line, $r->{server}{ip}, $port ) ) if (!defined $status || $status eq $SERVICE_UP);
+ return $SERVICE_DOWN;
+ }
+ elsif (defined $recstr && $res->as_string !~ /$recstr/) {
+ ld_log( _message( 'WRN1103', $recstr, $r->{server}{ip}, $port ) ) if (!defined $status || $status eq $SERVICE_UP);
+ ld_debug(3, "Headers " . $res->headers->as_string);
+ ld_debug(2, "check_http: $r->{url} is down\n");
+ return $SERVICE_DOWN;
+ }
+
+ ld_debug(2, "check_http: $r->{url} is up\n");
+ ld_log( _message( 'WRN0203', $status_line, $r->{server}{ip}, $port ) ) if (!defined $status || $status eq $SERVICE_DOWN || $r->{fail_counts} > 0);
+ return $SERVICE_UP;
+}
+
+# check_smtp
+# SMTP service health check.
+# Connect SMTP server and check first response
+sub check_smtp {
+ require Net::SMTP;
+ my ($v, $r) = @_;
+ my $status = get_status([[$v, $r]]);
+
+ my $port = defined $v->{checkport} ? $v->{checkport} : $r->{server}{port};
+
+ ld_debug(2, "Checking http: server=$r->{server}{ip} port=$port");
+ my $debug_flag = $DEBUG_LEVEL ? 1 : 0;
+
+ my $smtp = Net::SMTP->new(
+ $r->{server}{ip},
+ Port => $port,
+ Timeout => $v->{negotiatetimeout},
+ Debug => $debug_flag,
+ );
+ if (!$smtp) {
+ ld_log( _message('WRN1201', $r->{server}{ip}, $port) ) if (!defined $status || $status eq $SERVICE_UP);
+ return $SERVICE_DOWN;
+ }
+ $smtp->quit;
+
+ ld_log( _message('WRN0204', $r->{server}{ip}, $port) ) if (!defined $status || $status eq $SERVICE_DOWN || $r->{fail_counts} > 0);
+ return $SERVICE_UP;
+}
+
+# check_pop
+# POP3 service health check.
+# Connect POP3 server and login if user-pass specified.
+sub check_pop {
+ require Net::POP3;
+ my ($v, $r) = @_;
+ my $status = get_status([[$v, $r]]);
+
+ my $port = defined $v->{checkport} ? $v->{checkport} : $r->{server}{port};
+
+ ld_debug(2, "Checking pop server=$r->{server}{ip} port=$port");
+ my $debug_flag = $DEBUG_LEVEL ? 1 : 0;
+
+ my $pop = Net::POP3->new(
+ $r->{server}{ip},
+ Port => $port,
+ Timeout => $v->{negotiatetimeout},
+ Debug => $debug_flag,
+ );
+ if (!$pop) {
+ ld_log( _message('WRN1301', $r->{server}{ip}, $port) ) if (!defined $status || $status eq $SERVICE_UP);
+ return $SERVICE_DOWN;
+ }
+
+ if ( defined $v->{login} && defined $v->{passwd} && $v->{login} ne q{} ) {
+ $pop->user( $v->{login} );
+ my $num = $pop->pass( $v->{passwd} );
+ if (!defined $num) {
+ ld_log( _message('WRN1302', $r->{server}{ip}, $port) ) if (!defined $status || $status eq $SERVICE_UP);
+ $pop->quit();
+ return $SERVICE_DOWN;
+ }
+ }
+ $pop->quit();
+
+ ld_log( _message('WRN0205', $r->{server}{ip}, $port) ) if (!defined $status || $status eq $SERVICE_DOWN || $r->{fail_counts} > 0);
+ return $SERVICE_UP;
+}
+
+# check_imap
+# IMAP service health check.
+# Connect IMAP server and login if user-pass specified.
+sub check_imap {
+ require Mail::IMAPClient;
+ my ($v, $r) = @_;
+ my $status = get_status([[$v, $r]]);
+
+ my $port = defined $v->{checkport} ? $v->{checkport} : $r->{server}{port};
+
+ ld_debug(2, "Checking imap server=$r->{server}{ip} port=$port");
+ my $debug_flag = $DEBUG_LEVEL ? 1 : 0;
+
+ my $imap;
+ {
+ local $SIG{ALRM} = sub { die "Connection timeout\n"; };
+ eval {
+ alarm $v->{negotiatetimeout};
+ $imap = Mail::IMAPClient->new(
+ Server => $r->{server}{ip},
+ Port => $port,
+ Timeout => $v->{negotiatetimeout},
+ Debug => $debug_flag,
+ );
+ alarm 0;
+ };
+ alarm 0;
+ if ($EVAL_ERROR) {
+ ld_log( _message('WRN1403', $v->{negotiatetimeout}, $r->{server}{ip}, $port) ) if (!defined $status || $status eq $SERVICE_UP);
+ return $SERVICE_DOWN;
+ }
+ }
+ if (!$imap) {
+ ld_log( _message('WRN1401', $r->{server}{ip}, $port) ) if (!defined $status || $status eq $SERVICE_UP);
+ return $SERVICE_DOWN;
+ }
+
+ if ( defined $v->{login} && defined $v->{passwd} && $v->{login} ne q{} ) {
+ $imap->User( $v->{login} );
+ $imap->Password( $v->{passwd} );
+ my $authres = $imap->login();
+ if (!$authres) {
+ ld_log( _message('WRN1402', $r->{server}{ip}, $port) ) if (!defined $status || $status eq $SERVICE_UP);
+ $imap->logout();
+ return $SERVICE_DOWN;
+ }
+ }
+ $imap->logout();
+
+ ld_log( _message('WRN0206', $r->{server}{ip}, $port) ) if (!defined $status || $status eq $SERVICE_DOWN || $r->{fail_counts} > 0);
+ return $SERVICE_UP;
+}
+
+# check_ldap
+# LDAP service health check.
+# Connect LDAP server and search if base-DN specified by 'request'
+sub check_ldap {
+ require Net::LDAP;
+ my ($v, $r) = @_;
+ my $status = get_status([[$v, $r]]);
+
+ my $port = defined $v->{checkport} ? $v->{checkport} : $r->{server}{port};
+
+ ld_debug(2, "Checking ldap server=$r->{server}{ip} port=$port");
+ my $debug_flag = $DEBUG_LEVEL ? 15 : 0;
+
+ my $ldap = Net::LDAP->new(
+ $r->{server}{ip},
+ port => $port,
+ timeout => $v->{negotiatetimeout},
+ debug => $debug_flag,
+ );
+ if (!$ldap) {
+ ld_log( _message('WRN1501', $r->{server}{ip}, $port) ) if (!defined $status || $status eq $SERVICE_UP);
+ return $SERVICE_DOWN;
+ }
+
+ my $mesg;
+ {
+ local $SIG{ALRM} = sub { die "Connection timeout\n"; };
+ eval {
+ alarm $v->{negotiatetimeout};
+ $mesg = $ldap->bind;
+ alarm 0;
+ };
+ alarm 0;
+ if ($EVAL_ERROR) {
+ ld_log( _message('WRN1502', $v->{negotiatetimeout}, $r->{server}{ip}, $port) ) if (!defined $status || $status eq $SERVICE_UP);
+ return $SERVICE_DOWN;
+ }
+ }
+ if ($mesg->is_error) {
+ ld_log( _message('WRN1503', $r->{server}{ip}, $port) ) if (!defined $status || $status eq $SERVICE_UP);
+ return $SERVICE_DOWN;
+ }
+
+ if ( defined $r->{request} && $r->{request} ne q{} ) {
+ ld_debug( 4, "Base : " . $r->{request} );
+ my $result = $ldap->search(
+ base => $r->{request},
+ scope => 'base',
+ filter => '(objectClass=*)',
+ );
+
+ if ($result->count != 1) {
+ ld_log( _message('WRN1504', $result->count, $r->{server}{ip}, $port) ) if (!defined $status || $status eq $SERVICE_UP);
+ $ldap->unbind;
+ return $SERVICE_DOWN;
+ }
+
+ if ( defined $r->{receive} ) {
+ my $href = $result->as_struct;
+ my @arrayOfDNs = keys %$href;
+ my $recstr = $r->{receive};
+ if ($recstr =~ /.+/ && $arrayOfDNs[0] !~ /$recstr/) {
+ ld_log( _message('WRN1505', $recstr, $r->{server}{ip}, $port) ) if (!defined $status || $status eq $SERVICE_UP);
+ $ldap->unbind;
+ return $SERVICE_DOWN;
+ }
+ }
+ }
+ $ldap->unbind;
+
+ ld_log( _message('WRN0207', $r->{server}{ip}, $port) ) if (!defined $status || $status eq $SERVICE_DOWN || $r->{fail_counts} > 0);
+ return $SERVICE_UP;
+}
+
+# check_nntp
+# NNTP service health check.
+# Connect NNTP server and check response start with '2**'
+sub check_nntp {
+ require IO::Socket;
+ require IO::Select;
+ my ($v, $r) = @_;
+ my $status = get_status([[$v, $r]]);
+
+ my $port = defined $v->{checkport} ? $v->{checkport} : $r->{server}{port};
+
+ ld_debug(2, "Checking nntp server=$r->{server}{ip} port=$port");
+
+ my $sock = ld_open_socket( $r->{server}{ip}, $port, $v->{protocol}, $v->{negotiatetimeout} );
+ if (!$sock) {
+ ld_log( _message('WRN1601', $r->{server}{ip}, $port) ) if (!defined $status || $status eq $SERVICE_UP);
+ return $SERVICE_DOWN;
+ }
+
+ ld_debug(3, "Connected to $r->{server}{ip} (port $port)");
+ my $select = IO::Select->new();
+ $select->add($sock);
+ if ( !defined $select->can_read( $v->{negotiatetimeout} ) ) {
+ ld_log( _message('WRN1602', $v->{negotiatetimeout}, $r->{server}{ip}, $port) ) if (!defined $status || $status eq $SERVICE_UP);
+ $select->remove($sock);
+ $sock->close;
+ return $SERVICE_DOWN;
+ }
+
+ my $buf;
+ sysread $sock, $buf, 64;
+ $select->remove($sock);
+ $sock->close;
+ my ($response) = split /[\r\n]/, $buf;
+
+ if ($response !~ /^2/) {
+ ld_log( _message('WRN1603', $response, $r->{server}{ip}, $port) ) if (!defined $status || $status eq $SERVICE_UP);
+ return $SERVICE_DOWN;
+ }
+
+ ld_log( _message('WRN0208', $response, $r->{server}{ip}, $port) ) if (!defined $status || $status eq $SERVICE_DOWN || $r->{fail_counts} > 0);
+ return $SERVICE_UP;
+}
+
+# check_mysql
+# MySQL service health check.
+# call check_sql and use MySQL driver
+sub check_mysql {
+ return check_sql(@_, 'mysql', 'database');
+}
+
+# check_pgsql
+# PostgreSQL service health check.
+# call check_sql and use PostgreSQL driver
+sub check_pgsql {
+ return check_sql(@_, 'Pg', 'dbname');
+}
+
+# check_sql
+# DBI service health check.
+# Login DB and send query if query specified by 'request', check result row number same as 'receive'
+sub check_sql {
+ require DBI;
+ my ($v, $r, $dbd, $dbname) = @_;
+ my $status = get_status([[$v, $r]]);
+
+ my $port = defined $v->{checkport} ? $v->{checkport} : $r->{server}{port};
+
+ if ( !defined $v->{login} || !defined $v->{passwd} || !defined $v->{database} ||
+ $v->{login} eq q{} || $v->{database} eq q{} ) {
+ ld_log( _message('WRN1701', $r->{server}{ip}, $port) ) if (!defined $status || $status eq $SERVICE_UP);
+ return $SERVICE_DOWN;
+ }
+
+ ld_debug(2, "Checking $v->{server}{ip} server=$r->{server}{ip} port=$port\n");
+
+ my $mask = POSIX::SigSet->new(SIGALRM);
+ my $action = POSIX::SigAction->new(
+ sub { die "Connection timeout\n" },
+ $mask,
+ );
+ my $oldaction = POSIX::SigAction->new();
+ sigaction(SIGALRM, $action, $oldaction);
+
+ my $dbh;
+ eval {
+ alarm $v->{negotiatetimeout};
+
+ DBI->trace(15) if $DEBUG_LEVEL;
+ $dbh = DBI->connect( "dbi:$dbd:$dbname=$v->{database};host=$r->{server}{ip};port=$port", $v->{login}, $v->{passwd} );
+ DBI->trace(0);
+
+ if (!defined $dbh) {
+ alarm 0;
+ sigaction(SIGALRM, $oldaction);
+ ld_log( _message('WRN1702', $r->{server}{ip}, $port) ) if (!defined $status || $status eq $SERVICE_UP);
+ die;
+ }
+
+ local $dbh->{TraceLevel} = $DEBUG_LEVEL ? 15 : 0;
+
+ my $rows = 0;
+
+ if ( defined $r->{request} && $r->{request} ne q{} ) {
+ my $sth = $dbh->prepare( $r->{request} );
+ $rows = $sth->execute;
+ $sth->finish;
+ }
+
+ $dbh->disconnect;
+
+ alarm 0;
+ sigaction(SIGALRM, $oldaction);
+
+ if ( defined $r->{request} && $r->{request} ne q{} ) {
+ ld_debug(4, "Database search returned $rows rows");
+ if ($rows == 0) {
+ ld_log( _message('WRN1703', $r->{server}{ip}, $port) ) if (!defined $status || $status eq $SERVICE_UP);
+ die;
+ }
+ # If user defined a receive string (number of rows returned), only do
+ # the check if the previous fetchall_arrayref succeeded.
+ if (defined $r->{receive} && $r->{receive} =~ /^\d+$/) {
+ # Receive string specifies an exact number of rows
+ if ( $rows ne $r->{receive} ) {
+ ld_log( _message('WRN1704', $r->{receive}, $rows, $r->{server}{ip}, $port) ) if (!defined $status || $status eq $SERVICE_UP);
+ die;
+ }
+ }
+ }
+ };
+ alarm 0;
+ sigaction(SIGALRM, $oldaction);
+ if ($EVAL_ERROR) {
+ if ($EVAL_ERROR eq "Connection timeout\n") {
+ ld_log( _message('WRN1705', $v->{negotiatetimeout}, $r->{server}{ip}, $port) ) if (!defined $status || $status eq $SERVICE_UP);
+ }
+ return $SERVICE_DOWN;
+ }
+
+ ld_log( _message('WRN0209', $r->{server}{ip}, $port) ) if (!defined $status || $status eq $SERVICE_DOWN || $r->{fail_counts} > 0);
+ return $SERVICE_UP;
+}
+
+# check_connect
+# Connect service health check.
+# Just connect port and close.
+sub check_connect {
+ my ($v, $r) = @_;
+ my $status = get_status([[$v, $r]]);
+
+ my $port = defined $v->{checkport} ? $v->{checkport} : $r->{server}{port};
+
+ ld_debug(2, "Checking connect: real server=$r->{server}{ip}:$port");
+
+ my $sock = ld_open_socket( $r->{server}{ip}, $port, $v->{protocol}, $v->{checktimeout} );
+ if (!defined $sock) {
+ ld_log( _message('WRN3201', $ERRNO, $r->{server}{ip}, $port) ) if (!defined $status || $status eq $SERVICE_UP);
+ return $SERVICE_DOWN;
+ }
+ close($sock);
+
+ ld_debug(3, "Connected to: (port $port)");
+
+ ld_log( _message('WRN0210', $r->{server}{ip}, $port) ) if (!defined $status || $status eq $SERVICE_DOWN || $r->{fail_counts} > 0);
+ return $SERVICE_UP;
+}
+
+# check_sip
+# SIP service health check.
+# Send SIP OPTIONS request and check 200 response
+sub check_sip {
+ my ($v, $r) = @_;
+ my $status = get_status([[$v, $r]]);
+
+ my $port = defined $v->{checkport} ? $v->{checkport} : $r->{server}{port};
+
+ ld_debug(2, "Checking sip server=$r->{server}{ip} port=$port");
+
+ if ( !defined $v->{login} ) {
+ ld_log( _message('WRN1801', $r->{server}{ip}, $port) ) if (!defined $status || $status eq $SERVICE_UP);
+ return $SERVICE_DOWN;
+ }
+
+ my $sock = ld_open_socket( $r->{server}{ip}, $port, $v->{protocol}, $v->{negotiatetimeout} );
+ if (!defined $sock) {
+ ld_log( _message('WRN1802', $r->{server}{ip}, $port) ) if (!defined $status || $status eq $SERVICE_UP);
+ return $SERVICE_DOWN;
+ }
+
+ my $sip_s_addr = $sock->sockhost;
+ my $sip_s_port = $sock->sockport;
+
+ ld_debug(3, "Connected from $sip_s_addr:$sip_s_port to " . $r->{server} . ":$port");
+
+ my $id = $v->{login};
+ my $request =
+ "OPTIONS sip:$id SIP/2.0\r\n"
+ . "Via: SIP/2.0/UDP $sip_s_addr:$sip_s_port;branch=z9hG4bKhjhs8ass877\r\n"
+ . "Max-Forwards: 70\r\n"
+ . "To: <sip:$id>\r\n"
+ . "From: <sip:$id>;tag=1928301774\r\n"
+ . "Call-ID: a84b4c76e66710\r\n"
+ . "CSeq: 63104 OPTIONS\r\n"
+ . "Contact: <sip:$id>\r\n"
+ . "Accept: application/sdp\r\n"
+ . "Content-Length: 0\r\n"
+ . "\r\n";
+
+ ld_debug(3, "Request:\n$request");
+
+ my $response;
+ eval {
+ local $SIG{__DIE__} = 'DEFAULT';
+ local $SIG{ALRM } = sub { die "Connection timeout\n"; };
+ ld_debug(4, "Timeout is $v->{negotiatetimeout}");
+ alarm $v->{negotiatetimeout};
+
+ print {$sock} $request;
+ $response = <$sock>;
+ close $sock;
+ alarm 0;
+
+ ld_debug(3, "Response:\n$response");
+
+ if ( $response !~ m{^SIP/2\.0 200 OK} ) {
+ ld_log( _message('WRN1803', $response, $r->{server}{ip}, $port) ) if (!defined $status || $status eq $SERVICE_UP);
+ die;
+ }
+ };
+ alarm 0;
+ if ($EVAL_ERROR) {
+ if ($EVAL_ERROR eq "Connection timeout\n") {
+ ld_log( _message('WRN1804', $v->{negotiatetimeout}, $r->{server}{ip}, $port) ) if (!defined $status || $status eq $SERVICE_UP);
+ }
+ return $SERVICE_DOWN;
+ }
+
+ ld_log( _message('WRN0211', $response, $r->{server}{ip}, $port) ) if (!defined $status || $status eq $SERVICE_DOWN || $r->{fail_counts} > 0);
+ return $SERVICE_UP;
+}
+
+# check_ftp
+# FTP service health check.
+# Login server and get file if 'request' specified, and check file include 'receive' string
+sub check_ftp {
+ require Net::FTP;
+ my ($v, $r) = @_;
+ my $status = get_status([[$v, $r]]);
+
+ my $ip_port = get_ip_port($r, $v->{checkport});
+
+ ld_debug(2, "Checking ftp server=$ip_port");
+ my $debug_flag = $DEBUG_LEVEL ? 1 : 0;
+
+ if ( !defined $v->{login} || !defined $v->{passwd} || $v->{login} eq q{} ) {
+ ld_log( _message('WRN1901', $ip_port) ) if (!defined $status || $status eq $SERVICE_UP);
+ return $SERVICE_DOWN;
+ }
+
+ my $ftp = Net::FTP->new(
+ $ip_port,
+ Timeout => $v->{negotiatetimeout},
+ Passive => 1,
+ Debug => $debug_flag,
+ );
+ if (!defined $ftp) {
+ ld_log( _message('WRN1902', $ip_port) ) if (!defined $status || $status eq $SERVICE_UP);
+ return $SERVICE_DOWN;
+ }
+ if ( !$ftp->login( $v->{login}, $v->{passwd} ) ) {
+ ld_log( _message('WRN1903', $ip_port) ) if (!defined $status || $status eq $SERVICE_UP);
+ $ftp->quit();
+ return $SERVICE_DOWN;
+ }
+ if ( !$ftp->cwd('/') ) {
+ ld_log( _message('WRN1904', $ip_port) ) if (!defined $status || $status eq $SERVICE_UP);
+ $ftp->quit();
+ return $SERVICE_DOWN;
+ }
+ if ( $r->{request} ) {
+ my $fail_flag = 0;
+ eval {
+ local $SIG{__DIE__} = 'DEFAULT';
+ local $SIG{ALRM } = sub { die "Connection timeout\n"; };
+ alarm $v->{negotiatetimeout};
+
+ open my $tmp, '+>', undef;
+ $ftp->binary();
+ if ( !$ftp->get( $r->{request}, *$tmp ) ) {
+ alarm 0;
+ ld_log( _message('WRN1905', $r->{request}, $ip_port) ) if (!defined $status || $status eq $SERVICE_UP);
+ close $tmp;
+ $ftp->quit();
+ $fail_flag = 1;
+ }
+ elsif ( $r->{receive} ) {
+ seek $tmp, 0, 0;
+ local $/;
+ my $memory = <$tmp>;
+ close $tmp;
+ if ($memory !~ /$r->{receive}/) {
+ alarm 0;
+ $ftp->quit();
+ ld_log( _message('WRN1906', $r->{receive}, $r->{request}, $ip_port) ) if (!defined $status || $status eq $SERVICE_UP);
+ $fail_flag = 1;
+ }
+ }
+ };
+ alarm 0;
+ if ($EVAL_ERROR) {
+ $ftp->quit();
+ my $error_message = $EVAL_ERROR;
+ $error_message =~ s/[\r\n]//g;
+ if ($error_message eq 'Connection timeout') {
+ ld_log( _message('WRN1908', $v->{negotiatetimeout}, $ip_port) ) if (!defined $status || $status eq $SERVICE_UP);
+ }
+ else {
+ ld_log( _message('WRN1907', $error_message, $ip_port) ) if (!defined $status || $status eq $SERVICE_UP);
+ }
+ return $SERVICE_DOWN;
+ }
+ if ($fail_flag) {
+ $ftp->quit();
+ return $SERVICE_DOWN;
+ }
+ }
+ $ftp->quit();
+
+ ld_log( _message('WRN0212', $ip_port) ) if (!defined $status || $status eq $SERVICE_DOWN || $r->{fail_counts} > 0);
+ return $SERVICE_UP;
+}
+
+# check_dns
+# DNS service health check.
+# Connect server and search 'request' A or PTR record and check result include 'response' string
+sub check_dns {
+ my ($v, $r) = @_;
+ my $status = get_status([[$v, $r]]);
+
+ my $port = defined $v->{checkport} ? $v->{checkport} : $r->{server}{port};
+
+ {
+ # Net::DNS makes ungaurded calls to eval
+ # which throw a fatal exception if they fail
+ local $SIG{__DIE__} = 'DEFAULT';
+ require Net::DNS;
+ }
+ my $res = Net::DNS::Resolver->new();
+
+ if ($DEBUG_LEVEL) {
+ $res->debug(1);
+ }
+
+ if ( !defined $r->{request} || $r->{request} eq q{} || !defined $r->{receive} || $r->{receive} eq q{} ) {
+ ld_log( _message('WRN2001', $r->{server}{ip}, $port) ) if (!defined $status || $status eq $SERVICE_UP);
+ return $SERVICE_DOWN;
+ }
+ ld_debug( 2, qq(Checking dns: request="$r->{request}" receive="$r->{receive}"\n) );
+
+ my $packet;
+ eval {
+ local $SIG{__DIE__} = 'DEFAULT';
+ local $SIG{ALRM } = sub { die "Connection timeout\n"; };
+ alarm $v->{negotiatetimeout};
+ $res->nameservers( $r->{server}{ip} );
+ $res->port($port);
+ $packet = $res->search( $r->{request} );
+ alarm 0;
+ };
+ alarm 0;
+ if ($EVAL_ERROR) {
+ if ($EVAL_ERROR eq "Connection timeout\n") {
+ ld_log( _message('WRN2002', $v->{negotiatetimeout}, $r->{server}{ip}, $port) ) if (!defined $status || $status eq $SERVICE_UP);
+ }
+ else {
+ ld_log( _message('WRN2003', $EVAL_ERROR, $r->{server}{ip}, $port) ) if (!defined $status || $status eq $SERVICE_UP);
+ }
+ return $SERVICE_DOWN;
+ }
+ if (!$packet) {
+ ld_log( _message('WRN2004', $r->{request}, $r->{server}{ip}, $port) ) if (!defined $status || $status eq $SERVICE_UP);
+ return $SERVICE_DOWN;
+ }
+
+ my $match = 0;
+ for my $rr ($packet->answer) {
+ if ( ( $rr->type eq 'A' && $rr->address eq $r->{receive} )
+ || ( $rr->type eq 'PTR' && $rr->ptrdname eq $r->{receive} ) ) {
+ $match = 1;
+ last;
+ }
+ }
+ if (!$match) {
+ ld_log( _message('WRN2005', $r->{receive}, $r->{server}{ip}, $port) ) if (!defined $status || $status eq $SERVICE_UP);
+ return $SERVICE_DOWN;
+ }
+
+ ld_log( _message('WRN0213', $r->{server}{ip}, $port) ) if (!defined $status || $status eq $SERVICE_DOWN || $r->{fail_counts} > 0);
+ return $SERVICE_UP;
+}
+
+# check_ping
+# ICMP ping service health check.
+# Ping server and check response.
+sub check_ping {
+ require Net::Ping;
+ my ($v, $r) = @_;
+ my $status = get_status([[$v, $r]]);
+
+ ld_debug( 2, qq(Checking ping: host="$r->{server}{ip}" checktimeout="$v->{checktimeout}"\n) );
+
+ my $p = Net::Ping->new('icmp', 1, 64);
+ if ( !$p->ping( $r->{server}{ip}, $v->{checktimeout} ) ) {
+ ld_log( _message('WRN3101', $v->{checktimeout}, $r->{server}{ip}) ) if (!defined $status || $status eq $SERVICE_UP);
+ return $SERVICE_DOWN;
+ }
+
+ ld_log( _message('WRN0214', $r->{server}{ip}) ) if (!defined $status || $status eq $SERVICE_DOWN || $r->{fail_counts} > 0);
+ return $SERVICE_UP;
+}
+
+# check_none
+# Dummy function to check service if service type is none.
+# Just activates the real server
+sub check_none {
+ my ($v, $r) = @_;
+ ld_debug(2, "Checking none");
+ return $SERVICE_UP;
+}
+
+# check_off
+# Check nothing and always return $SERVICE_DOWN
+sub check_off {
+ my ($v, $r) = @_;
+ return $SERVICE_DOWN;
+}
+
+# check_on
+# Check nothing and always return $SERVICE_UP
+sub check_on {
+ my ($v, $r) = @_;
+ return $SERVICE_UP;
+}
+
+# service_set
+# Used to bring up and down real servers.
+# This is the function you should call if you want to bring a real
+# server up or down.
+# This function is safe to call regrdless of the current state of a
+# real server.
+# Do _not_ call _service_up or _service_down directly.
+# pre: v_r_list: virtual and real pair list
+# [ [$v, $r], [$v, $r] ... ]
+# state: up or down
+# up to bring the real service up
+# down to bring the real service up
+# post: The real server is brough up or down for each virtual service
+# it belongs to.
+# return: none
+sub service_set {
+ my ($v_r_list, $state) = @_;
+
+ if (defined $state && $state eq 'up') {
+ _service_up($v_r_list);
+ }
+ elsif (defined $state && $state eq 'down') {
+ _service_down($v_r_list);
+ }
+}
+
+# _service_up
+# Bring a real service up if it is down
+# Should be called by service_set only
+# I.e. If you want to change the state of a real server call service_set.
+# If you call this function directly then l7directord will lose track
+# of the state of real servers.
+# pre: v_r_list: virtual and real pair list
+# [ [$v, $r], [$v, $r] ... ]
+# post: real service is taken up from the respective virtual service
+# if it is inactive
+# return: none
+sub _service_up {
+ my $v_r_list = shift;
+ if ( !_status_up($v_r_list) ) {
+ return;
+ }
+
+ for my $v_r_pair (@$v_r_list) {
+ my ($v, $r) = @$v_r_pair;
+ _restore_service($v, $r, 'real');
+ fallback_off($v);
+ }
+}
+
+# _service_down
+# Bring a real service down if it is up
+# Should be called by service_set only
+# I.e. if you want to change the state of a real server call service_set.
+# If you call this function directly then l7directord will lose track
+# of the state of real servers.
+# pre: v_r_list: virtual and real pair list
+# [ [$v, $r], [$v, $r] ... ]
+# post: real service is taken down from the respective virtual service
+# if it is active
+# return: none
+sub _service_down {
+ my $v_r_list = shift;
+ if ( !_status_down($v_r_list) ) {
+ return;
+ }
+
+ for my $v_r_pair (@$v_r_list) {
+ my ($v, $r) = @$v_r_pair;
+ _remove_service($v, $r, 'real');
+ fallback_on($v);
+ }
+}
+
+# _status_up
+# Set the status of a server as up
+# Should only be called from _service_up or fallback_on
+sub _status_up {
+ my ($v_r_list, $is_fallback) = @_;
+ if (!defined $v_r_list) {
+ return 0;
+ }
+
+ if (!$is_fallback) {
+ my $current_status = get_status($v_r_list);
+ if (defined $current_status && $current_status eq $SERVICE_UP) {
+ return 0;
+ }
+
+ my $id = get_health_check_id_str( @{ $v_r_list->[0] } );
+ if (!defined $id) {
+ ld_log( _message('ERR0503') );
+ return 0;
+ }
+ $HEALTH_CHECK{$id}{status} = $SERVICE_UP;
+
+ return 1;
+ }
+ else {
+ my $current_service = ld_read_l7vsadm();
+ if (!defined $current_service) {
+ ld_log( _message('FTL0201') );
+ return 0;
+ }
+ my $vid = get_virtual_id_str( $v_r_list->[0][0] );
+ if ( exists $current_service->{$vid} ) {
+ # no real server
+ if ( !defined $current_service->{$vid} ) {
+ return 1;
+ }
+ my $weight = 0;
+ # all real server's weight are zero.
+ for my $real ( keys %{ $current_service->{$vid} } ) {
+ # already added fallback server.
+ if ( $real eq get_ip_port( $v_r_list->[0][1] ) ) {
+ return 0;
+ }
+ $weight += $current_service->{$vid}{$real}{weight};
+ }
+ if ($weight == 0) {
+ return 1;
+ }
+ }
+ return 0;
+ }
+}
+
+# _status_down
+# Set the status of a server as down
+# Should only be called from _service_down or _ld_stop
+sub _status_down {
+ my ($v_r_list, $is_fallback) = (@_);
+ if (!defined $v_r_list) {
+ return 0;
+ }
+
+ if (!$is_fallback) {
+ my $current_status = get_status($v_r_list);
+ if ($current_status && $current_status eq $SERVICE_DOWN) {
+ return 0;
+ }
+
+ my $id = get_health_check_id_str( @{ $v_r_list->[0] } );
+ if (!defined $id) {
+ ld_log( _message('ERR0503') );
+ return 0;
+ }
+ $HEALTH_CHECK{$id}{status} = $SERVICE_DOWN;
+
+ return 1;
+ }
+ else {
+ my $current_service = ld_read_l7vsadm();
+ if (!defined $current_service) {
+ ld_log( _message('FTL0201') );
+ return 0;
+ }
+ my $vid = get_virtual_id_str( $v_r_list->[0][0] );
+ if ( defined $current_service->{$vid} ) {
+ my $weight = 0;
+ my $fallback_exist = 0;
+ # any real server has weight.
+ for my $real ( keys %{ $current_service->{$vid} } ) {
+ if ( $real eq get_ip_port( $v_r_list->[0][1] ) ) {
+ $fallback_exist = 1;
+ }
+ $weight += $current_service->{$vid}{$real}{weight};
+ }
+ if ($fallback_exist && $weight) {
+ return 1;
+ }
+ }
+ return 0;
+ }
+}
+
+# get_status
+# Get health check server status
+# return $SERVICE_UP / $SERVICE_DOWN
+sub get_status {
+ my $v_r_list = shift;
+
+ my $id = get_health_check_id_str( @{ $v_r_list->[0] } );
+ if (!defined $id) {
+ ld_log( _message('ERR0503') );
+ return 0;
+ }
+ return $HEALTH_CHECK{$id}{status};
+}
+
+# _remove_service
+# Remove a real server by either making it quiescent or deleteing it
+# Should be called by _service_down or fallback_off
+# I.e. If you want to change the state of a real server call service_set.
+# If you call this function directly then l7directord will lose track
+# of the state of real servers.
+# If the real server exists (which it should) make it quiescent or
+# delete it, depending on the global and per virtual service quiecent flag.
+# If it # doesn't exist, just leave it as it will be added by the
+# _service_up code as appropriate.
+# pre: v: reference to virtual service to with the real server belongs
+# rservice: service to restore. Of the form server:port for tcp
+# rforw: Forwarding mechanism of service. Should be only "-m"
+# rforw is kept as it is, even though not used - NTT COMWARE
+# tag: Tag to use for logging. Should be either "real" or "fallback"
+# post: real service is taken up from the respective virtual service
+# if it is inactive
+# return: none
+sub _remove_service {
+ my ($v, $r, $tag) = @_;
+ if (!defined $v || !defined $r) {
+ ld_log( _message('ERR0501') );
+ return;
+ }
+
+ my $vip_id = get_virtual_id_str($v);
+ if (!defined $vip_id) {
+ ld_log( _message('ERR0502') );
+ return;
+ }
+ my $oldsrv = ld_read_l7vsadm();
+ if (!defined $oldsrv) {
+ ld_log( _message('FTL0201') );
+ return;
+ }
+
+ if ( !exists $oldsrv->{$vip_id} ) {
+ ld_log( _message( 'ERR0208', get_ip_port($r), get_ip_port($v) ) );
+ return;
+ }
+
+ # quiescent check
+ my $is_quiescent = 0;
+ if (!defined $tag || $tag ne 'fallback') {
+ if ( defined $v->{quiescent} && $v->{quiescent} ) {
+ $is_quiescent = 1;
+ }
+ }
+
+ my $or = $oldsrv->{$vip_id}{ get_ip_port($r) };
+ # already removed server
+ if (!defined $or && !$is_quiescent) {
+ my $module_key = $v->{module}{name} . q{ } . $v->{module}{key};
+ ld_log( _message( 'ERR0210', get_ip_port($r), get_ip_port($v), $module_key ) );
+ return;
+ }
+ # already quiescent server
+ if ( defined $or && $is_quiescent && $or->{weight} == 0 &&
+ $or->{option}{forward} eq $r->{option}{forward} ) {
+ my $module_key = $v->{module}{name} . q{ } . $v->{module}{key};
+ ld_log( _message( 'ERR0211', get_ip_port($r), get_ip_port($v), $module_key ) );
+ return;
+ }
+
+ if ($is_quiescent) {
+ if (defined $or) {
+ ld_edit_real($v, $r, 0);
+ }
+ else {
+ ld_add_real($v, $r, 0);
+ }
+ if (!defined $tag || $tag eq 'real') {
+ ld_log( _message( 'INF0303', get_ip_port($r) ) );
+ }
+ elsif ($tag eq 'fallback') {
+ ld_log( _message( 'INF0304', get_ip_port($r) ) );
+ }
+ }
+ else {
+ ld_delete_real($v, $r);
+ if (!defined $tag || $tag eq 'real') {
+ ld_log( _message( 'INF0305', get_ip_port($r) ) );
+ }
+ elsif ($tag eq 'fallback') {
+ ld_log( _message( 'INF0306', get_ip_port($r) ) );
+ }
+ }
+
+ if ( defined $v->{realdowncallback} && $r->{healthchecked} ) {
+ system_wrapper( $v->{realdowncallback}, get_ip_port($r) );
+ ld_log( _message( 'INF0501', $v->{realdowncallback}, get_ip_port($r) ) );
+ }
+ $r->{healthchecked} = 1;
+}
+
+# _restore_service
+# Make a retore a real server. The opposite of _quiescent_server.
+# Should be called by _service_up or fallback_on
+# I.e. If you want to change the state of a real server call service_set.
+# If you call this function directly then l7directord will lose track
+# of the state of real servers.
+# If the real server exists (which it should) make it quiescent. If it
+# doesn't exist, just leave it as it will be added by the _service_up code
+# as appropriate.
+# pre: v: reference to virtual service to with the real server belongs
+# r: reference to real server to restore.
+# tag: Tag to use for logging. Should be either "real" or "fallback"
+# post: real service is taken up from the respective virtual service
+# if it is inactive
+# return: none
+sub _restore_service {
+ my ($v, $r, $tag) = @_;
+ if (!defined $v || !defined $r) {
+ ld_log( _message('ERR0501') );
+ return;
+ }
+
+ my $vip_id = get_virtual_id_str($v);
+ if (!defined $vip_id) {
+ ld_log( _message('ERR0502') );
+ return;
+ }
+ my $oldsrv = ld_read_l7vsadm();
+ if (!defined $oldsrv) {
+ ld_log( _message('FTL0201') );
+ return;
+ }
+
+ if ( !exists $oldsrv->{$vip_id} ) {
+ ld_log( _message( 'ERR0207', get_ip_port($r), get_ip_port($v) ) );
+ return;
+ }
+
+ my $or = $oldsrv->{$vip_id}{ get_ip_port($r) };
+ # already completely same server exist
+ if ( defined $or &&
+ $or->{weight} eq $r->{weight} &&
+ $or->{option}{forward} eq $r->{option}{forward} ) {
+ my $module_key = $v->{module}{name} . q{ } . $v->{module}{key};
+ ld_log( _message( 'ERR0209', get_ip_port($r), get_ip_port($v), $module_key ) );
+ return;
+ }
+
+ if (defined $or) {
+ ld_edit_real( $v, $r, $r->{weight} );
+ }
+ else {
+ ld_add_real( $v, $r, $r->{weight} );
+ }
+
+ if (!defined $tag || $tag eq 'real') {
+ ld_log( _message( 'INF0301', get_ip_port($r) ) );
+ }
+ elsif ($tag eq 'fallback') {
+ ld_log( _message( 'INF0302', get_ip_port($r) ) );
+ }
+
+ if ( defined $v->{realrecovercallback} && $r->{healthchecked} ){
+ system_wrapper( $v->{realrecovercallback}, get_ip_port($r) );
+ ld_log( _message( 'INF0502', $v->{realrecovercallback}, get_ip_port($r) ) );
+ }
+ $r->{healthchecked} = 1;
+}
+
+# fallback_on
+# Turn on the fallback server for a virtual service if it is inactive
+# pre: v: virtual to turn fallback service on for
+# post: fallback server is turned on if it was inactive
+# return: none
+sub fallback_on {
+ my $v = shift;
+
+ my $fallback = fallback_find($v);
+ if (defined $fallback) {
+ my $v_r_list = [ [ $v, $fallback->{tcp} ] ];
+ if ( _status_up($v_r_list, 'fallback') ) {
+ _restore_service($v, $fallback->{tcp}, 'fallback');
+ }
+ }
+}
+
+# fallback_off
+# Turn off the fallback server for a virtual service if it is active
+# pre: v: virtual to turn fallback service off for
+# post: fallback server is turned off if it was active
+# return: none
+sub fallback_off {
+ my $v = shift;
+
+ my $fallback = fallback_find($v);
+ if (defined $fallback) {
+ my $v_r_list = [ [ $v, $fallback->{tcp} ] ];
+ if ( _status_down($v_r_list, 'fallback') ) {
+ _remove_service($v, $fallback->{tcp}, 'fallback');
+ }
+ }
+}
+
+# fallback_find
+# Determine the fallback for a virtual service
+# pre: v: reference to a virtual service
+# post: none
+# return: $v->{fallback} if defined
+# else undef
+sub fallback_find {
+ my $v = shift;
+ if (!defined $v) {
+ ld_log( _message('ERR0501') );
+ return;
+ }
+ return $v->{fallback};
+}
+
+# check_cfgfile
+# Check configfile change.
+# pre: none
+# post: check configfile size, and then check md5 sum
+# return: 1 if notice file change
+# 0 if not notice or not change
+sub check_cfgfile {
+ if (!defined $CONFIG_FILE{path}) {
+ ld_log( _message('FTL0102') );
+ return 0;
+ }
+
+ my $mtime = (stat $CONFIG_FILE{path})[9];
+ if (!defined $mtime) {
+ ld_log( _message( 'ERR0410', $CONFIG_FILE{path} ) );
+ return 0;
+ }
+
+ if ( defined $CONFIG_FILE{stattime} && $mtime == $CONFIG_FILE{stattime} ) {
+ # file mtime is not change
+ return 0;
+ }
+ $CONFIG_FILE{stattime} = $mtime;
+
+ my $digest = undef;;
+ eval {
+ require Digest::MD5;
+
+ my $ctx = Digest::MD5->new();
+ open my $config, '<', $CONFIG_FILE{path};
+ $ctx->addfile($config);
+ $digest = $ctx->hexdigest;
+ close $config;
+ };
+ if ($EVAL_ERROR) {
+ ld_log( _message( 'ERR0407', $CONFIG_FILE{path} ) );
+ return 0;
+ }
+
+ if (defined $CONFIG_FILE{checksum} && $digest &&
+ $CONFIG_FILE{checksum} ne $digest ) {
+ ld_log( _message('WRN0101', $CONFIG_FILE{path}) );
+ $CONFIG_FILE{checksum} = $digest;
+
+ if ( defined $CONFIG{callback} && -x $CONFIG{callback} ) {
+ system_wrapper( $CONFIG{callback} . q{ } . $CONFIG_FILE{path} );
+ ld_log( _message( 'INF0503', $CONFIG{callback}, $CONFIG_FILE{path} ) );
+ }
+
+ if ( $CONFIG{autoreload} ) {
+ ld_log( _message('WRN0102') );
+ return 1;
+ }
+ else {
+ ld_log( _message('WRN0103') );
+ return 0;
+ }
+ }
+
+ $CONFIG_FILE{checksum} = $digest;
+ return 0;
+}
+
+# ld_openlog
+# Open logger
+# make log rotation work
+# pre: log setting
+# post: If logger is a file, it opened and closed again as a test
+# If logger is syslog, it is opened so it can be used without
+# needing to be opened again.
+# Otherwiese, nothing is done.
+# return: 0 on success
+# 1 on error
+sub ld_openlog {
+ my $log_config = shift;
+ if (!defined $log_config) {
+ ld_log( _message('ERR0501') );
+ return 1;
+ }
+
+ if ( $DEBUG_LEVEL > 0 or $CONFIG{supervised} ) {
+ # Instantly do nothing
+ return 0;
+ }
+
+ if ( $log_config =~ m{^/}) {
+ # Open and close the file as a test.
+ # We open the file each time we want to log to it
+ eval {
+ open my $log_file, ">>", $log_config;
+ close $log_file;
+ };
+ if ($EVAL_ERROR) {
+ ld_log( _message('ERR0118', $log_config) );
+ return 1;
+ }
+ }
+ else {
+ # Assume $log_config is a logfacility, log to syslog
+ setlogsock("unix");
+ openlog("l7directord", "pid", $log_config);
+ # FIXME "closelog" not found
+ }
+
+ $PROC_STAT{log_opened} = 1;
+ return 0;
+}
+
+# ld_log
+# Log a message.
+# pre: message: Message to write
+# post: message and timetsamp is written to loged
+# If logger is a file, it is opened and closed again as a
+# primative means to make log rotation work
+# return: 0 on success
+# 1 on error
+sub ld_log {
+ my $message = shift;
+ if (!defined $message) {
+ ld_log( _message('ERR0501') );
+ return 1;
+ }
+
+ ld_debug(2, $message);
+ chomp $message;
+
+ if ( !$PROC_STAT{log_opened} ) {
+ return 1;
+ }
+
+ my $now = localtime();
+ my $line_header = sprintf "[%s|%d] ", $now, $PROC_STAT{pid};
+ $message =~ s/^/$line_header/mg;
+
+ if ( $CONFIG{supervised} ) {
+ print {*STDOUT} $message . "\n";
+ }
+ elsif ( $CONFIG{logfile} =~ m{^/} ) {
+ eval {
+ open my $log_file, '>>', $CONFIG{logfile};
+ flock $log_file, 2; # LOCK_EX
+ print {$log_file} $message . "\n";
+ close $log_file;
+ };
+ if ($EVAL_ERROR) {
+ print {*STDERR} _message_only( 'FTL0103', $CONFIG{logfile}, $message ) . "\n";
+ return 1;
+ }
+ }
+ else {
+ # Assume LOGFILE is a logfacility, log to syslog
+ syslog('info', $message);
+ }
+ return 0;
+}
+
+# ld_debug
+# Log a message to a STDOUT.
+# pre: priority: priority of message
+# message: Message to write
+# post: message is written to STDOUT if $DEBUG_LEVEL >= priority
+# return: none
+sub ld_debug {
+ my ($priority, $message) = @_;
+
+ if (defined $priority && $priority =~ /^\d+$/ &&
+ defined $message && $DEBUG_LEVEL >= $priority) {
+ chomp $message;
+ $message =~ s/^/DEBUG[$priority]: /mg;
+ print {*STDERR} $message . "\n";
+ }
+}
+
+# command_wrapper
+# Wrapper around command(qx) to get output
+# pre: command to execute
+# post: execute command and if it returns non-zero a failure
+# message is logged
+# return: return value of command, and output
+sub command_wrapper {
+ my $command = shift;
+
+ if ($DEBUG_LEVEL > 2) {
+ ld_log( _message( 'INF0506', $command) );
+ }
+
+ $command =~ s/([{}\\])/\\$1/g;
+ my $output = qx($command);
+ if ($CHILD_ERROR != 0) {
+ ld_log( _message('ERR0303', $command, $CHILD_ERROR) );
+ }
+ return ($CHILD_ERROR, $output);
+}
+
+# system_wrapper
+# Wrapper around system() to log errors
+# pre: LIST: arguments to pass to system()
+# post: system() is called and if it returns non-zero a failure
+# message is logged
+# return: return value of system()
+sub system_wrapper {
+ my @args = @_;
+
+ if ($DEBUG_LEVEL > 2) {
+ ld_log( _message( 'INF0504', join(q{ }, @args) ) );
+ }
+ my $status = system(@args);
+ if ($DEBUG_LEVEL > 2) {
+ if ($status != 0) {
+ ld_log( _message('ERR0301', join(q{ }, @args), $status) );
+ }
+ }
+ return $status;
+}
+
+# exec_wrapper
+# Wrapper around exec() to log errors
+# pre: LIST: arguments to pass to exec()
+# post: exec() is called and if it returns non-zero a failure
+# message is logged
+# return: return value of exec() on failure
+# does not return on success
+sub exec_wrapper {
+ my @args = @_;
+
+ if ($DEBUG_LEVEL > 2) {
+ ld_log( _message( 'INF0505', join(q{ }, @args) ) );
+ }
+ my $status = exec(@args);
+ if (!$status) {
+ ld_log( _message('ERR0302', join(q{ }, @args), $status) );
+ }
+ return $status;
+}
+
+# ld_rm_file
+# Remove a file, symink, or anything that isn't a directory
+# and exists
+# pre: filename: file to delete
+# post: If filename does not exist or is a directory an
+# error state is reached
+# Else filename is delete
+# If $DEBUG_LEVEL >=2 errors are logged
+# return: 0 on success
+# -1 on error
+sub ld_rm_file {
+ my $filename = shift;
+ if (!defined $filename) {
+ ld_log( _message('ERR0411') );
+ return -1;
+ }
+ if (-d $filename) {
+ ld_log( _message('ERR0401', $filename) );
+ return -1;
+ }
+ if (!-e $filename) {
+ ld_log( _message('ERR0402', $filename) );
+ return -1;
+ }
+ my $status = unlink $filename;
+ if ($status != 1) {
+ ld_log( _message('ERR0403', $filename, $ERRNO) );
+ return -1;
+ }
+ return 0;
+}
+
+# is_octet
+# See if a number is an octet, that is >=0 and <=255
+# pre: alleged_octet: the octect to test
+# post: alleged_octect is checked to see if it is valid
+# return: 1 if the alleged_octet is an octet
+# 0 otherwise
+sub is_octet {
+ my $alleged_octet = shift;
+ if (!defined $alleged_octet || $alleged_octet !~ /^\d+$/ || $alleged_octet > 255) {
+ ld_log( _message('ERR0501') );
+ return 0;
+ }
+ return 1;
+}
+
+# is_ip
+# Check that a given string is an IP address
+# pre: alleged_ip: string representing ip address
+# post: alleged_ip is checked to see if it is valid
+# return: 1 if alleged_ip is a valid ip address
+# 0 otherwise
+sub is_ip {
+ my $alleged_ip = shift;
+
+ # If we don't have four, . delimited numbers then we have no hope
+ if (!defined $alleged_ip || $alleged_ip !~ m/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/) {
+ ld_log( _message('ERR0501') );
+ return 0;
+ }
+
+ # Each octet must be >=0 and <=255
+ is_octet($1) or return 0;
+ is_octet($2) or return 0;
+ is_octet($3) or return 0;
+ is_octet($4) or return 0;
+
+ return 1;
+}
+
+# ip_to_int
+# Turn an IP address given as a dotted quad into an integer
+# pre: ip_address: string representing IP address
+# post: post ip_address is converted to an integer
+# return: -1 if an error occurs
+# integer representation of IP address otherwise
+sub ip_to_int {
+ my $ip_address = shift;
+
+ if ( !is_ip($ip_address) ) {
+ return -1;
+ }
+ my ($oct1, $oct2, $oct3, $oct4)
+ = $ip_address =~ m/^(\d+)\.(\d+)\.(\d+)\.(\d+)$/;
+
+ my $result = ($oct1 << 24) + ($oct2 << 16) + ($oct3 << 8) + $oct4;
+ return $result;
+}
+
+# int_to_ip
+# Turn an IP address given as an integer into a dotted quad
+# pre: ip_address: integer representation of IP address
+# post: Decimal is converted to a dotted quad
+# return: string representing IP address
+sub int_to_ip {
+ my $ip_address = shift;
+ if (!defined $ip_address || $ip_address !~ /^\d+$/) {
+ ld_log( _message('ERR0501') );
+ return;
+ }
+
+ my $result = sprintf "%d.%d.%d.%d",
+ ($ip_address >> 24) & 255,
+ ($ip_address >> 16) & 255,
+ ($ip_address >> 8 ) & 255,
+ ($ip_address ) & 255;
+ return $result;
+}
+
+# get_ip_port
+# Get the service for a virtual or a real
+# pre: host: virtual or real to get the service for
+# post: none
+# return: ip_address:port
+sub get_ip_port {
+ my ($host, $checkport) = @_;
+ my $server = defined $host && defined $host->{server} && defined $host->{server}{ip}
+ ? $host->{server}{ip } : q{};
+ my $port = defined $checkport ? $checkport
+ : defined $host && defined $host->{server} && defined $host->{server}{port}
+ ? $host->{server}{port} : q{};
+
+ my $ip_port = $server ne q{} && $port ne q{} ? "$server:$port" : q{};
+ return $ip_port;
+}
+
+# get_health_check_id_str
+# Get an id string for a health check process
+# pre: r: Real service.
+# v: Virtual service
+# post: none
+# return: Id string for the health check process
+sub get_health_check_id_str {
+ my ($v, $r) = @_;
+ if ( !defined $v || !defined $r || !defined $r->{server} ) {
+ ld_log( _message('ERR0501') );
+ return;
+ }
+
+ my $ip = defined $r->{server}{ip } ? $r->{server}{ip } : q{};
+ my $port = defined $v->{checkport } ? $v->{checkport } :
+ defined $r->{server}{port} ? $r->{server}{port} : q{};
+ my $checktype = defined $v->{checktype } ? $v->{checktype } : q{};
+ my $service = defined $v->{service } ? $v->{service } : q{};
+ my $protocol = defined $v->{protocol } ? $v->{protocol } : q{};
+ my $num_connects = defined $v->{num_connects} ? $v->{num_connects} : q{};
+ my $request = defined $r->{request } ? $r->{request } : q{};
+ my $receive = defined $r->{receive } ? $r->{receive } : q{};
+ my $httpmethod = defined $v->{httpmethod } ? $v->{httpmethod } : q{};
+ my $virtualhost = defined $v->{virtualhost } ? $v->{virtualhost } : q{};
+ my $login = defined $v->{login } ? $v->{login } : q{};
+ my $password = defined $v->{passwd } ? $v->{passwd } : q{};
+ my $database = defined $v->{database } ? $v->{database } : q{};
+ my $customcheck = defined $v->{customcheck } ? $v->{customcheck } : q{};
+ my $checkinterval = defined $v->{checkinterval } ? $v->{checkinterval } : q{};
+ my $checkcount = defined $v->{checkcount } ? $v->{checkcount } : q{};
+ my $checktimeout = defined $v->{checktimeout } ? $v->{checktimeout } : q{};
+ my $negotiatetimeout = defined $v->{negotiatetimeout } ? $v->{negotiatetimeout } : q{};
+ my $retryinterval = defined $v->{retryinterval } ? $v->{retryinterval } : q{};
+
+ # FIXME SHOULD change separator. (request, receive, login, passwd ,database may include ':')
+ my $id = "$ip:$port:$checktype:$service:$protocol:$num_connects:$request:$receive:" .
+ "$httpmethod:$virtualhost:$login:$password:$database:$customcheck:" .
+ "$checkinterval:$checkcount:$checktimeout:$negotiatetimeout:$retryinterval";
+
+ return $id;
+}
+
+# get_virtual_id_str
+# Get an id string for a virtual service
+# pre: v: Virtual service
+# post: none
+# return: Id string for the virtual service
+sub get_virtual_id_str {
+ my $v = shift;
+ if ( !defined $v || !defined $v->{module} ) {
+ ld_log( _message('ERR0501') );
+ return;
+ }
+
+ my $ip_port = get_ip_port($v);
+ my $protocol = defined $v->{protocol } ? $v->{protocol } : q{};
+ my $module_name = defined $v->{module}{name} ? $v->{module}{name} : q{};
+ my $module_key = defined $v->{module}{key } ? $v->{module}{key } : q{};
+
+ my $id = "$protocol:$ip_port:$module_name $module_key";
+ $id =~ s/ +$//;
+
+ return $id;
+ # [cf] id = "tcp:127.0.0.1:80:cinsert --cookie-name 'monkey'"
+}
+
+# get_forward_flag
+# Get the l7vsadm flag corresponging to a forwarding mechanism
+# pre: forward: Name of forwarding mechanism.
+# Should be masq
+# post: none
+# return: l7vsadm flag corresponding to the forwading mechanism
+# " " if $forward is unknown
+sub get_forward_flag {
+ my $forward = shift;
+
+ if (defined $forward && $forward =~ /^masq$/i) {
+ return '-m';
+ }
+ return q{};
+}
+
+# ld_exit
+# Exit and log a message
+# pre: exit_status: Integer exit status to exit with
+# 0 wiil be used if parameter is omitted
+# message: Message to log when exiting. May be omitted
+# post: If exit_status is non-zero or $DEBUG_LEVEL>2 then
+# message logged.
+# Programme exits with exit_status
+# return: does not return
+sub ld_exit {
+ my ($exit_status, $message) = @_;
+ if (defined $exit_status && defined $message) {
+ ld_log( _message('INF0006', $exit_status, $message) );
+ }
+ exit $exit_status;
+}
+
+# ld_open_socket
+# Open a socket connection
+# pre: remote: IP address as a dotted quad of remote host to connect to
+# port: port to connect to
+# protocol: Prococol to use. Should be either "tcp" or "udp"
+# post: A Socket connection is opened to the remote host
+# return: Open socket
+sub ld_open_socket {
+ require IO::Socket::INET;
+ my ($remote, $port, $protocol, $timeout) = @_;
+
+ my $sock_handle = IO::Socket::INET->new(
+ PeerAddr => $remote,
+ PeerPort => $port,
+ Proto => $protocol,
+ Timeout => $timeout,
+ );
+ return $sock_handle;
+}
+
+# daemon
+# Close and fork to become a daemon.
+#
+# Notes from unix programmer faq
+# http://www.landfield.com/faqs/unix-faq/programmer/faq/
+#
+# Almost none of this is necessary (or advisable) if your daemon is being
+# started by `inetd'. In that case, stdin, stdout and stderr are all set up
+# for you to refer to the network connection, and the `fork()'s and session
+# manipulation should *not* be done (to avoid confusing `inetd'). Only the
+# `chdir()' step remains useful.
+sub ld_daemon {
+ ld_daemon_become_child();
+
+ if (POSIX::setsid() < 0) {
+ ld_exit( 7, _message_only('ERR0702') );
+ }
+
+ ld_daemon_become_child();
+
+ if (chdir('/') < 0) {
+ ld_exit( 8, _message_only('ERR0703') );
+ }
+
+ close *STDIN;
+ close *STDOUT;
+ close *STDERR;
+
+ eval { open *STDIN, '<', '/dev/null'; };
+ ld_exit(9, _message_only('ERR0704') ) if ($EVAL_ERROR);
+ eval { open *STDOUT, '>>', '/dev/console'; };
+ ld_exit(10, _message_only('ERR0705') ) if ($EVAL_ERROR);
+ eval { open *STDERR, '>>', '/dev/console'; };
+ ld_exit(10, _message_only('ERR0705') ) if ($EVAL_ERROR);
+}
+
+# ld_daemon_become_child
+# Fork, kill parent and return child process
+# pre: none
+# post: process forkes and parent exits
+# All preocess exit with exit status -1 if an error occurs
+# return: parent: exits
+# child: none (this is the process that returns)
+sub ld_daemon_become_child {
+ my $status = fork();
+ $PROC_STAT{pid} = $PID;
+
+ if ($status < 0) {
+ ld_exit( 6, _message_only('ERR0701', $ERRNO) );
+ }
+ if ($status > 0) {
+ ld_exit( 0, _message_only('INF0005') );
+ }
+}
+
+# ld_gethostbyname
+# Wrapper to gethostbyname. Look up the/an IP address of a hostname
+# If an IP address is given is it returned
+# pre: name: Hostname of IP address to lookup
+# post: gethostbyname is called to find an IP address for $name
+# This is converted to a string
+# return: IP address
+# undef on error
+sub ld_gethostbyname {
+ my $name = shift;
+ $name = q{} if !defined $name;
+ my $addrs = ( gethostbyname($name) )[4] or return;
+ return Socket::inet_ntoa($addrs);
+}
+
+# ld_getservbyname
+# Wraper for getservbyname. Look up the port for a service name
+# If a port is given it is returned.
+# pre: name: Port or Service name to look up
+# post: if $name is a number
+# if 0<=$name<=65536 $name is returned
+# else undef is returned
+# else getservbyname is called to look up the port for the service
+# return: Port
+# undef on error
+sub ld_getservbyname {
+ my ($name, $protocol) = @_;
+ $name = q{} if !defined $name;
+ $protocol = q{} if !defined $protocol;
+
+ if ($name =~ /^\d+$/) {
+ if ($name > 65535) {
+ return;
+ }
+ return $name;
+ }
+
+ my $port = ( getservbyname($name, $protocol) )[2] or return;
+ return $port;
+}
+
+# ld_gethostservbyname
+# Wraper for ld_gethostbyname and ld_getservbyname. Given a server of the
+# form ip_address|hostname:port|servicename return hash refs of ip_address and port
+# pre: hostserv: Servver of the form ip_address|hostname:port|servicename
+# protocol: Protocol for service. Should be either "tcp" or "udp"
+# post: lookups performed as per ld_getservbyname and ld_gethostbyname
+# return: { ip => ip_address, port => port }
+# undef on error
+sub ld_gethostservbyname {
+ my ($hostserv, $protocol) = @_;
+
+ if (!defined $hostserv || $hostserv !~ /
+ ^
+ (\d+\.\d+\.\d+\.\d+|[a-z0-9.-]+) # host or ip
+ : # colon
+ (\d+|[a-z0-9-]+) # serv or port
+ $
+ /ix) {
+ return;
+ }
+ my $ip = $1;
+ my $port = $2;
+ $ip = ld_gethostbyname($ip) or return;
+ $port = ld_getservbyname($port, $protocol) or return;
+
+ return {ip => $ip, port => $port};
+}
+
+# _message_only
+# Create message only.
+sub _message_only {
+ my ($code, @message_args) = @_;
+
+ my $message_list = {
+ # health check process exit
+ FTL0001 => "health_check argument is invalid. Exit this monitor process with status: 1",
+ FTL0002 => "health_check argument pair, virtual or real structure is invalid. Exit this monitor process with status: 2",
+ FTL0003 => "Detected down management process (pid: %s). Exit this monitor process with status: 3",
+ # file fatal error
+ FTL0101 => "l7vsadm file `%s' is not found or cannot execute.",
+ FTL0102 => "Config file is not defined. So cannot check configuration change.",
+ FTL0103 => "Cannot open logfile `%s'. Log message: `%s'",
+ # command fatal error
+ FTL0201 => "Result of read from l7vsadm is not defined.",
+
+ # exit
+ ERR0001 => "Initialization error: %s",
+ ERR0002 => "Configuration error and exit.",
+ # validation error
+ ERR0101 => "Invalid value (set natural number) `%s'.",
+ ERR0102 => "Invalid value (set `yes' or `no') `%s'.",
+ ERR0103 => "Invalid value (set any word) `%s'.",
+ ERR0104 => "Invalid value (set `custom', `connect', `negotiate', `ping', `off', `on' "
+ . "or positive number) `%s'.",
+ ERR0105 => "Invalid value (set `lc', `rr' or `wrr') `%s'.",
+ ERR0106 => "Invalid value (set `http', `https', `ftp', `smtp', `pop', `imap', "
+ . "`ldap', `nntp', `dns', `mysql', `pgsql', `sip', or `none') `%s'.",
+ ERR0107 => "Invalid value (forwarding mode must be `masq') `%s'.",
+ ERR0108 => "Invalid port number `%s'.",
+ ERR0109 => "Invalid protocol (protocol must be `tcp') `%s'.",
+ ERR0110 => "Invalid HTTP method (set `GET' or `HEAD') `%s'.",
+ ERR0111 => "Invalid module (set `url', `pfilter', `ip', `sslid' or `sessionless') `%s'.",
+ # ERR0111 => "Invalid module (set `cinsert', `cpassive', `crewrite', `url', `pfilter', `ip', `sslid' or `sessionless') `%s'.",
+ ERR0112 => "Invalid module key option (`%s' module must set `%s' option) `%s'.",
+ ERR0113 => "Invalid QoS value (set 0 or 1-999[KMG]. must specify unit(KMG)) `%s'.",
+ ERR0114 => "Invalid address `%s'.",
+ ERR0115 => "Invalid address range (first value(%s) must be less than or equal to the second value(%s)) `%s'.",
+ ERR0116 => "File not found `%s'.",
+ ERR0117 => "File not found or cannot execute `%s'.",
+ ERR0118 => "Unable to open logfile `%s'.",
+ ERR0119 => "Virtual section not found for `%s'.",
+ ERR0120 => "Unknown config `%s'.",
+ ERR0121 => "Configuration error. Reading file `%s' at line %d: %s",
+ ERR0122 => "Caught exception during re-read config file and re-setup l7vsd. (message: %s) "
+ . "So config setting will be rollbacked.",
+ ERR0123 => "`%s' is a required module for checking %s service.",
+ # operate l7vsd error
+ ERR0201 => "Failed to add virtual service to l7vsd: `%s %s', output: `%s'",
+ ERR0202 => "Failed to edit virtual service on l7vsd: `%s %s', output: `%s'",
+ ERR0203 => "Failed to delete virtual service from l7vsd: `%s %s', output: `%s'",
+ ERR0204 => "Failed to add server to l7vsd: `%s' ( x `%s %s'), output: `%s'",
+ ERR0205 => "Failed to edit server on l7vsd: `%s' ( x `%s %s'), output: `%s'",
+ ERR0206 => "Failed to delete server from l7vsd: `%s' ( x `%s %s'), output: `%s'",
+ ERR0207 => "Trying add server `%s', but virtual service `%s' is not found.",
+ ERR0208 => "Trying delete server `%s', but virtual service `%s' is not found.",
+ ERR0209 => "`%s' was already existed on l7vsd. ( x `%s %s')",
+ ERR0210 => "`%s' was already deleted on l7vsd. ( x `%s %s')",
+ ERR0211 => "`%s' was already changed to quiescent state on l7vsd. ( x `%s %s')",
+ # command error
+ ERR0301 => "Failed to system `%s' with return: %s",
+ ERR0302 => "Failed to exec `%s' with return: %s",
+ ERR0303 => "Failed to command `%s' with return: %s",
+ # file error
+ ERR0401 => "Failed to delete file `%s': `Is a directory'",
+ ERR0402 => "Failed to delete file `%s': `No such file'",
+ ERR0403 => "Failed to delete file `%s': `%s'",
+ ERR0404 => "Config file `%s' is not found.",
+ ERR0405 => "`l7directord.cf' is not found at default search paths.",
+ ERR0406 => "`l7vsadm' file is not found at default search paths.",
+ ERR0407 => "Cannot open config file `%s'.",
+ ERR0408 => "Cannot close config file `%s'.",
+ ERR0409 => "Cannot open pid file (%s): %s",
+ ERR0410 => "Cannot get mtime of configuration file `%s'",
+ ERR0411 => "No delete file specified.",
+ ERR0412 => "Invalid pid specified. (pid: %s)",
+ # undefined
+ ERR0501 => "Some method arguments are undefined.",
+ ERR0502 => "VirtualService ID is undefined.",
+ ERR0503 => "HealthCheck ID is undefined.",
+ ERR0504 => "negotiate function is undefined. So use check_connect function.",
+ ERR0505 => "custom check script is undefined. So use check_off function.",
+ # health check process
+ ERR0601 => "Service up detected. (Real server `%s')",
+ ERR0602 => "Service down detected. (Real server `%s')",
+ ERR0603 => "Detected down monitor process (pid: %s). Prepare to re-start health check process. (id: `%s')",
+ ERR0604 => "Failed to fork() on sub process creation. (id: `%s')",
+ # daemon
+ ERR0701 => "Cannot fork for become daemon (errno: `%s') and exit.",
+ ERR0702 => "Cannot setsid for become daemon and exit.",
+ ERR0703 => "Cannot chdir for become daemon and exit.",
+ ERR0704 => "Cannot open /dev/null for become daemon and exit.",
+ ERR0705 => "Cannot open /dev/console for become daemon and exit.",
+
+ # signal
+ WRN0001 => "l7directord `%s' received signal: %s. Terminate process.",
+ WRN0002 => "l7directord `%s' received signal: %s. Reload configuration.",
+ WRN0003 => "Signal TERM send error(pid: %d)",
+ WRN0004 => "Signal HUP send error(pid: %d)",
+ # config
+ WRN0101 => "Configuration file `%s' has changed on disk.",
+ WRN0102 => "Reread new configuration.",
+ WRN0103 => "Ignore new configuration.",
+ # service check OK
+ WRN0203 => "Service check OK. HTTP response is valid. HTTP response status line is `%s' (real - `%s:%s')",
+ WRN0204 => "Service check OK. Successfully connect SMTP server. (real - `%s:%s')",
+ WRN0205 => "Service check OK. Successfully connect POP3 server. (real - `%s:%s')",
+ WRN0206 => "Service check OK. Successfully connect IMAP server. (real - `%s:%s')",
+ WRN0207 => "Service check OK. Successfully bind LDAP server. (real - `%s:%s')",
+ WRN0208 => "Service check OK. NNTP response is valid. `%s' (real - `%s:%s')",
+ WRN0209 => "Service check OK. Database response is valid. (real - `%s:%s')",
+ WRN0210 => "Service check OK. Successfully connect socket to server. (real - `%s:%s')",
+ WRN0211 => "Service check OK. SIP response is valid. `%s' (real - `%s:%s')",
+ WRN0212 => "Service check OK. Successfully login FTP server. (real - `%s')",
+ WRN0213 => "Service check OK. Successfully lookup DNS. (real - `%s:%s')",
+ WRN0214 => "Service check OK. Successfully receive ping response. (real - `%s')",
+ WRN0215 => "Custom check result OK. (real - `%s')",
+ # perl warn
+ WRN0301 => "Perl warning: `%s'",
+ # service check NG
+ WRN1001 => "Retry service check `%s' %d more time(s).",
+ # - http
+ WRN1101 => "Service check NG. Check URL `%s' is not valid. (real - `%s:%s')",
+ WRN1102 => "Service check NG. HTTP response is not ok. Response status line is `%s' (real - `%s:%s')",
+ WRN1103 => "Service check NG. Check string `%s' is not found in HTTP response. (real - `%s:%s')",
+ # - smtp
+ WRN1201 => "Service check NG. Cannot connect SMTP server. (real - `%s:%s')",
+ # - pop3
+ WRN1301 => "Service check NG. Cannot connect POP3 server. (real - `%s:%s')",
+ WRN1302 => "Service check NG. Cannot login POP3 server. (real - `%s:%s')",
+ # - imap
+ WRN1401 => "Service check NG. Cannot connect IMAP server. (real - `%s:%s')",
+ WRN1402 => "Service check NG. Cannot login IMAP server. (real - `%s:%s')",
+ WRN1403 => "Service check NG. Connection timeout from IMAP server in %d seconds. (real - `%s:%s')",
+ # - ldap
+ WRN1501 => "Service check NG. Cannot connect LDAP server. (real - `%s:%s')",
+ WRN1502 => "Service check NG. Connection timeout from LDAP server in %d seconds. (real - `%s:%s')",
+ WRN1503 => "Service check NG. LDAP bind error. (real - `%s:%s')",
+ WRN1504 => "Service check NG. Exists %d results (not one) on search Base DN. (real - `%s:%s')",
+ WRN1505 => "Service check NG. Check string `%s' is not found in Base DN search result. (real - `%s:%s')",
+ # - nntp
+ WRN1601 => "Service check NG. Cannot connect NNTP server. (real - `%s:%s')",
+ WRN1602 => "Service check NG. Connection timeout from NNTP server in %d seconds. (real - `%s:%s')",
+ WRN1603 => "Service check NG. NNTP response is not ok. `%s' (real - `%s:%s')",
+ # - sql
+ WRN1701 => "Service check NG. SQL check must set `database', `login', `passwd' by configuration. (real - `%s:%s')",
+ WRN1702 => "Service check NG. Cannot connect database or cannot login database. (real - `%s:%s')",
+ WRN1703 => "Service check NG. Query result has no row. (real - `%s:%s')",
+ WRN1704 => "Service check NG. Expected %d rows of query results, but got %d rows. (real - `%s:%s')",
+ WRN1705 => "Service check NG. Connection timeout from database in %d seconds. (real - `%s:%s')",
+ # - sip
+ WRN1801 => "Service check NG. SIP check must set `login' by configuration. (real - `%s:%s')",
+ WRN1802 => "Service check NG. Cannot connect SIP server. (real - `%s:%s')",
+ WRN1803 => "Service check NG. SIP response is not ok. `%s' (real - `%s:%s')",
+ WRN1804 => "Service check NG. Connection timeout from SIP server in %d seconds. (real - `%s:%s')",
+ # - ftp
+ WRN1901 => "Service check NG. FTP check must set `login', `passwd' by configuration. (real - `%s')",
+ WRN1902 => "Service check NG. Cannot connect FTP server. (real - `%s')",
+ WRN1903 => "Service check NG. Cannot login FTP server. (real - `%s')",
+ WRN1904 => "Service check NG. Cannot chdir to / of FTP server. (real - `%s')",
+ WRN1905 => "Service check NG. Cannot get file `%s' (real - `%s')",
+ WRN1906 => "Service check NG. Check string `%s' is not found in file `%s' (real - `%s')",
+ WRN1907 => "Service check NG. Exception occur during FTP check `%s' (real - `%s')",
+ WRN1908 => "Service check NG. Connection timeout from FTP server in %d seconds. (real - `%s')",
+ # - dns
+ WRN2001 => "Service check NG. DNS check must set `request', `receive' by configuration. (real - `%s:%s')",
+ WRN2002 => "Service check NG. Connection timeout from DNS server in %d seconds. (real - `%s:%s')",
+ WRN2003 => "Service check NG. Net::DNS exception occur `%s' (real - `%s:%s')",
+ WRN2004 => "Service check NG. DNS search `%s' not respond. (real - `%s:%s')",
+ WRN2005 => "Service check NG. Check string `%s' is not found in search result. (real - `%s:%s')",
+ # - ping
+ WRN3101 => "Service check NG. Ping timeout in %d seconds. (real - `%s')",
+ # - connect
+ WRN3201 => "Service check NG. Cannot connect socket to server. (errno: `%s') (real - `%s:%s')",
+ # - custom
+ WRN3301 => "Custom check NG. Check timeout in %d seconds. (real - `%s')",
+ WRN3302 => "Custom check NG. `%s' returns %d",
+
+ # start stop
+ INF0001 => "Starting program with command: `%s'",
+ INF0002 => "Starting l7directord v%s with pid: %d (configuration: `%s')",
+ INF0003 => "Starting l7directord v%s as daemon. (configuration: `%s')",
+ INF0004 => "Exit by initialize error.",
+ INF0005 => "Exit parent process for become daemon",
+ INF0006 => "Exiting with exit status %d: %s",
+ INF0007 => "Detected halt flag. Exit this monitor process with status: 0",
+ INF0008 => "Reached end of `main'",
+ # stderr
+ INF0101 => "l7directord for `%s' is running with pid: %d",
+ INF0102 => "l7directord stale pid file %s for %s",
+ INF0103 => "Other l7directord process is running. (pid: %d)",
+ INF0104 => "l7directord process is not running.",
+ # l7vsd
+ INF0201 => "Add virtual service to l7vsd: `%s %s'",
+ INF0202 => "Edit virtual service on l7vsd: `%s %s'",
+ INF0203 => "Delete virtual service from l7vsd: `%s %s'",
+ INF0204 => "Add server to l7vsd: `%s' ( x `%s %s') (weight set to %d)",
+ INF0205 => "Edit server on l7vsd: `%s' ( x `%s %s') (weight set to %d)",
+ INF0206 => "Delete server from l7vsd: `%s' ( x `%s %s')",
+ # server change
+ INF0301 => "Added real server. (`%s')",
+ INF0302 => "Added fallback server. (`%s')",
+ INF0303 => "Changed real server to quiescent state. (`%s')",
+ INF0304 => "Changed fallback server to quiescent state. (`%s')",
+ INF0305 => "Deleted real server. (`%s')",
+ INF0306 => "Deleted fallback server. (`%s')",
+ # health check
+ INF0401 => "Prepare to start health check process. (id: `%s')",
+ INF0402 => "Create health check process with pid: %d. (id `%s')",
+ # run
+ INF0501 => "Real server down shell execute: `%s %s'",
+ INF0502 => "Real server recovery shell execute: `%s %s'",
+ INF0503 => "Config callback shell execute: `%s %s'",
+ INF0504 => "Running system: `%s'",
+ INF0505 => "Running exec: `%s'",
+ INF0506 => "Running command: `%s'",
+ };
+
+ my $message
+ = exists $message_list->{$code} ? sprintf $message_list->{$code}, @message_args
+ : "Unknown message. (code:[$code] args:[" . join(q{, }, @message_args) . '])';
+
+ return $message;
+}
+
+# _message
+# Create message by _message_only and add code header.
+sub _message {
+ my ($code, @message_args) = @_;
+ my $message = _message_only($code, @message_args);
+ $message = "[$code] $message";
+ return $message;
+}
+
+1;
+
+__END__
+
+=head1 NAME
+
+l7directord - UltraMonkey-L7 Director Daemon
+
+Daemon to monitor remote services and control UltraMonkey-L7
+
+
+=head1 SYNOPSIS
+
+B<l7directord> [B<-d>] [I<configuration>] {B<start>|B<stop>|B<restart>|B<try-restart>|B<reload>|B<status>|B<configtest>}
+
+B<l7directord> B<-t> [I<configuration>]
+
+B<l7directord> B<-h|--help>
+
+B<l7directord> B<-v|--version>
+
+=head1 DESCRIPTION
+
+B<l7directord> is a daemon to monitor and administer real servers in a
+cluster of load balanced virtual servers. B<l7directord> is similar to B<ldirectord>
+in terms of functionality except that it triggers B<l7vsadm>.
+B<l7directord> typically is started from command line but can be included
+to start from heartbeat. On startup B<l7directord> reads the file
+B</etc/ha.d/conf/>I<configuration>.
+After parsing the file, entries for virtual servers are created on the UltraMonkey-L7.
+Now at regular intervals the specified real servers are monitored and if
+they are considered alive, added to a list for each virtual server. If a
+real server fails, it is removed from that list. Only one instance of
+B<l7directord> can be started for each configuration, but more instances of
+B<l7directord> may be started for different configurations. This helps to
+group clusters of services. This can be done by putting an entry inside
+B</etc/ha.d/haresources>
+
+I<nodename virtual-ip-address l7directord::configuration>
+
+to start l7directord from heartbeat.
+
+
+=head1 OPTIONS
+
+=over
+
+=item I<configuration>:
+
+This is the name for the configuration as specified in the file
+B</etc/ha.d/conf/>I<configuration>
+
+=item B<-d>
+
+Don't start as daemon. Useful for debugging.
+
+=item B<-h>
+
+Help. Print user manual of l7directord.
+
+=item B<-v>
+
+Version. Print version of l7directord.
+
+=item B<-t>
+
+Run syntax tests for configuration files only. The program immediately exits after these syntax parsing tests
+with either a return code of 0 (Syntax OK) or return code not equal to 0 (Syntax Error).
+
+=item B<start>
+
+Start the daemon for the specified configuration.
+
+=item B<stop>
+
+Stop the daemon for the specified configuration. This is the same as sending
+a TERM signal to the running daemon.
+
+=item B<restart>
+
+Restart the daemon for the specified configuration. The same as stopping and starting.
+
+=item B<try-restart>
+
+Try to restart the daemon for the specified configuration. If l7directord is already running for the
+specified configuration, then the same is stopped and started (Similar to restart).
+However, if l7directord is not already running for the specified configuration, then an error message
+is thrown and the program exits.
+
+=item B<reload>
+
+Reload the configuration file. This is only useful for modifications
+inside a virtual server entry. It will have no effect on adding or
+removing a virtual server block. This is the same as sending a HUP signal to
+the running daemon.
+
+=item B<status>
+
+Show status of the running daemon for the specified configuration.
+
+=item B<configtest>
+
+This is the same as B<-t>.
+
+=back
+
+
+=head1 SYNTAX
+
+=head2 Description how to write configuration files
+
+=over
+
+=item B<virtual = >I<(ip_address|hostname:portnumber|servicename)>
+
+Defines a virtual service by IP-address (or hostname) and port (or
+servicename). All real services and flags for a virtual
+service must follow this line immediately and be indented.
+For ldirectord, Firewall-mark settings could be set. But for l7directord
+Firewall-mark settings cannot be set.
+
+=item B<checktimeout = >I<n>
+
+Timeout in seconds for connect checks. If the timeout is exceeded then the
+real server is declared dead. Default is 5 seconds. If defined in virtual
+server section then the global value is overridden.
+
+=item B<negotiatetimeout = >I<n>
+
+Timeout in seconds for negotiate checks. Default is 5 seconds.
+If defined in virtual server section then the global value is overridden.
+
+=item B<checkinterval = >I<n>
+
+Defines the number of second between server checks. Default is 10 seconds.
+If defined in virtual server section then the global value is overridden.
+
+=item B<retryinterval = >I<n>
+
+Defines the number of second between server checks when server status is NG.
+Default is 10 seconds. If defined in virtual server section then the global
+value is overridden.
+
+=item B<checkcount = >I<n>
+
+The number of times a check will be attempted before it is considered
+to have failed. Note that the checktimeout is additive, so if checkcount
+is 3 and checktimeout is 2 seconds and retryinterval is 1 second,
+then a total of 8 seconds (2 + 1 + 2 + 1 + 2) worth of timeout will occur
+before the check fails. Default is 1. If defined in virtual server section
+then the global value is overridden.
+
+=item B<configinterval = >I<n>
+
+Defines the number of second between configuration checks.
+Default is 5 seconds.
+
+=item B<autoreload = >[B<yes>|B<no>]
+
+Defines if <l7directord> should continuously check the configuration file
+for modification each B<configinterval> seconds. If this is set to B<yes>
+and the configuration file changed on disk and its modification time (mtime)
+is newer than the previous version, the configuration is automatically reloaded.
+Default is B<no>.
+
+=item B<callback = ">I</path/to/callback>B<">
+
+If this directive is defined, B<l7directord> automatically calls
+the executable I</path/to/callback> after the configuration
+file has changed on disk. This is useful to update the configuration
+file through B<scp> on the other heartbeated host. The first argument
+to the callback is the name of the configuration.
+
+This directive might also be used to restart B<l7directord> automatically
+after the configuration file changed on disk. However, if B<autoreload>
+is set to B<yes>, the configuration is reloaded anyway.
+
+=item B<fallback = >I<ip_address|hostname[:portnumber|servicename]> [B<masq>]
+
+the server onto which a web service is redirected if all real
+servers are down. Typically this would be 127.0.0.1 with
+an emergency page.
+
+This directive may also appear within a virtual server, in which
+case it will override the global fallback server, if set.
+Only a value of B<masq> can be specified here. The default is I<masq>.
+
+=item B<logfile = ">I</path/to/logfile>B<">|syslog_facility
+
+An alternative logfile might be specified with this directive. If the logfile
+does not have a leading '/', it is assumed to be a syslog(3) facility name.
+
+The default is to log directly to the file I</var/log/l7vs/l7directord.log>.
+
+=item B<execute = ">I<configuration>B<">
+
+Use this directive to start an instance of l7directord for
+the named I<configuration>.
+
+=item B<supervised>
+
+If this directive is specified, the daemon does not go into background mode.
+All log-messages are redirected to stdout instead of a logfile.
+This is useful to run B<l7directord> supervised from daemontools.
+See http://untroubled.org/rpms/daemontools/ or http://cr.yp.to/daemontools.html
+for details.
+
+=item B<quiescent = >[B<yes>|B<no>]
+
+If B<yes>, then when real or fallback servers are determined
+to be down, they are not actually removed from the UltraMonkey-L7,
+but set weight to zero.
+If B<no>, then the real or fallback servers will be removed
+from the UltraMonkey-L7. The default is B<yes>.
+
+This directive may also appear within a virtual server, in which
+case it will override the global fallback server, if set.
+
+=back
+
+
+=head2 Section virtual
+
+The following commands must follow a B<virtual> entry and must be indented
+with a minimum of 4 spaces or one tab.
+
+=over
+
+=item B<real => I<ip_address|hostname[-E<gt>ip_address|hostname][:portnumber|servicename>] [B<masq>] [I<n>] [B<">I<request>B<", ">I<receive>B<">]
+
+Defines a real service by IP-address (or hostname) and port (or
+servicename). If the port is omitted then a 0 will be used.
+Optionally a range of IP addresses (or two hostnames) may be
+given, in which case each IP address in the range will be treated as a real
+server using the given port. The second argument defines the forwarding
+method, it must be B<masq> only. The third argument defines the weight of
+each real service. This argument is optional. Default is 1. The last two
+arguments are optional too. They define a request-receive pair to be used to
+check if a server is alive. They override the request-receive pair in the
+virtual server section. These two strings must be quoted. If the request
+string starts with I<http://...> the IP-address and port of the real server
+is overridden, otherwise the IP-address and port of the real server is used.
+
+=item B<module => I<proto-module module-args [opt-module-args]>
+
+Indicates the module parameter of B<l7directord>. Here B<proto-module>
+denotes the protocol module name (For example, pfilter). B<module-args> denotes the
+arguments for the protocol module (For example, --pattern-match '*.html*').
+B<module-args> is optional only when set B<sessionless>, B<ip> and B<sslid> module to B<proto-module>.
+The last argument is optional (For example, --reschedule).
+
+=back
+
+=head2 More than one of these entries may be inside a virtual section:
+
+=over
+
+=item B<maxconn => I<n>
+
+Defines the maximum connection that the virtual service can handle. If the number of
+requests cross the maxconn limit, the requests would be redirected to the
+sorry server.
+
+=item B<qosup => I<n>[B<K>|B<M>|B<G>]
+
+Defines the bandwidth quota size in bps for up stream. If the number of the
+bandwidth is over the qosup limit, a packet to the virtual service will be delayed
+until the number of bandwidth become below the qosup limit.
+B<K>(kilo), B<M>(mega) and B<G>(giga) unit are available.
+
+=item B<qosdown => I<n>[B<K>|B<M>|B<G>]
+
+Defines the bandwidth quota size in bps for down stream. If the number of the
+bandwidth is over the qosdown limit, a packet to the client will be delayed
+until the number of bandwidth become below the qosdown limit.
+B<K>(kilo), B<M>(mega) and B<G>(giga) unit are available.
+
+=item B<sorryserver =>I<ip_address|hostname[:portnumber|servicename]>
+
+Defines a sorry server by IP-address (or hostname) and port (or
+servicename). Firewall-mark settings cannot be set.
+If the number of requests to the virtual service cross the maxconn limit, the requests would be
+redirected to the sorry server.
+
+=item B<checktype = negotiate>|B<connect>|I<N>|B<ping>|B<custom>|B<off>|B<on>
+
+Type of check to perform. Negotiate sends a request and matches a receive
+string. Connect only attempts to make a TCP/IP connection, thus the
+request and receive strings may be omitted. If checktype is a number then
+negotiate and connect is combined so that after each N connect attempts one
+negotiate attempt is performed. This is useful to check often if a service
+answers and in much longer intervals a negotiating check is done. Ping
+means that ICMP ping will be used to test the availability of real servers.
+Ping is also used as the connect check for UDP services. Custom means that
+custom command will be used to test the availability of real servers.
+Off means no checking will take place and no real or fallback servers will
+be activated. On means no checking will take place and real servers will
+always be activated. Default is I<negotiate>.
+
+=item B<service = ftp>|B<smtp>|B<http>|B<pop>|B<nntp>|B<imap>|B<ldap>|B<https>|B<dns>|B<mysql>|B<pgsql>|B<sip>|B<none>
+
+The type of service to monitor when using checktype=negotiate. None denotes
+a service that will not be monitored. If the port specified for the virtual
+server is 21, 25, 53, 80, 110, 119, 143, 389, 443, 3306, 5432 or 5060 then
+the default is B<ftp>, B<smtp>, B<dns>, B<http>, B<pop>, B<nntp>, B<imap>,
+B<ldap>, B<https>, B<mysql>, B<pgsql> or B<sip> respectively. Otherwise the
+default service is B<none>.
+
+=item B<checkport = >I<n>
+
+Number of port to monitor. Sometimes check port differs from service port.
+Default is port specified for the real server.
+
+=item B<request = ">I<uri to requested object>B<">
+
+This object will be requested each checkinterval seconds on each real
+server. The string must be inside quotes. Note that this string may be
+overridden by an optional per real-server based request-string.
+
+For a DNS check this should the name of an A record, or the address
+of a PTR record to look up.
+
+For a MySQL or PostgreSQL checks, this should be a SQL query.
+The data returned is not checked, only that the
+answer is one or more rows. This is a required setting.
+
+=item B<receive = ">I<regexp to compare>B<">
+
+If the requested result contains this I<regexp to compare>, the real server
+is declared alive. The regexp must be inside quotes. Keep in mind that
+regexps are not plain strings and that you need to escape the special
+characters if they should as literals. Note that this regexp may be
+overridden by an optional per real-server based receive regexp.
+
+For a DNS check this should be any one the A record's addresses or
+any one of the PTR record's names.
+
+For a MySQL check, the receive setting is not used.
+
+=item B<httpmethod = GET>|B<HEAD>
+
+Sets the HTTP method, which should be used to fetch the URI specified in
+the request-string. GET is the method used by default if the parameter is
+not set. If HEAD is used, the receive-string should be unset.
+
+=item B<virtualhost = ">I<hostname>B<">
+
+Used when using a negotiate check with HTTP or HTTPS. Sets the host header
+used in the HTTP request. In the case of HTTPS this generally needs to
+match the common name of the SSL certificate. If not set then the host
+header will be derived from the request url for the real server if present.
+As a last resort the IP address of the real server will be used.
+
+=item B<login = ">I<username>B<">
+
+Username to use to login to FTP, POP, IMAP, MySQL and PostgreSQL servers.
+For FTP, the default is anonymous. For POP and IMAP, the default is the
+empty string, in which case authentication will not be attempted.
+For a MySQL and PostgreSQL, the username must be provided.
+
+For SIP the username is used as both the to and from address
+for an OPTIONS query. If unset it defaults to l7directord\@<hostname>,
+hostname is derived as per the passwd option below.
+
+=item B<passwd = ">I<password>B<">
+
+Password to use to login to FTP, POP, IMAP, MySQL and PostgreSQL servers.
+Default is for FTP is l7directord\@<hostname>, where hostname is the
+environment variable HOSTNAME evaluated at run time, or sourced from uname
+if unset. The default for all other services is an empty password, in the
+case of MySQL and PostgreSQL this means authentication will not be
+performed.
+
+=item B<database = ">I<databasename>B<">
+
+Database to use for MySQL and PostgreSQL servers, this is the database that
+the query (set by B<receive> above) will be performed against. This is a
+required setting.
+
+=item B<scheduler => I<scheduler_name>
+
+Scheduler to be used by UltraMonkey-L7 for load balancing.
+The available schedulers are only B<lc> and B<rr>. The default is I<rr>.
+
+=item B<protocol = tcp>
+
+Protocol to be used. B<l7vsadm> supports only B<tcp>.
+Since the virtual is specified as an IP address and port, it would be tcp
+and will default to tcp.
+
+=item B<realdowncallback = ">I</path/to/realdowncallback>B<">
+
+If this directive is defined, B<l7directord> automatically calls
+the executable I</path/to/realdowncallback> after a real server's status
+changes to down. The first argument to the realdowncallback is the real
+server's IP-address and port (ip_address:portnumber).
+
+=item B<realrecovercallback = ">I</path/to/realrecovercallback>B<">
+
+If this directive is defined, B<l7directord> automatically calls
+the executable I</path/to/realrecovercallback> after a real server's status
+changes to up. The first argument to the realrecovercallback is the real
+server's IP-address and port (ip_address:portnumber).
+
+=item B<customcheck = ">I<custom check command>B<">
+
+If this directive is defined and set B<checktype> to custom, B<l7directord>
+exec custom command for real servers health checking. Only if custom command
+returns 0, real servers will change to up. Otherwise real servers will change
+to down. Custom check command has some macro string. See below.
+
+=over
+
+=item B<_IP_>
+
+Change to real server IP address.
+
+=item B<_PORT_>
+
+Change to real server port number.
+
+=back
+
+=back
+
+
+=head1 FILES
+
+B</etc/ha.d/conf/l7directord.cf>
+
+B</var/log/l7vs/l7directord.log>
+
+B</var/run/l7directord.>I<configuration>B<.pid>
+
+B</etc/services>
+
+=head1 SEE ALSO
+
+L<l7vsadm>, L<heartbeat>
+
+
+=head1 AUTHORS
+
+NTT COMWARE
+
+=cut
--- /dev/null
+use strict;
+use warnings;
+use lib qw(t/lib lib);
+use L7lib;
+use Test::More tests => 1;
+
+L7lib::chdir();
+L7lib::comment_out();
+
+SKIP: {
+ skip 'Test::More version 0.59_01 required', 1 if $Test::More::VERSION < 0.59_01;
+ require_ok('./l7directord');
+}
+
+L7lib::comment_in();
--- /dev/null
+use strict;
+use warnings;
+no warnings qw(redefine once);
+use lib qw(t/lib lib);
+use File::Copy;
+use L7lib;
+use Test::More tests => 75;
+use POSIX;
+use Cwd qw(abs_path);
+
+L7lib::chdir();
+L7lib::comment_out();
+require './l7directord';
+require_file();
+override();
+
+close *STDOUT;
+open *STDOUT, '>', '/dev/null';
+close *STDERR;
+open *STDERR, '>', '/dev/null';
+
+#...............................................
+# test start
+# - main
+# - parse_cmd
+# - parse_option
+# - initial_setting
+# - search_config_file
+# - search_l7vsadm_file
+
+test_default();
+
+test_argv('no ARGV', 10, qw());
+test_argv('ARGV="usage"', 10, qw(usage));
+test_argv('unknown ARGV', 10, qw(foobar hogehoge));
+test_argv('ARGV="help"', 9, qw(help));
+test_argv('ARGV="--help"', 9, qw(--help));
+test_argv('ARGV="--h"', 9, qw(--h));
+test_argv('ARGV="-h"', 9, qw(-h));
+test_argv('ARGV="version"', 8, qw(version));
+test_argv('ARGV="--version"', 8, qw(--version));
+test_argv('ARGV="-v"', 8, qw(-v));
+test_argv('ARGV="--v"', 8, qw(--v));
+test_argv('ARGV="configtest"', 7, qw(configtest));
+test_argv('ARGV="--configtest"', 10, qw(--configtest));
+test_argv('ARGV="-t"', 7, qw(-t));
+test_argv('ARGV="--t"', 7, qw(--t));
+test_argv('ARGV="--test"', 10, qw(--test));
+test_argv('ARGV="status"', 6, qw(status));
+test_argv('ARGV="reload"', 5, qw(reload));
+test_argv('ARGV="try-restart"', 4, qw(try-restart));
+test_argv('ARGV="restart"', 3, qw(restart));
+test_argv('ARGV="stop"', 2, qw(stop));
+test_argv('ARGV="start"', 1, qw(start));
+test_argv('ARGV="--help start"', 9, qw(--help start));
+test_argv('ARGV="--version stop"', 8, qw(--version stop));
+test_argv('ARGV="--help --version"', 9, qw(--help --version));
+test_argv('ARGV="-t --version"', 8, qw(-t --version));
+test_argv('ARGV="-t -d"', 7, qw(-t -d));
+
+test_argv('ARGV="-d"', 10, qw(-d));
+is $main::DEBUG_LEVEL, 3, 'default debug level';
+
+test_argv('ARGV="-d 1"', 10, qw(-d 1));
+is $main::DEBUG_LEVEL, 1, 'set debug level';
+
+test_argv('ARGV="-d 0"', 10, qw(-d 0));
+is $main::DEBUG_LEVEL, 0, 'set debug level zero';
+
+test_argv('ARGV="-d -1"', 10, qw(-d -1));
+is $main::DEBUG_LEVEL, -1, 'set debug level minus';
+
+SKIP: {
+ skip '/etc/hosts not found', 3 if (!-f '/etc/hosts');
+ test_argv('ARGV="/etc/hosts start"', 1, qw(/etc/hosts start));
+ is $main::CONFIG_FILE{path}, '/etc/hosts', 'set config path(1)';
+ is $main::CONFIG_FILE{filename}, 'hosts', 'set config filename';
+}
+
+SKIP: {
+ skip '/etc/hosts not found', 3 if (!-f '/etc/hosts');
+ test_argv('ARGV="-d 20 --version /etc/hosts start"', 8, qw(-d 20 --version /etc/hosts start));
+ is $main::DEBUG_LEVEL, 20, 'set debug level';
+ is $main::CONFIG_FILE{path}, '/etc/hosts', 'set config path';
+ is $main::CONFIG_FILE{filename}, 'hosts', 'set config filename';
+}
+
+SKIP: {
+ skip '/etc/ld.so.conf not found', 3 if (!-f '/etc/ld.so.conf');
+ test_argv('ARGV="/etc/ld.so.conf stop"', 2, qw(/etc/ld.so.conf stop));
+ is $main::CONFIG_FILE{path}, '/etc/ld.so.conf', 'set config path(2)';
+ is $main::CONFIG_FILE{filename}, 'ld.so', 'set config filename, omit ".conf"';
+}
+
+SKIP: {
+ skip '/etc/mail/sendmail.cf not found', 3 if (!-f '/etc/mail/sendmail.cf');
+ test_argv('ARGV="/etc/mail/sendmail.cf restart"', 3, qw(/etc/mail/sendmail.cf restart));
+ is $main::CONFIG_FILE{path}, '/etc/mail/sendmail.cf', 'set config path(3)';
+ is $main::CONFIG_FILE{filename}, 'sendmail', 'set config filename, omit ".cf"';
+}
+
+SKIP: {
+ skip '/a/b/c exist', 1 if (-f '/a/b/c');
+ local @ARGV = qw(/a/b/c reload);
+ eval { main(); };
+ is $@, "init_error\n", 'config not found';
+}
+
+SKIP: {
+ my $fail = 0;
+ my $made = 0;
+ if (!-f './l7directord.cf') {
+ if (!open my $f, '>', './l7directord.cf') {
+ $fail = 1;
+ } else { $made = 1; close $f; }
+ }
+ if ($fail) {
+ if ($made) { unlink './l7directord.cf'; }
+ skip 'cannot make ./l7directord.cf', 3;
+ }
+ test_argv('ARGV="reload"', 5, qw(reload));
+ is $main::CONFIG_FILE{path}, abs_path('./l7directord.cf'), 'search config path(1)';
+ is $main::CONFIG_FILE{filename}, 'l7directord', 'search config filename';
+ if ($made) { unlink './l7directord.cf'; }
+}
+
+SKIP: {
+ my $fail = 0;
+ my $made = 0;
+ my $mkdir = 0;
+ my $bak1 = 0;
+ if (-f './l7directord.cf') {
+ if (move './l7directord.cf', 'l7d.bak1') {
+ $bak1 = 1;
+ } else {
+ $fail = 1;
+ }
+ }
+ if (!$fail && !-d '/etc/ha.d/conf') {
+ if (!mkdir '/etc/ha.d/conf') {
+ $fail = 1;
+ } else { $mkdir = 1; }
+ }
+ if (!$fail && !-f '/etc/ha.d/conf/l7directord.cf') {
+ if (!open my $f, '>', '/etc/ha.d/conf/l7directord.cf') {
+ $fail = 1;
+ } else { $made = 1; }
+ }
+ if ($fail) {
+ if ($made) { unlink '/etc/ha.d/conf/l7directord.cf'; }
+ if ($mkdir) { rmdir '/etc/ha.d/conf'; }
+ if ($bak1) { move 'l7d.bak1', './l7directord.cf'; }
+ skip 'cannot make /etc/ha.d/conf/l7directord.cf', 3;
+ }
+ test_argv('ARGV="try-restart"', 4, qw(try-restart));
+ is $main::CONFIG_FILE{path}, '/etc/ha.d/conf/l7directord.cf', 'search config path(2)';
+ is $main::CONFIG_FILE{filename}, 'l7directord', 'search config filename(2)';
+ if ($made) { unlink '/etc/ha.d/conf/l7directord.cf'; }
+ if ($mkdir) { rmdir '/etc/ha.d/conf'; }
+ if ($bak1) { move 'l7d.bak1', './l7directord.cf'; }
+}
+
+SKIP: {
+ my $fail = 0;
+ my $made = 0;
+ my $mkdir = 0;
+ my $bak1 = 0;
+ my $bak2 = 0;
+ if (-f './l7directord.cf') {
+ if (move './l7directord.cf', 'l7d.bak1') {
+ $bak1 = 1;
+ } else {
+ $fail = 1;
+ }
+ }
+ if (!$fail && -f '/etc/ha.d/conf/l7directord.cf') {
+ if (move '/etc/ha.d/conf/l7directord.cf', 'l7d.bak2') {
+ $bak2 = 1;
+ } else {
+ $fail = 1;
+ }
+ }
+ if (!$fail && !-d '/etc/ha.d') {
+ if (!mkdir '/etc/ha.d') {
+ $fail = 1;
+ } else { $mkdir = 1; }
+ }
+ if (!$fail && !-f '/etc/ha.d/l7directord.cf') {
+ if (!open my $f, '>', '/etc/ha.d/l7directord.cf') {
+ $fail = 1;
+ } else { $made = 1; }
+ }
+ if ($fail) {
+ if ($made) { unlink '/etc/ha.d/l7directord.cf'; }
+ if ($mkdir) { rmdir '/etc/ha.d'; }
+ if ($bak1) { move 'l7d.bak1', './l7directord.cf'; }
+ if ($bak2) { move 'l7d.bak2', '/etc/ha.d/conf/l7directord.cf'; }
+ skip 'cannot make /etc/ha.d/l7directord.cf', 3;
+ }
+ test_argv('ARGV="restart"', 3, qw(restart));
+ is $main::CONFIG_FILE{path}, '/etc/ha.d/l7directord.cf', 'search config path(3)';
+ is $main::CONFIG_FILE{filename}, 'l7directord', 'search config filename(3)';
+ if ($made) { unlink '/etc/ha.d/l7directord.cf'; }
+ if ($mkdir) { rmdir '/etc/ha.d'; }
+ if ($bak1) { move 'l7d.bak1', './l7directord.cf'; }
+ if ($bak2) { move 'l7d.bak2', '/etc/ha.d/conf/l7directord.cf'; }
+}
+
+SKIP: {
+ my $fail = 0;
+ my $bak1 = 0;
+ my $bak2 = 0;
+ my $bak3 = 0;
+ if (-f './l7directord.cf') {
+ if (move './l7directord.cf', 'l7d.bak1') {
+ $bak1 = 1;
+ } else {
+ $fail = 1;
+ }
+ }
+ if (!$fail && -f '/etc/ha.d/conf/l7directord.cf') {
+ if (move '/etc/ha.d/conf/l7directord.cf', 'l7d.bak2') {
+ $bak2 = 1;
+ } else {
+ $fail = 1;
+ }
+ }
+ if (!$fail && -f '/etc/ha.d/l7directord.cf') {
+ if (move '/etc/ha.d/l7directord.cf', 'l7d.bak3') {
+ $bak3 = 1;
+ } else {
+ $fail = 1;
+ }
+ }
+ if ($fail) {
+ if ($bak1) { move 'l7d.bak1', './l7directord.cf'; }
+ if ($bak2) { move 'l7d.bak2', '/etc/ha.d/conf/l7directord.cf'; }
+ if ($bak2) { move 'l7d.bak3', '/etc/ha.d/l7directord.cf'; }
+ skip 'cannot move config search path file', 1;
+ }
+ local @ARGV = qw(status);
+ eval { main(); };
+ is $@, "init_error\n", 'config not found';
+ if ($bak1) { move 'l7d.bak1', './l7directord.cf'; }
+ if ($bak2) { move 'l7d.bak2', '/etc/ha.d/conf/l7directord.cf'; }
+ if ($bak2) { move 'l7d.bak3', '/etc/ha.d/l7directord.cf'; }
+}
+
+SKIP: {
+ my $fail = 0;
+ my $made = 0;
+ if (!-f './l7vsadm') {
+ if (!open my $f, '>', './l7vsadm') {
+ $fail = 1;
+ } else { $made = 1; close $f; }
+ }
+ if (!-x './l7vsadm') {
+ if (!chmod 0755, './l7vsadm') {
+ $fail = 1;
+ }
+ }
+ skip 'cannot make ./l7vsadm', 2 if ($fail);
+ test_argv('ARGV="stop"', 2, qw(stop));
+ is $main::PROC_ENV{l7vsadm}, abs_path('./l7vsadm'), 'search l7vsadm(1)';
+ if ($made) { unlink './l7vsadm'; }
+}
+
+SKIP: {
+ my $fail = 0;
+ my $made = 0;
+ my $mkdir = 0;
+ my $bak1 = 0;
+ if (-f './l7vsadm') {
+ if (move './l7vsadm', 'l7v.bak1') {
+ $bak1 = 1;
+ } else {
+ $fail = 1;
+ }
+ }
+ if (!$fail && !-d '/usr/sbin') {
+ if (!mkdir '/usr/sbin') {
+ $fail = 1;
+ } else { $mkdir = 1; }
+ }
+ if (!$fail && !-f '/usr/sbin/l7vsadm') {
+ if (!open my $f, '>', '/usr/sbin/l7vsadm') {
+ $fail = 1;
+ } else { $made = 1; }
+ }
+ if (!$fail && !-x '/usr/sbin/l7vsadm') {
+ if (!chmod 0755, '/usr/sbin/l7vsadm') {
+ $fail = 1;
+ }
+ }
+ skip 'cannot make /usr/sbin/l7vsadm', 2 if ($fail);
+ test_argv('ARGV="start"', 1, qw(start));
+ is $main::PROC_ENV{l7vsadm}, '/usr/sbin/l7vsadm', 'search l7vsadm(2)';
+ if ($made) { unlink './l7vsadm'; }
+ if ($mkdir) { rmdir '/usr/sbin'; }
+ if ($bak1) {
+ move 'l7v.bak1', './l7vsadm';
+ chmod '0755', './l7vsadm';
+ }
+}
+
+SKIP: {
+ my $fail = 0;
+ my $made = 0;
+ my $mkdir = 0;
+ my $bak1 = 0;
+ my $bak2 = 0;
+ if (-f './l7vsadm') {
+ if (move './l7vsadm', 'l7v.bak1') {
+ $bak1 = 1;
+ } else {
+ $fail = 1;
+ }
+ }
+ if (!$fail && -f '/usr/sbin/l7vsadm') {
+ if (move '/usr/sbin/l7vsadm', 'l7v.bak2') {
+ $bak2 = 1;
+ } else {
+ $fail = 1;
+ }
+ }
+ if (!$fail && (!-d '/sbin')) {
+ if (!mkdir '/sbin') {
+ $fail = 1;
+ } else { $mkdir = 1; }
+ }
+ if (!$fail && !-f '/sbin/l7vsadm') {
+ if (!open my $f, '>', '/sbin/l7vsadm') {
+ $fail = 1;
+ } else { $made = 1; }
+ }
+ if (!$fail && !-x '/sbin/l7vsadm') {
+ if (!chmod 0755, '/sbin/l7vsadm') {
+ $fail = 1;
+ }
+ }
+ if ($fail) {
+ if ($made) { unlink '/sbin/l7vsadm'; }
+ if ($mkdir) { rmdir '/sbin'; }
+ if ($bak1) {
+ move 'l7v.bak1', './l7vsadm';
+ chmod '0755', './l7vsadm';
+ }
+ if ($bak2) {
+ move 'l7v.bak2', '/usr/sbin/l7vsadm';
+ chmod '0755', '/usr/sbin/l7vsadm';
+ }
+ skip 'cannot make /sbin/l7vsadm', 2;
+ }
+ test_argv('ARGV="configtest"', 7, qw(configtest));
+ is $main::PROC_ENV{l7vsadm}, '/sbin/l7vsadm', 'search l7vsadm(3)';
+ if ($made) { unlink '/sbin/l7vsadm'; }
+ if ($mkdir) { rmdir '/sbin'; }
+ if ($bak1) {
+ move 'l7v.bak1', './l7vsadm';
+ chmod '0755', './l7vsadm';
+ }
+ if ($bak2) {
+ move 'l7v.bak2', '/usr/sbin/l7vsadm';
+ chmod '0755', '/usr/sbin/l7vsadm';
+ }
+}
+
+SKIP: {
+ my $fail = 0;
+ my $bak1 = 0;
+ my $bak2 = 0;
+ my $bak3 = 0;
+ if (-f './l7vsadm') {
+ if (move './l7vsadm', 'l7v.bak1') {
+ $bak1 = 1;
+ } else {
+ $fail = 1;
+ }
+ }
+ if (!$fail && -f '/usr/sbin/l7vsadm') {
+ if (move '/usr/sbin/l7vsadm', 'l7v.bak2') {
+ $bak2 = 1;
+ } else {
+ $fail = 1;
+ }
+ }
+ if (!$fail && -f '/sbin/l7vsadm') {
+ if (move '/sbin/l7vsadm', 'l7v.bak3') {
+ $bak3 = 1;
+ } else {
+ $fail = 1;
+ }
+ }
+ if ($fail) {
+ if ($bak1) {
+ move 'l7v.bak1', './l7vsadm';
+ chmod '0755', './l7vsadm';
+ }
+ if ($bak2) {
+ move 'l7v.bak2', '/usr/sbin/l7vsadm';
+ chmod '0755', '/usr/sbin/l7vsadm';
+ }
+ if ($bak3) {
+ move 'l7v.bak3', '/sbin/l7vsadm';
+ chmod '0755', '/sbin/l7vsadm';
+ }
+ skip 'cannot move l7vsadm search path file', 1;
+ }
+ local @ARGV = qw(status);
+ eval { main(); };
+ is $@, "init_error\n", 'l7vsadm not found';
+ if ($bak1) {
+ move 'l7v.bak1', './l7vsadm';
+ chmod '0755', './l7vsadm';
+ }
+ if ($bak2) {
+ move 'l7v.bak2', '/usr/sbin/l7vsadm';
+ chmod '0755', '/usr/sbin/l7vsadm';
+ }
+ if ($bak3) {
+ move 'l7v.bak3', '/sbin/l7vsadm';
+ chmod '0755', '/sbin/l7vsadm';
+ }
+}
+
+{
+ local $ENV{HOSTNAME} = 'test_host_name';
+ test_argv('ARGV="status"', 6, qw(status));
+ is $main::PROC_ENV{hostname}, 'test_host_name', 'set env HOSTNAME';
+}
+
+{
+ local $ENV{HOSTNAME};
+ test_argv('ARGV="status"', 6, qw(status));
+ is $main::PROC_ENV{hostname}, (POSIX::uname())[1], 'set HOSTNAME from uname';
+}
+
+
+
+sub test_default {
+ is $main::DEBUG_LEVEL, 0, 'default - debug level';
+ is $main::PROC_ENV{l7vsadm}, undef, 'default - l7vsadm path';
+ is $main::CONFIG_FILE{path}, undef, 'default - config path';
+ is $main::CONFIG_FILE{filename}, undef, 'default - config filename';
+ is $main::PROC_ENV{hostname}, undef, 'default - hostname';
+}
+
+sub test_argv {
+ my $name = shift;
+ my $expected = shift;
+ local @ARGV = @_;
+ my $return = main();
+ is $return, $expected, $name;
+}
+
+# test end
+#...............................................
+
+remove_file();
+L7lib::comment_in();
+
+sub require_file {
+ open my $d, '>', './l7directord.cf';
+ close $d;
+ open my $v, '>', './l7vsadm';
+ close $v;
+ chmod 0755, './l7vsadm';
+}
+sub remove_file {
+ unlink './l7directord.cf';
+ unlink './l7vsadm';
+}
+sub override {
+ *cmd_start = \&__cmd_start;
+ *cmd_stop = \&__cmd_stop;
+ *cmd_restart = \&__cmd_restart;
+ *cmd_try_restart = \&__cmd_try_restart;
+ *cmd_reload = \&__cmd_reload;
+ *cmd_status = \&__cmd_status;
+ *cmd_configtest = \&__cmd_configtest;
+ *cmd_version = \&__cmd_version;
+ *cmd_help = \&__cmd_help;
+ *cmd_usage = \&__cmd_usage;
+ *init_error = \&__init_error;
+ *ld_exit = \&__ld_exit;
+ *ld_log = \&__ld_log;
+}
+sub __cmd_start {
+ return 1;
+}
+sub __cmd_stop {
+ return 2;
+}
+sub __cmd_restart {
+ return 3;
+}
+sub __cmd_try_restart {
+ return 4;
+}
+sub __cmd_reload {
+ return 5;
+}
+sub __cmd_status {
+ return 6;
+}
+sub __cmd_configtest {
+ return 7;
+}
+sub __cmd_version {
+ return 8;
+}
+sub __cmd_help {
+ return 9;
+}
+sub __cmd_usage {
+ return 10;
+}
+sub __init_error {
+ die "init_error\n";
+}
+sub __ld_exit {
+ return shift;
+}
+sub __ld_log {
+}
--- /dev/null
+use strict;
+use warnings;
+no warnings qw(redefine once);
+use lib qw(t/lib lib);
+use L7lib;
+use Test::More tests => 75;
+
+L7lib::chdir();
+L7lib::comment_out();
+require './l7directord';
+override();
+default_value();
+
+our $signal = undef;
+our $read_config_called = 0;
+our $ld_log_called = 0;
+our @read_pid_return = ();
+our @children_command = ();
+our $system_command = undef;
+our $cmd_start_return = undef;
+our $cmd_stop_return = undef;
+our $set_ld_handler_called = 0;
+our $ld_setup_called = 0;
+our $ld_daemon_called = 0;
+our $run_pid = 0;
+our $ld_main_called = 0;
+our $remove_pid_called = 0;
+
+close *STDOUT;
+open *STDOUT, '>', '/dev/null';
+close *STDERR;
+open *STDERR, '>', '/dev/null';
+
+#...............................................
+# test start
+# - cmd_start
+{
+ local $set_ld_handler_called = 0;
+ local $read_config_called = 0;
+ local $ld_setup_called = 0;
+ local @read_pid_return = ();
+ local $ld_log_called = 0;
+ local $ld_daemon_called = 0;
+ local $run_pid = 0;
+ local @children_command = ();
+ local $remove_pid_called = 0;
+ my $got = cmd_start();
+ is $got, 0, 'cmd_start - run as daemon';
+ is $set_ld_handler_called, 1, 'cmd_start - set_ld_handler';
+ is $read_config_called, 1, 'cmd_start - read_config';
+ is $ld_setup_called, 1, 'cmd_start - ld_setup';
+ is $ld_log_called, 2, 'cmd_start - ld_log';
+ is $ld_daemon_called, 1, 'cmd_start - ld_daemon';
+ is $main::PROC_STAT{pid}, $$, 'cmd_start - save pid';
+ is $run_pid, $$, 'cmd_start - write_pid';
+ is_deeply \@children_command, ['start', 'stop'], 'cmd_start - ld_cmd_children';
+ is $ld_main_called, 1, 'cmd_start - ld_main';
+ is $remove_pid_called, 1, 'cmd_start - remove_pid';
+}
+{
+ local $set_ld_handler_called = 0;
+ local $read_config_called = 0;
+ local $ld_setup_called = 0;
+ local @read_pid_return = ();
+ local $ld_log_called = 0;
+ local $ld_daemon_called = 0;
+ local $run_pid = 0;
+ local @children_command = ();
+ local $ld_main_called = 0;
+ local $remove_pid_called = 0;
+ local $main::CONFIG{supervised} = 1;
+ local $main::DEBUG_LEVEL = 0;
+ local $main::PROC_STAT{pid} = 10000;
+ my $got = cmd_start();
+ is $got, 0, 'cmd_start - run supervised mode';
+ is $set_ld_handler_called, 1, 'cmd_start - set_ld_handler';
+ is $read_config_called, 1, 'cmd_start - read_config';
+ is $ld_setup_called, 1, 'cmd_start - ld_setup';
+ is $ld_log_called, 2, 'cmd_start - ld_log';
+ is $ld_daemon_called, 0, 'cmd_start - no ld_daemon';
+ is $run_pid, 10000, 'cmd_start - write_pid';
+ is_deeply \@children_command, ['start', 'stop'], 'cmd_start - ld_cmd_children';
+ is $ld_main_called, 1, 'cmd_start - ld_main';
+ is $remove_pid_called, 1, 'cmd_start - remove_pid';
+}
+{
+ local $set_ld_handler_called = 0;
+ local $read_config_called = 0;
+ local $ld_setup_called = 0;
+ local @read_pid_return = ();
+ local $ld_log_called = 0;
+ local $ld_daemon_called = 0;
+ local $run_pid = 0;
+ local @children_command = ();
+ local $ld_main_called = 0;
+ local $remove_pid_called = 0;
+ local $main::CONFIG{supervised} = 0;
+ local $main::DEBUG_LEVEL = 3;
+ local $main::PROC_STAT{pid} = 20000;
+ my $got = cmd_start();
+ is $got, 0, 'cmd_start - run debug mode';
+ is $set_ld_handler_called, 1, 'cmd_start - set_ld_handler';
+ is $read_config_called, 1, 'cmd_start - read_config';
+ is $ld_setup_called, 1, 'cmd_start - ld_setup';
+ is $ld_log_called, 2, 'cmd_start - ld_log';
+ is $ld_daemon_called, 0, 'cmd_start - no ld_daemon';
+ is $run_pid, 20000, 'cmd_start - write_pid';
+ is_deeply \@children_command, ['start', 'stop'], 'cmd_start - ld_cmd_children';
+ is $ld_main_called, 1, 'cmd_start - ld_main';
+ is $remove_pid_called, 1, 'cmd_start - remove_pid';
+}
+{
+ local $set_ld_handler_called = 0;
+ local $read_config_called = 0;
+ local $ld_setup_called = 0;
+ local @read_pid_return = (100);
+ my $got = cmd_start();
+ is $got, 1, 'cmd_start - already running';
+ is $set_ld_handler_called, 1, 'cmd_start - set_ld_handler';
+ is $read_config_called, 1, 'cmd_start - read_config';
+ is $ld_setup_called, 1, 'cmd_start - ld_setup';
+}
+# - cmd_stop
+{
+ local @read_pid_return = ();
+ my $got = cmd_stop();
+ is $got, 2, 'cmd_stop - not running(1)';
+}
+{
+ local @read_pid_return = (undef, undef);
+ my $got = cmd_stop();
+ is $got, 2, 'cmd_stop - not running(2)';
+}
+{
+ local @read_pid_return = (undef, 100);
+ my $got = cmd_stop();
+ is $got, 2, 'cmd_stop - stale pid exist';
+}
+{
+ local $SIG{TERM} = sub { $signal = shift; };
+ local @read_pid_return = ($$);
+ my $got = cmd_stop();
+ is $got, 0, 'cmd_stop - running';
+ is $signal, 'TERM', 'cmd_stop - signal send';
+}
+{
+ local @read_pid_return = (99999);
+ local $ld_log_called = 0;
+ my $got = cmd_stop();
+ is $got, 3, 'cmd_stop - signal error';
+ is $ld_log_called, 0, 'cmd_stop - ld_log';
+}
+# - cmd_restart
+{
+ local *cmd_start = \&__cmd_start;
+ local *cmd_stop = \&__cmd_stop;
+ {
+ local $cmd_stop_return = 0;
+ local $cmd_start_return = 0;
+ my $got = cmd_restart();
+ is $got, 0, 'cmd_restart - stop success, start success';
+ }
+ {
+ local $cmd_stop_return = 0;
+ local $cmd_start_return = 1;
+ my $got = cmd_restart();
+ is $got, 1, 'cmd_restart - stop success, start fail';
+ }
+ {
+ local $cmd_stop_return = 1;
+ local $cmd_start_return = 0;
+ my $got = cmd_restart();
+ is $got, 0, 'cmd_restart - stop fail, start success';
+ }
+ {
+ local $cmd_stop_return = 1;
+ local $cmd_start_return = 1;
+ my $got = cmd_restart();
+ is $got, 1, 'cmd_restart - stop fail, start fail';
+ }
+}
+# - cmd_try_restart
+{
+ local *cmd_start = \&__cmd_start;
+ local *cmd_stop = \&__cmd_stop;
+ {
+ local $cmd_stop_return = 0;
+ local $cmd_start_return = 0;
+ my $got = cmd_try_restart();
+ is $got, 0, 'cmd_try_restart - stop success, start success';
+ }
+ {
+ local $cmd_stop_return = 0;
+ local $cmd_start_return = 1;
+ my $got = cmd_try_restart();
+ is $got, 1, 'cmd_try_restart - stop success, start fail';
+ }
+ {
+ local $cmd_stop_return = 2;
+ my $got = cmd_try_restart();
+ is $got, 2, 'cmd_try_restart - stop fail';
+ }
+}
+# - cmd_reload
+{
+ local $read_config_called = 0;
+ local @read_pid_return = ();
+ my $got = cmd_reload();
+ is $got, 2, 'cmd_reload - not running(1)';
+ is $read_config_called, 1, 'cmd_reload - read_config';
+}
+{
+ local $read_config_called = 0;
+ local @read_pid_return = (undef, undef);
+ my $got = cmd_reload();
+ is $got, 2, 'cmd_reload - not running(2)';
+ is $read_config_called, 1, 'cmd_reload - read_config';
+}
+{
+ local $read_config_called = 0;
+ local @read_pid_return = (undef, 100);
+ my $got = cmd_reload();
+ is $got, 2, 'cmd_reload - stale pid exist';
+ is $read_config_called, 1, 'cmd_reload - read_config';
+}
+{
+ local $SIG{HUP} = sub { $signal = shift; };
+ local $read_config_called = 0;
+ local @read_pid_return = ($$);
+ my $got = cmd_reload();
+ is $got, 0, 'cmd_reload - running';
+ is $read_config_called, 1, 'cmd_reload - read_config';
+ is $signal, 'HUP', 'cmd_reload - signal send';
+}
+{
+ local $read_config_called = 0;
+ local $ld_log_called = 0;
+ local @read_pid_return = (99999);
+ my $got = cmd_reload();
+ is $got, 3, 'cmd_reload - signal error';
+ is $read_config_called, 1, 'cmd_reload - read_config';
+ is $ld_log_called, 0, 'cmd_reload - ld_log';
+}
+# - cmd_status
+{
+ local @read_pid_return = ();
+ local @children_command = ();
+ my $got = cmd_status();
+ is $got, 2, 'cmd_status - not running(1)';
+ is_deeply \@children_command, ['status'], 'status - ld_cmd_children';
+}
+{
+ local @read_pid_return = (undef, undef);
+ local @children_command = ();
+ my $got = cmd_status();
+ is $got, 2, 'cmd_status - not running(2)';
+ is_deeply \@children_command, ['status'], 'status - ld_cmd_children';
+}
+{
+ local @children_command = ();
+ local @read_pid_return = (999);
+ my $got = cmd_status();
+ is $got, 0, 'cmd_status - running';
+ is_deeply \@children_command, ['status'], 'status - ld_cmd_children';
+}
+{
+ local @children_command = ();
+ local @read_pid_return = (undef, 1000);
+ my $got = cmd_status();
+ is $got, 2, 'cmd_status - stale pid exist';
+ is_deeply \@children_command, ['status'], 'status - ld_cmd_children';
+}
+# - cmd_configtest
+{
+ local $read_config_called = 0;
+ my $got = cmd_configtest();
+ is $got, 0, 'cmd_configtest';
+ is $read_config_called, 1, 'configtest - read_config';
+}
+# - cmd_version
+{
+ my $got = cmd_version();
+ is $got, 0, 'cmd_version';
+}
+# - cmd_help
+{
+ local $system_command = undef;
+ $main::PROC_ENV{l7directord} = '_l7directord_';
+ my $got = cmd_help();
+ is $got, 0, 'cmd_help';
+ is $system_command, '/usr/bin/perldoc _l7directord_', 'perldoc command';
+}
+# - cmd_usage
+{
+ my $got = cmd_usage();
+ is $got, 0, 'cmd_usage';
+}
+
+
+# test end
+#...............................................
+
+L7lib::comment_in();
+
+sub default_value {
+ $main::CONFIG_FILE{filename} = 'filename';
+ $main::CONFIG_FILE{path} = '/path/filename';
+ $main::CONFIG{supervised} = 0;
+ $main::DEBUG_LEVEL = 0;
+}
+sub override {
+ *set_ld_handler = \&__set_ld_handler;
+ *read_config = \&__read_config;
+ *ld_setup = \&__ld_setup;
+ *read_pid = \&__read_pid;
+ *write_pid = \&__write_pid;
+ *ld_cmd_children = \&__ld_cmd_children;
+ *ld_main = \&__ld_main;
+ *remove_pid = \&__remove_pid;
+ *system_wrapper = \&__system_wrapper;
+ *ld_log = \&__ld_log;
+ *ld_daemon = \&__ld_daemon;
+}
+sub __cmd_start {
+ return $cmd_start_return;
+}
+sub __cmd_stop {
+ return $cmd_stop_return;
+}
+sub __set_ld_handler {
+ $set_ld_handler_called++;
+}
+sub __read_config {
+ $read_config_called++;
+}
+sub __ld_setup {
+ $ld_setup_called++;
+}
+sub __read_pid {
+ return wantarray ? @read_pid_return : $read_pid_return[0];
+}
+sub __write_pid {
+ $run_pid = shift;
+}
+sub __ld_cmd_children {
+ push @children_command, @_;
+}
+sub __ld_main {
+ $ld_main_called++;
+}
+sub __remove_pid {
+ $remove_pid_called++;
+}
+sub __system_wrapper {
+ $system_command = shift;
+}
+sub __ld_log {
+ $ld_log_called++;
+}
+sub __ld_daemon {
+ $ld_daemon_called++;
+}
--- /dev/null
+use strict;
+use warnings;
+no warnings qw(redefine once);
+use lib qw(t/lib lib);
+use L7lib;
+use Test::More tests => 26;
+
+L7lib::chdir();
+L7lib::comment_out();
+require './l7directord';
+
+override();
+
+#...............................................
+# test start
+# - set_ld_handler
+set_ld_handler();
+{
+ default_value();
+ # PIPE (ignore)
+ kill 13, $$;
+ is $main::PROC_STAT{halt }, undef, 'signal PIPE, not halt';
+ is $main::PROC_STAT{reload}, undef, 'signal PIPE, not reload';
+}
+# - ld_handler_term
+{
+ default_value();
+ # INT
+ kill 2, $$;
+ is $main::PROC_STAT{halt }, 'INT', 'signal INT, halt';
+ is $main::PROC_STAT{reload}, undef, 'signal INT, not reload';
+}
+{
+ default_value();
+ # QUIT
+ kill 3, $$;
+ is $main::PROC_STAT{halt }, 'QUIT', 'signal QUIT, halt';
+ is $main::PROC_STAT{reload}, undef, 'signal QUIT, not reload';
+}
+{
+ default_value();
+ # ILL
+ kill 4, $$;
+ is $main::PROC_STAT{halt }, 'ILL', 'signal ILL, halt';
+ is $main::PROC_STAT{reload}, undef, 'signal ILL, not reload';
+}
+{
+ default_value();
+ # ABRT
+ kill 6, $$;
+ is $main::PROC_STAT{halt }, 'ABRT', 'signal ABRT, halt';
+ is $main::PROC_STAT{reload}, undef, 'signal ABRT, not reload';
+}
+{
+ default_value();
+ # FPE
+ kill 8, $$;
+ is $main::PROC_STAT{halt }, 'FPE', 'signal FPE, halt';
+ is $main::PROC_STAT{reload}, undef, 'signal FPE, not reload';
+}
+{
+ default_value();
+ # SEGV
+ kill 11, $$;
+ is $main::PROC_STAT{halt }, 'SEGV', 'signal SEGV, halt';
+ is $main::PROC_STAT{reload}, undef, 'signal SEGV, not reload';
+}
+{
+ default_value();
+ # TERM
+ kill 15, $$;
+ is $main::PROC_STAT{halt }, 'TERM', 'signal TERM, halt';
+ is $main::PROC_STAT{reload}, undef, 'signal TERM, not reload';
+}
+{
+ default_value();
+ # BUS
+ kill 7, $$;
+ is $main::PROC_STAT{halt }, 'BUS', 'signal BUS, halt';
+ is $main::PROC_STAT{reload}, undef, 'signal BUS, not reload';
+}
+{
+ default_value();
+ # SYS
+ kill 31, $$;
+ is $main::PROC_STAT{halt }, 'SYS', 'signal SYS, halt';
+ is $main::PROC_STAT{reload}, undef, 'signal SYS, not reload';
+}
+{
+ default_value();
+ # XCPU
+ kill 24, $$;
+ is $main::PROC_STAT{halt }, 'XCPU', 'signal XCPU, halt';
+ is $main::PROC_STAT{reload}, undef, 'signal XCPU, not reload';
+}
+{
+ default_value();
+ # XFSZ
+ kill 25, $$;
+ is $main::PROC_STAT{halt }, 'XFSZ', 'signal XFSZ, halt';
+ is $main::PROC_STAT{reload}, undef, 'signal XFSZ, not reload';
+}
+# - ld_handler_hup
+{
+ default_value();
+ # HUP
+ kill 1, $$;
+ is $main::PROC_STAT{halt }, undef, 'signal HUP, not halt';
+ is $main::PROC_STAT{reload}, 'HUP', 'signal HUP, reload';
+}
+# test end
+#...............................................
+
+L7lib::comment_in();
+
+sub default_value {
+ undef $main::PROC_STAT{halt };
+ undef $main::PROC_STAT{reload};
+}
+sub override {
+ *ld_log = \&__ld_log;
+}
+sub __ld_log {
+}
--- /dev/null
+use strict;
+use warnings;
+no warnings qw(redefine once);
+use lib qw(t/lib lib);
+use subs qw(print);
+use Cwd;
+use L7lib;
+use Test::More tests => 33;
+
+L7lib::chdir();
+L7lib::comment_out();
+require './l7directord';
+override();
+
+our $filename = undef;
+our @message_only_args = ();
+our @message_args = ();
+our $init_error_arg = undef;
+our $ld_rm_file_arg = undef;
+our $ld_log_arg = undef;
+
+#...............................................
+# test start
+# - read_pid
+{
+ default_value();
+ create_pidfile($$);
+ local $0 = 'l7directord';
+ my ($oldpid, $filepid) = read_pid();
+ is $oldpid, $$, 'read_pid - from /proc/pid';
+ is $filepid, $$, 'read_pid - from pid file';
+ remove_pidfile();
+}
+{
+ default_value();
+ create_pidfile($$);
+ local $0 = 'l7directord';
+ my $oldpid = read_pid();
+ is $oldpid, $$, 'read_pid - get /proc/pid only';
+ remove_pidfile();
+}
+{
+ default_value();
+ create_pidfile($$);
+ local $0 = 'foobar';
+ my ($oldpid, $filepid) = read_pid();
+ is $oldpid, undef, 'read_pid - from /proc/pid, but process name mismatch';
+ is $filepid, $$, 'read_pid - from pid file';
+ remove_pidfile();
+}
+{
+ default_value();
+ create_pidfile($$);
+ local $0 = 'foobar';
+ my $oldpid = read_pid();
+ is $oldpid, undef, 'read_pid - get /proc/pid only, but process name mismatch';
+ remove_pidfile();
+}
+{
+ default_value();
+ create_pidfile(99999);
+ local $0 = 'l7directord';
+ my ($oldpid, $filepid) = read_pid();
+ is $oldpid, undef, 'read_pid - from /proc/pid, but no such proc file.';
+ is $filepid, 99999, 'read_pid - from pid file';
+ remove_pidfile();
+}
+{
+ default_value();
+ local $0 = 'l7directord';
+ my ($oldpid, $filepid) = read_pid();
+ is $oldpid, undef, 'read_pid - from /proc/pid';
+ is $filepid, undef, 'read_pid - from pid file, but no such pid file.';
+ remove_pidfile();
+}
+# - write_pid
+{
+ default_value();
+ remove_pidfile();
+ local @message_only_args = ();
+ local $init_error_arg = undef;
+ write_pid(1);
+ my $written = read_pidfile();
+ is $written, "1\n", 'write_pid - pid 1 specified';
+ remove_pidfile();
+}
+{
+ default_value();
+ remove_pidfile();
+ local @message_only_args = ();
+ local $init_error_arg = undef;
+ write_pid(0);
+ is_deeply \@message_only_args, ['ERR0412', 0], 'write_pid - pid 0 specified, error message';
+ is $init_error_arg, "message_only", 'write_pid - pid 0 specified, init_error';
+ remove_pidfile();
+}
+{
+ default_value();
+ remove_pidfile();
+ local @message_only_args = ();
+ local $init_error_arg = undef;
+ write_pid();
+ is_deeply \@message_only_args, ['ERR0412', 'undef'], 'write_pid - pid not specified, error message';
+ is $init_error_arg, "message_only", 'write_pid - pid not specified, init_error';
+ remove_pidfile();
+}
+{
+ default_value();
+ remove_pidfile();
+ local @message_only_args = ();
+ local $init_error_arg = undef;
+ write_pid('foobar');
+ is_deeply \@message_only_args, ['ERR0412', 'foobar'], 'write_pid - pid some word specified, error message';
+ is $init_error_arg, "message_only", 'write_pid - pid some word specified, init_error';
+ remove_pidfile();
+}
+{
+ default_value();
+ remove_pidfile();
+ local @message_only_args = ();
+ local $init_error_arg = undef;
+ local *close = \&__close;
+ write_pid(1);
+ is_deeply \@message_only_args, ['ERR0409', $filename, "close_error\n"], 'write_pid - close error';
+ is $init_error_arg, "message_only", 'write_pid - close error, init_error';
+ remove_pidfile();
+}
+# - remove_pid
+{
+ default_value();
+ local *ld_rm_file = \&__ld_rm_file;
+ remove_pid();
+ is $ld_rm_file_arg, $filename, 'remove_pid';
+}
+# - ld_rm_file
+{
+ default_value();
+ create_pidfile(1);
+ my $got = ld_rm_file($filename);
+ is $got, 0, 'ld_rm_file - success';
+}
+{
+ default_value();
+ my $got = ld_rm_file();
+ is $got, -1, 'ld_rm_file - error no delete file';
+ is_deeply \@message_args, ['ERR0411'], 'ld_rm_file - error message(1)';
+ is $ld_log_arg, 'message', 'ld_rm_file - error log(1)';
+}
+SKIP: {
+ default_value();
+ skip '/tmp not found!', 3 if (!-d '/tmp');
+ my $got = ld_rm_file('/tmp');
+ is $got, -1, 'ld_rm_file - error directory';
+ is_deeply \@message_args, ['ERR0401', '/tmp'], 'ld_rm_file - error message(2)';
+ is $ld_log_arg, 'message', 'ld_rm_file - error log(2)';
+}
+SKIP: {
+ default_value();
+ skip 'file /asdfasdf exist', 3 if (-e '/asdfasdf');
+ my $got = ld_rm_file('/asdfasdf');
+ is $got, -1, 'ld_rm_file - error file not found';
+ is_deeply \@message_args, ['ERR0402', '/asdfasdf'], 'ld_rm_file - error message(3)';
+ is $ld_log_arg, 'message', 'ld_rm_file - error log(3)';
+}
+SKIP: {
+ default_value();
+ skip 'file /proc/version not exist', 3 if (!-f '/proc/version');
+ my $got = ld_rm_file('/proc/version');
+ is $got, -1, 'ld_rm_file - error cannot remove';
+ is_deeply \@message_args, ['ERR0403', '/proc/version', $!], 'ld_rm_file - error message(4)';
+ is $ld_log_arg, 'message', 'ld_rm_file - error log(4)';
+}
+# test end
+#...............................................
+
+L7lib::comment_in();
+
+sub default_value {
+ $main::PROC_ENV{pid_prefix} = cwd;
+ $main::CONFIG_FILE{filename} = time;
+}
+sub override {
+ *_message_only = \&__message_only;
+ *_message = \&__message;
+ *ld_log = \&__ld_log;
+ *init_error = \&__init_error;
+}
+sub create_pidfile {
+ my $pid = shift;
+ $filename = $main::PROC_ENV{pid_prefix} . q{.} . $main::CONFIG_FILE{filename} . '.pid';
+ if (open my $f, ">", $filename) {
+ print $f $pid . "\n";
+ close $f;
+ return 1;
+ }
+ return 0;
+}
+sub read_pidfile {
+ $filename = $main::PROC_ENV{pid_prefix} . q{.} . $main::CONFIG_FILE{filename} . '.pid';
+ my $pidinfo = undef;
+ if (open my $f, "<", $filename) {
+ local $\ = undef;
+ $pidinfo = <$f>;
+ close $f;
+ }
+ return $pidinfo;
+}
+sub remove_pidfile {
+ $filename = $main::PROC_ENV{pid_prefix} . q{.} . $main::CONFIG_FILE{filename} . '.pid';
+ if (-f $filename) {
+ unlink $filename;
+ }
+}
+sub __message_only {
+ @message_only_args = @_;
+ return 'message_only';
+}
+sub __init_error {
+ $init_error_arg = shift;
+}
+sub __close {
+ die "close_error\n";
+}
+sub __ld_rm_file {
+ $ld_rm_file_arg = shift;
+}
+sub __ld_log {
+ $ld_log_arg = shift;
+}
+sub __message {
+ @message_args = @_;
+ return 'message';
+}
--- /dev/null
+use strict;
+use warnings;
+no warnings qw(redefine once);
+use lib qw(t/lib lib);
+use subs qw(print);
+use Cwd;
+use L7lib;
+use Test::More tests => 589;
+
+L7lib::chdir();
+L7lib::comment_out();
+require './l7directord';
+override();
+
+our @config_error_args = ();
+our @ld_gethostservbyname_args = undef;
+our $ld_gethostservbyname_return = undef;
+our $ld_gethostservbyname_undef = 0;
+our $_ld_service_resolve_called = 0;
+our @parse_fallback_args = ();
+our $parse_fallback_return = undef;
+our @parse_real_args = ();
+our $parse_real_return = undef;
+our $ld_openlog_arg = ();
+our $ld_openlog_return = undef;
+our @get_hostservbyname_args = ();
+our $get_hostservbyname_return = undef;
+our @ld_cmd_children_args = ();
+our $system_wrapper_called = 0;
+our $system_wrapper_return = undef;
+our $ld_setup_die = 0;
+our $read_config_die = 0;
+our $read_config_virtual = [];
+our $read_config_execute = {};
+#...............................................
+# test start
+# - read_config
+# - validate_config
+SKIP: {
+ my $input = <<"CONFIG";
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 2;
+ read_config();
+ is $main::PROC_STAT{initialized}, 1, 'read_config - empty config';
+ is_deeply \%main::CONFIG, \%main::GLOBAL, 'read_config - not set anything(1)';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+ # comment
+
+ # comment
+
+ # comment
+
+ # comment
+
+# comment
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 2;
+ read_config();
+ is $main::PROC_STAT{initialized}, 1, 'read_config - ignore comment';
+ is_deeply \%main::CONFIG, \%main::GLOBAL, 'read_config - not set anything(2)';
+ remove_config();
+}
+{
+ default_value();
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 0, 'read_config - no such config file';
+ is $@, "config_error\n", 'read_config - raise config_error(3)';
+ is_deeply \@config_error_args, [0, 'ERR0407', $main::CONFIG_FILE{path}], 'read_config - config_error args(3)';
+ is_deeply \%main::CONFIG, \%main::GLOBAL, 'read_config - not set anything(3)';
+}
+SKIP: {
+ my $input = <<"CONFIG";
+ #
+#
+
+virtual = virtual_value1
+virtual = "virtual_value2" # comment
+checktimeout =1
+negotiatetimeout= 2
+checkinterval=3
+retryinterval='4'
+configinterval="5"
+checkcount = 6
+autoreload = 'no'
+quiescent = yes # comment
+fallback=fallback_value
+callback=/bin/cat
+
+execute= /etc/hosts
+logfile= "logfile_value"
+ #
+supervised
+
+virtual = "virtual_value3" # comment
+ real = real_value1
+ real = real_value2
+ request='request'
+ #
+ receive = receive
+ login= "login"
+
+ passwd = "passwd"
+ database = database
+ virtualhost='virtualhost'
+ checktype = CoNnEcT
+ checktimeout =1
+
+ negotiatetimeout = 2
+ checkinterval=3
+ retryinterval='4'
+ checkcount = 6
+ maxconn=7
+ checkport = 10000
+ scheduler = rr
+ protocol= tcp
+ service = http
+ httpmethod = 'hEaD'
+ fallback = fallback_value
+ quiescent="yes"
+ #
+ module = url --pattern-match "/foo/bar" # comment
+
+ sorryserver= sorryserver_value
+ qosup = '0'
+ qosdown =999M
+
+ realdowncallback=/bin/cat
+ realrecovercallback = '/bin/cat'
+
+ customcheck = "/bin/echo"
+ #
+
+virtual = "virtual_value4" # comment
+ real = real_value3
+
+ #
+# end comment...
+CONFIG
+ my %config = (
+ 'autoreload' => 0,
+ 'checktimeout' => 1,
+ 'quiescent' => 1,
+ 'retryinterval' => 4,
+ 'negotiatetimeout' => 2,
+ 'checkinterval' => 3,
+ 'supervised' => 1,
+ 'fallback' => { 'tcp' => 'fallback_return' },
+ 'configinterval' => 5,
+ 'execute' => { '/etc/hosts' => 1 },
+ 'callback' => '/bin/cat',
+ 'checkcount' => 6,
+ 'logfile' => 'logfile_value',
+ 'virtual' => [
+ {
+ 'protocol' => 'tcp',
+ 'httpmethod' => 'GET',
+ 'qosdown' => 0,
+ 'retryinterval' => undef,
+ 'negotiatetimeout' => undef,
+ 'checkinterval' => undef,
+ 'server' => {},
+ 'qosup' => 0,
+ 'real' => undef,
+ 'module' => { 'name' => 'sessionless', 'key' => '' },
+ 'checktimeout' => undef,
+ 'request' => undef,
+ 'checktype' => 'negotiate',
+ 'virtualhost' => undef,
+ 'quiescent' => undef,
+ 'realrecovercallback' => undef,
+ 'sorryserver' => undef,
+ 'service' => undef,
+ 'login' => '',
+ 'fallback' => undef,
+ 'passwd' => '',
+ 'receive' => undef,
+ 'database' => '',
+ 'maxconn' => 0,
+ 'checkcount' => undef,
+ 'checkport' => undef,
+ 'scheduler' => 'rr',
+ 'realdowncallback' => undef,
+ 'customcheck' => undef,
+ },
+ {
+ 'protocol' => 'tcp',
+ 'httpmethod' => 'GET',
+ 'qosdown' => 0,
+ 'retryinterval' => undef,
+ 'negotiatetimeout' => undef,
+ 'checkinterval' => undef,
+ 'server' => {},
+ 'qosup' => 0,
+ 'real' => undef,
+ 'module' => { 'name' => 'sessionless', 'key' => '' },
+ 'checktimeout' => undef,
+ 'request' => undef,
+ 'checktype' => 'negotiate',
+ 'virtualhost' => undef,
+ 'quiescent' => undef,
+ 'realrecovercallback' => undef,
+ 'sorryserver' => undef,
+ 'service' => undef,
+ 'login' => '',
+ 'fallback' => undef,
+ 'passwd' => '',
+ 'receive' => undef,
+ 'database' => '',
+ 'maxconn' => 0,
+ 'checkcount' => undef,
+ 'checkport' => undef,
+ 'scheduler' => 'rr',
+ 'realdowncallback' => undef,
+ 'customcheck' => undef,
+ },
+ {
+ 'protocol' => 'tcp',
+ 'httpmethod' => 'HEAD',
+ 'qosdown' => '999M',
+ 'retryinterval' => 4,
+ 'negotiatetimeout' => 2,
+ 'checkinterval' => 3,
+ 'server' => {},
+ 'qosup' => '0',
+ 'real' => ['real', 'real'],
+ 'module' => {
+ 'name' => 'url',
+ 'option' => '--pattern-match /foo/bar',
+ 'key' => '--pattern-match /foo/bar'
+ },
+ 'checktimeout' => 1,
+ 'request' => 'request',
+ 'checktype' => 'connect',
+ 'virtualhost' => 'virtualhost',
+ 'quiescent' => 1,
+ 'realrecovercallback' => '/bin/cat',
+ 'sorryserver' => {},
+ 'service' => 'http',
+ 'login' => 'login',
+ 'fallback' => { 'tcp' => 'fallback_return' },
+ 'passwd' => 'passwd',
+ 'receive' => 'receive',
+ 'database' => 'database',
+ 'maxconn' => 7,
+ 'checkcount' => 6,
+ 'checkport' => 10000,
+ 'scheduler' => 'rr',
+ 'realdowncallback' => '/bin/cat',
+ 'customcheck' => '/bin/echo',
+ },
+ {
+ 'protocol' => 'tcp',
+ 'httpmethod' => 'GET',
+ 'qosdown' => 0,
+ 'retryinterval' => undef,
+ 'negotiatetimeout' => undef,
+ 'checkinterval' => undef,
+ 'server' => {},
+ 'qosup' => 0,
+ 'real' => ['real'],
+ 'module' => { 'name' => 'sessionless', 'key' => '' },
+ 'checktimeout' => undef,
+ 'request' => undef,
+ 'checktype' => 'negotiate',
+ 'virtualhost' => undef,
+ 'quiescent' => undef,
+ 'realrecovercallback' => undef,
+ 'sorryserver' => undef,
+ 'service' => undef,
+ 'login' => '',
+ 'fallback' => undef,
+ 'passwd' => '',
+ 'receive' => undef,
+ 'database' => '',
+ 'maxconn' => 0,
+ 'checkcount' => undef,
+ 'checkport' => undef,
+ 'scheduler' => 'rr',
+ 'realdowncallback' => undef,
+ 'customcheck' => undef,
+ }
+ ]
+ );
+ default_value();
+ local $ld_gethostservbyname_return = {};
+ local @ld_gethostservbyname_args = ();
+ local $_ld_service_resolve_called = 0;
+ local @parse_fallback_args = ();
+ local $parse_fallback_return = 'fallback_return';
+ local @parse_real_args = ();
+ local $parse_real_return = ['real'];
+ local $ld_openlog_arg = ();
+ local $ld_openlog_return = 0;
+ create_config($input) or skip 'cannot create config', 7;
+ read_config();
+ is $main::PROC_STAT{initialized}, 1, 'read_config - full config';
+ is_deeply \%main::CONFIG, \%config, 'read_config - set all value';
+ is $_ld_service_resolve_called, 4, 'read_config - _ld_service_resolve called';
+ is_deeply \@ld_gethostservbyname_args,
+ ['virtual_value1', 'tcp', 'virtual_value2', 'tcp', 'virtual_value3', 'tcp',
+ 'sorryserver_value', 'tcp', 'virtual_value4', 'tcp'],
+ 'read_config - _ld_gethostservbyname called';
+ is_deeply \@parse_fallback_args,
+ [14, 'fallback_value', 'fallback=fallback_value',
+ 46, 'fallback_value', ' fallback = fallback_value'],
+ 'read_config - parse_fallback called';
+ is_deeply \@parse_real_args,
+ [23, 'real_value1', ' real = real_value1',
+ 24, 'real_value2', ' real = real_value2',
+ 62, 'real_value3', ' real = real_value3'],
+ 'read_config - parse_real called';
+ is $ld_openlog_arg, 'logfile_value', 'read_config - ld_openlog called';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+checktimeout=1
+CONFIG
+ my %config = %main::GLOBAL;
+ $config{checktimeout} = 1;
+ default_value();
+ create_config($input) or skip 'cannot create config', 2;
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 1, 'read_config - checktimeout result ok';
+ is_deeply \%main::CONFIG, \%config, 'read_config - checktimeout set config ok';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+checktimeout
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 4;
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 0, 'read_config - checktimeout not defined';
+ is $@, "config_error\n", 'read_config - raise config_error(4)';
+ is_deeply \@config_error_args, [1, 'ERR0101', 'checktimeout'], 'read_config - config_error args(4)';
+ is_deeply \%main::CONFIG, \%main::GLOBAL, 'read_config - not set anything(4)';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+checktimeout=yes
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 4;
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 0, 'read_config - checktimeout not numeric';
+ is $@, "config_error\n", 'read_config - raise config_error(5)';
+ is_deeply \@config_error_args, [1, 'ERR0101', 'checktimeout=yes'], 'read_config - config_error args(5)';
+ is_deeply \%main::CONFIG, \%main::GLOBAL, 'read_config - not set anything(5)';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+checktimeout=0
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 4;
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 0, 'read_config - checktimeout zero';
+ is $@, "config_error\n", 'read_config - raise config_error(6)';
+ is_deeply \@config_error_args, [1, 'ERR0101', 'checktimeout=0'], 'read_config - config_error args(6)';
+ is_deeply \%main::CONFIG, \%main::GLOBAL, 'read_config - not set anything(6)';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+negotiatetimeout=1
+CONFIG
+ my %config = %main::GLOBAL;
+ $config{negotiatetimeout} = 1;
+ default_value();
+ create_config($input) or skip 'cannot create config', 2;
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 1, 'read_config - negotiatetimeout result ok';
+ is_deeply \%main::CONFIG, \%config, 'read_config - negotiatetimeout set config ok';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+negotiatetimeout
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 4;
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 0, 'read_config - negotiatetimeout not defined';
+ is $@, "config_error\n", 'read_config - raise config_error(7)';
+ is_deeply \@config_error_args, [1, 'ERR0101', 'negotiatetimeout'], 'read_config - config_error args(7)';
+ is_deeply \%main::CONFIG, \%main::GLOBAL, 'read_config - not set anything(7)';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+negotiatetimeout=yes
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 4;
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 0, 'read_config - negotiatetimeout not numeric';
+ is $@, "config_error\n", 'read_config - raise config_error(8)';
+ is_deeply \@config_error_args, [1, 'ERR0101', 'negotiatetimeout=yes'], 'read_config - config_error args(8)';
+ is_deeply \%main::CONFIG, \%main::GLOBAL, 'read_config - not set anything(8)';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+negotiatetimeout=0
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 4;
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 0, 'read_config - negotiatetimeout zero';
+ is $@, "config_error\n", 'read_config - raise config_error(9)';
+ is_deeply \@config_error_args, [1, 'ERR0101', 'negotiatetimeout=0'], 'read_config - config_error args(9)';
+ is_deeply \%main::CONFIG, \%main::GLOBAL, 'read_config - not set anything(9)';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+checkinterval=1
+CONFIG
+ my %config = %main::GLOBAL;
+ $config{checkinterval} = 1;
+ default_value();
+ create_config($input) or skip 'cannot create config', 2;
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 1, 'read_config - checkinterval result ok';
+ is_deeply \%main::CONFIG, \%config, 'read_config - checkinterval set config ok';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+checkinterval
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 4;
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 0, 'read_config - checkinterval not defined';
+ is $@, "config_error\n", 'read_config - raise config_error(10)';
+ is_deeply \@config_error_args, [1, 'ERR0101', 'checkinterval'], 'read_config - config_error args(10)';
+ is_deeply \%main::CONFIG, \%main::GLOBAL, 'read_config - not set anything(10)';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+checkinterval=yes
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 4;
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 0, 'read_config - checkinterval not numeric';
+ is $@, "config_error\n", 'read_config - raise config_error(11)';
+ is_deeply \@config_error_args, [1, 'ERR0101', 'checkinterval=yes'], 'read_config - config_error args(11)';
+ is_deeply \%main::CONFIG, \%main::GLOBAL, 'read_config - not set anything(11)';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+checkinterval=0
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 4;
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 0, 'read_config - checkinterval zero';
+ is $@, "config_error\n", 'read_config - raise config_error(12)';
+ is_deeply \@config_error_args, [1, 'ERR0101', 'checkinterval=0'], 'read_config - config_error args(12)';
+ is_deeply \%main::CONFIG, \%main::GLOBAL, 'read_config - not set anything(12)';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+retryinterval=1
+CONFIG
+ my %config = %main::GLOBAL;
+ $config{retryinterval} = 1;
+ default_value();
+ create_config($input) or skip 'cannot create config', 2;
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 1, 'read_config - retryinterval result ok';
+ is_deeply \%main::CONFIG, \%config, 'read_config - retryinterval set config ok';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+retryinterval
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 4;
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 0, 'read_config - retryinterval not defined';
+ is $@, "config_error\n", 'read_config - raise config_error(13)';
+ is_deeply \@config_error_args, [1, 'ERR0101', 'retryinterval'], 'read_config - config_error args(13)';
+ is_deeply \%main::CONFIG, \%main::GLOBAL, 'read_config - not set anything(13)';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+retryinterval=yes
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 4;
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 0, 'read_config - retryinterval not numeric';
+ is $@, "config_error\n", 'read_config - raise config_error(14)';
+ is_deeply \@config_error_args, [1, 'ERR0101', 'retryinterval=yes'], 'read_config - config_error args(14)';
+ is_deeply \%main::CONFIG, \%main::GLOBAL, 'read_config - not set anything(14)';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+retryinterval=0
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 4;
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 0, 'read_config - retryinterval zero';
+ is $@, "config_error\n", 'read_config - raise config_error(15)';
+ is_deeply \@config_error_args, [1, 'ERR0101', 'retryinterval=0'], 'read_config - config_error args(15)';
+ is_deeply \%main::CONFIG, \%main::GLOBAL, 'read_config - not set anything(15)';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+configinterval=1
+CONFIG
+ my %config = %main::GLOBAL;
+ $config{configinterval} = 1;
+ default_value();
+ create_config($input) or skip 'cannot create config', 2;
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 1, 'read_config - configinterval result ok';
+ is_deeply \%main::CONFIG, \%config, 'read_config - configinterval set config ok';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+configinterval
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 4;
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 0, 'read_config - configinterval not defined';
+ is $@, "config_error\n", 'read_config - raise config_error(16)';
+ is_deeply \@config_error_args, [1, 'ERR0101', 'configinterval'], 'read_config - config_error args(16)';
+ is_deeply \%main::CONFIG, \%main::GLOBAL, 'read_config - not set anything(16)';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+configinterval=yes
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 4;
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 0, 'read_config - configinterval not numeric';
+ is $@, "config_error\n", 'read_config - raise config_error(17)';
+ is_deeply \@config_error_args, [1, 'ERR0101', 'configinterval=yes'], 'read_config - config_error args(17)';
+ is_deeply \%main::CONFIG, \%main::GLOBAL, 'read_config - not set anything(17)';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+configinterval=0
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 4;
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 0, 'read_config - configinterval zero';
+ is $@, "config_error\n", 'read_config - raise config_error(18)';
+ is_deeply \@config_error_args, [1, 'ERR0101', 'configinterval=0'], 'read_config - config_error args(18)';
+ is_deeply \%main::CONFIG, \%main::GLOBAL, 'read_config - not set anything(18)';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+checkcount=1
+CONFIG
+ my %config = %main::GLOBAL;
+ $config{checkcount} = 1;
+ default_value();
+ create_config($input) or skip 'cannot create config', 2;
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 1, 'read_config - checkcount result ok';
+ is_deeply \%main::CONFIG, \%config, 'read_config - checkcount set config ok';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+checkcount
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 4;
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 0, 'read_config - checkcount not defined';
+ is $@, "config_error\n", 'read_config - raise config_error(19)';
+ is_deeply \@config_error_args, [1, 'ERR0101', 'checkcount'], 'read_config - config_error args(19)';
+ is_deeply \%main::CONFIG, \%main::GLOBAL, 'read_config - not set anything(19)';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+checkcount=yes
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 4;
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 0, 'read_config - checkcount not numeric';
+ is $@, "config_error\n", 'read_config - raise config_error(20)';
+ is_deeply \@config_error_args, [1, 'ERR0101', 'checkcount=yes'], 'read_config - config_error args(20)';
+ is_deeply \%main::CONFIG, \%main::GLOBAL, 'read_config - not set anything(20)';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+checkcount=0
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 4;
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 0, 'read_config - checkcount zero';
+ is $@, "config_error\n", 'read_config - raise config_error(21)';
+ is_deeply \@config_error_args, [1, 'ERR0101', 'checkcount=0'], 'read_config - config_error args(21)';
+ is_deeply \%main::CONFIG, \%main::GLOBAL, 'read_config - not set anything(21)';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+autoreload=YeS
+CONFIG
+ my %config = %main::GLOBAL;
+ $config{autoreload} = 1;
+ default_value();
+ create_config($input) or skip 'cannot create config', 2;
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 1, 'read_config - autoreload yes result ok';
+ is_deeply \%main::CONFIG, \%config, 'read_config - autoreload yes set config ok';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+autoreload=nO
+CONFIG
+ my %config = %main::GLOBAL;
+ $config{autoreload} = 0;
+ default_value();
+ create_config($input) or skip 'cannot create config', 2;
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 1, 'read_config - autoreload no result ok';
+ is_deeply \%main::CONFIG, \%config, 'read_config - autoreload no set config ok';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+autoreload
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 4;
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 0, 'read_config - autoreload not defined';
+ is $@, "config_error\n", 'read_config - raise config_error(22)';
+ is_deeply \@config_error_args, [1, 'ERR0102', 'autoreload'], 'read_config - config_error args(22)';
+ is_deeply \%main::CONFIG, \%main::GLOBAL, 'read_config - not set anything(22)';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+autoreload=YEAH
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 4;
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 0, 'read_config - autoreload not lower yes or no(1)';
+ is $@, "config_error\n", 'read_config - raise config_error(23)';
+ is_deeply \@config_error_args, [1, 'ERR0102', 'autoreload=YEAH'], 'read_config - config_error args(23)';
+ is_deeply \%main::CONFIG, \%main::GLOBAL, 'read_config - not set anything(23)';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+autoreload=0
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 4;
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 0, 'read_config - autoreload not lower yes or no(2)';
+ is $@, "config_error\n", 'read_config - raise config_error(24)';
+ is_deeply \@config_error_args, [1, 'ERR0102', 'autoreload=0'], 'read_config - config_error args(24)';
+ is_deeply \%main::CONFIG, \%main::GLOBAL, 'read_config - not set anything(24)';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+quiescent=yEs
+CONFIG
+ my %config = %main::GLOBAL;
+ $config{quiescent} = 1;
+ default_value();
+ create_config($input) or skip 'cannot create config', 2;
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 1, 'read_config - quiescent yes result ok';
+ is_deeply \%main::CONFIG, \%config, 'read_config - quiescent yes set config ok';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+quiescent=No
+CONFIG
+ my %config = %main::GLOBAL;
+ $config{quiescent} = 0;
+ default_value();
+ create_config($input) or skip 'cannot create config', 2;
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 1, 'read_config - quiescent no result ok';
+ is_deeply \%main::CONFIG, \%config, 'read_config - quiescent no set config ok';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+quiescent
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 4;
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 0, 'read_config - quiescent not defined';
+ is $@, "config_error\n", 'read_config - raise config_error(25)';
+ is_deeply \@config_error_args, [1, 'ERR0102', 'quiescent'], 'read_config - config_error args(25)';
+ is_deeply \%main::CONFIG, \%main::GLOBAL, 'read_config - not set anything(25)';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+quiescent=NOPE
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 4;
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 0, 'read_config - quiescent not lower yes or no(1)';
+ is $@, "config_error\n", 'read_config - raise config_error(26)';
+ is_deeply \@config_error_args, [1, 'ERR0102', 'quiescent=NOPE'], 'read_config - config_error args(26)';
+ is_deeply \%main::CONFIG, \%main::GLOBAL, 'read_config - not set anything(26)';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+quiescent=0
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 4;
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 0, 'read_config - quiescent not lower yes or no(2)';
+ is $@, "config_error\n", 'read_config - raise config_error(27)';
+ is_deeply \@config_error_args, [1, 'ERR0102', 'quiescent=0'], 'read_config - config_error args(27)';
+ is_deeply \%main::CONFIG, \%main::GLOBAL, 'read_config - not set anything(27)';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+fallback
+CONFIG
+ my %config = %main::GLOBAL;
+ $config{fallback} = { tcp => undef };
+ default_value();
+ create_config($input) or skip 'cannot create config', 3;
+ local @parse_fallback_args = ();
+ local $parse_fallback_return = undef;
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 1, 'read_config - fallback not defined';
+ is_deeply \%main::CONFIG, \%config, 'read_config - fallback set undef..';
+ is_deeply \@parse_fallback_args, [1, undef, 'fallback'], 'read_config - parse_fallback_args(1)';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+fallback=localhost:http
+CONFIG
+ my %config = %main::GLOBAL;
+ $config{fallback} = { tcp => 'fallback' };
+ default_value();
+ create_config($input) or skip 'cannot create config', 3;
+ local @parse_fallback_args = ();
+ local $parse_fallback_return = 'fallback';
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 1, 'read_config - fallback ok';
+ is_deeply \%main::CONFIG, \%config, 'read_config - fallback set normal';
+ is_deeply \@parse_fallback_args, [1, 'localhost:http', 'fallback=localhost:http'], 'read_config - parse_fallback_args(2)';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+callback=/bin/sh
+CONFIG
+ my %config = %main::GLOBAL;
+ $config{callback} = '/bin/sh';
+ default_value();
+ create_config($input) or skip 'cannot create config', 2;
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 1, 'read_config - callback result ok';
+ is_deeply \%main::CONFIG, \%config, 'read_config - callback set config ok';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+callback
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 4;
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 0, 'read_config - callback not defined';
+ is $@, "config_error\n", 'read_config - raise config_error(28)';
+ is_deeply \@config_error_args, [1, 'ERR0117', 'callback'], 'read_config - config_error args(28)';
+ is_deeply \%main::CONFIG, \%main::GLOBAL, 'read_config - not set anything(28)';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+callback=/proc/1
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 4;
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 0, 'read_config - callback cannot execute';
+ is $@, "config_error\n", 'read_config - raise config_error(29)';
+ is_deeply \@config_error_args, [1, 'ERR0117', 'callback=/proc/1'], 'read_config - config_error args(29)';
+ is_deeply \%main::CONFIG, \%main::GLOBAL, 'read_config - not set anything(29)';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+callback=/proc/100000
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 4;
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 0, 'read_config - callback no such file';
+ is $@, "config_error\n", 'read_config - raise config_error(30)';
+ is_deeply \@config_error_args, [1, 'ERR0117', 'callback=/proc/100000'], 'read_config - config_error args(30)';
+ is_deeply \%main::CONFIG, \%main::GLOBAL, 'read_config - not set anything(30)';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+callback=/proc
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 4;
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 0, 'read_config - callback directory';
+ is $@, "config_error\n", 'read_config - raise config_error(31)';
+ is_deeply \@config_error_args, [1, 'ERR0117', 'callback=/proc'], 'read_config - config_error args(31)';
+ is_deeply \%main::CONFIG, \%main::GLOBAL, 'read_config - not set anything(31)';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+execute=/bin/sh
+execute=/bin/bash
+CONFIG
+ my %config = %main::GLOBAL;
+ $config{execute} = { '/bin/sh' => 1, '/bin/bash' => 1 };
+ default_value();
+ create_config($input) or skip 'cannot create config', 2;
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 1, 'read_config - execute result ok';
+ is_deeply \%main::CONFIG, \%config, 'read_config - execute set config ok';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+execute
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 4;
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 0, 'read_config - execute not defined';
+ is $@, "config_error\n", 'read_config - raise config_error(32)';
+ is_deeply \@config_error_args, [1, 'ERR0116', 'execute'], 'read_config - config_error args(32)';
+ is_deeply \%main::CONFIG, \%main::GLOBAL, 'read_config - not set anything(32)';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+execute=/proc/100000
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 4;
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 0, 'read_config - execute no such file';
+ is $@, "config_error\n", 'read_config - raise config_error(33)';
+ is_deeply \@config_error_args, [1, 'ERR0116', 'execute=/proc/100000'], 'read_config - config_error args(33)';
+ is_deeply \%main::CONFIG, \%main::GLOBAL, 'read_config - not set anything(33)';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+execute=/proc
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 4;
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 0, 'read_config - execute directory';
+ is $@, "config_error\n", 'read_config - raise config_error(34)';
+ is_deeply \@config_error_args, [1, 'ERR0116', 'execute=/proc'], 'read_config - config_error args(34)';
+ is_deeply \%main::CONFIG, \%main::GLOBAL, 'read_config - not set anything(34)';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+logfile=/bin/sh
+CONFIG
+ my %config = %main::GLOBAL;
+ $config{logfile} = '/bin/sh';
+ default_value();
+ create_config($input) or skip 'cannot create config', 2;
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 1, 'read_config - logfile result ok';
+ is_deeply \%main::CONFIG, \%config, 'read_config - logfile set config ok';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+logfile=sys
+CONFIG
+ my %config = %main::GLOBAL;
+ $config{logfile} = 'sys';
+ default_value();
+ create_config($input) or skip 'cannot create config', 2;
+ local $ld_openlog_arg = undef;
+ local $ld_openlog_return = 0;
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 1, 'read_config - logfile ld_openlog ok';
+ is_deeply \%main::CONFIG, \%config, 'read_config - logfile ld_openlog ok';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+logfile
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 4;
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 0, 'read_config - logfile not defined';
+ is $@, "config_error\n", 'read_config - raise config_error(35)';
+ is_deeply \@config_error_args, [1, 'ERR0118', 'logfile'], 'read_config - config_error args(35)';
+ is_deeply \%main::CONFIG, \%main::GLOBAL, 'read_config - not set anything(35)';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+logfile=sys
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 5;
+ local $ld_openlog_arg = undef;
+ local $ld_openlog_return = 1;
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 0, 'read_config - logfile ld_openlog fail';
+ is $@, "config_error\n", 'read_config - raise config_error(36)';
+ is_deeply \@config_error_args, [1, 'ERR0118', 'logfile=sys'], 'read_config - config_error args(36)';
+ is_deeply \%main::CONFIG, \%main::GLOBAL, 'read_config - not set anything(36)';
+ is $ld_openlog_arg, 'sys', 'read_config - ld_openlog arg';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+supervised
+CONFIG
+ my %config = %main::GLOBAL;
+ $config{supervised} = 1;
+ default_value();
+ create_config($input) or skip 'cannot create config', 2;
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 1, 'read_config - supervised result ok(1)';
+ is_deeply \%main::CONFIG, \%config, 'read_config - supervised set config ok(1)';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+supervised = yes
+CONFIG
+ my %config = %main::GLOBAL;
+ $config{supervised} = 1;
+ default_value();
+ create_config($input) or skip 'cannot create config', 2;
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 1, 'read_config - supervised result ok(2)';
+ is_deeply \%main::CONFIG, \%config, 'read_config - supervised set config ok(2)';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+supervised = no
+CONFIG
+ my %config = %main::GLOBAL;
+ $config{supervised} = 1;
+ default_value();
+ create_config($input) or skip 'cannot create config', 2;
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 1, 'read_config - supervised result ok(3)';
+ is_deeply \%main::CONFIG, \%config, 'read_config - supervised set config ok(3)';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+unknown
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 4;
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 0, 'read_config - unknown config';
+ is $@, "config_error\n", 'read_config - raise config_error(37)';
+ is_deeply \@config_error_args, [1, 'ERR0120', 'unknown'], 'read_config - config_error args(37)';
+ is_deeply \%main::CONFIG, \%main::GLOBAL, 'read_config - not set anything(37)';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+virtual
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 5;
+ local @ld_gethostservbyname_args = ();
+ local $ld_gethostservbyname_return = undef;
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 0, 'read_config - virtual not defined';
+ is $@, "config_error\n", 'read_config - raise config_error(38)';
+ is_deeply \@config_error_args, [1, 'ERR0114', 'virtual'], 'read_config - config_error args(38)';
+ is_deeply \%main::CONFIG, \%main::GLOBAL, 'read_config - not set anything(38)';
+ is_deeply \@ld_gethostservbyname_args, [undef, 'tcp'], 'read_config - ld_gethostservbyname args(1)';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+virtual=localhost:http
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 4;
+ local @ld_gethostservbyname_args = ();
+ local $ld_gethostservbyname_return = { ip => '127.0.0.1', port => 80 };
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 1, 'read_config - virtual normal ok';
+ is $main::CONFIG{virtual}[0]{server}{ip}, '127.0.0.1', 'read_config - set virtual ip ok';
+ is $main::CONFIG{virtual}[0]{server}{port}, 80, 'read_config - set virtual port ok';
+ is_deeply \@ld_gethostservbyname_args, ['localhost:http', 'tcp'], 'read_config - ld_gethostservbyname args(2)';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+ real=localhost:http
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 4;
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 0, 'read_config - virtual section - no virtual line';
+ is $@, "config_error\n", 'read_config - virtual section - raise config_error(1)';
+ is_deeply \@config_error_args, [1, 'ERR0119', ' real=localhost:http'], 'read_config - virtual section - config_error args(1)';
+ is_deeply \%main::CONFIG, \%main::GLOBAL, 'read_config - virtual section - not set anything(1)';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+virtual=localhost:http
+ unknown
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 3;
+ local @ld_gethostservbyname_args = ();
+ local $ld_gethostservbyname_return = { ip => '127.0.0.1', port => 80 };
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 0, 'read_config - virtual section - unknown config';
+ is $@, "config_error\n", 'read_config - virtual section - raise config_error(2)';
+ is_deeply \@config_error_args, [2, 'ERR0120', ' unknown'], 'read_config - virtual section - config_error args(2)';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+virtual=localhost:http
+ real="realhost1:ftp"
+ real="realhost2:ftp"
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 6;
+ local @ld_gethostservbyname_args = ();
+ local $ld_gethostservbyname_return = { ip => '127.0.0.1', port => 80 };
+ local @parse_real_args = ();
+ local $parse_real_return = [ {server => { ip => '127.0.0.2', port => 21 } } ];
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 1, 'read_config - virtual section - real ok';
+ is $main::CONFIG{virtual}[0]{real}[0]{server}{ip}, '127.0.0.2', 'read_config - virtual section - set real ip ok(1)';
+ is $main::CONFIG{virtual}[0]{real}[0]{server}{port}, 21, 'read_config - virtual section - set real port ok(1)';
+ is $main::CONFIG{virtual}[0]{real}[1]{server}{ip}, '127.0.0.2', 'read_config - virtual section - set real ip ok(2)';
+ is $main::CONFIG{virtual}[0]{real}[1]{server}{port}, 21, 'read_config - virtual section - set real port ok(2)';
+ is_deeply \@parse_real_args, [2, 'realhost1:ftp', ' real="realhost1:ftp"',
+ 3, 'realhost2:ftp', ' real="realhost2:ftp"'], 'read_config - virtual section - parse_real args';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+virtual=localhost:http
+ real
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 3;
+ local @ld_gethostservbyname_args = ();
+ local $ld_gethostservbyname_return = { ip => '127.0.0.1', port => 80 };
+ local @parse_real_args = ();
+ local $parse_real_return = undef;
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 1, 'read_config - virtual section - real not defined';
+ is_deeply \@parse_real_args, [2, undef, ' real'], 'read_config - virtual section - parse_real args(3)';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+virtual=localhost:http
+ request="/index.html"
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 2;
+ local @ld_gethostservbyname_args = ();
+ local $ld_gethostservbyname_return = { ip => '127.0.0.1', port => 80 };
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 1, 'read_config - virtual section - request ok';
+ is $main::CONFIG{virtual}[0]{request}, '/index.html', 'read_config - virtual section - set request ok';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+virtual=localhost:http
+ request =
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 3;
+ local @ld_gethostservbyname_args = ();
+ local $ld_gethostservbyname_return = { ip => '127.0.0.1', port => 80 };
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 0, 'read_config - virtual section - request not defined';
+ is $@, "config_error\n", 'read_config - virtual section - raise config_error(4)';
+ is_deeply \@config_error_args, [2, 'ERR0103', ' request ='], 'read_config - virtual section - config_error args(4)';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+virtual=localhost:http
+ request = ""
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 3;
+ local @ld_gethostservbyname_args = ();
+ local $ld_gethostservbyname_return = { ip => '127.0.0.1', port => 80 };
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 0, 'read_config - virtual section - empty request';
+ is $@, "config_error\n", 'read_config - virtual section - raise config_error(5)';
+ is_deeply \@config_error_args, [2, 'ERR0103', ' request = ""'], 'read_config - virtual section - config_error args(5)';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+virtual=localhost:http
+ receive='body'
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 2;
+ local @ld_gethostservbyname_args = ();
+ local $ld_gethostservbyname_return = { ip => '127.0.0.1', port => 80 };
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 1, 'read_config - virtual section - receive ok';
+ is $main::CONFIG{virtual}[0]{receive}, 'body', 'read_config - virtual section - set receive ok';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+virtual=localhost:http
+ receive =
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 3;
+ local @ld_gethostservbyname_args = ();
+ local $ld_gethostservbyname_return = { ip => '127.0.0.1', port => 80 };
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 0, 'read_config - virtual section - receive not defined';
+ is $@, "config_error\n", 'read_config - virtual section - raise config_error(4)';
+ is_deeply \@config_error_args, [2, 'ERR0103', ' receive ='], 'read_config - virtual section - config_error args(4)';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+virtual=localhost:http
+ receive = ""
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 3;
+ local @ld_gethostservbyname_args = ();
+ local $ld_gethostservbyname_return = { ip => '127.0.0.1', port => 80 };
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 0, 'read_config - virtual section - empty receive';
+ is $@, "config_error\n", 'read_config - virtual section - raise config_error(5)';
+ is_deeply \@config_error_args, [2, 'ERR0103', ' receive = ""'], 'read_config - virtual section - config_error args(5)';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+virtual=localhost:http
+ login= anonymous
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 2;
+ local @ld_gethostservbyname_args = ();
+ local $ld_gethostservbyname_return = { ip => '127.0.0.1', port => 80 };
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 1, 'read_config - virtual section - login ok';
+ is $main::CONFIG{virtual}[0]{login}, 'anonymous', 'read_config - virtual section - set login ok';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+virtual=localhost:http
+ login =
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 3;
+ local @ld_gethostservbyname_args = ();
+ local $ld_gethostservbyname_return = { ip => '127.0.0.1', port => 80 };
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 0, 'read_config - virtual section - login not defined';
+ is $@, "config_error\n", 'read_config - virtual section - raise config_error(4)';
+ is_deeply \@config_error_args, [2, 'ERR0103', ' login ='], 'read_config - virtual section - config_error args(4)';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+virtual=localhost:http
+ login = ""
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 3;
+ local @ld_gethostservbyname_args = ();
+ local $ld_gethostservbyname_return = { ip => '127.0.0.1', port => 80 };
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 0, 'read_config - virtual section - empty login';
+ is $@, "config_error\n", 'read_config - virtual section - raise config_error(5)';
+ is_deeply \@config_error_args, [2, 'ERR0103', ' login = ""'], 'read_config - virtual section - config_error args(5)';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+virtual=localhost:http
+ passwd = "ftp\@localhost"
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 2;
+ local @ld_gethostservbyname_args = ();
+ local $ld_gethostservbyname_return = { ip => '127.0.0.1', port => 80 };
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 1, 'read_config - virtual section - passwd ok';
+ is $main::CONFIG{virtual}[0]{passwd}, 'ftp@localhost', 'read_config - virtual section - set passwd ok';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+virtual=localhost:http
+ passwd =
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 3;
+ local @ld_gethostservbyname_args = ();
+ local $ld_gethostservbyname_return = { ip => '127.0.0.1', port => 80 };
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 0, 'read_config - virtual section - passwd not defined';
+ is $@, "config_error\n", 'read_config - virtual section - raise config_error(4)';
+ is_deeply \@config_error_args, [2, 'ERR0103', ' passwd ='], 'read_config - virtual section - config_error args(4)';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+virtual=localhost:http
+ passwd = ""
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 3;
+ local @ld_gethostservbyname_args = ();
+ local $ld_gethostservbyname_return = { ip => '127.0.0.1', port => 80 };
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 0, 'read_config - virtual section - empty passwd';
+ is $@, "config_error\n", 'read_config - virtual section - raise config_error(5)';
+ is_deeply \@config_error_args, [2, 'ERR0103', ' passwd = ""'], 'read_config - virtual section - config_error args(5)';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+virtual=localhost:http
+ database = "template"
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 2;
+ local @ld_gethostservbyname_args = ();
+ local $ld_gethostservbyname_return = { ip => '127.0.0.1', port => 80 };
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 1, 'read_config - virtual section - database ok';
+ is $main::CONFIG{virtual}[0]{database}, 'template', 'read_config - virtual section - set database ok';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+virtual=localhost:http
+ database =
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 3;
+ local @ld_gethostservbyname_args = ();
+ local $ld_gethostservbyname_return = { ip => '127.0.0.1', port => 80 };
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 0, 'read_config - virtual section - database not defined';
+ is $@, "config_error\n", 'read_config - virtual section - raise config_error(4)';
+ is_deeply \@config_error_args, [2, 'ERR0103', ' database ='], 'read_config - virtual section - config_error args(4)';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+virtual=localhost:http
+ database = ""
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 3;
+ local @ld_gethostservbyname_args = ();
+ local $ld_gethostservbyname_return = { ip => '127.0.0.1', port => 80 };
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 0, 'read_config - virtual section - empty database';
+ is $@, "config_error\n", 'read_config - virtual section - raise config_error(5)';
+ is_deeply \@config_error_args, [2, 'ERR0103', ' database = ""'], 'read_config - virtual section - config_error args(5)';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+virtual=localhost:http
+ virtualhost = "vip.domain.com"
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 2;
+ local @ld_gethostservbyname_args = ();
+ local $ld_gethostservbyname_return = { ip => '127.0.0.1', port => 80 };
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 1, 'read_config - virtual section - virtualhost ok';
+ is $main::CONFIG{virtual}[0]{virtualhost}, 'vip.domain.com', 'read_config - virtual section - set virtualhost ok';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+virtual=localhost:http
+ virtualhost =
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 3;
+ local @ld_gethostservbyname_args = ();
+ local $ld_gethostservbyname_return = { ip => '127.0.0.1', port => 80 };
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 0, 'read_config - virtual section - virtualhost not defined';
+ is $@, "config_error\n", 'read_config - virtual section - raise config_error(4)';
+ is_deeply \@config_error_args, [2, 'ERR0103', ' virtualhost ='], 'read_config - virtual section - config_error args(4)';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+virtual=localhost:http
+ virtualhost = ""
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 3;
+ local @ld_gethostservbyname_args = ();
+ local $ld_gethostservbyname_return = { ip => '127.0.0.1', port => 80 };
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 0, 'read_config - virtual section - empty virtualhost';
+ is $@, "config_error\n", 'read_config - virtual section - raise config_error(5)';
+ is_deeply \@config_error_args, [2, 'ERR0103', ' virtualhost = ""'], 'read_config - virtual section - config_error args(5)';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+virtual=localhost:http
+ checktype = CoNnEcT
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 2;
+ local @ld_gethostservbyname_args = ();
+ local $ld_gethostservbyname_return = { ip => '127.0.0.1', port => 80 };
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 1, 'read_config - virtual section - checktype connect ok';
+ is $main::CONFIG{virtual}[0]{checktype}, 'connect', 'read_config - virtual section - set checktype connect ok';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+virtual=localhost:http
+ checktype = nEgOtIaTe
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 2;
+ local @ld_gethostservbyname_args = ();
+ local $ld_gethostservbyname_return = { ip => '127.0.0.1', port => 80 };
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 1, 'read_config - virtual section - checktype negotiate ok';
+ is $main::CONFIG{virtual}[0]{checktype}, 'negotiate', 'read_config - virtual section - set checktype negotiate ok';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+virtual=localhost:http
+ checktype = piNG
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 2;
+ local @ld_gethostservbyname_args = ();
+ local $ld_gethostservbyname_return = { ip => '127.0.0.1', port => 80 };
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 1, 'read_config - virtual section - checktype ping ok';
+ is $main::CONFIG{virtual}[0]{checktype}, 'ping', 'read_config - virtual section - set checktype ping ok';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+virtual=localhost:http
+ checktype = Off
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 2;
+ local @ld_gethostservbyname_args = ();
+ local $ld_gethostservbyname_return = { ip => '127.0.0.1', port => 80 };
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 1, 'read_config - virtual section - checktype off ok';
+ is $main::CONFIG{virtual}[0]{checktype}, 'off', 'read_config - virtual section - set checktype off ok';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+virtual=localhost:http
+ checktype = oN
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 2;
+ local @ld_gethostservbyname_args = ();
+ local $ld_gethostservbyname_return = { ip => '127.0.0.1', port => 80 };
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 1, 'read_config - virtual section - checktype on ok';
+ is $main::CONFIG{virtual}[0]{checktype}, 'on', 'read_config - virtual section - set checktype on ok';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+virtual=localhost:http
+ checktype = 1
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 2;
+ local @ld_gethostservbyname_args = ();
+ local $ld_gethostservbyname_return = { ip => '127.0.0.1', port => 80 };
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 1, 'read_config - virtual section - checktype combined ok';
+ is $main::CONFIG{virtual}[0]{checktype}, '1', 'read_config - virtual section - set checktype combined ok';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+virtual=localhost:http
+ checktype =
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 3;
+ local @ld_gethostservbyname_args = ();
+ local $ld_gethostservbyname_return = { ip => '127.0.0.1', port => 80 };
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 0, 'read_config - virtual section - checktype not defined';
+ is $@, "config_error\n", 'read_config - virtual section - raise config_error(6)';
+ is_deeply \@config_error_args, [2, 'ERR0104', ' checktype ='], 'read_config - virtual section - config_error args(6)';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+virtual=localhost:http
+ checktype = unknown
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 3;
+ local @ld_gethostservbyname_args = ();
+ local $ld_gethostservbyname_return = { ip => '127.0.0.1', port => 80 };
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 0, 'read_config - virtual section - checktype not valid';
+ is $@, "config_error\n", 'read_config - virtual section - raise config_error(7)';
+ is_deeply \@config_error_args, [2, 'ERR0104', ' checktype = unknown'], 'read_config - virtual section - config_error args(7)';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+virtual=localhost:http
+ checktype = 0
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 3;
+ local @ld_gethostservbyname_args = ();
+ local $ld_gethostservbyname_return = { ip => '127.0.0.1', port => 80 };
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 0, 'read_config - virtual section - checktype is zero';
+ is $@, "config_error\n", 'read_config - virtual section - raise config_error(8)';
+ is_deeply \@config_error_args, [2, 'ERR0104', ' checktype = 0'], 'read_config - virtual section - config_error args(8)';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+virtual=localhost:http
+ checktimeout = '1'
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 2;
+ local @ld_gethostservbyname_args = ();
+ local $ld_gethostservbyname_return = { ip => '127.0.0.1', port => 80 };
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 1, 'read_config - virtual section - checktimeout ok';
+ is $main::CONFIG{virtual}[0]{checktimeout}, '1', 'read_config - virtual section - set checktimeout ok';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+virtual=localhost:http
+ checktimeout
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 3;
+ local @ld_gethostservbyname_args = ();
+ local $ld_gethostservbyname_return = { ip => '127.0.0.1', port => 80 };
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 0, 'read_config - virtual section - checktimeout not defined';
+ is $@, "config_error\n", 'read_config - virtual section - raise config_error(9)';
+ is_deeply \@config_error_args, [2, 'ERR0101', ' checktimeout'], 'read_config - virtual section - config_error args(9)';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+virtual=localhost:http
+ checktimeout = yes
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 3;
+ local @ld_gethostservbyname_args = ();
+ local $ld_gethostservbyname_return = { ip => '127.0.0.1', port => 80 };
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 0, 'read_config - virtual section - checktimeout not numeric';
+ is $@, "config_error\n", 'read_config - virtual section - raise config_error(10)';
+ is_deeply \@config_error_args, [2, 'ERR0101', ' checktimeout = yes'], 'read_config - virtual section - config_error args(10)';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+virtual=localhost:http
+ checktimeout = 0
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 3;
+ local @ld_gethostservbyname_args = ();
+ local $ld_gethostservbyname_return = { ip => '127.0.0.1', port => 80 };
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 0, 'read_config - virtual section - checktimeout is zero';
+ is $@, "config_error\n", 'read_config - virtual section - raise config_error(11)';
+ is_deeply \@config_error_args, [2, 'ERR0101', ' checktimeout = 0'], 'read_config - virtual section - config_error args(11)';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+virtual=localhost:http
+ negotiatetimeout = '1'
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 2;
+ local @ld_gethostservbyname_args = ();
+ local $ld_gethostservbyname_return = { ip => '127.0.0.1', port => 80 };
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 1, 'read_config - virtual section - negotiatetimeout ok';
+ is $main::CONFIG{virtual}[0]{negotiatetimeout}, '1', 'read_config - virtual section - set negotiatetimeout ok';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+virtual=localhost:http
+ negotiatetimeout
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 3;
+ local @ld_gethostservbyname_args = ();
+ local $ld_gethostservbyname_return = { ip => '127.0.0.1', port => 80 };
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 0, 'read_config - virtual section - negotiatetimeout not defined';
+ is $@, "config_error\n", 'read_config - virtual section - raise config_error(12)';
+ is_deeply \@config_error_args, [2, 'ERR0101', ' negotiatetimeout'], 'read_config - virtual section - config_error args(12)';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+virtual=localhost:http
+ negotiatetimeout = yes
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 3;
+ local @ld_gethostservbyname_args = ();
+ local $ld_gethostservbyname_return = { ip => '127.0.0.1', port => 80 };
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 0, 'read_config - virtual section - negotiatetimeout not numeric';
+ is $@, "config_error\n", 'read_config - virtual section - raise config_error(13)';
+ is_deeply \@config_error_args, [2, 'ERR0101', ' negotiatetimeout = yes'], 'read_config - virtual section - config_error args(13)';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+virtual=localhost:http
+ negotiatetimeout = 0
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 3;
+ local @ld_gethostservbyname_args = ();
+ local $ld_gethostservbyname_return = { ip => '127.0.0.1', port => 80 };
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 0, 'read_config - virtual section - negotiatetimeout is zero';
+ is $@, "config_error\n", 'read_config - virtual section - raise config_error(14)';
+ is_deeply \@config_error_args, [2, 'ERR0101', ' negotiatetimeout = 0'], 'read_config - virtual section - config_error args(14)';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+virtual=localhost:http
+ checkinterval = '1'
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 2;
+ local @ld_gethostservbyname_args = ();
+ local $ld_gethostservbyname_return = { ip => '127.0.0.1', port => 80 };
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 1, 'read_config - virtual section - checkinterval ok';
+ is $main::CONFIG{virtual}[0]{checkinterval}, '1', 'read_config - virtual section - set checkinterval ok';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+virtual=localhost:http
+ checkinterval
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 3;
+ local @ld_gethostservbyname_args = ();
+ local $ld_gethostservbyname_return = { ip => '127.0.0.1', port => 80 };
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 0, 'read_config - virtual section - checkinterval not defined';
+ is $@, "config_error\n", 'read_config - virtual section - raise config_error(15)';
+ is_deeply \@config_error_args, [2, 'ERR0101', ' checkinterval'], 'read_config - virtual section - config_error args(15)';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+virtual=localhost:http
+ checkinterval = yes
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 3;
+ local @ld_gethostservbyname_args = ();
+ local $ld_gethostservbyname_return = { ip => '127.0.0.1', port => 80 };
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 0, 'read_config - virtual section - checkinterval not numeric';
+ is $@, "config_error\n", 'read_config - virtual section - raise config_error(16)';
+ is_deeply \@config_error_args, [2, 'ERR0101', ' checkinterval = yes'], 'read_config - virtual section - config_error args(16)';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+virtual=localhost:http
+ checkinterval = 0
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 3;
+ local @ld_gethostservbyname_args = ();
+ local $ld_gethostservbyname_return = { ip => '127.0.0.1', port => 80 };
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 0, 'read_config - virtual section - checkinterval is zero';
+ is $@, "config_error\n", 'read_config - virtual section - raise config_error(17)';
+ is_deeply \@config_error_args, [2, 'ERR0101', ' checkinterval = 0'], 'read_config - virtual section - config_error args(17)';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+virtual=localhost:http
+ retryinterval = '1'
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 2;
+ local @ld_gethostservbyname_args = ();
+ local $ld_gethostservbyname_return = { ip => '127.0.0.1', port => 80 };
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 1, 'read_config - virtual section - retryinterval ok';
+ is $main::CONFIG{virtual}[0]{retryinterval}, '1', 'read_config - virtual section - set retryinterval ok';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+virtual=localhost:http
+ retryinterval
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 3;
+ local @ld_gethostservbyname_args = ();
+ local $ld_gethostservbyname_return = { ip => '127.0.0.1', port => 80 };
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 0, 'read_config - virtual section - retryinterval not defined';
+ is $@, "config_error\n", 'read_config - virtual section - raise config_error(18)';
+ is_deeply \@config_error_args, [2, 'ERR0101', ' retryinterval'], 'read_config - virtual section - config_error args(18)';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+virtual=localhost:http
+ retryinterval = yes
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 3;
+ local @ld_gethostservbyname_args = ();
+ local $ld_gethostservbyname_return = { ip => '127.0.0.1', port => 80 };
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 0, 'read_config - virtual section - retryinterval not numeric';
+ is $@, "config_error\n", 'read_config - virtual section - raise config_error(19)';
+ is_deeply \@config_error_args, [2, 'ERR0101', ' retryinterval = yes'], 'read_config - virtual section - config_error args(19)';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+virtual=localhost:http
+ retryinterval = 0
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 3;
+ local @ld_gethostservbyname_args = ();
+ local $ld_gethostservbyname_return = { ip => '127.0.0.1', port => 80 };
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 0, 'read_config - virtual section - retryinterval is zero';
+ is $@, "config_error\n", 'read_config - virtual section - raise config_error(20)';
+ is_deeply \@config_error_args, [2, 'ERR0101', ' retryinterval = 0'], 'read_config - virtual section - config_error args(20)';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+virtual=localhost:http
+ checkcount = "1"
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 2;
+ local @ld_gethostservbyname_args = ();
+ local $ld_gethostservbyname_return = { ip => '127.0.0.1', port => 80 };
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 1, 'read_config - virtual section - checkcount ok';
+ is $main::CONFIG{virtual}[0]{checkcount}, '1', 'read_config - virtual section - set checkcount ok';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+virtual=localhost:http
+ checkcount
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 3;
+ local @ld_gethostservbyname_args = ();
+ local $ld_gethostservbyname_return = { ip => '127.0.0.1', port => 80 };
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 0, 'read_config - virtual section - checkcount not defined';
+ is $@, "config_error\n", 'read_config - virtual section - raise config_error(21)';
+ is_deeply \@config_error_args, [2, 'ERR0101', ' checkcount'], 'read_config - virtual section - config_error args(21)';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+virtual=localhost:http
+ checkcount = yes
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 3;
+ local @ld_gethostservbyname_args = ();
+ local $ld_gethostservbyname_return = { ip => '127.0.0.1', port => 80 };
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 0, 'read_config - virtual section - checkcount not numeric';
+ is $@, "config_error\n", 'read_config - virtual section - raise config_error(22)';
+ is_deeply \@config_error_args, [2, 'ERR0101', ' checkcount = yes'], 'read_config - virtual section - config_error args(22)';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+virtual=localhost:http
+ checkcount = 0
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 3;
+ local @ld_gethostservbyname_args = ();
+ local $ld_gethostservbyname_return = { ip => '127.0.0.1', port => 80 };
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 0, 'read_config - virtual section - checkcount is zero';
+ is $@, "config_error\n", 'read_config - virtual section - raise config_error(23)';
+ is_deeply \@config_error_args, [2, 'ERR0101', ' checkcount = 0'], 'read_config - virtual section - config_error args(23)';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+virtual=localhost:http
+ maxconn = 0
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 2;
+ local @ld_gethostservbyname_args = ();
+ local $ld_gethostservbyname_return = { ip => '127.0.0.1', port => 80 };
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 1, 'read_config - virtual section - maxconn ok';
+ is $main::CONFIG{virtual}[0]{maxconn}, '0', 'read_config - virtual section - set maxconn ok';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+virtual=localhost:http
+ maxconn
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 3;
+ local @ld_gethostservbyname_args = ();
+ local $ld_gethostservbyname_return = { ip => '127.0.0.1', port => 80 };
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 0, 'read_config - virtual section - maxconn not defined';
+ is $@, "config_error\n", 'read_config - virtual section - raise config_error(24)';
+ is_deeply \@config_error_args, [2, 'ERR0101', ' maxconn'], 'read_config - virtual section - config_error args(24)';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+virtual=localhost:http
+ maxconn = yes
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 3;
+ local @ld_gethostservbyname_args = ();
+ local $ld_gethostservbyname_return = { ip => '127.0.0.1', port => 80 };
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 0, 'read_config - virtual section - maxconn not numeric';
+ is $@, "config_error\n", 'read_config - virtual section - raise config_error(25)';
+ is_deeply \@config_error_args, [2, 'ERR0101', ' maxconn = yes'], 'read_config - virtual section - config_error args(25)';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+virtual=localhost:http
+ maxconn = -1
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 3;
+ local @ld_gethostservbyname_args = ();
+ local $ld_gethostservbyname_return = { ip => '127.0.0.1', port => 80 };
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 0, 'read_config - virtual section - maxconn is minus';
+ is $@, "config_error\n", 'read_config - virtual section - raise config_error(26)';
+ is_deeply \@config_error_args, [2, 'ERR0101', ' maxconn = -1'], 'read_config - virtual section - config_error args(26)';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+virtual=localhost:http
+ checkport = "1"
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 2;
+ local @ld_gethostservbyname_args = ();
+ local $ld_gethostservbyname_return = { ip => '127.0.0.1', port => 80 };
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 1, 'read_config - virtual section - checkport min ok';
+ is $main::CONFIG{virtual}[0]{checkport}, '1', 'read_config - virtual section - set checkport min ok';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+virtual=localhost:http
+ checkport = 65535
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 2;
+ local @ld_gethostservbyname_args = ();
+ local $ld_gethostservbyname_return = { ip => '127.0.0.1', port => 80 };
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 1, 'read_config - virtual section - checkport max ok';
+ is $main::CONFIG{virtual}[0]{checkport}, '65535', 'read_config - virtual section - set checkport max ok';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+virtual=localhost:http
+ checkport
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 3;
+ local @ld_gethostservbyname_args = ();
+ local $ld_gethostservbyname_return = { ip => '127.0.0.1', port => 80 };
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 0, 'read_config - virtual section - checkport not defined';
+ is $@, "config_error\n", 'read_config - virtual section - raise config_error(27)';
+ is_deeply \@config_error_args, [2, 'ERR0108', ' checkport'], 'read_config - virtual section - config_error args(27)';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+virtual=localhost:http
+ checkport = yes
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 3;
+ local @ld_gethostservbyname_args = ();
+ local $ld_gethostservbyname_return = { ip => '127.0.0.1', port => 80 };
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 0, 'read_config - virtual section - checkport not numeric';
+ is $@, "config_error\n", 'read_config - virtual section - raise config_error(28)';
+ is_deeply \@config_error_args, [2, 'ERR0108', ' checkport = yes'], 'read_config - virtual section - config_error args(28)';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+virtual=localhost:http
+ checkport = 0
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 3;
+ local @ld_gethostservbyname_args = ();
+ local $ld_gethostservbyname_return = { ip => '127.0.0.1', port => 80 };
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 0, 'read_config - virtual section - checkport is zero';
+ is $@, "config_error\n", 'read_config - virtual section - raise config_error(29';
+ is_deeply \@config_error_args, [2, 'ERR0108', ' checkport = 0'], 'read_config - virtual section - config_error args(29)';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+virtual=localhost:http
+ checkport = 65536
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 3;
+ local @ld_gethostservbyname_args = ();
+ local $ld_gethostservbyname_return = { ip => '127.0.0.1', port => 80 };
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 0, 'read_config - virtual section - checkport is over range';
+ is $@, "config_error\n", 'read_config - virtual section - raise config_error(30)';
+ is_deeply \@config_error_args, [2, 'ERR0108', ' checkport = 65536'], 'read_config - virtual section - config_error args(30)';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+virtual=localhost:http
+ scheduler = lC
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 2;
+ local @ld_gethostservbyname_args = ();
+ local $ld_gethostservbyname_return = { ip => '127.0.0.1', port => 80 };
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 1, 'read_config - virtual section - scheduler lc ok';
+ is $main::CONFIG{virtual}[0]{scheduler}, 'lc', 'read_config - virtual section - set scheduler lc ok';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+virtual=localhost:http
+ scheduler = 'Rr'
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 2;
+ local @ld_gethostservbyname_args = ();
+ local $ld_gethostservbyname_return = { ip => '127.0.0.1', port => 80 };
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 1, 'read_config - virtual section - scheduler rr ok';
+ is $main::CONFIG{virtual}[0]{scheduler}, 'rr', 'read_config - virtual section - set scheduler rr ok';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+virtual=localhost:http
+ scheduler = "WRR"
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 2;
+ local @ld_gethostservbyname_args = ();
+ local $ld_gethostservbyname_return = { ip => '127.0.0.1', port => 80 };
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 1, 'read_config - virtual section - scheduler wrr ok';
+ is $main::CONFIG{virtual}[0]{scheduler}, 'wrr', 'read_config - virtual section - set scheduler wrr ok';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+virtual=localhost:http
+ scheduler =
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 3;
+ local @ld_gethostservbyname_args = ();
+ local $ld_gethostservbyname_return = { ip => '127.0.0.1', port => 80 };
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 0, 'read_config - virtual section - scheduler not defined';
+ is $@, "config_error\n", 'read_config - virtual section - raise config_error(31)';
+ is_deeply \@config_error_args, [2, 'ERR0105', ' scheduler ='], 'read_config - virtual section - config_error args(31)';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+virtual=localhost:http
+ scheduler = unknown
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 3;
+ local @ld_gethostservbyname_args = ();
+ local $ld_gethostservbyname_return = { ip => '127.0.0.1', port => 80 };
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 0, 'read_config - virtual section - scheduler not valid';
+ is $@, "config_error\n", 'read_config - virtual section - raise config_error(32)';
+ is_deeply \@config_error_args, [2, 'ERR0105', ' scheduler = unknown'], 'read_config - virtual section - config_error args(32)';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+virtual=localhost:http
+ protocol = 'TcP'
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 2;
+ local @ld_gethostservbyname_args = ();
+ local $ld_gethostservbyname_return = { ip => '127.0.0.1', port => 80 };
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 1, 'read_config - virtual section - protocol ok';
+ is $main::CONFIG{virtual}[0]{protocol}, 'tcp', 'read_config - virtual section - set protocol ok';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+virtual=localhost:http
+ protocol =
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 3;
+ local @ld_gethostservbyname_args = ();
+ local $ld_gethostservbyname_return = { ip => '127.0.0.1', port => 80 };
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 0, 'read_config - virtual section - protocol not defined';
+ is $@, "config_error\n", 'read_config - virtual section - raise config_error(33)';
+ is_deeply \@config_error_args, [2, 'ERR0109', ' protocol ='], 'read_config - virtual section - config_error args(33)';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+virtual=localhost:http
+ protocol = unknown
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 3;
+ local @ld_gethostservbyname_args = ();
+ local $ld_gethostservbyname_return = { ip => '127.0.0.1', port => 80 };
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 0, 'read_config - virtual section - protocol not valid';
+ is $@, "config_error\n", 'read_config - virtual section - raise config_error(34)';
+ is_deeply \@config_error_args, [2, 'ERR0109', ' protocol = unknown'], 'read_config - virtual section - config_error args(34)';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+virtual=localhost:http
+ service=hTTp
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 2;
+ local @ld_gethostservbyname_args = ();
+ local $ld_gethostservbyname_return = { ip => '127.0.0.1', port => 80 };
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 1, 'read_config - virtual section - service http ok';
+ is $main::CONFIG{virtual}[0]{service}, 'http', 'read_config - virtual section - set service http ok';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+virtual=localhost:http
+ service=hTTpS
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 2;
+ local @ld_gethostservbyname_args = ();
+ local $ld_gethostservbyname_return = { ip => '127.0.0.1', port => 80 };
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 1, 'read_config - virtual section - service https ok';
+ is $main::CONFIG{virtual}[0]{service}, 'https', 'read_config - virtual section - set service https ok';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+virtual=localhost:http
+ service=LdAp
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 2;
+ local @ld_gethostservbyname_args = ();
+ local $ld_gethostservbyname_return = { ip => '127.0.0.1', port => 80 };
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 1, 'read_config - virtual section - service ldap ok';
+ is $main::CONFIG{virtual}[0]{service}, 'ldap', 'read_config - virtual section - set service ldap ok';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+virtual=localhost:http
+ service= "FTP"
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 2;
+ local @ld_gethostservbyname_args = ();
+ local $ld_gethostservbyname_return = { ip => '127.0.0.1', port => 80 };
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 1, 'read_config - virtual section - service ftp ok';
+ is $main::CONFIG{virtual}[0]{service}, 'ftp', 'read_config - virtual section - set service ftp ok';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+virtual=localhost:http
+ service= 'SmtP'
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 2;
+ local @ld_gethostservbyname_args = ();
+ local $ld_gethostservbyname_return = { ip => '127.0.0.1', port => 80 };
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 1, 'read_config - virtual section - service smtp ok';
+ is $main::CONFIG{virtual}[0]{service}, 'smtp', 'read_config - virtual section - set service smtp ok';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+virtual=localhost:http
+ service = POp
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 2;
+ local @ld_gethostservbyname_args = ();
+ local $ld_gethostservbyname_return = { ip => '127.0.0.1', port => 80 };
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 1, 'read_config - virtual section - service pop ok';
+ is $main::CONFIG{virtual}[0]{service}, 'pop', 'read_config - virtual section - set service pop ok';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+virtual=localhost:http
+ service = "ImAp"
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 2;
+ local @ld_gethostservbyname_args = ();
+ local $ld_gethostservbyname_return = { ip => '127.0.0.1', port => 80 };
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 1, 'read_config - virtual section - service imap ok';
+ is $main::CONFIG{virtual}[0]{service}, 'imap', 'read_config - virtual section - set service imap ok';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+virtual=localhost:http
+ service = 'NNtp'
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 2;
+ local @ld_gethostservbyname_args = ();
+ local $ld_gethostservbyname_return = { ip => '127.0.0.1', port => 80 };
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 1, 'read_config - virtual section - service nntp ok';
+ is $main::CONFIG{virtual}[0]{service}, 'nntp', 'read_config - virtual section - set service nntp ok';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+virtual=localhost:http
+ service =DNS
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 2;
+ local @ld_gethostservbyname_args = ();
+ local $ld_gethostservbyname_return = { ip => '127.0.0.1', port => 80 };
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 1, 'read_config - virtual section - service dns ok';
+ is $main::CONFIG{virtual}[0]{service}, 'dns', 'read_config - virtual section - set service dns ok';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+virtual=localhost:http
+ service= mysql
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 2;
+ local @ld_gethostservbyname_args = ();
+ local $ld_gethostservbyname_return = { ip => '127.0.0.1', port => 80 };
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 1, 'read_config - virtual section - service mysql ok';
+ is $main::CONFIG{virtual}[0]{service}, 'mysql', 'read_config - virtual section - set service mysql ok';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+virtual=localhost:http
+ service= 'PGSQL'
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 2;
+ local @ld_gethostservbyname_args = ();
+ local $ld_gethostservbyname_return = { ip => '127.0.0.1', port => 80 };
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 1, 'read_config - virtual section - service pgsql ok';
+ is $main::CONFIG{virtual}[0]{service}, 'pgsql', 'read_config - virtual section - set service pgsql ok';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+virtual=localhost:http
+ service= sip
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 2;
+ local @ld_gethostservbyname_args = ();
+ local $ld_gethostservbyname_return = { ip => '127.0.0.1', port => 80 };
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 1, 'read_config - virtual section - service sip ok';
+ is $main::CONFIG{virtual}[0]{service}, 'sip', 'read_config - virtual section - set service sip ok';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+virtual=localhost:http
+ service= NONE
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 2;
+ local @ld_gethostservbyname_args = ();
+ local $ld_gethostservbyname_return = { ip => '127.0.0.1', port => 80 };
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 1, 'read_config - virtual section - service none ok';
+ is $main::CONFIG{virtual}[0]{service}, 'none', 'read_config - virtual section - set service none ok';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+virtual=localhost:http
+ service =
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 3;
+ local @ld_gethostservbyname_args = ();
+ local $ld_gethostservbyname_return = { ip => '127.0.0.1', port => 80 };
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 0, 'read_config - virtual section - service not defined';
+ is $@, "config_error\n", 'read_config - virtual section - raise config_error(31)';
+ is_deeply \@config_error_args, [2, 'ERR0106', ' service ='], 'read_config - virtual section - config_error args(31)';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+virtual=localhost:http
+ service = unknown
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 3;
+ local @ld_gethostservbyname_args = ();
+ local $ld_gethostservbyname_return = { ip => '127.0.0.1', port => 80 };
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 0, 'read_config - virtual section - service not valid';
+ is $@, "config_error\n", 'read_config - virtual section - raise config_error(32)';
+ is_deeply \@config_error_args, [2, 'ERR0106', ' service = unknown'], 'read_config - virtual section - config_error args(32)';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+virtual=localhost:http
+ httpmethod=get
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 2;
+ local @ld_gethostservbyname_args = ();
+ local $ld_gethostservbyname_return = { ip => '127.0.0.1', port => 80 };
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 1, 'read_config - virtual section - httpmethod GET ok';
+ is $main::CONFIG{virtual}[0]{httpmethod}, 'GET', 'read_config - virtual section - set httpmethod GET ok';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+virtual=localhost:http
+ httpmethod= 'HeaD'
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 2;
+ local @ld_gethostservbyname_args = ();
+ local $ld_gethostservbyname_return = { ip => '127.0.0.1', port => 80 };
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 1, 'read_config - virtual section - httpmethod HEAD ok';
+ is $main::CONFIG{virtual}[0]{httpmethod}, 'HEAD', 'read_config - virtual section - set httpmethod HEAD ok';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+virtual=localhost:http
+ httpmethod =
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 3;
+ local @ld_gethostservbyname_args = ();
+ local $ld_gethostservbyname_return = { ip => '127.0.0.1', port => 80 };
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 0, 'read_config - virtual section - httpmethod not defined';
+ is $@, "config_error\n", 'read_config - virtual section - raise config_error(31)';
+ is_deeply \@config_error_args, [2, 'ERR0110', ' httpmethod ='], 'read_config - virtual section - config_error args(31)';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+virtual=localhost:http
+ httpmethod = unknown
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 3;
+ local @ld_gethostservbyname_args = ();
+ local $ld_gethostservbyname_return = { ip => '127.0.0.1', port => 80 };
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 0, 'read_config - virtual section - httpmethod not valid';
+ is $@, "config_error\n", 'read_config - virtual section - raise config_error(32)';
+ is_deeply \@config_error_args, [2, 'ERR0110', ' httpmethod = unknown'], 'read_config - virtual section - config_error args(32)';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+virtual=localhost:http
+ fallback
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 2;
+ local @ld_gethostservbyname_args = ();
+ local $ld_gethostservbyname_return = { ip => '127.0.0.1', port => 80 };
+ local @parse_fallback_args = ();
+ local $parse_fallback_return = undef;
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 1, 'read_config - virtual section - fallback not defined';
+ is_deeply \@parse_fallback_args, [2, undef, ' fallback'], 'read_config - virtual section - parse_fallback_args(1)';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+virtual=localhost:http
+ fallback=localhost:http
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 2;
+ local @ld_gethostservbyname_args = ();
+ local $ld_gethostservbyname_return = { ip => '127.0.0.1', port => 80 };
+ local @parse_fallback_args = ();
+ local $parse_fallback_return = 'fallback';
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 1, 'read_config - virtual section - fallback ok';
+ is_deeply \@parse_fallback_args, [2, 'localhost:http', ' fallback=localhost:http'], 'read_config - virtual section - parse_fallback_args(2)';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+virtual=localhost:http
+ quiescent= YEs
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 2;
+ local @ld_gethostservbyname_args = ();
+ local $ld_gethostservbyname_return = { ip => '127.0.0.1', port => 80 };
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 1, 'read_config - virtual section - quiescent yes ok';
+ is $main::CONFIG{virtual}[0]{quiescent}, '1', 'read_config - virtual section - set quiescent yes ok';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+virtual=localhost:http
+ quiescent= "NO"
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 2;
+ local @ld_gethostservbyname_args = ();
+ local $ld_gethostservbyname_return = { ip => '127.0.0.1', port => 80 };
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 1, 'read_config - virtual section - quiescent no ok';
+ is $main::CONFIG{virtual}[0]{quiescent}, '0', 'read_config - virtual section - set quiescent no ok';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+virtual=localhost:http
+ quiescent
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 3;
+ local @ld_gethostservbyname_args = ();
+ local $ld_gethostservbyname_return = { ip => '127.0.0.1', port => 80 };
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 0, 'read_config - virtual section - quiescent not defined';
+ is $@, "config_error\n", 'read_config - virtual section - raise config_error(33)';
+ is_deeply \@config_error_args, [2, 'ERR0102', ' quiescent'], 'read_config - virtual section - config_error args(33)';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+virtual=localhost:http
+ quiescent=YEP
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 3;
+ local @ld_gethostservbyname_args = ();
+ local $ld_gethostservbyname_return = { ip => '127.0.0.1', port => 80 };
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 0, 'read_config - virtual section - quiescent not lower yes or no(1)';
+ is $@, "config_error\n", 'read_config - virtual section - raise config_error(34)';
+ is_deeply \@config_error_args, [2, 'ERR0102', ' quiescent=YEP'], 'read_config - virtual section - config_error args(34)';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+virtual=localhost:http
+ quiescent=0
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 3;
+ local @ld_gethostservbyname_args = ();
+ local $ld_gethostservbyname_return = { ip => '127.0.0.1', port => 80 };
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 0, 'read_config - virtual section - quiescent not lower yes or no(2)';
+ is $@, "config_error\n", 'read_config - virtual section - raise config_error(35)';
+ is_deeply \@config_error_args, [2, 'ERR0102', ' quiescent=0'], 'read_config - virtual section - config_error args(35)';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+virtual=localhost:http
+ module= URL --reschedule --pattern-match "foobar"
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 2;
+ local @ld_gethostservbyname_args = ();
+ local $ld_gethostservbyname_return = { ip => '127.0.0.1', port => 80 };
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 1, 'read_config - virtual section - module url ok';
+ is_deeply $main::CONFIG{virtual}[0]{module}, { name => 'url', option => '--reschedule --pattern-match foobar', key => '--pattern-match foobar' }, 'read_config - virtual section - set module url ok';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+virtual=localhost:http
+ module= 'cINSERT --cookie-name 'Monkey' --cookie-expire 864'
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 2;
+ local @ld_gethostservbyname_args = ();
+ local $ld_gethostservbyname_return = { ip => '127.0.0.1', port => 80 };
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 1, 'read_config - virtual section - module cinsert ok';
+ is_deeply $main::CONFIG{virtual}[0]{module}, { name => 'cinsert', option => '--cookie-name Monkey --cookie-expire 864', key => '--cookie-name Monkey' }, 'read_config - virtual section - set module cinsert ok';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+virtual=localhost:http
+ module= "sslID"
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 2;
+ local @ld_gethostservbyname_args = ();
+ local $ld_gethostservbyname_return = { ip => '127.0.0.1', port => 80 };
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 1, 'read_config - virtual section - module sslid ok';
+ is_deeply $main::CONFIG{virtual}[0]{module}, { name => 'sslid', option => undef, key => '' }, 'read_config - virtual section - set module sslid ok';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+virtual=localhost:http
+ module= SessionLess
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 2;
+ local @ld_gethostservbyname_args = ();
+ local $ld_gethostservbyname_return = { ip => '127.0.0.1', port => 80 };
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 1, 'read_config - virtual section - module sessionless ok';
+ is_deeply $main::CONFIG{virtual}[0]{module}, { name => 'sessionless', option => undef, key => '' }, 'read_config - virtual section - set module sessionless ok';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+virtual=localhost:http
+ module= 'Cinsert --reschedule'
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 2;
+ local @ld_gethostservbyname_args = ();
+ local $ld_gethostservbyname_return = { ip => '127.0.0.1', port => 80 };
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 1, 'read_config - virtual section - module cinsert omit ok';
+ is_deeply $main::CONFIG{virtual}[0]{module}, { name => 'cinsert', option => '--cookie-name CookieName --reschedule', key => '--cookie-name CookieName' }, 'read_config - virtual section - set module cinsert omit ok';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+virtual=localhost:http
+ module
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 3;
+ local @ld_gethostservbyname_args = ();
+ local $ld_gethostservbyname_return = { ip => '127.0.0.1', port => 80 };
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 0, 'read_config - virtual section - module not defined';
+ is $@, "config_error\n", 'read_config - virtual section - raise config_error(36)';
+ is_deeply \@config_error_args, [2, 'ERR0111', ' module'], 'read_config - virtual section - config_error args(36)';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+virtual=localhost:http
+ module = unknown
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 3;
+ local @ld_gethostservbyname_args = ();
+ local $ld_gethostservbyname_return = { ip => '127.0.0.1', port => 80 };
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 0, 'read_config - virtual section - unknown module';
+ is $@, "config_error\n", 'read_config - virtual section - raise config_error(37)';
+ is_deeply \@config_error_args, [2, 'ERR0111', ' module = unknown'], 'read_config - virtual section - config_error args(37)';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+virtual=localhost:http
+ module = url
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 3;
+ local @ld_gethostservbyname_args = ();
+ local $ld_gethostservbyname_return = { ip => '127.0.0.1', port => 80 };
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 0, 'read_config - virtual section - url module key not exist';
+ is $@, "config_error\n", 'read_config - virtual section - raise config_error(39)';
+ is_deeply \@config_error_args, [2, 'ERR0112', 'url', q{--pattern-match' or `--uri-pattern-match' or `--host-pattern-match}, ' module = url'], 'read_config - virtual section - config_error args(39)';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+virtual=localhost:http
+ sorryserver = sorryhost:ssh
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 3;
+ local @ld_gethostservbyname_args = ();
+ local $ld_gethostservbyname_return = { ip => '127.0.0.1', port => 80 };
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 1, 'read_config - virtual section - sorryserver ok';
+ is_deeply $main::CONFIG{virtual}[0]{sorryserver}, { ip => '127.0.0.1', port => 80 }, 'read_config - virtual section - set sorryserver ok';
+ is_deeply \@ld_gethostservbyname_args, ['localhost:http', 'tcp', 'sorryhost:ssh', 'tcp'], 'read_config - virtual section - ld_gethostservbyname args(3)';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+virtual=localhost:http
+ sorryserver
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 4;
+ local @ld_gethostservbyname_args = ();
+ local $ld_gethostservbyname_return = { ip => '127.0.0.1', port => 80 };
+ local $ld_gethostservbyname_undef = 2;
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 0, 'read_config - virtual section - sorryserver not defined';
+ is $@, "config_error\n", 'read_config - virtual section - raise config_error(40)';
+ is_deeply \@config_error_args, [2, 'ERR0114', ' sorryserver'], 'read_config - virtual section - config_error args(40)';
+ is_deeply \@ld_gethostservbyname_args, ['localhost:http', 'tcp', undef, 'tcp'], 'read_config - virtual section - ld_gethostservbyname args(4)';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+virtual=localhost:http
+ sorryserver = sorryhost:ftp
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 4;
+ local @ld_gethostservbyname_args = ();
+ local $ld_gethostservbyname_return = { ip => '127.0.0.1', port => 80 };
+ local $ld_gethostservbyname_undef = 2;
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 0, 'read_config - virtual section - sorryserver not defined';
+ is $@, "config_error\n", 'read_config - virtual section - raise config_error(41)';
+ is_deeply \@config_error_args, [2, 'ERR0114', ' sorryserver = sorryhost:ftp'], 'read_config - virtual section - config_error args(41)';
+ is_deeply \@ld_gethostservbyname_args, ['localhost:http', 'tcp', 'sorryhost:ftp', 'tcp'], 'read_config - virtual section - ld_gethostservbyname args(5)';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+virtual=localhost:http
+ qosup = 0
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 2;
+ local @ld_gethostservbyname_args = ();
+ local $ld_gethostservbyname_return = { ip => '127.0.0.1', port => 80 };
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 1, 'read_config - virtual section - qosup 0 ok';
+ is $main::CONFIG{virtual}[0]{qosup}, '0', 'read_config - virtual section - set qosup 0 ok';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+virtual=localhost:http
+ qosup = "1k"
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 2;
+ local @ld_gethostservbyname_args = ();
+ local $ld_gethostservbyname_return = { ip => '127.0.0.1', port => 80 };
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 1, 'read_config - virtual section - qosup min kilo ok';
+ is $main::CONFIG{virtual}[0]{qosup}, '1K', 'read_config - virtual section - set qosup min kilo ok';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+virtual=localhost:http
+ qosup = '999K'
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 2;
+ local @ld_gethostservbyname_args = ();
+ local $ld_gethostservbyname_return = { ip => '127.0.0.1', port => 80 };
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 1, 'read_config - virtual section - qosup max kilo ok';
+ is $main::CONFIG{virtual}[0]{qosup}, '999K', 'read_config - virtual section - set qosup max kilo ok';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+virtual=localhost:http
+ qosup = 1m
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 2;
+ local @ld_gethostservbyname_args = ();
+ local $ld_gethostservbyname_return = { ip => '127.0.0.1', port => 80 };
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 1, 'read_config - virtual section - qosup min mega ok';
+ is $main::CONFIG{virtual}[0]{qosup}, '1M', 'read_config - virtual section - set qosup min mega ok';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+virtual=localhost:http
+ qosup = "999M"
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 2;
+ local @ld_gethostservbyname_args = ();
+ local $ld_gethostservbyname_return = { ip => '127.0.0.1', port => 80 };
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 1, 'read_config - virtual section - qosup max mega ok';
+ is $main::CONFIG{virtual}[0]{qosup}, '999M', 'read_config - virtual section - set qosup max mega ok';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+virtual=localhost:http
+ qosup = '1G'
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 2;
+ local @ld_gethostservbyname_args = ();
+ local $ld_gethostservbyname_return = { ip => '127.0.0.1', port => 80 };
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 1, 'read_config - virtual section - qosup min giga ok';
+ is $main::CONFIG{virtual}[0]{qosup}, '1G', 'read_config - virtual section - set qosup min giga ok';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+virtual=localhost:http
+ qosup = 999g
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 2;
+ local @ld_gethostservbyname_args = ();
+ local $ld_gethostservbyname_return = { ip => '127.0.0.1', port => 80 };
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 1, 'read_config - virtual section - qosup max giga ok';
+ is $main::CONFIG{virtual}[0]{qosup}, '999G', 'read_config - virtual section - set qosup max giga ok';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+virtual=localhost:http
+ qosup
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 3;
+ local @ld_gethostservbyname_args = ();
+ local $ld_gethostservbyname_return = { ip => '127.0.0.1', port => 80 };
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 0, 'read_config - virtual section - qosup not defined';
+ is $@, "config_error\n", 'read_config - virtual section - raise config_error(42)';
+ is_deeply \@config_error_args, [2, 'ERR0113', ' qosup'], 'read_config - virtual section - config_error args(42)';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+virtual=localhost:http
+ qosup=100
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 3;
+ local @ld_gethostservbyname_args = ();
+ local $ld_gethostservbyname_return = { ip => '127.0.0.1', port => 80 };
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 0, 'read_config - virtual section - qosup not valid format(1)';
+ is $@, "config_error\n", 'read_config - virtual section - raise config_error(43-1)';
+ is_deeply \@config_error_args, [2, 'ERR0113', ' qosup=100'], 'read_config - virtual section - config_error args(43-1)';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+virtual=localhost:http
+ qosup=1000K
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 3;
+ local @ld_gethostservbyname_args = ();
+ local $ld_gethostservbyname_return = { ip => '127.0.0.1', port => 80 };
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 0, 'read_config - virtual section - qosup not valid format(2)';
+ is $@, "config_error\n", 'read_config - virtual section - raise config_error(43-2)';
+ is_deeply \@config_error_args, [2, 'ERR0113', ' qosup=1000K'], 'read_config - virtual section - config_error args(43-2)';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+virtual=localhost:http
+ qosdown = 0
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 2;
+ local @ld_gethostservbyname_args = ();
+ local $ld_gethostservbyname_return = { ip => '127.0.0.1', port => 80 };
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 1, 'read_config - virtual section - qosdown 0 ok';
+ is $main::CONFIG{virtual}[0]{qosdown}, '0', 'read_config - virtual section - set qosdown 0 ok';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+virtual=localhost:http
+ qosdown = "1k"
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 2;
+ local @ld_gethostservbyname_args = ();
+ local $ld_gethostservbyname_return = { ip => '127.0.0.1', port => 80 };
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 1, 'read_config - virtual section - qosdown min kilo ok';
+ is $main::CONFIG{virtual}[0]{qosdown}, '1K', 'read_config - virtual section - set qosdown min kilo ok';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+virtual=localhost:http
+ qosdown = '999K'
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 2;
+ local @ld_gethostservbyname_args = ();
+ local $ld_gethostservbyname_return = { ip => '127.0.0.1', port => 80 };
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 1, 'read_config - virtual section - qosdown max kilo ok';
+ is $main::CONFIG{virtual}[0]{qosdown}, '999K', 'read_config - virtual section - set qosdown max kilo ok';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+virtual=localhost:http
+ qosdown = 1m
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 2;
+ local @ld_gethostservbyname_args = ();
+ local $ld_gethostservbyname_return = { ip => '127.0.0.1', port => 80 };
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 1, 'read_config - virtual section - qosdown min mega ok';
+ is $main::CONFIG{virtual}[0]{qosdown}, '1M', 'read_config - virtual section - set qosdown min mega ok';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+virtual=localhost:http
+ qosdown = "999M"
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 2;
+ local @ld_gethostservbyname_args = ();
+ local $ld_gethostservbyname_return = { ip => '127.0.0.1', port => 80 };
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 1, 'read_config - virtual section - qosdown max mega ok';
+ is $main::CONFIG{virtual}[0]{qosdown}, '999M', 'read_config - virtual section - set qosdown max mega ok';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+virtual=localhost:http
+ qosdown = '1G'
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 2;
+ local @ld_gethostservbyname_args = ();
+ local $ld_gethostservbyname_return = { ip => '127.0.0.1', port => 80 };
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 1, 'read_config - virtual section - qosdown min giga ok';
+ is $main::CONFIG{virtual}[0]{qosdown}, '1G', 'read_config - virtual section - set qosdown min giga ok';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+virtual=localhost:http
+ qosdown = 999g
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 2;
+ local @ld_gethostservbyname_args = ();
+ local $ld_gethostservbyname_return = { ip => '127.0.0.1', port => 80 };
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 1, 'read_config - virtual section - qosdown max giga ok';
+ is $main::CONFIG{virtual}[0]{qosdown}, '999G', 'read_config - virtual section - set qosdown max giga ok';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+virtual=localhost:http
+ qosdown
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 3;
+ local @ld_gethostservbyname_args = ();
+ local $ld_gethostservbyname_return = { ip => '127.0.0.1', port => 80 };
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 0, 'read_config - virtual section - qosdown not defined';
+ is $@, "config_error\n", 'read_config - virtual section - raise config_error(44)';
+ is_deeply \@config_error_args, [2, 'ERR0113', ' qosdown'], 'read_config - virtual section - config_error args(44)';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+virtual=localhost:http
+ qosdown=100
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 3;
+ local @ld_gethostservbyname_args = ();
+ local $ld_gethostservbyname_return = { ip => '127.0.0.1', port => 80 };
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 0, 'read_config - virtual section - qosdown not valid format(1)';
+ is $@, "config_error\n", 'read_config - virtual section - raise config_error(45-1)';
+ is_deeply \@config_error_args, [2, 'ERR0113', ' qosdown=100'], 'read_config - virtual section - config_error args(45-1)';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+virtual=localhost:http
+ qosdown= 1000M
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 3;
+ local @ld_gethostservbyname_args = ();
+ local $ld_gethostservbyname_return = { ip => '127.0.0.1', port => 80 };
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 0, 'read_config - virtual section - qosdown not valid format(2)';
+ is $@, "config_error\n", 'read_config - virtual section - raise config_error(45-2)';
+ is_deeply \@config_error_args, [2, 'ERR0113', ' qosdown= 1000M'], 'read_config - virtual section - config_error args(45-2)';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+virtual=localhost:http
+ realdowncallback = '/bin/sh'
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 2;
+ local @ld_gethostservbyname_args = ();
+ local $ld_gethostservbyname_return = { ip => '127.0.0.1', port => 80 };
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 1, 'read_config - virtual section - realdowncallback ok';
+ is $main::CONFIG{virtual}[0]{realdowncallback}, '/bin/sh', 'read_config - virtual section - set realdowncallback ok';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+virtual=localhost:http
+ realdowncallback
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 3;
+ local @ld_gethostservbyname_args = ();
+ local $ld_gethostservbyname_return = { ip => '127.0.0.1', port => 80 };
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 0, 'read_config - virtual section - realdowncallback not defined';
+ is $@, "config_error\n", 'read_config - virtual section - raise config_error(46)';
+ is_deeply \@config_error_args, [2, 'ERR0117', ' realdowncallback'], 'read_config - virtual section - config_error args(46)';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+virtual=localhost:http
+ realdowncallback=/proc/1
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 3;
+ local @ld_gethostservbyname_args = ();
+ local $ld_gethostservbyname_return = { ip => '127.0.0.1', port => 80 };
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 0, 'read_config - virtual section - realdowncallback cannot execute';
+ is $@, "config_error\n", 'read_config - virtual section - raise config_error(47)';
+ is_deeply \@config_error_args, [2, 'ERR0117', ' realdowncallback=/proc/1'], 'read_config - virtual section - config_error args(47)';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+virtual=localhost:http
+ realdowncallback=/proc/100000
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 3;
+ local @ld_gethostservbyname_args = ();
+ local $ld_gethostservbyname_return = { ip => '127.0.0.1', port => 80 };
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 0, 'read_config - virtual section - realdowncallback no such file';
+ is $@, "config_error\n", 'read_config - virtual section - raise config_error(48)';
+ is_deeply \@config_error_args, [2, 'ERR0117', ' realdowncallback=/proc/100000'], 'read_config - virtual section - config_error args(48)';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+virtual=localhost:http
+ realdowncallback=/proc
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 3;
+ local @ld_gethostservbyname_args = ();
+ local $ld_gethostservbyname_return = { ip => '127.0.0.1', port => 80 };
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 0, 'read_config - virtual section - realdowncallback directory';
+ is $@, "config_error\n", 'read_config - virtual section - raise config_error(49)';
+ is_deeply \@config_error_args, [2, 'ERR0117', ' realdowncallback=/proc'], 'read_config - virtual section - config_error args(49)';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+virtual=localhost:http
+ realrecovercallback = '/bin/sh'
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 2;
+ local @ld_gethostservbyname_args = ();
+ local $ld_gethostservbyname_return = { ip => '127.0.0.1', port => 80 };
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 1, 'read_config - virtual section - realrecovercallback ok';
+ is $main::CONFIG{virtual}[0]{realrecovercallback}, '/bin/sh', 'read_config - virtual section - set realrecovercallback ok';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+virtual=localhost:http
+ realrecovercallback
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 3;
+ local @ld_gethostservbyname_args = ();
+ local $ld_gethostservbyname_return = { ip => '127.0.0.1', port => 80 };
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 0, 'read_config - virtual section - realrecovercallback not defined';
+ is $@, "config_error\n", 'read_config - virtual section - raise config_error(50)';
+ is_deeply \@config_error_args, [2, 'ERR0117', ' realrecovercallback'], 'read_config - virtual section - config_error args(50)';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+virtual=localhost:http
+ realrecovercallback=/proc/1
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 3;
+ local @ld_gethostservbyname_args = ();
+ local $ld_gethostservbyname_return = { ip => '127.0.0.1', port => 80 };
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 0, 'read_config - virtual section - realrecovercallback cannot execute';
+ is $@, "config_error\n", 'read_config - virtual section - raise config_error(51)';
+ is_deeply \@config_error_args, [2, 'ERR0117', ' realrecovercallback=/proc/1'], 'read_config - virtual section - config_error args(51)';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+virtual=localhost:http
+ realrecovercallback=/proc/100000
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 3;
+ local @ld_gethostservbyname_args = ();
+ local $ld_gethostservbyname_return = { ip => '127.0.0.1', port => 80 };
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 0, 'read_config - virtual section - realrecovercallback no such file';
+ is $@, "config_error\n", 'read_config - virtual section - raise config_error(52)';
+ is_deeply \@config_error_args, [2, 'ERR0117', ' realrecovercallback=/proc/100000'], 'read_config - virtual section - config_error args(52)';
+ remove_config();
+}
+SKIP: {
+ my $input = <<"CONFIG";
+virtual=localhost:http
+ realrecovercallback=/proc
+CONFIG
+ default_value();
+ create_config($input) or skip 'cannot create config', 3;
+ local @ld_gethostservbyname_args = ();
+ local $ld_gethostservbyname_return = { ip => '127.0.0.1', port => 80 };
+ eval {
+ read_config();
+ };
+ is $main::PROC_STAT{initialized}, 0, 'read_config - virtual section - realrecovercallback directory';
+ is $@, "config_error\n", 'read_config - virtual section - raise config_error(53)';
+ is_deeply \@config_error_args, [2, 'ERR0117', ' realrecovercallback=/proc'], 'read_config - virtual section - config_error args(53)';
+ remove_config();
+}
+# - reread_config
+{
+ local *read_config = \&__read_config;
+ local $main::CONFIG{virtual} = undef;
+ local $read_config_virtual = [ foo => 2, bar => 4 ];
+ local $main::CONFIG{execute} = { 'foo.conf' => 1, 'bar.conf' => 1 };
+ local $read_config_execute = { 'foo.conf' => 1, 'hoge.conf' => 1 };
+ local $system_wrapper_return = 1;
+ local $system_wrapper_called = 0;
+ local @ld_cmd_children_args = ();
+ reread_config();
+ is $system_wrapper_called, 2, 'reread_config - virtual is undef';
+ is_deeply \@ld_cmd_children_args, [ ['stop', {'bar.conf' => 1} ], ['start', {'hoge.conf' => 1} ] ], 'reread_config - 1 old config stop, 1 new config start';
+}
+{
+ local *read_config = \&__read_config;
+ local $main::CONFIG{virtual} = [ foo => 1, bar => 2 ];
+ local $read_config_virtual = [ foo => 2, bar => 4 ];
+ local $main::CONFIG{execute} = undef;
+ local $read_config_execute = { 'foo.conf' => 1, 'hoge.conf' => 1 };
+ local $system_wrapper_return = 1;
+ local $system_wrapper_called = 0;
+ local @ld_cmd_children_args = ();
+ reread_config();
+ is $system_wrapper_called, 0, 'reread_config - execute is undef';
+ is_deeply \@ld_cmd_children_args, [ ['stop', {} ], ['start', {'foo.conf' => 1, 'hoge.conf' => 1} ] ], 'reread_config - 0 old config stop, 2 new config start';
+}
+{
+ local *read_config = \&__read_config;
+ local $main::CONFIG{virtual} = [ foo => 1, bar => 2 ];
+ local $read_config_virtual = [ foo => 2, bar => 4 ];
+ local $main::CONFIG{execute} = { 'foo.conf' => 1, 'bar.conf' => 1 };
+ local $read_config_execute = { 'foo.conf' => 1, 'hoge.conf' => 1 };
+ local $system_wrapper_return = 1;
+ local $system_wrapper_called = 0;
+ local @ld_cmd_children_args = ();
+ reread_config();
+ is $system_wrapper_called, 2, 'reread_config - 1 exist config reload, but failed and then start';
+ is_deeply \@ld_cmd_children_args, [ ['stop', {'bar.conf' => 1} ], ['start', {'hoge.conf' => 1} ] ], 'reread_config - 1 old config stop, 1 new config start';
+}
+{
+ local *read_config = \&__read_config;
+ local $main::CONFIG{virtual} = [ foo => 1, bar => 2 ];
+ local $read_config_virtual = [ foo => 2, bar => 4 ];
+ local $main::CONFIG{execute} = { 'foo.conf' => 1, 'bar.conf' => 1 };
+ local $read_config_execute = { 'foo.conf' => 1, 'hoge.conf' => 1 };
+ local $system_wrapper_return = 0;
+ local $system_wrapper_called = 0;
+ local $read_config_die = 1;
+ local @ld_cmd_children_args = ();
+ reread_config();
+ is $system_wrapper_called, 2, 'reread_config - all old config reload(1)';
+ is_deeply \@ld_cmd_children_args, [ ['stop', {} ], ['start', {} ] ], 'reread_config - no stop / start command(1)';
+}
+{
+ local *read_config = \&__read_config;
+ local $main::CONFIG{virtual} = [ foo => 1, bar => 2 ];
+ local $read_config_virtual = [ foo => 2, bar => 4 ];
+ local $main::CONFIG{execute} = { 'foo.conf' => 1, 'bar.conf' => 1 };
+ local $read_config_execute = { 'foo.conf' => 1, 'hoge.conf' => 1 };
+ local $system_wrapper_return = 0;
+ local $system_wrapper_called = 0;
+ local $read_config_die = 0;
+ local $ld_setup_die = 1;
+ local @ld_cmd_children_args = ();
+ reread_config();
+ is $system_wrapper_called, 2, 'reread_config - all old config reload(2)';
+ is_deeply \@ld_cmd_children_args, [ ['stop', {} ], ['start', {} ] ], 'reread_config - no stop / start command(2)';
+}
+# - check_cfgfile
+{
+ local $main::CONFIG_FILE{path} = undef;
+ my $got = check_cfgfile();
+ is $got, 0, 'check_cfgfile - config file path is undef';
+}
+{
+ default_value();
+ create_config('sample');
+ my $got = check_cfgfile();
+ is $got, 0, 'check_cfgfile - first config file check(1)';
+ ok $main::CONFIG_FILE{stattime} > 0, 'check_cfgfile - register mtime(1)';
+ ok length $main::CONFIG_FILE{checksum} > 0, 'check_cfgfile - register checksum(1)';
+ remove_config();
+}
+{
+ default_value();
+ create_config('sample');
+ my $got = check_cfgfile();
+ is $got, 0, 'check_cfgfile - first config file check(2)';
+ ok $main::CONFIG_FILE{stattime} > 0, 'check_cfgfile - register mtime(2)';
+ ok length $main::CONFIG_FILE{checksum} > 0, 'check_cfgfile - register checksum(2)';
+ my $before_mtime = $main::CONFIG_FILE{stattime};
+ my $before_checksum = $main::CONFIG_FILE{checksum};
+ sleep 1;
+ open my $f, ">", $main::CONFIG_FILE{path};
+ print $f 'sample';
+ close $f;
+ $got = check_cfgfile();
+ is $got, 0, 'check_cfgfile - mtime change but same';
+ ok $main::CONFIG_FILE{stattime} > $before_mtime, 'check_cfgfile - mtime change';
+ is $main::CONFIG_FILE{checksum}, $before_checksum, 'check_cfgfile - same checksum';
+ remove_config();
+}
+{
+ default_value();
+ create_config('sample');
+ my $got = check_cfgfile();
+ is $got, 0, 'check_cfgfile - first config file check(3)';
+ ok $main::CONFIG_FILE{stattime} > 0, 'check_cfgfile - register mtime(3)';
+ ok length $main::CONFIG_FILE{checksum} > 0, 'check_cfgfile - register checksum(3)';
+ my $before_mtime = $main::CONFIG_FILE{stattime};
+ my $before_checksum = $main::CONFIG_FILE{checksum};
+ sleep 1;
+ open my $f, ">", $main::CONFIG_FILE{path};
+ print $f 'sample2';
+ close $f;
+ $got = check_cfgfile();
+ is $got, 0, 'check_cfgfile - config change, no autoreload, no callback';
+ ok $main::CONFIG_FILE{stattime} > $before_mtime, 'check_cfgfile - mtime change';
+ ok $main::CONFIG_FILE{checksum} ne $before_checksum, 'check_cfgfile - checksum change';
+ remove_config();
+}
+{
+ default_value();
+ create_config('sample');
+ $main::CONFIG{autoreload} = 1;
+ my $got = check_cfgfile();
+ is $got, 0, 'check_cfgfile - first config file check(4)';
+ ok $main::CONFIG_FILE{stattime} > 0, 'check_cfgfile - register mtime(4)';
+ ok length $main::CONFIG_FILE{checksum} > 0, 'check_cfgfile - register checksum(4)';
+ my $before_mtime = $main::CONFIG_FILE{stattime};
+ my $before_checksum = $main::CONFIG_FILE{checksum};
+ sleep 1;
+ open my $f, ">", $main::CONFIG_FILE{path};
+ print $f 'test';
+ close $f;
+ $got = check_cfgfile();
+ is $got, 1, 'check_cfgfile - config change, autoreload, no callback';
+ ok $main::CONFIG_FILE{stattime} > $before_mtime, 'check_cfgfile - mtime change';
+ ok $main::CONFIG_FILE{checksum} ne $before_checksum, 'check_cfgfile - checksum change';
+ remove_config();
+}
+{
+ default_value();
+ create_config('sample');
+ $main::CONFIG{autoreload} = 1;
+ $main::CONFIG{callback} = '/bin/sh';
+ my $got = check_cfgfile();
+ is $got, 0, 'check_cfgfile - first config file check(4)';
+ ok $main::CONFIG_FILE{stattime} > 0, 'check_cfgfile - register mtime(4)';
+ ok length $main::CONFIG_FILE{checksum} > 0, 'check_cfgfile - register checksum(4)';
+ my $before_mtime = $main::CONFIG_FILE{stattime};
+ my $before_checksum = $main::CONFIG_FILE{checksum};
+ sleep 1;
+ open my $f, ">", $main::CONFIG_FILE{path};
+ print $f 'callback';
+ close $f;
+ local $system_wrapper_called = 0;
+ $got = check_cfgfile();
+ is $got, 1, 'check_cfgfile - config change, autoreload, callback';
+ ok $main::CONFIG_FILE{stattime} > $before_mtime, 'check_cfgfile - mtime change';
+ ok $main::CONFIG_FILE{checksum} ne $before_checksum, 'check_cfgfile - checksum change';
+ is $system_wrapper_called, 1, 'check_cfgfile - callback called';
+ remove_config();
+}
+# test end
+#...............................................
+
+L7lib::comment_in();
+
+sub default_value {
+ $main::CONFIG_FILE{path} = time;
+ undef $main::CONFIG_FILE{stattime};
+ undef $main::CONFIG_FILE{checksum};
+ $main::PROC_STAT{initialized} = 0;
+ %main::CONFIG = %main::GLOBAL;
+}
+sub create_config {
+ my $input = shift;
+ open my $f, ">", $main::CONFIG_FILE{path} or return 0;
+ print $f $input;
+ close $f;
+ return 1;
+}
+sub remove_config {
+ if (-f $main::CONFIG_FILE{path}) {
+ unlink $main::CONFIG_FILE{path};
+ }
+}
+sub override {
+ *config_error = \&__config_error;
+ *ld_gethostservbyname = \&__ld_gethostservbyname;
+ *parse_fallback = \&__parse_fallback;
+ *parse_real = \&__parse_real;
+ *ld_openlog = \&__ld_openlog;
+ *_ld_service_resolve = \&__ld_service_resolve;
+ *ld_setup = \&__ld_setup;
+ *ld_cmd_children = \&__ld_cmd_children;
+ *system_wrapper = \&__system_wrapper;
+ *ld_log = \&__ld_log;
+ *ld_start = \&__ld_start;
+ *check_require_module = \&__check_require_module;
+}
+sub __config_error {
+ @config_error_args = @_;
+ die "config_error\n";
+}
+sub __ld_gethostservbyname {
+ push @ld_gethostservbyname_args, @_;
+ if ($ld_gethostservbyname_undef != 0) {
+ $ld_gethostservbyname_undef--;
+ if ($ld_gethostservbyname_undef == 0) {
+ return undef;
+ }
+ }
+ return $ld_gethostservbyname_return;
+}
+sub __parse_fallback {
+ push @parse_fallback_args, @_;
+ return $parse_fallback_return;
+}
+sub __parse_real {
+ push @parse_real_args, @_;
+ return $parse_real_return;
+}
+sub __ld_openlog {
+ $ld_openlog_arg = shift;
+ return $ld_openlog_return;
+}
+sub __get_hostservbyname {
+ @get_hostservbyname_args = @_;
+ return $get_hostservbyname_return;
+}
+sub __ld_service_resolve {
+ $_ld_service_resolve_called++;
+}
+sub __ld_cmd_children {
+ push @ld_cmd_children_args, [@_];
+}
+sub __system_wrapper {
+ $system_wrapper_called++;
+ return $system_wrapper_return;
+}
+sub __ld_setup {
+ die if $ld_setup_die;
+}
+sub __check_require_module {
+}
+sub __ld_start {
+}
+sub __read_config {
+ $main::CONFIG{virtual} = $read_config_virtual;
+ $main::CONFIG{execute} = $read_config_execute;
+ die if $read_config_die;
+}
+sub __ld_log {
+}
--- /dev/null
+use strict;
+use warnings;
+no warnings qw(redefine once);
+use lib qw(t/lib lib);
+use subs qw(print);
+use Cwd;
+use L7lib;
+use Test::More tests => 41;
+use Config;
+
+L7lib::chdir();
+L7lib::comment_out();
+require './l7directord';
+
+override();
+
+#...............................................
+# test start
+# - _ld_service_resolve
+{
+ my %v = ();
+ my $port = 80;
+ _ld_service_resolve(\%v, $port);
+ is $v{service}, 'http', '_ld_service_resolve - http ok';
+}
+{
+ my %v = ();
+ my $port = 443;
+ _ld_service_resolve(\%v, $port);
+ is $v{service}, 'https', '_ld_service_resolve - https ok';
+}
+{
+ my %v = ();
+ my $port = 21;
+ _ld_service_resolve(\%v, $port);
+ is $v{service}, 'ftp', '_ld_service_resolve - ftp ok';
+}
+{
+ my %v = ();
+ my $port = 25;
+ _ld_service_resolve(\%v, $port);
+ is $v{service}, 'smtp', '_ld_service_resolve - smtp ok';
+}
+{
+ my %v = ();
+ my $port = 110;
+ _ld_service_resolve(\%v, $port);
+ is $v{service}, 'pop', '_ld_service_resolve - pop ok';
+}
+{
+ my %v = ();
+ my $port = 119;
+ _ld_service_resolve(\%v, $port);
+ is $v{service}, 'nntp', '_ld_service_resolve - nntp ok';
+}
+{
+ my %v = ();
+ my $port = 143;
+ _ld_service_resolve(\%v, $port);
+ is $v{service}, 'imap', '_ld_service_resolve - imap ok';
+}
+{
+ my %v = ();
+ my $port = 389;
+ _ld_service_resolve(\%v, $port);
+ is $v{service}, 'ldap', '_ld_service_resolve - ldap ok';
+}
+{
+ my %v = ();
+ my $port = 53;
+ _ld_service_resolve(\%v, $port);
+ is $v{service}, 'dns', '_ld_service_resolve - dns ok';
+}
+{
+ my %v = ();
+ my $port = 3306;
+ _ld_service_resolve(\%v, $port);
+ is $v{service}, 'mysql', '_ld_service_resolve - mysql ok';
+}
+{
+ my %v = ();
+ my $port = 5432;
+ _ld_service_resolve(\%v, $port);
+ is $v{service}, 'pgsql', '_ld_service_resolve - pgsql ok';
+}
+{
+ my %v = ();
+ my $port = 5060;
+ _ld_service_resolve(\%v, $port);
+ is $v{service}, 'sip', '_ld_service_resolve - sip ok';
+}
+{
+ my %v = ();
+ my $port = 100000;
+ _ld_service_resolve(\%v, $port);
+ is $v{service}, 'none', '_ld_service_resolve - none ok';
+}
+{
+ my $port = 100000;
+ _ld_service_resolve(undef, $port);
+}
+{
+ my %v = ();
+ _ld_service_resolve(\%v, undef);
+ is $v{service}, undef, '_ld_service_resolve - port is undef';
+}
+{
+ my %v = ( service => 'pop' );
+ my $port = 80;
+ _ld_service_resolve(\%v, $port);
+ is $v{service}, 'pop', '_ld_service_resolve - service is already exist';
+}
+# - is_octet
+{
+ my $got = is_octet(0);
+ is $got, 1, 'is_octet - 0 is ok';
+}
+{
+ my $got = is_octet(-1);
+ is $got, 0, 'is_octet - -1 is error';
+}
+{
+ my $got = is_octet(255);
+ is $got, 1, 'is_octet - 255 is ok';
+}
+{
+ my $got = is_octet(256);
+ is $got, 0, 'is_octet - 256 is error';
+}
+{
+ my $got = is_octet();
+ is $got, 0, 'is_octet - undef is error';
+}
+{
+ my $got = is_octet('one');
+ is $got, 0, 'is_octet - one(string) is error';
+}
+# - is_ip
+{
+ my $got = is_ip();
+ is $got, 0, 'is_ip - undef is error';
+}
+{
+ my $got = is_ip('0.0.0.0');
+ is $got, 1, 'is_ip - 0.0.0.0 is ok';
+}
+{
+ my $got = is_ip('-1.-1.-1.-1');
+ is $got, 0, 'is_ip - -1.-1.-1.-1 is error';
+}
+{
+ my $got = is_ip('255.255.255.255');
+ is $got, 1, 'is_ip - 255.255.255.255 is ok';
+}
+{
+ my $got = is_ip('256.256.256.256');
+ is $got, 0, 'is_ip - 256.256.256.256 is error';
+}
+{
+ my $got = is_ip('localhost');
+ is $got, 0, 'is_ip - localhost(invalid format) is error';
+}
+# - ip_to_int
+{
+ my $got = ip_to_int();
+ is $got, -1, 'ip_to_int - undef is error';
+}
+{
+ my $got = ip_to_int('0.0.0.0');
+ is $got, 0, 'ip_to_int - 0.0.0.0 is ok';
+}
+{
+ my $got = ip_to_int('-1.-1.-1.-1');
+ is $got, -1, 'ip_to_int - -1.-1.-1.-1 is error';
+}
+{
+ my $got = ip_to_int('255.255.255.255');
+ is $got, 4294967295, 'ip_to_int - 255.255.255.255 is ok';
+}
+{
+ my $got = ip_to_int('127.0.0.1');
+ is $got, 2130706433, 'ip_to_int - 127.0.0.1 is ok';
+}
+{
+ my $got = ip_to_int('256.256.256.256');
+ is $got, -1, 'ip_to_int - 256.256.256.256 is error';
+}
+{
+ my $got = ip_to_int('localhost');
+ is $got, -1, 'ip_to_int - localhost(invalid format) is error';
+}
+# - int_to_ip
+{
+ my $got = int_to_ip(0);
+ is $got, '0.0.0.0', 'int_to_ip - 0 is ok';
+}
+{
+ my $got = int_to_ip(-1);
+ is $got, undef, 'int_to_ip - -1 is error';
+}
+{
+ my $got = int_to_ip(2130706433);
+ is $got, '127.0.0.1', 'int_to_ip - 2130706433 is ok';
+}
+{
+ my $got = int_to_ip(4294967295);
+ is $got, '255.255.255.255', 'int_to_ip - 4294967295 is ok';
+}
+SKIP: {
+ my $got = int_to_ip(4294967296);
+ if ( $Config{'use64bitint'} ) {
+ is $got, '0.0.0.0', 'int_to_ip - 4294967296 is ok (overflow)';
+ }
+ else {
+ is $got, '255.255.255.255', 'int_to_ip - 4294967296 is ok (overflow)';
+ }
+}
+{
+ my $got = int_to_ip();
+ is $got, undef, 'int_to_ip - undef is error';
+}
+{
+ my $got = int_to_ip('one');
+ is $got, undef, 'int_to_ip - one(string) is error';
+}
+# test end
+#...............................................
+
+L7lib::comment_in();
+
+sub override {
+ *ld_log = \&__ld_log;
+}
+sub __ld_log {
+}
--- /dev/null
+use strict;
+use warnings;
+no warnings qw(redefine once);
+use lib qw(t/lib lib);
+use subs qw(print);
+use Cwd;
+use L7lib;
+use Test::More tests => 63;
+
+L7lib::chdir();
+L7lib::comment_out();
+require './l7directord';
+override();
+
+our @config_error_args = ();
+our @ld_gethostservbyname_args = ();
+our $ld_gethostservbyname_return = undef;
+our @ld_gethostbyname_args = ();
+our @ld_gethostbyname_returns = ();
+our $ld_getservbyname_arg = undef;
+our $ld_getservbyname_return = undef;
+our @ip_to_int_args = ();
+our @ip_to_int_returns = ();
+our @int_to_ip_args = ();
+our @int_to_ip_returns = ();
+#...............................................
+# test start
+# - parse_fallback
+{
+ local @ld_gethostservbyname_args = ();
+ local $ld_gethostservbyname_return = 'foo:bar';
+ my %expected = %main::REAL;
+ $expected{server} = $ld_gethostservbyname_return;
+ $expected{forward} = 'masq';
+ my $line = 1;
+ my $fallback = 'fallback masq';
+ my $config_line = 'configline';
+ my $ret = parse_fallback($line, $fallback, $config_line);
+ is_deeply $ret, \%expected, 'parse_fallback - ok';
+ is_deeply \@ld_gethostservbyname_args, [ 'fallback', 'tcp' ], 'parse_fallback - ld_gethostservbyname arg(1)';
+}
+{
+ local @ld_gethostservbyname_args = ();
+ local $ld_gethostservbyname_return = 'foo:bar';
+ my %expected = %main::REAL;
+ $expected{server} = $ld_gethostservbyname_return;
+ my $line = 1;
+ my $fallback = 'fallback';
+ my $config_line = 'configline';
+ my $ret = parse_fallback($line, $fallback, $config_line);
+ is_deeply $ret, \%expected, 'parse_fallback - no forward mode ok';
+ is_deeply \@ld_gethostservbyname_args, [ 'fallback', 'tcp' ], 'parse_fallback - ld_gethostservbyname arg(2)';
+}
+{
+ local @config_error_args = ();
+ my $line = 1;
+ my $fallback = ' fallback ';
+ my $config_line = 'configline';
+ eval {
+ my $ret = parse_fallback($line, $fallback, $config_line);
+ };
+ is $@, "config_error\n", 'parse_fallback - format error';
+ is_deeply \@config_error_args, [1, 'ERR0114', 'configline'], 'parse_fallback - config_error args(1)';
+}
+{
+ local @config_error_args = ();
+ local @ld_gethostservbyname_args = ();
+ local $ld_gethostservbyname_return = undef;
+ my $line = 1;
+ my $fallback = 'fallback masq';
+ my $config_line = 'configline';
+ eval {
+ my $ret = parse_fallback($line, $fallback, $config_line);
+ };
+ is $@, "config_error\n", 'parse_fallback - ld_gethostservbyname error';
+ is_deeply \@config_error_args, [1, 'ERR0114', 'configline'], 'parse_fallback - config_error args(2)';
+ is_deeply \@ld_gethostservbyname_args, [ 'fallback', 'tcp' ], 'parse_fallback - ld_gethostservbyname arg(3)';
+}
+{
+ local @config_error_args = ();
+ local @ld_gethostservbyname_args = ();
+ local $ld_gethostservbyname_return = 'foo:bar';
+ my $line = 1;
+ my $fallback = 'fallback direct';
+ my $config_line = 'configline';
+ eval {
+ my $ret = parse_fallback($line, $fallback, $config_line);
+ };
+ is $@, "config_error\n", 'parse_fallback - forward mode error';
+ is_deeply \@config_error_args, [1, 'ERR0107', 'configline'], 'parse_fallback - config_error args(3)';
+ is_deeply \@ld_gethostservbyname_args, [ 'fallback', 'tcp' ], 'parse_fallback - ld_gethostservbyname arg(4)';
+}
+# - parse_real
+{
+ local @ld_gethostbyname_args = ();
+ local @ld_gethostbyname_returns = ('1.1.1.1', '3.3.3.3');
+ local $ld_getservbyname_arg = undef;
+ local $ld_getservbyname_return = 80;
+ local @ip_to_int_args = ();
+ local @ip_to_int_returns = (1, 3);
+ local @int_to_ip_args = ();
+ local @int_to_ip_returns = ('1.1.1.1', '2.2.2.2', '3.3.3.3');
+ my %real = %main::REAL;
+ $real{forward} = 'masq';
+ $real{weight} = 100;
+ $real{request} = 'request';
+ $real{receive} = 'receive';
+ my @expected;
+ my $c = 0;
+ for ($ip_to_int_returns[0] .. $ip_to_int_returns[1]) {
+ my %r = %real;
+ push @expected, \%r;
+ $expected[$c]->{server}{ip} = $int_to_ip_returns[$c];
+ $expected[$c]->{server}{port} = $ld_getservbyname_return;
+ $c++;
+ }
+ my @gethost_r = @ld_gethostbyname_returns;
+ my @ip_to_r = @ip_to_int_returns;
+ my $line = 1;
+ my $real = q{foo.bar.com->hoge.huga.com:serv Masq 100 "request" , 'receive'};
+ my $config_line = 'configline';
+ my $ret = parse_real($line, $real, $config_line);
+ is_deeply $ret, \@expected, 'parse_real - full parse ok';
+ is $ld_getservbyname_arg, 'serv', 'parse_real - ld_getservbyname arg(1)';
+ is_deeply \@ld_gethostbyname_args, ['foo.bar.com', 'hoge.huga.com'], 'parse_real - ld_gethostbyname arg(1)';
+ is_deeply \@ip_to_int_args, \@gethost_r, 'parse_real - ip_to_int arg(1)';
+ is_deeply \@int_to_ip_args, [ $ip_to_r[0] .. $ip_to_r[1] ], 'parse_real - int_to_ip arg(1)';
+}
+{
+ local @ld_gethostbyname_args = ();
+ local @ld_gethostbyname_returns = ('1.1.1.1', '1.1.1.1');
+ local $ld_getservbyname_arg = undef;
+ local $ld_getservbyname_return = 80;
+ local @ip_to_int_args = ();
+ local @ip_to_int_returns = (1, 1);
+ local @int_to_ip_args = ();
+ local @int_to_ip_returns = ('1.1.1.1');
+ my %real = %main::REAL;
+ $real{forward} = 'masq';
+ $real{weight} = 100;
+ $real{request} = 'request';
+ $real{receive} = 'receive';
+ my @expected;
+ my $c = 0;
+ for ($ip_to_int_returns[0] .. $ip_to_int_returns[1]) {
+ my %r = %real;
+ push @expected, \%r;
+ $expected[$c]->{server}{ip} = $int_to_ip_returns[$c];
+ $expected[$c]->{server}{port} = $ld_getservbyname_return;
+ $c++;
+ }
+ my @gethost_r = @ld_gethostbyname_returns;
+ my @ip_to_r = @ip_to_int_returns;
+ my $line = 1;
+ my $real = q{foo.bar.com->hoge.huga.com:serv Masq 100 "request" , 'receive'};
+ my $config_line = 'configline';
+ my $ret = parse_real($line, $real, $config_line);
+ is_deeply $ret, \@expected, 'parse_real - same range ok';
+ is $ld_getservbyname_arg, 'serv', 'parse_real - ld_getservbyname arg(2)';
+ is_deeply \@ld_gethostbyname_args, ['foo.bar.com', 'hoge.huga.com'], 'parse_real - ld_gethostbyname arg(2)';
+ is_deeply \@ip_to_int_args, \@gethost_r, 'parse_real - ip_to_int arg(2)';
+ is_deeply \@int_to_ip_args, [ $ip_to_r[0] .. $ip_to_r[1] ], 'parse_real - int_to_ip arg(2)';
+}
+{
+ local @ld_gethostbyname_args = ();
+ local @ld_gethostbyname_returns = ('1.1.1.1', '1.1.1.1');
+ local $ld_getservbyname_arg = undef;
+ local $ld_getservbyname_return = 80;
+ local @ip_to_int_args = ();
+ local @ip_to_int_returns = (1, 1);
+ local @int_to_ip_args = ();
+ local @int_to_ip_returns = ('1.1.1.1');
+ my %real = %main::REAL;
+ $real{forward} = 'masq';
+ $real{weight} = 100;
+ $real{request} = 'request';
+ $real{receive} = 'receive';
+ my @expected;
+ my $c = 0;
+ for ($ip_to_int_returns[0] .. $ip_to_int_returns[1]) {
+ my %r = %real;
+ push @expected, \%r;
+ $expected[$c]->{server}{ip} = $int_to_ip_returns[$c];
+ $expected[$c]->{server}{port} = $ld_getservbyname_return;
+ $c++;
+ }
+ my @gethost_r = @ld_gethostbyname_returns;
+ my @ip_to_r = @ip_to_int_returns;
+ my $line = 1;
+ my $real = q{foo.bar.com:serv Masq 100 "request" , 'receive'};
+ my $config_line = 'configline';
+ my $ret = parse_real($line, $real, $config_line);
+ is_deeply $ret, \@expected, 'parse_real - no range ok';
+ is $ld_getservbyname_arg, 'serv', 'parse_real - ld_getservbyname arg(3)';
+ is_deeply \@ld_gethostbyname_args, ['foo.bar.com'], 'parse_real - ld_gethostbyname arg(3)';
+ is_deeply \@ip_to_int_args, \@gethost_r, 'parse_real - ip_to_int arg(3)';
+ is_deeply \@int_to_ip_args, [ $ip_to_r[0] .. $ip_to_r[1] ], 'parse_real - int_to_ip arg(3)';
+}
+{
+ local @ld_gethostbyname_args = ();
+ local @ld_gethostbyname_returns = ('1.1.1.1', '1.1.1.1');
+ local @ip_to_int_args = ();
+ local @ip_to_int_returns = (1, 1);
+ local @int_to_ip_args = ();
+ local @int_to_ip_returns = ('1.1.1.1');
+ my %real = %main::REAL;
+ $real{forward} = 'masq';
+ $real{weight} = 100;
+ $real{request} = 'request';
+ $real{receive} = 'receive';
+ my @expected;
+ my $c = 0;
+ for ($ip_to_int_returns[0] .. $ip_to_int_returns[1]) {
+ my %r = %real;
+ push @expected, \%r;
+ $expected[$c]->{server}{ip} = $int_to_ip_returns[$c];
+ $expected[$c]->{server}{port} = undef;
+ $c++;
+ }
+ my @gethost_r = @ld_gethostbyname_returns;
+ my @ip_to_r = @ip_to_int_returns;
+ my $line = 1;
+ my $real = q{foo.bar.com Masq 100 "request" , 'receive'};
+ my $config_line = 'configline';
+ my $ret = parse_real($line, $real, $config_line);
+ is_deeply $ret, \@expected, 'parse_real - no port ok';
+ is_deeply \@ld_gethostbyname_args, ['foo.bar.com'], 'parse_real - ld_gethostbyname arg(4)';
+ is_deeply \@ip_to_int_args, \@gethost_r, 'parse_real - ip_to_int arg(4)';
+ is_deeply \@int_to_ip_args, [ $ip_to_r[0] .. $ip_to_r[1] ], 'parse_real - int_to_ip arg(4)';
+}
+{
+ local @ld_gethostbyname_args = ();
+ local @ld_gethostbyname_returns = ('1.1.1.1', '1.1.1.1');
+ local @ip_to_int_args = ();
+ local @ip_to_int_returns = (1, 1);
+ local @int_to_ip_args = ();
+ local @int_to_ip_returns = ('1.1.1.1');
+ my %real = %main::REAL;
+ $real{weight} = 100;
+ $real{request} = 'request';
+ $real{receive} = 'receive';
+ my @expected;
+ my $c = 0;
+ for ($ip_to_int_returns[0] .. $ip_to_int_returns[1]) {
+ my %r = %real;
+ push @expected, \%r;
+ $expected[$c]->{server}{ip} = $int_to_ip_returns[$c];
+ $expected[$c]->{server}{port} = undef;
+ $c++;
+ }
+ my @gethost_r = @ld_gethostbyname_returns;
+ my @ip_to_r = @ip_to_int_returns;
+ my $line = 1;
+ my $real = q{foo.bar.com 100 "request" , 'receive'};
+ my $config_line = 'configline';
+ my $ret = parse_real($line, $real, $config_line);
+ is_deeply $ret, \@expected, 'parse_real - no forward mode ok';
+ is_deeply \@ld_gethostbyname_args, ['foo.bar.com'], 'parse_real - ld_gethostbyname arg(5)';
+ is_deeply \@ip_to_int_args, \@gethost_r, 'parse_real - ip_to_int arg(5)';
+ is_deeply \@int_to_ip_args, [ $ip_to_r[0] .. $ip_to_r[1] ], 'parse_real - int_to_ip arg(5)';
+}
+{
+ local @ld_gethostbyname_args = ();
+ local @ld_gethostbyname_returns = ('1.1.1.1', '1.1.1.1');
+ local @ip_to_int_args = ();
+ local @ip_to_int_returns = (1, 1);
+ local @int_to_ip_args = ();
+ local @int_to_ip_returns = ('1.1.1.1');
+ my %real = %main::REAL;
+ $real{request} = 'request';
+ $real{receive} = 'receive';
+ my @expected;
+ my $c = 0;
+ for ($ip_to_int_returns[0] .. $ip_to_int_returns[1]) {
+ my %r = %real;
+ push @expected, \%r;
+ $expected[$c]->{server}{ip} = $int_to_ip_returns[$c];
+ $expected[$c]->{server}{port} = undef;
+ $c++;
+ }
+ my @gethost_r = @ld_gethostbyname_returns;
+ my @ip_to_r = @ip_to_int_returns;
+ my $line = 1;
+ my $real = q{foo.bar.com "request" , 'receive'};
+ my $config_line = 'configline';
+ my $ret = parse_real($line, $real, $config_line);
+ is_deeply $ret, \@expected, 'parse_real - no weight ok';
+ is_deeply \@ld_gethostbyname_args, ['foo.bar.com'], 'parse_real - ld_gethostbyname arg(6)';
+ is_deeply \@ip_to_int_args, \@gethost_r, 'parse_real - ip_to_int arg(6)';
+ is_deeply \@int_to_ip_args, [ $ip_to_r[0] .. $ip_to_r[1] ], 'parse_real - int_to_ip arg(6)';
+}
+{
+ local @ld_gethostbyname_args = ();
+ local @ld_gethostbyname_returns = ('1.1.1.1', '1.1.1.1');
+ local @ip_to_int_args = ();
+ local @ip_to_int_returns = (1, 1);
+ local @int_to_ip_args = ();
+ local @int_to_ip_returns = ('1.1.1.1');
+ my %real = %main::REAL;
+ my @expected;
+ my $c = 0;
+ for ($ip_to_int_returns[0] .. $ip_to_int_returns[1]) {
+ my %r = %real;
+ push @expected, \%r;
+ $expected[$c]->{server}{ip} = $int_to_ip_returns[$c];
+ $expected[$c]->{server}{port} = undef;
+ $c++;
+ }
+ my @gethost_r = @ld_gethostbyname_returns;
+ my @ip_to_r = @ip_to_int_returns;
+ my $line = 1;
+ my $real = q{foo.bar.com};
+ my $config_line = 'configline';
+ my $ret = parse_real($line, $real, $config_line);
+ is_deeply $ret, \@expected, 'parse_real - no request, receive ok';
+ is_deeply \@ld_gethostbyname_args, ['foo.bar.com'], 'parse_real - ld_gethostbyname arg(7)';
+ is_deeply \@ip_to_int_args, \@gethost_r, 'parse_real - ip_to_int arg(7)';
+ is_deeply \@int_to_ip_args, [ $ip_to_r[0] .. $ip_to_r[1] ], 'parse_real - int_to_ip arg(7)';
+}
+{
+ local @config_error_args = ();
+ my $line = 1;
+ my $real = q{foo.bar.com:bad:format};
+ my $config_line = 'configline';
+ eval {
+ my $ret = parse_real($line, $real, $config_line);
+ };
+ is $@, "config_error\n", 'parse_real - format error';
+ is_deeply \@config_error_args, [1, 'ERR0114', 'configline'], 'parse_real - config_error args(1)';
+}
+{
+ local @config_error_args = ();
+ my $line = 1;
+ my $real = q{foo.bar.com:bad direct};
+ my $config_line = 'configline';
+ eval {
+ my $ret = parse_real($line, $real, $config_line);
+ };
+ is $@, "config_error\n", 'parse_real - forward mode error';
+ is_deeply \@config_error_args, [1, 'ERR0107', 'configline'], 'parse_real - config_error args(2)';
+}
+{
+ local @config_error_args = ();
+ local $ld_getservbyname_arg = undef;
+ local $ld_getservbyname_return = undef;
+ my $line = 1;
+ my $real = q{foo.bar.com:bad masq};
+ my $config_line = 'configline';
+ eval {
+ my $ret = parse_real($line, $real, $config_line);
+ };
+ is $@, "config_error\n", 'parse_real - ld_getservbyname error';
+ is_deeply \@config_error_args, [1, 'ERR0108', 'configline'], 'parse_real - config_error args(3)';
+ is $ld_getservbyname_arg, 'bad', 'parse_real - ld_getservbyname args(4)';
+}
+{
+ local @config_error_args = ();
+ local $ld_getservbyname_arg = undef;
+ local $ld_getservbyname_return = 80;
+ local @ld_gethostbyname_args = ();
+ local @ld_gethostbyname_returns = ();
+ my $line = 1;
+ my $real = q{foo.bar.com:bad masq};
+ my $config_line = 'configline';
+ eval {
+ my $ret = parse_real($line, $real, $config_line);
+ };
+ is $@, "config_error\n", 'parse_real - first ld_gethostbyname error';
+ is_deeply \@config_error_args, [1, 'ERR0114', 'configline'], 'parse_real - config_error args(4)';
+ is $ld_getservbyname_arg, 'bad', 'parse_real - ld_getservbyname args(5)';
+ is_deeply \@ld_gethostbyname_args, ['foo.bar.com'], 'parse_real - ld_gethostbyname args(5)';
+}
+{
+ local @config_error_args = ();
+ local $ld_getservbyname_arg = undef;
+ local $ld_getservbyname_return = 80;
+ local @ld_gethostbyname_args = ();
+ local @ld_gethostbyname_returns = ('1.1.1.1');
+ my $line = 1;
+ my $real = q{foo.bar.com->hoge.huga.com:bad masq};
+ my $config_line = 'configline';
+ eval {
+ my $ret = parse_real($line, $real, $config_line);
+ };
+ is $@, "config_error\n", 'parse_real - second ld_gethostbyname error';
+ is_deeply \@config_error_args, [1, 'ERR0114', 'configline'], 'parse_real - config_error args(5)';
+ is $ld_getservbyname_arg, 'bad', 'parse_real - ld_getservbyname args(6)';
+ is_deeply \@ld_gethostbyname_args, ['foo.bar.com', 'hoge.huga.com'], 'parse_real - ld_gethostbyname args(6)';
+}
+{
+ local @config_error_args = ();
+ local $ld_getservbyname_arg = undef;
+ local $ld_getservbyname_return = 80;
+ local @ld_gethostbyname_args = ();
+ local @ld_gethostbyname_returns = ('1.1.1.1', '2.2.2.2');
+ local @ip_to_int_args = ();
+ local @ip_to_int_returns = (2, 1);
+ my $line = 1;
+ my $real = q{foo.bar.com->hoge.huga.com:bad masq};
+ my $config_line = 'configline';
+ my @gethost_r = @ld_gethostbyname_returns;
+ eval {
+ my $ret = parse_real($line, $real, $config_line);
+ };
+ is $@, "config_error\n", 'parse_real - second ld_gethostbyname error';
+ is_deeply \@config_error_args, [1, 'ERR0115', '1.1.1.1', '2.2.2.2', 'configline'], 'parse_real - config_error args(5)';
+ is $ld_getservbyname_arg, 'bad', 'parse_real - ld_getservbyname args(6)';
+ is_deeply \@ld_gethostbyname_args, ['foo.bar.com', 'hoge.huga.com'], 'parse_real - ld_gethostbyname args(6)';
+ is_deeply \@ip_to_int_args, \@gethost_r, 'parse_real - ip_to_int arg(8)';
+}
+# test end
+#...............................................
+
+L7lib::comment_in();
+
+sub override {
+ *config_error = \&__config_error;
+ *ld_gethostservbyname = \&__ld_gethostservbyname;
+ *ld_gethostbyname = \&__ld_gethostbyname;
+ *ld_getservbyname = \&__ld_getservbyname;
+ *ip_to_int = \&__ip_to_int;
+ *int_to_ip = \&__int_to_ip;
+ *ld_log = \&__ld_log;
+}
+sub __config_error {
+ @config_error_args = @_;
+ die "config_error\n";
+}
+sub __ld_gethostservbyname {
+ push @ld_gethostservbyname_args, @_;
+ return $ld_gethostservbyname_return;
+}
+sub __ld_gethostbyname {
+ push @ld_gethostbyname_args, @_;
+ return shift @ld_gethostbyname_returns;
+}
+sub __ld_getservbyname {
+ $ld_getservbyname_arg = shift;
+ return $ld_getservbyname_return;
+}
+sub __ip_to_int {
+ push @ip_to_int_args, @_;
+ return shift @ip_to_int_returns;
+}
+sub __int_to_ip {
+ push @int_to_ip_args, @_;
+ return shift @int_to_ip_returns;
+}
+sub __ld_log {
+}
--- /dev/null
+use strict;
+use warnings;
+no warnings qw(redefine once);
+use lib qw(t/lib lib);
+use subs qw(print);
+use Cwd;
+use L7lib;
+use Test::More tests => 38;
+
+L7lib::chdir();
+L7lib::comment_out();
+require './l7directord';
+override();
+
+our @get_ip_port_args = ();
+our @get_ip_port_returns = ();
+our @get_forward_flag_args = ();
+our @get_forward_flag_returns = ();
+#...............................................
+# test start
+# - ld_setup
+{
+ set_default();
+ local @get_ip_port_args = ();
+ local @get_ip_port_returns = ();
+ local @get_forward_flag_args = ();
+ local @get_forward_flag_returns = ();
+ my %expected = %main::GLOBAL;
+ ld_setup();
+ is_deeply \%main::CONFIG, \%expected, 'ld_setup - empty virtual ok';
+}
+{
+ set_default();
+ local @get_ip_port_args = ();
+ local @get_ip_port_returns = ();
+ local @get_forward_flag_args = ();
+ local @get_forward_flag_returns = ();
+ my %expected = %main::GLOBAL;
+ $expected{virtual} = [ undef, undef, undef ];
+ $main::CONFIG{virtual} = [ undef, undef, undef ];
+ ld_setup();
+ is_deeply \%main::CONFIG, \%expected, 'ld_setup - virtual undef list ok';
+}
+{
+ set_default();
+ local @get_ip_port_args = ();
+ local @get_ip_port_returns = ();
+ local @get_forward_flag_args = ();
+ local @get_forward_flag_returns = ();
+ my %expected = %main::GLOBAL;
+ $main::CONFIG{virtual} = [ undef, undef, {
+ protocol => 'tcp',
+ } ];
+ $expected{virtual} = [ undef, undef, {
+ option => { protocol => '-t' },
+ protocol => 'tcp',
+ checkcount => $main::CONFIG{checkcount},
+ checktimeout => $main::CONFIG{checktimeout},
+ negotiatetimeout => $main::CONFIG{negotiatetimeout},
+ checkinterval => $main::CONFIG{checkinterval},
+ retryinterval => $main::CONFIG{retryinterval},
+ quiescent => $main::CONFIG{quiescent},
+ } ];
+ ld_setup();
+ is_deeply \%main::CONFIG, \%expected, 'ld_setup - protocol tcp ok';
+}
+{
+ set_default();
+ local @get_ip_port_args = ();
+ local @get_ip_port_returns = ('ip:port');
+ local @get_forward_flag_args = ();
+ local @get_forward_flag_returns = ();
+ my %expected = %main::GLOBAL;
+ $main::CONFIG{virtual} = [ undef, undef, {
+ option => { protocol => '-t' },
+ module => { name => 'cinsert' },
+ } ];
+ $expected{virtual} = [ undef, undef, {
+ option => {
+ protocol => '-t',
+ main => '-t ip:port -m cinsert',
+ flags => '-t ip:port -m cinsert',
+ },
+ module => { name => 'cinsert' },
+ checkcount => $main::CONFIG{checkcount},
+ checktimeout => $main::CONFIG{checktimeout},
+ negotiatetimeout => $main::CONFIG{negotiatetimeout},
+ checkinterval => $main::CONFIG{checkinterval},
+ retryinterval => $main::CONFIG{retryinterval},
+ quiescent => $main::CONFIG{quiescent},
+ } ];
+ ld_setup();
+ is_deeply \%main::CONFIG, \%expected, 'ld_setup - module minimum setup ok';
+}
+{
+ set_default();
+ local @get_ip_port_args = ();
+ local @get_ip_port_returns = ('ip:port');
+ local @get_forward_flag_args = ();
+ local @get_forward_flag_returns = ();
+ my %expected = %main::GLOBAL;
+ $main::CONFIG{virtual} = [ undef, undef, {
+ option => { protocol => '-t' },
+ module => {
+ name => 'cinsert',
+ option => '--cookie-name cookie',
+ },
+ } ];
+ $expected{virtual} = [ undef, undef, {
+ option => {
+ protocol => '-t',
+ main => '-t ip:port -m cinsert --cookie-name cookie',
+ flags => '-t ip:port -m cinsert --cookie-name cookie',
+ },
+ module => {
+ name => 'cinsert',
+ option => '--cookie-name cookie',
+ },
+ checkcount => $main::CONFIG{checkcount},
+ checktimeout => $main::CONFIG{checktimeout},
+ negotiatetimeout => $main::CONFIG{negotiatetimeout},
+ checkinterval => $main::CONFIG{checkinterval},
+ retryinterval => $main::CONFIG{retryinterval},
+ quiescent => $main::CONFIG{quiescent},
+ } ];
+ ld_setup();
+ is_deeply \%main::CONFIG, \%expected, 'ld_setup - module option setup ok';
+}
+{
+ set_default();
+ local @get_ip_port_args = ();
+ local @get_ip_port_returns = ('ip:port');
+ local @get_forward_flag_args = ();
+ local @get_forward_flag_returns = ();
+ my %expected = %main::GLOBAL;
+ $main::CONFIG{virtual} = [ undef, undef, {
+ option => { protocol => '-t' },
+ module => {
+ name => 'cinsert',
+ option => '--cookie-name cookie',
+ },
+ scheduler => 'rr',
+ } ];
+ $expected{virtual} = [ undef, undef, {
+ option => {
+ protocol => '-t',
+ main => '-t ip:port -m cinsert --cookie-name cookie',
+ flags => '-t ip:port -m cinsert --cookie-name cookie -s rr',
+ },
+ module => {
+ name => 'cinsert',
+ option => '--cookie-name cookie',
+ },
+ scheduler => 'rr',
+ checkcount => $main::CONFIG{checkcount},
+ checktimeout => $main::CONFIG{checktimeout},
+ negotiatetimeout => $main::CONFIG{negotiatetimeout},
+ checkinterval => $main::CONFIG{checkinterval},
+ retryinterval => $main::CONFIG{retryinterval},
+ quiescent => $main::CONFIG{quiescent},
+ } ];
+ ld_setup();
+ is_deeply \%main::CONFIG, \%expected, 'ld_setup - scheduler setup ok';
+}
+{
+ set_default();
+ local @get_ip_port_args = ();
+ local @get_ip_port_returns = ('ip:port');
+ local @get_forward_flag_args = ();
+ local @get_forward_flag_returns = ();
+ my %expected = %main::GLOBAL;
+ $main::CONFIG{virtual} = [ undef, undef, {
+ option => { protocol => '-t' },
+ module => {
+ name => 'cinsert',
+ option => '--cookie-name cookie',
+ },
+ scheduler => 'rr',
+ maxconn => 1000,
+ } ];
+ $expected{virtual} = [ undef, undef, {
+ option => {
+ protocol => '-t',
+ main => '-t ip:port -m cinsert --cookie-name cookie',
+ flags => '-t ip:port -m cinsert --cookie-name cookie -s rr -u 1000',
+ },
+ module => {
+ name => 'cinsert',
+ option => '--cookie-name cookie',
+ },
+ scheduler => 'rr',
+ maxconn => 1000,
+ checkcount => $main::CONFIG{checkcount},
+ checktimeout => $main::CONFIG{checktimeout},
+ negotiatetimeout => $main::CONFIG{negotiatetimeout},
+ checkinterval => $main::CONFIG{checkinterval},
+ retryinterval => $main::CONFIG{retryinterval},
+ quiescent => $main::CONFIG{quiescent},
+ } ];
+ ld_setup();
+ is_deeply \%main::CONFIG, \%expected, 'ld_setup - maxconn setup ok';
+}
+{
+ set_default();
+ local @get_ip_port_args = ();
+ local @get_ip_port_returns = ('ip:port');
+ local @get_forward_flag_args = ();
+ local @get_forward_flag_returns = ();
+ my %expected = %main::GLOBAL;
+ $main::CONFIG{virtual} = [ undef, undef, {
+ option => { protocol => '-t' },
+ module => {
+ name => 'cinsert',
+ option => '--cookie-name cookie',
+ },
+ scheduler => 'rr',
+ maxconn => 1000,
+ sorryserver => { ip => 'sorryip', port => 'sorryport' },
+ } ];
+ $expected{virtual} = [ undef, undef, {
+ option => {
+ protocol => '-t',
+ main => '-t ip:port -m cinsert --cookie-name cookie',
+ flags => '-t ip:port -m cinsert --cookie-name cookie -s rr -u 1000 -b sorryip:sorryport',
+ },
+ module => {
+ name => 'cinsert',
+ option => '--cookie-name cookie',
+ },
+ scheduler => 'rr',
+ maxconn => 1000,
+ sorryserver => { ip => 'sorryip', port => 'sorryport' },
+ checkcount => $main::CONFIG{checkcount},
+ checktimeout => $main::CONFIG{checktimeout},
+ negotiatetimeout => $main::CONFIG{negotiatetimeout},
+ checkinterval => $main::CONFIG{checkinterval},
+ retryinterval => $main::CONFIG{retryinterval},
+ quiescent => $main::CONFIG{quiescent},
+ } ];
+ ld_setup();
+ is_deeply \%main::CONFIG, \%expected, 'ld_setup - sorryserver setup ok';
+}
+{
+ set_default();
+ local @get_ip_port_args = ();
+ local @get_ip_port_returns = ('ip:port');
+ local @get_forward_flag_args = ();
+ local @get_forward_flag_returns = ();
+ my %expected = %main::GLOBAL;
+ $main::CONFIG{virtual} = [ undef, undef, {
+ option => { protocol => '-t' },
+ module => {
+ name => 'cinsert',
+ option => '--cookie-name cookie',
+ },
+ scheduler => 'rr',
+ maxconn => 1000,
+ sorryserver => { ip => 'sorryip', port => 'sorryport' },
+ qosup => '100M',
+ } ];
+ $expected{virtual} = [ undef, undef, {
+ option => {
+ protocol => '-t',
+ main => '-t ip:port -m cinsert --cookie-name cookie',
+ flags => '-t ip:port -m cinsert --cookie-name cookie -s rr -u 1000 -b sorryip:sorryport -Q 100M',
+ },
+ module => {
+ name => 'cinsert',
+ option => '--cookie-name cookie',
+ },
+ scheduler => 'rr',
+ maxconn => 1000,
+ sorryserver => { ip => 'sorryip', port => 'sorryport' },
+ qosup => '100M',
+ checkcount => $main::CONFIG{checkcount},
+ checktimeout => $main::CONFIG{checktimeout},
+ negotiatetimeout => $main::CONFIG{negotiatetimeout},
+ checkinterval => $main::CONFIG{checkinterval},
+ retryinterval => $main::CONFIG{retryinterval},
+ quiescent => $main::CONFIG{quiescent},
+ } ];
+ ld_setup();
+ is_deeply \%main::CONFIG, \%expected, 'ld_setup - qosup setup ok';
+}
+{
+ set_default();
+ local @get_ip_port_args = ();
+ local @get_ip_port_returns = ('ip:port');
+ local @get_forward_flag_args = ();
+ local @get_forward_flag_returns = ();
+ my %expected = %main::GLOBAL;
+ $main::CONFIG{virtual} = [ undef, undef, {
+ option => { protocol => '-t' },
+ module => {
+ name => 'cinsert',
+ option => '--cookie-name cookie',
+ },
+ scheduler => 'rr',
+ maxconn => 1000,
+ sorryserver => { ip => 'sorryip', port => 'sorryport' },
+ qosup => '100M',
+ qosdown => '100K',
+ } ];
+ $expected{virtual} = [ undef, undef, {
+ option => {
+ protocol => '-t',
+ main => '-t ip:port -m cinsert --cookie-name cookie',
+ flags => '-t ip:port -m cinsert --cookie-name cookie -s rr -u 1000 -b sorryip:sorryport -Q 100M -q 100K',
+ },
+ module => {
+ name => 'cinsert',
+ option => '--cookie-name cookie',
+ },
+ scheduler => 'rr',
+ maxconn => 1000,
+ sorryserver => { ip => 'sorryip', port => 'sorryport' },
+ qosup => '100M',
+ qosdown => '100K',
+ checkcount => $main::CONFIG{checkcount},
+ checktimeout => $main::CONFIG{checktimeout},
+ negotiatetimeout => $main::CONFIG{negotiatetimeout},
+ checkinterval => $main::CONFIG{checkinterval},
+ retryinterval => $main::CONFIG{retryinterval},
+ quiescent => $main::CONFIG{quiescent},
+ } ];
+ ld_setup();
+ is_deeply \%main::CONFIG, \%expected, 'ld_setup - qosdown setup ok';
+}
+{
+ set_default();
+ local @get_ip_port_args = ();
+ local @get_ip_port_returns = ('fbip1', 'fbip1');
+ local @get_forward_flag_args = ();
+ local @get_forward_flag_returns = ();
+ my %expected = %main::GLOBAL;
+ $main::CONFIG{virtual} = [ undef, undef, {
+ } ];
+ $main::CONFIG{fallback} = { tcp => { server => 'fallback'} };
+ $expected{virtual} = [ undef, undef, {
+ fallback => { tcp => { server => 'fallback', option => { flags => '-r fbip1' } } },
+ checkcount => $main::CONFIG{checkcount},
+ checktimeout => $main::CONFIG{checktimeout},
+ negotiatetimeout => $main::CONFIG{negotiatetimeout},
+ checkinterval => $main::CONFIG{checkinterval},
+ retryinterval => $main::CONFIG{retryinterval},
+ quiescent => $main::CONFIG{quiescent},
+ } ];
+ $expected{fallback} = { tcp => { server => 'fallback',
+ option => { flags => '-r fbip1' } }
+ };
+ ld_setup();
+ is_deeply \%main::CONFIG, \%expected, 'ld_setup - fallback overwrite ok';
+}
+{
+ set_default();
+ local @get_ip_port_args = ();
+ local @get_ip_port_returns = ('fbip1');
+ local @get_forward_flag_args = ();
+ local @get_forward_flag_returns = ();
+ my %expected = %main::GLOBAL;
+ $main::CONFIG{virtual} = [ undef, undef, {
+ fallback => { tcp => { server => 'fallback' } },
+ } ];
+ $expected{virtual} = [ undef, undef, {
+ fallback => { tcp => { server => 'fallback', option => { flags => '-r fbip1' } } },
+ checkcount => $main::CONFIG{checkcount},
+ checktimeout => $main::CONFIG{checktimeout},
+ negotiatetimeout => $main::CONFIG{negotiatetimeout},
+ checkinterval => $main::CONFIG{checkinterval},
+ retryinterval => $main::CONFIG{retryinterval},
+ quiescent => $main::CONFIG{quiescent},
+ } ];
+ ld_setup();
+ is_deeply \%main::CONFIG, \%expected, 'ld_setup - fallback ok';
+}
+{
+ set_default();
+ local @get_ip_port_args = ();
+ local @get_ip_port_returns = ();
+ local @get_forward_flag_args = ();
+ local @get_forward_flag_returns = ();
+ my %expected = %main::GLOBAL;
+ $main::CONFIG{virtual} = [ undef, undef, {
+ checktype => 1,
+ } ];
+ $expected{virtual} = [ undef, undef, {
+ checktype => 'combined',
+ num_connects => 1,
+ checkcount => $main::CONFIG{checkcount},
+ checktimeout => $main::CONFIG{checktimeout},
+ negotiatetimeout => $main::CONFIG{negotiatetimeout},
+ checkinterval => $main::CONFIG{checkinterval},
+ retryinterval => $main::CONFIG{retryinterval},
+ quiescent => $main::CONFIG{quiescent},
+ } ];
+ ld_setup();
+ is_deeply \%main::CONFIG, \%expected, 'ld_setup - checktype ok';
+}
+{
+ set_default();
+ local @get_ip_port_args = ();
+ local @get_ip_port_returns = ();
+ local @get_forward_flag_args = ();
+ local @get_forward_flag_returns = ();
+ my %expected = %main::GLOBAL;
+ $main::CONFIG{virtual} = [ undef, undef, {
+ login => '',
+ service => 'ftp',
+ } ];
+ $expected{virtual} = [ undef, undef, {
+ login => 'anonymous',
+ service => 'ftp',
+ checkcount => $main::CONFIG{checkcount},
+ checktimeout => $main::CONFIG{checktimeout},
+ negotiatetimeout => $main::CONFIG{negotiatetimeout},
+ checkinterval => $main::CONFIG{checkinterval},
+ retryinterval => $main::CONFIG{retryinterval},
+ quiescent => $main::CONFIG{quiescent},
+ } ];
+ ld_setup();
+ is_deeply \%main::CONFIG, \%expected, 'ld_setup - login ftp ok';
+}
+{
+ set_default();
+ local @get_ip_port_args = ();
+ local @get_ip_port_returns = ();
+ local @get_forward_flag_args = ();
+ local @get_forward_flag_returns = ();
+ my %expected = %main::GLOBAL;
+ $main::CONFIG{virtual} = [ undef, undef, {
+ login => '',
+ service => 'sip',
+ } ];
+ $expected{virtual} = [ undef, undef, {
+ login => 'l7directord@' . $main::PROC_ENV{hostname},
+ service => 'sip',
+ checkcount => $main::CONFIG{checkcount},
+ checktimeout => $main::CONFIG{checktimeout},
+ negotiatetimeout => $main::CONFIG{negotiatetimeout},
+ checkinterval => $main::CONFIG{checkinterval},
+ retryinterval => $main::CONFIG{retryinterval},
+ quiescent => $main::CONFIG{quiescent},
+ } ];
+ ld_setup();
+ is_deeply \%main::CONFIG, \%expected, 'ld_setup - login sip ok';
+}
+{
+ set_default();
+ local @get_ip_port_args = ();
+ local @get_ip_port_returns = ();
+ local @get_forward_flag_args = ();
+ local @get_forward_flag_returns = ();
+ my %expected = %main::GLOBAL;
+ $main::CONFIG{virtual} = [ undef, undef, {
+ passwd => '',
+ service => 'ftp',
+ } ];
+ $expected{virtual} = [ undef, undef, {
+ passwd => 'l7directord@' . $main::PROC_ENV{hostname},
+ service => 'ftp',
+ checkcount => $main::CONFIG{checkcount},
+ checktimeout => $main::CONFIG{checktimeout},
+ negotiatetimeout => $main::CONFIG{negotiatetimeout},
+ checkinterval => $main::CONFIG{checkinterval},
+ retryinterval => $main::CONFIG{retryinterval},
+ quiescent => $main::CONFIG{quiescent},
+ } ];
+ ld_setup();
+ is_deeply \%main::CONFIG, \%expected, 'ld_setup - passwd ftp ok';
+}
+{
+ set_default();
+ local @get_ip_port_args = ();
+ local @get_ip_port_returns = ();
+ local @get_forward_flag_args = ();
+ local @get_forward_flag_returns = ();
+ my %expected = %main::GLOBAL;
+ $main::CONFIG{virtual} = [ undef, undef, {
+ real => [ undef, undef, undef ],
+ } ];
+ $expected{virtual} = [ undef, undef, {
+ real => [ undef, undef, undef ],
+ checkcount => $main::CONFIG{checkcount},
+ checktimeout => $main::CONFIG{checktimeout},
+ negotiatetimeout => $main::CONFIG{negotiatetimeout},
+ checkinterval => $main::CONFIG{checkinterval},
+ retryinterval => $main::CONFIG{retryinterval},
+ quiescent => $main::CONFIG{quiescent},
+ } ];
+ ld_setup();
+ is_deeply \%main::CONFIG, \%expected, 'ld_setup - real undef list ok';
+}
+{
+ set_default();
+ local @get_ip_port_args = ();
+ local @get_ip_port_returns = ('real');
+ local @get_forward_flag_args = ();
+ local @get_forward_flag_returns = ('-m');
+ my %expected = %main::GLOBAL;
+ $main::CONFIG{virtual} = [ undef, undef, {
+ real => [ undef, undef, {
+ forward => 'forward',
+ } ],
+ } ];
+ $expected{virtual} = [ undef, undef, {
+ real => [ undef, undef, {
+ forward => 'forward',
+ option => { forward => '-m', flags => '-r real' },
+ weight => 1,
+ fail_counts => 0,
+ healthchecked => 0,
+ server => { port => undef },
+ } ],
+ server => {},
+ checkcount => $main::CONFIG{checkcount},
+ checktimeout => $main::CONFIG{checktimeout},
+ negotiatetimeout => $main::CONFIG{negotiatetimeout},
+ checkinterval => $main::CONFIG{checkinterval},
+ retryinterval => $main::CONFIG{retryinterval},
+ quiescent => $main::CONFIG{quiescent},
+ } ];
+ ld_setup();
+ is_deeply \%main::CONFIG, \%expected, 'ld_setup - real forward, weight ok';
+}
+{
+ set_default();
+ local @get_ip_port_args = ();
+ local @get_ip_port_returns = ('real');
+ local @get_forward_flag_args = ();
+ local @get_forward_flag_returns = ('-m');
+ my %expected = %main::GLOBAL;
+ $main::CONFIG{virtual} = [ undef, undef, {
+ real => [ undef, undef, {
+ weight => 'foo',
+ } ],
+ } ];
+ $expected{virtual} = [ undef, undef, {
+ real => [ undef, undef, {
+ option => { flags => '-r real' },
+ weight => 1,
+ fail_counts => 0,
+ healthchecked => 0,
+ server => { port => undef },
+ } ],
+ server => {},
+ checkcount => $main::CONFIG{checkcount},
+ checktimeout => $main::CONFIG{checktimeout},
+ negotiatetimeout => $main::CONFIG{negotiatetimeout},
+ checkinterval => $main::CONFIG{checkinterval},
+ retryinterval => $main::CONFIG{retryinterval},
+ quiescent => $main::CONFIG{quiescent},
+ } ];
+ ld_setup();
+ is_deeply \%main::CONFIG, \%expected, 'ld_setup - real invalid weight ok';
+}
+{
+ set_default();
+ local @get_ip_port_args = ();
+ local @get_ip_port_returns = ('real');
+ local @get_forward_flag_args = ();
+ local @get_forward_flag_returns = ('-m');
+ my %expected = %main::GLOBAL;
+ $main::CONFIG{virtual} = [ undef, undef, {
+ real => [ undef, undef, {
+ weight => 10,
+ } ],
+ } ];
+ $expected{virtual} = [ undef, undef, {
+ real => [ undef, undef, {
+ option => { flags => '-r real' },
+ weight => 10,
+ fail_counts => 0,
+ healthchecked => 0,
+ server => { port => undef },
+ } ],
+ server => {},
+ checkcount => $main::CONFIG{checkcount},
+ checktimeout => $main::CONFIG{checktimeout},
+ negotiatetimeout => $main::CONFIG{negotiatetimeout},
+ checkinterval => $main::CONFIG{checkinterval},
+ retryinterval => $main::CONFIG{retryinterval},
+ quiescent => $main::CONFIG{quiescent},
+ } ];
+ ld_setup();
+ is_deeply \%main::CONFIG, \%expected, 'ld_setup - real valid weight ok';
+}
+{
+ set_default();
+ local @get_ip_port_args = ();
+ local @get_ip_port_returns = ('real');
+ local @get_forward_flag_args = ();
+ local @get_forward_flag_returns = ('-m');
+ my %expected = %main::GLOBAL;
+ $main::CONFIG{virtual} = [ undef, undef, {
+ real => [ undef, undef, {
+ server => { ip => 'r', port => 'p' },
+ } ],
+ service => 'http',
+ } ];
+ $expected{virtual} = [ undef, undef, {
+ real => [ undef, undef, {
+ server => { ip => 'r', port => 'p' },
+ option => { flags => '-r real' },
+ weight => 1,
+ fail_counts => 0,
+ healthchecked => 0,
+ url => 'http://r:p/',
+ } ],
+ service => 'http',
+ checkcount => $main::CONFIG{checkcount},
+ checktimeout => $main::CONFIG{checktimeout},
+ negotiatetimeout => $main::CONFIG{negotiatetimeout},
+ checkinterval => $main::CONFIG{checkinterval},
+ retryinterval => $main::CONFIG{retryinterval},
+ quiescent => $main::CONFIG{quiescent},
+ } ];
+ ld_setup();
+ is_deeply \%main::CONFIG, \%expected, 'ld_setup - real url ip, port ok';
+}
+{
+ set_default();
+ local @get_ip_port_args = ();
+ local @get_ip_port_returns = ('real');
+ local @get_forward_flag_args = ();
+ local @get_forward_flag_returns = ('-m');
+ my %expected = %main::GLOBAL;
+ $main::CONFIG{virtual} = [ undef, undef, {
+ real => [ undef, undef, {
+ server => { ip => 'r', port => 'p' },
+ } ],
+ service => 'http',
+ checkport => '10000',
+ } ];
+ $expected{virtual} = [ undef, undef, {
+ real => [ undef, undef, {
+ server => { ip => 'r', port => 'p' },
+ option => { flags => '-r real' },
+ weight => 1,
+ fail_counts => 0,
+ healthchecked => 0,
+ url => 'http://r:10000/',
+ } ],
+ service => 'http',
+ checkport => '10000',
+ checkcount => $main::CONFIG{checkcount},
+ checktimeout => $main::CONFIG{checktimeout},
+ negotiatetimeout => $main::CONFIG{negotiatetimeout},
+ checkinterval => $main::CONFIG{checkinterval},
+ retryinterval => $main::CONFIG{retryinterval},
+ quiescent => $main::CONFIG{quiescent},
+ } ];
+ ld_setup();
+ is_deeply \%main::CONFIG, \%expected, 'ld_setup - real url checkport ok';
+}
+{
+ set_default();
+ local @get_ip_port_args = ();
+ local @get_ip_port_returns = ('real');
+ local @get_forward_flag_args = ();
+ local @get_forward_flag_returns = ('-m');
+ my %expected = %main::GLOBAL;
+ $main::CONFIG{virtual} = [ undef, undef, {
+ real => [ undef, undef, {
+ server => { ip => 'r' },
+ } ],
+ service => 'http',
+ server => { port => 'v' },
+ } ];
+ $expected{virtual} = [ undef, undef, {
+ real => [ undef, undef, {
+ server => { ip => 'r', port => 'v' },
+ option => { flags => '-r real' },
+ weight => 1,
+ fail_counts => 0,
+ healthchecked => 0,
+ url => 'http://r:v/',
+ } ],
+ server => { port => 'v' },
+ service => 'http',
+ checkcount => $main::CONFIG{checkcount},
+ checktimeout => $main::CONFIG{checktimeout},
+ negotiatetimeout => $main::CONFIG{negotiatetimeout},
+ checkinterval => $main::CONFIG{checkinterval},
+ retryinterval => $main::CONFIG{retryinterval},
+ quiescent => $main::CONFIG{quiescent},
+ } ];
+ ld_setup();
+ is_deeply \%main::CONFIG, \%expected, 'ld_setup - real url default port ok';
+}
+{
+ set_default();
+ local @get_ip_port_args = ();
+ local @get_ip_port_returns = ('real');
+ local @get_forward_flag_args = ();
+ local @get_forward_flag_returns = ('-m');
+ my %expected = %main::GLOBAL;
+ $main::CONFIG{virtual} = [ undef, undef, {
+ real => [ undef, undef, {
+ request => 'r',
+ } ],
+ } ];
+ $expected{virtual} = [ undef, undef, {
+ real => [ undef, undef, {
+ option => { flags => '-r real' },
+ request => 'r',
+ weight => 1,
+ fail_counts => 0,
+ healthchecked => 0,
+ url => 'r',
+ server => { port => undef },
+ } ],
+ server => {},
+ checkcount => $main::CONFIG{checkcount},
+ checktimeout => $main::CONFIG{checktimeout},
+ negotiatetimeout => $main::CONFIG{negotiatetimeout},
+ checkinterval => $main::CONFIG{checkinterval},
+ retryinterval => $main::CONFIG{retryinterval},
+ quiescent => $main::CONFIG{quiescent},
+ } ];
+ ld_setup();
+ is_deeply \%main::CONFIG, \%expected, 'ld_setup - real valid request ok';
+}
+{
+ set_default();
+ local @get_ip_port_args = ();
+ local @get_ip_port_returns = ('real');
+ local @get_forward_flag_args = ();
+ local @get_forward_flag_returns = ('-m');
+ my %expected = %main::GLOBAL;
+ $main::CONFIG{virtual} = [ undef, undef, {
+ real => [ undef, undef, {
+ } ],
+ request => 'r',
+ } ];
+ $expected{virtual} = [ undef, undef, {
+ real => [ undef, undef, {
+ option => { flags => '-r real' },
+ request => 'r',
+ weight => 1,
+ fail_counts => 0,
+ healthchecked => 0,
+ url => 'r',
+ server => { port => undef },
+ } ],
+ server => {},
+ request => 'r',
+ checkcount => $main::CONFIG{checkcount},
+ checktimeout => $main::CONFIG{checktimeout},
+ negotiatetimeout => $main::CONFIG{negotiatetimeout},
+ checkinterval => $main::CONFIG{checkinterval},
+ retryinterval => $main::CONFIG{retryinterval},
+ quiescent => $main::CONFIG{quiescent},
+ } ];
+ ld_setup();
+ is_deeply \%main::CONFIG, \%expected, 'ld_setup - real request overwrite ok';
+}
+{
+ set_default();
+ local @get_ip_port_args = ();
+ local @get_ip_port_returns = ('real');
+ local @get_forward_flag_args = ();
+ local @get_forward_flag_returns = ('-m');
+ my %expected = %main::GLOBAL;
+ $main::CONFIG{virtual} = [ undef, undef, {
+ real => [ undef, undef, {
+ server => { ip => 'r' },
+ } ],
+ request => 'ftp://foo',
+ service => 'ftp',
+ server => { port => 'v' },
+ } ];
+ $expected{virtual} = [ undef, undef, {
+ real => [ undef, undef, {
+ option => { flags => '-r real' },
+ request => 'ftp://foo',
+ weight => 1,
+ fail_counts => 0,
+ healthchecked => 0,
+ url => 'ftp://foo',
+ server => { ip => 'r', port => 'v' },
+ } ],
+ server => { port => 'v' },
+ request => 'ftp://foo',
+ service => 'ftp',
+ checkcount => $main::CONFIG{checkcount},
+ checktimeout => $main::CONFIG{checktimeout},
+ negotiatetimeout => $main::CONFIG{negotiatetimeout},
+ checkinterval => $main::CONFIG{checkinterval},
+ retryinterval => $main::CONFIG{retryinterval},
+ quiescent => $main::CONFIG{quiescent},
+ } ];
+ ld_setup();
+ is_deeply \%main::CONFIG, \%expected, 'ld_setup - real request set to url ok';
+}
+{
+ set_default();
+ local @get_ip_port_args = ();
+ local @get_ip_port_returns = ('real');
+ local @get_forward_flag_args = ();
+ local @get_forward_flag_returns = ('-m');
+ my %expected = %main::GLOBAL;
+ $main::CONFIG{virtual} = [ undef, undef, {
+ real => [ undef, undef, {
+ } ],
+ checktype => 3,
+ } ];
+ $expected{virtual} = [ undef, undef, {
+ real => [ undef, undef, {
+ option => { flags => '-r real' },
+ weight => 1,
+ fail_counts => 0,
+ healthchecked => 0,
+ num_connects => undef,
+ server => { port => undef },
+ } ],
+ server => {},
+ checktype => 'combined',
+ num_connects => 3,
+ checkcount => $main::CONFIG{checkcount},
+ checktimeout => $main::CONFIG{checktimeout},
+ negotiatetimeout => $main::CONFIG{negotiatetimeout},
+ checkinterval => $main::CONFIG{checkinterval},
+ retryinterval => $main::CONFIG{retryinterval},
+ quiescent => $main::CONFIG{quiescent},
+ } ];
+ ld_setup();
+ is_deeply \%main::CONFIG, \%expected, 'ld_setup - real combined ok';
+}
+{
+ set_default();
+ local @get_ip_port_args = ();
+ local @get_ip_port_returns = ('real');
+ local @get_forward_flag_args = ();
+ local @get_forward_flag_returns = ('-m');
+ my %expected = %main::GLOBAL;
+ $main::CONFIG{virtual} = [ undef, undef, {
+ checkcount => 100,
+ } ];
+ $expected{virtual} = [ undef, undef, {
+ checkcount => 100,
+ checktimeout => $main::CONFIG{checktimeout},
+ negotiatetimeout => $main::CONFIG{negotiatetimeout},
+ checkinterval => $main::CONFIG{checkinterval},
+ retryinterval => $main::CONFIG{retryinterval},
+ quiescent => $main::CONFIG{quiescent},
+ } ];
+ ld_setup();
+ is_deeply \%main::CONFIG, \%expected, 'ld_setup - valid checkcount ok';
+}
+{
+ set_default();
+ local @get_ip_port_args = ();
+ local @get_ip_port_returns = ('real');
+ local @get_forward_flag_args = ();
+ local @get_forward_flag_returns = ('-m');
+ my %expected = %main::GLOBAL;
+ $main::CONFIG{virtual} = [ undef, undef, {
+ checkcount => -100,
+ } ];
+ $expected{virtual} = [ undef, undef, {
+ checkcount => $main::CONFIG{checkcount},
+ checktimeout => $main::CONFIG{checktimeout},
+ negotiatetimeout => $main::CONFIG{negotiatetimeout},
+ checkinterval => $main::CONFIG{checkinterval},
+ retryinterval => $main::CONFIG{retryinterval},
+ quiescent => $main::CONFIG{quiescent},
+ } ];
+ ld_setup();
+ is_deeply \%main::CONFIG, \%expected, 'ld_setup - invalid checkcount ok';
+}
+{
+ set_default();
+ local @get_ip_port_args = ();
+ local @get_ip_port_returns = ('real');
+ local @get_forward_flag_args = ();
+ local @get_forward_flag_returns = ('-m');
+ my %expected = %main::GLOBAL;
+ $main::CONFIG{virtual} = [ undef, undef, {
+ checktimeout => 100,
+ } ];
+ $expected{virtual} = [ undef, undef, {
+ checkcount => $main::CONFIG{checkcount},
+ checktimeout => 100,
+ negotiatetimeout => $main::CONFIG{negotiatetimeout},
+ checkinterval => $main::CONFIG{checkinterval},
+ retryinterval => $main::CONFIG{retryinterval},
+ quiescent => $main::CONFIG{quiescent},
+ } ];
+ ld_setup();
+ is_deeply \%main::CONFIG, \%expected, 'ld_setup - valid checktimeout ok';
+}
+{
+ set_default();
+ local @get_ip_port_args = ();
+ local @get_ip_port_returns = ('real');
+ local @get_forward_flag_args = ();
+ local @get_forward_flag_returns = ('-m');
+ my %expected = %main::GLOBAL;
+ $main::CONFIG{virtual} = [ undef, undef, {
+ checktimeout => -100,
+ } ];
+ $expected{virtual} = [ undef, undef, {
+ checkcount => $main::CONFIG{checkcount},
+ checktimeout => $main::CONFIG{checktimeout},
+ negotiatetimeout => $main::CONFIG{negotiatetimeout},
+ checkinterval => $main::CONFIG{checkinterval},
+ retryinterval => $main::CONFIG{retryinterval},
+ quiescent => $main::CONFIG{quiescent},
+ } ];
+ ld_setup();
+ is_deeply \%main::CONFIG, \%expected, 'ld_setup - invalid checktimeout ok';
+}
+{
+ set_default();
+ local @get_ip_port_args = ();
+ local @get_ip_port_returns = ('real');
+ local @get_forward_flag_args = ();
+ local @get_forward_flag_returns = ('-m');
+ my %expected = %main::GLOBAL;
+ $main::CONFIG{virtual} = [ undef, undef, {
+ negotiatetimeout => 100,
+ } ];
+ $expected{virtual} = [ undef, undef, {
+ checkcount => $main::CONFIG{checkcount},
+ checktimeout => $main::CONFIG{checktimeout},
+ negotiatetimeout => 100,
+ checkinterval => $main::CONFIG{checkinterval},
+ retryinterval => $main::CONFIG{retryinterval},
+ quiescent => $main::CONFIG{quiescent},
+ } ];
+ ld_setup();
+ is_deeply \%main::CONFIG, \%expected, 'ld_setup - valid negotiatetimeout ok';
+}
+{
+ set_default();
+ local @get_ip_port_args = ();
+ local @get_ip_port_returns = ('real');
+ local @get_forward_flag_args = ();
+ local @get_forward_flag_returns = ('-m');
+ my %expected = %main::GLOBAL;
+ $main::CONFIG{virtual} = [ undef, undef, {
+ negotiatetimeout => -100,
+ } ];
+ $expected{virtual} = [ undef, undef, {
+ checkcount => $main::CONFIG{checkcount},
+ checktimeout => $main::CONFIG{checktimeout},
+ negotiatetimeout => $main::CONFIG{negotiatetimeout},
+ checkinterval => $main::CONFIG{checkinterval},
+ retryinterval => $main::CONFIG{retryinterval},
+ quiescent => $main::CONFIG{quiescent},
+ } ];
+ ld_setup();
+ is_deeply \%main::CONFIG, \%expected, 'ld_setup - invalid negotiatetimeout ok';
+}
+{
+ set_default();
+ local @get_ip_port_args = ();
+ local @get_ip_port_returns = ('real');
+ local @get_forward_flag_args = ();
+ local @get_forward_flag_returns = ('-m');
+ my %expected = %main::GLOBAL;
+ $main::CONFIG{virtual} = [ undef, undef, {
+ checkinterval => 100,
+ } ];
+ $expected{virtual} = [ undef, undef, {
+ checkcount => $main::CONFIG{checkcount},
+ checktimeout => $main::CONFIG{checktimeout},
+ negotiatetimeout => $main::CONFIG{negotiatetimeout},
+ checkinterval => 100,
+ retryinterval => $main::CONFIG{retryinterval},
+ quiescent => $main::CONFIG{quiescent},
+ } ];
+ ld_setup();
+ is_deeply \%main::CONFIG, \%expected, 'ld_setup - valid checkinterval ok';
+}
+{
+ set_default();
+ local @get_ip_port_args = ();
+ local @get_ip_port_returns = ('real');
+ local @get_forward_flag_args = ();
+ local @get_forward_flag_returns = ('-m');
+ my %expected = %main::GLOBAL;
+ $main::CONFIG{virtual} = [ undef, undef, {
+ checkinterval => -100,
+ } ];
+ $expected{virtual} = [ undef, undef, {
+ checkcount => $main::CONFIG{checkcount},
+ checktimeout => $main::CONFIG{checktimeout},
+ negotiatetimeout => $main::CONFIG{negotiatetimeout},
+ checkinterval => $main::CONFIG{checkinterval},
+ retryinterval => $main::CONFIG{retryinterval},
+ quiescent => $main::CONFIG{quiescent},
+ } ];
+ ld_setup();
+ is_deeply \%main::CONFIG, \%expected, 'ld_setup - invalid checkinterval ok';
+}
+{
+ set_default();
+ local @get_ip_port_args = ();
+ local @get_ip_port_returns = ('real');
+ local @get_forward_flag_args = ();
+ local @get_forward_flag_returns = ('-m');
+ my %expected = %main::GLOBAL;
+ $main::CONFIG{virtual} = [ undef, undef, {
+ retryinterval => 100,
+ } ];
+ $expected{virtual} = [ undef, undef, {
+ checkcount => $main::CONFIG{checkcount},
+ checktimeout => $main::CONFIG{checktimeout},
+ negotiatetimeout => $main::CONFIG{negotiatetimeout},
+ checkinterval => $main::CONFIG{checkinterval},
+ retryinterval => 100,
+ quiescent => $main::CONFIG{quiescent},
+ } ];
+ ld_setup();
+ is_deeply \%main::CONFIG, \%expected, 'ld_setup - valid retryinterval ok';
+}
+{
+ set_default();
+ local @get_ip_port_args = ();
+ local @get_ip_port_returns = ('real');
+ local @get_forward_flag_args = ();
+ local @get_forward_flag_returns = ('-m');
+ my %expected = %main::GLOBAL;
+ $main::CONFIG{virtual} = [ undef, undef, {
+ retryinterval => -100,
+ } ];
+ $expected{virtual} = [ undef, undef, {
+ checkcount => $main::CONFIG{checkcount},
+ checktimeout => $main::CONFIG{checktimeout},
+ negotiatetimeout => $main::CONFIG{negotiatetimeout},
+ checkinterval => $main::CONFIG{checkinterval},
+ retryinterval => $main::CONFIG{retryinterval},
+ quiescent => $main::CONFIG{quiescent},
+ } ];
+ ld_setup();
+ is_deeply \%main::CONFIG, \%expected, 'ld_setup - invalid retryinterval ok';
+}
+{
+ set_default();
+ local @get_ip_port_args = ();
+ local @get_ip_port_returns = ('real');
+ local @get_forward_flag_args = ();
+ local @get_forward_flag_returns = ('-m');
+ my %expected = %main::GLOBAL;
+ $main::CONFIG{virtual} = [ undef, undef, {
+ quiescent => 0,
+ } ];
+ $expected{virtual} = [ undef, undef, {
+ checkcount => $main::CONFIG{checkcount},
+ checktimeout => $main::CONFIG{checktimeout},
+ negotiatetimeout => $main::CONFIG{negotiatetimeout},
+ checkinterval => $main::CONFIG{checkinterval},
+ retryinterval => $main::CONFIG{retryinterval},
+ quiescent => 0,
+ } ];
+ ld_setup();
+ is_deeply \%main::CONFIG, \%expected, 'ld_setup - valid quiescent ok';
+}
+# test end
+#...............................................
+
+L7lib::comment_in();
+
+sub set_default {
+ %main::CONFIG = %main::GLOBAL;
+ $main::PROC_ENV{hostname} = 'test';
+}
+sub override {
+ *get_ip_port = \&__get_ip_port;
+ *get_forward_flag = \&__get_forward_flag;
+ *ld_log = \&__ld_log;
+}
+sub __get_ip_port {
+ push @get_ip_port_args, @_;
+ return shift @get_ip_port_returns;
+}
+sub __get_forward_flag {
+ push @get_forward_flag_args, @_;
+ return shift @get_forward_flag_returns;
+}
+sub __ld_log {
+}
--- /dev/null
+use strict;
+use warnings;
+no warnings qw(redefine once);
+use lib qw(t/lib lib);
+use subs qw(print);
+use Cwd;
+use L7lib;
+use Test::More tests => 16;
+
+L7lib::chdir();
+L7lib::comment_out();
+require './l7directord';
+override();
+
+our @get_ip_port_args = ();
+our @get_ip_port_returns = ();
+our @get_forward_flag_args = ();
+our @get_forward_flag_returns = ();
+our @system_wrapper_args = ();
+our @system_wrapper_returns = ();
+our @command_wrapper_args = ();
+our @command_wrapper_returns = ();
+#...............................................
+# test start
+# - ld_read_l7vsadm
+{
+ set_default();
+ local @get_ip_port_args = ();
+ local @get_ip_port_returns = ();
+ local @get_forward_flag_args = ();
+ local @get_forward_flag_returns = ();
+ local @system_wrapper_args = ();
+ local @system_wrapper_returns = ();
+ local $main::PROC_ENV{l7vsadm} = '/';
+ my %expected = (
+ );
+ my $got = ld_read_l7vsadm();
+ is_deeply $got, \%expected, 'ld_read_l7vsadm - no l7vsadm ok(1)';
+}
+{
+ set_default();
+ local @get_ip_port_args = ();
+ local @get_ip_port_returns = ();
+ local @get_forward_flag_args = ();
+ local @get_forward_flag_returns = ();
+ local @system_wrapper_args = ();
+ local @system_wrapper_returns = ();
+ local $main::PROC_ENV{l7vsadm} = '/proc/1';
+ my %expected = (
+ );
+ my $got = ld_read_l7vsadm();
+ is_deeply $got, \%expected, 'ld_read_l7vsadm - no l7vsadm ok(2)';
+}
+{
+ set_default();
+ local @get_ip_port_args = ();
+ local @get_ip_port_returns = ();
+ local @get_forward_flag_args = ();
+ local @get_forward_flag_returns = ();
+ local @system_wrapper_args = ();
+ local @system_wrapper_returns = ();
+ local $main::PROC_ENV{l7vsadm} = 't/lib/l7vsadm.1';
+ my %expected = (
+ );
+ my $got = ld_read_l7vsadm();
+ is_deeply $got, \%expected, 'ld_read_l7vsadm - no virtual service ok';
+}
+{
+ set_default();
+ local @get_ip_port_args = ();
+ local @get_ip_port_returns = ();
+ local @get_forward_flag_args = ();
+ local @get_forward_flag_returns = ();
+ local @system_wrapper_args = ();
+ local @system_wrapper_returns = ();
+ local $main::PROC_ENV{l7vsadm} = 't/lib/l7vsadm.2';
+ my %expected = (
+ 'tcp:127.0.0.1:80:sessionless' => undef,
+ );
+ my $got = ld_read_l7vsadm();
+ is_deeply $got, \%expected, 'ld_read_l7vsadm - one virtual service ok';
+}
+{
+ set_default();
+ local @get_ip_port_args = ();
+ local @get_ip_port_returns = ();
+ local @get_forward_flag_args = ();
+ local @get_forward_flag_returns = ('-m');
+ local @system_wrapper_args = ();
+ local @system_wrapper_returns = ();
+ local $main::PROC_ENV{l7vsadm} = 't/lib/l7vsadm.3';
+ my %expected = (
+ 'tcp:127.0.0.1:80:cinsert --cookie-name monkey' => {
+ '192.168.0.1:8080' => {
+ server => { ip => '192.168.0.1', port => 8080 },
+ weight => 5,
+ forward => 'Masq',
+ option => { flags => '-r 192.168.0.1:8080',
+ forward => '-m' },
+ },
+ },
+ );
+ my $got = ld_read_l7vsadm();
+ is_deeply $got, \%expected, 'ld_read_l7vsadm - one virtual service, one real server ok';
+}
+{
+ set_default();
+ local @get_ip_port_args = ();
+ local @get_ip_port_returns = ();
+ local @get_forward_flag_args = ();
+ local @get_forward_flag_returns = ('-m', '-m', '-m');
+ local @system_wrapper_args = ();
+ local @system_wrapper_returns = ();
+ local $main::PROC_ENV{l7vsadm} = 't/lib/l7vsadm.4';
+ my %expected = (
+ 'tcp:127.0.0.1:80:url --pattern-match monkey' => {
+ '192.168.0.1:80' => {
+ server => { ip => '192.168.0.1', port => 80 },
+ weight => 3,
+ forward => 'Masq',
+ option => { flags => '-r 192.168.0.1:80',
+ forward => '-m' },
+ },
+ '192.168.0.2:80' => {
+ server => { ip => '192.168.0.2', port => 80 },
+ weight => 2,
+ forward => 'Masq',
+ option => { flags => '-r 192.168.0.2:80',
+ forward => '-m' },
+ },
+ '192.168.0.3:80' => {
+ server => { ip => '192.168.0.3', port => 80 },
+ weight => 1,
+ forward => 'Masq',
+ option => { flags => '-r 192.168.0.3:80',
+ forward => '-m' },
+ },
+ },
+ );
+ my $got = ld_read_l7vsadm();
+ is_deeply $got, \%expected, 'ld_read_l7vsadm - one virtual service, three real server ok';
+}
+{
+ set_default();
+ local @get_ip_port_args = ();
+ local @get_ip_port_returns = ();
+ local @get_forward_flag_args = ();
+ local @get_forward_flag_returns = ();
+ local @system_wrapper_args = ();
+ local @system_wrapper_returns = ();
+ local $main::PROC_ENV{l7vsadm} = 't/lib/l7vsadm.5';
+ my %expected = (
+ 'tcp:127.0.0.1:80:sessionless' => undef,
+ 'tcp:192.168.0.1:8080:sslid' => undef,
+ 'tcp:192.168.0.100:10000:cinsert --cookie-name monkey' => undef,
+ );
+ my $got = ld_read_l7vsadm();
+ is_deeply $got, \%expected, 'ld_read_l7vsadm - three virtual service ok';
+}
+{
+ set_default();
+ local @get_ip_port_args = ();
+ local @get_ip_port_returns = ();
+ local @get_forward_flag_args = ();
+ local @get_forward_flag_returns = ('-m', '-m', '-m');
+ local @system_wrapper_args = ();
+ local @system_wrapper_returns = ();
+ local $main::PROC_ENV{l7vsadm} = 't/lib/l7vsadm.6';
+ my %expected = (
+ 'tcp:127.0.0.1:80:sessionless' => {
+ '192.168.0.1:80' => {
+ server => { ip => '192.168.0.1', port => 80 },
+ weight => 1,
+ forward => 'Masq',
+ option => { flags => '-r 192.168.0.1:80',
+ forward => '-m' },
+ },
+ '192.168.0.2:80' => {
+ server => { ip => '192.168.0.2', port => 80 },
+ weight => 1,
+ forward => 'Masq',
+ option => { flags => '-r 192.168.0.2:80',
+ forward => '-m' },
+ },
+ },
+ 'tcp:10.10.10.10:10:sslid' => undef,
+ 'tcp:20.20.20.20:20:url --pattern-match monkey' => {
+ '192.168.0.1:80' => {
+ server => { ip => '192.168.0.1', port => 80 },
+ weight => 1,
+ forward => 'Masq',
+ option => { flags => '-r 192.168.0.1:80',
+ forward => '-m' },
+ },
+ },
+ );
+ my $got = ld_read_l7vsadm();
+ is_deeply $got, \%expected, 'ld_read_l7vsadm - virtual 1: two real, virtual 2: no real, virtual 3: one real ok';
+}
+{
+ set_default();
+ local @get_ip_port_args = ();
+ local @get_ip_port_returns = ();
+ local @get_forward_flag_args = ();
+ local @get_forward_flag_returns = ();
+ local @system_wrapper_args = ();
+ local @system_wrapper_returns = ();
+ local $main::PROC_ENV{l7vsadm} = 't/lib/l7vsadm.7';
+ my %expected = (
+ );
+ my $got = ld_read_l7vsadm();
+ is_deeply $got, \%expected, 'ld_read_l7vsadm - no virtual, ignore real';
+}
+{
+ set_default();
+ local @get_ip_port_args = ();
+ local @get_ip_port_returns = ();
+ local @get_forward_flag_args = ();
+ local @get_forward_flag_returns = ('-m');
+ local @system_wrapper_args = ();
+ local @system_wrapper_returns = ();
+ local $main::PROC_ENV{l7vsadm} = 't/lib/l7vsadm.8';
+ my %expected = (
+ 'tcp:192.168.0.1:8080:sessionless' => {
+ '192.168.0.2:80' => {
+ server => { ip => '192.168.0.2', port => 80 },
+ weight => 1,
+ forward => 'Masq',
+ option => { flags => '-r 192.168.0.2:80',
+ forward => '-m' },
+ },
+ },
+ );
+ my $got = ld_read_l7vsadm();
+ is_deeply $got, \%expected, 'ld_read_l7vsadm - ignore real, one virtual, one real ok';
+}
+# - ld_add_virtual
+# - ld_operate_virtual
+{
+ set_default();
+ local @get_ip_port_args = ();
+ local @get_ip_port_returns = ('1.1.1.1:1');
+ local @get_forward_flag_args = ();
+ local @get_forward_flag_returns = ();
+ local @command_wrapper_args = ();
+ local @command_wrapper_returns = (0, q{});
+ local $main::PROC_ENV{l7vsadm} = 'l7vsadm';
+ my $v = { module => { name => 'sslid' }, option => { flags => '-t 1.1.1.1:1 -m sslid' } };
+ ld_add_virtual($v);
+ is_deeply \@command_wrapper_args, ['l7vsadm -A -t 1.1.1.1:1 -m sslid 2>&1'], 'ld_add_virtual - ok';
+}
+# - ld_edit_virtual
+# - ld_operate_virtual
+{
+ set_default();
+ local @get_ip_port_args = ();
+ local @get_ip_port_returns = ('1.1.1.1:1');
+ local @get_forward_flag_args = ();
+ local @get_forward_flag_returns = ();
+ local @command_wrapper_args = ();
+ local @command_wrapper_returns = (0, q{});
+ local $main::PROC_ENV{l7vsadm} = 'l7vsadm';
+ my $v = { module => { name => 'sslid' }, option => { flags => '-t 1.1.1.1:1 -m sslid' } };
+ ld_edit_virtual($v);
+ is_deeply \@command_wrapper_args, ['l7vsadm -E -t 1.1.1.1:1 -m sslid 2>&1'], 'ld_edit_virtual - ok';
+}
+# - ld_delete_virtual
+# - ld_operate_virtual
+{
+ set_default();
+ local @get_ip_port_args = ();
+ local @get_ip_port_returns = ('1.1.1.1:1');
+ local @get_forward_flag_args = ();
+ local @get_forward_flag_returns = ();
+ local @command_wrapper_args = ();
+ local @command_wrapper_returns = (0, q{});
+ local $main::PROC_ENV{l7vsadm} = 'l7vsadm';
+ my $v = { module => { name => 'sslid' }, option => { main => '-t 1.1.1.1:1 -m sslid' } };
+ ld_delete_virtual($v);
+ is_deeply \@command_wrapper_args, ['l7vsadm -D -t 1.1.1.1:1 -m sslid 2>&1'], 'ld_delete_virtual - ok';
+}
+# - ld_add_real
+# - ld_operate_real
+{
+ set_default();
+ local @get_ip_port_args = ();
+ local @get_ip_port_returns = ('1.1.1.1:1', '2.2.2.2:2');
+ local @get_forward_flag_args = ();
+ local @get_forward_flag_returns = ();
+ local @command_wrapper_args = ();
+ local @command_wrapper_returns = (0, q{});
+ local $main::PROC_ENV{l7vsadm} = 'l7vsadm';
+ my $v = { module => { name => 'sslid' }, option => { main => '-t 1.1.1.1:1 -m sslid' } };
+ my $r = { option => { flags => '-r 2.2.2.2:2' } };
+ my $weight = 10;
+ ld_add_real($v, $r, $weight);
+ is_deeply \@command_wrapper_args, ['l7vsadm -a -t 1.1.1.1:1 -m sslid -r 2.2.2.2:2 -w 10 2>&1'], 'ld_add_real - ok';
+}
+# - ld_edit_real
+# - ld_operate_real
+{
+ set_default();
+ local @get_ip_port_args = ();
+ local @get_ip_port_returns = ('1.1.1.1:1', '2.2.2.2:2');
+ local @get_forward_flag_args = ();
+ local @get_forward_flag_returns = ();
+ local @command_wrapper_args = ();
+ local @command_wrapper_returns = (0, q{});
+ local $main::PROC_ENV{l7vsadm} = 'l7vsadm';
+ my $v = { module => { name => 'sslid' }, option => { main => '-t 1.1.1.1:1 -m sslid' } };
+ my $r = { option => { flags => '-r 2.2.2.2:2' } };
+ my $weight = 10;
+ ld_edit_real($v, $r, $weight);
+ is_deeply \@command_wrapper_args, ['l7vsadm -e -t 1.1.1.1:1 -m sslid -r 2.2.2.2:2 -w 10 2>&1'], 'ld_edit_real - ok';
+}
+# - ld_delete_real
+# - ld_operate_real
+{
+ set_default();
+ local @get_ip_port_args = ();
+ local @get_ip_port_returns = ('1.1.1.1:1', '2.2.2.2:2');
+ local @get_forward_flag_args = ();
+ local @get_forward_flag_returns = ();
+ local @command_wrapper_args = ();
+ local @command_wrapper_returns = (0, q{});
+ local $main::PROC_ENV{l7vsadm} = 'l7vsadm';
+ my $v = { module => { name => 'sslid' }, option => { main => '-t 1.1.1.1:1 -m sslid' } };
+ my $r = { option => { flags => '-r 2.2.2.2:2' } };
+ my $weight = 10;
+ ld_delete_real($v, $r, $weight);
+ is_deeply \@command_wrapper_args, ['l7vsadm -d -t 1.1.1.1:1 -m sslid -r 2.2.2.2:2 2>&1'], 'ld_delete_real - ok';
+}
+# test end
+#...............................................
+
+L7lib::comment_in();
+
+sub set_default {
+ $main::PROC_ENV{l7vsadm} = 'l7vsadm';
+}
+sub override {
+ *get_ip_port = \&__get_ip_port;
+ *get_forward_flag = \&__get_forward_flag;
+ *system_wrapper = \&__system_wrapper;
+ *command_wrapper = \&__command_wrapper;
+ *ld_log = \&__ld_log;
+}
+sub __get_ip_port {
+ push @get_ip_port_args, @_;
+ return shift @get_ip_port_returns;
+}
+sub __get_forward_flag {
+ push @get_forward_flag_args, @_;
+ return shift @get_forward_flag_returns;
+}
+sub __system_wrapper {
+ push @system_wrapper_args, @_;
+ return shift @system_wrapper_returns;
+}
+sub __command_wrapper {
+ push @command_wrapper_args, @_;
+ return shift @command_wrapper_returns;
+}
+sub __ld_log {
+}
--- /dev/null
+use strict;
+use warnings;
+no warnings qw(redefine once);
+use lib qw(t/lib lib);
+use subs qw(print);
+use Cwd;
+use L7lib;
+use Test::More tests => 31;
+
+L7lib::chdir();
+L7lib::comment_out();
+require './l7directord';
+override();
+
+our @ld_read_l7vsadm_args = ();
+our @ld_read_l7vsadm_returns = ();
+our @get_virtual_id_str_args = ();
+our @get_virtual_id_str_returns = ();
+our @ld_add_virtual_args = ();
+our @ld_add_virtual_returns = ();
+our @ld_edit_virtual_args = ();
+our @ld_edit_virtual_returns = ();
+our @fallback_find_args = ();
+our @fallback_find_returns = ();
+our @get_ip_port_args = ();
+our @get_ip_port_returns = ();
+our @get_health_check_id_str_args = ();
+our @get_health_check_id_str_returns = ();
+our @ld_delete_virtual_args = ();
+our @ld_delete_virtual_returns = ();
+our @ld_delete_real_args = ();
+our @ld_delete_real_returns = ();
+#...............................................
+# test start
+# - ld_start
+{
+ set_default();
+ local @ld_read_l7vsadm_returns = ();
+ ld_start();
+ is_deeply \%main::CONFIG, \%main::GLOBAL, 'ld_start - l7vsadm error';
+}
+{
+ set_default();
+ local @ld_read_l7vsadm_returns = ( {} );
+ $main::CONFIG{virtual} = [ { protocol => 'tcp' } ];
+ my %expected = %main::GLOBAL;
+ $expected{virtual} = [ { protocol => 'tcp' } ];
+ ld_start();
+ is_deeply \%main::CONFIG, \%expected, 'ld_start - l7vsadm has no service';
+}
+{
+ set_default();
+ local @ld_read_l7vsadm_returns = ( {} );
+ local @get_virtual_id_str_returns = ();
+ $main::CONFIG{virtual} = [ { protocol => 'tcp' } ];
+ my %expected = %main::GLOBAL;
+ $expected{virtual} = [ { protocol => 'tcp' } ];
+ ld_start();
+ is_deeply \%main::CONFIG, \%expected, 'ld_start - get_virtual_id_error';
+}
+{
+ set_default();
+ local @ld_read_l7vsadm_returns = ( { vid => undef } );
+ local @get_virtual_id_str_returns = ('vid');
+ $main::CONFIG{virtual} = [ { protocol => 'tcp' } ];
+ my %expected = %main::GLOBAL;
+ $expected{virtual} = [ { protocol => 'tcp' } ];
+ ld_start();
+ is_deeply \%main::CONFIG, \%expected, 'ld_start - edit virtual';
+ is_deeply \@ld_edit_virtual_args, [ { protocol => 'tcp' } ], 'ld_start - edit virtual call';
+}
+{
+ set_default();
+ local @ld_read_l7vsadm_returns = ( {} );
+ local @get_virtual_id_str_returns = ('vid');
+ $main::CONFIG{virtual} = [ { protocol => 'tcp' } ];
+ my %expected = %main::GLOBAL;
+ $expected{virtual} = [ { protocol => 'tcp' } ];
+ ld_start();
+ is_deeply \%main::CONFIG, \%expected, 'ld_start - add virtual';
+ is_deeply \@ld_add_virtual_args, [ { protocol => 'tcp' } ], 'ld_start - add virtual call';
+}
+{
+ set_default();
+ local @ld_read_l7vsadm_returns = ( { vid => { 'fbip:fbport' => undef } } );
+ local @get_virtual_id_str_returns = ('vid');
+ local @fallback_find_returns = ( {} );
+ local @get_ip_port_returns = ( 'fbip:fbport' );
+ $main::CONFIG{virtual} = [ { protocol => 'tcp' } ];
+ my %expected = %main::GLOBAL;
+ $expected{virtual} = [ { protocol => 'tcp' } ];
+ ld_start();
+ is_deeply \%main::CONFIG, \%expected, 'ld_start - fallback find';
+ is_deeply \@ld_delete_real_args, [], 'ld_start - not delete fallback';
+}
+{
+ set_default();
+ local @ld_read_l7vsadm_returns = ( { vid => { 'fbip:fbport' => undef, 'foo:bar' => { ip => 'foo' } } } );
+ local @get_virtual_id_str_returns = ('vid');
+ local @fallback_find_returns = ( {} );
+ local @get_ip_port_returns = ( 'fbip:fbport' );
+ $main::CONFIG{virtual} = [ { protocol => 'tcp' } ];
+ my %expected = %main::GLOBAL;
+ $expected{virtual} = [ { protocol => 'tcp' } ];
+ ld_start();
+ is_deeply \%main::CONFIG, \%expected, 'ld_start - delete not management real';
+ is_deeply \@ld_delete_real_args, [ { protocol => 'tcp' }, { ip => 'foo' } ], 'ld_start - delete real';
+}
+{
+ set_default();
+ local @ld_read_l7vsadm_returns = ( { vid => { 'foo:bar' => { ip => 'foo' } } } );
+ local @get_virtual_id_str_returns = ('vid');
+ local @get_health_check_id_str_returns = ();
+ local @fallback_find_returns = ();
+ local @get_ip_port_returns = ( 'foo:bar' );
+ $main::CONFIG{virtual} = [ {
+ protocol => 'tcp',
+ real => [ 'real' ],
+ } ];
+ my %expected = %main::GLOBAL;
+ $expected{virtual} = [ {
+ protocol => 'tcp',
+ real => [ 'real' ],
+ } ];
+ ld_start();
+ is_deeply \%main::CONFIG, \%expected, 'ld_start - health_check_id_str error';
+}
+{
+ set_default();
+ local @ld_read_l7vsadm_returns = ( { vid => { 'foo:bar' => { ip => 'foo' } } } );
+ local @get_virtual_id_str_returns = ('vid');
+ local @get_health_check_id_str_returns = ('hid');
+ local @fallback_find_returns = ();
+ local @get_ip_port_returns = ( 'foo:bar' );
+ local %main::HEALTH_CHECK = ();
+ $main::CONFIG{virtual} = [ {
+ protocol => 'tcp',
+ real => [ 'real' ],
+ } ];
+ my %expected = %main::GLOBAL;
+ $expected{virtual} = [ {
+ protocol => 'tcp',
+ real => [ 'real' ],
+ } ];
+ ld_start();
+ is_deeply \%main::CONFIG, \%expected, 'ld_start - new health check';
+ is_deeply \%main::HEALTH_CHECK, { hid => { manage => [
+ [ $expected{virtual}[0], $expected{virtual}[0]{real}[0] ]
+ ] } }, 'ld_start - new health check id';
+}
+{
+ set_default();
+ local @ld_read_l7vsadm_returns = ( { vid => { 'foo:bar' => { ip => 'foo' } } } );
+ local @get_virtual_id_str_returns = ('vid');
+ local @get_health_check_id_str_returns = ('hid');
+ local @fallback_find_returns = ();
+ local @get_ip_port_returns = ( 'foo:bar' );
+ local %main::HEALTH_CHECK = ( hid => undef );
+ $main::CONFIG{virtual} = [ {
+ protocol => 'tcp',
+ real => [ 'real' ],
+ } ];
+ my %expected = %main::GLOBAL;
+ $expected{virtual} = [ {
+ protocol => 'tcp',
+ real => [ 'real' ],
+ } ];
+ ld_start();
+ is_deeply \%main::CONFIG, \%expected, 'ld_start - add health check';
+ is_deeply \%main::HEALTH_CHECK, { hid => { manage => [
+ [ $expected{virtual}[0], $expected{virtual}[0]{real}[0] ]
+ ] } }, 'ld_start - add health check id';
+}
+{
+ set_default();
+ local @ld_read_l7vsadm_returns = ( { vid => { 'foo:bar' => { ip => 'foo' } } } );
+ local @get_virtual_id_str_returns = ('vid');
+ local @get_health_check_id_str_returns = ('hid');
+ local @fallback_find_returns = ();
+ local @get_ip_port_returns = ( 'foo:bar' );
+ $main::CONFIG{virtual} = [ {
+ protocol => 'tcp',
+ real => [ 'real' ],
+ } ];
+ local %main::HEALTH_CHECK = ( hid => { manage => [ [ $main::CONFIG{virtual}[0], $main::CONFIG{virtual}[0]{real}[0] ] ] } );
+ my %expected = %main::GLOBAL;
+ $expected{virtual} = [ {
+ protocol => 'tcp',
+ real => [ 'real' ],
+ } ];
+ ld_start();
+ is_deeply \%main::CONFIG, \%expected, 'ld_start - ignore exists health check';
+ is_deeply \%main::HEALTH_CHECK, { hid => { manage => [
+ [ $expected{virtual}[0], $expected{virtual}[0]{real}[0] ]
+ ] } }, 'ld_start - ignore exists health check id';
+}
+{
+ set_default();
+ local @ld_read_l7vsadm_returns = ( {} );
+ $main::CONFIG{old_virtual} = [];
+ my %expected = %main::GLOBAL;
+ delete $expected{old_virtual};
+ ld_start();
+ is_deeply \%main::CONFIG, \%expected, 'ld_start - empty old virtual';
+}
+{
+ set_default();
+ local @ld_read_l7vsadm_returns = ( {} );
+ local @get_virtual_id_str_returns = ( 'vid' );
+ $main::CONFIG{old_virtual} = ['ov'];
+ my %expected = %main::GLOBAL;
+ delete $expected{old_virtual};
+ ld_start();
+ is_deeply \%main::CONFIG, \%expected, 'ld_start - not exists old virtual';
+}
+{
+ set_default();
+ local @ld_read_l7vsadm_returns = ( { vid => { ip => 'foo' } } );
+ local @get_virtual_id_str_returns = ( 'vid' );
+ $main::CONFIG{old_virtual} = ['ov'];
+ my %expected = %main::GLOBAL;
+ delete $expected{old_virtual};
+ ld_start();
+ is_deeply \%main::CONFIG, \%expected, 'ld_start - exists old virtual';
+ is_deeply \@ld_delete_virtual_args, ['ov'], 'ld_start - exists old virtual delete';
+}
+# - ld_stop
+{
+ set_default();
+ local @ld_read_l7vsadm_returns = ();
+ ld_stop();
+ is_deeply \%main::CONFIG, \%main::GLOBAL, 'ld_stop - l7vsadm no service';
+}
+{
+ set_default();
+ local @ld_read_l7vsadm_returns = ({});
+ $main::CONFIG{virtual} = [];
+ my %expected = %main::GLOBAL;
+ $expected{virtual} = [];
+ ld_stop();
+ is_deeply \%main::CONFIG, \%expected, 'ld_stop - empty virtual';
+}
+{
+ set_default();
+ local @ld_read_l7vsadm_returns = ({});
+ local @get_virtual_id_str_args = ();
+ local @get_virtual_id_str_returns = ('vid');
+ local @ld_delete_virtual_args = ();
+ $main::CONFIG{virtual} = ['virtual'];
+ my %expected = %main::GLOBAL;
+ $expected{virtual} = ['virtual'];
+ ld_stop();
+ is_deeply \%main::CONFIG, \%expected, 'ld_stop - no real';
+ is_deeply \@get_virtual_id_str_args, ['virtual'], 'ld_stop - get_virtual_id_str';
+ is_deeply \@ld_delete_virtual_args, ['virtual'], 'ld_stop - delete virtual';
+}
+{
+ set_default();
+ local @ld_read_l7vsadm_returns = ({ vid => { rid1 => 'real1', rid2 => 'real2' } });
+ local @get_virtual_id_str_args = ();
+ local @get_virtual_id_str_returns = ('vid');
+ local @ld_delete_virtual_args = ();
+ local @ld_delete_real_args = ();
+ $main::CONFIG{virtual} = ['virtual'];
+ my %expected = %main::GLOBAL;
+ $expected{virtual} = ['virtual'];
+ ld_stop();
+ is_deeply \%main::CONFIG, \%expected, 'ld_stop - exists real';
+ is_deeply \@get_virtual_id_str_args, ['virtual'], 'ld_stop - get_virtual_id_str';
+ is_deeply \@ld_delete_real_args, ['virtual', 'real2', 'virtual', 'real1'], 'ld_stop - delete real';
+ is_deeply \@ld_delete_virtual_args, ['virtual'], 'ld_stop - delete virtual';
+}
+# test end
+#...............................................
+
+L7lib::comment_in();
+
+sub set_default {
+ %main::CONFIG = %main::GLOBAL;
+ %main::HEALTH_CHECK = ();
+}
+sub override {
+ *ld_read_l7vsadm = \&__ld_read_l7vsadm;
+ *get_virtual_id_str = \&__get_virtual_id_str;
+ *ld_add_virtual = \&__ld_add_virtual;
+ *ld_edit_virtual = \&__ld_edit_virtual;
+ *fallback_find = \&__fallback_find;
+ *get_ip_port = \&__get_ip_port;
+ *get_health_check_id_str = \&__get_health_check_id_str;
+ *ld_delete_virtual = \&__ld_delete_virtual;
+ *ld_delete_real = \&__ld_delete_real;
+ *ld_log = \&__ld_log;
+}
+sub __ld_read_l7vsadm {
+ push @ld_read_l7vsadm_args, @_;
+ return shift @ld_read_l7vsadm_returns;
+}
+sub __get_virtual_id_str {
+ push @get_virtual_id_str_args, @_;
+ return shift @get_virtual_id_str_returns;
+}
+sub __ld_add_virtual {
+ push @ld_add_virtual_args, @_;
+ return shift @ld_add_virtual_returns;
+}
+sub __ld_edit_virtual {
+ push @ld_edit_virtual_args, @_;
+ return shift @ld_edit_virtual_returns;
+}
+sub __fallback_find {
+ push @fallback_find_args, @_;
+ return shift @fallback_find_returns;
+}
+sub __get_ip_port {
+ push @get_ip_port_args, @_;
+ return shift @get_ip_port_returns;
+}
+sub __get_health_check_id_str {
+ push @get_health_check_id_str_args, @_;
+ return shift @get_health_check_id_str_returns;
+}
+sub __ld_delete_virtual {
+ push @ld_delete_virtual_args, @_;
+ return shift @ld_delete_virtual_returns;
+}
+sub __ld_delete_real {
+ push @ld_delete_real_args, @_;
+ return shift @ld_delete_real_returns;
+}
+sub __ld_log {
+}
--- /dev/null
+use strict;
+use warnings;
+no warnings qw(redefine once);
+use lib qw(t/lib lib);
+use subs qw(print);
+use Cwd;
+use L7lib;
+use Test::More tests => 6;
+
+L7lib::chdir();
+L7lib::comment_out();
+require './l7directord';
+override();
+
+our @system_wrapper_args = ();
+our @system_wrapper_returns = ();
+#...............................................
+# test start
+# - ld_cmd_children
+{
+ set_default();
+ local @system_wrapper_args = ();
+ local @system_wrapper_returns = ();
+ ld_cmd_children();
+ is_deeply \@system_wrapper_args, [], 'ld_cmd_children - no execute';
+}
+{
+ set_default();
+ local @system_wrapper_args = ();
+ local @system_wrapper_returns = ();
+ $main::CONFIG{execute} = { subconf1 => 1, subconf2 => 1 };
+ ld_cmd_children();
+ is_deeply \@system_wrapper_args, [], 'ld_cmd_children - exists execute, but no command';
+}
+{
+ set_default();
+ local @system_wrapper_args = ();
+ local @system_wrapper_returns = ();
+ $main::CONFIG{execute} = { subconf1 => 1, subconf2 => 1 };
+ ld_cmd_children('start');
+ is_deeply \@system_wrapper_args, ['l7directord subconf1 start', 'l7directord subconf2 start'],
+ 'ld_cmd_children - exists execute and command';
+}
+{
+ set_default();
+ local @system_wrapper_args = ();
+ local @system_wrapper_returns = ();
+ $main::CONFIG{execute} = { subconf1 => 1, subconf2 => 1 };
+ ld_cmd_children('start', {});
+ is_deeply \@system_wrapper_args, [], 'ld_cmd_children - specified empty config';
+}
+{
+ set_default();
+ local @system_wrapper_args = ();
+ local @system_wrapper_returns = ();
+ my $execute = { subconf1 => 1, subconf2 => 1 };
+ ld_cmd_children(undef, $execute);
+ is_deeply \@system_wrapper_args, [], 'ld_cmd_children - specified config but not exist command';
+}
+{
+ set_default();
+ local @system_wrapper_args = ();
+ local @system_wrapper_returns = ();
+ my $execute = { subconf1 => 1, subconf2 => 1 };
+ ld_cmd_children('start', $execute);
+ is_deeply \@system_wrapper_args, ['l7directord subconf1 start', 'l7directord subconf2 start'],
+ 'ld_cmd_children - specified config and exists command';
+}
+# test end
+#...............................................
+
+L7lib::comment_in();
+
+sub set_default {
+ %main::CONFIG = %main::GLOBAL;
+ $main::PROC_ENV{l7directord} = 'l7directord';
+}
+sub override {
+ *system_wrapper = \&__system_wrapper;
+ *ld_log = \&__ld_log;
+}
+sub __system_wrapper {
+ push @system_wrapper_args, @_;
+ return shift @system_wrapper_returns;
+}
+sub __ld_log {
+}
--- /dev/null
+use strict;
+use warnings;
+no warnings qw(redefine once);
+use lib qw(t/lib lib);
+use subs qw(print);
+use Cwd;
+use L7lib;
+use Test::More tests => 29;
+
+L7lib::chdir();
+L7lib::comment_out();
+require './l7directord';
+override();
+
+our $ld_start_called = 0;
+our $ld_stop_called = 0;
+our $reread_config_called = 0;
+our @check_child_process_args = ();
+our @check_child_process_returns = ();
+our @create_check_process_args = ();
+our @create_check_process_returns = ();
+our @sleep_and_check_signal_args = ();
+our @sleep_and_check_signal_returns = ();
+our $check_cfgfile_called = 0;
+our @check_cfgfile_returns = ();
+#...............................................
+# test start
+# - ld_main
+{
+ set_default();
+ local @check_child_process_returns = ([]);
+ local @sleep_and_check_signal_returns = ('halt');
+ local $SIG{TERM} = sub { is $_[0], 'TERM', 'catch sigterm'; };
+ $main::HEALTH_CHECK{id}{pid} = $$;
+ ld_main();
+ is $ld_start_called, 1, 'ld_main - start called';
+ is $reread_config_called, 0, 'ld_main - reread_config called';
+ is $check_cfgfile_called, 0, 'ld_main - check_cfgfile called';
+ is $ld_stop_called, 1, 'ld_main - stop called';
+}
+{
+ set_default();
+ local @check_child_process_returns = (['id1', 'id2']);
+ local @sleep_and_check_signal_returns = ('halt');
+ local $SIG{TERM} = sub { is $_[0], 'TERM', 'catch sigterm'; };
+ $main::HEALTH_CHECK{id}{pid} = $$;
+ ld_main();
+ is $ld_start_called, 1, 'ld_main - start called';
+ is $reread_config_called, 0, 'ld_main - reread_config called';
+ is $ld_stop_called, 1, 'ld_main - stop called';
+ is $check_cfgfile_called, 0, 'ld_main - check_cfgfile called';
+ is_deeply \@create_check_process_args, ['id1', 'id2'], 'ld_main - create_check_process args';
+}
+{
+ set_default();
+ local @check_child_process_returns = (['id1', 'id2'], [], []);
+ local @sleep_and_check_signal_returns = (undef, undef , 'halt');
+ local @create_check_process_args = ();
+ local $SIG{TERM} = sub { is $_[0], 'TERM', 'catch sigterm'; };
+ $main::HEALTH_CHECK{id}{pid} = $$;
+ ld_main();
+ is $ld_start_called, 1, 'ld_main - start called';
+ is $reread_config_called, 0, 'ld_main - reread_config called';
+ is $ld_stop_called, 1, 'ld_main - stop called';
+ is $check_cfgfile_called, 2, 'ld_main - check_cfgfile called';
+ is_deeply \@create_check_process_args, ['id1', 'id2'], 'ld_main - create_check_process args';
+}
+{
+ set_default();
+ local @check_child_process_returns = (['id1', 'id2'], [], []);
+ local @sleep_and_check_signal_returns = (undef, 'reload' , 'halt');
+ local @create_check_process_args = ();
+ local $SIG{TERM} = sub { is $_[0], 'TERM', 'catch sigterm'; };
+ $main::HEALTH_CHECK{id}{pid} = $$;
+ ld_main();
+ is $ld_start_called, 1, 'ld_main - start called';
+ is $reread_config_called, 1, 'ld_main - reread_config called';
+ is $ld_stop_called, 1, 'ld_main - stop called';
+ is $check_cfgfile_called, 1, 'ld_main - check_cfgfile called';
+ is_deeply \@create_check_process_args, ['id1', 'id2'], 'ld_main - create_check_process args';
+}
+{
+ set_default();
+ local @check_child_process_returns = (['id1', 'id2'], [], []);
+ local @sleep_and_check_signal_returns = (undef, 'reload' , 'halt');
+ local @check_cfgfile_returns = (1);
+ local @create_check_process_args = ();
+ local $SIG{TERM} = sub { is $_[0], 'TERM', 'catch sigterm'; };
+ $main::HEALTH_CHECK{id}{pid} = $$;
+ ld_main();
+ is $ld_start_called, 1, 'ld_main - start called';
+ is $reread_config_called, 2, 'ld_main - reread_config called';
+ is $ld_stop_called, 1, 'ld_main - stop called';
+ is $check_cfgfile_called, 1, 'ld_main - check_cfgfile called';
+ is_deeply \@create_check_process_args, ['id1', 'id2'], 'ld_main - create_check_process args';
+}
+# test end
+#...............................................
+
+L7lib::comment_in();
+
+sub set_default {
+ %main::CONFIG = %main::GLOBAL;
+ %main::HEALTH_CHECK = ();
+ $ld_start_called = 0;
+ $ld_stop_called = 0;
+ $reread_config_called = 0;
+ $check_cfgfile_called = 0;
+}
+sub override {
+ *ld_start = \&__ld_start;
+ *check_child_process = \&__check_child_process;
+ *create_check_process = \&__create_check_process;
+ *sleep_and_check_signal = \&__sleep_and_check_signal;
+ *check_cfgfile = \&__check_cfgfile;
+ *reread_config = \&__reread_config;
+ *ld_stop = \&__ld_stop;
+ *ld_log = \&__ld_log;
+}
+sub __ld_start {
+ $ld_start_called++;
+}
+sub __check_child_process {
+ push @check_child_process_args, @_;
+ my $return = shift @check_child_process_returns;
+ return @$return;
+}
+sub __create_check_process {
+ push @create_check_process_args, @_;
+ return shift @create_check_process_returns;
+}
+sub __sleep_and_check_signal {
+ push @sleep_and_check_signal_args, @_;
+ return shift @sleep_and_check_signal_returns;
+}
+sub __check_cfgfile {
+ $check_cfgfile_called++;
+ return shift @check_cfgfile_returns;
+}
+sub __reread_config {
+ $reread_config_called++;
+}
+sub __ld_stop {
+ $ld_stop_called++;
+}
+sub __ld_log {
+}
--- /dev/null
+use strict;
+use warnings;
+no warnings qw(redefine once);
+use lib qw(t/lib lib);
+use subs qw(print);
+use Cwd;
+use L7lib;
+use subs qw(fork chdir);
+use Test::More tests => 29;
+
+L7lib::chdir();
+L7lib::comment_out();
+require './l7directord';
+override();
+
+our $health_check_called = 0;
+our $fork_return = -1;
+our $fork_called = 0;
+our $ld_exit_called = 0;
+our $setsid_return = 0;
+our $chdir_return = 0;
+#...............................................
+# test start
+# - check_child_process
+{
+ set_default();
+ my @got = check_child_process();
+ is_deeply \@got, [], 'check_child_process - no process';
+}
+{
+ set_default();
+ %main::HEALTH_CHECK = ( id1 => { pid => $$ }, id2 => { pid => undef }, id3 => {pid => 100000 } );
+ my @got = check_child_process();
+ is_deeply \@got, ['id2', 'id3'], 'check_child_process - valid process, no process, invalid process';
+}
+# - create_check_process
+{
+ set_default();
+ create_check_process();
+ is $fork_called, 0, 'create_check_process - no list';
+ is $health_check_called, 0, 'create_check_process - no list';
+}
+{
+ set_default();
+ $fork_return = -1;
+ create_check_process('id1', 'id2');
+ is $fork_called, 2, 'create_check_process - fork error';
+ is $health_check_called, 0, 'create_check_process - fork error';
+ is_deeply \%main::HEALTH_CHECK, {}, 'create_check_process - fork error';
+}
+{
+ set_default();
+ $fork_return = 0;
+ create_check_process('id1');
+ is $fork_called, 1, 'create_check_process - fork child';
+ is $health_check_called, 1, 'create_check_process - fork child';
+ is_deeply \%main::HEALTH_CHECK, { id1 => {} }, 'create_check_process - fork child';
+}
+{
+ set_default();
+ $fork_return = 1000;
+ create_check_process('id1', 'id2');
+ is $fork_called, 2, 'create_check_process - fork parent';
+ is $health_check_called, 0, 'create_check_process - fork parent';
+ is_deeply \%main::HEALTH_CHECK, { id1 => {pid => 1000}, id2 => {pid => 1000} }, 'create_check_process - fork parent';
+}
+# - ld_daemon_become_child
+{
+ set_default();
+ local $fork_return = 0;
+ eval { ld_daemon_become_child(); };
+ is $fork_called, 1, 'ld_daemon_become_child - fork child';
+ is $ld_exit_called, 0, 'ld_daemon_become_child - become child';
+}
+{
+ set_default();
+ local $fork_return = 1;
+ eval { ld_daemon_become_child(); };
+ is $fork_called, 1, 'ld_daemon_become_child - fork parent';
+ is $ld_exit_called, 1, 'ld_daemon_become_child - parent ld_exit';
+}
+{
+ set_default();
+ local $fork_return = -1;
+ eval { ld_daemon_become_child(); };
+ is $fork_called, 1, 'ld_daemon_become_child - fork error';
+ is $ld_exit_called, 1, 'ld_daemon_become_child - fork error ld_exit';
+}
+# - ld_daemon
+SKIP: {
+ skip "need root privilege", 2 if ($> != 0);
+ set_default();
+ local $fork_return = 0;
+ eval { ld_daemon(); };
+ is $fork_called, 2, 'ld_daemon - fork child 2 times';
+ is $ld_exit_called, 0, 'ld_daemon - become daemon';
+}
+{
+ set_default();
+ local $fork_return = 1;
+ eval { ld_daemon(); };
+ is $fork_called, 1, 'ld_daemon - fork parent';
+ is $ld_exit_called, 1, 'ld_daemon - cannot become daemon';
+}
+{
+ set_default();
+ local $fork_return = -1;
+ eval { ld_daemon(); };
+ is $fork_called, 1, 'ld_daemon - fork error';
+ is $ld_exit_called, 1, 'ld_daemon - cannot become daemon';
+}
+{
+ set_default();
+ local $fork_return = 0;
+ local $setsid_return = -1;
+ eval { ld_daemon(); };
+ is $fork_called, 1, 'ld_daemon - setsid error';
+ is $ld_exit_called, 1, 'ld_daemon - cannot become daemon';
+}
+{
+ set_default();
+ local $fork_return = 0;
+ local $chdir_return = -1;
+ eval { ld_daemon(); };
+ is $fork_called, 2, 'ld_daemon - chdir error';
+ is $ld_exit_called, 1, 'ld_daemon - cannot become daemon';
+}
+# test end
+#...............................................
+
+L7lib::comment_in();
+
+sub set_default {
+ %main::HEALTH_CHECK = ();
+ $health_check_called = 0;
+ $fork_return = -1;
+ $fork_called = 0;
+ $ld_exit_called = 0;
+}
+sub override {
+ *health_check = \&__health_check;
+ *ld_log = \&__ld_log;
+ *ld_exit = \&__ld_exit;
+ *fork = \&__fork;
+ *chdir = \&__chdir;
+ *POSIX::setsid = \&__setsid;
+}
+sub __health_check {
+ $health_check_called++;
+}
+sub __fork {
+ $fork_called++;
+ return $fork_return;
+}
+sub __ld_exit {
+ $ld_exit_called++;
+ die @_;
+}
+sub __setsid {
+ return $setsid_return;
+}
+sub __chdir {
+ return $chdir_return;
+}
+sub __ld_log {
+}
--- /dev/null
+use strict;
+use warnings;
+no warnings qw(redefine once);
+use lib qw(t/lib lib);
+use subs qw(print);
+use Cwd;
+use L7lib;
+use subs qw(fork);
+use Test::More tests => 11;
+
+L7lib::chdir();
+L7lib::comment_out();
+require './l7directord';
+override();
+
+our @check_func_args = ();
+our @check_func_returns = ();
+our @get_status_args = ();
+our @get_status_returns = ();
+our @get_ip_port_args = ();
+our @get_ip_port_returns = ();
+our @get_check_func_args = ();
+our @get_check_func_returns = ();
+our @service_set_args = ();
+our @service_set_returns = ();
+our @check_connect_args = ();
+our @check_connect_returns = ();
+our @sleep_and_check_signal_args = ();
+our @sleep_and_check_signal_returns = ();
+our $health_check_called = 0;
+#...............................................
+# test start
+# - health_check
+{
+ set_default();
+ eval {
+ health_check();
+ };
+ is $@, "1\n", 'health_check - no virtual real list';
+}
+{
+ set_default();
+ local @get_status_returns = ();
+ local @get_check_func_returns = ( \&check_func );
+ my $v = {};
+ my $r = {};
+ eval {
+ health_check([ [] ]);
+ };
+ is $@, "2\n", 'health_check - no virtual real';
+}
+{
+ set_default();
+ local @get_status_returns = ();
+ local @get_ip_port_returns = ('ip:port');
+ local @get_check_func_returns = ( \&check_func );
+ local @check_func_returns = ( $main::SERVICE_DOWN );
+ local @sleep_and_check_signal_returns = ( 'halt' );
+ local @service_set_args = ();
+ my $v = {
+ checktype => 'connect',
+ checkcount => 1,
+ retryinterval => 5,
+ checkinterval => 8,
+ };
+ my $r = {};
+ eval {
+ health_check([ [$v, $r] ]);
+ };
+ is $@, "0\n", 'health_check - no virtual real';
+ is_deeply \@service_set_args, [ [[$v,$r]], 'down' ], 'health_check - service set down';
+}
+{
+ set_default();
+ local @get_status_returns = ();
+ local @get_ip_port_returns = ('ip:port');
+ local @get_check_func_returns = ( \&check_func );
+ local @check_func_returns = ( $main::SERVICE_UP,
+ $main::SERVICE_DOWN,
+ $main::SERVICE_DOWN,
+ $main::SERVICE_DOWN,
+ );
+ local @sleep_and_check_signal_returns = ( 'run',
+ 'run',
+ 'run',
+ 'halt',
+ );
+ local @service_set_args = ();
+ my $v = {
+ checktype => 'connect',
+ checkcount => 3,
+ retryinterval => 5,
+ checkinterval => 8,
+ };
+ my $r = {};
+ eval {
+ health_check([ [$v, $r] ]);
+ };
+ is $@, "0\n", 'health_check - no virtual real';
+ is_deeply \@service_set_args, [ [[$v,$r]], 'up', [[$v,$r]], 'down' ], 'health_check - service set up and down';
+ is_deeply \@sleep_and_check_signal_args, [8,1,5,1,5,1,8,1], 'health_check - sleep time';
+}
+{
+ set_default();
+ local @get_status_returns = ();
+ local @get_ip_port_returns = ('ip:port');
+ local @get_check_func_returns = ( \&check_func );
+ local @check_func_returns = ( $main::SERVICE_DOWN,
+ $main::SERVICE_DOWN,
+ $main::SERVICE_UP,
+ $main::SERVICE_DOWN,
+ );
+ local @sleep_and_check_signal_returns = ( 'run',
+ 'run',
+ 'run',
+ 'halt',
+ );
+ local @service_set_args = ();
+ my $v = {
+ checktype => 'connect',
+ checkcount => 3,
+ retryinterval => 5,
+ checkinterval => 8,
+ };
+ my $r = {};
+ eval {
+ health_check([ [$v, $r] ]);
+ };
+ is $@, "0\n", 'health_check - no virtual real';
+ is_deeply \@service_set_args, [ [[$v,$r]], 'up' ], 'health_check - service set up and down';
+ is_deeply \@sleep_and_check_signal_args, [5,1,5,1,8,1,5,1], 'health_check - sleep time';
+}
+{
+ set_default();
+ local $main::PROC_STAT{parent_pid} = 100000;
+ local @get_status_returns = ();
+ local @get_ip_port_returns = ('ip:port');
+ local @get_check_func_returns = ( \&check_func );
+ local @check_func_returns = ( $main::SERVICE_DOWN );
+ local @sleep_and_check_signal_returns = ( 'run' );
+ local @service_set_args = ();
+ my $v = {
+ checktype => 'connect',
+ checkcount => 3,
+ retryinterval => 5,
+ checkinterval => 8,
+ };
+ my $r = {};
+ eval {
+ health_check([ [$v, $r] ]);
+ };
+ is $@, "3\n", 'health_check - parent process is down';
+}
+# test end
+#...............................................
+
+L7lib::comment_in();
+
+sub check_func {
+ push @check_func_args, @_;
+ return shift @check_func_returns;
+}
+sub set_default {
+ $main::PROC_STAT{parent_pid} = $$;
+ @get_status_args = ();
+ @get_status_returns = ();
+ @get_check_func_args = ();
+ @get_check_func_returns = ();
+ @get_ip_port_args = ();
+ @get_ip_port_returns = ();
+ @service_set_args = ();
+ @service_set_returns = ();
+ @check_connect_args = ();
+ @check_connect_returns = ();
+ $health_check_called = 0;
+ @sleep_and_check_signal_args = ();
+ @sleep_and_check_signal_returns = ();
+}
+sub override {
+ *POSIX::_exit = \&__POSIX__exit;
+ *get_status = \&__get_status;
+ *get_check_func = \&__get_check_func;
+ *service_set = \&__service_set;
+ *check_connect = \&__check_connect;
+ *sleep_and_check_signal = \&__sleep_and_check_signal;
+ *ld_log = \&__ld_log;
+}
+sub __get_status {
+ push @get_status_args, @_;
+ return shift @get_status_returns;
+}
+sub __get_ip_port {
+ push @get_ip_port_args, @_;
+ return shift @get_ip_port_returns;
+}
+sub __get_check_func {
+ push @get_check_func_args, @_;
+ return shift @get_check_func_returns;
+}
+sub __service_set {
+ push @service_set_args, @_;
+ return shift @service_set_returns;
+}
+sub __check_connect {
+ push @get_status_args, @_;
+ return shift @get_status_returns;
+}
+sub __sleep_and_check_signal {
+ push @sleep_and_check_signal_args, @_;
+ return shift @sleep_and_check_signal_returns;
+}
+sub __POSIX__exit {
+ die "$_[0]\n";
+}
+sub __ld_log {
+}
--- /dev/null
+use strict;
+use warnings;
+no warnings qw(redefine once);
+use lib qw(t/lib lib);
+use subs qw(print);
+use Cwd;
+use L7lib;
+use Test::More tests => 8;
+
+L7lib::chdir();
+L7lib::comment_out();
+require './l7directord';
+override();
+
+#...............................................
+# test start
+# - sleep_and_check_signal
+{
+ set_default();
+ my $sec = undef;
+ my $child = 0;
+ my $got = sleep_and_check_signal($sec, $child);
+ is $got, 'halt', 'sleep_and_check_signal - sleep time is undef';
+}
+{
+ set_default();
+ my $sec = 'ten';
+ my $child = 0;
+ my $got = sleep_and_check_signal($sec, $child);
+ is $got, 'halt', 'sleep_and_check_signal - sleep time is invalid';
+}
+{
+ set_default();
+ my $sec = 0;
+ my $child = 0;
+ my $got = sleep_and_check_signal($sec, $child);
+ is $got, 'run', 'sleep_and_check_signal - sleep time is zero';
+}
+{
+ set_default();
+ my $sec = 10;
+ my $child = 0;
+ local $main::PROC_STAT{reload} = 1;
+ my $got = sleep_and_check_signal($sec, $child);
+ is $got, 'reload', 'sleep_and_check_signal - sleep parent and reload';
+ is $main::PROC_STAT, undef, 'sleep_and_check_signal - reload flag off';
+}
+{
+ set_default();
+ my $sec = 10;
+ my $child = 0;
+ local $main::PROC_STAT{halt} = 1;
+ my $got = sleep_and_check_signal($sec, $child);
+ is $got, 'halt', 'sleep_and_check_signal - sleep parent and halt';
+}
+{
+ set_default();
+ my $sec = 10;
+ my $child = 1;
+ local $main::PROC_STAT{halt} = 1;
+ my $got = sleep_and_check_signal($sec, $child);
+ is $got, 'halt', 'sleep_and_check_signal - sleep child and halt';
+}
+{
+ set_default();
+ my $sec = 3;
+ my $child = 1;
+ local $main::PROC_STAT{reload} = 1;
+ my $got = sleep_and_check_signal($sec, $child);
+ is $got, 'run', 'sleep_and_check_signal - sleep child and ignore reload';
+}
+# test end
+#...............................................
+
+L7lib::comment_in();
+
+sub set_default {
+ $main::CONFIG_FILE{path} = 'config';
+}
+sub override {
+ *ld_log = \&__ld_log;
+}
+sub __ld_log {
+}
--- /dev/null
+use strict;
+use warnings;
+no warnings qw(redefine once);
+use lib qw(t/lib lib);
+use subs qw(print);
+use Cwd;
+use L7lib;
+use Test::More tests => 34;
+
+L7lib::chdir();
+L7lib::comment_out();
+require './l7directord';
+override();
+
+#...............................................
+# test start
+# - get_check_func
+{
+ set_default();
+ my $got = get_check_func();
+ is $got, \&main::check_off, 'get_check_func - virtual is undef';
+}
+{
+ set_default();
+ my $v = {};
+ my $got = get_check_func($v);
+ is $got, \&main::check_none, 'get_check_func - no checktype';
+}
+{
+ set_default();
+ my $v = {
+ checktype => 'negotiate',
+ service => 'http'
+ };
+ my $got = get_check_func($v);
+ is $got, \&main::check_http, 'get_check_func - negotiate http';
+}
+{
+ set_default();
+ my $v = {
+ checktype => 'negotiate',
+ service => 'https'
+ };
+ my $got = get_check_func($v);
+ is $got, \&main::check_http, 'get_check_func - negotiate https';
+}
+{
+ set_default();
+ my $v = {
+ checktype => 'negotiate',
+ service => 'pop'
+ };
+ my $got = get_check_func($v);
+ is $got, \&main::check_pop, 'get_check_func - negotiate pop';
+}
+{
+ set_default();
+ my $v = {
+ checktype => 'negotiate',
+ service => 'imap'
+ };
+ my $got = get_check_func($v);
+ is $got, \&main::check_imap, 'get_check_func - negotiate imap';
+}
+{
+ set_default();
+ my $v = {
+ checktype => 'negotiate',
+ service => 'smtp'
+ };
+ my $got = get_check_func($v);
+ is $got, \&main::check_smtp, 'get_check_func - negotiate smtp';
+}
+{
+ set_default();
+ my $v = {
+ checktype => 'negotiate',
+ service => 'ftp'
+ };
+ my $got = get_check_func($v);
+ is $got, \&main::check_ftp, 'get_check_func - negotiate ftp';
+}
+{
+ set_default();
+ my $v = {
+ checktype => 'negotiate',
+ service => 'ldap'
+ };
+ my $got = get_check_func($v);
+ is $got, \&main::check_ldap, 'get_check_func - negotiate ldap';
+}
+{
+ set_default();
+ my $v = {
+ checktype => 'negotiate',
+ service => 'nntp'
+ };
+ my $got = get_check_func($v);
+ is $got, \&main::check_nntp, 'get_check_func - negotiate nntp';
+}
+{
+ set_default();
+ my $v = {
+ checktype => 'negotiate',
+ service => 'dns'
+ };
+ my $got = get_check_func($v);
+ is $got, \&main::check_dns, 'get_check_func - negotiate dns';
+}
+{
+ set_default();
+ my $v = {
+ checktype => 'negotiate',
+ service => 'sip'
+ };
+ my $got = get_check_func($v);
+ is $got, \&main::check_sip, 'get_check_func - negotiate sip';
+}
+{
+ set_default();
+ my $v = {
+ checktype => 'negotiate',
+ service => 'mysql'
+ };
+ my $got = get_check_func($v);
+ is $got, \&main::check_mysql, 'get_check_func - negotiate mysql';
+}
+{
+ set_default();
+ my $v = {
+ checktype => 'negotiate',
+ service => 'pgsql'
+ };
+ my $got = get_check_func($v);
+ is $got, \&main::check_pgsql, 'get_check_func - negotiate pgsql';
+}
+{
+ set_default();
+ my $v = {
+ checktype => 'negotiate',
+ service => 'unknown'
+ };
+ my $got = get_check_func($v);
+ is $got, \&main::check_none, 'get_check_func - negotiate unknown';
+}
+TODO:{
+ todo_skip 'should check closure.', 1 if 1;
+ set_default();
+ my $v = {
+ checktype => 'combined',
+ service => 'http'
+ };
+ my $got = get_check_func($v);
+ is $got, \&main::check_http, 'get_check_func - combined http';
+}
+TODO:{
+ todo_skip 'should check closure.', 1 if 1;
+ set_default();
+ my $v = {
+ checktype => 'combined',
+ service => 'https'
+ };
+ my $got = get_check_func($v);
+ is $got, \&main::check_http, 'get_check_func - combined https';
+}
+TODO:{
+ todo_skip 'should check closure.', 1 if 1;
+ set_default();
+ my $v = {
+ checktype => 'combined',
+ service => 'pop'
+ };
+ my $got = get_check_func($v);
+ is $got, \&main::check_pop, 'get_check_func - combined pop';
+}
+TODO:{
+ todo_skip 'should check closure.', 1 if 1;
+ set_default();
+ my $v = {
+ checktype => 'combined',
+ service => 'imap'
+ };
+ my $got = get_check_func($v);
+ is $got, \&main::check_imap, 'get_check_func - combined imap';
+}
+TODO:{
+ todo_skip 'should check closure.', 1 if 1;
+ set_default();
+ my $v = {
+ checktype => 'combined',
+ service => 'smtp'
+ };
+ my $got = get_check_func($v);
+ is $got, \&main::check_smtp, 'get_check_func - combined smtp';
+}
+TODO:{
+ todo_skip 'should check closure.', 1 if 1;
+ set_default();
+ my $v = {
+ checktype => 'combined',
+ service => 'ftp'
+ };
+ my $got = get_check_func($v);
+ is $got, \&main::check_ftp, 'get_check_func - combined ftp';
+}
+TODO:{
+ todo_skip 'should check closure.', 1 if 1;
+ set_default();
+ my $v = {
+ checktype => 'combined',
+ service => 'ldap'
+ };
+ my $got = get_check_func($v);
+ is $got, \&main::check_ldap, 'get_check_func - combined ldap';
+}
+TODO:{
+ todo_skip 'should check closure.', 1 if 1;
+ set_default();
+ my $v = {
+ checktype => 'combined',
+ service => 'nntp'
+ };
+ my $got = get_check_func($v);
+ is $got, \&main::check_nntp, 'get_check_func - combined nntp';
+}
+TODO:{
+ todo_skip 'should check closure.', 1 if 1;
+ set_default();
+ my $v = {
+ checktype => 'combined',
+ service => 'dns'
+ };
+ my $got = get_check_func($v);
+ is $got, \&main::check_dns, 'get_check_func - combined dns';
+}
+TODO:{
+ todo_skip 'should check closure.', 1 if 1;
+ set_default();
+ my $v = {
+ checktype => 'combined',
+ service => 'sip'
+ };
+ my $got = get_check_func($v);
+ is $got, \&main::check_sip, 'get_check_func - combined sip';
+}
+TODO:{
+ todo_skip 'should check closure.', 1 if 1;
+ set_default();
+ my $v = {
+ checktype => 'combined',
+ service => 'mysql'
+ };
+ my $got = get_check_func($v);
+ is $got, \&main::check_mysql, 'get_check_func - combined mysql';
+}
+TODO:{
+ todo_skip 'should check closure.', 1 if 1;
+ set_default();
+ my $v = {
+ checktype => 'combined',
+ service => 'pgsql'
+ };
+ my $got = get_check_func($v);
+ is $got, \&main::check_pgsql, 'get_check_func - combined pgsql';
+}
+{
+ set_default();
+ my $v = {
+ checktype => 'combined',
+ service => 'unknown'
+ };
+ my $got = get_check_func($v);
+ is $got, \&main::check_none, 'get_check_func - combined unknown';
+}
+{
+ set_default();
+ my $v = {
+ checktype => 'connect',
+ };
+ my $got = get_check_func($v);
+ is $got, \&main::check_ping, 'get_check_func - connect, but no protocol';
+}
+{
+ set_default();
+ my $v = {
+ checktype => 'connect',
+ protocol => 'udp',
+ };
+ my $got = get_check_func($v);
+ is $got, \&main::check_ping, 'get_check_func - connect, protocol is not tcp';
+}
+{
+ set_default();
+ my $v = {
+ checktype => 'connect',
+ protocol => 'tcp',
+ };
+ my $got = get_check_func($v);
+ is $got, \&main::check_connect, 'get_check_func - connect, protocol is tcp';
+}
+{
+ set_default();
+ my $v = {
+ checktype => 'ping',
+ };
+ my $got = get_check_func($v);
+ is $got, \&main::check_ping, 'get_check_func - ping';
+}
+{
+ set_default();
+ my $v = {
+ checktype => 'off',
+ };
+ my $got = get_check_func($v);
+ is $got, \&main::check_off, 'get_check_func - off';
+}
+{
+ set_default();
+ my $v = {
+ checktype => 'on',
+ };
+ my $got = get_check_func($v);
+ is $got, \&main::check_on, 'get_check_func - on';
+}
+# test end
+#...............................................
+
+L7lib::comment_in();
+
+sub set_default {
+}
+sub override {
+ *ld_log = \&__ld_log;
+}
+sub __ld_log {
+}
--- /dev/null
+use strict;
+use warnings;
+no warnings qw(redefine once);
+use lib qw(t/lib lib);
+use subs qw(print);
+use Cwd;
+use L7lib;
+use Test::More tests => 12;
+use IO::Socket::INET;
+
+L7lib::chdir();
+L7lib::comment_out();
+require './l7directord';
+override();
+
+#...............................................
+# test start
+# - check_http
+SKIP: {
+ my $port = 63334;
+ my $sock = create_sock($port);
+ skip 'cannot create socket', 1 if !$sock;
+ my $pid = prepare_child($sock, "HTTP/1.0 200 OK\r\n\r\n");
+ set_default();
+ my $v = {negotiatetimeout => 1, service => 'http', httpmethod => 'GET'};
+ my $r = {url => "http://localhost:$port/", fail_counts => 0,
+ server => {ip => '127.0.0.1', port => $port }};
+ my $got = check_http($v, $r);
+ is $got, $main::SERVICE_UP, 'check_http - GET ok';
+ close_child($pid);
+ close $sock;
+}
+SKIP: {
+ my $port = 63334;
+ my $sock = create_sock($port);
+ skip 'cannot create socket', 1 if !$sock;
+ my $pid = prepare_child($sock, "HTTP/1.0 200 OK\r\n\r\n");
+ set_default();
+ my $v = {negotiatetimeout => 1, service => 'http', httpmethod => 'HEAD'};
+ my $r = {url => "http://localhost:$port/", fail_counts => 0,
+ server => {ip => '127.0.0.1', port => $port }};
+ my $got = check_http($v, $r);
+ is $got, $main::SERVICE_UP, 'check_http - HEAD ok';
+ close_child($pid);
+ close $sock;
+}
+{
+ set_default();
+ my $port = 63334;
+ my $v = {negotiatetimeout => 1, service => 'http', httpmethod => 'HEAD'};
+ my $r = {url => "http//localhost:$port/", fail_counts => 0,
+ server => {ip => '127.0.0.1', port => $port }};
+ my $got = check_http($v, $r);
+ is $got, $main::SERVICE_DOWN, 'check_http - URL error';
+}
+{
+ set_default();
+ my $port = 63334;
+ my $v = {negotiatetimeout => 1, service => 'http', httpmethod => 'HEAD'};
+ my $r = {url => "http://localhost:$port/", fail_counts => 0,
+ server => {ip => '127.0.0.1', port => $port }};
+ my $got = check_http($v, $r);
+ is $got, $main::SERVICE_DOWN, 'check_http - cannot connect';
+}
+SKIP: {
+ my $port = 63334;
+ my $sock = create_sock($port);
+ skip 'cannot create socket', 1 if !$sock;
+ my $pid = prepare_child($sock, "HTTP/1.0 200 OK\r\n\r\n", 2);
+ set_default();
+ my $v = {negotiatetimeout => 1, service => 'http', httpmethod => 'HEAD'};
+ my $r = {url => "http://localhost:$port/", fail_counts => 0,
+ server => {ip => '127.0.0.1', port => $port }};
+ my $got = check_http($v, $r);
+ is $got, $main::SERVICE_DOWN, 'check_http - timeout';
+ close_child($pid);
+ close $sock;
+}
+SKIP: {
+ my $port = 63334;
+ my $sock = create_sock($port);
+ skip 'cannot create socket', 1 if !$sock;
+ my $pid = prepare_child($sock, "HTTP/1.0 500 Internal Server Error\r\n\r\n");
+ set_default();
+ my $v = {negotiatetimeout => 1, service => 'http', httpmethod => 'HEAD'};
+ my $r = {url => "http://localhost:$port/", fail_counts => 0,
+ server => {ip => '127.0.0.1', port => $port }};
+ my $got = check_http($v, $r);
+ is $got, $main::SERVICE_DOWN, 'check_http - error response';
+ close_child($pid);
+ close $sock;
+}
+# https
+TODO: {
+#SKIP: {
+ todo_skip 'not ready https response', 1;
+ my $port = 63334;
+ my $sock = create_sock($port);
+ skip 'cannot create socket', 1 if !$sock;
+ my $pid = prepare_child($sock, "HTTP/1.0 200 OK\r\n\r\n");
+ set_default();
+ my $v = {negotiatetimeout => 1, service => 'https', httpmethod => 'GET'};
+ my $r = {url => "https://localhost:$port/", fail_counts => 0,
+ server => {ip => '127.0.0.1', port => $port }};
+ my $got = check_http($v, $r);
+ is $got, $main::SERVICE_UP, 'check_http - GET ok (https)';
+ close_child($pid);
+ close $sock;
+}
+TODO: {
+#SKIP: {
+ todo_skip 'not ready https response', 1;
+ my $port = 63334;
+ my $sock = create_sock($port);
+ skip 'cannot create socket', 1 if !$sock;
+ my $pid = prepare_child($sock, "HTTP/1.0 200 OK\r\n\r\n");
+ set_default();
+ my $v = {negotiatetimeout => 1, service => 'https', httpmethod => 'HEAD'};
+ my $r = {url => "https://localhost:$port/", fail_counts => 0,
+ server => {ip => '127.0.0.1', port => $port }};
+ my $got = check_http($v, $r);
+ is $got, $main::SERVICE_UP, 'check_http - HEAD ok (https)';
+ close_child($pid);
+ close $sock;
+}
+{
+ set_default();
+ my $port = 63334;
+ my $v = {negotiatetimeout => 1, service => 'https', httpmethod => 'HEAD'};
+ my $r = {url => "https//localhost:$port/", fail_counts => 0,
+ server => {ip => '127.0.0.1', port => $port }};
+ my $got = check_http($v, $r);
+ is $got, $main::SERVICE_DOWN, 'check_http - URL error (https)';
+}
+{
+ set_default();
+ my $port = 63334;
+ my $v = {negotiatetimeout => 1, service => 'https', httpmethod => 'HEAD'};
+ my $r = {url => "https://localhost:$port/", fail_counts => 0,
+ server => {ip => '127.0.0.1', port => $port }};
+ my $got = check_http($v, $r);
+ is $got, $main::SERVICE_DOWN, 'check_http - cannot connect (https)';
+}
+TODO: {
+#SKIP: {
+ todo_skip 'not ready https response', 1;
+ my $port = 63334;
+ my $sock = create_sock($port);
+ skip 'cannot create socket', 1 if !$sock;
+ my $pid = prepare_child($sock, "HTTP/1.0 200 OK\r\n\r\n", 2);
+ set_default();
+ my $v = {negotiatetimeout => 1, service => 'https', httpmethod => 'HEAD'};
+ my $r = {url => "https://localhost:$port/", fail_counts => 0,
+ server => {ip => '127.0.0.1', port => $port }};
+ my $got = check_http($v, $r);
+ is $got, $main::SERVICE_DOWN, 'check_http - timeout (https)';
+ close_child($pid);
+ close $sock;
+}
+TODO: {
+#SKIP: {
+ todo_skip 'not ready https response', 1;
+ my $port = 63334;
+ my $sock = create_sock($port);
+ skip 'cannot create socket', 1 if !$sock;
+ my $pid = prepare_child($sock, "HTTP/1.0 500 Internal Server Error\r\n\r\n");
+ set_default();
+ my $v = {negotiatetimeout => 1, service => 'https', httpmethod => 'HEAD'};
+ my $r = {url => "https://localhost:$port/", fail_counts => 0,
+ server => {ip => '127.0.0.1', port => $port }};
+ my $got = check_http($v, $r);
+ is $got, $main::SERVICE_DOWN, 'check_http - error response (https)';
+ close_child($pid);
+ close $sock;
+}
+# test end
+#...............................................
+
+L7lib::comment_in();
+
+sub create_sock {
+ my $port = shift;
+ my $sock = IO::Socket::INET->new(
+ Listen => 5,
+ LocalAddr => 'localhost',
+ LocalPort => $port,
+ ReuseAddr => 1,
+ Proto => 'tcp');
+ return $sock;
+}
+sub prepare_child {
+ my $sock = shift;
+ my $res = shift;
+ my $sleep = shift;
+ my $pid = fork();
+ if ($pid == 0) {
+ my $s = $sock->accept;
+ <$s>;
+ if ($sleep) { sleep $sleep; }
+ print $s $res;
+ close $s;
+ exit;
+ }
+ return $pid;
+}
+sub close_child {
+ my $pid = shift;
+ kill 15, $pid;
+ waitpid $pid, 0;
+}
+sub set_default {
+}
+sub override {
+ *ld_log = \&__ld_log;
+ *get_status = \&__get_status;
+}
+sub __get_status {
+ return $main::SERVICE_UP;
+}
+sub __ld_log {
+}
--- /dev/null
+use strict;
+use warnings;
+no warnings qw(redefine once);
+use lib qw(t/lib lib);
+use subs qw(print);
+use Cwd;
+use L7lib;
+use Test::More tests => 5;
+use IO::Socket::INET;
+
+L7lib::chdir();
+L7lib::comment_out();
+require './l7directord';
+override();
+
+#...............................................
+# test start
+# - check_smtp
+SKIP: {
+ my $port = 63334;
+ my $sock = create_sock($port);
+ skip 'cannot create socket', 1 if !$sock;
+ my $pid = prepare_child($sock, "220\n250\n");
+ set_default();
+ my $v = {negotiatetimeout => 3};
+ my $r = { server => {ip => '127.0.0.1', port => $port }, fail_counts => 0 };
+ my $got = check_smtp($v, $r);
+ is $got, $main::SERVICE_UP, 'check_smtp - connect ok';
+ close_child($pid);
+ close $sock;
+}
+SKIP: {
+ my $port = 63334;
+ my $sock = create_sock($port);
+ skip 'cannot create socket', 1 if !$sock;
+ my $pid = prepare_child($sock, "220\n250\n");
+ set_default();
+ my $v = {negotiatetimeout => 3, checkport => $port };
+ my $r = { server => {ip => '127.0.0.1', port => 10000 }, fail_counts => 0 };
+ my $got = check_smtp($v, $r);
+ is $got, $main::SERVICE_UP, 'check_smtp - checkport connect ok';
+ close_child($pid);
+ close $sock;
+}
+SKIP: {
+ my $port = 63334;
+ my $sock = create_sock($port);
+ skip 'cannot create socket', 1 if !$sock;
+ my $pid = prepare_child($sock, "420\n");
+ set_default();
+ my $v = {negotiatetimeout => 1, checkport => $port };
+ my $r = { server => {ip => '127.0.0.1', port => 10000 }, fail_counts => 0 };
+ my $got = check_smtp($v, $r);
+ is $got, $main::SERVICE_DOWN, 'check_smtp - error response';
+ close_child($pid);
+ close $sock;
+}
+SKIP: {
+ my $port = 63334;
+ my $sock = create_sock($port);
+ skip 'cannot create socket', 1 if !$sock;
+ my $pid = prepare_child($sock, "220\n250\n", 2);
+ set_default();
+ my $v = {negotiatetimeout => 1, checkport => $port };
+ my $r = { server => {ip => '127.0.0.1', port => 10000 }, fail_counts => 0 };
+ my $got = check_smtp($v, $r);
+ is $got, $main::SERVICE_DOWN, 'check_smtp - timeout';
+ close_child($pid);
+ close $sock;
+}
+{
+ my $port = 63334;
+ set_default();
+ my $v = {negotiatetimeout => 1, checkport => $port };
+ my $r = { server => {ip => '127.0.0.1', port => 10000 }, fail_counts => 0 };
+ my $got = check_smtp($v, $r);
+ is $got, $main::SERVICE_DOWN, 'check_smtp - connect error';
+}
+# test end
+#...............................................
+
+L7lib::comment_in();
+
+sub create_sock {
+ my $port = shift;
+ my $sock = IO::Socket::INET->new(
+ Listen => 5,
+ LocalAddr => 'localhost',
+ LocalPort => $port,
+ ReuseAddr => 1,
+ Proto => 'tcp');
+ return $sock;
+}
+sub prepare_child {
+ my $sock = shift;
+ my $res = shift;
+ my $sleep = shift;
+ my $pid = fork();
+ if ($pid == 0) {
+ my $s = $sock->accept;
+ if ($sleep) { sleep $sleep; }
+ print $s $res;
+ close $s;
+ exit;
+ }
+ return $pid;
+}
+sub close_child {
+ my $pid = shift;
+ kill 15, $pid;
+ waitpid $pid, 0;
+}
+sub set_default {
+}
+sub override {
+ *ld_log = \&__ld_log;
+ *get_status = \&__get_status;
+}
+sub __get_status {
+ return $main::SERVICE_UP;
+}
+sub __ld_log {
+}
--- /dev/null
+use strict;
+use warnings;
+no warnings qw(redefine once);
+use lib qw(t/lib lib);
+use subs qw(print);
+use Cwd;
+use L7lib;
+use Test::More tests => 6;
+use IO::Socket::INET;
+
+L7lib::chdir();
+L7lib::comment_out();
+require './l7directord';
+override();
+
+#...............................................
+# test start
+# - check_pop
+#+OK ready <24814.1224854220@HOST>
+#USER USERNAME
+#+OK Password required for USERNAME.
+#PASS PASSWORD
+#+OK USERNAME has 0 visible messages (0 hidden) in 0 octets.
+#-ERR [AUTH] Password supplied for "USERNAME" is incorrect.
+#QUIT
+#+OK Pop server at HOST signing off.
+SKIP: {
+ my $port = 63334;
+ my $sock = create_sock($port);
+ skip 'cannot create socket', 1 if !$sock;
+ my $pid = prepare_child($sock, "+OK ready\n+OK Password\n+OK user has 0 visible messages (0 hidden) in 0 octets.\n");
+ set_default();
+ my $v = {negotiatetimeout => 3};
+ my $r = { server => {ip => '127.0.0.1', port => $port }, fail_counts => 0 };
+ my $got = check_pop($v, $r);
+ is $got, $main::SERVICE_UP, 'check_pop - connect ok';
+ close_child($pid);
+ close $sock;
+}
+SKIP: {
+ my $port = 63334;
+ my $sock = create_sock($port);
+ skip 'cannot create socket', 1 if !$sock;
+ my $pid = prepare_child($sock, "+OK ready\n+OK Password\n+OK user has 0 visible messages (0 hidden) in 0 octets.\n");
+ set_default();
+ my $v = {negotiatetimeout => 3, checkport => $port};
+ my $r = { server => {ip => '127.0.0.1', port => 10000 }, fail_counts => 0 };
+ my $got = check_pop($v, $r);
+ is $got, $main::SERVICE_UP, 'check_pop - checkport connect ok';
+ close_child($pid);
+ close $sock;
+}
+SKIP: {
+ my $port = 63334;
+ my $sock = create_sock($port);
+ skip 'cannot create socket', 1 if !$sock;
+ my $pid = prepare_child($sock, "+OK ready\n+OK Password\n+OK user has 0 visible messages (0 hidden) in 0 octets.\n");
+ set_default();
+ my $v = {negotiatetimeout => 3, login => 'foo', passwd => 'bar'};
+ my $r = { server => {ip => '127.0.0.1', port => $port } , fail_counts => 0 };
+ my $got = check_pop($v, $r);
+ is $got, $main::SERVICE_UP, 'check_pop - login ok';
+ close_child($pid);
+ close $sock;
+}
+SKIP: {
+ my $port = 63334;
+ my $sock = create_sock($port);
+ skip 'cannot create socket', 1 if !$sock;
+ my $pid = prepare_child($sock, "+OK ready\n+OK Password\n+OK user has 0 visible messages (0 hidden) in 0 octets.\n", 2);
+ set_default();
+ my $v = {negotiatetimeout => 1, login => 'foo', passwd => 'bar'};
+ my $r = { server => {ip => '127.0.0.1', port => $port } , fail_counts => 0 };
+ my $got = check_pop($v, $r);
+ is $got, $main::SERVICE_DOWN, 'check_pop - timeout';
+ close_child($pid);
+ close $sock;
+}
+SKIP: {
+ my $port = 63334;
+ my $sock = create_sock($port);
+ skip 'cannot create socket', 1 if !$sock;
+ my $pid = prepare_child($sock, "+OK ready\n+OK Password\n-ERR\n");
+ set_default();
+ my $v = {negotiatetimeout => 1, login => 'foo', passwd => 'bar'};
+ my $r = { server => {ip => '127.0.0.1', port => $port } , fail_counts => 0 };
+ my $got = check_pop($v, $r);
+ is $got, $main::SERVICE_DOWN, 'check_pop - response error';
+ close_child($pid);
+ close $sock;
+}
+{
+ my $port = 63334;
+ set_default();
+ my $v = {negotiatetimeout => 1, checkport => $port };
+ my $r = { server => {ip => '127.0.0.1', port => 10000 }, fail_counts => 0 };
+ my $got = check_pop($v, $r);
+ is $got, $main::SERVICE_DOWN, 'check_pop - connect error';
+}
+# test end
+#...............................................
+
+L7lib::comment_in();
+
+sub create_sock {
+ my $port = shift;
+ my $sock = IO::Socket::INET->new(
+ Listen => 5,
+ LocalAddr => 'localhost',
+ LocalPort => $port,
+ ReuseAddr => 1,
+ Proto => 'tcp');
+ return $sock;
+}
+sub prepare_child {
+ my $sock = shift;
+ my $res = shift;
+ my $sleep = shift;
+ my $pid = fork();
+ if ($pid == 0) {
+ my $s = $sock->accept;
+ if ($sleep) { sleep $sleep; }
+ print $s $res;
+ close $s;
+ exit;
+ }
+ return $pid;
+}
+sub close_child {
+ my $pid = shift;
+ kill 15, $pid;
+ waitpid $pid, 0;
+}
+sub set_default {
+}
+sub override {
+ *ld_log = \&__ld_log;
+ *get_status = \&__get_status;
+}
+sub __get_status {
+ return $main::SERVICE_UP;
+}
+sub __ld_log {
+}
--- /dev/null
+use strict;
+use warnings;
+no warnings qw(redefine once);
+use lib qw(t/lib lib);
+use subs qw(print);
+use Cwd;
+use L7lib;
+use Test::More tests => 6;
+use IO::Socket::INET;
+
+L7lib::chdir();
+L7lib::comment_out();
+require './l7directord';
+override();
+
+our $module_error = 0;
+eval { require Mail::IMAPClient; };
+if ($@) {
+ $module_error = 1;
+}
+
+#...............................................
+# test start
+# - check_imap
+SKIP: {
+ skip q{Can't locate Mail/IMAPClient.pm in @INC}, 1 if $module_error;
+ my $port = 63334;
+ my $sock = create_sock($port);
+ skip 'cannot create socket', 1 if !$sock;
+ my $pid = prepare_child($sock, ["* OK IMAP4 ready\n", "* BYE\n1 OK completed\n"]);
+ set_default();
+ my $v = { negotiatetimeout => 3, };
+ my $r = { server => {ip => '127.0.0.1', port => $port }, fail_counts => 0 };
+ my $got = check_imap($v, $r);
+ is $got, $main::SERVICE_UP, 'check_imap - connect ok';
+ close_child($pid);
+ close $sock;
+}
+SKIP: {
+ skip q{Can't locate Mail/IMAPClient.pm in @INC}, 1 if $module_error;
+ my $port = 63334;
+ my $sock = create_sock($port);
+ skip 'cannot create socket', 1 if !$sock;
+ my $pid = prepare_child($sock, ["* OK IMAP4 ready\n", "* BYE\n1 OK completed\n"]);
+ set_default();
+ my $v = { negotiatetimeout => 3, checkport => $port };
+ my $r = { server => {ip => '127.0.0.1', port => 10000 }, fail_counts => 0 };
+ my $got = check_imap($v, $r);
+ is $got, $main::SERVICE_UP, 'check_imap - checkport connect ok';
+ close_child($pid);
+ close $sock;
+}
+SKIP: {
+ skip q{Can't locate Mail/IMAPClient.pm in @INC}, 1 if $module_error;
+ my $port = 63334;
+ my $sock = create_sock($port);
+ skip 'cannot create socket', 1 if !$sock;
+ my $pid = prepare_child($sock, ["* OK IMAP4 ready\n", "1 OK LOGIN completed\n", "* BYE\n2 OK completed\n"]);
+ set_default();
+ my $v = {negotiatetimeout => 3, login => 'foo', passwd => 'bar'};
+ my $r = { server => {ip => '127.0.0.1', port => $port } , fail_counts => 0 };
+ my $got = check_imap($v, $r);
+ is $got, $main::SERVICE_UP, 'check_imap - login ok';
+ close_child($pid);
+ close $sock;
+}
+SKIP: {
+ skip q{Can't locate Mail/IMAPClient.pm in @INC}, 1 if $module_error;
+ my $port = 63334;
+ my $sock = create_sock($port);
+ skip 'cannot create socket', 1 if !$sock;
+ my $pid = prepare_child($sock, ["* OK IMAP4 ready\n", "1 OK LOGIN completed\n", "* BYE\n2 OK completed\n"], 5);
+ set_default();
+ my $v = {negotiatetimeout => 1, login => 'foo', passwd => 'bar'};
+ my $r = { server => {ip => '127.0.0.1', port => $port }, fail_counts => 0 };
+ my $got = check_imap($v, $r);
+ is $got, $main::SERVICE_DOWN, 'check_imap - timeout';
+ close_child($pid);
+ close $sock;
+}
+SKIP: {
+ skip q{Can't locate Mail/IMAPClient.pm in @INC}, 1 if $module_error;
+ my $port = 63334;
+ my $sock = create_sock($port);
+ skip 'cannot create socket', 1 if !$sock;
+ my $pid = prepare_child($sock, ["* OK IMAP4 ready\n", "1 NO LOGIN Error\n", "* BYE\n2 OK completed\n"]);
+ set_default();
+ my $v = {negotiatetimeout => 1, login => 'foo', passwd => 'bar'};
+ my $r = { server => {ip => '127.0.0.1', port => $port }, fail_counts => 0 };
+ my $got = check_imap($v, $r);
+ is $got, $main::SERVICE_DOWN, 'check_imap - response error';
+ close_child($pid);
+ close $sock;
+}
+SKIP: {
+ skip q{Can't locate Mail/IMAPClient.pm in @INC}, 1 if $module_error;
+ my $port = 63334;
+ set_default();
+ my $v = {negotiatetimeout => 1, checkport => $port };
+ my $r = { server => {ip => '127.0.0.1', port => 10000 }, fail_counts => 0 };
+ my $got = check_imap($v, $r);
+ is $got, $main::SERVICE_DOWN, 'check_imap - connect error';
+}
+# test end
+#...............................................
+
+L7lib::comment_in();
+
+sub create_sock {
+ my $port = shift;
+ my $sock = IO::Socket::INET->new(
+ Listen => 5,
+ LocalAddr => 'localhost',
+ LocalPort => $port,
+ ReuseAddr => 1,
+ Proto => 'tcp');
+ return $sock;
+}
+sub prepare_child {
+ my $sock = shift;
+ my $res = shift;
+ my $sleep = shift;
+ my $pid = fork();
+ if ($pid == 0) {
+ my $s = $sock->accept;
+ if ($sleep) { sleep $sleep; }
+ for (@$res) {
+ print $s $_;
+ <$s>;
+ }
+ close $s;
+ exit;
+ }
+ return $pid;
+}
+sub close_child {
+ my $pid = shift;
+ kill 15, $pid;
+ waitpid $pid, 0;
+}
+sub set_default {
+}
+sub override {
+ *ld_log = \&__ld_log;
+ *get_status = \&__get_status;
+}
+sub __get_status {
+ return $main::SERVICE_UP;
+}
+sub __ld_log {
+}
--- /dev/null
+use strict;
+use warnings;
+no warnings qw(redefine once);
+use lib qw(t/lib lib);
+use subs qw(print);
+use Cwd;
+use L7lib;
+use Test::More tests => 7;
+use IO::Socket::INET;
+use IO::Handle;
+
+L7lib::chdir();
+L7lib::comment_out();
+require './l7directord';
+override();
+
+our $module_error = 0;
+eval { require Net::LDAP; };
+if ($@) {
+ $module_error = 1;
+}
+
+#...............................................
+# test start
+# - check_ldap
+SKIP: {
+ skip q{Can't locate Net/LDAP.pm in @INC}, 1 if $module_error;
+ my $port = 63334;
+ my $sock = create_sock($port);
+ skip 'cannot create socket', 1 if !$sock;
+ # 30 0C 02 01 01 61 07 0A 01 00 04 00 04 00 __ __ 0....a........
+ my $normal_response = pack 'H*', '300C02010161070A010004000400';
+ my $pid = prepare_child($sock, [$normal_response]);
+ set_default();
+ my $v = { negotiatetimeout => 3, };
+ my $r = { server => {ip => '127.0.0.1', port => $port }, fail_counts => 0 };
+ my $got = check_ldap($v, $r);
+ is $got, $main::SERVICE_UP, 'check_ldap - connect ok';
+ close_child($pid);
+ close $sock;
+}
+SKIP: {
+ skip q{Can't locate Net/LDAP.pm in @INC}, 1 if $module_error;
+ my $port = 63334;
+ my $sock = create_sock($port);
+ skip 'cannot create socket', 1 if !$sock;
+ # 30 0C 02 01 01 61 07 0A 01 00 04 00 04 00 __ __ 0....a........
+ my $normal_response = pack 'H*', '300C02010161070A010004000400';
+ my $pid = prepare_child($sock, [$normal_response]);
+ set_default();
+ my $v = { negotiatetimeout => 3, checkport => $port };
+ my $r = { server => {ip => '127.0.0.1', port => 10000 }, fail_counts => 0 };
+ my $got = check_ldap($v, $r);
+ is $got, $main::SERVICE_UP, 'check_ldap - checkport connect ok';
+ close_child($pid);
+ close $sock;
+}
+SKIP: {
+ skip q{Can't locate Net/LDAP.pm in @INC}, 1 if $module_error;
+ my $port = 63334;
+ my $sock = create_sock($port);
+ skip 'cannot create socket', 1 if !$sock;
+ # 30 0C 02 01 01 61 07 0A 01 00 04 00 04 00 __ __ 0....a........
+ my $normal_response = pack 'H*', '300C02010161070A010004000400';
+ # 30 64 02 01 02 64 5F 04 11 64 63 3D 65 78 61 6D 0d...d_..dc=exam
+ # 70 6C 65 2C 64 63 3D 63 6F 6D 30 4A 30 27 04 0B ple,dc=com0J0'..
+ # 6F 62 6A 65 63 74 43 6C 61 73 73 31 18 04 08 64 objectClass1...d
+ # 63 4F 62 6A 65 63 74 04 0C 6F 72 67 61 6E 69 7A cObject..organiz
+ # 61 74 69 6F 6E 30 0F 04 02 64 63 31 09 04 07 65 ation0...dc1...e
+ # 78 61 6D 70 6C 65 30 0E 04 01 6F 31 09 04 07 65 xample0...o1...e
+ # 78 61 6D 70 6C 65 __ __ __ __ __ __ __ __ __ __ xample
+ my $search_response = pack 'H*',
+ '3064020102645F041164633D6578616D706C652C64633D636F6D304A3027040B' .
+ '6F626A656374436C6173733118040864634F626A656374040C6F7267616E697A' .
+ '6174696F6E300F04026463310904076578616D706C65300E04016F3109040765' .
+ '78616D706C65';
+ my $pid = prepare_child($sock, [$normal_response, $search_response]);
+ set_default();
+ my $v = {negotiatetimeout => 3, };
+ my $r = { server => {ip => '127.0.0.1', port => $port}, request => 'dc=example,dc=com' , fail_counts => 0 };
+ my $got = check_ldap($v, $r);
+ is $got, $main::SERVICE_UP, 'check_ldap - search ok';
+ close_child($pid);
+ close $sock;
+}
+SKIP: {
+ skip q{Can't locate Net/LDAP.pm in @INC}, 1 if $module_error;
+ my $port = 63334;
+ my $sock = create_sock($port);
+ skip 'cannot create socket', 1 if !$sock;
+ # 30 0C 02 01 01 61 07 0A 01 00 04 00 04 00 __ __ 0....a........
+ my $normal_response = pack 'H*', '300C02010161070A010004000400';
+ # 30 64 02 01 02 64 5F 04 11 64 63 3D 65 78 61 6D 0d...d_..dc=exam
+ # 70 6C 65 2C 64 63 3D 63 6F 6D 30 4A 30 27 04 0B ple,dc=com0J0'..
+ # 6F 62 6A 65 63 74 43 6C 61 73 73 31 18 04 08 64 objectClass1...d
+ # 63 4F 62 6A 65 63 74 04 0C 6F 72 67 61 6E 69 7A cObject..organiz
+ # 61 74 69 6F 6E 30 0F 04 02 64 63 31 09 04 07 65 ation0...dc1...e
+ # 78 61 6D 70 6C 65 30 0E 04 01 6F 31 09 04 07 65 xample0...o1...e
+ # 78 61 6D 70 6C 65 __ __ __ __ __ __ __ __ __ __ xample
+ my $search_response = pack 'H*',
+ '3064020102645F041164633D6578616D706C652C64633D636F6D304A3027040B' .
+ '6F626A656374436C6173733118040864634F626A656374040C6F7267616E697A' .
+ '6174696F6E300F04026463310904076578616D706C65300E04016F3109040765' .
+ '78616D706C65';
+ my $pid = prepare_child($sock, [$normal_response, $search_response]);
+ set_default();
+ my $v = {negotiatetimeout => 3};
+ my $r = { server => {ip => '127.0.0.1', port => $port}, request => 'dc=example,dc=com', receive => 'example' , fail_counts => 0 };
+ my $got = check_ldap($v, $r);
+ is $got, $main::SERVICE_UP, 'check_ldap - response check ok';
+ close_child($pid);
+ close $sock;
+}
+SKIP: {
+ skip q{Can't locate Net/LDAP.pm in @INC}, 1 if $module_error;
+ my $port = 63334;
+ my $sock = create_sock($port);
+ skip 'cannot create socket', 1 if !$sock;
+ # 30 0C 02 01 01 61 07 0A 01 00 04 00 04 00 __ __ 0....a........
+ my $normal_response = pack 'H*', '300C02010161070A010004000400';
+ my $pid = prepare_child($sock, [$normal_response], 2);
+ set_default();
+ my $v = {negotiatetimeout => 1};
+ my $r = { server => {ip => '127.0.0.1', port => $port}, request => 'dc=example,dc=com', receive => 'example' , fail_counts => 0 };
+ my $got = check_ldap($v, $r);
+ is $got, $main::SERVICE_DOWN, 'check_ldap - timeout';
+ close_child($pid);
+ close $sock;
+}
+SKIP: {
+ skip q{Can't locate Net/LDAP.pm in @INC}, 1 if $module_error;
+ my $port = 63334;
+ my $sock = create_sock($port);
+ skip 'cannot create socket', 1 if !$sock;
+ # 30 0C 02 01 01 61 07 0A 01 00 04 00 04 00 __ __ 0....a........
+ my $normal_response = pack 'H*', '300C02010161070A010004000400';
+ # 30 64 02 01 02 64 5F 04 11 64 63 3D 65 78 61 6D 0d...d_..dc=exam
+ # 70 6C 65 2C 64 63 3D 63 6F 6D 30 4A 30 27 04 0B ple,dc=com0J0'..
+ # 6F 62 6A 65 63 74 43 6C 61 73 73 31 18 04 08 64 objectClass1...d
+ # 63 4F 62 6A 65 63 74 04 0C 6F 72 67 61 6E 69 7A cObject..organiz
+ # 61 74 69 6F 6E 30 0F 04 02 64 63 31 09 04 07 65 ation0...dc1...e
+ # 78 61 6D 70 6C 65 30 0E 04 01 6F 31 09 04 07 65 xample0...o1...e
+ # 78 61 6D 70 6C 65 __ __ __ __ __ __ __ __ __ __ xample
+ my $search_response = pack 'H*',
+ '3064020102645F041164633D6578616D706C652C64633D636F6D304A3027040B' .
+ '6F626A656374436C6173733118040864634F626A656374040C6F7267616E697A' .
+ '6174696F6E300F04026463310904076578616D706C65300E04016F3109040765' .
+ '78616D706C65';
+ my $pid = prepare_child($sock, [$normal_response, $search_response]);
+ set_default();
+ my $v = {negotiatetimeout => 3};
+ my $r = { server => {ip => '127.0.0.1', port => $port}, request => 'dc=example,dc=com', receive => 'foo' , fail_counts => 0 };
+ my $got = check_ldap($v, $r);
+ is $got, $main::SERVICE_DOWN, 'check_ldap - response error';
+ close_child($pid);
+ close $sock;
+}
+SKIP: {
+ skip q{Can't locate Net/LDAP.pm in @INC}, 1 if $module_error;
+ my $port = 63334;
+ set_default();
+ my $v = {negotiatetimeout => 1, checkport => $port };
+ my $r = { server => {ip => '127.0.0.1', port => 10000 }, fail_counts => 0 };
+ my $got = check_ldap($v, $r);
+ is $got, $main::SERVICE_DOWN, 'check_ldap - connect error';
+}
+# test end
+#...............................................
+
+L7lib::comment_in();
+
+sub create_sock {
+ my $port = shift;
+ my $sock = IO::Socket::INET->new(
+ Listen => 5,
+ LocalAddr => 'localhost',
+ LocalPort => $port,
+ ReuseAddr => 1,
+ Proto => 'tcp');
+ return $sock;
+}
+sub prepare_child {
+ my $sock = shift;
+ my $res = shift;
+ my $sleep = shift;
+ my $pid = fork();
+ if ($pid == 0) {
+ my $s = $sock->accept;
+ $s->autoflush(1);
+ if ($sleep) { sleep $sleep; }
+ for my $response (@$res) {
+ my $length;
+ read $s, $length, 1;
+ read $s, $length, 1;
+ $length = unpack('C', $length);
+ #print "read length: $length\n";
+ my $req;
+ read $s, $req, $length;
+ #print "read: ", unpack('H*', $req), "\n";
+ my $num = substr $req, 2, 1;
+ $response =~ s/^(....)./$1$num/;
+ print $s $response;
+ }
+ close $s;
+ exit;
+ }
+ return $pid;
+}
+sub close_child {
+ my $pid = shift;
+ kill 15, $pid;
+ waitpid $pid, 0;
+}
+sub set_default {
+}
+sub override {
+ *ld_log = \&__ld_log;
+ *get_status = \&__get_status;
+}
+sub __get_status {
+ return $main::SERVICE_UP;
+}
+sub __ld_log {
+}
--- /dev/null
+use strict;
+use warnings;
+no warnings qw(redefine once);
+use lib qw(t/lib lib);
+use subs qw(print);
+use Cwd;
+use L7lib;
+use Test::More tests => 5;
+use IO::Socket::INET;
+
+L7lib::chdir();
+L7lib::comment_out();
+require './l7directord';
+override();
+
+#...............................................
+# test start
+# - check_nntp
+SKIP: {
+ my $port = 63334;
+ my $sock = create_sock($port);
+ skip 'cannot create socket', 1 if !$sock;
+ my $pid = prepare_child($sock, ["200\n"]);
+ set_default();
+ my $v = { negotiatetimeout => 3};
+ my $r = { server => {ip => '127.0.0.1', port => $port }, fail_counts => 0 };
+ my $got = check_nntp($v, $r);
+ is $got, $main::SERVICE_UP, 'check_nntp - response ok';
+ close_child($pid);
+ close $sock;
+}
+SKIP: {
+ my $port = 63334;
+ my $sock = create_sock($port);
+ skip 'cannot create socket', 1 if !$sock;
+ my $pid = prepare_child($sock, ["200\n"]);
+ set_default();
+ my $v = { negotiatetimeout => 3, checkport => $port };
+ my $r = { server => {ip => '127.0.0.1', port => 10000 }, fail_counts => 0 };
+ my $got = check_nntp($v, $r);
+ is $got, $main::SERVICE_UP, 'check_nntp - checkport response ok';
+ close_child($pid);
+ close $sock;
+}
+SKIP: {
+ my $port = 63334;
+ my $sock = create_sock($port);
+ skip 'cannot create socket', 1 if !$sock;
+ my $pid = prepare_child($sock, ["200\n"], 2);
+ set_default();
+ my $v = {negotiatetimeout => 1};
+ my $r = { server => {ip => '127.0.0.1', port => $port } , fail_counts => 0 };
+ my $got = check_nntp($v, $r);
+ is $got, $main::SERVICE_DOWN, 'check_nntp - timeout';
+ close_child($pid);
+ close $sock;
+}
+SKIP: {
+ my $port = 63334;
+ my $sock = create_sock($port);
+ skip 'cannot create socket', 1 if !$sock;
+ my $pid = prepare_child($sock, ["500\n"]);
+ set_default();
+ my $v = {negotiatetimeout => 1};
+ my $r = { server => {ip => '127.0.0.1', port => $port } , fail_counts => 0 };
+ my $got = check_nntp($v, $r);
+ is $got, $main::SERVICE_DOWN, 'check_nntp - response error';
+ close_child($pid);
+ close $sock;
+}
+{
+ my $port = 63334;
+ set_default();
+ my $v = {negotiatetimeout => 1, checkport => $port };
+ my $r = { server => {ip => '127.0.0.1', port => 10000 }, fail_counts => 0 };
+ my $got = check_nntp($v, $r);
+ is $got, $main::SERVICE_DOWN, 'check_nntp - connect error';
+}
+# test end
+#...............................................
+
+L7lib::comment_in();
+
+sub create_sock {
+ my $port = shift;
+ my $sock = IO::Socket::INET->new(
+ Listen => 5,
+ LocalAddr => 'localhost',
+ LocalPort => $port,
+ ReuseAddr => 1,
+ Proto => 'tcp');
+ return $sock;
+}
+sub prepare_child {
+ my $sock = shift;
+ my $res = shift;
+ my $sleep = shift;
+ my $pid = fork();
+ if ($pid == 0) {
+ my $s = $sock->accept;
+ if ($sleep) { sleep $sleep; }
+ for (@$res) {
+ print $s $_;
+ <$s>;
+ }
+ close $s;
+ exit;
+ }
+ return $pid;
+}
+sub close_child {
+ my $pid = shift;
+ kill 15, $pid;
+ waitpid $pid, 0;
+}
+sub set_default {
+}
+sub override {
+ *ld_log = \&__ld_log;
+ *get_status = \&__get_status;
+}
+sub __get_status {
+ return $main::SERVICE_UP;
+}
+sub __ld_log {
+}
--- /dev/null
+use strict;
+use warnings;
+no warnings qw(redefine once);
+use lib qw(t/lib lib);
+use subs qw(print);
+use Cwd;
+use L7lib;
+use Test::More tests => 14;
+use IO::Socket::INET;
+
+L7lib::chdir();
+L7lib::comment_out();
+require './l7directord';
+override();
+
+our $dbi_error = 0;
+eval { require DBI; };
+if ($@) {
+ $dbi_error = 1;
+}
+our $pg_error = 0;
+eval { require DBD::Pg; };
+if ($@) {
+ $pg_error = 1;
+}
+our $mysql_error = 0;
+eval { require DBD::mysql; };
+if ($@) {
+ $mysql_error = 1;
+}
+
+#...............................................
+# test start
+# - check_sql
+# - check_mysql
+TODO: {
+ todo_skip q{Can't locate DBI.pm in @INC}, 1 if $dbi_error;
+ todo_skip q{Can't locate DBD/mysql.pm in @INC}, 1 if $mysql_error;
+ todo_skip 'not ready mysql response', 1;
+#SKIP: {
+ my $port = 63334;
+ my $sock = create_sock($port);
+ skip 'cannot create socket', 1 if !$sock;
+ my $response = ''; # TODO create mysql response
+ my $pid = prepare_child($sock, [$response]);
+ set_default();
+ my $v = { server => {ip => '127.0.0.1'}, negotiatetimeout => 3, login => 'postgres', passwd => '', database => 'template1' };
+ my $r = { server => {ip => '127.0.0.1', port => $port }, fail_counts => 0 };
+ my $got = check_mysql($v, $r);
+ is $got, $main::SERVICE_UP, 'check_mysql - connect ok';
+ close_child($pid);
+ close $sock;
+}
+TODO: {
+ todo_skip q{Can't locate DBI.pm in @INC}, 1 if $dbi_error;
+ todo_skip q{Can't locate DBD/mysql.pm in @INC}, 1 if $mysql_error;
+ todo_skip 'not ready mysql response', 1;
+#SKIP: {
+ my $port = 63334;
+ my $sock = create_sock($port);
+ skip 'cannot create socket', 1 if !$sock;
+ my $response = ''; # TODO create mysql response
+ my $pid = prepare_child($sock, [$response]);
+ set_default();
+ my $v = { server => {ip => '127.0.0.1'}, checkport => $port, negotiatetimeout => 3, login => 'postgres', passwd => '', database => 'template1' };
+ my $r = { server => {ip => '127.0.0.1', port => 10000 }, fail_counts => 0 };
+ my $got = check_mysql($v, $r);
+ is $got, $main::SERVICE_UP, 'check_mysql - checkport connect ok';
+ close_child($pid);
+ close $sock;
+}
+TODO: {
+ todo_skip q{Can't locate DBI.pm in @INC}, 1 if $dbi_error;
+ todo_skip q{Can't locate DBD/mysql.pm in @INC}, 1 if $mysql_error;
+ todo_skip 'not ready mysql response', 1;
+#SKIP: {
+ my $port = 63334;
+ my $sock = create_sock($port);
+ skip 'cannot create socket', 1 if !$sock;
+ my $response = ''; # TODO create mysql response
+ my $query_response = ''; # TODO create mysql query response
+ my $pid = prepare_child($sock, [$response, $query_response]);
+ set_default();
+ my $v = { server => {ip => '127.0.0.1'}, negotiatetimeout => 3, login => 'postgres', passwd => '', database => 'template1' };
+ my $r = { server => {ip => '127.0.0.1', port => $port }, request => 'SELECT * from foo', fail_counts => 0 };
+ my $got = check_mysql($v, $r);
+ is $got, $main::SERVICE_UP, 'check_mysql - request ok';
+ close_child($pid);
+ close $sock;
+}
+SKIP: {
+ skip q{Can't locate DBI.pm in @INC}, 1 if $dbi_error;
+ skip q{Can't locate DBD/mysql.pm in @INC}, 1 if $mysql_error;
+ my $port = 63334;
+ my $sock = create_sock($port);
+ skip 'cannot create socket', 1 if !$sock;
+ my $response = ''; # TODO create mysql response
+ my $pid = prepare_child($sock, [$response], 5);
+ set_default();
+ my $v = { server => {ip => '127.0.0.1'}, negotiatetimeout => 1, login => 'postgres', passwd => '', database => 'template1' };
+ my $r = { server => {ip => '127.0.0.1', port => $port }, request => 'SELECT * from foo', fail_counts => 0 };
+ my $got = check_mysql($v, $r);
+ is $got, $main::SERVICE_DOWN, 'check_mysql - timeout';
+ close_child($pid);
+ close $sock;
+}
+TODO: {
+ todo_skip q{Can't locate DBI.pm in @INC}, 1 if $dbi_error;
+ todo_skip q{Can't locate DBD/mysql.pm in @INC}, 1 if $mysql_error;
+ todo_skip 'not ready mysql response', 1;
+#SKIP: {
+ my $port = 63334;
+ my $sock = create_sock($port);
+ skip 'cannot create socket', 1 if !$sock;
+ my $response = ''; # TODO create mysql response
+ my $query_response = ''; # TODO create mysql query response (3rows)
+ my $pid = prepare_child($sock, [$response, $query_response]);
+ set_default();
+ my $v = { server => {ip => '127.0.0.1'}, negotiatetimeout => 3, login => 'postgres', passwd => '', database => 'template1' };
+ my $r = { server => {ip => '127.0.0.1', port => $port }, request => 'SELECT * from foo', receive => 3, fail_counts => 0 };
+ my $got = check_mysql($v, $r);
+ is $got, $main::SERVICE_UP, 'check_mysql - receive ok';
+ close_child($pid);
+ close $sock;
+}
+TODO: {
+ todo_skip q{Can't locate DBI.pm in @INC}, 1 if $dbi_error;
+ todo_skip q{Can't locate DBD/mysql.pm in @INC}, 1 if $mysql_error;
+ todo_skip 'not ready mysql response', 1;
+#SKIP: {
+ my $port = 63334;
+ my $sock = create_sock($port);
+ skip 'cannot create socket', 1 if !$sock;
+ my $response = ''; # TODO create mysql response
+ my $query_response = ''; # TODO create mysql query response (3rows)
+ my $pid = prepare_child($sock, [$response, $query_response]);
+ set_default();
+ my $v = { server => {ip => '127.0.0.1'}, negotiatetimeout => 3, login => 'postgres', passwd => '', database => 'template1' };
+ my $r = { server => {ip => '127.0.0.1', port => $port }, request => 'SELECT * from foo', receive => 5, fail_counts => 0 };
+ my $got = check_mysql($v, $r);
+ is $got, $main::SERVICE_DOWN, 'check_mysql - receive error';
+ close_child($pid);
+ close $sock;
+}
+SKIP: {
+ skip q{Can't locate DBI.pm in @INC}, 1 if $dbi_error;
+ skip q{Can't locate DBD/mysql.pm in @INC}, 1 if $mysql_error;
+ my $port = 63334;
+ set_default();
+ my $v = {negotiatetimeout => 1, checkport => $port };
+ my $r = { server => {ip => '127.0.0.1', port => 10000 }, fail_counts => 0 };
+ my $got = check_mysql($v, $r);
+ is $got, $main::SERVICE_DOWN, 'check_mysql - connect error';
+}
+# - check_pgsql
+TODO: {
+ todo_skip q{Can't locate DBI.pm in @INC}, 1 if $dbi_error;
+ todo_skip q{Can't locate DBD/Pg.pm in @INC}, 1 if $pg_error;
+ todo_skip 'not ready pgsql response', 1;
+#SKIP: {
+ my $port = 63334;
+ my $sock = create_sock($port);
+ skip 'cannot create socket', 1 if !$sock;
+ my $response = ''; # TODO create pgsql response
+ my $pid = prepare_child($sock, [$response]);
+ set_default();
+ my $v = { server => {ip => '127.0.0.1'}, negotiatetimeout => 3, login => 'postgres', passwd => '', database => 'template1' };
+ my $r = { server => {ip => '127.0.0.1', port => $port }, fail_counts => 0 };
+ my $got = check_pgsql($v, $r);
+ is $got, $main::SERVICE_UP, 'check_pgsql - connect ok';
+ close_child($pid);
+ close $sock;
+}
+TODO: {
+ todo_skip q{Can't locate DBI.pm in @INC}, 1 if $dbi_error;
+ todo_skip q{Can't locate DBD/Pg.pm in @INC}, 1 if $pg_error;
+ todo_skip 'not ready pgsql response', 1;
+#SKIP: {
+ my $port = 63334;
+ my $sock = create_sock($port);
+ skip 'cannot create socket', 1 if !$sock;
+ my $response = ''; # TODO create pgsql response
+ my $pid = prepare_child($sock, [$response]);
+ set_default();
+ my $v = { server => {ip => '127.0.0.1'}, checkport => $port, negotiatetimeout => 3, login => 'postgres', passwd => '', database => 'template1' };
+ my $r = { server => {ip => '127.0.0.1', port => 10000 }, fail_counts => 0 };
+ my $got = check_pgsql($v, $r);
+ is $got, $main::SERVICE_UP, 'check_pgsql - checkport connect ok';
+ close_child($pid);
+ close $sock;
+}
+TODO: {
+ todo_skip q{Can't locate DBI.pm in @INC}, 1 if $dbi_error;
+ todo_skip q{Can't locate DBD/Pg.pm in @INC}, 1 if $pg_error;
+ todo_skip 'not ready pgsql response', 1;
+#SKIP: {
+ my $port = 63334;
+ my $sock = create_sock($port);
+ skip 'cannot create socket', 1 if !$sock;
+ my $response = ''; # TODO create pgsql response
+ my $query_response = ''; # TODO create pgsql query response
+ my $pid = prepare_child($sock, [$response, $query_response]);
+ set_default();
+ my $v = { server => {ip => '127.0.0.1'}, negotiatetimeout => 3, login => 'postgres', passwd => '', database => 'template1' };
+ my $r = { server => {ip => '127.0.0.1', port => $port }, request => 'SELECT * from foo', fail_counts => 0 };
+ my $got = check_pgsql($v, $r);
+ is $got, $main::SERVICE_UP, 'check_pgsql - request ok';
+ close_child($pid);
+ close $sock;
+}
+SKIP: {
+ skip q{Can't locate DBI.pm in @INC}, 1 if $dbi_error;
+ skip q{Can't locate DBD/Pg.pm in @INC}, 1 if $pg_error;
+ my $port = 63334;
+ my $sock = create_sock($port);
+ skip 'cannot create socket', 1 if !$sock;
+ my $response = ''; # TODO create pgsql response
+ my $pid = prepare_child($sock, [$response], 5);
+ set_default();
+ my $v = { server => {ip => '127.0.0.1'}, negotiatetimeout => 1, login => 'postgres', passwd => '', database => 'template1' };
+ my $r = { server => {ip => '127.0.0.1', port => $port }, request => 'SELECT * from foo', fail_counts => 0 };
+ my $got = check_pgsql($v, $r);
+ is $got, $main::SERVICE_DOWN, 'check_pgsql - timeout';
+ close_child($pid);
+ close $sock;
+}
+TODO: {
+ todo_skip q{Can't locate DBI.pm in @INC}, 1 if $dbi_error;
+ todo_skip q{Can't locate DBD/Pg.pm in @INC}, 1 if $pg_error;
+ todo_skip 'not ready pgsql response', 1;
+#SKIP: {
+ my $port = 63334;
+ my $sock = create_sock($port);
+ skip 'cannot create socket', 1 if !$sock;
+ my $response = ''; # TODO create pgsql response
+ my $query_response = ''; # TODO create pgsql query response (3rows)
+ my $pid = prepare_child($sock, [$response, $query_response]);
+ set_default();
+ my $v = { server => {ip => '127.0.0.1'}, negotiatetimeout => 3, login => 'postgres', passwd => '', database => 'template1' };
+ my $r = { server => {ip => '127.0.0.1', port => $port }, request => 'SELECT * from foo', receive => 3, fail_counts => 0 };
+ my $got = check_pgsql($v, $r);
+ is $got, $main::SERVICE_UP, 'check_pgsql - receive ok';
+ close_child($pid);
+ close $sock;
+}
+TODO: {
+ todo_skip q{Can't locate DBI.pm in @INC}, 1 if $dbi_error;
+ todo_skip q{Can't locate DBD/Pg.pm in @INC}, 1 if $pg_error;
+ todo_skip 'not ready pgsql response', 1;
+#SKIP: {
+ my $port = 63334;
+ my $sock = create_sock($port);
+ skip 'cannot create socket', 1 if !$sock;
+ my $response = ''; # TODO create pgsql response
+ my $query_response = ''; # TODO create pgsql query response (3rows)
+ my $pid = prepare_child($sock, [$response, $query_response]);
+ set_default();
+ my $v = { server => {ip => '127.0.0.1'}, negotiatetimeout => 3, login => 'postgres', passwd => '', database => 'template1' };
+ my $r = { server => {ip => '127.0.0.1', port => $port }, request => 'SELECT * from foo', receive => 5, fail_counts => 0 };
+ my $got = check_pgsql($v, $r);
+ is $got, $main::SERVICE_DOWN, 'check_pgsql - receive error';
+ close_child($pid);
+ close $sock;
+}
+SKIP: {
+ skip q{Can't locate DBI.pm in @INC}, 1 if $dbi_error;
+ skip q{Can't locate DBD/Pg.pm in @INC}, 1 if $pg_error;
+ my $port = 63334;
+ set_default();
+ my $v = {negotiatetimeout => 1, checkport => $port };
+ my $r = { server => {ip => '127.0.0.1', port => 10000 }, fail_counts => 0 };
+ my $got = check_pgsql($v, $r);
+ is $got, $main::SERVICE_DOWN, 'check_pgsql - connect error';
+}
+# test end
+#...............................................
+
+L7lib::comment_in();
+
+sub create_sock {
+ my $port = shift;
+ my $sock = IO::Socket::INET->new(
+ Listen => 5,
+ LocalAddr => 'localhost',
+ LocalPort => $port,
+ ReuseAddr => 1,
+ Proto => 'tcp');
+ return $sock;
+}
+sub prepare_child {
+ my $sock = shift;
+ my $res = shift;
+ my $sleep = shift;
+ my $pid = fork();
+ if ($pid == 0) {
+ my $s = $sock->accept;
+ if ($sleep) { sleep $sleep; }
+ for (@$res) {
+ print $s $_;
+# <$s>;
+ }
+ close $s;
+ exit;
+ }
+ return $pid;
+}
+sub close_child {
+ my $pid = shift;
+ kill 15, $pid;
+ waitpid $pid, 0;
+}
+sub set_default {
+}
+sub override {
+ *ld_log = \&__ld_log;
+ *get_status = \&__get_status;
+}
+sub __get_status {
+ return $main::SERVICE_UP;
+}
+sub __ld_log {
+}
--- /dev/null
+use strict;
+use warnings;
+no warnings qw(redefine once);
+use lib qw(t/lib lib);
+use subs qw(print);
+use Cwd;
+use L7lib;
+use Test::More tests => 8;
+use IO::Socket::INET;
+
+L7lib::chdir();
+L7lib::comment_out();
+require './l7directord';
+override();
+
+#...............................................
+# test start
+# - check_connect
+SKIP: {
+ my $port = 63334;
+ my $sock = create_sock($port);
+ skip 'cannot create socket', 1 if !$sock;
+ set_default();
+ my $v = { checktimeout => 3, protocol => 'tcp' };
+ my $r = { server => {ip => '127.0.0.1', port => $port }, fail_counts => 0 };
+ my $got = check_connect($v, $r);
+ is $got, $main::SERVICE_UP, 'check_connect - connect ok';
+ close $sock;
+}
+SKIP: {
+ my $port = 63334;
+ my $sock = create_sock($port);
+ skip 'cannot create socket', 1 if !$sock;
+ set_default();
+ my $v = { checktimeout => 3, protocol => 'tcp', checkport => $port };
+ my $r = { server => {ip => '127.0.0.1', port => 10000 }, fail_counts => 0 };
+ my $got = check_connect($v, $r);
+ is $got, $main::SERVICE_UP, 'check_connect - checkport connect ok';
+ close $sock;
+}
+TODO: {
+ todo_skip 'cannot half open socket', 1;
+#SKIP: {
+ my $port = 63334;
+ my $sock = create_sock($port);
+ skip 'cannot create socket', 1 if !$sock;
+ set_default();
+ my $v = { checktimeout => 1, protocol => 'tcp' };
+ my $r = { server => {ip => '127.0.0.1', port => $port } , fail_counts => 0 };
+ my $got = check_connect($v, $r);
+ is $got, $main::SERVICE_DOWN, 'check_connect - timeout';
+ close $sock;
+}
+{
+ my $port = 63334;
+ set_default();
+ my $v = { checktimeout => 1, checkport => $port, protocol => 'tcp' };
+ my $r = { server => {ip => '127.0.0.1', port => 10000 }, fail_counts => 0 };
+ my $got = check_connect($v, $r);
+ is $got, $main::SERVICE_DOWN, 'check_connect - connect error';
+}
+SKIP: {
+ my $port = 63335;
+ my $sock = create_sock($port, 'udp');
+ skip 'cannot create socket', 1 if !$sock;
+ set_default();
+ my $v = { checktimeout => 3, protocol => 'udp' };
+ my $r = { server => {ip => '127.0.0.1', port => $port }, fail_counts => 0 };
+ my $got = check_connect($v, $r);
+ is $got, $main::SERVICE_UP, 'check_connect - connect ok (udp)';
+ close $sock;
+}
+SKIP: {
+ my $port = 63336;
+ my $sock = create_sock($port, 'udp');
+ skip 'cannot create socket', 1 if !$sock;
+ set_default();
+ my $v = { checktimeout => 3, protocol => 'udp', checkport => $port };
+ my $r = { server => {ip => '127.0.0.1', port => 10000 }, fail_counts => 0 };
+ my $got = check_connect($v, $r);
+ is $got, $main::SERVICE_UP, 'check_connect - checkport connect ok (udp)';
+ close $sock;
+}
+TODO: {
+ todo_skip 'cannot half open socket', 1;
+#SKIP: {
+ my $port = 63337;
+ my $sock = create_sock($port, 'udp');
+ skip 'cannot create socket', 1 if !$sock;
+ set_default();
+ my $v = { checktimeout => 1, protocol => 'udp' };
+ my $r = { server => {ip => '127.0.0.1', port => $port } , fail_counts => 0 };
+ my $got = check_connect($v, $r);
+ is $got, $main::SERVICE_DOWN, 'check_connect - timeout (udp)';
+ close $sock;
+}
+TODO: {
+ todo_skip 'udp socket can connect any port?', 1;
+ my $port = 63338;
+ set_default();
+ my $v = { checktimeout => 1, checkport => $port, protocol => 'udp' };
+ my $r = { server => {ip => '127.0.0.1', port => 10000 }, fail_counts => 0 };
+ my $got = check_connect($v, $r);
+ is $got, $main::SERVICE_DOWN, 'check_connect - connect error (udp)';
+}
+# test end
+#...............................................
+
+L7lib::comment_in();
+
+sub create_sock {
+ my $port = shift;
+ my $proto = shift || 'tcp';
+ if ($proto eq 'tcp') {
+ my $sock = IO::Socket::INET->new(
+ Listen => 5,
+ LocalAddr => 'localhost',
+ LocalPort => $port,
+ ReuseAddr => 1,
+ Proto => $proto);
+ return $sock;
+ }
+ else {
+ my $sock = IO::Socket::INET->new(
+ LocalAddr => 'localhost',
+ LocalPort => $port,
+ ReuseAddr => 1,
+ Proto => $proto);
+ return $sock;
+ }
+}
+sub prepare_child {
+ my $sock = shift;
+ my $res = shift;
+ my $sleep = shift;
+ my $pid = fork();
+ if ($pid == 0) {
+ if ($sleep) { sleep $sleep; }
+ my $s = $sock->accept;
+ for (@$res) {
+ print $s $_;
+ <$s>;
+ }
+ close $s;
+ exit;
+ }
+ return $pid;
+}
+sub close_child {
+ my $pid = shift;
+ kill 15, $pid;
+ waitpid $pid, 0;
+}
+sub set_default {
+}
+sub override {
+ *ld_log = \&__ld_log;
+ *get_status = \&__get_status;
+}
+sub __get_status {
+ return $main::SERVICE_UP;
+}
+sub __ld_log {
+}
--- /dev/null
+use strict;
+use warnings;
+no warnings qw(redefine once);
+use lib qw(t/lib lib);
+use subs qw(print);
+use Cwd;
+use L7lib;
+use Test::More tests => 8;
+use IO::Socket::INET;
+
+L7lib::chdir();
+L7lib::comment_out();
+require './l7directord';
+override();
+
+#...............................................
+# test start
+# - check_sip
+SKIP: {
+ my $port = 63334;
+ my $sock = create_sock($port);
+ skip 'cannot create socket', 1 if !$sock;
+ my $pid = prepare_child($sock, ["SIP/2.0 200 OK\n"]);
+ set_default();
+ my $v = { negotiatetimeout => 3, protocol => 'tcp', login => 'carol@chicago.com' };
+ my $r = { server => {ip => '127.0.0.1', port => $port }, fail_counts => 0 };
+ my $got = check_sip($v, $r);
+ is $got, $main::SERVICE_UP, 'check_sip - response ok';
+ close_child($pid);
+ close $sock;
+}
+SKIP: {
+ my $port = 63334;
+ my $sock = create_sock($port);
+ skip 'cannot create socket', 1 if !$sock;
+ my $pid = prepare_child($sock, ["SIP/2.0 200 OK\n"]);
+ set_default();
+ my $v = { negotiatetimeout => 3, protocol => 'tcp', checkport => $port, login => 'carol@chicago.com' };
+ my $r = { server => {ip => '127.0.0.1', port => 10000 }, fail_counts => 0 };
+ my $got = check_sip($v, $r);
+ is $got, $main::SERVICE_UP, 'check_sip - checkport response ok';
+ close_child($pid);
+ close $sock;
+}
+SKIP: {
+ my $port = 63334;
+ my $sock = create_sock($port);
+ skip 'cannot create socket', 1 if !$sock;
+ my $pid = prepare_child($sock, ["SIP/2.0 200 OK\n"], 2);
+ set_default();
+ my $v = { negotiatetimeout => 1, protocol => 'tcp', login => 'carol@chicago.com' };
+ my $r = { server => {ip => '127.0.0.1', port => $port } , fail_counts => 0 };
+ my $got = check_sip($v, $r);
+ is $got, $main::SERVICE_DOWN, 'check_sip - timeout';
+ close_child($pid);
+ close $sock;
+}
+{
+ my $port = 63334;
+ set_default();
+ my $v = { negotiatetimeout => 1, checkport => $port, protocol => 'tcp', login => 'carol@chicago.com' };
+ my $r = { server => {ip => '127.0.0.1', port => 10000 }, fail_counts => 0 };
+ my $got = check_sip($v, $r);
+ is $got, $main::SERVICE_DOWN, 'check_sip - connect error';
+}
+TODO: {
+ todo_skip 'not implement udp sip response', 1;
+#SKIP: {
+ my $port = 63335;
+ my $sock = create_sock($port, 'udp');
+ skip 'cannot create socket', 1 if !$sock;
+ my $pid = prepare_child($sock, ["SIP/2.0 200 OK\n"], 0, 'udp');
+ set_default();
+ my $v = { negotiatetimeout => 3, protocol => 'udp', login => 'carol@chicago.com' };
+ my $r = { server => {ip => '127.0.0.1', port => $port }, fail_counts => 0 };
+ my $got = check_sip($v, $r);
+ is $got, $main::SERVICE_UP, 'check_sip - connect ok (udp)';
+ close_child($pid);
+ close $sock;
+}
+TODO: {
+ todo_skip 'not implement udp sip response', 1;
+#SKIP: {
+ my $port = 63336;
+ my $sock = create_sock($port, 'udp');
+ skip 'cannot create socket', 1 if !$sock;
+ my $pid = prepare_child($sock, ["SIP/2.0 200 OK\n"], 0, 'udp');
+ set_default();
+ my $v = { negotiatetimeout => 3, protocol => 'udp', checkport => $port, login => 'carol@chicago.com' };
+ my $r = { server => {ip => '127.0.0.1', port => 10000 }, fail_counts => 0 };
+ my $got = check_sip($v, $r);
+ is $got, $main::SERVICE_UP, 'check_sip - checkport connect ok (udp)';
+ close_child($pid);
+ close $sock;
+}
+TODO: {
+ todo_skip 'not implement udp sip response', 1;
+#SKIP: {
+ my $port = 63337;
+ my $sock = create_sock($port, 'udp');
+ skip 'cannot create socket', 1 if !$sock;
+ my $pid = prepare_child($sock, ["SIP/2.0 200 OK\n"], 2, 'udp');
+ set_default();
+ my $v = { negotiatetimeout => 1, protocol => 'udp', login => 'carol@chicago.com' };
+ my $r = { server => {ip => '127.0.0.1', port => $port } , fail_counts => 0 };
+ my $got = check_sip($v, $r);
+ is $got, $main::SERVICE_DOWN, 'check_sip - timeout (udp)';
+ close_child($pid);
+ close $sock;
+}
+TODO: {
+ todo_skip 'udp socket can connect any port?', 1;
+ my $port = 63338;
+ set_default();
+ my $v = { negotiatetimeout => 1, checkport => $port, protocol => 'udp', login => 'carol@chicago.com' };
+ my $r = { server => {ip => '127.0.0.1', port => 10000 }, fail_counts => 0 };
+ my $got = check_sip($v, $r);
+ is $got, $main::SERVICE_DOWN, 'check_sip - connect error (udp)';
+}
+# test end
+#...............................................
+
+L7lib::comment_in();
+
+sub create_sock {
+ my $port = shift;
+ my $proto = shift || 'tcp';
+ if ($proto eq 'tcp') {
+ my $sock = IO::Socket::INET->new(
+ Listen => 5,
+ LocalAddr => 'localhost',
+ LocalPort => $port,
+ ReuseAddr => 1,
+ Proto => $proto);
+ return $sock;
+ }
+ else {
+ my $sock = IO::Socket::INET->new(
+ LocalAddr => 'localhost',
+ LocalPort => $port,
+ ReuseAddr => 1,
+ Proto => $proto);
+ return $sock;
+ }
+}
+sub prepare_child {
+ my $sock = shift;
+ my $res = shift;
+ my $sleep = shift;
+ my $udp = shift;
+ my $pid = fork();
+ if ($pid == 0) {
+ if (!$udp) {
+ my $s = $sock->accept;
+ if ($sleep) { sleep $sleep; }
+ for (@$res) {
+ <$s>;
+ print $s $_;
+ }
+ close $s;
+ exit;
+ } else {
+ my $req;
+ recv $sock, $req, 1500, 0;
+ $req =~ /^Via.+(\d+\.\d+\.\d+\.\d+):(\d+)/;
+ my $ret_sock = IO::Socket::INET->new(
+ PeerAddr => $1,
+ PeerPort => $2,
+ Proto => 'udp',
+ );
+ if ($sleep) { sleep $sleep; }
+ for (@$res) {
+ send $ret_sock, $_, 0;
+ }
+ close $ret_sock;
+ exit;
+ }
+ }
+ return $pid;
+}
+sub close_child {
+ my $pid = shift;
+ kill 15, $pid;
+ waitpid $pid, 0;
+}
+sub set_default {
+}
+sub override {
+ *ld_log = \&__ld_log;
+ *get_status = \&__get_status;
+}
+sub __get_status {
+ return $main::SERVICE_UP;
+}
+sub __ld_log {
+}
--- /dev/null
+use strict;
+use warnings;
+no warnings qw(redefine once);
+use lib qw(t/lib lib);
+use subs qw(print);
+use Cwd;
+use L7lib;
+use Test::More tests => 10;
+use IO::Socket::INET;
+
+L7lib::chdir();
+L7lib::comment_out();
+require './l7directord';
+override();
+
+#...............................................
+# test start
+# - check_ftp
+#220 (vsFTPd 2.0.5)
+#USER ftp
+#331 Please specify the password.
+#PASS ftp
+#230 Login successful.
+#CWD /
+#250 Directory successfully changed.
+#TYPE I
+#200 Switching to Binary mode.
+#PASV
+#227 Entering Passive Mode (127,0,0,1,191,154)
+#RETR test.dat
+#150 Opening BINARY mode data connection for test.dat (9 bytes).
+#226 File send OK.
+#QUIT
+#221 Goodbye.
+SKIP: {
+ my $port = 63334;
+ my $sock = create_sock($port);
+ skip 'cannot create socket', 1 if !$sock;
+ my $pid = prepare_child($sock, [
+ "220 (vsFTPd 2.0.5)\n",
+ "331 Please specify the password\n",
+ "230 Login successful.\n",
+ "250 Directory successfully changed.\n",
+ "221 Goodbye.\n",
+ ]);
+ set_default();
+ my $v = { negotiatetimeout => 3, login => 'ftp', passwd => 'ftppass' };
+ my $r = { server => {ip => '127.0.0.1', port => $port }, fail_counts => 0 };
+ my $got = check_ftp($v, $r);
+ is $got, $main::SERVICE_UP, 'check_ftp - login ok';
+ close_child($pid);
+ close $sock;
+}
+SKIP: {
+ my $port = 63334;
+ my $sock = create_sock($port);
+ skip 'cannot create socket', 1 if !$sock;
+ my $pid = prepare_child($sock, [
+ "220 (vsFTPd 2.0.5)\n",
+ "331 Please specify the password\n",
+ "230 Login successful.\n",
+ "250 Directory successfully changed.\n",
+ "221 Goodbye.\n",
+ ]);
+ set_default();
+ my $v = { negotiatetimeout => 3, login => 'ftp', passwd => 'ftppass', checkport => $port };
+ my $r = { server => {ip => '127.0.0.1', port => 10000 }, fail_counts => 0 };
+ my $got = check_ftp($v, $r);
+ is $got, $main::SERVICE_UP, 'check_ftp - checkport login ok';
+ close_child($pid);
+ close $sock;
+}
+SKIP: {
+ my $port = 63334;
+ my $sock = create_sock($port);
+ skip 'cannot create socket', 1 if !$sock;
+ my $pid = prepare_child($sock, [
+ "220 (vsFTPd 2.0.5)\n",
+ "331 Please specify the password\n",
+ "230 Login successful.\n",
+ "250 Directory successfully changed.\n",
+ "221 Goodbye.\n",
+ ], 2);
+ set_default();
+ my $v = {negotiatetimeout => 1, login => 'ftp', passwd => 'ftppass'};
+ my $r = { server => {ip => '127.0.0.1', port => $port } , fail_counts => 0 };
+ my $got = check_ftp($v, $r);
+ is $got, $main::SERVICE_DOWN, 'check_ftp - timeout';
+ close_child($pid);
+ close $sock;
+}
+SKIP: {
+ my $port = 63334;
+ my $sock = create_sock($port);
+ my $dataport = 53332;
+ my $datasock = create_sock($dataport);
+ skip 'cannot create socket', 1 if !$sock;
+ my $pid = prepare_child($sock, [
+ "220 (vsFTPd 2.0.5)\n",
+ "331 Please specify the password\n",
+ "530 Login incorrect.\n",
+ "221 Goodbye.\n",
+ ]);
+ set_default();
+ my $v = {negotiatetimeout => 1, login => 'foo', passwd => 'bar'};
+ my $r = { server => {ip => '127.0.0.1', port => $port } , fail_counts => 0 };
+ my $got = check_ftp($v, $r);
+ is $got, $main::SERVICE_DOWN, 'check_ftp - login error';
+ close_child($pid);
+ close $sock;
+}
+SKIP: {
+ my $port = 63334;
+ my $sock = create_sock($port);
+ skip 'cannot create socket', 1 if !$sock;
+ my $pid = prepare_child($sock, [
+ "220 (vsFTPd 2.0.5)\n",
+ "331 Please specify the password\n",
+ "230 Login successful.\n",
+ "550 Failed to change directory.\n",
+ "221 Goodbye.\n",
+ ]);
+ set_default();
+ my $v = { negotiatetimeout => 3, login => 'ftp', passwd => 'ftppass', checkport => $port };
+ my $r = { server => {ip => '127.0.0.1', port => 10000 }, fail_counts => 0 };
+ my $got = check_ftp($v, $r);
+ is $got, $main::SERVICE_DOWN, 'check_ftp - checkport cwd error';
+ close_child($pid);
+ close $sock;
+}
+SKIP: {
+ my $port = 63334;
+ my $sock = create_sock($port);
+ my $dataport = 53334;
+ my $datasock = create_sock($dataport);
+ skip 'cannot create socket', 1 if !$sock;
+ skip 'cannot create data socket', 1 if !$datasock;
+ my $pasvport = sprintf "%d,%d", $dataport / 256, $dataport % 256;
+ my $pid = prepare_child($sock, [
+ "220 (vsFTPd 2.0.5)\n",
+ "331 Please specify the password\n",
+ "230 Login successful.\n",
+ "250 Directory successfully changed.\n",
+ "200 Switching to Binary mode.\n",
+ "227 Entering Passive Mode (127,0,0,1,$pasvport)\n",
+ "150 Opening BINARY mode data connection for test.dat (9 bytes).\n226 File send OK.\n",
+ "221 Goodbye.\n",
+ ]);
+ my $datapid = prepare_child($datasock, ["test.dat\n"], 0, 1);
+ set_default();
+ my $v = { negotiatetimeout => 3, login => 'ftp', passwd => 'ftppass' };
+ my $r = { server => {ip => '127.0.0.1', port => $port }, request => 'test.dat' , fail_counts => 0 };
+ my $got = check_ftp($v, $r);
+ is $got, $main::SERVICE_UP, 'check_ftp - get ok';
+ close_child($pid);
+ close_child($datapid);
+ close $sock;
+}
+SKIP: {
+ my $port = 63334;
+ my $sock = create_sock($port);
+ my $dataport = 53335;
+ my $datasock = create_sock($dataport);
+ skip 'cannot create socket', 1 if !$sock;
+ skip 'cannot create socket', 1 if !$datasock;
+ my $pasvport = sprintf "%d,%d", $dataport / 256, $dataport % 256;
+ my $pid = prepare_child($sock, [
+ "220 (vsFTPd 2.0.5)\n",
+ "331 Please specify the password\n",
+ "230 Login successful.\n",
+ "250 Directory successfully changed.\n",
+ "200 Switching to Binary mode.\n",
+ "227 Entering Passive Mode (127,0,0,1,$pasvport)\n",
+ "550 Failed to open file.\n",
+ "221 Goodbye.\n",
+ ]);
+ my $datapid = prepare_child($datasock, ["test.dat\n"]);
+ set_default();
+ my $v = { negotiatetimeout => 3, login => 'ftp', passwd => 'ftppass' };
+ my $r = { server => {ip => '127.0.0.1', port => $port }, request => 'test.dat' , fail_counts => 0 };
+ my $got = check_ftp($v, $r);
+ is $got, $main::SERVICE_DOWN, 'check_ftp - get error';
+ close_child($pid);
+ close_child($datapid);
+ close $sock;
+}
+SKIP: {
+ my $port = 63334;
+ my $sock = create_sock($port);
+ my $dataport = 53334;
+ my $datasock = create_sock($dataport);
+ skip 'cannot create socket', 1 if !$sock;
+ skip 'cannot create data socket', 1 if !$datasock;
+ my $pasvport = sprintf "%d,%d", $dataport / 256, $dataport % 256;
+ my $pid = prepare_child($sock, [
+ "220 (vsFTPd 2.0.5)\n",
+ "331 Please specify the password\n",
+ "230 Login successful.\n",
+ "250 Directory successfully changed.\n",
+ "200 Switching to Binary mode.\n",
+ "227 Entering Passive Mode (127,0,0,1,$pasvport)\n150 Opening BINARY mode data connection for test.dat (9 bytes).\n",
+ "226 File send OK.\n",
+ "221 Goodbye.\n",
+ ]);
+ my $datapid = prepare_child($datasock, ["test.dat\n"], 0, 1);
+ set_default();
+ my $v = { negotiatetimeout => 3, login => 'ftp', passwd => 'ftppass' };
+ my $r = { server => {ip => '127.0.0.1', port => $port }, request => 'test.dat', receive => 'test' , fail_counts => 0 };
+ my $got = check_ftp($v, $r);
+ is $got, $main::SERVICE_UP, 'check_ftp - receive ok';
+ close_child($pid);
+ close_child($datapid);
+ close $sock;
+}
+SKIP: {
+ my $port = 63334;
+ my $sock = create_sock($port);
+ my $dataport = 53334;
+ my $datasock = create_sock($dataport);
+ skip 'cannot create socket', 1 if !$sock;
+ skip 'cannot create data socket', 1 if !$datasock;
+ my $pasvport = sprintf "%d,%d", $dataport / 256, $dataport % 256;
+ my $pid = prepare_child($sock, [
+ "220 (vsFTPd 2.0.5)\n",
+ "331 Please specify the password\n",
+ "230 Login successful.\n",
+ "250 Directory successfully changed.\n",
+ "200 Switching to Binary mode.\n",
+ "227 Entering Passive Mode (127,0,0,1,$pasvport)\n150 Opening BINARY mode data connection for test.dat (9 bytes).\n",
+ "226 File send OK.\n",
+ "221 Goodbye.\n",
+ ]);
+ my $datapid = prepare_child($datasock, ["test.dat\n"], 0, 1);
+ set_default();
+ my $v = { negotiatetimeout => 3, login => 'ftp', passwd => 'ftppass' };
+ my $r = { server => {ip => '127.0.0.1', port => $port }, request => 'test.dat', receive => 'foo' , fail_counts => 0 };
+ my $got = check_ftp($v, $r);
+ is $got, $main::SERVICE_DOWN, 'check_ftp - receive error';
+ close_child($pid);
+ close_child($datapid);
+ close $sock;
+}
+{
+ my $port = 63334;
+ set_default();
+ my $v = {negotiatetimeout => 1, checkport => $port };
+ my $r = { server => {ip => '127.0.0.1', port => 10000 }, fail_counts => 0 };
+ my $got = check_ftp($v, $r);
+ is $got, $main::SERVICE_DOWN, 'check_ftp - connect error';
+}
+# test end
+#...............................................
+
+L7lib::comment_in();
+
+sub create_sock {
+ my $port = shift;
+ my $sock = IO::Socket::INET->new(
+ Listen => 5,
+ LocalAddr => 'localhost',
+ LocalPort => $port,
+ ReuseAddr => 1,
+ Proto => 'tcp');
+ return $sock;
+}
+sub prepare_child {
+ my $sock = shift;
+ my $res = shift;
+ my $sleep = shift;
+ my $pid = fork();
+ if ($pid == 0) {
+ my $s = $sock->accept;
+ if ($sleep) { sleep $sleep; }
+ my $read = 0;
+ for (@$res) {
+ if ($read) {
+ my $req = <$s>;
+ }
+ print $s $_;
+ $read = 1;
+ }
+ close $s;
+ exit;
+ }
+ return $pid;
+}
+sub close_child {
+ my $pid = shift;
+ kill 15, $pid;
+ waitpid $pid, 0;
+}
+sub set_default {
+}
+sub override {
+ *ld_log = \&__ld_log;
+ *get_status = \&__get_status;
+}
+sub __get_status {
+ return $main::SERVICE_UP;
+}
+sub __ld_log {
+}
--- /dev/null
+use strict;
+use warnings;
+no warnings qw(redefine once);
+use lib qw(t/lib lib);
+use subs qw(print);
+use Cwd;
+use L7lib;
+use Test::More tests => 6;
+use IO::Socket::INET;
+
+L7lib::chdir();
+L7lib::comment_out();
+require './l7directord';
+override();
+
+our $module_error = 0;
+eval { require Net::DNS::Resolver; };
+if ($@) {
+ $module_error = 1;
+}
+
+#...............................................
+# test start
+# - check_dns
+TODO: {
+ todo_skip q{Can't locate Net/DNS.pm in @INC}, 1 if $module_error;
+ todo_skip 'not implement dns response', 1;
+#SKIP: {
+ my $port = 63334;
+ my $sock = create_sock($port);
+ skip 'cannot create socket', 1 if !$sock;
+ my $pid = prepare_child($sock, []);
+ set_default();
+ my $v = { negotiatetimeout => 3 };
+ my $r = { server => {ip => '127.0.0.1', port => $port }, request => 'localhost', receive => '127.0.0.1' , fail_counts => 0 };
+local $main::DEBUG_LEVEL = 100;
+ my $got = check_dns($v, $r);
+ is $got, $main::SERVICE_UP, 'check_dns - A ok';
+ close_child($pid);
+ close $sock;
+}
+TODO: {
+ todo_skip q{Can't locate Net/DNS.pm in @INC}, 1 if $module_error;
+ todo_skip 'not implement dns response', 1;
+#SKIP: {
+ my $port = 63334;
+ my $sock = create_sock($port);
+ skip 'cannot create socket', 1 if !$sock;
+ my $pid = prepare_child($sock, []);
+ set_default();
+ my $v = { negotiatetimeout => 3, checkport => $port };
+ my $r = { server => {ip => '127.0.0.1', port => 10000}, request => 'localhost', receive => '127.0.0.1' , fail_counts => 0 };
+local $main::DEBUG_LEVEL = 100;
+ my $got = check_dns($v, $r);
+ is $got, $main::SERVICE_UP, 'check_dns - checkport A ok';
+ close_child($pid);
+ close $sock;
+}
+TODO: {
+ todo_skip q{Can't locate Net/DNS.pm in @INC}, 1 if $module_error;
+ todo_skip 'not implement dns response', 1;
+#SKIP: {
+ my $port = 63334;
+ my $sock = create_sock($port);
+ skip 'cannot create socket', 1 if !$sock;
+ my $pid = prepare_child($sock, []);
+ set_default();
+ my $v = {negotiatetimeout => 3};
+ my $r = { server => {ip => '127.0.0.1', port => $port}, request => '127.0.0.1', receive => 'localhost' , fail_counts => 0 };
+local $main::DEBUG_LEVEL = 100;
+ my $got = check_dns($v, $r);
+ is $got, $main::SERVICE_UP, 'check_dns - PTR ok';
+ close_child($pid);
+ close $sock;
+}
+SKIP: {
+ skip q{Can't locate Net/DNS.pm in @INC}, 1 if $module_error;
+ my $port = 63334;
+ my $sock = create_sock($port);
+ skip 'cannot create socket', 1 if !$sock;
+ my $pid = prepare_child($sock, [], 2);
+ set_default();
+ my $v = {negotiatetimeout => 1};
+ my $r = { server => {ip => '127.0.0.1', port => $port }, request => 'localhost', receive => '127.0.0.1' , fail_counts => 0 };
+ my $got = check_dns($v, $r);
+ is $got, $main::SERVICE_DOWN, 'check_dns - timeout';
+ close_child($pid);
+ close $sock;
+}
+TODO: {
+ todo_skip q{Can't locate Net/DNS.pm in @INC}, 1 if $module_error;
+ todo_skip 'not implement dns response', 1;
+#SKIP: {
+ my $port = 63334;
+ my $sock = create_sock($port);
+ skip 'cannot create socket', 1 if !$sock;
+ my $pid = prepare_child($sock, []);
+ set_default();
+ my $v = {negotiatetimeout => 1};
+ my $r = { server => {ip => '127.0.0.1', port => $port }, request => 'localhost', receive => '128.0.0.1' , fail_counts => 0 };
+local $main::DEBUG_LEVEL = 100;
+ my $got = check_dns($v, $r);
+ is $got, $main::SERVICE_DOWN, 'check_dns - A error';
+ close_child($pid);
+ close $sock;
+}
+SKIP: {
+ skip q{Can't locate Net/DNS.pm in @INC}, 1 if $module_error;
+ my $port = 63334;
+ set_default();
+ my $v = {negotiatetimeout => 1, checkport => $port };
+ my $r = { server => {ip => '127.0.0.1', port => 10000 }, fail_counts => 0 };
+ my $got = check_dns($v, $r);
+ is $got, $main::SERVICE_DOWN, 'check_dns - connect error';
+}
+# test end
+#...............................................
+
+L7lib::comment_in();
+
+sub create_sock {
+ my $port = shift;
+ my $sock = IO::Socket::INET->new(
+ LocalAddr => 'localhost',
+ LocalPort => $port,
+ ReuseAddr => 1,
+ Proto => 'udp');
+ return $sock;
+}
+sub prepare_child {
+ my $sock = shift;
+ my $res = shift;
+ my $sleep = shift;
+ my $pid = fork();
+ if ($pid == 0) {
+ if ($sleep) { sleep $sleep; }
+ for (@$res) {
+ my $req;
+ recv $sock, $req, 1500, 0;
+ send $sock, $_, 0;
+ }
+ exit;
+ }
+ return $pid;
+}
+sub close_child {
+ my $pid = shift;
+ kill 15, $pid;
+ waitpid $pid, 0;
+}
+sub set_default {
+}
+sub override {
+ *ld_log = \&__ld_log;
+ *get_status = \&__get_status;
+}
+sub __get_status {
+ return $main::SERVICE_UP;
+}
+sub __ld_log {
+}
--- /dev/null
+use strict;
+use warnings;
+no warnings qw(redefine once);
+use lib qw(t/lib lib);
+use subs qw(print);
+use Cwd;
+use L7lib;
+use Test::More tests => 2;
+use IO::Socket::INET;
+
+L7lib::chdir();
+L7lib::comment_out();
+require './l7directord';
+override();
+
+#...............................................
+# test start
+# - check_ping
+SKIP: {
+ skip 'icmp ping requires root privilege', 1 if $< != 0;
+ set_default();
+ my $v = { checktimeout => 3 };
+ my $r = { server => {ip => '127.0.0.1'} , fail_counts => 0 };
+ my $got = check_ping($v, $r);
+ is $got, $main::SERVICE_UP, 'check_ping - ping ok';
+}
+SKIP: {
+ skip 'icmp ping requires root privilege', 1 if $< != 0;
+ set_default();
+ my $v = { checktimeout => 1 };
+ my $r = { server => {ip => '128.0.0.1'} , fail_counts => 0 };
+ my $got = check_ping($v, $r);
+ is $got, $main::SERVICE_DOWN, 'check_ping - timeout';
+}
+# test end
+#...............................................
+
+L7lib::comment_in();
+
+sub set_default {
+}
+sub override {
+ *ld_log = \&__ld_log;
+ *get_status = \&__get_status;
+}
+sub __get_status {
+ return $main::SERVICE_UP;
+}
+sub __ld_log {
+}
--- /dev/null
+use strict;
+use warnings;
+no warnings qw(redefine once);
+use lib qw(t/lib lib);
+use subs qw(print);
+use Cwd;
+use L7lib;
+use Test::More tests => 3;
+use IO::Socket::INET;
+
+L7lib::chdir();
+L7lib::comment_out();
+require './l7directord';
+override();
+
+#...............................................
+# test start
+# - check_none
+{
+ set_default();
+ my $v = { checktimeout => 3 };
+ my $r = { server => {ip => '127.0.0.1'} , fail_counts => 0 };
+ my $got = check_none($v, $r);
+ is $got, $main::SERVICE_UP, 'check_none - ok';
+}
+# - check_off
+{
+ set_default();
+ my $v = { checktimeout => 3 };
+ my $r = { server => {ip => '127.0.0.1'} , fail_counts => 0 };
+ my $got = check_off($v, $r);
+ is $got, $main::SERVICE_DOWN, 'check_off - ok';
+}
+# - check_on
+{
+ set_default();
+ my $v = { checktimeout => 3 };
+ my $r = { server => {ip => '127.0.0.1'} , fail_counts => 0 };
+ my $got = check_on($v, $r);
+ is $got, $main::SERVICE_UP, 'check_on - ok';
+}
+# test end
+#...............................................
+
+L7lib::comment_in();
+
+sub set_default {
+}
+sub override {
+ *ld_log = \&__ld_log;
+}
+sub __ld_log {
+}
--- /dev/null
+use strict;
+use warnings;
+no warnings qw(redefine once);
+use lib qw(t/lib lib);
+use subs qw(print);
+use Cwd;
+use L7lib;
+use Test::More tests => 21;
+
+L7lib::chdir();
+L7lib::comment_out();
+require './l7directord';
+override();
+
+our @get_health_check_id_str_args = ();
+our @get_health_check_id_str_returns = ();
+our @fallback_on_args = ();
+our @fallback_off_args = ();
+our @__restore_service_args = ();
+our @__remove_service_args = ();
+
+#...............................................
+# test start
+# - service_set
+# - _service_up
+# - _service_down
+# - _status_up
+# - _status_down
+# - get_status
+{
+ set_default();
+ my $v_r_list = undef;
+ my $state = undef;
+ service_set($v_r_list, $state);
+ pass 'service_set - state is undef';
+}
+{
+ set_default();
+ my $v_r_list = undef;
+ my $state = 'up';
+ service_set($v_r_list, $state);
+ pass 'service_set - v_r_list is undef(1)';
+}
+{
+ set_default();
+ my $v_r_list = undef;
+ my $state = 'down';
+ service_set($v_r_list, $state);
+ pass 'service_set - v_r_list is undef(2)';
+}
+{
+ local @get_health_check_id_str_args = ();
+ local @get_health_check_id_str_returns = ('id1');
+ set_default();
+ my $v_r_list = [ ['v', 'r'] ];
+ my $state = 'up';
+ local $main::HEALTH_CHECK{id1}{status} = $main::SERVICE_UP;
+ service_set($v_r_list, $state);
+ is_deeply \@get_health_check_id_str_args, [['v', 'r']], 'service_set - set up, but already up';
+}
+{
+ local @get_health_check_id_str_args = ();
+ local @get_health_check_id_str_returns = ('id2');
+ set_default();
+ my $v_r_list = [ ['v', 'r'] ];
+ my $state = 'down';
+ local $main::HEALTH_CHECK{id2}{status} = $main::SERVICE_DOWN;
+ service_set($v_r_list, $state);
+ is_deeply \@get_health_check_id_str_args, [['v', 'r']], 'service_set - set down, but already down';
+}
+{
+ local @get_health_check_id_str_args = ();
+ local @get_health_check_id_str_returns = ('id1', 'id1');
+ local @fallback_off_args = ();
+ local @__restore_service_args = ();
+ set_default();
+ my $v_r_list = [ ['v', 'r'] ];
+ my $state = 'up';
+ local $main::HEALTH_CHECK{id1}{status} = $main::SERVICE_DOWN;
+ service_set($v_r_list, $state);
+ is_deeply \@get_health_check_id_str_args, [['v', 'r'], ['v', 'r']], 'service_set - set up';
+ is_deeply \@fallback_off_args, ['v'], 'service_set - set up - fallback off args';
+ is_deeply \@__restore_service_args, ['v', 'r', 'real'], 'service_set - set up - restore service args';
+ is $main::HEALTH_CHECK{id1}{status}, $main::SERVICE_UP, 'service_set - status is changed to up';
+}
+{
+ local @get_health_check_id_str_args = ();
+ local @get_health_check_id_str_returns = ('id2', 'id2');
+ local @fallback_on_args = ();
+ local @__remove_service_args = ();
+ set_default();
+ my $v_r_list = [ ['v', 'r'] ];
+ my $state = 'down';
+ local $main::HEALTH_CHECK{id2}{status} = $main::SERVICE_UP;
+ service_set($v_r_list, $state);
+ is_deeply \@get_health_check_id_str_args, [['v', 'r'], ['v', 'r']], 'service_set - set down';
+ is_deeply \@fallback_on_args, ['v'], 'service_set - set up - fallback on args';
+ is_deeply \@__remove_service_args, ['v', 'r', 'real'], 'service_set - set up - remove service args';
+ is $main::HEALTH_CHECK{id2}{status}, $main::SERVICE_DOWN, 'service_set - status is changed to down';
+}
+{
+ local @get_health_check_id_str_args = ();
+ local @get_health_check_id_str_returns = ('id1', 'id1');
+ local @fallback_off_args = ();
+ local @__restore_service_args = ();
+ set_default();
+ my $v_r_list = [ ['v', 'r'] ];
+ my $state = 'up';
+ service_set($v_r_list, $state);
+ is_deeply \@get_health_check_id_str_args, [['v', 'r'], ['v', 'r']], 'service_set - set up, but not defined id';
+ is_deeply \@fallback_off_args, ['v'], 'service_set - set up - fallback off args';
+ is_deeply \@__restore_service_args, ['v', 'r', 'real'], 'service_set - set up - restore service args';
+ is $main::HEALTH_CHECK{id1}{status}, $main::SERVICE_UP, 'service_set - status is registerd as up';
+}
+{
+ local @get_health_check_id_str_args = ();
+ local @get_health_check_id_str_returns = ('id2', 'id2');
+ local @fallback_on_args = ();
+ local @__remove_service_args = ();
+ set_default();
+ my $v_r_list = [ ['v', 'r'] ];
+ my $state = 'down';
+ service_set($v_r_list, $state);
+ is_deeply \@get_health_check_id_str_args, [['v', 'r'], ['v', 'r']], 'service_set - set down, but not defined id';
+ is_deeply \@fallback_on_args, ['v'], 'service_set - set up - fallback on args';
+ is_deeply \@__remove_service_args, ['v', 'r', 'real'], 'service_set - set up - remove service args';
+ is $main::HEALTH_CHECK{id2}{status}, $main::SERVICE_DOWN, 'service_set - status is registerd as down';
+}
+# test end
+#...............................................
+
+L7lib::comment_in();
+
+sub set_default {
+}
+sub override {
+ *ld_log = \&__ld_log;
+ *get_health_check_id_str = \&__get_health_check_id_str;
+ *fallback_on = \&__fallback_on;
+ *fallback_off = \&__fallback_off;
+ *_restore_service = \&___restore_service;
+ *_remove_service = \&___remove_service;
+}
+sub __get_health_check_id_str {
+ push @get_health_check_id_str_args, [@_];
+ return shift @get_health_check_id_str_returns;
+}
+sub __fallback_on {
+ push @fallback_on_args, @_;
+}
+sub __fallback_off {
+ push @fallback_off_args, @_;
+}
+sub ___restore_service {
+ push @__restore_service_args, @_;
+}
+sub ___remove_service {
+ push @__remove_service_args, @_;
+}
+sub __ld_log {
+}
--- /dev/null
+use strict;
+use warnings;
+no warnings qw(redefine once);
+use lib qw(t/lib lib);
+use subs qw(print);
+use Cwd;
+use L7lib;
+use Test::More tests => 10;
+
+L7lib::chdir();
+L7lib::comment_out();
+require './l7directord';
+override();
+
+our @_status_up_args = ();
+our @_status_up_returns = ();
+our @_status_down_args = ();
+our @_status_down_returns = ();
+our @__restore_service_args = ();
+our @__remove_service_args = ();
+
+#...............................................
+# test start
+# - fallback_on
+# - fallback_off
+# - fallback_find
+{
+ set_default();
+ my $v = undef;
+ fallback_on($v);
+ pass 'fallback_on - v is undef';
+}
+{
+ set_default();
+ my $v = undef;
+ fallback_off($v);
+ pass 'fallback_off - v is undef';
+}
+{
+ set_default();
+ local @_status_up_args = ();
+ local @_status_up_returns = (1);
+ local @__restore_service_args = ();
+ my $v = { fallback => { tcp => 'r' } };
+ fallback_on($v);
+ is_deeply \@_status_up_args, [[[$v, 'r']], 'fallback'], 'fallback_on - status change to up';
+ is_deeply \@__restore_service_args, [$v, 'r', 'fallback'], 'fallback_on - restore service args';
+}
+{
+ set_default();
+ local @_status_down_args = ();
+ local @_status_down_returns = (1);
+ local @__remove_service_args = ();
+ my $v = { fallback => { tcp => 'r' } };
+ fallback_off($v);
+ is_deeply \@_status_down_args, [[[$v, 'r']], 'fallback'], 'fallback_off - status change to down';
+ is_deeply \@__remove_service_args, [$v, 'r', 'fallback'], 'fallback_off - remove service args';
+}
+{
+ set_default();
+ local @_status_up_args = ();
+ local @_status_up_returns = (0);
+ local @__restore_service_args = ();
+ my $v = { fallback => { tcp => 'r' } };
+ fallback_on($v);
+ is_deeply \@_status_up_args, [[[$v, 'r']], 'fallback'], 'fallback_on - status is not changed';
+ is_deeply \@__restore_service_args, [], 'fallback_on - restore service no args';
+}
+{
+ set_default();
+ local @_status_down_args = ();
+ local @_status_down_returns = (0);
+ local @__remove_service_args = ();
+ my $v = { fallback => { tcp => 'r' } };
+ fallback_off($v);
+ is_deeply \@_status_down_args, [[[$v, 'r']], 'fallback'], 'fallback_off - status is not changed';
+ is_deeply \@__remove_service_args, [], 'fallback_off - remove service no args';
+}
+# test end
+#...............................................
+
+L7lib::comment_in();
+
+sub set_default {
+}
+sub override {
+ *ld_log = \&__ld_log;
+ *_status_up = \&___status_up;
+ *_status_down = \&___status_down;
+ *_restore_service = \&___restore_service;
+ *_remove_service = \&___remove_service;
+}
+sub ___status_up {
+ push @_status_up_args, @_;
+ return shift @_status_up_returns;
+}
+sub ___status_down {
+ push @_status_down_args, @_;
+ return shift @_status_down_returns;
+}
+sub ___restore_service {
+ push @__restore_service_args, @_;
+}
+sub ___remove_service {
+ push @__remove_service_args, @_;
+}
+sub __ld_log {
+}
--- /dev/null
+use strict;
+use warnings;
+no warnings qw(redefine once);
+use lib qw(t/lib lib);
+use subs qw(print);
+use Cwd;
+use L7lib;
+use Test::More tests => 41;
+
+L7lib::chdir();
+L7lib::comment_out();
+require './l7directord';
+override();
+
+#...............................................
+# test start
+# - get_ip_port
+{
+ my $host = undef;
+ my $checkport = undef;
+ my $got = get_ip_port($host, $checkport);
+ is $got, '', 'get_ip_port - host and checkport is undef';
+}
+{
+ my $host = { server => { ip => '127.0.0.1', port => undef } };
+ my $checkport = undef;
+ my $got = get_ip_port($host, $checkport);
+ is $got, '', 'get_ip_port - host port and checkport is undef';
+}
+{
+ my $host = { server => { ip => undef, port => undef } };
+ my $checkport = 100;
+ my $got = get_ip_port($host, $checkport);
+ is $got, '', 'get_ip_port - host ip is undef';
+}
+{
+ my $host = { server => { ip => '127.0.0.1', port => 80 } };
+ my $checkport = undef;
+ my $got = get_ip_port($host, $checkport);
+ is $got, '127.0.0.1:80', 'get_ip_port - get host ip and port';
+}
+{
+ my $host = { server => { ip => '127.0.0.1', port => 80 } };
+ my $checkport = 8080;
+ my $got = get_ip_port($host, $checkport);
+ is $got, '127.0.0.1:8080', 'get_ip_port - get host ip and checkport';
+}
+{
+ my $host = { server => { ip => '127.0.0.1', port => 0 } };
+ my $checkport = undef;
+ my $got = get_ip_port($host, $checkport);
+ is $got, '127.0.0.1:0', 'get_ip_port - get host ip and port zero';
+}
+# - get_health_check_id_str
+{
+ my $v = undef;
+ my $r = { server => {} };
+ my $got = get_health_check_id_str($v, $r);
+ is $got, undef, 'get_health_check_id_str - v is undef';
+}
+{
+ my $v = {};
+ my $r = undef;
+ my $got = get_health_check_id_str($v, $r);
+ is $got, undef, 'get_health_check_id_str - r is undef';
+}
+{
+ my $v = {};
+ my $r = {};
+ my $got = get_health_check_id_str($v, $r);
+ is $got, undef, 'get_health_check_id_str - r->{server} is undef';
+}
+{
+ my $v = {};
+ my $r = { server => {} };
+ my $got = get_health_check_id_str($v, $r);
+ is $got, '::::::::::::::::::', 'get_health_check_id_str - all args is ok(empty)';
+}
+{
+ my $v = {};
+ my $r = { server => { ip => 1 } };
+ my $got = get_health_check_id_str($v, $r);
+ is $got, '1::::::::::::::::::', 'get_health_check_id_str - set real ip';
+}
+{
+ my $v = {};
+ my $r = { server => { port => 1 } };
+ my $got = get_health_check_id_str($v, $r);
+ is $got, ':1:::::::::::::::::', 'get_health_check_id_str - set real port';
+}
+{
+ my $v = { checkport => 1 };
+ my $r = { server => {} };
+ my $got = get_health_check_id_str($v, $r);
+ is $got, ':1:::::::::::::::::', 'get_health_check_id_str - set checkport';
+}
+{
+ my $v = { checktype => 'connect' };
+ my $r = { server => {} };
+ my $got = get_health_check_id_str($v, $r);
+ is $got, '::connect::::::::::::::::', 'get_health_check_id_str - set checktype';
+}
+{
+ my $v = { service => 'http' };
+ my $r = { server => {} };
+ my $got = get_health_check_id_str($v, $r);
+ is $got, ':::http:::::::::::::::', 'get_health_check_id_str - set service';
+}
+{
+ my $v = { protocol => 'tcp' };
+ my $r = { server => {} };
+ my $got = get_health_check_id_str($v, $r);
+ is $got, '::::tcp::::::::::::::', 'get_health_check_id_str - set protocol';
+}
+{
+ my $v = { num_connects => 1 };
+ my $r = { server => {} };
+ my $got = get_health_check_id_str($v, $r);
+ is $got, ':::::1:::::::::::::', 'get_health_check_id_str - set num_connects';
+}
+{
+ my $v = {};
+ my $r = { server => {}, request => '/' };
+ my $got = get_health_check_id_str($v, $r);
+ is $got, '::::::/::::::::::::', 'get_health_check_id_str - set real request';
+}
+{
+ my $v = {};
+ my $r = { server => {}, receive => 'ok' };
+ my $got = get_health_check_id_str($v, $r);
+ is $got, ':::::::ok:::::::::::', 'get_health_check_id_str - set real receive';
+}
+{
+ my $v = { httpmethod => 'GET' };
+ my $r = { server => {} };
+ my $got = get_health_check_id_str($v, $r);
+ is $got, '::::::::GET::::::::::', 'get_health_check_id_str - set httpmethod';
+}
+{
+ my $v = { virtualhost => 'virtual' };
+ my $r = { server => {} };
+ my $got = get_health_check_id_str($v, $r);
+ is $got, ':::::::::virtual:::::::::', 'get_health_check_id_str - set virtualhost';
+}
+{
+ my $v = { login => 'ftp' };
+ my $r = { server => {} };
+ my $got = get_health_check_id_str($v, $r);
+ is $got, '::::::::::ftp::::::::', 'get_health_check_id_str - set login';
+}
+{
+ my $v = { passwd => 'ftp' };
+ my $r = { server => {} };
+ my $got = get_health_check_id_str($v, $r);
+ is $got, ':::::::::::ftp:::::::', 'get_health_check_id_str - set passwd';
+}
+{
+ my $v = { database => 'template' };
+ my $r = { server => {} };
+ my $got = get_health_check_id_str($v, $r);
+ is $got, '::::::::::::template::::::', 'get_health_check_id_str - set database';
+}
+{
+ my $v = { customcheck => '/bin/echo' };
+ my $r = { server => {} };
+ my $got = get_health_check_id_str($v, $r);
+ is $got, ':::::::::::::/bin/echo:::::', 'get_health_check_id_str - set customcheck';
+}
+{
+ my $v = { checkinterval => 1 };
+ my $r = { server => {} };
+ my $got = get_health_check_id_str($v, $r);
+ is $got, '::::::::::::::1::::', 'get_health_check_id_str - set checkinterval';
+}
+{
+ my $v = { checkcount => 1 };
+ my $r = { server => {} };
+ my $got = get_health_check_id_str($v, $r);
+ is $got, ':::::::::::::::1:::', 'get_health_check_id_str - set checkcount';
+}
+{
+ my $v = { checktimeout => 1 };
+ my $r = { server => {} };
+ my $got = get_health_check_id_str($v, $r);
+ is $got, '::::::::::::::::1::', 'get_health_check_id_str - set checktimeout';
+}
+{
+ my $v = { negotiatetimeout => 1 };
+ my $r = { server => {} };
+ my $got = get_health_check_id_str($v, $r);
+ is $got, ':::::::::::::::::1:', 'get_health_check_id_str - set negotiatetimeout';
+}
+{
+ my $v = { retryinterval => 1 };
+ my $r = { server => {} };
+ my $got = get_health_check_id_str($v, $r);
+ is $got, '::::::::::::::::::1', 'get_health_check_id_str - set retryinterval';
+}
+{
+ my $v = {
+ checkport => 10,
+ checktype => 'connect',
+ service => 'http',
+ protocol => 'tcp',
+ num_connects => 2,
+ httpmethod => 'GET',
+ virtualhost => 'virtual',
+ login => 'ftp',
+ passwd => 'ftp',
+ database => 'template',
+ customcheck => '/bin/echo',
+ checkinterval => 3,
+ checkcount => 4,
+ checktimeout => 5,
+ negotiatetimeout => 6,
+ retryinterval => 7,
+ };
+ my $r = {
+ server => { ip => 1, port => 1 },
+ request => '/',
+ receive => 'ok',
+ };
+ my $got = get_health_check_id_str($v, $r);
+ is $got, '1:10:connect:http:tcp:2:/:ok:GET:virtual:ftp:ftp:template:/bin/echo:3:4:5:6:7',
+ 'get_health_check_id_str - set all';
+}
+# - get_virtual_id_str
+{
+ my $v = undef;
+ my $got = get_virtual_id_str($v);
+ is $got, undef, 'get_virtual_id_str - v is undef';
+}
+{
+ my $v = {};
+ my $got = get_virtual_id_str($v);
+ is $got, undef, 'get_virtual_id_str - v->{module} is undef';
+}
+{
+ my $v = { module => {} };
+ my $got = get_virtual_id_str($v);
+ is $got, '::', 'get_virtual_id_str - arg is ok(empty)';
+}
+{
+ my $v = { module => {}, protocol => 'tcp' };
+ my $got = get_virtual_id_str($v);
+ is $got, 'tcp::', 'get_virtual_id_str - set protocol';
+}
+{
+ my $v = { module => {}, server => { ip => '127.0.0.1', port => 80 } };
+ my $got = get_virtual_id_str($v);
+ is $got, ':127.0.0.1:80:', 'get_virtual_id_str - set server';
+}
+{
+ my $v = { module => { name => 'cinsert', key => '--cookie-name monkey' } };
+ my $got = get_virtual_id_str($v);
+ is $got, '::cinsert --cookie-name monkey', 'get_virtual_id_str - set module';
+}
+{
+ my $v = {
+ server => { ip => '127.0.0.1', port => 80 },
+ module => { name => 'cinsert', key => '--cookie-name monkey' },
+ protocol => 'tcp',
+ };
+ my $got = get_virtual_id_str($v);
+ is $got, 'tcp:127.0.0.1:80:cinsert --cookie-name monkey', 'get_virtual_id_str - set all';
+}
+# - get_forward_flag
+{
+ my $got = get_forward_flag();
+ is $got, '', 'get_forward_flag - forward is undef';
+}
+{
+ my $got = get_forward_flag('MAsq');
+ is $got, '-m', 'get_forward_flag - forward is masq';
+}
+{
+ my $got = get_forward_flag('MAsqs');
+ is $got, '', 'get_forward_flag - forward is otherwise';
+}
+# test end
+#...............................................
+
+L7lib::comment_in();
+
+sub set_default {
+}
+sub override {
+ *ld_log = \&__ld_log;
+}
+sub __ld_log {
+}
--- /dev/null
+use strict;
+use warnings;
+no warnings qw(redefine once);
+use lib qw(t/lib lib);
+use subs qw(print);
+use Cwd;
+use L7lib;
+use Test::More tests => 33;
+use Config;
+
+L7lib::chdir();
+L7lib::comment_out();
+require './l7directord';
+override();
+
+close *STDOUT;
+open *STDOUT, '>', '/dev/null';
+close *STDERR;
+open *STDERR, '>', '/dev/null';
+
+#...............................................
+# test start
+# - command_wrapper
+{
+ my @got = command_wrapper();
+ is_deeply \@got, [$?, ''], 'command_wrapper - args is undef';
+}
+{
+ my @got = command_wrapper('ls');
+ is $got[0], 0, 'command_wrapper - ls is ok';
+ like $got[1], qr/Makefile.*l7directord.*t/s, 'command_wrapper - ls result';
+}
+{
+ my @got = command_wrapper('env LANG=C ls /proc/100000 2>&1');
+ if ( $Config{'use64bitint'} ) {
+ is_deeply \@got, [512, "ls: /proc/100000: No such file or directory\n"], 'command_wrapper - ls /proc/100000(string) is ok';
+ }
+ else {
+ is_deeply \@got, [256, "ls: /proc/100000: No such file or directory\n"], 'command_wrapper - ls /proc/100000(string) is ok';
+ }
+}
+{
+ my @got = command_wrapper('/etc');
+ is_deeply \@got, [-1, undef], 'command_wrapper - no such command';
+}
+# - system_wrapper
+{
+ my $got = system_wrapper();
+ is $got, 65280, 'system_wrapper - args is undef';
+}
+{
+ my $got = system_wrapper('ls');
+ is $got, 0, 'system_wrapper - ls is ok';
+}
+{
+ my $got = system_wrapper('ls /proc/100000');
+ if ( $Config{'use64bitint'} ) {
+ is $got, 512, 'system_wrapper - ls /proc/100000(string) is ok';
+ }
+ else {
+ is $got, 256, 'system_wrapper - ls /proc/100000(string) is ok';
+ }
+}
+{
+ my $got = system_wrapper('ls', '/proc/100000');
+ if ( $Config{'use64bitint'} ) {
+ is $got, 512, 'system_wrapper - ls /proc/100000(array) is ok';
+ }
+ else {
+ is $got, 256, 'system_wrapper - ls /proc/100000(array) is ok';
+ }
+}
+{
+ my $got = system_wrapper('/etc');
+ is $got, -1, 'system_wrapper - no such command';
+}
+# - exec_wrapper
+{
+ my $got = exec_wrapper();
+ is $got, 0, 'exec_wrapper - args is undef';
+}
+{
+ my $got = exec_wrapper('/etc');
+ is $got, 0, 'exec_wrapper - no such command';
+}
+# - ld_gethostbyname
+{
+ my $got = ld_gethostbyname();
+ is $got, undef, 'ld_gethostbyname - name is undef';
+}
+{
+ my $got = ld_gethostbyname('localhost');
+ is $got, '127.0.0.1', 'ld_gethostbyname - resolve localhost';
+}
+{
+ my $got = ld_gethostbyname('0.0.0.0');
+ is $got, '0.0.0.0', 'ld_gethostbyname - already resolved';
+}
+{
+ my $got = ld_gethostbyname('any host name');
+ is $got, undef, 'ld_gethostbyname - cannot resolve';
+}
+# - ld_getservbyname
+{
+ my $name = undef;
+ my $protocol = 'tcp';
+ my $got = ld_getservbyname($name, $protocol);
+ is $got, undef, 'ld_getservbyname - name is undef';
+}
+{
+ my $name = 'www';
+ my $protocol = undef;
+ my $got = ld_getservbyname($name, $protocol);
+ is $got, 80, 'ld_getservbyname - protocol is undef';
+}
+{
+ my $name = 0;
+ my $protocol = 'tcp';
+ my $got = ld_getservbyname($name, $protocol);
+ is $got, 0, 'ld_getservbyname - name is 0(min)';
+}
+{
+ my $name = 65535;
+ my $protocol = 'tcp';
+ my $got = ld_getservbyname($name, $protocol);
+ is $got, 65535, 'ld_getservbyname - name is 65535(max)';
+}
+{
+ my $name = 65536;
+ my $protocol = 'tcp';
+ my $got = ld_getservbyname($name, $protocol);
+ is $got, undef, 'ld_getservbyname - name is 65536(error)';
+}
+{
+ my $name = 'foobar';
+ my $protocol = 'tcp';
+ my $got = ld_getservbyname($name, $protocol);
+ is $got, undef, 'ld_getservbyname - no such service name';
+}
+{
+ my $name = 'www';
+ my $protocol = 'foo';
+ my $got = ld_getservbyname($name, $protocol);
+ is $got, undef, 'ld_getservbyname - no such protocol name';
+}
+{
+ my $name = 'www';
+ my $protocol = 'tcp';
+ my $got = ld_getservbyname($name, $protocol);
+ is $got, 80, 'ld_getservbyname - resolve www tcp';
+}
+{
+ my $name = 'www';
+ my $protocol = 'udp';
+ my $got = ld_getservbyname($name, $protocol);
+ is $got, 80, 'ld_getservbyname - resolve www udp';
+}
+# - ld_getservhostbyname
+{
+ my $hostserv = 'localhost:www';
+ my $protocol = 'tcp';
+ my $got = ld_gethostservbyname($hostserv, $protocol);
+ is_deeply $got, { ip => '127.0.0.1', port => 80 }, 'ld_getservhostbyname - resolve localhost:www tcp';
+}
+{
+ my $hostserv = 'localhost:www';
+ my $protocol = 'udp';
+ my $got = ld_gethostservbyname($hostserv, $protocol);
+ is_deeply $got, { ip => '127.0.0.1', port => 80 }, 'ld_getservhostbyname - resolve localhost:www udp';
+}
+{
+ my $hostserv = 'localhost:www';
+ my $protocol = undef;
+ my $got = ld_gethostservbyname($hostserv, $protocol);
+ is_deeply $got, { ip => '127.0.0.1', port => 80 }, 'ld_getservhostbyname - protocol is undef';
+}
+{
+ my $hostserv = 'localhost:www';
+ my $protocol = 'foo';
+ my $got = ld_gethostservbyname($hostserv, $protocol);
+ is $got, undef, 'ld_getservhostbyname - no such protocol';
+}
+{
+ my $hostserv = 'foo-bar-host:www';
+ my $protocol = 'tcp';
+ my $got = ld_gethostservbyname($hostserv, $protocol);
+ is $got, undef, 'ld_getservhostbyname - invalid host address';
+}
+{
+ my $hostserv = 'localhost:foobar';
+ my $protocol = 'tcp';
+ my $got = ld_gethostservbyname($hostserv, $protocol);
+ is $got, undef, 'ld_getservhostbyname - invalid service name';
+}
+{
+ my $hostserv = undef;
+ my $protocol = 'tcp';
+ my $got = ld_gethostservbyname($hostserv, $protocol);
+ is $got, undef, 'ld_getservhostbyname - hostserv is undef';
+}
+{
+ my $hostserv = 'localhost';
+ my $protocol = 'tcp';
+ my $got = ld_gethostservbyname($hostserv, $protocol);
+ is $got, undef, 'ld_getservhostbyname - hostserv is invalid format';
+}
+# test end
+#...............................................
+
+L7lib::comment_in();
+
+sub set_default {
+}
+sub override {
+ *ld_log = \&__ld_log;
+}
+sub __ld_log {
+}
--- /dev/null
+use strict;
+use warnings;
+no warnings qw(redefine once);
+use lib qw(t/lib lib);
+use subs qw(print);
+use Cwd;
+use L7lib;
+use Test::More tests => 27;
+
+L7lib::chdir();
+L7lib::comment_out();
+require './l7directord';
+override();
+
+our $get_virtual_id_str_arg = undef;
+our $get_virtual_id_str_return = undef;
+our $ld_read_l7vsadm_return = undef;
+our $ld_add_real_arg = ();
+our $ld_edit_real_arg = ();
+our $ld_delete_real_arg = ();
+our $system_wrapper_arg = ();
+
+#...............................................
+# test start
+# - _remove_service
+{
+ set_default();
+ my $v = undef;
+ my $r = undef;
+ my $tag = undef;
+ _remove_service($v, $r, $tag);
+ pass '_remove_service - args is undef';
+}
+{
+ set_default();
+ my $v = {};
+ my $r = {};
+ my $tag = undef;
+ local $get_virtual_id_str_return = 'vipid';
+ local $ld_read_l7vsadm_return = {};
+ _remove_service($v, $r, $tag);
+ pass '_remove_service - not exist vip id in l7vsadm';
+}
+{
+ set_default();
+ my $v = { quiescent => 0, module => { name => 'cinsert', key => '' } };
+ my $r = { server => { ip => '127.0.0.1', port => 80 } };
+ my $tag = undef;
+ local $get_virtual_id_str_return = 'vipid';
+ local $ld_read_l7vsadm_return = { vipid => {} };
+ _remove_service($v, $r, $tag);
+ pass '_remove_service - not quiescent and not exist real';
+}
+{
+ set_default();
+ my $v = { quiescent => 1, module => { name => 'cinsert', key => '' } };
+ my $r = { server => { ip => '127.0.0.1', port => 80 }, option => { forward => '-m' } };
+ my $tag = undef;
+ local $get_virtual_id_str_return = 'vipid';
+ local $ld_read_l7vsadm_return = { vipid => { '127.0.0.1:80' => { weight => 0, option => { forward => '-m' } } } };
+ _remove_service($v, $r, $tag);
+ pass '_remove_service - quiescent and exist real and weight 0, same forward mode';
+}
+{
+ set_default();
+ my $v = { quiescent => 1, module => { name => 'cinsert', key => '' } };
+ my $r = { server => { ip => '127.0.0.1', port => 80 }, option => { forward => '-m' } };
+ my $tag = undef;
+ local $get_virtual_id_str_return = 'vipid';
+ local $ld_read_l7vsadm_return = { vipid => { '127.0.0.1:80' => { weight => 1, option => { forward => '-m' } } } };
+ _remove_service($v, $r, $tag);
+ is_deeply $ld_edit_real_arg, [$v, $r, 0], '_remove_service - quiescent and exist real, no realdowncallback';
+}
+{
+ set_default();
+ my $v = { quiescent => 1, realdowncallback => '/bin/sh', module => { name => 'cinsert', key => '' } };
+ my $r = { server => { ip => '127.0.0.1', port => 80 }, option => { forward => '-m' } };
+ my $tag = undef;
+ local $get_virtual_id_str_return = 'vipid';
+ local $ld_read_l7vsadm_return = { vipid => { '127.0.0.1:80' => { weight => 1, option => { forward => '-m' } } } };
+ _remove_service($v, $r, $tag);
+ is_deeply $ld_edit_real_arg, [$v, $r, 0], '_remove_service - quiescent and exist real, realdowncallback, first healthcheck';
+}
+{
+ set_default();
+ my $v = { quiescent => 1, realdowncallback => '/bin/sh', module => { name => 'cinsert', key => '' } };
+ my $r = { server => { ip => '127.0.0.1', port => 80 }, option => { forward => '-m' }, healthchecked => 1 };
+ my $tag = undef;
+ local $get_virtual_id_str_return = 'vipid';
+ local $ld_read_l7vsadm_return = { vipid => { '127.0.0.1:80' => { weight => 1, option => { forward => '-m' } } } };
+ _remove_service($v, $r, $tag);
+ is_deeply $ld_edit_real_arg, [$v, $r, 0], '_remove_service - quiescent and exist real, realdowncallback, not first healthcheck';
+ is_deeply $system_wrapper_arg, ['/bin/sh', '127.0.0.1:80'], '_remove_service - run realdowncallback';
+}
+{
+ set_default();
+ my $v = { quiescent => 1, module => { name => 'cinsert', key => '' } };
+ my $r = { server => { ip => '127.0.0.1', port => 80 }, option => { forward => '-m' } };
+ my $tag = undef;
+ local $get_virtual_id_str_return = 'vipid';
+ local $ld_read_l7vsadm_return = { vipid => {} };
+ _remove_service($v, $r, $tag);
+ is_deeply $ld_add_real_arg, [$v, $r, 0], '_remove_service - quiescent and not exist real, no realdowncallback';
+}
+{
+ set_default();
+ my $v = { quiescent => 1, realdowncallback => '/bin/sh', module => { name => 'cinsert', key => '' } };
+ my $r = { server => { ip => '127.0.0.1', port => 80 }, option => { forward => '-m' } };
+ my $tag = undef;
+ local $get_virtual_id_str_return = 'vipid';
+ local $ld_read_l7vsadm_return = { vipid => {} };
+ _remove_service($v, $r, $tag);
+ is_deeply $ld_add_real_arg, [$v, $r, 0], '_remove_service - quiescent and not exist real, realdowncallback, first healthcheck';
+}
+{
+ set_default();
+ my $v = { quiescent => 1, realdowncallback => '/bin/sh', module => { name => 'cinsert', key => '' } };
+ my $r = { server => { ip => '127.0.0.1', port => 80 }, option => { forward => '-m' }, healthchecked => 1 };
+ my $tag = undef;
+ local $get_virtual_id_str_return = 'vipid';
+ local $ld_read_l7vsadm_return = { vipid => {} };
+ _remove_service($v, $r, $tag);
+ is_deeply $ld_add_real_arg, [$v, $r, 0], '_remove_service - quiescent and not exist real, realdowncallback, not first healthcheck';
+ is_deeply $system_wrapper_arg, ['/bin/sh', '127.0.0.1:80'], '_remove_service - run realdowncallback';
+}
+{
+ set_default();
+ my $v = { quiescent => 0, module => { name => 'cinsert', key => '' } };
+ my $r = { server => { ip => '127.0.0.1', port => 80 }, option => { forward => '-m' } };
+ my $tag = undef;
+ local $get_virtual_id_str_return = 'vipid';
+ local $ld_read_l7vsadm_return = { vipid => { '127.0.0.1:80' => { weight => 1, option => { forward => '-m' } } } };
+ _remove_service($v, $r, $tag);
+ is_deeply $ld_delete_real_arg, [$v, $r], '_remove_service - no quiescent and exist real, no realdowncallback';
+}
+{
+ set_default();
+ my $v = { quiescent => 0, realdowncallback => '/bin/sh', module => { name => 'cinsert', key => '' } };
+ my $r = { server => { ip => '127.0.0.1', port => 80 }, option => { forward => '-m' } };
+ my $tag = undef;
+ local $get_virtual_id_str_return = 'vipid';
+ local $ld_read_l7vsadm_return = { vipid => { '127.0.0.1:80' => { weight => 1, option => { forward => '-m' } } } };
+ _remove_service($v, $r, $tag);
+ is_deeply $ld_delete_real_arg, [$v, $r], '_remove_service - no quiescent and exist real, realdowncallback, first healthcheck';
+}
+{
+ set_default();
+ my $v = { quiescent => 0, realdowncallback => '/bin/sh', module => { name => 'cinsert', key => '' } };
+ my $r = { server => { ip => '127.0.0.1', port => 80 }, option => { forward => '-m' }, healthchecked => 1 };
+ my $tag = undef;
+ local $get_virtual_id_str_return = 'vipid';
+ local $ld_read_l7vsadm_return = { vipid => { '127.0.0.1:80' => { weight => 1, option => { forward => '-m' } } } };
+ _remove_service($v, $r, $tag);
+ is_deeply $ld_delete_real_arg, [$v, $r], '_remove_service - no quiescent and exist real, realdowncallback, not first healthcheck';
+ is_deeply $system_wrapper_arg, ['/bin/sh', '127.0.0.1:80'], '_remove_service - run realdowncallback';
+}
+# - _restore_service
+{
+ set_default();
+ my $v = undef;
+ my $r = undef;
+ my $tag = undef;
+ _restore_service($v, $r, $tag);
+ pass '_restore_service - args is undef';
+}
+{
+ set_default();
+ my $v = {};
+ my $r = {};
+ my $tag = undef;
+ local $get_virtual_id_str_return = 'vipid';
+ local $ld_read_l7vsadm_return = {};
+ _restore_service($v, $r, $tag);
+ pass '_restore_service - not exist vip id in l7vsadm';
+}
+{
+ set_default();
+ my $v = { module => { name => 'cinsert', key => '' } };
+ my $r = { server => { ip => '127.0.0.1', port => 80 }, weight => 1, option => { forward => '-m' } };
+ my $tag = undef;
+ local $get_virtual_id_str_return = 'vipid';
+ local $ld_read_l7vsadm_return = { vipid => { '127.0.0.1:80' => { weight => 1, option => { forward => '-m' } } } };
+ _restore_service($v, $r, $tag);
+ pass '_restore_service - exist real and same weight, same forward mode';
+}
+{
+ set_default();
+ my $v = { module => { name => 'cinsert', key => '' } };
+ my $r = { server => { ip => '127.0.0.1', port => 80 }, weight => 1, option => { forward => '-m' } };
+ my $tag = undef;
+ local $get_virtual_id_str_return = 'vipid';
+ local $ld_read_l7vsadm_return = { vipid => { '127.0.0.1:80' => { weight => 2, option => { forward => '-m' } } } };
+ _restore_service($v, $r, $tag);
+ is_deeply $ld_edit_real_arg, [$v, $r, 1], '_restore_service - change weight, no realrecovercallback';
+}
+{
+ set_default();
+ my $v = { module => { name => 'cinsert', key => '' }, realrecovercallback => '/bin/sh' };
+ my $r = { server => { ip => '127.0.0.1', port => 80 }, weight => 1, option => { forward => '-m' } };
+ my $tag = undef;
+ local $get_virtual_id_str_return = 'vipid';
+ local $ld_read_l7vsadm_return = { vipid => { '127.0.0.1:80' => { weight => 2, option => { forward => '-m' } } } };
+ _restore_service($v, $r, $tag);
+ is_deeply $ld_edit_real_arg, [$v, $r, 1], '_restore_service - change weight, realrecovercallback, first healthcheck';
+}
+{
+ set_default();
+ my $v = { module => { name => 'cinsert', key => '' }, realrecovercallback => '/bin/sh' };
+ my $r = { server => { ip => '127.0.0.1', port => 80 }, weight => 1, option => { forward => '-m' }, healthchecked => 1 };
+ my $tag = undef;
+ local $get_virtual_id_str_return = 'vipid';
+ local $ld_read_l7vsadm_return = { vipid => { '127.0.0.1:80' => { weight => 2, option => { forward => '-m' } } } };
+ _restore_service($v, $r, $tag);
+ is_deeply $ld_edit_real_arg, [$v, $r, 1], '_restore_service - change weight, realrecovercallback, not first healthcheck';
+ is_deeply $system_wrapper_arg, ['/bin/sh', '127.0.0.1:80'], '_restore_service - run realrecovercallback';
+}
+{
+ set_default();
+ my $v = { module => { name => 'cinsert', key => '' } };
+ my $r = { server => { ip => '127.0.0.1', port => 80 }, weight => 1, option => { forward => '-m' } };
+ my $tag = undef;
+ local $get_virtual_id_str_return = 'vipid';
+ local $ld_read_l7vsadm_return = { vipid => {} };
+ _restore_service($v, $r, $tag);
+ is_deeply $ld_add_real_arg, [$v, $r, 1], '_restore_service - add real, no realrecovercallback';
+}
+{
+ set_default();
+ my $v = { module => { name => 'cinsert', key => '' }, realrecovercallback => '/bin/sh' };
+ my $r = { server => { ip => '127.0.0.1', port => 80 }, weight => 1, option => { forward => '-m' } };
+ my $tag = undef;
+ local $get_virtual_id_str_return = 'vipid';
+ local $ld_read_l7vsadm_return = { vipid => {} };
+ _restore_service($v, $r, $tag);
+ is_deeply $ld_add_real_arg, [$v, $r, 1], '_restore_service - add real, realrecovercallback, first healthcheck';
+}
+{
+ set_default();
+ my $v = { module => { name => 'cinsert', key => '' }, realrecovercallback => '/bin/sh' };
+ my $r = { server => { ip => '127.0.0.1', port => 80 }, weight => 1, option => { forward => '-m' }, healthchecked => 1 };
+ my $tag = undef;
+ local $get_virtual_id_str_return = 'vipid';
+ local $ld_read_l7vsadm_return = { vipid => {} };
+ _restore_service($v, $r, $tag);
+ is_deeply $ld_add_real_arg, [$v, $r, 1], '_restore_service - add real, realrecovercallback, not first healthcheck';
+ is_deeply $system_wrapper_arg, ['/bin/sh', '127.0.0.1:80'], '_restore_service - run realrecovercallback';
+}
+# test end
+#...............................................
+
+L7lib::comment_in();
+
+sub set_default {
+ $get_virtual_id_str_arg = undef;
+ $get_virtual_id_str_return = undef;
+ $ld_read_l7vsadm_return = undef;
+ $ld_add_real_arg = ();
+ $ld_edit_real_arg = ();
+ $ld_delete_real_arg = ();
+ $system_wrapper_arg = ();
+}
+sub override {
+ *ld_log = \&__ld_log;
+ *get_virtual_id_str = \&__get_virtual_id_str;
+ *ld_read_l7vsadm = \&__ld_read_l7vsadm;
+ *ld_add_real = \&__ld_add_real;
+ *ld_edit_real = \&__ld_edit_real;
+ *ld_delete_real = \&__ld_delete_real;
+ *system_wrapper = \&__system_wrapper;
+}
+sub __get_virtual_id_str {
+ $get_virtual_id_str_arg = shift;
+ return $get_virtual_id_str_return;
+}
+sub __ld_read_l7vsadm {
+ return $ld_read_l7vsadm_return;
+}
+sub __ld_add_real {
+ $ld_add_real_arg = [@_];
+}
+sub __ld_edit_real {
+ $ld_edit_real_arg = [@_];
+}
+sub __ld_delete_real {
+ $ld_delete_real_arg = [@_];
+}
+sub __system_wrapper {
+ $system_wrapper_arg = [@_];
+}
+sub __ld_log {
+}
--- /dev/null
+use strict;
+use warnings;
+no warnings qw(redefine once);
+use lib qw(t/lib lib);
+use subs qw(exit print);
+use Cwd;
+use L7lib;
+use Test::More tests => 33;
+
+L7lib::chdir();
+L7lib::comment_out();
+require './l7directord';
+override();
+
+our $ld_log_called = 0;
+
+close *STDOUT;
+open *STDOUT, '>', '/dev/null';
+close *STDERR;
+open *STDERR, '>', '/dev/null';
+
+#...............................................
+# test start
+# - ld_openlog
+{
+ local *ld_log = \&__ld_log;
+ my $got = ld_openlog();
+ is $got, 1, 'ld_openlog - log_config is undef';
+}
+{
+ local *ld_log = \&__ld_log;
+ local $main::DEBUG_LEVEL = 1;
+ my $got = ld_openlog('logfile');
+ is $got, 0, 'ld_openlog - debug mode';
+}
+{
+ local *ld_log = \&__ld_log;
+ local $main::CONFIG{supervised} = 1;
+ my $got = ld_openlog('logfile');
+ is $got, 0, 'ld_openlog - supervised mode';
+}
+{
+ local *ld_log = \&__ld_log;
+ my $log_config = '/tmp/' . time;
+ my $got = ld_openlog($log_config);
+ is $got, 0, 'ld_openlog - open normal logfile';
+ unlink $log_config;
+}
+{
+ local *ld_log = \&__ld_log;
+ my $log_config = '/tmp';
+ my $got = ld_openlog($log_config);
+ is $got, 1, 'ld_openlog - cannot open normal logfile';
+}
+{
+ local *ld_log = \&__ld_log;
+ my $log_config = 'local0';
+ my $got = ld_openlog($log_config);
+ is $got, 0, 'ld_openlog - open syslog';
+}
+# - ld_log
+SKIP: {
+ skip 'aboid logging', 1;
+ my $got = ld_log();
+ is $got, 1, 'ld_log - message is undef';
+}
+{
+ local $main::PROC_STAT{pid} = 12345;
+ local $main::CONFIG{logfile} = '/tmp/' . time;
+ my $got = ld_log('test');
+ is $got, 0, 'ld_log - write message to logfile';
+ unlink $main::CONFIG{logfile};
+}
+{
+ local $main::PROC_STAT{pid} = 12345;
+ local $main::CONFIG{logfile} = '/tmp';
+ my $got = ld_log('test');
+ is $got, 1, 'ld_log - cannot write message to logfile';
+}
+{
+ local $main::PROC_STAT{pid} = 12345;
+ local $main::CONFIG{logfile} = 'local0';
+ my $got = ld_log('test');
+ is $got, 0, 'ld_log - write message to syslog';
+}
+{
+ local $main::CONFIG{supervised} = 1;
+ local $main::PROC_STAT{pid} = 12345;
+ local $main::CONFIG{logfile} = 'local0';
+ my $got = ld_log('test');
+ is $got, 0, 'ld_log - write message to stderr(supervised mode)';
+}
+# - ld_debug
+{
+ local *ld_log = \&__ld_log;
+ ld_debug();
+ pass 'ld_debug - args is undef';
+}
+{
+ local *ld_log = \&__ld_log;
+ ld_debug(undef, 'test');
+ pass 'ld_debug - priority is undef';
+}
+{
+ local *ld_log = \&__ld_log;
+ ld_debug('fatal', 'test');
+ pass 'ld_debug - priority is string';
+}
+{
+ local *ld_log = \&__ld_log;
+ ld_debug(3, undef);
+ pass 'ld_debug - message is undef';
+}
+{
+ local *ld_log = \&__ld_log;
+ local $main::DEBUG_LEVEL = 10;
+ ld_debug(3, 'debug');
+ pass 'ld_debug - priority and message is ok';
+}
+# - ld_exit
+{
+ local *ld_log = \&__ld_log;
+ local $main::DEBUG_LEVEL = 0;
+ local $ld_log_called = 0;
+ ld_exit();
+ is $ld_log_called, 0, 'ld_exit - args is undef';
+}
+{
+ local *ld_log = \&__ld_log;
+ local $main::DEBUG_LEVEL = 0;
+ local $ld_log_called = 0;
+ ld_exit(undef, 'exit');
+ is $ld_log_called, 0, 'ld_exit - status is undef';
+}
+{
+ local *ld_log = \&__ld_log;
+ local $main::DEBUG_LEVEL = 0;
+ local $ld_log_called = 0;
+ ld_exit(1, undef);
+ is $ld_log_called, 0, 'ld_exit - message is undef';
+}
+{
+ local *ld_log = \&__ld_log;
+ local $main::DEBUG_LEVEL = 0;
+ local $ld_log_called = 0;
+ ld_exit(0, 'exit');
+ is $ld_log_called, 1, 'ld_exit - status is 0 (normal exit)';
+}
+{
+ local *ld_log = \&__ld_log;
+ local $main::DEBUG_LEVEL = 3;
+ local $ld_log_called = 0;
+ ld_exit(0, 'exit');
+ is $ld_log_called, 1, 'ld_exit - debug enable';
+}
+{
+ local *ld_log = \&__ld_log;
+ local $main::DEBUG_LEVEL = 0;
+ local $ld_log_called = 0;
+ ld_exit(1, 'exit');
+ is $ld_log_called, 1, 'ld_exit - status is 1 (some error)';
+}
+# - init_error
+{
+ local *ld_log = \&__ld_log;
+ local *ld_exit = \&__ld_exit;
+ local $main::DEBUG_LEVEL = 0;
+ local $ld_log_called = 0;
+ init_error();
+ is $ld_log_called, 0, 'init_error - message is undef';
+}
+{
+ local *ld_log = \&__ld_log;
+ local *ld_exit = \&__ld_exit;
+ local $main::DEBUG_LEVEL = 0;
+ local $ld_log_called = 0;
+ init_error('init error');
+ is $ld_log_called, 1, 'init_error - no debug';
+}
+{
+ local *ld_log = \&__ld_log;
+ local *ld_exit = \&__ld_exit;
+ local $main::DEBUG_LEVEL = 1;
+ local $ld_log_called = 0;
+ init_error('init error');
+ is $ld_log_called, 1, 'init_error - debug mode';
+}
+# - config_error
+{
+ local *ld_log = \&__ld_log;
+ local *ld_exit = \&__ld_exit;
+ local $main::CONFIG_FILE{path} = 'filepath';
+ local $main::PROC_STAT{initialized} = 1;
+ local $main::DEBUG_LEVEL = 1;
+ local $ld_log_called = 0;
+ eval { config_error(1, 'WRN0004'); };
+ is $ld_log_called, 0, 'config_error - debug mode';
+ ok $@, 'config_error - initialized and died';
+}
+{
+ local *ld_log = \&__ld_log;
+ local *ld_exit = \&__ld_exit;
+ local $main::CONFIG_FILE{path} = 'filepath';
+ local $main::PROC_STAT{initialized} = 0;
+ local $main::DEBUG_LEVEL = 1;
+ local $ld_log_called = 0;
+ eval { config_error(1, 'WRN0004'); };
+ is $ld_log_called, 0, 'config_error - debug mode';
+ is $@, '', 'config_error - not initialized exit';
+}
+{
+ local *ld_log = \&__ld_log;
+ local *ld_exit = \&__ld_exit;
+ local $main::CONFIG_FILE{path} = 'filepath';
+ local $main::PROC_STAT{initialized} = 1;
+ local $main::DEBUG_LEVEL = 0;
+ local $ld_log_called = 0;
+ eval { config_error(0, 'WRN0004'); };
+ is $ld_log_called, 1, 'config_error - no debug mode and line is 0';
+ ok $@, 'config_error - initialized and died';
+}
+{
+ local *ld_log = \&__ld_log;
+ local *ld_exit = \&__ld_exit;
+ local $main::CONFIG_FILE{path} = 'filepath';
+ local $main::PROC_STAT{initialized} = 1;
+ local $main::DEBUG_LEVEL = 0;
+ local $ld_log_called = 0;
+ eval { config_error(1, 'WRN0004'); };
+ is $ld_log_called, 2, 'config_error - no debug mode and line is 1';
+ ok $@, 'config_error - initialized and died';
+}
+# test end
+#...............................................
+
+L7lib::comment_in();
+
+sub set_default {
+}
+sub override {
+ *exit = \&__exit;
+}
+sub __exit {
+}
+sub __ld_exit {
+}
+sub __ld_log {
+ $ld_log_called++;
+}
--- /dev/null
+#!/usr/bin/perl
+package L7lib;
+use strict;
+use warnings;
+use Cwd;
+
+sub chdir {
+ my $pwd = cwd;
+ if ($pwd =~ m{/t$}) {
+ chdir '..';
+ }
+ if ($pwd =~ m{/t/lib$}) {
+ chdir '../..';
+ }
+}
+
+sub comment_in {
+ replace( qr{^#main}, q{main} );
+}
+
+sub comment_out {
+ replace( qr{^main}, q{#main} );
+}
+
+sub replace {
+ my ($before, $after) = @_;
+
+ my $file = -f 'l7directord' ? 'l7directord'
+ : -f '../l7directord' ? '../l7directord'
+ : die 'l7directord not found'
+ ;
+ local $/ = undef;
+ open my $f, '+<', $file or die $!;
+ flock $f, 2;
+ my $org = <$f>;
+ $org =~ s{$before}{$after}m;
+ seek $f, 0, 0;
+ print $f $org;
+ truncate $f, tell $f;
+ close $f;
+}
+1;
--- /dev/null
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+print <<"L7VSADM";
+Layer-7 Virtual Server version 2.0.0-1
+Prot LocalAddress:Port ProtoMod Scheduler Reschedule Protomod_key_string
+ -> RemoteAddress:Port Forward Weight ActiveConn InactConn
+L7VSADM
--- /dev/null
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+print <<"L7VSADM";
+Layer-7 Virtual Server version 2.0.0-1
+Prot LocalAddress:Port ProtoMod Scheduler Reschedule Protomod_key_string
+ -> RemoteAddress:Port Forward Weight ActiveConn InactConn
+TCP 127.0.0.1:80 sessionless rr 1
+L7VSADM
--- /dev/null
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+print <<"L7VSADM";
+Layer-7 Virtual Server version 2.0.0-1
+Prot LocalAddress:Port ProtoMod Scheduler Reschedule Protomod_key_string
+ -> RemoteAddress:Port Forward Weight ActiveConn InactConn
+TCP 127.0.0.1:80 cinsert rr 1 --cookie-name monkey
+ -> 192.168.0.1:8080 Masq 5 0 3
+L7VSADM
--- /dev/null
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+print <<"L7VSADM";
+Layer-7 Virtual Server version 2.0.0-1
+Prot LocalAddress:Port ProtoMod Scheduler Reschedule Protomod_key_string
+ -> RemoteAddress:Port Forward Weight ActiveConn InactConn
+TCP 127.0.0.1:80 url rr 1 --pattern-match monkey
+ -> 192.168.0.1:80 Masq 3 0 3
+ -> 192.168.0.2:80 Masq 2 0 3
+ -> 192.168.0.3:80 Masq 1 0 4
+L7VSADM
--- /dev/null
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+print <<"L7VSADM";
+Layer-7 Virtual Server version 2.0.0-1
+Prot LocalAddress:Port ProtoMod Scheduler Reschedule Protomod_key_string
+ -> RemoteAddress:Port Forward Weight ActiveConn InactConn
+TCP 127.0.0.1:80 sessionless rr 1
+TCP 192.168.0.1:8080 sslid rr 1
+TCP 192.168.0.100:10000 cinsert rr 1 --cookie-name monkey
+L7VSADM
--- /dev/null
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+print <<"L7VSADM";
+Layer-7 Virtual Server version 2.0.0-1
+Prot LocalAddress:Port ProtoMod Scheduler Reschedule Protomod_key_string
+ -> RemoteAddress:Port Forward Weight ActiveConn InactConn
+TCP 127.0.0.1:80 sessionless rr 1
+ -> 192.168.0.1:80 Masq 1 0 3
+ -> 192.168.0.2:80 Masq 1 0 3
+TCP 10.10.10.10:10 sslid rr 1
+TCP 20.20.20.20:20 url rr 1 --pattern-match monkey
+ -> 192.168.0.1:80 Masq 1 0 4
+L7VSADM
--- /dev/null
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+print <<"L7VSADM";
+Layer-7 Virtual Server version 2.0.0-1
+Prot LocalAddress:Port ProtoMod Scheduler Reschedule Protomod_key_string
+ -> RemoteAddress:Port Forward Weight ActiveConn InactConn
+ -> 127.0.0.1:80 Masq 1 0 3
+ -> 127.0.0.1:25 Masq 1 0 3
+ -> 127.0.0.1:8080 Masq 1 0 4
+L7VSADM
--- /dev/null
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+print <<"L7VSADM";
+Layer-7 Virtual Server version 2.0.0-1
+Prot LocalAddress:Port ProtoMod Scheduler Reschedule Protomod_key_string
+ -> RemoteAddress:Port Forward Weight ActiveConn InactConn
+ -> 127.0.0.1:80 Masq 1 0 3
+TCP 192.168.0.1:8080 sessionless rr 1
+ -> 192.168.0.2:80 Masq 1 0 4
+L7VSADM
--- /dev/null
+noinst_LIBRARIES= libl7vsd_logger.a libl7vsadm_logger.a libsnmpagent_logger.a
+AUTOMAKE_OPTIONS = foreign
+
+libl7vsd_logger_a_SOURCES = \
+ logger_enum.h \
+ logger.h \
+ logger_impl.h \
+ logger.cpp \
+ logger_impl.cpp \
+ strict_time_based_rolling_policy.h \
+ strict_time_based_rolling_policy.cpp \
+ time_and_size_based_rolling_policy.h \
+ time_and_size_based_rolling_policy.cpp
+
+libl7vsd_logger_a_CPPFLAGS = -O2 -g -I../include -I../snmpagent -I../parameter \
+ -DLOGGER_PROCESS_VSD \
+ -DVERSION=\"$(VERSION)\"
+
+libl7vsadm_logger_a_SOURCES = \
+ logger_enum.h \
+ logger.h \
+ logger_impl.h \
+ logger.cpp \
+ logger_impl.cpp \
+ strict_time_based_rolling_policy.h \
+ strict_time_based_rolling_policy.cpp \
+ time_and_size_based_rolling_policy.h \
+ time_and_size_based_rolling_policy.cpp
+
+libl7vsadm_logger_a_CPPFLAGS = -O2 -g -I../include -I../parameter \
+ -DLOGGER_PROCESS_ADM \
+ -DVERSION=\"$(VERSION)\"
+
+libsnmpagent_logger_a_SOURCES = \
+ logger_enum.h \
+ logger.h \
+ logger_impl.h \
+ logger.cpp \
+ logger_impl.cpp \
+ strict_time_based_rolling_policy.h \
+ strict_time_based_rolling_policy.cpp \
+ time_and_size_based_rolling_policy.h \
+ time_and_size_based_rolling_policy.cpp
+
+libsnmpagent_logger_a_CPPFLAGS = -O2 -g -I../include -I../parameter \
+ -DLOGGER_PROCESS_SNM \
+ -DVERSION=\"$(VERSION)\"
--- /dev/null
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = logger
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+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)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+LIBRARIES = $(noinst_LIBRARIES)
+ARFLAGS = cru
+libl7vsadm_logger_a_AR = $(AR) $(ARFLAGS)
+libl7vsadm_logger_a_LIBADD =
+am_libl7vsadm_logger_a_OBJECTS = libl7vsadm_logger_a-logger.$(OBJEXT) \
+ libl7vsadm_logger_a-logger_impl.$(OBJEXT) \
+ libl7vsadm_logger_a-strict_time_based_rolling_policy.$(OBJEXT) \
+ libl7vsadm_logger_a-time_and_size_based_rolling_policy.$(OBJEXT)
+libl7vsadm_logger_a_OBJECTS = $(am_libl7vsadm_logger_a_OBJECTS)
+libl7vsd_logger_a_AR = $(AR) $(ARFLAGS)
+libl7vsd_logger_a_LIBADD =
+am_libl7vsd_logger_a_OBJECTS = libl7vsd_logger_a-logger.$(OBJEXT) \
+ libl7vsd_logger_a-logger_impl.$(OBJEXT) \
+ libl7vsd_logger_a-strict_time_based_rolling_policy.$(OBJEXT) \
+ libl7vsd_logger_a-time_and_size_based_rolling_policy.$(OBJEXT)
+libl7vsd_logger_a_OBJECTS = $(am_libl7vsd_logger_a_OBJECTS)
+libsnmpagent_logger_a_AR = $(AR) $(ARFLAGS)
+libsnmpagent_logger_a_LIBADD =
+am_libsnmpagent_logger_a_OBJECTS = \
+ libsnmpagent_logger_a-logger.$(OBJEXT) \
+ libsnmpagent_logger_a-logger_impl.$(OBJEXT) \
+ libsnmpagent_logger_a-strict_time_based_rolling_policy.$(OBJEXT) \
+ libsnmpagent_logger_a-time_and_size_based_rolling_policy.$(OBJEXT)
+libsnmpagent_logger_a_OBJECTS = $(am_libsnmpagent_logger_a_OBJECTS)
+DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+LTCXXCOMPILE = $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) \
+ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+ $(AM_CXXFLAGS) $(CXXFLAGS)
+CXXLD = $(CXX)
+CXXLINK = $(LIBTOOL) --tag=CXX --mode=link $(CXXLD) $(AM_CXXFLAGS) \
+ $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \
+ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+ $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(AM_LDFLAGS) $(LDFLAGS) -o $@
+SOURCES = $(libl7vsadm_logger_a_SOURCES) $(libl7vsd_logger_a_SOURCES) \
+ $(libsnmpagent_logger_a_SOURCES)
+DIST_SOURCES = $(libl7vsadm_logger_a_SOURCES) \
+ $(libl7vsd_logger_a_SOURCES) $(libsnmpagent_logger_a_SOURCES)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+GLIB_CFLAGS = @GLIB_CFLAGS@
+GLIB_GENMARSHAL = @GLIB_GENMARSHAL@
+GLIB_LIBS = @GLIB_LIBS@
+GLIB_MKENUMS = @GLIB_MKENUMS@
+GOBJECT_QUERY = @GOBJECT_QUERY@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MANDIR = @MANDIR@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PKG_CONFIG = @PKG_CONFIG@
+RANLIB = @RANLIB@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+ac_ct_RANLIB = @ac_ct_RANLIB@
+ac_ct_STRIP = @ac_ct_STRIP@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+l7vs_maxvs = @l7vs_maxvs@
+l7vs_moddir = @l7vs_moddir@
+l7vsadm_sockdir = @l7vsadm_sockdir@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+snmpagent_libs = @snmpagent_libs@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+noinst_LIBRARIES = libl7vsd_logger.a libl7vsadm_logger.a libsnmpagent_logger.a
+AUTOMAKE_OPTIONS = foreign
+libl7vsd_logger_a_SOURCES = \
+ logger_enum.h \
+ logger.h \
+ logger_impl.h \
+ logger.cpp \
+ logger_impl.cpp \
+ strict_time_based_rolling_policy.h \
+ strict_time_based_rolling_policy.cpp \
+ time_and_size_based_rolling_policy.h \
+ time_and_size_based_rolling_policy.cpp
+
+libl7vsd_logger_a_CPPFLAGS = -O2 -g -I../include -I../snmpagent -I../parameter \
+ -DLOGGER_PROCESS_VSD \
+ -DVERSION=\"$(VERSION)\"
+
+libl7vsadm_logger_a_SOURCES = \
+ logger_enum.h \
+ logger.h \
+ logger_impl.h \
+ logger.cpp \
+ logger_impl.cpp \
+ strict_time_based_rolling_policy.h \
+ strict_time_based_rolling_policy.cpp \
+ time_and_size_based_rolling_policy.h \
+ time_and_size_based_rolling_policy.cpp
+
+libl7vsadm_logger_a_CPPFLAGS = -O2 -g -I../include -I../parameter \
+ -DLOGGER_PROCESS_ADM \
+ -DVERSION=\"$(VERSION)\"
+
+libsnmpagent_logger_a_SOURCES = \
+ logger_enum.h \
+ logger.h \
+ logger_impl.h \
+ logger.cpp \
+ logger_impl.cpp \
+ strict_time_based_rolling_policy.h \
+ strict_time_based_rolling_policy.cpp \
+ time_and_size_based_rolling_policy.h \
+ time_and_size_based_rolling_policy.cpp
+
+libsnmpagent_logger_a_CPPFLAGS = -O2 -g -I../include -I../parameter \
+ -DLOGGER_PROCESS_SNM \
+ -DVERSION=\"$(VERSION)\"
+
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .cpp .lo .o .obj
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign logger/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign logger/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+clean-noinstLIBRARIES:
+ -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
+libl7vsadm_logger.a: $(libl7vsadm_logger_a_OBJECTS) $(libl7vsadm_logger_a_DEPENDENCIES)
+ -rm -f libl7vsadm_logger.a
+ $(libl7vsadm_logger_a_AR) libl7vsadm_logger.a $(libl7vsadm_logger_a_OBJECTS) $(libl7vsadm_logger_a_LIBADD)
+ $(RANLIB) libl7vsadm_logger.a
+libl7vsd_logger.a: $(libl7vsd_logger_a_OBJECTS) $(libl7vsd_logger_a_DEPENDENCIES)
+ -rm -f libl7vsd_logger.a
+ $(libl7vsd_logger_a_AR) libl7vsd_logger.a $(libl7vsd_logger_a_OBJECTS) $(libl7vsd_logger_a_LIBADD)
+ $(RANLIB) libl7vsd_logger.a
+libsnmpagent_logger.a: $(libsnmpagent_logger_a_OBJECTS) $(libsnmpagent_logger_a_DEPENDENCIES)
+ -rm -f libsnmpagent_logger.a
+ $(libsnmpagent_logger_a_AR) libsnmpagent_logger.a $(libsnmpagent_logger_a_OBJECTS) $(libsnmpagent_logger_a_LIBADD)
+ $(RANLIB) libsnmpagent_logger.a
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libl7vsadm_logger_a-logger.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libl7vsadm_logger_a-logger_impl.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libl7vsadm_logger_a-strict_time_based_rolling_policy.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libl7vsadm_logger_a-time_and_size_based_rolling_policy.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libl7vsd_logger_a-logger.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libl7vsd_logger_a-logger_impl.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libl7vsd_logger_a-strict_time_based_rolling_policy.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libl7vsd_logger_a-time_and_size_based_rolling_policy.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsnmpagent_logger_a-logger.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsnmpagent_logger_a-logger_impl.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsnmpagent_logger_a-strict_time_based_rolling_policy.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsnmpagent_logger_a-time_and_size_based_rolling_policy.Po@am__quote@
+
+.cpp.o:
+@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $<
+
+.cpp.obj:
+@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
+@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+
+.cpp.lo:
+@am__fastdepCXX_TRUE@ if $(LTCXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $<
+
+libl7vsadm_logger_a-logger.o: logger.cpp
+@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libl7vsadm_logger_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libl7vsadm_logger_a-logger.o -MD -MP -MF "$(DEPDIR)/libl7vsadm_logger_a-logger.Tpo" -c -o libl7vsadm_logger_a-logger.o `test -f 'logger.cpp' || echo '$(srcdir)/'`logger.cpp; \
+@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libl7vsadm_logger_a-logger.Tpo" "$(DEPDIR)/libl7vsadm_logger_a-logger.Po"; else rm -f "$(DEPDIR)/libl7vsadm_logger_a-logger.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='logger.cpp' object='libl7vsadm_logger_a-logger.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libl7vsadm_logger_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libl7vsadm_logger_a-logger.o `test -f 'logger.cpp' || echo '$(srcdir)/'`logger.cpp
+
+libl7vsadm_logger_a-logger.obj: logger.cpp
+@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libl7vsadm_logger_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libl7vsadm_logger_a-logger.obj -MD -MP -MF "$(DEPDIR)/libl7vsadm_logger_a-logger.Tpo" -c -o libl7vsadm_logger_a-logger.obj `if test -f 'logger.cpp'; then $(CYGPATH_W) 'logger.cpp'; else $(CYGPATH_W) '$(srcdir)/logger.cpp'; fi`; \
+@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libl7vsadm_logger_a-logger.Tpo" "$(DEPDIR)/libl7vsadm_logger_a-logger.Po"; else rm -f "$(DEPDIR)/libl7vsadm_logger_a-logger.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='logger.cpp' object='libl7vsadm_logger_a-logger.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libl7vsadm_logger_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libl7vsadm_logger_a-logger.obj `if test -f 'logger.cpp'; then $(CYGPATH_W) 'logger.cpp'; else $(CYGPATH_W) '$(srcdir)/logger.cpp'; fi`
+
+libl7vsadm_logger_a-logger_impl.o: logger_impl.cpp
+@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libl7vsadm_logger_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libl7vsadm_logger_a-logger_impl.o -MD -MP -MF "$(DEPDIR)/libl7vsadm_logger_a-logger_impl.Tpo" -c -o libl7vsadm_logger_a-logger_impl.o `test -f 'logger_impl.cpp' || echo '$(srcdir)/'`logger_impl.cpp; \
+@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libl7vsadm_logger_a-logger_impl.Tpo" "$(DEPDIR)/libl7vsadm_logger_a-logger_impl.Po"; else rm -f "$(DEPDIR)/libl7vsadm_logger_a-logger_impl.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='logger_impl.cpp' object='libl7vsadm_logger_a-logger_impl.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libl7vsadm_logger_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libl7vsadm_logger_a-logger_impl.o `test -f 'logger_impl.cpp' || echo '$(srcdir)/'`logger_impl.cpp
+
+libl7vsadm_logger_a-logger_impl.obj: logger_impl.cpp
+@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libl7vsadm_logger_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libl7vsadm_logger_a-logger_impl.obj -MD -MP -MF "$(DEPDIR)/libl7vsadm_logger_a-logger_impl.Tpo" -c -o libl7vsadm_logger_a-logger_impl.obj `if test -f 'logger_impl.cpp'; then $(CYGPATH_W) 'logger_impl.cpp'; else $(CYGPATH_W) '$(srcdir)/logger_impl.cpp'; fi`; \
+@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libl7vsadm_logger_a-logger_impl.Tpo" "$(DEPDIR)/libl7vsadm_logger_a-logger_impl.Po"; else rm -f "$(DEPDIR)/libl7vsadm_logger_a-logger_impl.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='logger_impl.cpp' object='libl7vsadm_logger_a-logger_impl.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libl7vsadm_logger_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libl7vsadm_logger_a-logger_impl.obj `if test -f 'logger_impl.cpp'; then $(CYGPATH_W) 'logger_impl.cpp'; else $(CYGPATH_W) '$(srcdir)/logger_impl.cpp'; fi`
+
+libl7vsadm_logger_a-strict_time_based_rolling_policy.o: strict_time_based_rolling_policy.cpp
+@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libl7vsadm_logger_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libl7vsadm_logger_a-strict_time_based_rolling_policy.o -MD -MP -MF "$(DEPDIR)/libl7vsadm_logger_a-strict_time_based_rolling_policy.Tpo" -c -o libl7vsadm_logger_a-strict_time_based_rolling_policy.o `test -f 'strict_time_based_rolling_policy.cpp' || echo '$(srcdir)/'`strict_time_based_rolling_policy.cpp; \
+@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libl7vsadm_logger_a-strict_time_based_rolling_policy.Tpo" "$(DEPDIR)/libl7vsadm_logger_a-strict_time_based_rolling_policy.Po"; else rm -f "$(DEPDIR)/libl7vsadm_logger_a-strict_time_based_rolling_policy.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='strict_time_based_rolling_policy.cpp' object='libl7vsadm_logger_a-strict_time_based_rolling_policy.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libl7vsadm_logger_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libl7vsadm_logger_a-strict_time_based_rolling_policy.o `test -f 'strict_time_based_rolling_policy.cpp' || echo '$(srcdir)/'`strict_time_based_rolling_policy.cpp
+
+libl7vsadm_logger_a-strict_time_based_rolling_policy.obj: strict_time_based_rolling_policy.cpp
+@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libl7vsadm_logger_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libl7vsadm_logger_a-strict_time_based_rolling_policy.obj -MD -MP -MF "$(DEPDIR)/libl7vsadm_logger_a-strict_time_based_rolling_policy.Tpo" -c -o libl7vsadm_logger_a-strict_time_based_rolling_policy.obj `if test -f 'strict_time_based_rolling_policy.cpp'; then $(CYGPATH_W) 'strict_time_based_rolling_policy.cpp'; else $(CYGPATH_W) '$(srcdir)/strict_time_based_rolling_policy.cpp'; fi`; \
+@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libl7vsadm_logger_a-strict_time_based_rolling_policy.Tpo" "$(DEPDIR)/libl7vsadm_logger_a-strict_time_based_rolling_policy.Po"; else rm -f "$(DEPDIR)/libl7vsadm_logger_a-strict_time_based_rolling_policy.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='strict_time_based_rolling_policy.cpp' object='libl7vsadm_logger_a-strict_time_based_rolling_policy.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libl7vsadm_logger_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libl7vsadm_logger_a-strict_time_based_rolling_policy.obj `if test -f 'strict_time_based_rolling_policy.cpp'; then $(CYGPATH_W) 'strict_time_based_rolling_policy.cpp'; else $(CYGPATH_W) '$(srcdir)/strict_time_based_rolling_policy.cpp'; fi`
+
+libl7vsadm_logger_a-time_and_size_based_rolling_policy.o: time_and_size_based_rolling_policy.cpp
+@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libl7vsadm_logger_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libl7vsadm_logger_a-time_and_size_based_rolling_policy.o -MD -MP -MF "$(DEPDIR)/libl7vsadm_logger_a-time_and_size_based_rolling_policy.Tpo" -c -o libl7vsadm_logger_a-time_and_size_based_rolling_policy.o `test -f 'time_and_size_based_rolling_policy.cpp' || echo '$(srcdir)/'`time_and_size_based_rolling_policy.cpp; \
+@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libl7vsadm_logger_a-time_and_size_based_rolling_policy.Tpo" "$(DEPDIR)/libl7vsadm_logger_a-time_and_size_based_rolling_policy.Po"; else rm -f "$(DEPDIR)/libl7vsadm_logger_a-time_and_size_based_rolling_policy.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='time_and_size_based_rolling_policy.cpp' object='libl7vsadm_logger_a-time_and_size_based_rolling_policy.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libl7vsadm_logger_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libl7vsadm_logger_a-time_and_size_based_rolling_policy.o `test -f 'time_and_size_based_rolling_policy.cpp' || echo '$(srcdir)/'`time_and_size_based_rolling_policy.cpp
+
+libl7vsadm_logger_a-time_and_size_based_rolling_policy.obj: time_and_size_based_rolling_policy.cpp
+@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libl7vsadm_logger_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libl7vsadm_logger_a-time_and_size_based_rolling_policy.obj -MD -MP -MF "$(DEPDIR)/libl7vsadm_logger_a-time_and_size_based_rolling_policy.Tpo" -c -o libl7vsadm_logger_a-time_and_size_based_rolling_policy.obj `if test -f 'time_and_size_based_rolling_policy.cpp'; then $(CYGPATH_W) 'time_and_size_based_rolling_policy.cpp'; else $(CYGPATH_W) '$(srcdir)/time_and_size_based_rolling_policy.cpp'; fi`; \
+@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libl7vsadm_logger_a-time_and_size_based_rolling_policy.Tpo" "$(DEPDIR)/libl7vsadm_logger_a-time_and_size_based_rolling_policy.Po"; else rm -f "$(DEPDIR)/libl7vsadm_logger_a-time_and_size_based_rolling_policy.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='time_and_size_based_rolling_policy.cpp' object='libl7vsadm_logger_a-time_and_size_based_rolling_policy.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libl7vsadm_logger_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libl7vsadm_logger_a-time_and_size_based_rolling_policy.obj `if test -f 'time_and_size_based_rolling_policy.cpp'; then $(CYGPATH_W) 'time_and_size_based_rolling_policy.cpp'; else $(CYGPATH_W) '$(srcdir)/time_and_size_based_rolling_policy.cpp'; fi`
+
+libl7vsd_logger_a-logger.o: logger.cpp
+@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libl7vsd_logger_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libl7vsd_logger_a-logger.o -MD -MP -MF "$(DEPDIR)/libl7vsd_logger_a-logger.Tpo" -c -o libl7vsd_logger_a-logger.o `test -f 'logger.cpp' || echo '$(srcdir)/'`logger.cpp; \
+@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libl7vsd_logger_a-logger.Tpo" "$(DEPDIR)/libl7vsd_logger_a-logger.Po"; else rm -f "$(DEPDIR)/libl7vsd_logger_a-logger.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='logger.cpp' object='libl7vsd_logger_a-logger.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libl7vsd_logger_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libl7vsd_logger_a-logger.o `test -f 'logger.cpp' || echo '$(srcdir)/'`logger.cpp
+
+libl7vsd_logger_a-logger.obj: logger.cpp
+@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libl7vsd_logger_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libl7vsd_logger_a-logger.obj -MD -MP -MF "$(DEPDIR)/libl7vsd_logger_a-logger.Tpo" -c -o libl7vsd_logger_a-logger.obj `if test -f 'logger.cpp'; then $(CYGPATH_W) 'logger.cpp'; else $(CYGPATH_W) '$(srcdir)/logger.cpp'; fi`; \
+@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libl7vsd_logger_a-logger.Tpo" "$(DEPDIR)/libl7vsd_logger_a-logger.Po"; else rm -f "$(DEPDIR)/libl7vsd_logger_a-logger.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='logger.cpp' object='libl7vsd_logger_a-logger.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libl7vsd_logger_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libl7vsd_logger_a-logger.obj `if test -f 'logger.cpp'; then $(CYGPATH_W) 'logger.cpp'; else $(CYGPATH_W) '$(srcdir)/logger.cpp'; fi`
+
+libl7vsd_logger_a-logger_impl.o: logger_impl.cpp
+@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libl7vsd_logger_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libl7vsd_logger_a-logger_impl.o -MD -MP -MF "$(DEPDIR)/libl7vsd_logger_a-logger_impl.Tpo" -c -o libl7vsd_logger_a-logger_impl.o `test -f 'logger_impl.cpp' || echo '$(srcdir)/'`logger_impl.cpp; \
+@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libl7vsd_logger_a-logger_impl.Tpo" "$(DEPDIR)/libl7vsd_logger_a-logger_impl.Po"; else rm -f "$(DEPDIR)/libl7vsd_logger_a-logger_impl.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='logger_impl.cpp' object='libl7vsd_logger_a-logger_impl.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libl7vsd_logger_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libl7vsd_logger_a-logger_impl.o `test -f 'logger_impl.cpp' || echo '$(srcdir)/'`logger_impl.cpp
+
+libl7vsd_logger_a-logger_impl.obj: logger_impl.cpp
+@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libl7vsd_logger_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libl7vsd_logger_a-logger_impl.obj -MD -MP -MF "$(DEPDIR)/libl7vsd_logger_a-logger_impl.Tpo" -c -o libl7vsd_logger_a-logger_impl.obj `if test -f 'logger_impl.cpp'; then $(CYGPATH_W) 'logger_impl.cpp'; else $(CYGPATH_W) '$(srcdir)/logger_impl.cpp'; fi`; \
+@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libl7vsd_logger_a-logger_impl.Tpo" "$(DEPDIR)/libl7vsd_logger_a-logger_impl.Po"; else rm -f "$(DEPDIR)/libl7vsd_logger_a-logger_impl.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='logger_impl.cpp' object='libl7vsd_logger_a-logger_impl.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libl7vsd_logger_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libl7vsd_logger_a-logger_impl.obj `if test -f 'logger_impl.cpp'; then $(CYGPATH_W) 'logger_impl.cpp'; else $(CYGPATH_W) '$(srcdir)/logger_impl.cpp'; fi`
+
+libl7vsd_logger_a-strict_time_based_rolling_policy.o: strict_time_based_rolling_policy.cpp
+@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libl7vsd_logger_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libl7vsd_logger_a-strict_time_based_rolling_policy.o -MD -MP -MF "$(DEPDIR)/libl7vsd_logger_a-strict_time_based_rolling_policy.Tpo" -c -o libl7vsd_logger_a-strict_time_based_rolling_policy.o `test -f 'strict_time_based_rolling_policy.cpp' || echo '$(srcdir)/'`strict_time_based_rolling_policy.cpp; \
+@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libl7vsd_logger_a-strict_time_based_rolling_policy.Tpo" "$(DEPDIR)/libl7vsd_logger_a-strict_time_based_rolling_policy.Po"; else rm -f "$(DEPDIR)/libl7vsd_logger_a-strict_time_based_rolling_policy.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='strict_time_based_rolling_policy.cpp' object='libl7vsd_logger_a-strict_time_based_rolling_policy.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libl7vsd_logger_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libl7vsd_logger_a-strict_time_based_rolling_policy.o `test -f 'strict_time_based_rolling_policy.cpp' || echo '$(srcdir)/'`strict_time_based_rolling_policy.cpp
+
+libl7vsd_logger_a-strict_time_based_rolling_policy.obj: strict_time_based_rolling_policy.cpp
+@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libl7vsd_logger_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libl7vsd_logger_a-strict_time_based_rolling_policy.obj -MD -MP -MF "$(DEPDIR)/libl7vsd_logger_a-strict_time_based_rolling_policy.Tpo" -c -o libl7vsd_logger_a-strict_time_based_rolling_policy.obj `if test -f 'strict_time_based_rolling_policy.cpp'; then $(CYGPATH_W) 'strict_time_based_rolling_policy.cpp'; else $(CYGPATH_W) '$(srcdir)/strict_time_based_rolling_policy.cpp'; fi`; \
+@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libl7vsd_logger_a-strict_time_based_rolling_policy.Tpo" "$(DEPDIR)/libl7vsd_logger_a-strict_time_based_rolling_policy.Po"; else rm -f "$(DEPDIR)/libl7vsd_logger_a-strict_time_based_rolling_policy.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='strict_time_based_rolling_policy.cpp' object='libl7vsd_logger_a-strict_time_based_rolling_policy.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libl7vsd_logger_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libl7vsd_logger_a-strict_time_based_rolling_policy.obj `if test -f 'strict_time_based_rolling_policy.cpp'; then $(CYGPATH_W) 'strict_time_based_rolling_policy.cpp'; else $(CYGPATH_W) '$(srcdir)/strict_time_based_rolling_policy.cpp'; fi`
+
+libl7vsd_logger_a-time_and_size_based_rolling_policy.o: time_and_size_based_rolling_policy.cpp
+@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libl7vsd_logger_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libl7vsd_logger_a-time_and_size_based_rolling_policy.o -MD -MP -MF "$(DEPDIR)/libl7vsd_logger_a-time_and_size_based_rolling_policy.Tpo" -c -o libl7vsd_logger_a-time_and_size_based_rolling_policy.o `test -f 'time_and_size_based_rolling_policy.cpp' || echo '$(srcdir)/'`time_and_size_based_rolling_policy.cpp; \
+@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libl7vsd_logger_a-time_and_size_based_rolling_policy.Tpo" "$(DEPDIR)/libl7vsd_logger_a-time_and_size_based_rolling_policy.Po"; else rm -f "$(DEPDIR)/libl7vsd_logger_a-time_and_size_based_rolling_policy.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='time_and_size_based_rolling_policy.cpp' object='libl7vsd_logger_a-time_and_size_based_rolling_policy.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libl7vsd_logger_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libl7vsd_logger_a-time_and_size_based_rolling_policy.o `test -f 'time_and_size_based_rolling_policy.cpp' || echo '$(srcdir)/'`time_and_size_based_rolling_policy.cpp
+
+libl7vsd_logger_a-time_and_size_based_rolling_policy.obj: time_and_size_based_rolling_policy.cpp
+@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libl7vsd_logger_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libl7vsd_logger_a-time_and_size_based_rolling_policy.obj -MD -MP -MF "$(DEPDIR)/libl7vsd_logger_a-time_and_size_based_rolling_policy.Tpo" -c -o libl7vsd_logger_a-time_and_size_based_rolling_policy.obj `if test -f 'time_and_size_based_rolling_policy.cpp'; then $(CYGPATH_W) 'time_and_size_based_rolling_policy.cpp'; else $(CYGPATH_W) '$(srcdir)/time_and_size_based_rolling_policy.cpp'; fi`; \
+@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libl7vsd_logger_a-time_and_size_based_rolling_policy.Tpo" "$(DEPDIR)/libl7vsd_logger_a-time_and_size_based_rolling_policy.Po"; else rm -f "$(DEPDIR)/libl7vsd_logger_a-time_and_size_based_rolling_policy.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='time_and_size_based_rolling_policy.cpp' object='libl7vsd_logger_a-time_and_size_based_rolling_policy.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libl7vsd_logger_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libl7vsd_logger_a-time_and_size_based_rolling_policy.obj `if test -f 'time_and_size_based_rolling_policy.cpp'; then $(CYGPATH_W) 'time_and_size_based_rolling_policy.cpp'; else $(CYGPATH_W) '$(srcdir)/time_and_size_based_rolling_policy.cpp'; fi`
+
+libsnmpagent_logger_a-logger.o: logger.cpp
+@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsnmpagent_logger_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libsnmpagent_logger_a-logger.o -MD -MP -MF "$(DEPDIR)/libsnmpagent_logger_a-logger.Tpo" -c -o libsnmpagent_logger_a-logger.o `test -f 'logger.cpp' || echo '$(srcdir)/'`logger.cpp; \
+@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libsnmpagent_logger_a-logger.Tpo" "$(DEPDIR)/libsnmpagent_logger_a-logger.Po"; else rm -f "$(DEPDIR)/libsnmpagent_logger_a-logger.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='logger.cpp' object='libsnmpagent_logger_a-logger.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsnmpagent_logger_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libsnmpagent_logger_a-logger.o `test -f 'logger.cpp' || echo '$(srcdir)/'`logger.cpp
+
+libsnmpagent_logger_a-logger.obj: logger.cpp
+@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsnmpagent_logger_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libsnmpagent_logger_a-logger.obj -MD -MP -MF "$(DEPDIR)/libsnmpagent_logger_a-logger.Tpo" -c -o libsnmpagent_logger_a-logger.obj `if test -f 'logger.cpp'; then $(CYGPATH_W) 'logger.cpp'; else $(CYGPATH_W) '$(srcdir)/logger.cpp'; fi`; \
+@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libsnmpagent_logger_a-logger.Tpo" "$(DEPDIR)/libsnmpagent_logger_a-logger.Po"; else rm -f "$(DEPDIR)/libsnmpagent_logger_a-logger.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='logger.cpp' object='libsnmpagent_logger_a-logger.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsnmpagent_logger_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libsnmpagent_logger_a-logger.obj `if test -f 'logger.cpp'; then $(CYGPATH_W) 'logger.cpp'; else $(CYGPATH_W) '$(srcdir)/logger.cpp'; fi`
+
+libsnmpagent_logger_a-logger_impl.o: logger_impl.cpp
+@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsnmpagent_logger_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libsnmpagent_logger_a-logger_impl.o -MD -MP -MF "$(DEPDIR)/libsnmpagent_logger_a-logger_impl.Tpo" -c -o libsnmpagent_logger_a-logger_impl.o `test -f 'logger_impl.cpp' || echo '$(srcdir)/'`logger_impl.cpp; \
+@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libsnmpagent_logger_a-logger_impl.Tpo" "$(DEPDIR)/libsnmpagent_logger_a-logger_impl.Po"; else rm -f "$(DEPDIR)/libsnmpagent_logger_a-logger_impl.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='logger_impl.cpp' object='libsnmpagent_logger_a-logger_impl.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsnmpagent_logger_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libsnmpagent_logger_a-logger_impl.o `test -f 'logger_impl.cpp' || echo '$(srcdir)/'`logger_impl.cpp
+
+libsnmpagent_logger_a-logger_impl.obj: logger_impl.cpp
+@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsnmpagent_logger_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libsnmpagent_logger_a-logger_impl.obj -MD -MP -MF "$(DEPDIR)/libsnmpagent_logger_a-logger_impl.Tpo" -c -o libsnmpagent_logger_a-logger_impl.obj `if test -f 'logger_impl.cpp'; then $(CYGPATH_W) 'logger_impl.cpp'; else $(CYGPATH_W) '$(srcdir)/logger_impl.cpp'; fi`; \
+@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libsnmpagent_logger_a-logger_impl.Tpo" "$(DEPDIR)/libsnmpagent_logger_a-logger_impl.Po"; else rm -f "$(DEPDIR)/libsnmpagent_logger_a-logger_impl.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='logger_impl.cpp' object='libsnmpagent_logger_a-logger_impl.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsnmpagent_logger_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libsnmpagent_logger_a-logger_impl.obj `if test -f 'logger_impl.cpp'; then $(CYGPATH_W) 'logger_impl.cpp'; else $(CYGPATH_W) '$(srcdir)/logger_impl.cpp'; fi`
+
+libsnmpagent_logger_a-strict_time_based_rolling_policy.o: strict_time_based_rolling_policy.cpp
+@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsnmpagent_logger_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libsnmpagent_logger_a-strict_time_based_rolling_policy.o -MD -MP -MF "$(DEPDIR)/libsnmpagent_logger_a-strict_time_based_rolling_policy.Tpo" -c -o libsnmpagent_logger_a-strict_time_based_rolling_policy.o `test -f 'strict_time_based_rolling_policy.cpp' || echo '$(srcdir)/'`strict_time_based_rolling_policy.cpp; \
+@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libsnmpagent_logger_a-strict_time_based_rolling_policy.Tpo" "$(DEPDIR)/libsnmpagent_logger_a-strict_time_based_rolling_policy.Po"; else rm -f "$(DEPDIR)/libsnmpagent_logger_a-strict_time_based_rolling_policy.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='strict_time_based_rolling_policy.cpp' object='libsnmpagent_logger_a-strict_time_based_rolling_policy.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsnmpagent_logger_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libsnmpagent_logger_a-strict_time_based_rolling_policy.o `test -f 'strict_time_based_rolling_policy.cpp' || echo '$(srcdir)/'`strict_time_based_rolling_policy.cpp
+
+libsnmpagent_logger_a-strict_time_based_rolling_policy.obj: strict_time_based_rolling_policy.cpp
+@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsnmpagent_logger_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libsnmpagent_logger_a-strict_time_based_rolling_policy.obj -MD -MP -MF "$(DEPDIR)/libsnmpagent_logger_a-strict_time_based_rolling_policy.Tpo" -c -o libsnmpagent_logger_a-strict_time_based_rolling_policy.obj `if test -f 'strict_time_based_rolling_policy.cpp'; then $(CYGPATH_W) 'strict_time_based_rolling_policy.cpp'; else $(CYGPATH_W) '$(srcdir)/strict_time_based_rolling_policy.cpp'; fi`; \
+@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libsnmpagent_logger_a-strict_time_based_rolling_policy.Tpo" "$(DEPDIR)/libsnmpagent_logger_a-strict_time_based_rolling_policy.Po"; else rm -f "$(DEPDIR)/libsnmpagent_logger_a-strict_time_based_rolling_policy.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='strict_time_based_rolling_policy.cpp' object='libsnmpagent_logger_a-strict_time_based_rolling_policy.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsnmpagent_logger_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libsnmpagent_logger_a-strict_time_based_rolling_policy.obj `if test -f 'strict_time_based_rolling_policy.cpp'; then $(CYGPATH_W) 'strict_time_based_rolling_policy.cpp'; else $(CYGPATH_W) '$(srcdir)/strict_time_based_rolling_policy.cpp'; fi`
+
+libsnmpagent_logger_a-time_and_size_based_rolling_policy.o: time_and_size_based_rolling_policy.cpp
+@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsnmpagent_logger_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libsnmpagent_logger_a-time_and_size_based_rolling_policy.o -MD -MP -MF "$(DEPDIR)/libsnmpagent_logger_a-time_and_size_based_rolling_policy.Tpo" -c -o libsnmpagent_logger_a-time_and_size_based_rolling_policy.o `test -f 'time_and_size_based_rolling_policy.cpp' || echo '$(srcdir)/'`time_and_size_based_rolling_policy.cpp; \
+@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libsnmpagent_logger_a-time_and_size_based_rolling_policy.Tpo" "$(DEPDIR)/libsnmpagent_logger_a-time_and_size_based_rolling_policy.Po"; else rm -f "$(DEPDIR)/libsnmpagent_logger_a-time_and_size_based_rolling_policy.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='time_and_size_based_rolling_policy.cpp' object='libsnmpagent_logger_a-time_and_size_based_rolling_policy.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsnmpagent_logger_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libsnmpagent_logger_a-time_and_size_based_rolling_policy.o `test -f 'time_and_size_based_rolling_policy.cpp' || echo '$(srcdir)/'`time_and_size_based_rolling_policy.cpp
+
+libsnmpagent_logger_a-time_and_size_based_rolling_policy.obj: time_and_size_based_rolling_policy.cpp
+@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsnmpagent_logger_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libsnmpagent_logger_a-time_and_size_based_rolling_policy.obj -MD -MP -MF "$(DEPDIR)/libsnmpagent_logger_a-time_and_size_based_rolling_policy.Tpo" -c -o libsnmpagent_logger_a-time_and_size_based_rolling_policy.obj `if test -f 'time_and_size_based_rolling_policy.cpp'; then $(CYGPATH_W) 'time_and_size_based_rolling_policy.cpp'; else $(CYGPATH_W) '$(srcdir)/time_and_size_based_rolling_policy.cpp'; fi`; \
+@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libsnmpagent_logger_a-time_and_size_based_rolling_policy.Tpo" "$(DEPDIR)/libsnmpagent_logger_a-time_and_size_based_rolling_policy.Po"; else rm -f "$(DEPDIR)/libsnmpagent_logger_a-time_and_size_based_rolling_policy.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='time_and_size_based_rolling_policy.cpp' object='libsnmpagent_logger_a-time_and_size_based_rolling_policy.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsnmpagent_logger_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libsnmpagent_logger_a-time_and_size_based_rolling_policy.obj `if test -f 'time_and_size_based_rolling_policy.cpp'; then $(CYGPATH_W) 'time_and_size_based_rolling_policy.cpp'; else $(CYGPATH_W) '$(srcdir)/time_and_size_based_rolling_policy.cpp'; fi`
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+distclean-libtool:
+ -rm -f libtool
+uninstall-info-am:
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+ list='$(DISTFILES)'; for file in $$list; do \
+ case $$file in \
+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+ esac; \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ dir="/$$dir"; \
+ $(mkdir_p) "$(distdir)$$dir"; \
+ else \
+ dir=''; \
+ fi; \
+ if test -d $$d/$$file; then \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LIBRARIES)
+installdirs:
+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-libtool clean-noinstLIBRARIES \
+ mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-libtool distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-exec-am:
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-info-am
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+ clean-libtool clean-noinstLIBRARIES ctags distclean \
+ distclean-compile distclean-generic distclean-libtool \
+ distclean-tags distdir dvi dvi-am html html-am info info-am \
+ install install-am install-data install-data-am install-exec \
+ install-exec-am install-info install-info-am install-man \
+ install-strip installcheck installcheck-am installdirs \
+ maintainer-clean maintainer-clean-generic mostlyclean \
+ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
+ pdf pdf-am ps ps-am tags uninstall uninstall-am \
+ uninstall-info-am
+
+# 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:
--- /dev/null
+#ifndef __LEXICAL_CAST_H__
+#define __LEXICAL_CAST_H__
+
+#include <string>
+#include <sstream>
+
+namespace l7vs
+{
+ class bad_lexical_cast : public std::bad_cast
+ {
+ public:
+ bad_lexical_cast() {}
+ };
+
+ template <typename T>
+ T lexical_cast(const std::string& s)
+ {
+ std::stringstream ss;
+ T d;
+ ss << s.c_str();
+ while( !ss.eof() ){
+ ss >> d;
+ if(ss.fail()) {
+ throw bad_lexical_cast();
+ }
+ }
+ return d;
+ }
+}
+
+#endif //__LEXICAL_CAST_H__
--- /dev/null
+/*
+ * @file logger.cpp
+ * @brief logger module creation class.
+ *
+ * L7VSD: Linux Virtual Server for Layer7 Load Balancing
+ * Copyright (C) 2008 NTT COMWARE Corporation.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ **********************************************************************/
+
+#include <logger.h>
+#include <logger_impl.h>
+
+/*!
+ * default constructor.
+ * get instance of implement class, and initialize
+ * @param void
+ * @return void
+ */
+l7vs::Logger::Logger()
+{
+ if (!LoggerImpl::getInstance().init()) {
+ exit(1);
+ }
+}
+
+/*!
+ * destructor.
+ * @param void
+ * @return void
+ */
+l7vs::Logger::~Logger()
+{
+}
+
+/*!
+ * retrieve category's log level.
+ * this is only wrapper to implement method.
+ * @param category that want to know
+ * @return log level
+ */
+LOG_LEVEL_TAG l7vs::Logger::getLogLevel(LOG_CATEGORY_TAG cat)
+{
+ return LoggerImpl::getInstance().getLogLevel(cat);
+}
+
+/*!
+ * set category's log level.
+ * this is only wrapper to implement method.
+ * @param category to set log level
+ * @param level
+ * @retval true succeed
+ * @retval false failed
+ */
+bool l7vs::Logger::setLogLevel(LOG_CATEGORY_TAG cat, LOG_LEVEL_TAG level)
+{
+ return LoggerImpl::getInstance().setLogLevel(cat, level);
+}
+
+/*!
+ * output fatal log.
+ * this is only wrapper to implement method.
+ * @param category that logging matter occured
+ * @param log message id
+ * @param log message
+ * @param current file
+ * @param current line
+ * @retrun void
+ */
+void l7vs::Logger::putLogFatal(LOG_CATEGORY_TAG cat, const unsigned int message_id, const std::string& message, const char *file, int line)
+{
+ LoggerImpl::getInstance().putLogFatal(cat, message_id, message, file, line);
+}
+
+/*!
+ * output errorl log.
+ * this is only wrapper to implement method.
+ * @param category that logging matter occured
+ * @param log message id
+ * @param log message
+ * @param current file
+ * @param current line
+ * @retrun void
+ */
+void l7vs::Logger::putLogError(LOG_CATEGORY_TAG cat, const unsigned int message_id, const std::string& message, const char *file, int line)
+{
+ LoggerImpl::getInstance().putLogError(cat, message_id, message, file, line);
+}
+
+/*!
+ * output warn log.
+ * this is only wrapper to implement method.
+ * @param category that logging matter occured
+ * @param log message id
+ * @param log message
+ * @param current file
+ * @param current line
+ * @retrun void
+ */
+void l7vs::Logger::putLogWarn(LOG_CATEGORY_TAG cat, const unsigned int message_id, const std::string& message, const char *file, int line)
+{
+ LoggerImpl::getInstance().putLogWarn(cat, message_id, message, file, line);
+}
+
+/*!
+ * output info log.
+ * this is only wrapper to implement method.
+ * @param category that logging matter occured
+ * @param log message id
+ * @param log message
+ * @param current file
+ * @param current line
+ * @retrun void
+ */
+void l7vs::Logger::putLogInfo(LOG_CATEGORY_TAG cat, const unsigned int message_id, const std::string& message, const char *file, int line)
+{
+ LoggerImpl::getInstance().putLogInfo(cat, message_id, message, file, line);
+}
+
+/*!
+ * output debug log.
+ * this is only wrapper to implement method.
+ * @param category that logging matter occured
+ * @param log message id
+ * @param log message
+ * @param current file
+ * @param current line
+ * @retrun void
+ */
+void l7vs::Logger::putLogDebug(LOG_CATEGORY_TAG cat, const unsigned int message_id, const std::string& message, const char *file, int line)
+{
+ LoggerImpl::getInstance().putLogDebug(cat, message_id, message, file, line);
+}
+
+/*!
+ * return start category by using module.
+ * this is only wrapper to implement method.
+ * @param module
+ * @retrun start category
+ */
+LOG_CATEGORY_TAG l7vs::Logger::getCategoryRangeStart(LOG_MODULE_TAG mod)
+{
+ return LoggerImpl::getInstance().getCategoryRangeStart(mod);
+}
+
+/*!
+ * return end category by using module.
+ * this is only wrapper to implement method.
+ * @param module
+ * @retrun end category
+ */
+LOG_CATEGORY_TAG l7vs::Logger::getCategoryRangeEnd(LOG_MODULE_TAG mod)
+{
+ return LoggerImpl::getInstance().getCategoryRangeEnd(mod);
+}
+
+/*!
+ * reload configuration.
+ * this is only wrapper to implement method.
+ * @param void
+ * @return void
+ */
+void l7vs::Logger::loadConf()
+{
+ LoggerImpl::getInstance().loadConf();
+}
--- /dev/null
+/*
+ * @file logger.h
+ * @brief logger module creation class.
+ *
+ * L7VSD: Linux Virtual Server for Layer7 Load Balancing
+ * Copyright (C) 2008 NTT COMWARE Corporation.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ **********************************************************************/
+
+#ifndef __LOGGER_H__
+#define __LOGGER_H__
+
+#include <string>
+#include <logger_enum.h>
+
+#define BUF_LEN (4096)
+#define DEBUG_STR_LEN (4096)
+#define ADDR_STR_LEN (16)
+
+namespace l7vs
+{
+ /*!
+ * Logger creation class.
+ * this class create Logger Inmlement class and mediate function.
+ */
+ class Logger
+ {
+ public:
+ //! default constructor creates implement class.
+ Logger();
+ //! destructor.
+ ~Logger();
+ /*!
+ * returns single instance.
+ *
+ * @param void
+ * @return instance
+ */
+ static Logger& getInstance() {
+ return instance;
+ }
+ //! load Configuration.
+ void loadConf();
+ //! retrieve category's log level.
+ LOG_LEVEL_TAG getLogLevel(LOG_CATEGORY_TAG cat);
+ //! set category's log level.
+ bool setLogLevel(LOG_CATEGORY_TAG cat, LOG_LEVEL_TAG level);
+ //! output fatal log.
+ void putLogFatal(LOG_CATEGORY_TAG cat, const unsigned int message_id, const std::string& message, const char *file, int line);
+ //! output error log.
+ void putLogError(LOG_CATEGORY_TAG cat, const unsigned int message_id, const std::string& message, const char *file, int line);
+ //! output warn log.
+ void putLogWarn(LOG_CATEGORY_TAG cat, const unsigned int message_id, const std::string& message, const char *file, int line);
+ //! output info log.
+ void putLogInfo(LOG_CATEGORY_TAG cat, const unsigned int message_id, const std::string& message, const char *file, int line);
+ //! output debug log.
+ void putLogDebug(LOG_CATEGORY_TAG cat, const unsigned int message_id, const std::string& message, const char *file, int line);
+ //! return start category by using module.
+ LOG_CATEGORY_TAG getCategoryRangeStart(LOG_MODULE_TAG mod);
+ //! return end category by using module.
+ LOG_CATEGORY_TAG getCategoryRangeEnd(LOG_MODULE_TAG mod);
+
+ protected:
+ /*!
+ * static instance initialize before main.
+ * instance will defined in main program.
+ */
+ static Logger instance;
+ };
+} //namespace l7vs
+
+#endif //__LOGGER_H__
--- /dev/null
+/*
+ * @file logger_enum.h
+ * @brief logger module constants enumeration.
+ *
+ * L7VSD: Linux Virtual Server for Layer7 Load Balancing
+ * Copyright (C) 2008 NTT COMWARE Corporation.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ **********************************************************************/
+
+#ifndef __LOGGER_ENUM_H__
+#define __LOGGER_ENUM_H__
+
+#include <string>
+#include <log4cxx/level.h>
+
+/*!
+ * LogLevel enumeration.
+ */
+enum LOG_LEVEL_TAG
+{
+ LOG_LV_NONE = 0,
+ LOG_LV_DEBUG,
+ LOG_LV_INFO,
+ LOG_LV_WARN,
+ LOG_LV_ERROR,
+ LOG_LV_FATAL
+};
+
+inline LOG_LEVEL_TAG& operator++(LOG_LEVEL_TAG& level) {
+ level = static_cast<LOG_LEVEL_TAG>(level + 1);
+ return level;
+}
+
+/*!
+ * Category enumeration.
+ */
+enum LOG_CATEGORY_TAG
+{
+ LOG_CAT_NONE = 0,
+ LOG_CAT_L7VSD_NETWORK,
+ LOG_CAT_L7VSD_NETWORK_BANDWIDTH,
+ LOG_CAT_L7VSD_NETWORK_NUM_CONNECTION,
+ LOG_CAT_L7VSD_NETWORK_QOS,
+ LOG_CAT_L7VSD_VIRTUAL_SERVICE,
+ LOG_CAT_L7VSD_REAL_SERVER,
+ LOG_CAT_L7VSD_SORRY_SERVER,
+ LOG_CAT_L7VSD_REAL_SERVER_BALANCING,
+ LOG_CAT_L7VSD_REPLICATION,
+ LOG_CAT_L7VSD_START_STOP,
+ LOG_CAT_L7VSD_SYSTEM,
+ LOG_CAT_L7VSD_SYSTEM_MEMORY,
+ LOG_CAT_L7VSD_SYSTEM_SOCKET,
+ LOG_CAT_L7VSD_SYSTEM_SIGNAL,
+ LOG_CAT_L7VSD_ENVIRONMENT,
+ LOG_CAT_L7VSD_ENVIRONMENT_PARAMETER,
+ LOG_CAT_L7VSD_LOGGER,
+ LOG_CAT_L7VSD_PARAMETER,
+ LOG_CAT_L7VSD_EVENT,
+ LOG_CAT_L7VSD_SCHEDULE,
+ LOG_CAT_L7VSD_PROGRAM,
+ LOG_CAT_L7VSD_PROTOCOL,
+ LOG_CAT_L7VSD_MODULE,
+
+ LOG_CAT_L7VSADM_PARSE,
+ LOG_CAT_L7VSADM_OPERATE,
+ LOG_CAT_L7VSADM_COMMUNICATE,
+ LOG_CAT_L7VSADM_CONFIG_RESULT,
+ LOG_CAT_L7VSADM_COMMON,
+ LOG_CAT_L7VSADM_LOGGER,
+ LOG_CAT_L7VSADM_PARAMETER,
+ LOG_CAT_L7VSADM_PROTOCOL,
+ LOG_CAT_L7VSADM_MODULE,
+
+ LOG_CAT_SNMPAGENT_START_STOP,
+ LOG_CAT_SNMPAGENT_MANAGER_RECEIVE,
+ LOG_CAT_SNMPAGENT_MANAGER_SEND,
+ LOG_CAT_SNMPAGENT_L7VSD_RECEIVE,
+ LOG_CAT_SNMPAGENT_L7VSD_SEND,
+ LOG_CAT_SNMPAGENT_LOGGER,
+ LOG_CAT_SNMPAGENT_PARAMETER
+};
+
+inline LOG_CATEGORY_TAG& operator++(LOG_CATEGORY_TAG& cat) {
+ cat = static_cast<LOG_CATEGORY_TAG>(cat + 1);
+ return cat;
+}
+
+/*!
+ * Module enumeration.
+ */
+enum LOG_MODULE_TAG
+{
+ LOG_MOD_L7VSD = 0,
+ LOG_MOD_L7VSADM,
+ LOG_MOD_SNMPAGENT
+};
+
+/*!
+ * Rotation enumeration.
+ */
+enum LOG_ROTATION_TAG {
+ LOG_ROT_SIZE,
+ LOG_ROT_DATE,
+ LOG_ROT_DATESIZE
+};
+
+/*!
+ * RotationTiming enumeration.
+ */
+enum LOG_ROTATION_TIMING_TAG {
+ LOG_TIM_YEAR,
+ LOG_TIM_MONTH,
+ LOG_TIM_WEEK,
+ LOG_TIM_DATE,
+ LOG_TIM_HOUR
+};
+
+#endif //__LOGGER_ENUM_H__
--- /dev/null
+/*
+ * @file logger_impl.cpp
+ * @brief logger module implementation class.
+ *
+ * L7VSD: Linux Virtual Server for Layer7 Load Balancing
+ * Copyright (C) 2008 NTT COMWARE Corporation.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ **********************************************************************/
+
+#include <sstream>
+#include <iomanip>
+#include <limits.h>
+#include <log4cxx/logmanager.h>
+#include <log4cxx/helpers/loglog.h>
+#include <log4cxx/rolling/rollingfileappender.h>
+#include <log4cxx/rolling/fixedwindowrollingpolicy.h>
+#include <log4cxx/rolling/sizebasedtriggeringpolicy.h>
+#include <log4cxx/rolling/timebasedrollingpolicy.h>
+#include <log4cxx/consoleappender.h>
+#include <errno.h>
+#include <stdexcept>
+
+#include "logger_impl.h"
+#include "parameter.h"
+#include "lexical_cast.h"
+#include "strict_time_based_rolling_policy.h"
+#include "time_and_size_based_rolling_policy.h"
+
+#define LOGGER_LAYOUT "%d{%Y/%m/%d %H:%M:%S} [%p] %c %m %t %F:%L%n"
+#define LOGGER_DEFAULT_BUFFER_SIZE (8 * 1024)
+#define LOGGER_SYSLOG_FACILITY "USER"
+#define LOGGER_BACKUP_INDEX_LOWER_LIMIT (1)
+#define LOGGER_BACKUP_INDEX_LIMIT (12)
+#define LOGGER_FILESIZE_LOWER_LIMIT (65535)
+#define LOGGER_FILE_PATTERN "%i"
+
+#if defined(LOGGER_PROCESS_VSD)
+#define LOGGER_LOG_FILENAME_KEY "l7vsd_log_filename"
+#define LOGGER_ROTATION_KEY "l7vsd_rotation"
+#define LOGGER_MAX_BACKUP_INDEX_KEY "l7vsd_max_backup_index"
+#define LOGGER_MAX_FILE_SIZE_KEY "l7vsd_max_filesize"
+#define LOGGER_ROTATION_TIMING_KEY "l7vsd_rotation_timing"
+#define LOGGER_ROTATION_TIMING_VALUE_KEY "l7vsd_rotation_timing_value"
+
+#elif defined(LOGGER_PROCESS_ADM)
+#define LOGGER_LOG_FILENAME_KEY "l7vsadm_log_filename"
+#define LOGGER_ROTATION_KEY "l7vsadm_rotation"
+#define LOGGER_MAX_BACKUP_INDEX_KEY "l7vsadm_max_backup_index"
+#define LOGGER_MAX_FILE_SIZE_KEY "l7vsadm_max_filesize"
+#define LOGGER_ROTATION_TIMING_KEY "l7vsadm_rotation_timing"
+#define LOGGER_ROTATION_TIMING_VALUE_KEY "l7vsadm_rotation_timing_value"
+#else //LOGGER_PROCESS_SNM
+#define LOGGER_LOG_FILENAME_KEY "snmpagent_log_filename"
+#define LOGGER_ROTATION_KEY "snmpagent_rotation"
+#define LOGGER_MAX_BACKUP_INDEX_KEY "snmpagent_max_backup_index"
+#define LOGGER_MAX_FILE_SIZE_KEY "snmpagent_max_filesize"
+#define LOGGER_ROTATION_TIMING_KEY "snmpagent_rotation_timing"
+#define LOGGER_ROTATION_TIMING_VALUE_KEY "snmpagent_rotation_timing_value"
+#endif
+
+//! for transration between log4cxx::LevelPtr and LOGER_LEVEL_TAG
+char l7vs::LoggerImpl::categoryTable[][LOGGER_CATEGORY_NUM] = {
+ "none",
+ "l7vsd_network",
+ "l7vsd_network.bandwidth",
+ "l7vsd_network.num_connection",
+ "l7vsd_network.qos",
+ "l7vsd_virtual_service",
+ "l7vsd_real_server",
+ "l7vsd_sorry_server",
+ "l7vsd_real_server.balancing",
+ "l7vsd_replication",
+ "l7vsd_start_stop",
+ "l7vsd_system",
+ "l7vsd_system.memory",
+ "l7vsd_system.socket",
+ "l7vsd_system.signal",
+ "l7vsd_environment",
+ "l7vsd_environment.parameter",
+ "l7vsd_logger",
+ "l7vsd_parameter",
+ "l7vsd_event",
+ "l7vsd_schedule",
+ "l7vsd_program",
+ "l7vsd_protocol",
+ "l7vsd_module",
+ "l7vsadm_parse",
+ "l7vsadm_operate",
+ "l7vsadm_communicate",
+ "l7vsadm_config_result",
+ "l7vsadm_common",
+ "l7vsadm_logger",
+ "l7vsadm_parameter",
+ "l7vsadm_protocol",
+ "l7vsadm_module",
+ "snmpagent_start_stop",
+ "snmpagent_manager_receive",
+ "snmpagent_manager_send",
+ "snmpagent_l7vsd_receive",
+ "snmpagent_l7vsd_send",
+ "snmpagent_logger",
+ "snmpagent_parameter"
+ };
+
+//! for transration between string and LOGGER_CATEGORY_TAG
+log4cxx::LevelPtr l7vs::LoggerImpl::levelTable[LOGGER_LEVEL_NUM];
+
+/*!
+ * returns single instance.
+ *
+ * @param void
+ * @return instance
+ */
+l7vs::LoggerImpl& l7vs::LoggerImpl::getInstance()
+{
+ if (!instance) {
+ instance = new LoggerImpl;
+ }
+ return *instance;
+}
+
+//! static Logger instance pointer initialized by 0.
+l7vs::LoggerImpl* l7vs::LoggerImpl::instance = 0;
+
+/*!
+ * initialize function.
+ * logger initialized to use syslogappender and fileappender(/dev/console)
+ *
+ * @param void
+ * @retval true succeed
+ * @retval false failed
+ */
+bool l7vs::LoggerImpl::init()
+{
+ int ret = 0;
+ if (initialized) return false;
+
+ try {
+ log4cxx::LoggerPtr root = log4cxx::Logger::getRootLogger();
+ if (0 == root) {
+ return false;
+ }
+ log4cxx::LayoutPtr layout =
+ new log4cxx::PatternLayout(LOGGER_LAYOUT);
+ log4cxx::net::SyslogAppenderPtr syslogAppender =
+ new log4cxx::net::SyslogAppender(layout, log4cxx::net::SyslogAppender::getFacility(LOGGER_SYSLOG_FACILITY));
+ root->addAppender(syslogAppender);
+ log4cxx::WriterAppender* consoleAppender =
+ new log4cxx::ConsoleAppender( layout, log4cxx::ConsoleAppender::getSystemErr() );
+ root->addAppender(consoleAppender);
+
+ for (LOG_CATEGORY_TAG cat = LOG_CAT_NONE; cat <= getCategoryRangeEnd(LOG_MOD_SNMPAGENT); ++cat) {
+ log4cxx::Logger::getLogger(categoryTable[cat])->setLevel(categoryLevel[cat]);
+ }
+ }
+ catch (const std::exception& e) {
+ std::ostringstream oss;
+ oss << "Logger Initialization Failed : " << e.what();
+ errorConf(6, oss.str(), __FILE__, __LINE__);
+ return false;
+ }
+
+ ret = gethostname(hostname, HOST_NAME_LEN);
+ if (0 > ret) {
+ if (LOG_LV_WARN >= this->getLogLevel(loggerCategory)) {
+ this->putLogWarn(loggerCategory,1, "Fail to get Hostname", __FILE__, __LINE__);
+ }
+ }
+
+ if (LOG_LV_INFO >= this->getLogLevel(loggerCategory)) {
+ this->putLogInfo(loggerCategory,1, "Logger Initialized.", __FILE__, __LINE__);
+ }
+
+ initialized = true;
+ return true;
+}
+
+/*!
+ * error handling function.
+ * if error occured, switch appenders to syslogappender and fileappender(/dev/console)
+ * message will output to syslog/fileappender appender
+ *
+ * @param log message id
+ * @param log message
+ * @param current file
+ * @param current line
+ * @return void
+ */
+void l7vs::LoggerImpl::errorConf(unsigned int message_id, const std::string& errorMessage, const char* file, int line)
+{
+ try {
+ log4cxx::LogManager::resetConfiguration();
+ log4cxx::LoggerPtr root = log4cxx::Logger::getRootLogger();
+ if (0 == root)
+ return;
+ log4cxx::LayoutPtr layout =
+ new log4cxx::PatternLayout(LOGGER_LAYOUT);
+ log4cxx::net::SyslogAppenderPtr syslogAppender =
+ new log4cxx::net::SyslogAppender(layout, log4cxx::net::SyslogAppender::getFacility(LOGGER_SYSLOG_FACILITY));
+ log4cxx::ConsoleAppender* consoleAppender = new log4cxx::ConsoleAppender(layout, log4cxx::ConsoleAppender::getSystemErr() );
+ root->addAppender(consoleAppender);
+ root->addAppender(syslogAppender);
+
+ for (LOG_CATEGORY_TAG cat = LOG_CAT_NONE; cat <= getCategoryRangeEnd(LOG_MOD_SNMPAGENT); ++cat) {
+ log4cxx::Logger::getLogger(categoryTable[cat])->setLevel(categoryLevel[cat]);
+ }
+
+ char buf[BUF_LEN];
+ snprintf(buf, BUF_LEN, "%s%d%03d%04d %s %s", LOGGER_PROCESS_ID, LOG_LV_FATAL, loggerCategory, message_id, errorMessage.c_str(), hostname);
+ log4cxx::Logger::getLogger(categoryTable[loggerCategory])->forcedLog(log4cxx::Level::getFatal(), buf, log4cxx::spi::LocationInfo(file, "", line));
+ }
+ catch (const std::exception& e) {
+ std::ostringstream oss;
+ oss << "Logger Error Output Failed : " << e.what() << "\n";
+ fputs(oss.str().c_str(), stderr);
+ }
+}
+
+/*!
+ * load the logger parameter.
+ * get settings from parameter component, and configure log4cxx property
+ *
+ * @param void
+ * @return void
+ */
+void l7vs::LoggerImpl::loadConf()
+{
+ std::string ret;
+
+ //get log filename
+ if (l7vs::Parameter::getInstance().isStringExist(PARAM_COMP_LOGGER, LOGGER_LOG_FILENAME_KEY)) {
+ logFilename = l7vs::Parameter::getInstance().getStringValue(PARAM_COMP_LOGGER, LOGGER_LOG_FILENAME_KEY);
+ }
+ else {
+ if (LOG_LV_ERROR >= this->getLogLevel(loggerCategory)) {
+ this->putLogError(loggerCategory,1, "Not Exist Log Filename Setting.", __FILE__, __LINE__);
+ }
+ throw std::logic_error("Not Exist Log Filename Setting.");
+ }
+
+ //get rotation
+ if (l7vs::Parameter::getInstance().isStringExist(PARAM_COMP_LOGGER, LOGGER_ROTATION_KEY)) {
+ std::string rotationStr = l7vs::Parameter::getInstance().getStringValue(PARAM_COMP_LOGGER, LOGGER_ROTATION_KEY);
+ if ("size" == rotationStr) rotation = LOG_ROT_SIZE;
+ else if ("date" == rotationStr) rotation = LOG_ROT_DATE;
+ else if ("datesize" == rotationStr) rotation = LOG_ROT_DATESIZE;
+ else {
+ if (LOG_LV_ERROR >= this->getLogLevel(loggerCategory)) {
+ this->putLogError(loggerCategory,2, "Invalid Log Rotation Setting.", __FILE__, __LINE__);
+ }
+ throw std::logic_error("Invalid Log Rotation Setting.");
+ }
+ }
+ else {
+ if (LOG_LV_ERROR >= this->getLogLevel(loggerCategory)) {
+ this->putLogError(loggerCategory,3, "Not Exist Log Rotation Setting.", __FILE__, __LINE__);
+ }
+ throw std::logic_error("Not Exist Log Rotation Setting.");
+ }
+
+ //get max backup index
+ if (l7vs::Parameter::getInstance().isStringExist(PARAM_COMP_LOGGER, LOGGER_MAX_BACKUP_INDEX_KEY)) {
+ std::string maxBackupIndexStr = l7vs::Parameter::getInstance().getStringValue(PARAM_COMP_LOGGER, LOGGER_MAX_BACKUP_INDEX_KEY);
+ try {
+ maxBackupIndex = lexical_cast<unsigned int>(maxBackupIndexStr);
+ }
+ catch (const l7vs::bad_lexical_cast& bc) {
+ if (LOG_LV_ERROR >= this->getLogLevel(loggerCategory)) {
+ this->putLogError(loggerCategory,4, "Invalid MaxBackupIndex Value.", __FILE__, __LINE__);
+ }
+ throw std::logic_error("Invalid MaxBackupIndex Value.");
+ }
+ if (LOGGER_BACKUP_INDEX_LOWER_LIMIT > maxBackupIndex) {
+ std::ostringstream oss;
+ oss << "Max Backup Index must at least " << LOGGER_BACKUP_INDEX_LOWER_LIMIT << ".";
+ if (LOG_LV_ERROR >= this->getLogLevel(loggerCategory)) {
+ this->putLogError(loggerCategory,5, oss.str(), __FILE__, __LINE__);
+ }
+ throw std::logic_error(oss.str());
+ }
+ if (LOGGER_BACKUP_INDEX_LIMIT < maxBackupIndex) {
+ std::ostringstream oss;
+ oss << "Max Backup Index must at most " << LOGGER_BACKUP_INDEX_LIMIT << ".";
+ if (LOG_LV_ERROR >= this->getLogLevel(loggerCategory)) {
+ this->putLogError(loggerCategory,6, oss.str(), __FILE__, __LINE__);
+ }
+ throw std::logic_error(oss.str());
+ }
+ }
+ else {
+ if (LOG_LV_ERROR >= this->getLogLevel(loggerCategory)) {
+ this->putLogError(loggerCategory,7, "Not Exist Log MaxBackupIndex Setting.", __FILE__, __LINE__);
+ }
+ throw std::logic_error("Not Exist Log MaxBackupIndex Setting.");
+ }
+
+ if (LOG_ROT_SIZE == rotation || LOG_ROT_DATESIZE == rotation) {
+ // get max file size
+ std::string maxFileSizeStr;
+ if (l7vs::Parameter::getInstance().isStringExist(PARAM_COMP_LOGGER, LOGGER_MAX_FILE_SIZE_KEY)) {
+ maxFileSizeStr = l7vs::Parameter::getInstance().getStringValue(PARAM_COMP_LOGGER, LOGGER_MAX_FILE_SIZE_KEY);
+ }
+ else {
+ if (LOG_LV_ERROR >= this->getLogLevel(loggerCategory)) {
+ this->putLogError(loggerCategory,8, "Not Exist Log MaxFileSize Setting.", __FILE__, __LINE__);
+ }
+ throw std::logic_error("Not Exist Log MaxFileSize Setting.");
+ }
+
+ std::string size_val;
+ std::string last_str = maxFileSizeStr.substr(maxFileSizeStr.length() - 1, 1);
+ // when unit was specified
+ if (("K" == last_str) || ("M" == last_str) || ("G" == last_str)) {
+ size_val = maxFileSizeStr.substr(0, maxFileSizeStr.length() - 1);
+ }
+ else {
+ size_val = maxFileSizeStr;
+ }
+
+ try {
+ maxFileSize = lexical_cast<size_t>(size_val);
+ }
+ catch (const l7vs::bad_lexical_cast& bc) {
+ if (LOG_LV_ERROR >= this->getLogLevel(loggerCategory)) {
+ this->putLogError(loggerCategory,9, "Invalid FileSize Value.", __FILE__, __LINE__);
+ }
+ throw std::logic_error("Invalid FileSize Value.");
+ }
+
+ if ("K" == last_str) {
+ if ((ULLONG_MAX / 1024) < maxFileSize) {
+ if (LOG_LV_ERROR >= this->getLogLevel(loggerCategory)) {
+ this->putLogError(loggerCategory,10, "Invalid FileSize Value.", __FILE__, __LINE__);
+ }
+ throw std::logic_error("Invalid FileSize Value.");
+ }
+ maxFileSize = maxFileSize * 1024;
+ }
+ else if ("M" == last_str) {
+ if ((ULLONG_MAX / 1024 / 1024) < maxFileSize) {
+ if (LOG_LV_ERROR >= this->getLogLevel(loggerCategory)) {
+ this->putLogError(loggerCategory,11, "Invalid FileSize Value.", __FILE__, __LINE__);
+ }
+ throw std::logic_error("Invalid FileSize Value.");
+ }
+ maxFileSize = maxFileSize * 1024 * 1024;
+ }
+ else if ("G" == last_str) {
+ if ((ULLONG_MAX / 1024 / 1024 / 1024) < maxFileSize) {
+ if (LOG_LV_ERROR >= this->getLogLevel(loggerCategory)) {
+ this->putLogError(loggerCategory,12, "Invalid FileSize Value.", __FILE__, __LINE__);
+ }
+ throw std::logic_error("Invalid FileSize Value.");
+ }
+ maxFileSize = maxFileSize * 1024 * 1024 * 1024;
+ }
+ if (LOGGER_FILESIZE_LOWER_LIMIT > maxFileSize) {
+ int limit = LOGGER_FILESIZE_LOWER_LIMIT;
+ std::ostringstream oss;
+ oss << "FileSize must at least " << limit << " bytes.";
+ if (LOG_LV_ERROR >= this->getLogLevel(loggerCategory)) {
+ this->putLogError(loggerCategory,13, oss.str(), __FILE__, __LINE__);
+ }
+ throw std::logic_error(oss.str());
+ }
+ }
+
+ if (LOG_ROT_DATE == rotation || LOG_ROT_DATESIZE == rotation) {
+ // get rotation timing
+ if (l7vs::Parameter::getInstance().isStringExist(PARAM_COMP_LOGGER, LOGGER_ROTATION_TIMING_KEY)) {
+ std::string rotationTimingStr = l7vs::Parameter::getInstance().getStringValue(PARAM_COMP_LOGGER, LOGGER_ROTATION_TIMING_KEY);
+ if ("year" == rotationTimingStr) rotationTiming = LOG_TIM_YEAR;
+ else if ("month" == rotationTimingStr) rotationTiming = LOG_TIM_MONTH;
+ else if ("week" == rotationTimingStr) rotationTiming = LOG_TIM_WEEK;
+ else if ("date" == rotationTimingStr) rotationTiming = LOG_TIM_DATE;
+ else if ("hour" == rotationTimingStr) rotationTiming = LOG_TIM_HOUR;
+ else {
+ if (LOG_LV_ERROR >= this->getLogLevel(loggerCategory)) {
+ this->putLogError(loggerCategory,14, "Invalid Log RotationTiming Setting.", __FILE__, __LINE__);
+ }
+ throw std::logic_error("Invalid Log RotationTiming Setting.");
+ }
+ }
+ else {
+ if (LOG_LV_ERROR >= this->getLogLevel(loggerCategory)) {
+ this->putLogError(loggerCategory,15, "Not Exist Log RotaionTiming Setting.", __FILE__, __LINE__);
+ }
+ throw std::logic_error("Not Exist Log RotaionTiming Setting.");
+ }
+
+ if (LOG_TIM_YEAR == rotationTiming) {
+ if (l7vs::Parameter::getInstance().isStringExist(PARAM_COMP_LOGGER, LOGGER_ROTATION_TIMING_VALUE_KEY)) {
+ ret = l7vs::Parameter::getInstance().getStringValue(PARAM_COMP_LOGGER, LOGGER_ROTATION_TIMING_VALUE_KEY);
+
+ std::string::size_type fpos = 0;
+ std::string::size_type rpos = 0;
+ int month = 0;
+ int date = 0;
+ int hour = 0;
+ int minute = 0;
+ // find month
+ rpos = ret.find_first_of('/', fpos);
+ if (std::string::npos != rpos) {
+ std::string monthStr = ret.substr(fpos, rpos - fpos);
+ try {
+ month = lexical_cast<int>(monthStr);
+ }
+ catch (const l7vs::bad_lexical_cast& bc) {
+ if (LOG_LV_ERROR >= this->getLogLevel(loggerCategory)) {
+ this->putLogError(loggerCategory,16, "Parse Timing Year Error.", __FILE__, __LINE__);
+ }
+ throw std::logic_error("Parse Timing Year Error.");
+ }
+ if (1 > month || month > 12) {
+ if (LOG_LV_ERROR >= this->getLogLevel(loggerCategory)) {
+ this->putLogError(loggerCategory,17, "Parse Timing Year Error.", __FILE__, __LINE__);
+ }
+ throw std::logic_error("Parse Timing Year Error.");
+ }
+ fpos = rpos + 1;
+ // find date
+ rpos = ret.find_first_of(' ', fpos);
+ if (std::string::npos != rpos) {
+ std::string dateStr = ret.substr(fpos, rpos - fpos);
+ try {
+ date = lexical_cast<int>(dateStr);
+ }
+ catch (const l7vs::bad_lexical_cast& bc) {
+ if (LOG_LV_ERROR >= this->getLogLevel(loggerCategory)) {
+ this->putLogError(loggerCategory,18, "Parse Timing Year Error.", __FILE__, __LINE__);
+ }
+ throw std::logic_error("Parse Timing Year Error.");
+ }
+ if (1 > date || date > 31) {
+ if (LOG_LV_ERROR >= this->getLogLevel(loggerCategory)) {
+ this->putLogError(loggerCategory,19, "Parse Timing Year Error.", __FILE__, __LINE__);
+ }
+ throw std::logic_error("Parse Timing Year Error.");
+ }
+ int dates[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
+ if (date > dates[month - 1]) {
+ if (LOG_LV_ERROR >= this->getLogLevel(loggerCategory)) {
+ this->putLogError(loggerCategory,20, "Parse Timing Year Error.", __FILE__, __LINE__);
+ }
+ throw std::logic_error("Parse Timing Year Error.");
+ }
+ fpos = rpos + 1;
+ // find hour
+ rpos = ret.find_first_of(':', fpos);
+ if (std::string::npos != rpos) {
+ std::string hourStr = ret.substr(fpos, rpos - fpos);
+ try {
+ hour = lexical_cast<int>(hourStr);
+ }
+ catch (const l7vs::bad_lexical_cast& bc) {
+ if (LOG_LV_ERROR >= this->getLogLevel(loggerCategory)) {
+ this->putLogError(loggerCategory,21, "Parse Timing Year Error.", __FILE__, __LINE__);
+ }
+ throw std::logic_error("Parse Timing Year Error.");
+ }
+ if (0 > hour || hour > 23) {
+ if (LOG_LV_ERROR >= this->getLogLevel(loggerCategory)) {
+ this->putLogError(loggerCategory,22, "Parse Timing Year Error.", __FILE__, __LINE__);
+ }
+ throw std::logic_error("Parse Timing Year Error.");
+ }
+ // minute
+ std::string minuteStr = ret.substr(rpos + 1);
+ try {
+ minute = lexical_cast<int>(minuteStr);
+ }
+ catch (const l7vs::bad_lexical_cast& bc) {
+ if (LOG_LV_ERROR >= this->getLogLevel(loggerCategory)) {
+ this->putLogError(loggerCategory,23, "Parse Timing Year Error.", __FILE__, __LINE__);
+ }
+ throw std::logic_error("Parse Timing Year Error.");
+ }
+ if (0 > minute || minute > 59) {
+ if (LOG_LV_ERROR >= this->getLogLevel(loggerCategory)) {
+ this->putLogError(loggerCategory,24, "Parse Timing Year Error.", __FILE__, __LINE__);
+ }
+ throw std::logic_error("Parse Timing Year Error.");
+ }
+ }
+ else {
+ if (LOG_LV_ERROR >= this->getLogLevel(loggerCategory)) {
+ this->putLogError(loggerCategory,25, "Parse Timing Year Error.", __FILE__, __LINE__);
+ }
+ throw std::logic_error("Parse Timing Year Error.");
+ }
+ }
+ else {
+ if (LOG_LV_ERROR >= this->getLogLevel(loggerCategory)) {
+ this->putLogError(loggerCategory,26, "Parse Timing Year Error.", __FILE__, __LINE__);
+ }
+ throw std::logic_error("Parse Timing Year Error.");
+ }
+ }
+ else {
+ if (LOG_LV_ERROR >= this->getLogLevel(loggerCategory)) {
+ this->putLogError(loggerCategory,27, "Parse Timing Year Error.", __FILE__, __LINE__);
+ }
+ throw std::logic_error("Parse Timing Year Error.");
+ }
+
+ // format to internal rotation timing value expresson
+ std::ostringstream oss;
+ oss << std::setfill('0') << std::setw(2) << month
+ << std::setfill('0') << std::setw(2) << date
+ << std::setfill('0') << std::setw(2) << hour
+ << std::setfill('0') << std::setw(2) << minute;
+
+ rotationTimingValue = oss.str();
+
+ }
+ else {
+ if (LOG_LV_ERROR >= this->getLogLevel(loggerCategory)) {
+ this->putLogError(loggerCategory,28, "Not Exist Log RotaionTiming Year Setting.", __FILE__, __LINE__);
+ }
+ throw std::logic_error("Not Exist Log RotaionTiming Year Setting.");
+ }
+ }
+
+ if (LOG_TIM_MONTH == rotationTiming) {
+ if (l7vs::Parameter::getInstance().isStringExist(PARAM_COMP_LOGGER, LOGGER_ROTATION_TIMING_VALUE_KEY)) {
+ ret = l7vs::Parameter::getInstance().getStringValue(PARAM_COMP_LOGGER, LOGGER_ROTATION_TIMING_VALUE_KEY);
+
+ std::string::size_type fpos = 0;
+ std::string::size_type rpos = 0;
+ int date = 0;
+ int hour = 0;
+ int minute = 0;
+ // find day
+ rpos = ret.find_first_of(' ', fpos);
+ if (std::string::npos != rpos) {
+ std::string dateStr = ret.substr(fpos, rpos - fpos);
+ try {
+ date = lexical_cast<int>(dateStr);
+ }
+ catch (const l7vs::bad_lexical_cast& bc) {
+ if (LOG_LV_ERROR >= this->getLogLevel(loggerCategory)) {
+ this->putLogError(loggerCategory,29, "Parse Timing Month Error.", __FILE__, __LINE__);
+ }
+ throw std::logic_error("Parse Timing Month Error.");
+ }
+ if (1 > date || date > 31) {
+ if (LOG_LV_ERROR >= this->getLogLevel(loggerCategory)) {
+ this->putLogError(loggerCategory,30, "Parse Timing Month Error.", __FILE__, __LINE__);
+ }
+ throw std::logic_error("Parse Timing Month Error.");
+ }
+ fpos = rpos + 1;
+ // find hour
+ rpos = ret.find_first_of(':', fpos);
+ if (std::string::npos != rpos) {
+ std::string hourStr = ret.substr(fpos, rpos - fpos);
+ try {
+ hour = lexical_cast<int>(hourStr);
+ }
+ catch (const l7vs::bad_lexical_cast& bc) {
+ if (LOG_LV_ERROR >= this->getLogLevel(loggerCategory)) {
+ this->putLogError(loggerCategory,31, "Parse Timing Month Error.", __FILE__, __LINE__);
+ }
+ throw std::logic_error("Parse Timing Month Error.");
+ }
+ if (0 > hour || hour > 23) {
+ if (LOG_LV_ERROR >= this->getLogLevel(loggerCategory)) {
+ this->putLogError(loggerCategory,32, "Parse Timing Month Error.", __FILE__, __LINE__);
+ }
+ throw std::logic_error("Parse Timing Month Error.");
+ }
+ // minute
+ std::string minuteStr = ret.substr(rpos + 1);
+ try {
+ minute = lexical_cast<int>(minuteStr);
+ }
+ catch (const l7vs::bad_lexical_cast& bc) {
+ if (LOG_LV_ERROR >= this->getLogLevel(loggerCategory)) {
+ this->putLogError(loggerCategory,33, "Parse Timing Month Error.", __FILE__, __LINE__);
+ }
+ throw std::logic_error("Parse Timing Month Error.");
+ }
+ if (0 > minute || minute > 59) {
+ if (LOG_LV_ERROR >= this->getLogLevel(loggerCategory)) {
+ this->putLogError(loggerCategory,34, "Parse Timing Month Error.", __FILE__, __LINE__);
+ }
+ throw std::logic_error("Parse Timing Month Error.");
+ }
+ }
+ else {
+ if (LOG_LV_ERROR >= this->getLogLevel(loggerCategory)) {
+ this->putLogError(loggerCategory,35, "Parse Timing Month Error.", __FILE__, __LINE__);
+ }
+ throw std::logic_error("Parse Timing Month Error.");
+ }
+ }
+ else {
+ if (LOG_LV_ERROR >= this->getLogLevel(loggerCategory)) {
+ this->putLogError(loggerCategory,36, "Parse Timing Month Error.", __FILE__, __LINE__);
+ }
+ throw std::logic_error("Parse Timing Month Error.");
+ }
+
+ // format to internal rotation timing value expresson
+ std::ostringstream oss;
+ oss << std::setfill('0') << std::setw(2) << date
+ << std::setfill('0') << std::setw(2) << hour
+ << std::setfill('0') << std::setw(2) << minute;
+
+ rotationTimingValue = oss.str();
+
+ }
+ else {
+ if (LOG_LV_ERROR >= this->getLogLevel(loggerCategory)) {
+ this->putLogError(loggerCategory,37, "Not Exist Log RotaionTiming Month Setting.", __FILE__, __LINE__);
+ }
+ throw std::logic_error("Not Exist Log RotaionTiming Month Setting.");
+ }
+ }
+
+ if (LOG_TIM_WEEK == rotationTiming) {
+ if (l7vs::Parameter::getInstance().isStringExist(PARAM_COMP_LOGGER, LOGGER_ROTATION_TIMING_VALUE_KEY)) {
+ ret = l7vs::Parameter::getInstance().getStringValue(PARAM_COMP_LOGGER, LOGGER_ROTATION_TIMING_VALUE_KEY);
+
+ std::string::size_type fpos = 0;
+ std::string::size_type rpos = 0;
+ int week = 0;
+ int hour = 0;
+ int minute = 0;
+ rpos = ret.find_first_of(' ', fpos);
+ //find week
+ if (std::string::npos != rpos) {
+ std::string weekStr = ret.substr(fpos, rpos - fpos);
+
+ if ("sun" == weekStr) week = 0;
+ else if ("mon" == weekStr) week = 1;
+ else if ("tue" == weekStr) week = 2;
+ else if ("wed" == weekStr) week = 3;
+ else if ("thu" == weekStr) week = 4;
+ else if ("fri" == weekStr) week = 5;
+ else if ("sat" == weekStr) week = 6;
+ else {
+ if (LOG_LV_ERROR >= this->getLogLevel(loggerCategory)) {
+ this->putLogError(loggerCategory,38, "Parse Timing Week Error.", __FILE__, __LINE__);
+ }
+ throw std::logic_error("Parse Timing Week Error.");
+ }
+ fpos = rpos + 1;
+ // find hour
+ rpos = ret.find_first_of(':', fpos);
+ if (std::string::npos != rpos) {
+ std::string hourStr = ret.substr(fpos, rpos - fpos);
+ try {
+ hour = lexical_cast<int>(hourStr);
+ }
+ catch (const l7vs::bad_lexical_cast& bc) {
+ if (LOG_LV_ERROR >= this->getLogLevel(loggerCategory)) {
+ this->putLogError(loggerCategory,39, "Parse Timing Week Error.", __FILE__, __LINE__);
+ }
+ throw std::logic_error("Parse Timing Week Error.");
+ }
+ if (0 > hour || hour > 23) {
+ if (LOG_LV_ERROR >= this->getLogLevel(loggerCategory)) {
+ this->putLogError(loggerCategory,40, "Parse Timing Week Error.", __FILE__, __LINE__);
+ }
+ throw std::logic_error("Parse Timing Week Error.");
+ }
+ // minute
+ std::string minuteStr = ret.substr(rpos + 1);
+ try {
+ minute = lexical_cast<int>(minuteStr);
+ }
+ catch (const l7vs::bad_lexical_cast& bc) {
+ if (LOG_LV_ERROR >= this->getLogLevel(loggerCategory)) {
+ this->putLogError(loggerCategory,41, "Parse Timing Week Error.", __FILE__, __LINE__);
+ }
+ throw std::logic_error("Parse Timing Week Error.");
+ }
+ if (0 > minute || minute > 59) {
+ if (LOG_LV_ERROR >= this->getLogLevel(loggerCategory)) {
+ this->putLogError(loggerCategory,42, "Parse Timing Week Error.", __FILE__, __LINE__);
+ }
+ throw std::logic_error("Parse Timing Week Error.");
+ }
+ }
+ else {
+ if (LOG_LV_ERROR >= this->getLogLevel(loggerCategory)) {
+ this->putLogError(loggerCategory,43, "Parse Timing Week Error.", __FILE__, __LINE__);
+ }
+ throw std::logic_error("Parse Timing Week Error.");
+ }
+ }
+ else {
+ if (LOG_LV_ERROR >= this->getLogLevel(loggerCategory)) {
+ this->putLogError(loggerCategory,44, "Parse Timing Week Error.", __FILE__, __LINE__);
+ }
+ throw std::logic_error("Parse Timing Week Error.");
+ }
+
+ // format to internal rotation timing value expresson
+ std::ostringstream oss;
+ oss << std::setfill('0') << std::setw(1) << week
+ << std::setfill('0') << std::setw(2) << hour
+ << std::setfill('0') << std::setw(2) << minute;
+
+ rotationTimingValue = oss.str();
+
+ }
+ else {
+ if (LOG_LV_ERROR >= this->getLogLevel(loggerCategory)) {
+ this->putLogError(loggerCategory,45, "Not Exist Log RotaionTiming Week Setting.", __FILE__, __LINE__);
+ }
+ throw std::logic_error("Not Exist Log RotaionTiming Week Setting.");
+ }
+ }
+
+ if (LOG_TIM_DATE == rotationTiming) {
+ if (l7vs::Parameter::getInstance().isStringExist(PARAM_COMP_LOGGER, LOGGER_ROTATION_TIMING_VALUE_KEY)) {
+ ret = l7vs::Parameter::getInstance().getStringValue(PARAM_COMP_LOGGER, LOGGER_ROTATION_TIMING_VALUE_KEY);
+
+ std::string::size_type fpos = 0;
+ std::string::size_type rpos = 0;
+ int hour = 0;
+ int minute = 0;
+ //find time
+ rpos = ret.find_first_of(':', fpos);
+ if (std::string::npos != rpos) {
+ std::string hourStr = ret.substr(fpos, rpos - fpos);
+ try {
+ hour = lexical_cast<int>(hourStr);
+ }
+ catch (const l7vs::bad_lexical_cast& bc) {
+ if (LOG_LV_ERROR >= this->getLogLevel(loggerCategory)) {
+ this->putLogError(loggerCategory,46, "Parse Timing Date Error.", __FILE__, __LINE__);
+ }
+ throw std::logic_error("Parse Timing Date Error.");
+ }
+ if (0 > hour || hour > 23) {
+ if (LOG_LV_ERROR >= this->getLogLevel(loggerCategory)) {
+ this->putLogError(loggerCategory,47, "Parse Timing Date Error.", __FILE__, __LINE__);
+ }
+ throw std::logic_error("Parse Timing Date Error.");
+ }
+ // minute
+ std::string minuteStr = ret.substr(rpos + 1);
+ try {
+ minute = lexical_cast<int>(minuteStr);
+ }
+ catch (const l7vs::bad_lexical_cast& bc) {
+ if (LOG_LV_ERROR >= this->getLogLevel(loggerCategory)) {
+ this->putLogError(loggerCategory,48, "Parse Timing Date Error.", __FILE__, __LINE__);
+ }
+ throw std::logic_error("Parse Timing Date Error.");
+ }
+ if (0 > minute || minute > 59) {
+ if (LOG_LV_ERROR >= this->getLogLevel(loggerCategory)) {
+ this->putLogError(loggerCategory,49, "Parse Timing Date Error.", __FILE__, __LINE__);
+ }
+ throw std::logic_error("Parse Timing Date Error.");
+ }
+ }
+ else {
+ if (LOG_LV_ERROR >= this->getLogLevel(loggerCategory)) {
+ this->putLogError(loggerCategory,50, "Parse Timing Date Error.", __FILE__, __LINE__);
+ }
+ throw std::logic_error("Parse Timing Date Error.");
+ }
+
+ // format to internal rotation timing value expresson
+ std::ostringstream oss;
+ oss << std::setfill('0') << std::setw(2) << hour
+ << std::setfill('0') << std::setw(2) << minute;
+
+ rotationTimingValue = oss.str();
+
+ }
+ else {
+ if (LOG_LV_ERROR >= this->getLogLevel(loggerCategory)) {
+ this->putLogError(loggerCategory,51, "Not Exist Log RotaionTiming Date Setting.", __FILE__, __LINE__);
+ }
+ throw std::logic_error("Not Exist Log RotaionTiming Date Setting.");
+ }
+ }
+
+ if (LOG_TIM_HOUR == rotationTiming) {
+ if (l7vs::Parameter::getInstance().isStringExist(PARAM_COMP_LOGGER, LOGGER_ROTATION_TIMING_VALUE_KEY)) {
+ ret = l7vs::Parameter::getInstance().getStringValue(PARAM_COMP_LOGGER, LOGGER_ROTATION_TIMING_VALUE_KEY);
+
+ // minute
+ int minute = 0;
+ try {
+ minute = lexical_cast<int>(ret);
+ }
+ catch (const l7vs::bad_lexical_cast& bc) {
+ if (LOG_LV_ERROR >= this->getLogLevel(loggerCategory)) {
+ this->putLogError(loggerCategory,52, "Parse Timing Hour Error.", __FILE__, __LINE__);
+ }
+ throw std::logic_error("Parse Timing Hour Error.");
+ }
+ if (0 > minute || minute > 59) {
+ if (LOG_LV_ERROR >= this->getLogLevel(loggerCategory)) {
+ this->putLogError(loggerCategory,53, "Parse Timing Hour Error.", __FILE__, __LINE__);
+ }
+ throw std::logic_error("Parse Timing Hour Error.");
+ }
+
+ // format to internal rotation timing value expresson
+ std::ostringstream oss;
+ oss << std::setfill('0') << std::setw(2) << minute;
+
+ rotationTimingValue = oss.str();
+
+ }
+ else {
+ if (LOG_LV_ERROR >= this->getLogLevel(loggerCategory)) {
+ this->putLogError(loggerCategory,54, "Not Exist Log RotaionTiming Hour Setting.", __FILE__, __LINE__);
+ }
+ throw std::logic_error("Not Exist Log RotaionTiming Hour Setting.");
+ }
+ }
+ }
+
+ try {
+ // reset current configuration
+ log4cxx::helpers::Pool pool;
+ log4cxx::LogManager::resetConfiguration();
+ log4cxx::LoggerPtr root = log4cxx::Logger::getRootLogger();
+ if (0 == root) {
+ throw std::logic_error("getRootLogger Failed.");
+ }
+ log4cxx::LayoutPtr layout =
+ new log4cxx::PatternLayout(LOGGER_LAYOUT);
+
+ switch (rotation) {
+ case LOG_ROT_SIZE:
+ {
+ // create FixedWindowRollingPolicy
+ log4cxx::rolling::FixedWindowRollingPolicyPtr fixedRollingPolicy =
+ new log4cxx::rolling::FixedWindowRollingPolicy();
+
+ // setting minIndex
+ fixedRollingPolicy->setMinIndex(1);
+
+ // setting maxIndex
+ fixedRollingPolicy->setMaxIndex(maxBackupIndex);
+
+ // setting FileNamePattern
+ std::ostringstream sizeFile;
+ sizeFile << logFilename << "." << LOGGER_FILE_PATTERN;
+ fixedRollingPolicy->setFileNamePattern(sizeFile.str());
+
+ // create SizeBasedTriggeringPolicy
+ log4cxx::rolling::SizeBasedTriggeringPolicyPtr sizeTriggeringPolicy =
+ new log4cxx::rolling::SizeBasedTriggeringPolicy();
+
+ // setting maxFileSize
+ sizeTriggeringPolicy->setMaxFileSize(maxFileSize);
+
+ // create RollingFileAppender
+ log4cxx::rolling::RollingFileAppenderPtr sizeAppender =
+ new log4cxx::rolling::RollingFileAppender();
+
+ // set layout
+ sizeAppender->setLayout(layout);
+
+ // set RollingPolicy
+ sizeAppender->setRollingPolicy(fixedRollingPolicy);
+
+ // set TriggeringPolicy
+ sizeAppender->setTriggeringPolicy(sizeTriggeringPolicy);
+
+ // set Log Filename
+ sizeAppender->setFile(logFilename, true, false, LOGGER_DEFAULT_BUFFER_SIZE, pool);
+
+ // activate appender options
+ sizeAppender->activateOptions(pool);
+
+ // add size_base_appender to rootLogger
+ root->addAppender(sizeAppender);
+
+ break;
+ }
+ case LOG_ROT_DATE:
+ {
+ // create StrictTimeBasedRollingPolicy
+ log4cxx::rolling::StrictTimeBasedRollingPolicyPtr strictRollingPolicy =
+ new log4cxx::rolling::StrictTimeBasedRollingPolicy();
+
+ // setting minIndex
+ strictRollingPolicy->setMinIndex(1);
+
+ // setting maxIndex
+ strictRollingPolicy->setMaxIndex(maxBackupIndex);
+
+ // setting FileNamePattern
+ std::ostringstream dateFile;
+ dateFile << logFilename << "." << LOGGER_FILE_PATTERN;
+ strictRollingPolicy->setFileNamePattern(dateFile.str());
+
+ // setting Rotation Timing
+ strictRollingPolicy->setRotationTiming(rotationTiming);
+
+ // setting Rotation Timing Value
+ strictRollingPolicy->setRotationTimingValue(rotationTimingValue);
+
+ //create RollingFileAppender
+ log4cxx::rolling::RollingFileAppenderPtr dateAppender =
+ new log4cxx::rolling::RollingFileAppender();
+
+ // set layout
+ dateAppender->setLayout(layout);
+
+ // set RollingPolicy (TriggeringPolicy also included RollingPolicy)
+ dateAppender->setRollingPolicy(strictRollingPolicy);
+
+ // set Log Filename
+ dateAppender->setFile(logFilename, true, false, LOGGER_DEFAULT_BUFFER_SIZE, pool);
+
+ // activate appender options
+ dateAppender->activateOptions(pool);
+
+ // add date_based_appender to rootRogger
+ root->addAppender(dateAppender);
+
+ break;
+ }
+ default: //LOG_ROT_DATESIZE:
+ {
+ // create TimeAndSizeBasedRollingPolicy
+ log4cxx::rolling::TimeAndSizeBasedRollingPolicyPtr timeSizeRollingPolicy =
+ new log4cxx::rolling::TimeAndSizeBasedRollingPolicy();
+
+ // setting minIndex
+ timeSizeRollingPolicy->setMinIndex(1);
+
+ // setting maxIndex
+ timeSizeRollingPolicy->setMaxIndex(maxBackupIndex);
+
+ // setting FileNamePattern
+ std::ostringstream dateSizeFile;
+ dateSizeFile << logFilename << "." << LOGGER_FILE_PATTERN;
+ timeSizeRollingPolicy->setFileNamePattern(dateSizeFile.str());
+
+ // setting Rotation Timing
+ timeSizeRollingPolicy->setRotationTiming(rotationTiming);
+
+ // setting Rotation Timing Value
+ timeSizeRollingPolicy->setRotationTimingValue(rotationTimingValue);
+
+ // setting MaxFileSize
+ timeSizeRollingPolicy->setMaxFileSize(maxFileSize);
+
+ // create Rolling FileAppender
+ log4cxx::rolling::RollingFileAppenderPtr dateSizeAppender =
+ new log4cxx::rolling::RollingFileAppender();
+
+ // set layout
+ dateSizeAppender->setLayout(layout);
+
+ // set RollingPolicy (TriggeringPolicy also included RollingPolicy)
+ dateSizeAppender->setRollingPolicy(timeSizeRollingPolicy);
+
+ // set Log Filename
+ dateSizeAppender->setFile(logFilename, true, false, LOGGER_DEFAULT_BUFFER_SIZE, pool);
+
+ // activate appender options
+ dateSizeAppender->activateOptions(pool);
+
+ // add time_and_size_based_appender to rootLogger
+ root->addAppender(dateSizeAppender);
+ }
+ }
+ //set default log level
+ for (LOG_CATEGORY_TAG cat = LOG_CAT_NONE; cat <= getCategoryRangeEnd(LOG_MOD_SNMPAGENT); ++cat) {
+ log4cxx::Logger::getLogger(categoryTable[cat])->setLevel(categoryLevel[cat]);
+ }
+
+ //get category level
+ for (LOG_CATEGORY_TAG cat = getCategoryRangeStart(loggerProcess); cat <= getCategoryRangeEnd(loggerProcess); ++cat) {
+ if (l7vs::Parameter::getInstance().isStringExist(PARAM_COMP_LOGGER, categoryTable[cat])) {
+ std::string levelStr = l7vs::Parameter::getInstance().getStringValue(PARAM_COMP_LOGGER, categoryTable[cat]);
+ if ("debug" == levelStr) {
+ categoryLevel[cat] = log4cxx::Level::getDebug();
+ log4cxx::Logger::getLogger(categoryTable[cat])->setLevel(categoryLevel[cat]);
+ }
+ else if ("info" == levelStr) {
+ categoryLevel[cat] = log4cxx::Level::getInfo();
+ log4cxx::Logger::getLogger(categoryTable[cat])->setLevel(categoryLevel[cat]);
+ }
+ else if ("warn" == levelStr) {
+ categoryLevel[cat] = log4cxx::Level::getWarn();
+ log4cxx::Logger::getLogger(categoryTable[cat])->setLevel(categoryLevel[cat]);
+ }
+ else if ("error" == levelStr) {
+ categoryLevel[cat] = log4cxx::Level::getError();
+ log4cxx::Logger::getLogger(categoryTable[cat])->setLevel(categoryLevel[cat]);
+ }
+ else if ("fatal" == levelStr) {
+ categoryLevel[cat] = log4cxx::Level::getFatal();
+ log4cxx::Logger::getLogger(categoryTable[cat])->setLevel(categoryLevel[cat]);
+ }
+ else {
+ std::ostringstream oss;
+ oss << "Invalid Log Category Setting : " << categoryTable[cat];
+ if (LOG_LV_WARN >= this->getLogLevel(loggerCategory)) {
+ this->putLogWarn(loggerCategory,2, oss.str(), __FILE__, __LINE__);
+ }
+ categoryLevel[cat] = log4cxx::Level::getInfo();
+ log4cxx::Logger::getLogger(categoryTable[cat])->setLevel(categoryLevel[cat]);
+ }
+ }
+ else {
+ std::ostringstream oss;
+ oss << "Not Exist Log Category Setting : " << categoryTable[cat];
+ if (LOG_LV_WARN >= this->getLogLevel(loggerCategory)) {
+ this->putLogWarn(loggerCategory,3, oss.str(), __FILE__, __LINE__);
+ }
+ categoryLevel[cat] = log4cxx::Level::getInfo();
+ log4cxx::Logger::getLogger(categoryTable[cat])->setLevel(categoryLevel[cat]);
+ }
+ }
+ }
+ catch (const std::exception& e) {
+ std::ostringstream oss;
+ oss << "Logger Reload Config Failed : " << e.what();
+ errorConf(7, oss.str(), __FILE__, __LINE__);
+ throw std::logic_error(oss.str());
+ }
+
+ if (LOG_LV_INFO >= this->getLogLevel(loggerCategory)) {
+ this->putLogInfo(loggerCategory,2, "Logger Configuration Succeed.", __FILE__, __LINE__);
+ }
+ initLogLevelTable();
+}
+
+/*!
+ * initialize LogLevel table.
+ * initialize the LogLevel table.
+ *
+ * @param void
+ * @return void
+ */
+void l7vs::LoggerImpl::initLogLevelTable(void)
+{
+ int nCounter = 0;
+
+ for (;nCounter < LOGGER_CATEGORY_NUM; nCounter++) {
+ loglevel[nCounter] = LOG_LV_NONE;
+ }
+
+ return;
+}
--- /dev/null
+/*
+ * @file logger_impl.h
+ * @brief logger module implementation class.
+ *
+ * L7VSD: Linux Virtual Server for Layer7 Load Balancing
+ * Copyright (C) 2008 NTT COMWARE Corporation.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ **********************************************************************/
+
+#ifndef __LOGGER_IMPL_H__
+#define __LOGGER_IMPL_H__
+
+#include <string>
+#include <map>
+#include <log4cxx/logger.h>
+#include <log4cxx/level.h>
+#include <log4cxx/net/syslogappender.h>
+#include <log4cxx/fileappender.h>
+#include <log4cxx/rollingfileappender.h>
+#include <log4cxx/patternlayout.h>
+#include "logger_enum.h"
+
+#define BUF_LEN (4096)
+#define LOGGER_LEVEL_NUM (6)
+#define LOGGER_CATEGORY_NUM (40)
+
+#if !defined(LOGGER_PROCESS_VSD) && !defined(LOGGER_PROCESS_ADM) && !defined(LOGGER_PROCESS_SNM)
+#define LOGGER_PROCESS_VSD
+#endif
+
+#if defined(LOGGER_PROCESS_VSD)
+#define LOGGER_PROCESS_ID "VSD"
+#elif defined(LOGGER_PROCESS_ADM)
+#define LOGGER_PROCESS_ID "ADM"
+#else
+#define LOGGER_PROCESS_ID "SNM"
+#endif
+
+#if defined(LOGGER_PROCESS_VSD)
+#include "l7vs_snmpbridge.h"
+#endif
+
+#define LOGGER_NULL "/dev/null"
+
+#define HOST_NAME_LEN (256)
+
+namespace log4cxx
+{
+ typedef helpers::ObjectPtrT<RollingFileAppender> RollingFileAppenderPtr;
+}
+
+namespace l7vs
+{
+ /*!
+ * Logger implement class.
+ * operate log4cxx library.
+ * this is singleton class.
+ */
+ class LoggerImpl
+ {
+ public:
+ //! returns current instance.
+ static LoggerImpl& getInstance();
+ protected:
+ //! default constructor initialize member variables.
+ LoggerImpl() : initialized(false), logFilename(""), rotation(LOG_ROT_SIZE), maxBackupIndex(0), maxFileSize(0), rotationTiming(LOG_TIM_YEAR), rotationTimingValue("")
+ {
+ levelTable[LOG_LV_NONE] = log4cxx::Level::getDebug();
+ levelTable[LOG_LV_DEBUG] = log4cxx::Level::getDebug();
+ levelTable[LOG_LV_INFO] = log4cxx::Level::getInfo();
+ levelTable[LOG_LV_WARN] = log4cxx::Level::getWarn();
+ levelTable[LOG_LV_ERROR] = log4cxx::Level::getError();
+ levelTable[LOG_LV_FATAL] = log4cxx::Level::getFatal();
+#if defined(LOGGER_PROCESS_VSD)
+ loggerCategory = LOG_CAT_L7VSD_LOGGER;
+ loggerProcess = LOG_MOD_L7VSD;
+ //set default log level
+ for (LOG_CATEGORY_TAG cat = LOG_CAT_NONE; cat <= getCategoryRangeEnd(LOG_MOD_SNMPAGENT); ++cat) {
+ categoryLevel[cat] = log4cxx::Level::getError();
+ }
+#elif defined(LOGGER_PROCESS_ADM)
+ loggerCategory = LOG_CAT_L7VSADM_LOGGER;
+ loggerProcess = LOG_MOD_L7VSADM;
+ //set default log level
+ for (LOG_CATEGORY_TAG cat = LOG_CAT_NONE; cat <= getCategoryRangeEnd(LOG_MOD_SNMPAGENT); ++cat) {
+ categoryLevel[cat] = log4cxx::Level::getError();
+ }
+#else //LOGGER_PROCESS_SNM
+ loggerCategory = LOG_CAT_SNMPAGENT_LOGGER;
+ loggerProcess = LOG_MOD_SNMPAGENT;
+ //set default log level
+ for (LOG_CATEGORY_TAG cat = LOG_CAT_NONE; cat <= getCategoryRangeEnd(LOG_MOD_SNMPAGENT); ++cat) {
+ categoryLevel[cat] = log4cxx::Level::getError();
+ }
+#endif
+ }
+ //! cpoy constructor disable
+ LoggerImpl( const LoggerImpl& );
+ //! operator= disable
+ LoggerImpl& operator=( const LoggerImpl& );
+ //! destructor.
+ virtual ~LoggerImpl() {}
+ //! static Logger instance
+ static LoggerImpl* instance;
+ //! initialized flag
+ bool initialized;
+ //! logger category
+ LOG_CATEGORY_TAG loggerCategory;
+ //! logger process
+ LOG_MODULE_TAG loggerProcess;
+ //! hostname
+ char hostname[HOST_NAME_LEN];
+
+ //! if error occured, switch appenders to syslogappender and fileappender(/dev/console)
+ virtual void errorConf(unsigned int messageId, const std::string& errorMessage, const char* file, int line);
+
+ //! base logFileanme
+ std::string logFilename;
+ //! rotation way (size base, date base, or both size and date base)
+ LOG_ROTATION_TAG rotation;
+ //! number of backup log file
+ unsigned int maxBackupIndex;
+ //! max size of log file
+ unsigned long long maxFileSize;
+ /*!
+ * rotation timing
+ * "year" = yearly
+ * "monthr" = monthly
+ * "week" = weekly
+ * "date" = daily
+ * "hour" = hourly
+ */
+ LOG_ROTATION_TIMING_TAG rotationTiming;
+ /*!
+ * rotation timing value
+ *
+ * rotation timing value
+ * -------------------------------------------------
+ * year "03051500" (3/5 15:00)
+ * month "051100" (5 11:00)
+ * week "12000" (mon 20:00) sun = 0, sat = 6
+ * date "1500" (15:00)
+ * hour "45" (45)
+ */
+ std::string rotationTimingValue;
+
+ //! for transration between log4cxx::LevelPtr and LOGER_LEVEL_TAG
+ static log4cxx::LevelPtr levelTable[LOGGER_LEVEL_NUM];
+ //! for transration between string and LOGGER_CATEGORY_TAG
+ static char categoryTable[][LOGGER_CATEGORY_NUM];
+ //! holds category-loglevel
+ log4cxx::LevelPtr categoryLevel[LOGGER_CATEGORY_NUM];
+
+ //! LOG_LEVEL_TAG to log4cxx::LevelPtr transrator
+ virtual inline const log4cxx::LevelPtr toLevel(LOG_LEVEL_TAG level)
+ {
+ return levelTable[level];
+ }
+ //! log4cxx::LevelPtr to LOG_LEVEL_TAG transrator
+ virtual inline LOG_LEVEL_TAG toLevelTag(const log4cxx::LevelPtr level)
+ {
+ int levelInt = level->toInt();
+ switch (levelInt) {
+ case log4cxx::Level::DEBUG_INT:
+ return LOG_LV_DEBUG;
+ case log4cxx::Level::INFO_INT:
+ return LOG_LV_INFO;
+ case log4cxx::Level::WARN_INT:
+ return LOG_LV_WARN;
+ case log4cxx::Level::ERROR_INT:
+ return LOG_LV_ERROR;
+ case log4cxx::Level::FATAL_INT:
+ return LOG_LV_FATAL;
+ default:
+ return LOG_LV_DEBUG;
+ }
+ }
+ private:
+ //! loglevel tagle
+ LOG_LEVEL_TAG loglevel[LOGGER_CATEGORY_NUM];
+
+ public:
+ //! initialze function
+ virtual bool init();
+ //! Configuration function
+ virtual void loadConf();
+ //1 initialize loglevel table
+ void initLogLevelTable();
+
+ /*!
+ * retrieve category's log level.
+ *
+ * @param category that want to know
+ * @return log level
+ */
+ virtual inline LOG_LEVEL_TAG getLogLevel(LOG_CATEGORY_TAG cat)
+ {
+#if defined(LOGGER_PROCESS_VSD)
+ if (cat >= getCategoryRangeStart(LOG_MOD_SNMPAGENT) && cat <= getCategoryRangeEnd(LOG_MOD_SNMPAGENT)) {
+ return l7vs_snmpbridge_get_loglevel(cat);
+ }
+#endif
+ if (LOG_LV_NONE == loglevel[cat]) {
+ this->loglevel[cat] = toLevelTag(log4cxx::Logger::getLogger(categoryTable[cat])->getLevel());
+ }
+
+ return loglevel[cat];
+ //return toLevelTag(log4cxx::Logger::getLogger(categoryTable[cat])->getLevel());
+ }
+
+ /*!
+ * set category's log level.
+ *
+ * @param category to set log level
+ * @param level
+ * @retval true succeed
+ * @retval false failed
+ */
+ virtual inline bool setLogLevel(LOG_CATEGORY_TAG cat, LOG_LEVEL_TAG level)
+ {
+ try {
+#if defined(LOGGER_PROCESS_VSD)
+ if (cat >= getCategoryRangeStart(LOG_MOD_SNMPAGENT) && cat <= getCategoryRangeEnd(LOG_MOD_SNMPAGENT)) {
+ l7vs_snmpbridge_change_loglevel(cat, level);
+ }
+#endif
+ log4cxx::Logger::getLogger(categoryTable[cat])->setLevel(toLevel(level));
+ }
+ catch (const std::exception& ex) {
+ return false;
+ }
+
+ loglevel[cat] = level;
+ return true;
+ }
+
+ /*!
+ * output fatal log.
+ *
+ * @param category that logging matter occured
+ * @param log message id
+ * @param log message
+ * @param current file
+ * @param current line
+ * @retrun void
+ */
+ virtual inline void putLogFatal(LOG_CATEGORY_TAG cat, const unsigned int message_id, const std::string& message, const char *file, int line)
+ {
+ char buf[BUF_LEN];
+ snprintf(buf, BUF_LEN, "%s%d%03d%04d %s %s", LOGGER_PROCESS_ID, LOG_LV_FATAL, cat, message_id, message.c_str(), hostname);
+ try {
+ log4cxx::Logger::getLogger(categoryTable[cat])->forcedLog(log4cxx::Level::getFatal(), buf, log4cxx::spi::LocationInfo(file, "", line));
+ }
+ catch (const std::exception& ex) {
+ std::ostringstream oss;
+ oss << "Logging Error (Fatal Log) : " << ex.what();
+ errorConf(1, oss.str(), __FILE__, __LINE__);
+ }
+ }
+ /*!
+ * output error log.
+ *
+ * @param category that logging matter occured
+ * @param log message id
+ * @param log message
+ * @param current file
+ * @param current line
+ * @retrun void
+ */
+ //! output fatal log.
+ virtual inline void putLogError(LOG_CATEGORY_TAG cat, const unsigned int message_id, const std::string& message, const char *file, int line)
+ {
+ char buf[BUF_LEN];
+ snprintf(buf, BUF_LEN, "%s%d%03d%04d %s %s", LOGGER_PROCESS_ID, LOG_LV_ERROR, cat, message_id, message.c_str(), hostname);
+ try {
+ log4cxx::Logger::getLogger(categoryTable[cat])->forcedLog(log4cxx::Level::getError(), buf, log4cxx::spi::LocationInfo(file, "", line));
+ }
+ catch (const std::exception& ex) {
+ std::ostringstream oss;
+ oss << "Logging Error (Error Log) : " << ex.what();
+ errorConf(2, oss.str(), __FILE__, __LINE__);
+ }
+ }
+ /*!
+ * output warn log.
+ *
+ * @param category that logging matter occured
+ * @param log message id
+ * @param log message
+ * @param current file
+ * @param current line
+ * @retrun void
+ */
+ //! output fatal log.
+ virtual inline void putLogWarn(LOG_CATEGORY_TAG cat, const unsigned int message_id, const std::string& message, const char *file, int line)
+ {
+ char buf[BUF_LEN];
+ snprintf(buf, BUF_LEN, "%s%d%03d%04d %s %s", LOGGER_PROCESS_ID, LOG_LV_WARN, cat, message_id, message.c_str(), hostname);
+ try {
+ log4cxx::Logger::getLogger(categoryTable[cat])->forcedLog(log4cxx::Level::getWarn(), buf, log4cxx::spi::LocationInfo(file, "", line));
+ }
+ catch (const std::exception& ex) {
+ std::ostringstream oss;
+ oss << "Logging Error (Warn Log) : " << ex.what();
+ errorConf(3, oss.str(), __FILE__, __LINE__);
+ }
+ }
+ /*!
+ * output info log.
+ *
+ * @param category that logging matter occured
+ * @param log message id
+ * @param log message
+ * @param current file
+ * @param current line
+ * @retrun void
+ */
+ //! output fatal log.
+ virtual inline void putLogInfo(LOG_CATEGORY_TAG cat, const unsigned int message_id, const std::string& message, const char *file, int line)
+ {
+ char buf[BUF_LEN];
+ snprintf(buf, BUF_LEN, "%s%d%03d%04d %s %s", LOGGER_PROCESS_ID, LOG_LV_INFO, cat, message_id, message.c_str(), hostname);
+ try {
+ log4cxx::Logger::getLogger(categoryTable[cat])->forcedLog(log4cxx::Level::getInfo(), buf, log4cxx::spi::LocationInfo(file, "", line));
+ }
+ catch (const std::exception& ex) {
+ std::ostringstream oss;
+ oss << "Logging Error (Info Log) : " << ex.what();
+ errorConf(4, oss.str(), __FILE__, __LINE__);
+ }
+ }
+ /*!
+ * output debug log.
+ *
+ * @param category that logging matter occured
+ * @param log message id
+ * @param log message
+ * @param current file
+ * @param current line
+ * @retrun void
+ */
+ virtual inline void putLogDebug(LOG_CATEGORY_TAG cat, const unsigned int message_id, const std::string& message, const char *file, int line)
+ {
+ char buf[BUF_LEN];
+ snprintf(buf, BUF_LEN, "%s%d%03d%04d %s %s", LOGGER_PROCESS_ID, LOG_LV_DEBUG, cat, message_id, message.c_str(), hostname);
+ try {
+ log4cxx::Logger::getLogger(categoryTable[cat])->forcedLog(log4cxx::Level::getDebug(), buf, log4cxx::spi::LocationInfo(file, "", line));
+ }
+ catch (const std::exception& ex) {
+ std::ostringstream oss;
+ oss << "Logging Error (Debug Log) : " << ex.what();
+ errorConf(5, oss.str(), __FILE__, __LINE__);
+ }
+ }
+
+ /*!
+ * return start category by using module.
+ *
+ * @param module
+ * @retrun start category
+ */
+ virtual inline LOG_CATEGORY_TAG getCategoryRangeStart(LOG_MODULE_TAG mod)
+ {
+ switch (mod) {
+ case LOG_MOD_L7VSADM: return LOG_CAT_L7VSADM_PARSE;
+ case LOG_MOD_SNMPAGENT: return LOG_CAT_SNMPAGENT_START_STOP;
+ default: return LOG_CAT_L7VSD_NETWORK;
+ }
+ }
+ /*!
+ * return end category by using module.
+ *
+ * @param module
+ * @retrun end category
+ */
+ virtual inline LOG_CATEGORY_TAG getCategoryRangeEnd(LOG_MODULE_TAG mod)
+ {
+ switch (mod) {
+ case LOG_MOD_L7VSADM: return LOG_CAT_L7VSADM_MODULE;
+ case LOG_MOD_SNMPAGENT: return LOG_CAT_SNMPAGENT_PARAMETER;
+ default: return LOG_CAT_L7VSD_MODULE;
+ }
+ }
+ };
+} //namespace l7vs
+#endif //__LOGGER_IMPL_H__
--- /dev/null
+/*
+ * @file logger_wapprer.h
+ * @brief logger module c wrapper.
+ *
+ * L7VSD: Linux Virtual Server for Layer7 Load Balancing
+ * Copyright (C) 2008 NTT COMWARE Corporation.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ **********************************************************************/
+
+#ifndef __LOGGER_WRAPPER_H__
+#define __LOGGER_WRAPPER_H__
+
+#include "logger.h"
+
+/*!
+ * retrieve category's log level.
+ * this is only wrapper to implement method.
+ * @param category that want to know
+ * @return log level
+ */
+inline enum LOG_LEVEL_TAG logger_get_log_level(const enum LOG_CATEGORY_TAG cat)
+{
+ return l7vs::Logger::getInstance().getLogLevel(cat);
+}
+
+/*!
+ * set category's log level.
+ * this is only wrapper to implement method.
+ * @param category to set log level
+ * @param level
+ * @retval 0 succeed
+ * @retval -1 failed
+ */
+inline int logger_set_log_level(const enum LOG_CATEGORY_TAG cat, const enum LOG_LEVEL_TAG level)
+{
+ if (l7vs::Logger::getInstance().setLogLevel(cat, level)) {
+ return 0;
+ }
+ return -1;
+}
+
+/*!
+ * output fatal log.
+ * this is only wrapper to implement method.
+ * @param category that logging matter occured
+ * @param log message id
+ * @param current file
+ * @param current line
+ * @param log message
+ * @retrun void
+ */
+inline void logger_put_log_fatal(const enum LOG_CATEGORY_TAG cat, const unsigned int message_id, char* file, int line, const char* message)
+{
+ l7vs::Logger::getInstance().putLogFatal(cat, message_id, message, file, line);
+}
+
+/*!
+ * output error log.
+ * this is only wrapper to implement method.
+ * @param category that logging matter occured
+ * @param log message id
+ * @param current file
+ * @param current line
+ * @param log message
+ * @retrun void
+ */
+inline void logger_put_log_error(const enum LOG_CATEGORY_TAG cat, const unsigned int message_id, char* file, int line, const char* message)
+{
+ l7vs::Logger::getInstance().putLogError(cat, message_id, message, file, line);
+}
+
+/*!
+ * output warn log.
+ * this is only wrapper to implement method.
+ * @param category that logging matter occured
+ * @param log message id
+ * @param current file
+ * @param current line
+ * @param log message
+ * @retrun void
+ */
+inline void logger_put_log_warn(const enum LOG_CATEGORY_TAG cat, const unsigned int message_id, char* file, int line, const char* message)
+{
+ l7vs::Logger::getInstance().putLogWarn(cat, message_id, message, file, line);
+}
+
+/*!
+ * output info log.
+ * this is only wrapper to implement method.
+ * @param category that logging matter occured
+ * @param log message id
+ * @param current file
+ * @param current line
+ * @param log message
+ * @retrun void
+ */
+inline void logger_put_log_info(const enum LOG_CATEGORY_TAG cat, const unsigned int message_id, char* file, int line, const char* message)
+{
+ l7vs::Logger::getInstance().putLogInfo(cat, message_id, message, file, line);
+}
+
+/*!
+ * output debug log.
+ * this is only wrapper to implement method.
+ * @param category that logging matter occured
+ * @param log message id
+ * @param current file
+ * @param current line
+ * @param log message
+ * @retrun void
+ */
+inline void logger_put_log_debug(const enum LOG_CATEGORY_TAG cat, const unsigned int message_id, char* file, int line, const char* message)
+{
+ l7vs::Logger::getInstance().putLogDebug(cat, message_id, message, file, line);
+}
+
+/*!
+ * return start category by using module.
+ * this is only wrapper to implement method.
+ * @param module
+ * @retrun start category
+ */
+inline enum LOG_CATEGORY_TAG logger_get_category_range_start(enum LOG_MODULE_TAG mod)
+{
+ return l7vs::Logger::getInstance().getCategoryRangeStart(mod);
+}
+
+/*!
+ * return end category by using module.
+ * this is only wrapper to implement method.
+ * @param module
+ * @retrun end category
+ */
+inline enum LOG_CATEGORY_TAG logger_get_category_range_end(enum LOG_MODULE_TAG mod)
+{
+ return l7vs::Logger::getInstance().getCategoryRangeEnd(mod);
+}
+
+#define LOGGER_PUT_LOG_FATAL(cat, message_id, message, arg...) { \
+ if (LOG_LV_FATAL >= logger_get_log_level(cat)) { \
+ char buf[BUF_LEN]; \
+ snprintf(buf, BUF_LEN, message, ##arg); \
+ logger_put_log_fatal(cat, message_id, __FILE__, __LINE__, buf); }}
+
+#define LOGGER_PUT_LOG_ERROR(cat, message_id, message, arg...) { \
+ if (LOG_LV_ERROR >= logger_get_log_level(cat)) { \
+ char buf[BUF_LEN]; \
+ snprintf(buf, BUF_LEN, message, ##arg); \
+ logger_put_log_error(cat, message_id, __FILE__, __LINE__, buf); }}
+
+#define LOGGER_PUT_LOG_WARN(cat, message_id, message, arg...) { \
+ if (LOG_LV_WARN >= logger_get_log_level(cat)) { \
+ char buf[BUF_LEN]; \
+ snprintf(buf, BUF_LEN, message, ##arg); \
+ logger_put_log_warn(cat, message_id, __FILE__, __LINE__, buf); }}
+
+#define LOGGER_PUT_LOG_INFO(cat, message_id, message, arg...) { \
+ if (LOG_LV_INFO >= logger_get_log_level(cat)) { \
+ char buf[BUF_LEN]; \
+ snprintf(buf, BUF_LEN, message, ##arg); \
+ logger_put_log_info(cat, message_id, __FILE__, __LINE__, buf); }}
+
+#define LOGGER_PUT_LOG_DEBUG(cat, message_id, message, arg...) { \
+ char buf[BUF_LEN]; \
+ snprintf(buf, BUF_LEN, message, ##arg); \
+ logger_put_log_debug(cat, message_id, __FILE__, __LINE__, buf); }
+
+#endif //__LOGGER_WRAPPER_H__
--- /dev/null
+/*
+ * @file strict_time_based_rolling_policy.cpp
+ * @brief log4cxx's rolling policy class. (time)
+ *
+ * L7VSD: Linux Virtual Server for Layer7 Load Balancing
+ * Copyright (C) 2008 NTT COMWARE Corporation.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ **********************************************************************/
+
+#include <log4cxx/logstring.h>
+#include <log4cxx/rolling/filerenameaction.h>
+#include <log4cxx/helpers/loglog.h>
+#include <log4cxx/helpers/exception.h>
+#include <log4cxx/helpers/stringhelper.h>
+#include <log4cxx/helpers/optionconverter.h>
+#include <time.h>
+#include "strict_time_based_rolling_policy.h"
+#include "lexical_cast.h"
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+
+using namespace log4cxx;
+using namespace log4cxx::rolling;
+using namespace log4cxx::helpers;
+using namespace log4cxx::pattern;
+
+#define TIME_BUF_LEN (256)
+#define LOG_DATE_FORMAT "%Y%m%d%H%M"
+#define LOG_DATE_FORMAT_WEEK "%Y%m%d%w%H%M"
+
+IMPLEMENT_LOG4CXX_OBJECT(StrictTimeBasedRollingPolicy)
+
+/*!
+ * default constructor.
+ * initialize member valiables
+ * @param void
+ * @return void
+ */
+StrictTimeBasedRollingPolicy::StrictTimeBasedRollingPolicy() :
+ nextCheck(0), rotationTiming(LOG_TIM_YEAR), rotationTimingValue("")
+{
+}
+
+/*!
+ * increase reffernce count
+ * @param void
+ * @return void
+ */
+void StrictTimeBasedRollingPolicy::addRef() const
+{
+ TriggeringPolicy::addRef();
+}
+
+/*!
+ * decrease reffernce count
+ * @param void
+ * @return void
+ */
+void StrictTimeBasedRollingPolicy::releaseRef() const
+{
+ TriggeringPolicy::releaseRef();
+}
+
+/*!
+ * evaluate and activate options
+ * @param memory pool
+ * @return void
+ */
+void StrictTimeBasedRollingPolicy::activateOptions(log4cxx::helpers::Pool& pool)
+{
+ // check for rotationTimingValue
+ if (0 >= rotationTimingValue.length()) {
+ LogLog::warn(
+ LOG4CXX_STR("The RotationTimingValue option must be set before using StrictTimeBasedRollingPolicy. "));
+ throw IllegalStateException();
+ }
+
+ // call super class's activateOptions
+ FixedWindowRollingPolicy::activateOptions(pool);
+}
+
+/*!
+ * rotationTimingValue getter
+ * @param void
+ * @return rotationTimingValue
+ */
+std::string StrictTimeBasedRollingPolicy::getRotationTimingValue()
+{
+ return rotationTimingValue;
+}
+
+/*!
+ * rotationTimingValue setter
+ * @param rotationTimingValue
+ * @return void
+ */
+void StrictTimeBasedRollingPolicy::setRotationTimingValue(const std::string& val)
+{
+ rotationTimingValue = val;
+}
+
+/*!
+ * rotationTiming getter
+ * @param void
+ * @return rotationTiming
+ */
+LOG_ROTATION_TIMING_TAG StrictTimeBasedRollingPolicy::getRotationTiming()
+{
+ return rotationTiming;
+}
+
+/*!
+ * rotationTiming setter
+ * @param rotationTiming
+ * @return void
+ */
+void StrictTimeBasedRollingPolicy::setRotationTiming(const LOG_ROTATION_TIMING_TAG val)
+{
+ rotationTiming = val;
+}
+
+/*!
+ * option setter
+ * @param option name
+ * @param value
+ * @return void
+ */
+void StrictTimeBasedRollingPolicy::setOption(const LogString& option, const LogString& value)
+{
+ if (StringHelper::equalsIgnoreCase(option,
+ LOG4CXX_STR("ROTATIONTIMINGVALUE"),
+ LOG4CXX_STR("rotationtimingvalue"))) {
+ rotationTimingValue = value;
+ }
+ else if (StringHelper::equalsIgnoreCase(option,
+ LOG4CXX_STR("ROTATIONTIMING"),
+ LOG4CXX_STR("rotationtiming"))) {
+ rotationTiming = (LOG_ROTATION_TIMING_TAG)OptionConverter::toInt(value, 0);
+ }
+ else {
+ FixedWindowRollingPolicy::setOption(option, value);
+ }
+}
+
+/*!
+ * rolling policy initialize
+ * @param filename of current use
+ * @param append or overWrite
+ * @param memory pool
+ * @return Rollover information
+ */
+RolloverDescriptionPtr StrictTimeBasedRollingPolicy::initialize(
+ const LogString& currentActiveFile,
+ const bool append,
+ Pool& pool)
+{
+ // get current time
+ time_t now_time;
+ time_t ret_time = time(&now_time);
+ if (-1 == ret_time) {
+ LogLog::warn(LOG4CXX_STR("Fail to get CurrentTime. "));
+ RolloverDescriptionPtr desc;
+ return desc;
+ }
+
+ // get next rotation timing
+ nextCheck = getNextCheck(now_time);
+ if (-1 == nextCheck) {
+ LogLog::warn(LOG4CXX_STR("Fail to get nextCheck. "));
+ RolloverDescriptionPtr desc;
+ return desc;
+ }
+
+ // call super class's initialize
+ return FixedWindowRollingPolicy::initialize(currentActiveFile, append, pool);
+}
+
+/*!
+ * calculate next rollover timing
+ * @param now time
+ * @return next rollover time
+ */
+time_t StrictTimeBasedRollingPolicy::getNextCheck(time_t now_time)
+{
+ struct tm now_tm;
+ struct tm *ret_tm;
+ ret_tm = localtime_r(&now_time, &now_tm);
+ if (0 == ret_tm) {
+ return -1;
+ }
+
+ char buf[TIME_BUF_LEN];
+ size_t ret_sz = 0;
+ if (LOG_TIM_WEEK == rotationTiming) {
+ ret_sz = strftime(buf, sizeof(buf), LOG_DATE_FORMAT_WEEK, &now_tm);
+ }
+ else {
+ ret_sz = strftime(buf, sizeof(buf), LOG_DATE_FORMAT, &now_tm);
+ }
+ if (0 == ret_sz) {
+ return -1;
+ }
+ std::string now(buf);
+
+ int dates[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
+ unsigned long long numNowDate = 0;;
+ unsigned long long numTimingDate = 0;
+
+ int numYear = 0;
+ int numMonth = 0;
+ int numDate = 0;
+ int numNowWeek = 0;
+ int numTimingWeek = 0;
+ int numHour = 0;
+ int numMinute = 0;
+
+ struct tm t;
+ memset(&t, 0, sizeof(struct tm));
+
+ time_t next = 0;
+
+ try {
+ switch (rotationTiming) {
+ case LOG_TIM_YEAR:
+ numNowDate = l7vs::lexical_cast<unsigned long long>(now.substr(4));
+ numTimingDate = l7vs::lexical_cast<unsigned long long>(rotationTimingValue);
+
+ numYear = l7vs::lexical_cast<int>(now.substr(0, 4));
+ numMonth = l7vs::lexical_cast<int>(rotationTimingValue.substr(0, 2));
+ numDate = l7vs::lexical_cast<int>(rotationTimingValue.substr(2, 2));
+ numHour = l7vs::lexical_cast<int>(rotationTimingValue.substr(4, 2));
+ numMinute = l7vs::lexical_cast<int>(rotationTimingValue.substr(6));
+
+ if (numTimingDate > numNowDate) {
+ t.tm_year = numYear - 1900;
+ }
+ else {
+#if defined(LOGGER_PROCESS_ADM)
+ t.tm_year = numYear - 1900;
+#else //LOGGER_PROCESS_VSD or LOGGER_PROCESS_SNM
+ t.tm_year = numYear + 1 - 1900;
+#endif
+ }
+ t.tm_mon = numMonth - 1;
+ t.tm_mday = numDate;
+ t.tm_hour = numHour;
+ t.tm_min = numMinute;
+
+ next = mktime(&t);
+ if (-1 == next) {
+ return -1;
+ }
+ break;
+
+ case LOG_TIM_MONTH:
+ numNowDate = l7vs::lexical_cast<unsigned long long>(now.substr(6));
+ numTimingDate = l7vs::lexical_cast<unsigned long long>(rotationTimingValue);
+
+ numYear = l7vs::lexical_cast<int>(now.substr(0, 4));
+ numMonth = l7vs::lexical_cast<int>(now.substr(4, 2));
+ numDate = l7vs::lexical_cast<int>(rotationTimingValue.substr(0, 2));
+ numHour = l7vs::lexical_cast<int>(rotationTimingValue.substr(2, 2));
+ numMinute = l7vs::lexical_cast<int>(rotationTimingValue.substr(4));
+
+ if (numTimingDate > numNowDate) {
+ t.tm_year = numYear - 1900;
+ t.tm_mon = numMonth - 1;
+ }
+ else {
+#if defined(LOGGER_PROCESS_ADM)
+ t.tm_year = numYear - 1900;
+ t.tm_mon = numMonth - 1;
+#else //LOGGER_PROCESS_VSD or LOGGER_PROCESS_SNM
+ if (12 == numMonth) {
+ t.tm_year = numYear + 1 - 1900;
+ t.tm_mon = 0;
+ }
+ else {
+ t.tm_year = numYear - 1900;
+ t.tm_mon = numMonth + 1 - 1;
+ }
+#endif
+ }
+
+ if (numDate > dates[t.tm_mon]) {
+ t.tm_mday = dates[t.tm_mon];
+ }
+ else {
+ t.tm_mday = numDate;
+ }
+
+ t.tm_hour = numHour;
+ t.tm_min = numMinute;
+
+ next = mktime(&t);
+ if (-1 == next) {
+ return -1;
+ }
+
+ break;
+ case LOG_TIM_WEEK:
+ numNowDate = l7vs::lexical_cast<unsigned long long>(now.substr(8));
+ numTimingDate = l7vs::lexical_cast<unsigned long long>(rotationTimingValue);
+
+ numYear = l7vs::lexical_cast<int>(now.substr(0, 4));
+ numMonth = l7vs::lexical_cast<int>(now.substr(4, 2));
+ numDate = l7vs::lexical_cast<int>(now.substr(6, 2));
+ numNowWeek = l7vs::lexical_cast<int>(now.substr(8, 1));
+ numTimingWeek = l7vs::lexical_cast<int>(rotationTimingValue.substr(0, 1));
+ numHour = l7vs::lexical_cast<int>(rotationTimingValue.substr(1, 2));
+ numMinute = l7vs::lexical_cast<int>(rotationTimingValue.substr(3));
+
+ t.tm_year = numYear - 1900;
+ t.tm_mon = numMonth - 1;
+ if (numTimingDate > numNowDate) {
+ t.tm_mday = numDate + (numTimingWeek - numNowWeek);
+ }
+ else {
+#if defined(LOGGER_PROCESS_ADM)
+ t.tm_mday = numDate + (numTimingWeek - numNowWeek);
+#else //LOGGER_PROCESS_VSD or LOGGER_PROCESS_SNM
+ t.tm_mday = numDate + (7 - (numNowWeek - numTimingWeek));
+#endif
+ }
+ t.tm_hour = numHour;
+ t.tm_min = numMinute;
+
+ next = mktime(&t);
+ if (-1 == next) {
+ return -1;
+ }
+
+ break;
+
+ case LOG_TIM_DATE:
+ numNowDate = l7vs::lexical_cast<unsigned long long>(now.substr(8));
+ numTimingDate = l7vs::lexical_cast<unsigned long long>(rotationTimingValue);
+
+ numYear = l7vs::lexical_cast<int>(now.substr(0, 4));
+ numMonth = l7vs::lexical_cast<int>(now.substr(4, 2));
+ numDate = l7vs::lexical_cast<int>(now.substr(6, 2));
+ numHour = l7vs::lexical_cast<int>(rotationTimingValue.substr(0, 2));
+ numMinute = l7vs::lexical_cast<int>(rotationTimingValue.substr(2));
+
+ t.tm_year = numYear - 1900;
+ t.tm_mon = numMonth - 1;
+ if (numTimingDate > numNowDate) {
+ t.tm_mday = numDate;
+ }
+ else {
+#if defined(LOGGER_PROCESS_ADM)
+ t.tm_mday = numDate;
+#else //LOGGER_PROCESS_VSD or LOGGER_PROCESS_SNM
+ t.tm_mday = numDate + 1;
+#endif
+ }
+ t.tm_hour = numHour;
+ t.tm_min = numMinute;
+
+ next = mktime(&t);
+ if (-1 == next) {
+ return -1;
+ }
+ break;
+
+ default: //HOUR
+ numNowDate = l7vs::lexical_cast<unsigned long long>(now.substr(10));
+ numTimingDate = l7vs::lexical_cast<unsigned long long>(rotationTimingValue);
+
+ numYear = l7vs::lexical_cast<int>(now.substr(0, 4));
+ numMonth = l7vs::lexical_cast<int>(now.substr(4, 2));
+ numDate = l7vs::lexical_cast<int>(now.substr(6, 2));
+ numHour = l7vs::lexical_cast<int>(now.substr(8, 2));
+ numMinute = l7vs::lexical_cast<int>(rotationTimingValue);
+
+ t.tm_year = numYear - 1900;
+ t.tm_mon = numMonth - 1;
+ t.tm_mday = numDate;
+ if (numTimingDate > numNowDate) {
+ t.tm_hour = numHour;
+ }
+ else {
+#if defined(LOGGER_PROCESS_ADM)
+ t.tm_hour = numHour;
+#else //LOGGER_PROCESS_VSD or LOGGER_PROCESS_SNM
+ t.tm_hour = numHour + 1;
+#endif
+ }
+ t.tm_min = numMinute;
+
+ next = mktime(&t);
+ if (-1 == next) {
+ return -1;
+ }
+ }
+ }
+ catch (const std::exception& ex) {
+ return -1;
+ }
+ return next;
+
+}
+
+/*!
+ * log file rollover opration
+ * @param name of current log file
+ * @param memory pool
+ * @return Rollover infomation
+ */
+RolloverDescriptionPtr StrictTimeBasedRollingPolicy::rollover(
+ const LogString& currentActiveFile,
+ Pool& pool)
+{
+ // get current time
+ time_t now_time;
+ time_t ret_time = time(&now_time);
+ if (-1 == ret_time) {
+ LogLog::warn(LOG4CXX_STR("Fail to get CurrentTime. "));
+ RolloverDescriptionPtr desc;
+ return desc;
+ }
+
+ // get next rotation timing
+ nextCheck = getNextCheck(now_time);
+ if (-1 == nextCheck) {
+ LogLog::warn(LOG4CXX_STR("Fail to get nextCheck. "));
+ RolloverDescriptionPtr desc;
+ return desc;
+ }
+
+ // call super class's rollover
+ return FixedWindowRollingPolicy::rollover(currentActiveFile, pool);
+
+}
+
+/*!
+ * returns do rollover or not
+ * @param appender (not use)
+ * @param event (not use)
+ * @param filename
+ * @param fileLength (not use)
+ * @retval true do rollover
+ * @retval false not rollover yet
+ */
+bool StrictTimeBasedRollingPolicy::isTriggeringEvent(
+ Appender* /* appender */,
+ const log4cxx::spi::LoggingEventPtr& /* event */,
+ const LogString& filename,
+ size_t /* fileLength */)
+{
+ time_t now_time;
+ time_t ret_time = time(&now_time);
+ if (-1 == ret_time) {
+ LogLog::warn(LOG4CXX_STR("Fail to get time. "));
+ return false;
+ }
+#if defined(LOGGER_PROCESS_ADM)
+ struct stat sb;
+
+ if (-1 == stat(filename.c_str(), &sb)) {
+ LogLog::warn(LOG4CXX_STR("Fail to get logfile update time. "));
+ return false;
+ }
+ if (now_time > nextCheck && nextCheck > sb.st_mtime) {
+ // Do rollover.
+ return true;
+ } else {
+ // Do not rollover.
+ return false;
+ }
+#else //LOGGER_PROCESS_VSD or LOGGER_PROCESS_SNM
+ return now_time > nextCheck;
+#endif
+}
--- /dev/null
+/*
+ * @file strict_time_based_rolling_policy.h
+ * @brief log4cxx's rolling policy class. (time)
+ *
+ * L7VSD: Linux Virtual Server for Layer7 Load Balancing
+ * Copyright (C) 2008 NTT COMWARE Corporation.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ **********************************************************************/
+
+#ifndef __STRICT_TIME_BASED_ROLLING_POLICY_H__
+#define __STRICT_TIME_BASED_ROLLING_POLICY_H__
+
+#include <log4cxx/portability.h>
+#include <log4cxx/rolling/rollingpolicybase.h>
+#include <log4cxx/rolling/triggeringpolicy.h>
+#include <log4cxx/rolling/fixedwindowrollingpolicy.h>
+#include "logger_enum.h"
+
+namespace log4cxx {
+ namespace rolling {
+ /*!
+ * log4cxx time based rolling policy class.
+ * this policy class can specify rolling time more strictly
+ * than normal TimeBasedRollingPolicy.
+ */
+ class LOG4CXX_EXPORT StrictTimeBasedRollingPolicy :
+ public FixedWindowRollingPolicy,
+ public TriggeringPolicy
+ {
+ DECLARE_LOG4CXX_OBJECT(StrictTimeBasedRollingPolicy)
+ BEGIN_LOG4CXX_CAST_MAP()
+ LOG4CXX_CAST_ENTRY(StrictTimeBasedRollingPolicy)
+ LOG4CXX_CAST_ENTRY_CHAIN(FixedWindowRollingPolicy)
+ LOG4CXX_CAST_ENTRY_CHAIN(TriggeringPolicy)
+ END_LOG4CXX_CAST_MAP()
+
+ protected:
+ //! time of next rollover
+ time_t nextCheck;
+ /*!
+ * rotation timing
+ * LOG_TIM_YEAR = yearly
+ * LOG_TIM_MONTH = monthly
+ * LOG_TIM_WEEK = weekly
+ * LOG_TIM_DATE = daily
+ * LOG_TIM_HOUR = hourly
+ */
+ LOG_ROTATION_TIMING_TAG rotationTiming;
+ /*!
+ * rotation timing value
+ *
+ * rotation timing value
+ * -------------------------------------------------
+ * LOG_TIM_YEAR "03051500" (3/5 15:00)
+ * LOG_TIM_MONTH "051100" (5 11:00)
+ * LOG_TIM_WEEK "12000" (mon 20:00) sun = 0, sat = 6
+ * LOG_TIM_DATE "1500" (15:00)
+ * LOG_TIM_HOUR "45" (45)
+ */
+ std::string rotationTimingValue;
+ //! calculate next rollover timing
+ time_t getNextCheck(time_t now_time);
+
+ public:
+ //! default constructor
+ StrictTimeBasedRollingPolicy();
+ //! increase reffernce count
+ void addRef() const;
+ //! decrease reffernce count
+ void releaseRef() const;
+ //! option setter
+ void setOption(const LogString&, const LogString&);
+ //! evaluate and activate options
+ void activateOptions(log4cxx::helpers::Pool& );
+
+ //! rotationTiming getter
+ LOG_ROTATION_TIMING_TAG getRotationTiming();
+ //! rotationTiming setter
+ void setRotationTiming(const LOG_ROTATION_TIMING_TAG);
+ //! rotatioTimingValue getter
+ std::string getRotationTimingValue();
+ //! rotatioTimingValue setter
+ void setRotationTimingValue(const std::string&);
+
+ //! rolling policy initialize
+ RolloverDescriptionPtr initialize(
+ const LogString& file,
+ const bool append,
+ log4cxx::helpers::Pool& pool);
+ //! invoke when rollover event
+ RolloverDescriptionPtr rollover(const LogString& activeFile,
+ log4cxx::helpers::Pool& pool);
+
+ //! returns do rollover or not
+ virtual bool isTriggeringEvent(
+ Appender* appender,
+ const log4cxx::spi::LoggingEventPtr& event,
+ const LogString& filename,
+ size_t fileLength);
+
+ };
+ LOG4CXX_PTR_DEF(StrictTimeBasedRollingPolicy);
+ }
+}
+
+#endif //__STRICT_TIME_BASED_ROLLING_POLICY_H__
+
--- /dev/null
+/*
+ * @file time_and_size_based_rolling_policy.cpp
+ * @brief log4cxx's rolling policy class. (time + size)
+ *
+ * L7VSD: Linux Virtual Server for Layer7 Load Balancing
+ * Copyright (C) 2008 NTT COMWARE Corporation.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ **********************************************************************/
+
+#include <log4cxx/logstring.h>
+#include <log4cxx/pattern/filedatepatternconverter.h>
+#include <log4cxx/helpers/date.h>
+#include <log4cxx/rolling/filerenameaction.h>
+#include <log4cxx/helpers/loglog.h>
+#include <log4cxx/helpers/exception.h>
+#include <log4cxx/helpers/stringhelper.h>
+#include <log4cxx/helpers/optionconverter.h>
+#include <time.h>
+#include "time_and_size_based_rolling_policy.h"
+#include "lexical_cast.h"
+
+#define DEFAULT_MAX_FILE_SIZE (10 * 1024 * 1024)
+
+using namespace log4cxx;
+using namespace log4cxx::rolling;
+using namespace log4cxx::helpers;
+using namespace log4cxx::pattern;
+
+IMPLEMENT_LOG4CXX_OBJECT(TimeAndSizeBasedRollingPolicy)
+
+/*!
+ * default constructor.
+ * initialize member valiables
+ * @param void
+ * @return void
+ */
+TimeAndSizeBasedRollingPolicy::TimeAndSizeBasedRollingPolicy() :
+ maxFileSize(DEFAULT_MAX_FILE_SIZE)
+{
+}
+
+/*!
+ * maxFileSize getter
+ * @param void
+ * @return maxFileSize
+ */
+size_t TimeAndSizeBasedRollingPolicy::getMaxFileSize()
+{
+ return maxFileSize;
+}
+
+/*!
+ * maxFileSize setter
+ * @param maxFileSize
+ * @return void
+ */
+void TimeAndSizeBasedRollingPolicy::setMaxFileSize(size_t size)
+{
+ maxFileSize = size;
+}
+
+/*!
+ * option setter
+ * @param option name
+ * @param value
+ * @return void
+ */
+void TimeAndSizeBasedRollingPolicy::setOption(const LogString& option, const LogString& value)
+{
+ if (StringHelper::equalsIgnoreCase(option,
+ LOG4CXX_STR("MAXFILESIZE"),
+ LOG4CXX_STR("maxfilesize"))) {
+ maxFileSize = OptionConverter::toFileSize(value, DEFAULT_MAX_FILE_SIZE);
+ }
+ else {
+ StrictTimeBasedRollingPolicy::setOption(option, value);
+ }
+}
+
+/*!
+ * returns do rollover or not
+ * @param appender (not use)
+ * @param event (not use)
+ * @param filename (not use)
+ * @param fileLength
+ * @retval true do rollover
+ * @retval false not rollover yet
+ */
+bool TimeAndSizeBasedRollingPolicy::isTriggeringEvent(
+ Appender* appender,
+ const log4cxx::spi::LoggingEventPtr& event,
+ const LogString& filename,
+ size_t fileLength)
+{
+
+ return (fileLength >= maxFileSize ||
+ StrictTimeBasedRollingPolicy::isTriggeringEvent(appender, event, filename, fileLength));
+}
--- /dev/null
+/*
+ * @file time_and_size_based_rolling_policy.h
+ * @brief log4cxx's rolling policy class. (time + size)
+ *
+ * L7VSD: Linux Virtual Server for Layer7 Load Balancing
+ * Copyright (C) 2008 NTT COMWARE Corporation.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ **********************************************************************/
+
+#ifndef __TIME_AND_SIZE_BASED_ROLLING_POLICY_H__
+#define __TIME_AND_SIZE_BASED_ROLLING_POLICY_H__
+
+#include <log4cxx/portability.h>
+#include "strict_time_based_rolling_policy.h"
+#include "logger_enum.h"
+
+namespace log4cxx {
+ namespace rolling {
+ /*!
+ * log4cxx time and size based rolling policy class.
+ * this policy class is delivered from StrictTimeBasedRollingPolicy.
+ * so it can size specify in addition to strict time specify.
+ */
+ class LOG4CXX_EXPORT TimeAndSizeBasedRollingPolicy :
+ public StrictTimeBasedRollingPolicy
+ {
+ DECLARE_LOG4CXX_OBJECT(TimeAndSizeBasedRollingPolicy)
+ BEGIN_LOG4CXX_CAST_MAP()
+ LOG4CXX_CAST_ENTRY(TimeAndSizeBasedRollingPolicy)
+ LOG4CXX_CAST_ENTRY_CHAIN(StrictTimeBasedRollingPolicy)
+ END_LOG4CXX_CAST_MAP()
+
+ protected:
+ //! maximum size of file
+ size_t maxFileSize;
+
+ public:
+ //! default constructor
+ TimeAndSizeBasedRollingPolicy();
+ //! option setter
+ void setOption(const LogString&, const LogString&);
+ //! maxFileSize getter
+ size_t getMaxFileSize();
+ //! maxFileSize setter
+ void setMaxFileSize(size_t);
+
+ //! returns do rollover or not
+ virtual bool isTriggeringEvent(
+ Appender* appender,
+ const log4cxx::spi::LoggingEventPtr& event,
+ const LogString& filename,
+ size_t fileLength);
+
+ };
+ LOG4CXX_PTR_DEF(TimeAndSizeBasedRollingPolicy);
+ }
+}
+
+#endif //__TIME_AND_SIZE_BASED_ROLLING_POLICY_H__
+
--- /dev/null
+# ltmain.sh - Provide generalized library-building support services.
+# NOTE: Changing this file will not affect anything until you rerun configure.
+#
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005
+# Free Software Foundation, Inc.
+# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+basename="s,^.*/,,g"
+
+# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
+# is ksh but when the shell is invoked as "sh" and the current value of
+# the _XPG environment variable is not equal to 1 (one), the special
+# positional parameter $0, within a function call, is the name of the
+# function.
+progpath="$0"
+
+# The name of this program:
+progname=`echo "$progpath" | $SED $basename`
+modename="$progname"
+
+# Global variables:
+EXIT_SUCCESS=0
+EXIT_FAILURE=1
+
+PROGRAM=ltmain.sh
+PACKAGE=libtool
+VERSION=1.5.22
+TIMESTAMP=" (1.1220.2.365 2005/12/18 22:14:06)"
+
+# Be Bourne compatible (taken from Autoconf:_AS_BOURNE_COMPATIBLE).
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+ emulate sh
+ NULLCMD=:
+ # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
+ # is contrary to our usage. Disable this feature.
+ alias -g '${1+"$@"}'='"$@"'
+ setopt NO_GLOB_SUBST
+else
+ case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
+fi
+
+# Check that we have a working $echo.
+if test "X$1" = X--no-reexec; then
+ # Discard the --no-reexec flag, and continue.
+ shift
+elif test "X$1" = X--fallback-echo; then
+ # Avoid inline document here, it may be left over
+ :
+elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
+ # Yippee, $echo works!
+ :
+else
+ # Restart under the correct shell, and then maybe $echo will work.
+ exec $SHELL "$progpath" --no-reexec ${1+"$@"}
+fi
+
+if test "X$1" = X--fallback-echo; then
+ # used as fallback echo
+ shift
+ cat <<EOF
+$*
+EOF
+ exit $EXIT_SUCCESS
+fi
+
+default_mode=
+help="Try \`$progname --help' for more information."
+magic="%%%MAGIC variable%%%"
+mkdir="mkdir"
+mv="mv -f"
+rm="rm -f"
+
+# 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'
+# test EBCDIC or ASCII
+case `echo X|tr X '\101'` in
+ A) # ASCII based system
+ # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr
+ SP2NL='tr \040 \012'
+ NL2SP='tr \015\012 \040\040'
+ ;;
+ *) # EBCDIC based system
+ SP2NL='tr \100 \n'
+ NL2SP='tr \r\n \100\100'
+ ;;
+esac
+
+# NLS nuisances.
+# Only set LANG and LC_ALL to C if already set.
+# These must not be set unconditionally because not all systems understand
+# e.g. LANG=C (notably SCO).
+# We save the old values to restore during execute mode.
+for lt_var in LANG LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
+do
+ eval "if test \"\${$lt_var+set}\" = set; then
+ save_$lt_var=\$$lt_var
+ $lt_var=C
+ export $lt_var
+ fi"
+done
+
+# Make sure IFS has a sensible default
+lt_nl='
+'
+IFS=" $lt_nl"
+
+if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
+ $echo "$modename: not configured to build any kind of library" 1>&2
+ $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
+ exit $EXIT_FAILURE
+fi
+
+# Global variables.
+mode=$default_mode
+nonopt=
+prev=
+prevopt=
+run=
+show="$echo"
+show_help=
+execute_dlfiles=
+duplicate_deps=no
+preserve_args=
+lo2o="s/\\.lo\$/.${objext}/"
+o2lo="s/\\.${objext}\$/.lo/"
+extracted_archives=
+extracted_serial=0
+
+#####################################
+# Shell function definitions:
+# This seems to be the best place for them
+
+# func_mktempdir [string]
+# Make a temporary directory that won't clash with other running
+# libtool processes, and avoids race conditions if possible. If
+# given, STRING is the basename for that directory.
+func_mktempdir ()
+{
+ my_template="${TMPDIR-/tmp}/${1-$progname}"
+
+ if test "$run" = ":"; then
+ # Return a directory name, but don't create it in dry-run mode
+ my_tmpdir="${my_template}-$$"
+ else
+
+ # If mktemp works, use that first and foremost
+ my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
+
+ if test ! -d "$my_tmpdir"; then
+ # Failing that, at least try and use $RANDOM to avoid a race
+ my_tmpdir="${my_template}-${RANDOM-0}$$"
+
+ save_mktempdir_umask=`umask`
+ umask 0077
+ $mkdir "$my_tmpdir"
+ umask $save_mktempdir_umask
+ fi
+
+ # If we're not in dry-run mode, bomb out on failure
+ test -d "$my_tmpdir" || {
+ $echo "cannot create temporary directory \`$my_tmpdir'" 1>&2
+ exit $EXIT_FAILURE
+ }
+ fi
+
+ $echo "X$my_tmpdir" | $Xsed
+}
+
+
+# func_win32_libid arg
+# return the library type of file 'arg'
+#
+# Need a lot of goo to handle *both* DLLs and import libs
+# Has to be a shell function in order to 'eat' the argument
+# that is supplied when $file_magic_command is called.
+func_win32_libid ()
+{
+ win32_libid_type="unknown"
+ win32_fileres=`file -L $1 2>/dev/null`
+ case $win32_fileres in
+ *ar\ archive\ import\ library*) # definitely import
+ win32_libid_type="x86 archive import"
+ ;;
+ *ar\ archive*) # could be an import, or static
+ if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \
+ $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
+ win32_nmres=`eval $NM -f posix -A $1 | \
+ $SED -n -e '1,100{/ I /{s,.*,import,;p;q;};}'`
+ case $win32_nmres in
+ import*) win32_libid_type="x86 archive import";;
+ *) win32_libid_type="x86 archive static";;
+ esac
+ fi
+ ;;
+ *DLL*)
+ win32_libid_type="x86 DLL"
+ ;;
+ *executable*) # but shell scripts are "executable" too...
+ case $win32_fileres in
+ *MS\ Windows\ PE\ Intel*)
+ win32_libid_type="x86 DLL"
+ ;;
+ esac
+ ;;
+ esac
+ $echo $win32_libid_type
+}
+
+
+# func_infer_tag arg
+# Infer tagged configuration to use if any are available and
+# if one wasn't chosen via the "--tag" command line option.
+# Only attempt this if the compiler in the base compile
+# command doesn't match the default compiler.
+# arg is usually of the form 'gcc ...'
+func_infer_tag ()
+{
+ if test -n "$available_tags" && test -z "$tagname"; then
+ CC_quoted=
+ for arg in $CC; do
+ case $arg in
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
+ arg="\"$arg\""
+ ;;
+ esac
+ CC_quoted="$CC_quoted $arg"
+ done
+ case $@ in
+ # Blanks in the command may have been stripped by the calling shell,
+ # but not from the CC environment variable when configure was run.
+ " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;;
+ # Blanks at the start of $base_compile will cause this to fail
+ # if we don't check for them as well.
+ *)
+ for z in $available_tags; do
+ if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
+ # Evaluate the configuration.
+ eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
+ CC_quoted=
+ for arg in $CC; do
+ # Double-quote args containing other shell metacharacters.
+ case $arg in
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
+ arg="\"$arg\""
+ ;;
+ esac
+ CC_quoted="$CC_quoted $arg"
+ done
+ case "$@ " in
+ " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*)
+ # The compiler in the base compile command matches
+ # the one in the tagged configuration.
+ # Assume this is the tagged configuration we want.
+ tagname=$z
+ break
+ ;;
+ esac
+ fi
+ done
+ # If $tagname still isn't set, then no tagged configuration
+ # was found and let the user know that the "--tag" command
+ # line option must be used.
+ if test -z "$tagname"; then
+ $echo "$modename: unable to infer tagged configuration"
+ $echo "$modename: specify a tag with \`--tag'" 1>&2
+ exit $EXIT_FAILURE
+# else
+# $echo "$modename: using $tagname tagged configuration"
+ fi
+ ;;
+ esac
+ fi
+}
+
+
+# func_extract_an_archive dir oldlib
+func_extract_an_archive ()
+{
+ f_ex_an_ar_dir="$1"; shift
+ f_ex_an_ar_oldlib="$1"
+
+ $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)"
+ $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" || exit $?
+ if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
+ :
+ else
+ $echo "$modename: ERROR: object name conflicts: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 1>&2
+ exit $EXIT_FAILURE
+ fi
+}
+
+# func_extract_archives gentop oldlib ...
+func_extract_archives ()
+{
+ my_gentop="$1"; shift
+ my_oldlibs=${1+"$@"}
+ my_oldobjs=""
+ my_xlib=""
+ my_xabs=""
+ my_xdir=""
+ my_status=""
+
+ $show "${rm}r $my_gentop"
+ $run ${rm}r "$my_gentop"
+ $show "$mkdir $my_gentop"
+ $run $mkdir "$my_gentop"
+ my_status=$?
+ if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then
+ exit $my_status
+ fi
+
+ for my_xlib in $my_oldlibs; do
+ # Extract the objects.
+ case $my_xlib in
+ [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
+ *) my_xabs=`pwd`"/$my_xlib" ;;
+ esac
+ my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'`
+ my_xlib_u=$my_xlib
+ while :; do
+ case " $extracted_archives " in
+ *" $my_xlib_u "*)
+ extracted_serial=`expr $extracted_serial + 1`
+ my_xlib_u=lt$extracted_serial-$my_xlib ;;
+ *) break ;;
+ esac
+ done
+ extracted_archives="$extracted_archives $my_xlib_u"
+ my_xdir="$my_gentop/$my_xlib_u"
+
+ $show "${rm}r $my_xdir"
+ $run ${rm}r "$my_xdir"
+ $show "$mkdir $my_xdir"
+ $run $mkdir "$my_xdir"
+ exit_status=$?
+ if test "$exit_status" -ne 0 && test ! -d "$my_xdir"; then
+ exit $exit_status
+ fi
+ case $host in
+ *-darwin*)
+ $show "Extracting $my_xabs"
+ # Do not bother doing anything if just a dry run
+ if test -z "$run"; then
+ darwin_orig_dir=`pwd`
+ cd $my_xdir || exit $?
+ darwin_archive=$my_xabs
+ darwin_curdir=`pwd`
+ darwin_base_archive=`$echo "X$darwin_archive" | $Xsed -e 's%^.*/%%'`
+ darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null`
+ if test -n "$darwin_arches"; then
+ darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'`
+ darwin_arch=
+ $show "$darwin_base_archive has multiple architectures $darwin_arches"
+ for darwin_arch in $darwin_arches ; do
+ mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
+ lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
+ cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
+ func_extract_an_archive "`pwd`" "${darwin_base_archive}"
+ cd "$darwin_curdir"
+ $rm "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
+ done # $darwin_arches
+ ## Okay now we have a bunch of thin objects, gotta fatten them up :)
+ darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print| xargs basename | sort -u | $NL2SP`
+ darwin_file=
+ darwin_files=
+ for darwin_file in $darwin_filelist; do
+ darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP`
+ lipo -create -output "$darwin_file" $darwin_files
+ done # $darwin_filelist
+ ${rm}r unfat-$$
+ cd "$darwin_orig_dir"
+ else
+ cd "$darwin_orig_dir"
+ func_extract_an_archive "$my_xdir" "$my_xabs"
+ fi # $darwin_arches
+ fi # $run
+ ;;
+ *)
+ func_extract_an_archive "$my_xdir" "$my_xabs"
+ ;;
+ esac
+ my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
+ done
+ func_extract_archives_result="$my_oldobjs"
+}
+# End of Shell function definitions
+#####################################
+
+# Darwin sucks
+eval std_shrext=\"$shrext_cmds\"
+
+disable_libs=no
+
+# Parse our command line options once, thoroughly.
+while test "$#" -gt 0
+do
+ arg="$1"
+ shift
+
+ case $arg in
+ -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
+ *) optarg= ;;
+ esac
+
+ # If the previous option needs an argument, assign it.
+ if test -n "$prev"; then
+ case $prev in
+ execute_dlfiles)
+ execute_dlfiles="$execute_dlfiles $arg"
+ ;;
+ tag)
+ tagname="$arg"
+ preserve_args="${preserve_args}=$arg"
+
+ # Check whether tagname contains only valid characters
+ case $tagname in
+ *[!-_A-Za-z0-9,/]*)
+ $echo "$progname: invalid tag name: $tagname" 1>&2
+ exit $EXIT_FAILURE
+ ;;
+ esac
+
+ case $tagname in
+ CC)
+ # Don't test for the "default" C tag, as we know, it's there, but
+ # not specially marked.
+ ;;
+ *)
+ if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev/null; then
+ taglist="$taglist $tagname"
+ # Evaluate the configuration.
+ eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`"
+ else
+ $echo "$progname: ignoring unknown tag $tagname" 1>&2
+ fi
+ ;;
+ esac
+ ;;
+ *)
+ eval "$prev=\$arg"
+ ;;
+ esac
+
+ prev=
+ prevopt=
+ continue
+ fi
+
+ # Have we seen a non-optional argument yet?
+ case $arg in
+ --help)
+ show_help=yes
+ ;;
+
+ --version)
+ $echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
+ $echo
+ $echo "Copyright (C) 2005 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 $?
+ ;;
+
+ --config)
+ ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath
+ # Now print the configurations for the tags.
+ for tagname in $taglist; do
+ ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath"
+ done
+ exit $?
+ ;;
+
+ --debug)
+ $echo "$progname: enabling shell trace mode"
+ set -x
+ preserve_args="$preserve_args $arg"
+ ;;
+
+ --dry-run | -n)
+ run=:
+ ;;
+
+ --features)
+ $echo "host: $host"
+ if test "$build_libtool_libs" = yes; then
+ $echo "enable shared libraries"
+ else
+ $echo "disable shared libraries"
+ fi
+ if test "$build_old_libs" = yes; then
+ $echo "enable static libraries"
+ else
+ $echo "disable static libraries"
+ fi
+ exit $?
+ ;;
+
+ --finish) mode="finish" ;;
+
+ --mode) prevopt="--mode" prev=mode ;;
+ --mode=*) mode="$optarg" ;;
+
+ --preserve-dup-deps) duplicate_deps="yes" ;;
+
+ --quiet | --silent)
+ show=:
+ preserve_args="$preserve_args $arg"
+ ;;
+
+ --tag)
+ prevopt="--tag"
+ prev=tag
+ preserve_args="$preserve_args --tag"
+ ;;
+ --tag=*)
+ set tag "$optarg" ${1+"$@"}
+ shift
+ prev=tag
+ preserve_args="$preserve_args --tag"
+ ;;
+
+ -dlopen)
+ prevopt="-dlopen"
+ prev=execute_dlfiles
+ ;;
+
+ -*)
+ $echo "$modename: unrecognized option \`$arg'" 1>&2
+ $echo "$help" 1>&2
+ exit $EXIT_FAILURE
+ ;;
+
+ *)
+ nonopt="$arg"
+ break
+ ;;
+ esac
+done
+
+if test -n "$prevopt"; then
+ $echo "$modename: option \`$prevopt' requires an argument" 1>&2
+ $echo "$help" 1>&2
+ exit $EXIT_FAILURE
+fi
+
+case $disable_libs in
+no)
+ ;;
+shared)
+ build_libtool_libs=no
+ build_old_libs=yes
+ ;;
+static)
+ build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
+ ;;
+esac
+
+# If this variable is set in any of the actions, the command in it
+# will be execed at the end. This prevents here-documents from being
+# left over by shells.
+exec_cmd=
+
+if test -z "$show_help"; then
+
+ # Infer the operation mode.
+ if test -z "$mode"; then
+ $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2
+ $echo "*** Future versions of Libtool will require --mode=MODE be specified." 1>&2
+ case $nonopt in
+ *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*)
+ mode=link
+ for arg
+ do
+ case $arg in
+ -c)
+ mode=compile
+ break
+ ;;
+ esac
+ done
+ ;;
+ *db | *dbx | *strace | *truss)
+ mode=execute
+ ;;
+ *install*|cp|mv)
+ mode=install
+ ;;
+ *rm)
+ mode=uninstall
+ ;;
+ *)
+ # If we have no mode, but dlfiles were specified, then do execute mode.
+ test -n "$execute_dlfiles" && mode=execute
+
+ # Just use the default operation mode.
+ if test -z "$mode"; then
+ if test -n "$nonopt"; then
+ $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2
+ else
+ $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
+ fi
+ fi
+ ;;
+ esac
+ fi
+
+ # Only execute mode is allowed to have -dlopen flags.
+ if test -n "$execute_dlfiles" && test "$mode" != execute; then
+ $echo "$modename: unrecognized option \`-dlopen'" 1>&2
+ $echo "$help" 1>&2
+ exit $EXIT_FAILURE
+ fi
+
+ # Change the help message to a mode-specific one.
+ generic_help="$help"
+ help="Try \`$modename --help --mode=$mode' for more information."
+
+ # These modes are in order of execution frequency so that they run quickly.
+ case $mode in
+ # libtool compile mode
+ compile)
+ modename="$modename: compile"
+ # Get the compilation command and the source file.
+ base_compile=
+ srcfile="$nonopt" # always keep a non-empty value in "srcfile"
+ suppress_opt=yes
+ suppress_output=
+ arg_mode=normal
+ libobj=
+ later=
+
+ for arg
+ do
+ case $arg_mode in
+ arg )
+ # do not "continue". Instead, add this to base_compile
+ lastarg="$arg"
+ arg_mode=normal
+ ;;
+
+ target )
+ libobj="$arg"
+ arg_mode=normal
+ continue
+ ;;
+
+ normal )
+ # Accept any command-line options.
+ case $arg in
+ -o)
+ if test -n "$libobj" ; then
+ $echo "$modename: you cannot specify \`-o' more than once" 1>&2
+ exit $EXIT_FAILURE
+ fi
+ arg_mode=target
+ continue
+ ;;
+
+ -static | -prefer-pic | -prefer-non-pic)
+ later="$later $arg"
+ continue
+ ;;
+
+ -no-suppress)
+ suppress_opt=no
+ continue
+ ;;
+
+ -Xcompiler)
+ arg_mode=arg # the next one goes into the "base_compile" arg list
+ continue # The current "srcfile" will either be retained or
+ ;; # replaced later. I would guess that would be a bug.
+
+ -Wc,*)
+ args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
+ lastarg=
+ save_ifs="$IFS"; IFS=','
+ for arg in $args; do
+ IFS="$save_ifs"
+
+ # Double-quote args containing other shell metacharacters.
+ # Many Bourne shells cannot handle close brackets correctly
+ # in scan sets, so we specify it separately.
+ case $arg in
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
+ arg="\"$arg\""
+ ;;
+ esac
+ lastarg="$lastarg $arg"
+ done
+ IFS="$save_ifs"
+ lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"`
+
+ # Add the arguments to base_compile.
+ base_compile="$base_compile $lastarg"
+ continue
+ ;;
+
+ * )
+ # Accept the current argument as the source file.
+ # The previous "srcfile" becomes the current argument.
+ #
+ lastarg="$srcfile"
+ srcfile="$arg"
+ ;;
+ esac # case $arg
+ ;;
+ esac # case $arg_mode
+
+ # Aesthetically quote the previous argument.
+ lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
+
+ case $lastarg in
+ # Double-quote args containing other shell metacharacters.
+ # Many Bourne shells cannot handle close brackets correctly
+ # in scan sets, and some SunOS ksh mistreat backslash-escaping
+ # in scan sets (worked around with variable expansion),
+ # and furthermore cannot handle '|' '&' '(' ')' in scan sets
+ # at all, so we specify them separately.
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
+ lastarg="\"$lastarg\""
+ ;;
+ esac
+
+ base_compile="$base_compile $lastarg"
+ done # for arg
+
+ case $arg_mode in
+ arg)
+ $echo "$modename: you must specify an argument for -Xcompile"
+ exit $EXIT_FAILURE
+ ;;
+ target)
+ $echo "$modename: you must specify a target with \`-o'" 1>&2
+ exit $EXIT_FAILURE
+ ;;
+ *)
+ # Get the name of the library object.
+ [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
+ ;;
+ esac
+
+ # Recognize several different file suffixes.
+ # If the user specifies -o file.o, it is replaced with file.lo
+ xform='[cCFSifmso]'
+ case $libobj in
+ *.ada) xform=ada ;;
+ *.adb) xform=adb ;;
+ *.ads) xform=ads ;;
+ *.asm) xform=asm ;;
+ *.c++) xform=c++ ;;
+ *.cc) xform=cc ;;
+ *.ii) xform=ii ;;
+ *.class) xform=class ;;
+ *.cpp) xform=cpp ;;
+ *.cxx) xform=cxx ;;
+ *.f90) xform=f90 ;;
+ *.for) xform=for ;;
+ *.java) xform=java ;;
+ *.obj) xform=obj ;;
+ esac
+
+ libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
+
+ case $libobj in
+ *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
+ *)
+ $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
+ exit $EXIT_FAILURE
+ ;;
+ esac
+
+ func_infer_tag $base_compile
+
+ for arg in $later; do
+ case $arg in
+ -static)
+ build_old_libs=yes
+ continue
+ ;;
+
+ -prefer-pic)
+ pic_mode=yes
+ continue
+ ;;
+
+ -prefer-non-pic)
+ pic_mode=no
+ continue
+ ;;
+ esac
+ done
+
+ qlibobj=`$echo "X$libobj" | $Xsed -e "$sed_quote_subst"`
+ case $qlibobj in
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
+ qlibobj="\"$qlibobj\"" ;;
+ esac
+ test "X$libobj" != "X$qlibobj" \
+ && $echo "X$libobj" | grep '[]~#^*{};<>?"'"'"' &()|`$[]' \
+ && $echo "$modename: libobj name \`$libobj' may not contain shell special characters."
+ objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
+ xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
+ if test "X$xdir" = "X$obj"; then
+ xdir=
+ else
+ xdir=$xdir/
+ fi
+ lobj=${xdir}$objdir/$objname
+
+ if test -z "$base_compile"; then
+ $echo "$modename: you must specify a compilation command" 1>&2
+ $echo "$help" 1>&2
+ exit $EXIT_FAILURE
+ fi
+
+ # Delete any leftover library objects.
+ if test "$build_old_libs" = yes; then
+ removelist="$obj $lobj $libobj ${libobj}T"
+ else
+ removelist="$lobj $libobj ${libobj}T"
+ fi
+
+ $run $rm $removelist
+ trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
+
+ # On Cygwin there's no "real" PIC flag so we must build both object types
+ case $host_os in
+ cygwin* | mingw* | pw32* | os2*)
+ pic_mode=default
+ ;;
+ esac
+ if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
+ # non-PIC code in shared libraries is not supported
+ pic_mode=default
+ fi
+
+ # Calculate the filename of the output object if compiler does
+ # not support -o with -c
+ if test "$compiler_c_o" = no; then
+ output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
+ lockfile="$output_obj.lock"
+ removelist="$removelist $output_obj $lockfile"
+ trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
+ else
+ output_obj=
+ need_locks=no
+ lockfile=
+ fi
+
+ # Lock this critical section if it is needed
+ # We use this script file to make the link, it avoids creating a new file
+ if test "$need_locks" = yes; then
+ until $run ln "$progpath" "$lockfile" 2>/dev/null; do
+ $show "Waiting for $lockfile to be removed"
+ sleep 2
+ done
+ elif test "$need_locks" = warn; then
+ if test -f "$lockfile"; then
+ $echo "\
+*** ERROR, $lockfile exists and contains:
+`cat $lockfile 2>/dev/null`
+
+This indicates that another process is trying to use the same
+temporary object file, and libtool could not work around it because
+your compiler does not support \`-c' and \`-o' together. If you
+repeat this compilation, it may succeed, by chance, but you had better
+avoid parallel builds (make -j) in this platform, or get a better
+compiler."
+
+ $run $rm $removelist
+ exit $EXIT_FAILURE
+ fi
+ $echo "$srcfile" > "$lockfile"
+ fi
+
+ if test -n "$fix_srcfile_path"; then
+ eval srcfile=\"$fix_srcfile_path\"
+ fi
+ qsrcfile=`$echo "X$srcfile" | $Xsed -e "$sed_quote_subst"`
+ case $qsrcfile in
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
+ qsrcfile="\"$qsrcfile\"" ;;
+ esac
+
+ $run $rm "$libobj" "${libobj}T"
+
+ # Create a libtool object file (analogous to a ".la" file),
+ # but don't create it if we're doing a dry run.
+ test -z "$run" && cat > ${libobj}T <<EOF
+# $libobj - a libtool object file
+# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
+#
+# Please DO NOT delete this file!
+# It is necessary for linking the library.
+
+# Name of the PIC object.
+EOF
+
+ # Only build a PIC object if we are building libtool libraries.
+ if test "$build_libtool_libs" = yes; then
+ # Without this assignment, base_compile gets emptied.
+ fbsd_hideous_sh_bug=$base_compile
+
+ if test "$pic_mode" != no; then
+ command="$base_compile $qsrcfile $pic_flag"
+ else
+ # Don't build PIC code
+ command="$base_compile $qsrcfile"
+ fi
+
+ if test ! -d "${xdir}$objdir"; then
+ $show "$mkdir ${xdir}$objdir"
+ $run $mkdir ${xdir}$objdir
+ exit_status=$?
+ if test "$exit_status" -ne 0 && test ! -d "${xdir}$objdir"; then
+ exit $exit_status
+ fi
+ fi
+
+ if test -z "$output_obj"; then
+ # Place PIC objects in $objdir
+ command="$command -o $lobj"
+ fi
+
+ $run $rm "$lobj" "$output_obj"
+
+ $show "$command"
+ if $run eval "$command"; then :
+ else
+ test -n "$output_obj" && $run $rm $removelist
+ exit $EXIT_FAILURE
+ fi
+
+ if test "$need_locks" = warn &&
+ test "X`cat $lockfile 2>/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 <<EOF
+pic_object='$objdir/$objname'
+
+EOF
+
+ # Allow error messages only from the first compilation.
+ if test "$suppress_opt" = yes; then
+ suppress_output=' >/dev/null 2>&1'
+ fi
+ else
+ # No PIC object so indicate it doesn't exist in the libtool
+ # object file.
+ test -z "$run" && cat >> ${libobj}T <<EOF
+pic_object=none
+
+EOF
+ fi
+
+ # Only build a position-dependent object if we build old libraries.
+ if test "$build_old_libs" = yes; then
+ if test "$pic_mode" != yes; then
+ # Don't build PIC code
+ command="$base_compile $qsrcfile"
+ else
+ command="$base_compile $qsrcfile $pic_flag"
+ fi
+ if test "$compiler_c_o" = yes; then
+ command="$command -o $obj"
+ fi
+
+ # Suppress compiler output if we already did a PIC compilation.
+ command="$command$suppress_output"
+ $run $rm "$obj" "$output_obj"
+ $show "$command"
+ if $run eval "$command"; then :
+ else
+ $run $rm $removelist
+ exit $EXIT_FAILURE
+ fi
+
+ if test "$need_locks" = warn &&
+ test "X`cat $lockfile 2>/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 <<EOF
+# Name of the non-PIC object.
+non_pic_object='$objname'
+
+EOF
+ else
+ # 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 <<EOF
+# Name of the non-PIC object.
+non_pic_object=none
+
+EOF
+ fi
+
+ $run $mv "${libobj}T" "${libobj}"
+
+ # Unlock the critical section if it was locked
+ if test "$need_locks" != no; then
+ $run $rm "$lockfile"
+ fi
+
+ exit $EXIT_SUCCESS
+ ;;
+
+ # libtool link mode
+ link | relink)
+ modename="$modename: link"
+ case $host in
+ *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
+ # It is impossible to link a dll without this setting, and
+ # we shouldn't force the makefile maintainer to figure out
+ # which system we are compiling for in order to pass an extra
+ # flag for every libtool invocation.
+ # allow_undefined=no
+
+ # FIXME: Unfortunately, there are problems with the above when trying
+ # to make a dll which has undefined symbols, in which case not
+ # even a static library is built. For now, we need to specify
+ # -no-undefined on the libtool link line when we can be certain
+ # that all symbols are satisfied, otherwise we get a static library.
+ allow_undefined=yes
+ ;;
+ *)
+ allow_undefined=yes
+ ;;
+ esac
+ libtool_args="$nonopt"
+ base_compile="$nonopt $@"
+ compile_command="$nonopt"
+ finalize_command="$nonopt"
+
+ compile_rpath=
+ finalize_rpath=
+ compile_shlibpath=
+ finalize_shlibpath=
+ convenience=
+ old_convenience=
+ deplibs=
+ old_deplibs=
+ compiler_flags=
+ linker_flags=
+ dllsearchpath=
+ lib_search_path=`pwd`
+ inst_prefix_dir=
+
+ avoid_version=no
+ dlfiles=
+ dlprefiles=
+ dlself=no
+ export_dynamic=no
+ export_symbols=
+ export_symbols_regex=
+ generated=
+ libobjs=
+ ltlibs=
+ module=no
+ no_install=no
+ objs=
+ non_pic_objects=
+ notinst_path= # paths that contain not-installed libtool libraries
+ precious_files_regex=
+ prefer_static_libs=no
+ preload=no
+ prev=
+ prevarg=
+ release=
+ rpath=
+ xrpath=
+ perm_rpath=
+ temp_rpath=
+ thread_safe=no
+ vinfo=
+ vinfo_number=no
+
+ func_infer_tag $base_compile
+
+ # We need to know -static, to get the right output filenames.
+ for arg
+ do
+ case $arg in
+ -all-static | -static | -static-libtool-libs)
+ case $arg in
+ -all-static)
+ if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
+ $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
+ fi
+ if test -n "$link_static_flag"; then
+ dlopen_self=$dlopen_self_static
+ fi
+ prefer_static_libs=yes
+ ;;
+ -static)
+ if test -z "$pic_flag" && test -n "$link_static_flag"; then
+ dlopen_self=$dlopen_self_static
+ fi
+ prefer_static_libs=built
+ ;;
+ -static-libtool-libs)
+ if test -z "$pic_flag" && test -n "$link_static_flag"; then
+ dlopen_self=$dlopen_self_static
+ fi
+ prefer_static_libs=yes
+ ;;
+ esac
+ build_libtool_libs=no
+ build_old_libs=yes
+ break
+ ;;
+ esac
+ done
+
+ # See if our shared archives depend on static archives.
+ test -n "$old_archive_from_new_cmds" && build_old_libs=yes
+
+ # Go through the arguments, transforming them on the way.
+ while test "$#" -gt 0; do
+ arg="$1"
+ shift
+ case $arg in
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
+ qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test
+ ;;
+ *) qarg=$arg ;;
+ esac
+ libtool_args="$libtool_args $qarg"
+
+ # If the previous option needs an argument, assign it.
+ if test -n "$prev"; then
+ case $prev in
+ output)
+ compile_command="$compile_command @OUTPUT@"
+ finalize_command="$finalize_command @OUTPUT@"
+ ;;
+ esac
+
+ case $prev in
+ dlfiles|dlprefiles)
+ if test "$preload" = no; then
+ # Add the symbol object into the linking commands.
+ compile_command="$compile_command @SYMFILE@"
+ finalize_command="$finalize_command @SYMFILE@"
+ preload=yes
+ fi
+ case $arg in
+ *.la | *.lo) ;; # We handle these cases below.
+ force)
+ if test "$dlself" = no; then
+ dlself=needless
+ export_dynamic=yes
+ fi
+ prev=
+ continue
+ ;;
+ self)
+ if test "$prev" = dlprefiles; then
+ dlself=yes
+ elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
+ dlself=yes
+ else
+ dlself=needless
+ export_dynamic=yes
+ fi
+ prev=
+ continue
+ ;;
+ *)
+ if test "$prev" = dlfiles; then
+ dlfiles="$dlfiles $arg"
+ else
+ dlprefiles="$dlprefiles $arg"
+ fi
+ prev=
+ continue
+ ;;
+ esac
+ ;;
+ expsyms)
+ export_symbols="$arg"
+ if test ! -f "$arg"; then
+ $echo "$modename: symbol file \`$arg' does not exist"
+ exit $EXIT_FAILURE
+ fi
+ prev=
+ continue
+ ;;
+ expsyms_regex)
+ export_symbols_regex="$arg"
+ prev=
+ continue
+ ;;
+ inst_prefix)
+ inst_prefix_dir="$arg"
+ prev=
+ continue
+ ;;
+ precious_regex)
+ precious_files_regex="$arg"
+ prev=
+ continue
+ ;;
+ release)
+ release="-$arg"
+ prev=
+ continue
+ ;;
+ objectlist)
+ if test -f "$arg"; then
+ save_arg=$arg
+ moreargs=
+ for fil in `cat $save_arg`
+ do
+# moreargs="$moreargs $fil"
+ arg=$fil
+ # A libtool-controlled object.
+
+ # Check to see that this really is a libtool object.
+ if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
+ pic_object=
+ non_pic_object=
+
+ # Read the .lo file
+ # If there is no directory component, then add one.
+ case $arg in
+ */* | *\\*) . $arg ;;
+ *) . ./$arg ;;
+ esac
+
+ if test -z "$pic_object" || \
+ test -z "$non_pic_object" ||
+ test "$pic_object" = none && \
+ test "$non_pic_object" = none; then
+ $echo "$modename: cannot find name of object for \`$arg'" 1>&2
+ exit $EXIT_FAILURE
+ fi
+
+ # Extract subdirectory from the argument.
+ xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
+ if test "X$xdir" = "X$arg"; then
+ xdir=
+ else
+ xdir="$xdir/"
+ fi
+
+ if test "$pic_object" != none; then
+ # Prepend the subdirectory the object is found in.
+ pic_object="$xdir$pic_object"
+
+ if test "$prev" = dlfiles; then
+ if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
+ dlfiles="$dlfiles $pic_object"
+ prev=
+ continue
+ else
+ # If libtool objects are unsupported, then we need to preload.
+ prev=dlprefiles
+ fi
+ fi
+
+ # CHECK ME: I think I busted this. -Ossama
+ if test "$prev" = dlprefiles; then
+ # Preload the old-style object.
+ dlprefiles="$dlprefiles $pic_object"
+ prev=
+ fi
+
+ # A PIC object.
+ libobjs="$libobjs $pic_object"
+ arg="$pic_object"
+ fi
+
+ # Non-PIC object.
+ if test "$non_pic_object" != none; then
+ # Prepend the subdirectory the object is found in.
+ non_pic_object="$xdir$non_pic_object"
+
+ # A standard non-PIC object
+ non_pic_objects="$non_pic_objects $non_pic_object"
+ if test -z "$pic_object" || test "$pic_object" = none ; then
+ arg="$non_pic_object"
+ fi
+ else
+ # If the PIC object exists, use it instead.
+ # $xdir was prepended to $pic_object above.
+ non_pic_object="$pic_object"
+ non_pic_objects="$non_pic_objects $non_pic_object"
+ fi
+ else
+ # Only an error if not doing a dry-run.
+ if test -z "$run"; then
+ $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
+ exit $EXIT_FAILURE
+ else
+ # Dry-run case.
+
+ # Extract subdirectory from the argument.
+ xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
+ if test "X$xdir" = "X$arg"; then
+ xdir=
+ else
+ xdir="$xdir/"
+ fi
+
+ pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
+ non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
+ libobjs="$libobjs $pic_object"
+ non_pic_objects="$non_pic_objects $non_pic_object"
+ fi
+ fi
+ done
+ else
+ $echo "$modename: link input file \`$save_arg' does not exist"
+ exit $EXIT_FAILURE
+ fi
+ arg=$save_arg
+ prev=
+ continue
+ ;;
+ rpath | xrpath)
+ # We need an absolute path.
+ case $arg in
+ [\\/]* | [A-Za-z]:[\\/]*) ;;
+ *)
+ $echo "$modename: only absolute run-paths are allowed" 1>&2
+ exit $EXIT_FAILURE
+ ;;
+ esac
+ if test "$prev" = rpath; then
+ case "$rpath " in
+ *" $arg "*) ;;
+ *) rpath="$rpath $arg" ;;
+ esac
+ else
+ case "$xrpath " in
+ *" $arg "*) ;;
+ *) xrpath="$xrpath $arg" ;;
+ esac
+ fi
+ prev=
+ continue
+ ;;
+ xcompiler)
+ compiler_flags="$compiler_flags $qarg"
+ prev=
+ compile_command="$compile_command $qarg"
+ finalize_command="$finalize_command $qarg"
+ continue
+ ;;
+ xlinker)
+ linker_flags="$linker_flags $qarg"
+ compiler_flags="$compiler_flags $wl$qarg"
+ prev=
+ compile_command="$compile_command $wl$qarg"
+ finalize_command="$finalize_command $wl$qarg"
+ continue
+ ;;
+ xcclinker)
+ linker_flags="$linker_flags $qarg"
+ compiler_flags="$compiler_flags $qarg"
+ prev=
+ compile_command="$compile_command $qarg"
+ finalize_command="$finalize_command $qarg"
+ continue
+ ;;
+ shrext)
+ shrext_cmds="$arg"
+ prev=
+ continue
+ ;;
+ darwin_framework|darwin_framework_skip)
+ test "$prev" = "darwin_framework" && compiler_flags="$compiler_flags $arg"
+ compile_command="$compile_command $arg"
+ finalize_command="$finalize_command $arg"
+ prev=
+ continue
+ ;;
+ *)
+ eval "$prev=\"\$arg\""
+ prev=
+ continue
+ ;;
+ esac
+ fi # test -n "$prev"
+
+ prevarg="$arg"
+
+ case $arg in
+ -all-static)
+ if test -n "$link_static_flag"; then
+ compile_command="$compile_command $link_static_flag"
+ finalize_command="$finalize_command $link_static_flag"
+ fi
+ continue
+ ;;
+
+ -allow-undefined)
+ # FIXME: remove this flag sometime in the future.
+ $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
+ continue
+ ;;
+
+ -avoid-version)
+ avoid_version=yes
+ continue
+ ;;
+
+ -dlopen)
+ prev=dlfiles
+ continue
+ ;;
+
+ -dlpreopen)
+ prev=dlprefiles
+ continue
+ ;;
+
+ -export-dynamic)
+ export_dynamic=yes
+ continue
+ ;;
+
+ -export-symbols | -export-symbols-regex)
+ if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
+ $echo "$modename: more than one -exported-symbols argument is not allowed"
+ exit $EXIT_FAILURE
+ fi
+ if test "X$arg" = "X-export-symbols"; then
+ prev=expsyms
+ else
+ prev=expsyms_regex
+ fi
+ continue
+ ;;
+
+ -framework|-arch|-isysroot)
+ case " $CC " in
+ *" ${arg} ${1} "* | *" ${arg} ${1} "*)
+ prev=darwin_framework_skip ;;
+ *) compiler_flags="$compiler_flags $arg"
+ prev=darwin_framework ;;
+ esac
+ compile_command="$compile_command $arg"
+ finalize_command="$finalize_command $arg"
+ continue
+ ;;
+
+ -inst-prefix-dir)
+ prev=inst_prefix
+ continue
+ ;;
+
+ # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
+ # so, if we see these flags be careful not to treat them like -L
+ -L[A-Z][A-Z]*:*)
+ case $with_gcc/$host in
+ no/*-*-irix* | /*-*-irix*)
+ compile_command="$compile_command $arg"
+ finalize_command="$finalize_command $arg"
+ ;;
+ esac
+ continue
+ ;;
+
+ -L*)
+ dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
+ # We need an absolute path.
+ case $dir in
+ [\\/]* | [A-Za-z]:[\\/]*) ;;
+ *)
+ absdir=`cd "$dir" && pwd`
+ if test -z "$absdir"; then
+ $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
+ absdir="$dir"
+ notinst_path="$notinst_path $dir"
+ fi
+ dir="$absdir"
+ ;;
+ esac
+ case "$deplibs " in
+ *" -L$dir "*) ;;
+ *)
+ deplibs="$deplibs -L$dir"
+ lib_search_path="$lib_search_path $dir"
+ ;;
+ esac
+ case $host in
+ *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
+ testbindir=`$echo "X$dir" | $Xsed -e 's*/lib$*/bin*'`
+ case :$dllsearchpath: in
+ *":$dir:"*) ;;
+ *) dllsearchpath="$dllsearchpath:$dir";;
+ esac
+ case :$dllsearchpath: in
+ *":$testbindir:"*) ;;
+ *) dllsearchpath="$dllsearchpath:$testbindir";;
+ esac
+ ;;
+ esac
+ continue
+ ;;
+
+ -l*)
+ if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
+ case $host in
+ *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos*)
+ # These systems don't actually have a C or math library (as such)
+ continue
+ ;;
+ *-*-os2*)
+ # These systems don't actually have a C library (as such)
+ test "X$arg" = "X-lc" && continue
+ ;;
+ *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
+ # Do not include libc due to us having libc/libc_r.
+ test "X$arg" = "X-lc" && continue
+ ;;
+ *-*-rhapsody* | *-*-darwin1.[012])
+ # Rhapsody C and math libraries are in the System framework
+ deplibs="$deplibs -framework System"
+ continue
+ ;;
+ *-*-sco3.2v5* | *-*-sco5v6*)
+ # Causes problems with __ctype
+ test "X$arg" = "X-lc" && continue
+ ;;
+ *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
+ # Compiler inserts libc in the correct place for threads to work
+ test "X$arg" = "X-lc" && continue
+ ;;
+ esac
+ elif test "X$arg" = "X-lc_r"; then
+ case $host in
+ *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
+ # Do not include libc_r directly, use -pthread flag.
+ continue
+ ;;
+ esac
+ fi
+ deplibs="$deplibs $arg"
+ continue
+ ;;
+
+ # Tru64 UNIX uses -model [arg] to determine the layout of C++
+ # classes, name mangling, and exception handling.
+ -model)
+ compile_command="$compile_command $arg"
+ compiler_flags="$compiler_flags $arg"
+ finalize_command="$finalize_command $arg"
+ prev=xcompiler
+ continue
+ ;;
+
+ -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
+ compiler_flags="$compiler_flags $arg"
+ compile_command="$compile_command $arg"
+ finalize_command="$finalize_command $arg"
+ continue
+ ;;
+
+ -module)
+ module=yes
+ continue
+ ;;
+
+ # -64, -mips[0-9] enable 64-bit mode on the SGI compiler
+ # -r[0-9][0-9]* specifies the processor on the SGI compiler
+ # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler
+ # +DA*, +DD* enable 64-bit mode on the HP compiler
+ # -q* pass through compiler args for the IBM compiler
+ # -m* pass through architecture-specific compiler args for GCC
+ # -m*, -t[45]*, -txscale* pass through architecture-specific
+ # compiler args for GCC
+ # -pg pass through profiling flag for GCC
+ # @file GCC response files
+ -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*|-pg| \
+ -t[45]*|-txscale*|@*)
+
+ # Unknown arguments in both finalize_command and compile_command need
+ # to be aesthetically quoted because they are evaled later.
+ arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
+ case $arg in
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
+ arg="\"$arg\""
+ ;;
+ esac
+ compile_command="$compile_command $arg"
+ finalize_command="$finalize_command $arg"
+ compiler_flags="$compiler_flags $arg"
+ continue
+ ;;
+
+ -shrext)
+ prev=shrext
+ continue
+ ;;
+
+ -no-fast-install)
+ fast_install=no
+ continue
+ ;;
+
+ -no-install)
+ case $host in
+ *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
+ # 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 | -static-libtool-libs)
+ # The effects of -static are defined in a previous loop.
+ # We used to do the same as -all-static on platforms that
+ # didn't have a PIC flag, but the assumption that the effects
+ # would be equivalent was wrong. It would break on at least
+ # Digital Unix and AIX.
+ continue
+ ;;
+
+ -thread-safe)
+ thread_safe=yes
+ continue
+ ;;
+
+ -version-info)
+ prev=vinfo
+ continue
+ ;;
+ -version-number)
+ prev=vinfo
+ vinfo_number=yes
+ continue
+ ;;
+
+ -Wc,*)
+ args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'`
+ arg=
+ save_ifs="$IFS"; IFS=','
+ for flag in $args; do
+ IFS="$save_ifs"
+ case $flag in
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
+ flag="\"$flag\""
+ ;;
+ esac
+ arg="$arg $wl$flag"
+ compiler_flags="$compiler_flags $flag"
+ done
+ IFS="$save_ifs"
+ arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
+ ;;
+
+ -Wl,*)
+ args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'`
+ arg=
+ save_ifs="$IFS"; IFS=','
+ for flag in $args; do
+ IFS="$save_ifs"
+ case $flag in
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
+ flag="\"$flag\""
+ ;;
+ esac
+ arg="$arg $wl$flag"
+ compiler_flags="$compiler_flags $wl$flag"
+ linker_flags="$linker_flags $flag"
+ done
+ IFS="$save_ifs"
+ arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
+ ;;
+
+ -Xcompiler)
+ prev=xcompiler
+ continue
+ ;;
+
+ -Xlinker)
+ prev=xlinker
+ continue
+ ;;
+
+ -XCClinker)
+ prev=xcclinker
+ continue
+ ;;
+
+ # Some other compiler flag.
+ -* | +*)
+ # Unknown arguments in both finalize_command and compile_command need
+ # to be aesthetically quoted because they are evaled later.
+ arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
+ case $arg in
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
+ arg="\"$arg\""
+ ;;
+ esac
+ ;;
+
+ *.$objext)
+ # A standard object.
+ objs="$objs $arg"
+ ;;
+
+ *.lo)
+ # A libtool-controlled object.
+
+ # Check to see that this really is a libtool object.
+ if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
+ pic_object=
+ non_pic_object=
+
+ # Read the .lo file
+ # If there is no directory component, then add one.
+ case $arg in
+ */* | *\\*) . $arg ;;
+ *) . ./$arg ;;
+ esac
+
+ if test -z "$pic_object" || \
+ test -z "$non_pic_object" ||
+ test "$pic_object" = none && \
+ test "$non_pic_object" = none; then
+ $echo "$modename: cannot find name of object for \`$arg'" 1>&2
+ exit $EXIT_FAILURE
+ fi
+
+ # Extract subdirectory from the argument.
+ xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
+ if test "X$xdir" = "X$arg"; then
+ xdir=
+ else
+ xdir="$xdir/"
+ fi
+
+ if test "$pic_object" != none; then
+ # Prepend the subdirectory the object is found in.
+ pic_object="$xdir$pic_object"
+
+ if test "$prev" = dlfiles; then
+ if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
+ dlfiles="$dlfiles $pic_object"
+ prev=
+ continue
+ else
+ # If libtool objects are unsupported, then we need to preload.
+ prev=dlprefiles
+ fi
+ fi
+
+ # CHECK ME: I think I busted this. -Ossama
+ if test "$prev" = dlprefiles; then
+ # Preload the old-style object.
+ dlprefiles="$dlprefiles $pic_object"
+ prev=
+ fi
+
+ # A PIC object.
+ libobjs="$libobjs $pic_object"
+ arg="$pic_object"
+ fi
+
+ # Non-PIC object.
+ if test "$non_pic_object" != none; then
+ # Prepend the subdirectory the object is found in.
+ non_pic_object="$xdir$non_pic_object"
+
+ # A standard non-PIC object
+ non_pic_objects="$non_pic_objects $non_pic_object"
+ if test -z "$pic_object" || test "$pic_object" = none ; then
+ arg="$non_pic_object"
+ fi
+ else
+ # If the PIC object exists, use it instead.
+ # $xdir was prepended to $pic_object above.
+ non_pic_object="$pic_object"
+ non_pic_objects="$non_pic_objects $non_pic_object"
+ fi
+ else
+ # Only an error if not doing a dry-run.
+ if test -z "$run"; then
+ $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
+ exit $EXIT_FAILURE
+ else
+ # Dry-run case.
+
+ # Extract subdirectory from the argument.
+ xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
+ if test "X$xdir" = "X$arg"; then
+ xdir=
+ else
+ xdir="$xdir/"
+ fi
+
+ pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
+ non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
+ libobjs="$libobjs $pic_object"
+ non_pic_objects="$non_pic_objects $non_pic_object"
+ fi
+ fi
+ ;;
+
+ *.$libext)
+ # An archive.
+ deplibs="$deplibs $arg"
+ old_deplibs="$old_deplibs $arg"
+ continue
+ ;;
+
+ *.la)
+ # A libtool-controlled library.
+
+ if test "$prev" = dlfiles; then
+ # This library was specified with -dlopen.
+ dlfiles="$dlfiles $arg"
+ prev=
+ elif test "$prev" = dlprefiles; then
+ # The library was specified with -dlpreopen.
+ dlprefiles="$dlprefiles $arg"
+ prev=
+ else
+ deplibs="$deplibs $arg"
+ fi
+ continue
+ ;;
+
+ # Some other compiler argument.
+ *)
+ # Unknown arguments in both finalize_command and compile_command need
+ # to be aesthetically quoted because they are evaled later.
+ arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
+ case $arg in
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
+ arg="\"$arg\""
+ ;;
+ esac
+ ;;
+ esac # arg
+
+ # Now actually substitute the argument into the commands.
+ if test -n "$arg"; then
+ compile_command="$compile_command $arg"
+ finalize_command="$finalize_command $arg"
+ fi
+ done # argument parsing loop
+
+ if test -n "$prev"; then
+ $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
+ $echo "$help" 1>&2
+ exit $EXIT_FAILURE
+ fi
+
+ if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
+ eval arg=\"$export_dynamic_flag_spec\"
+ compile_command="$compile_command $arg"
+ finalize_command="$finalize_command $arg"
+ fi
+
+ oldlibs=
+ # calculate the name of the file, without its directory
+ outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
+ libobjs_save="$libobjs"
+
+ if test -n "$shlibpath_var"; then
+ # get the directories listed in $shlibpath_var
+ eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
+ else
+ shlib_search_path=
+ fi
+ eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
+ eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
+
+ output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
+ if test "X$output_objdir" = "X$output"; then
+ output_objdir="$objdir"
+ else
+ output_objdir="$output_objdir/$objdir"
+ fi
+ # Create the object directory.
+ if test ! -d "$output_objdir"; then
+ $show "$mkdir $output_objdir"
+ $run $mkdir $output_objdir
+ exit_status=$?
+ if test "$exit_status" -ne 0 && test ! -d "$output_objdir"; then
+ exit $exit_status
+ fi
+ fi
+
+ # Determine the type of output
+ case $output in
+ "")
+ $echo "$modename: you must specify an output file" 1>&2
+ $echo "$help" 1>&2
+ exit $EXIT_FAILURE
+ ;;
+ *.$libext) linkmode=oldlib ;;
+ *.lo | *.$objext) linkmode=obj ;;
+ *.la) linkmode=lib ;;
+ *) linkmode=prog ;; # Anything else should be a program.
+ esac
+
+ case $host in
+ *cygwin* | *mingw* | *pw32*)
+ # don't eliminate duplications in $postdeps and $predeps
+ duplicate_compiler_generated_deps=yes
+ ;;
+ *)
+ duplicate_compiler_generated_deps=$duplicate_deps
+ ;;
+ esac
+ specialdeplibs=
+
+ libs=
+ # Find all interdependent deplibs by searching for libraries
+ # that are linked more than once (e.g. -la -lb -la)
+ for deplib in $deplibs; do
+ if test "X$duplicate_deps" = "Xyes" ; then
+ case "$libs " in
+ *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
+ esac
+ fi
+ libs="$libs $deplib"
+ done
+
+ if test "$linkmode" = lib; then
+ libs="$predeps $libs $compiler_lib_search_path $postdeps"
+
+ # Compute libraries that are listed more than once in $predeps
+ # $postdeps and mark them as special (i.e., whose duplicates are
+ # not to be eliminated).
+ pre_post_deps=
+ if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then
+ for pre_post_dep in $predeps $postdeps; do
+ case "$pre_post_deps " in
+ *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
+ esac
+ pre_post_deps="$pre_post_deps $pre_post_dep"
+ done
+ fi
+ pre_post_deps=
+ fi
+
+ deplibs=
+ newdependency_libs=
+ newlib_search_path=
+ need_relink=no # whether we're linking any uninstalled libtool libraries
+ notinst_deplibs= # not-installed libtool libraries
+ case $linkmode in
+ lib)
+ passes="conv link"
+ for file in $dlfiles $dlprefiles; do
+ case $file in
+ *.la) ;;
+ *)
+ $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2
+ exit $EXIT_FAILURE
+ ;;
+ esac
+ done
+ ;;
+ prog)
+ compile_deplibs=
+ finalize_deplibs=
+ alldeplibs=no
+ newdlfiles=
+ newdlprefiles=
+ passes="conv scan dlopen dlpreopen link"
+ ;;
+ *) passes="conv"
+ ;;
+ esac
+ for pass in $passes; do
+ if test "$linkmode,$pass" = "lib,link" ||
+ test "$linkmode,$pass" = "prog,scan"; then
+ libs="$deplibs"
+ deplibs=
+ fi
+ if test "$linkmode" = prog; then
+ case $pass in
+ dlopen) libs="$dlfiles" ;;
+ dlpreopen) libs="$dlprefiles" ;;
+ link) libs="$deplibs %DEPLIBS% $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
+ compiler_flags="$compiler_flags $deplib"
+ fi
+ continue
+ ;;
+ -l*)
+ if test "$linkmode" != lib && test "$linkmode" != prog; then
+ $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2
+ continue
+ fi
+ name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
+ 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' or unhandled argument \`$deplib'" 1>&2
+ exit $EXIT_FAILURE
+ fi
+
+ # Check to see that this really is a libtool archive.
+ if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
+ else
+ $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
+ exit $EXIT_FAILURE
+ fi
+
+ ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
+ test "X$ladir" = "X$lib" && ladir="."
+
+ dlname=
+ dlopen=
+ dlpreopen=
+ libdir=
+ library_names=
+ old_library=
+ # If the library was installed with an old release of libtool,
+ # it will not redefine variables installed, or shouldnotlink
+ installed=yes
+ shouldnotlink=no
+ avoidtemprpath=
+
+
+ # Read the .la file
+ case $lib in
+ */* | *\\*) . $lib ;;
+ *) . ./$lib ;;
+ esac
+
+ if test "$linkmode,$pass" = "lib,link" ||
+ test "$linkmode,$pass" = "prog,scan" ||
+ { test "$linkmode" != prog && test "$linkmode" != lib; }; then
+ test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
+ test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
+ fi
+
+ if test "$pass" = conv; then
+ # Only check for convenience libraries
+ deplibs="$lib $deplibs"
+ if test -z "$libdir"; then
+ if test -z "$old_library"; then
+ $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
+ exit $EXIT_FAILURE
+ fi
+ # It is a libtool convenience library, so add in its objects.
+ convenience="$convenience $ladir/$objdir/$old_library"
+ old_convenience="$old_convenience $ladir/$objdir/$old_library"
+ tmp_libs=
+ for deplib in $dependency_libs; do
+ deplibs="$deplib $deplibs"
+ if test "X$duplicate_deps" = "Xyes" ; then
+ case "$tmp_libs " in
+ *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
+ esac
+ fi
+ tmp_libs="$tmp_libs $deplib"
+ done
+ elif test "$linkmode" != prog && test "$linkmode" != lib; then
+ $echo "$modename: \`$lib' is not a convenience library" 1>&2
+ exit $EXIT_FAILURE
+ fi
+ continue
+ fi # $pass = conv
+
+
+ # Get the name of the library we link against.
+ linklib=
+ for l in $old_library $library_names; do
+ linklib="$l"
+ done
+ if test -z "$linklib"; then
+ $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
+ exit $EXIT_FAILURE
+ fi
+
+ # This library was specified with -dlopen.
+ if test "$pass" = dlopen; then
+ if test -z "$libdir"; then
+ $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
+ exit $EXIT_FAILURE
+ fi
+ if test -z "$dlname" ||
+ test "$dlopen_support" != yes ||
+ test "$build_libtool_libs" = no; then
+ # If there is no dlname, no dlopen support or we're linking
+ # statically, we need to preload. We also need to preload any
+ # dependent libraries so libltdl's deplib preloader doesn't
+ # bomb out in the load deplibs phase.
+ dlprefiles="$dlprefiles $lib $dependency_libs"
+ else
+ newdlfiles="$newdlfiles $lib"
+ fi
+ continue
+ fi # $pass = dlopen
+
+ # We need an absolute path.
+ case $ladir in
+ [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
+ *)
+ abs_ladir=`cd "$ladir" && pwd`
+ if test -z "$abs_ladir"; then
+ $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2
+ $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
+ abs_ladir="$ladir"
+ fi
+ ;;
+ esac
+ laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
+
+ # Find the relevant object directory and library name.
+ if test "X$installed" = Xyes; then
+ if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
+ $echo "$modename: warning: library \`$lib' was moved." 1>&2
+ dir="$ladir"
+ absdir="$abs_ladir"
+ libdir="$abs_ladir"
+ else
+ dir="$libdir"
+ absdir="$libdir"
+ fi
+ test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
+ else
+ if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
+ dir="$ladir"
+ absdir="$abs_ladir"
+ # Remove this search path later
+ notinst_path="$notinst_path $abs_ladir"
+ else
+ dir="$ladir/$objdir"
+ absdir="$abs_ladir/$objdir"
+ # Remove this search path later
+ notinst_path="$notinst_path $abs_ladir"
+ fi
+ fi # $installed = yes
+ name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
+
+ # This library was specified with -dlpreopen.
+ if test "$pass" = dlpreopen; then
+ if test -z "$libdir"; then
+ $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
+ exit $EXIT_FAILURE
+ fi
+ # Prefer using a static library (so that no silly _DYNAMIC symbols
+ # are required to link).
+ if test -n "$old_library"; then
+ newdlprefiles="$newdlprefiles $dir/$old_library"
+ # Otherwise, use the dlname, so that lt_dlopen finds it.
+ elif test -n "$dlname"; then
+ newdlprefiles="$newdlprefiles $dir/$dlname"
+ else
+ newdlprefiles="$newdlprefiles $dir/$linklib"
+ fi
+ fi # $pass = dlpreopen
+
+ if test -z "$libdir"; then
+ # Link the convenience library
+ if test "$linkmode" = lib; then
+ deplibs="$dir/$old_library $deplibs"
+ elif test "$linkmode,$pass" = "prog,link"; then
+ compile_deplibs="$dir/$old_library $compile_deplibs"
+ finalize_deplibs="$dir/$old_library $finalize_deplibs"
+ else
+ deplibs="$lib $deplibs" # used for prog,scan pass
+ fi
+ continue
+ fi
+
+
+ if test "$linkmode" = prog && test "$pass" != link; then
+ newlib_search_path="$newlib_search_path $ladir"
+ deplibs="$lib $deplibs"
+
+ linkalldeplibs=no
+ if test "$link_all_deplibs" != no || test -z "$library_names" ||
+ test "$build_libtool_libs" = no; then
+ linkalldeplibs=yes
+ fi
+
+ tmp_libs=
+ for deplib in $dependency_libs; do
+ case $deplib in
+ -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
+ esac
+ # Need to link against all dependency_libs?
+ if test "$linkalldeplibs" = yes; then
+ deplibs="$deplib $deplibs"
+ else
+ # Need to hardcode shared library paths
+ # or/and link against static libraries
+ newdependency_libs="$deplib $newdependency_libs"
+ fi
+ if test "X$duplicate_deps" = "Xyes" ; then
+ case "$tmp_libs " in
+ *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
+ esac
+ fi
+ tmp_libs="$tmp_libs $deplib"
+ done # for deplib
+ continue
+ fi # $linkmode = prog...
+
+ if test "$linkmode,$pass" = "prog,link"; then
+ if test -n "$library_names" &&
+ { { test "$prefer_static_libs" = no ||
+ test "$prefer_static_libs,$installed" = "built,yes"; } ||
+ test -z "$old_library"; }; then
+ # We need to hardcode the library path
+ if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
+ # Make sure the rpath contains only unique directories.
+ case "$temp_rpath " in
+ *" $dir "*) ;;
+ *" $absdir "*) ;;
+ *) temp_rpath="$temp_rpath $absdir" ;;
+ esac
+ fi
+
+ # Hardcode the library path.
+ # Skip directories that are in the system default run-time
+ # search path.
+ case " $sys_lib_dlsearch_path " in
+ *" $absdir "*) ;;
+ *)
+ case "$compile_rpath " in
+ *" $absdir "*) ;;
+ *) compile_rpath="$compile_rpath $absdir"
+ esac
+ ;;
+ esac
+ case " $sys_lib_dlsearch_path " in
+ *" $libdir "*) ;;
+ *)
+ case "$finalize_rpath " in
+ *" $libdir "*) ;;
+ *) finalize_rpath="$finalize_rpath $libdir"
+ esac
+ ;;
+ esac
+ fi # $linkmode,$pass = prog,link...
+
+ if test "$alldeplibs" = yes &&
+ { test "$deplibs_check_method" = pass_all ||
+ { test "$build_libtool_libs" = yes &&
+ test -n "$library_names"; }; }; then
+ # We only need to search for static libraries
+ continue
+ fi
+ fi
+
+ link_static=no # Whether the deplib will be linked statically
+ use_static_libs=$prefer_static_libs
+ if test "$use_static_libs" = built && test "$installed" = yes ; then
+ use_static_libs=no
+ fi
+ if test -n "$library_names" &&
+ { test "$use_static_libs" = no || test -z "$old_library"; }; then
+ if test "$installed" = no; then
+ notinst_deplibs="$notinst_deplibs $lib"
+ need_relink=yes
+ fi
+ # This is a shared library
+
+ # Warn about portability, can't link against -module's on
+ # some systems (darwin)
+ if test "$shouldnotlink" = yes && test "$pass" = link ; then
+ $echo
+ if test "$linkmode" = prog; then
+ $echo "*** Warning: Linking the executable $output against the loadable module"
+ else
+ $echo "*** Warning: Linking the shared library $output against the loadable module"
+ fi
+ $echo "*** $linklib is not portable!"
+ fi
+ if test "$linkmode" = lib &&
+ test "$hardcode_into_libs" = yes; then
+ # Hardcode the library path.
+ # Skip directories that are in the system default run-time
+ # search path.
+ case " $sys_lib_dlsearch_path " in
+ *" $absdir "*) ;;
+ *)
+ case "$compile_rpath " in
+ *" $absdir "*) ;;
+ *) compile_rpath="$compile_rpath $absdir"
+ esac
+ ;;
+ esac
+ case " $sys_lib_dlsearch_path " in
+ *" $libdir "*) ;;
+ *)
+ case "$finalize_rpath " in
+ *" $libdir "*) ;;
+ *) finalize_rpath="$finalize_rpath $libdir"
+ esac
+ ;;
+ esac
+ fi
+
+ if test -n "$old_archive_from_expsyms_cmds"; then
+ # figure out the soname
+ set dummy $library_names
+ realname="$2"
+ shift; shift
+ libname=`eval \\$echo \"$libname_spec\"`
+ # use dlname if we got it. it's perfectly good, no?
+ if test -n "$dlname"; then
+ soname="$dlname"
+ elif test -n "$soname_spec"; then
+ # bleh windows
+ case $host in
+ *cygwin* | mingw*)
+ major=`expr $current - $age`
+ versuffix="-$major"
+ ;;
+ esac
+ eval soname=\"$soname_spec\"
+ else
+ soname="$realname"
+ fi
+
+ # Make a new name for the extract_expsyms_cmds to use
+ soroot="$soname"
+ soname=`$echo $soroot | ${SED} -e 's/^.*\///'`
+ newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a"
+
+ # If the library has no export list, then create one now
+ if test -f "$output_objdir/$soname-def"; then :
+ else
+ $show "extracting exported symbol list from \`$soname'"
+ save_ifs="$IFS"; IFS='~'
+ cmds=$extract_expsyms_cmds
+ for cmd in $cmds; do
+ IFS="$save_ifs"
+ eval cmd=\"$cmd\"
+ $show "$cmd"
+ $run eval "$cmd" || exit $?
+ done
+ IFS="$save_ifs"
+ fi
+
+ # Create $newlib
+ if test -f "$output_objdir/$newlib"; then :; else
+ $show "generating import library for \`$soname'"
+ save_ifs="$IFS"; IFS='~'
+ cmds=$old_archive_from_expsyms_cmds
+ for cmd in $cmds; do
+ IFS="$save_ifs"
+ eval cmd=\"$cmd\"
+ $show "$cmd"
+ $run eval "$cmd" || exit $?
+ done
+ IFS="$save_ifs"
+ fi
+ # make sure the library variables are pointing to the new library
+ dir=$output_objdir
+ linklib=$newlib
+ fi # test -n "$old_archive_from_expsyms_cmds"
+
+ if test "$linkmode" = prog || test "$mode" != relink; then
+ add_shlibpath=
+ add_dir=
+ add=
+ lib_linked=yes
+ case $hardcode_action in
+ immediate | unsupported)
+ if test "$hardcode_direct" = no; then
+ add="$dir/$linklib"
+ case $host in
+ *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;;
+ *-*-sysv4*uw2*) add_dir="-L$dir" ;;
+ *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
+ *-*-unixware7*) add_dir="-L$dir" ;;
+ *-*-darwin* )
+ # if the lib is a module then we can not link against
+ # it, someone is ignoring the new warnings I added
+ if /usr/bin/file -L $add 2> /dev/null |
+ $EGREP ": [^:]* bundle" >/dev/null ; then
+ $echo "** Warning, lib $linklib is a module, not a shared library"
+ if test -z "$old_library" ; then
+ $echo
+ $echo "** And there doesn't seem to be a static archive available"
+ $echo "** The link will probably fail, sorry"
+ else
+ add="$dir/$old_library"
+ fi
+ fi
+ esac
+ elif test "$hardcode_minus_L" = no; then
+ case $host in
+ *-*-sunos*) add_shlibpath="$dir" ;;
+ esac
+ add_dir="-L$dir"
+ add="-l$name"
+ elif test "$hardcode_shlibpath_var" = no; then
+ add_shlibpath="$dir"
+ add="-l$name"
+ else
+ lib_linked=no
+ fi
+ ;;
+ relink)
+ if test "$hardcode_direct" = yes; then
+ add="$dir/$linklib"
+ elif test "$hardcode_minus_L" = yes; then
+ add_dir="-L$dir"
+ # Try looking first in the location we're being installed to.
+ if test -n "$inst_prefix_dir"; then
+ case $libdir in
+ [\\/]*)
+ add_dir="$add_dir -L$inst_prefix_dir$libdir"
+ ;;
+ esac
+ fi
+ add="-l$name"
+ elif test "$hardcode_shlibpath_var" = yes; then
+ add_shlibpath="$dir"
+ add="-l$name"
+ else
+ lib_linked=no
+ fi
+ ;;
+ *) lib_linked=no ;;
+ esac
+
+ if test "$lib_linked" != yes; then
+ $echo "$modename: configuration error: unsupported hardcode properties"
+ exit $EXIT_FAILURE
+ fi
+
+ if test -n "$add_shlibpath"; then
+ case :$compile_shlibpath: in
+ *":$add_shlibpath:"*) ;;
+ *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
+ esac
+ fi
+ if test "$linkmode" = prog; then
+ test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
+ test -n "$add" && compile_deplibs="$add $compile_deplibs"
+ else
+ test -n "$add_dir" && deplibs="$add_dir $deplibs"
+ test -n "$add" && deplibs="$add $deplibs"
+ if test "$hardcode_direct" != yes && \
+ test "$hardcode_minus_L" != yes && \
+ test "$hardcode_shlibpath_var" = yes; then
+ case :$finalize_shlibpath: in
+ *":$libdir:"*) ;;
+ *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
+ esac
+ fi
+ fi
+ fi
+
+ if test "$linkmode" = prog || test "$mode" = relink; then
+ add_shlibpath=
+ add_dir=
+ add=
+ # Finalize command for both is simple: just hardcode it.
+ if test "$hardcode_direct" = yes; then
+ add="$libdir/$linklib"
+ elif test "$hardcode_minus_L" = yes; then
+ add_dir="-L$libdir"
+ add="-l$name"
+ elif test "$hardcode_shlibpath_var" = yes; then
+ case :$finalize_shlibpath: in
+ *":$libdir:"*) ;;
+ *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
+ esac
+ add="-l$name"
+ elif test "$hardcode_automatic" = yes; then
+ if test -n "$inst_prefix_dir" &&
+ test -f "$inst_prefix_dir$libdir/$linklib" ; then
+ add="$inst_prefix_dir$libdir/$linklib"
+ else
+ add="$libdir/$linklib"
+ fi
+ else
+ # We cannot seem to hardcode it, guess we'll fake it.
+ add_dir="-L$libdir"
+ # Try looking first in the location we're being installed to.
+ if test -n "$inst_prefix_dir"; then
+ case $libdir in
+ [\\/]*)
+ add_dir="$add_dir -L$inst_prefix_dir$libdir"
+ ;;
+ esac
+ fi
+ add="-l$name"
+ fi
+
+ if test "$linkmode" = prog; then
+ test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
+ test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
+ else
+ test -n "$add_dir" && deplibs="$add_dir $deplibs"
+ test -n "$add" && deplibs="$add $deplibs"
+ fi
+ fi
+ elif test "$linkmode" = prog; then
+ # Here we assume that one of hardcode_direct or hardcode_minus_L
+ # is not unsupported. This is valid on all known static and
+ # shared platforms.
+ if test "$hardcode_direct" != unsupported; then
+ test -n "$old_library" && linklib="$old_library"
+ compile_deplibs="$dir/$linklib $compile_deplibs"
+ finalize_deplibs="$dir/$linklib $finalize_deplibs"
+ else
+ compile_deplibs="-l$name -L$dir $compile_deplibs"
+ finalize_deplibs="-l$name -L$dir $finalize_deplibs"
+ fi
+ elif test "$build_libtool_libs" = yes; then
+ # Not a shared library
+ if test "$deplibs_check_method" != pass_all; then
+ # We're trying link a shared library against a static one
+ # but the system doesn't support it.
+
+ # Just print a warning and add the library to dependency_libs so
+ # that the program can be linked against the static library.
+ $echo
+ $echo "*** Warning: This system can not link to static lib archive $lib."
+ $echo "*** I have the capability to make that library automatically link in when"
+ $echo "*** you link to this library. But I can only do this if you have a"
+ $echo "*** shared version of the library, which you do not appear to have."
+ if test "$module" = yes; then
+ $echo "*** But as you try to build a module library, libtool will still create "
+ $echo "*** a static module, that should work as long as the dlopening application"
+ $echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
+ if test -z "$global_symbol_pipe"; then
+ $echo
+ $echo "*** However, this would only work if libtool was able to extract symbol"
+ $echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
+ $echo "*** not find such a program. So, this module is probably useless."
+ $echo "*** \`nm' from GNU binutils and a full rebuild may help."
+ fi
+ if test "$build_old_libs" = no; then
+ build_libtool_libs=module
+ build_old_libs=yes
+ else
+ build_libtool_libs=no
+ fi
+ fi
+ else
+ deplibs="$dir/$old_library $deplibs"
+ link_static=yes
+ fi
+ fi # link shared/static library?
+
+ if test "$linkmode" = lib; then
+ if test -n "$dependency_libs" &&
+ { test "$hardcode_into_libs" != yes ||
+ test "$build_old_libs" = yes ||
+ test "$link_static" = yes; }; then
+ # Extract -R from dependency_libs
+ temp_deplibs=
+ for libdir in $dependency_libs; do
+ case $libdir in
+ -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'`
+ case " $xrpath " in
+ *" $temp_xrpath "*) ;;
+ *) xrpath="$xrpath $temp_xrpath";;
+ esac;;
+ *) temp_deplibs="$temp_deplibs $libdir";;
+ esac
+ done
+ dependency_libs="$temp_deplibs"
+ fi
+
+ newlib_search_path="$newlib_search_path $absdir"
+ # Link against this library
+ test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
+ # ... and its dependency_libs
+ tmp_libs=
+ for deplib in $dependency_libs; do
+ newdependency_libs="$deplib $newdependency_libs"
+ if test "X$duplicate_deps" = "Xyes" ; then
+ case "$tmp_libs " in
+ *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
+ esac
+ fi
+ tmp_libs="$tmp_libs $deplib"
+ done
+
+ if test "$link_all_deplibs" != no; then
+ # Add the search paths of all dependency libraries
+ for deplib in $dependency_libs; do
+ case $deplib in
+ -L*) path="$deplib" ;;
+ *.la)
+ dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'`
+ test "X$dir" = "X$deplib" && dir="."
+ # We need an absolute path.
+ case $dir in
+ [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
+ *)
+ absdir=`cd "$dir" && pwd`
+ if test -z "$absdir"; then
+ $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
+ absdir="$dir"
+ fi
+ ;;
+ esac
+ if grep "^installed=no" $deplib > /dev/null; then
+ path="$absdir/$objdir"
+ else
+ eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
+ if test -z "$libdir"; then
+ $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
+ exit $EXIT_FAILURE
+ fi
+ if test "$absdir" != "$libdir"; then
+ $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2
+ fi
+ path="$absdir"
+ fi
+ depdepl=
+ case $host in
+ *-*-darwin*)
+ # we do not want to link against static libs,
+ # but need to link against shared
+ eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
+ 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
+ *" $path "*) ;;
+ *) deplibs="$path $deplibs" ;;
+ esac
+ case " $deplibs " in
+ *" $depdepl "*) ;;
+ *) deplibs="$depdepl $deplibs" ;;
+ esac
+ done
+ fi # link_all_deplibs != no
+ fi # linkmode = lib
+ done # for deplib in $libs
+ dependency_libs="$newdependency_libs"
+ if test "$pass" = dlpreopen; then
+ # Link the dlpreopened libraries before other libraries
+ for deplib in $save_deplibs; do
+ deplibs="$deplib $deplibs"
+ done
+ fi
+ if test "$pass" != dlopen; then
+ if test "$pass" != conv; then
+ # Make sure lib_search_path contains only unique directories.
+ lib_search_path=
+ for dir in $newlib_search_path; do
+ case "$lib_search_path " in
+ *" $dir "*) ;;
+ *) lib_search_path="$lib_search_path $dir" ;;
+ esac
+ done
+ newlib_search_path=
+ fi
+
+ if test "$linkmode,$pass" != "prog,link"; then
+ vars="deplibs"
+ else
+ vars="compile_deplibs finalize_deplibs"
+ fi
+ for var in $vars dependency_libs; do
+ # Add libraries to $var in reverse order
+ eval tmp_libs=\"\$$var\"
+ new_libs=
+ for deplib in $tmp_libs; do
+ # FIXME: Pedantically, this is the right thing to do, so
+ # that some nasty dependency loop isn't accidentally
+ # broken:
+ #new_libs="$deplib $new_libs"
+ # Pragmatically, this seems to cause very few problems in
+ # practice:
+ case $deplib in
+ -L*) new_libs="$deplib $new_libs" ;;
+ -R*) ;;
+ *)
+ # And here is the reason: when a library appears more
+ # than once as an explicit dependence of a library, or
+ # is implicitly linked in more than once by the
+ # compiler, it is considered special, and multiple
+ # occurrences thereof are not removed. Compare this
+ # with having the same library being listed as a
+ # dependency of multiple other libraries: in this case,
+ # we know (pedantically, we assume) the library does not
+ # need to be listed more than once, so we keep only the
+ # last copy. This is not always right, but it is rare
+ # enough that we require users that really mean to play
+ # such unportable linking tricks to link the library
+ # using -Wl,-lname, so that libtool does not consider it
+ # for duplicate removal.
+ case " $specialdeplibs " in
+ *" $deplib "*) new_libs="$deplib $new_libs" ;;
+ *)
+ case " $new_libs " in
+ *" $deplib "*) ;;
+ *) new_libs="$deplib $new_libs" ;;
+ esac
+ ;;
+ esac
+ ;;
+ esac
+ done
+ tmp_libs=
+ for deplib in $new_libs; do
+ case $deplib in
+ -L*)
+ case " $tmp_libs " in
+ *" $deplib "*) ;;
+ *) tmp_libs="$tmp_libs $deplib" ;;
+ esac
+ ;;
+ *) tmp_libs="$tmp_libs $deplib" ;;
+ esac
+ done
+ eval $var=\"$tmp_libs\"
+ done # for var
+ fi
+ # Last step: remove runtime libs from dependency_libs
+ # (they stay in deplibs)
+ tmp_libs=
+ for i in $dependency_libs ; do
+ case " $predeps $postdeps $compiler_lib_search_path " in
+ *" $i "*)
+ i=""
+ ;;
+ esac
+ if test -n "$i" ; then
+ tmp_libs="$tmp_libs $i"
+ fi
+ done
+ dependency_libs=$tmp_libs
+ done # for pass
+ if test "$linkmode" = prog; then
+ dlfiles="$newdlfiles"
+ dlprefiles="$newdlprefiles"
+ fi
+
+ case $linkmode in
+ oldlib)
+ 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|none)
+ current=`expr $number_major + $number_minor`
+ age="$number_minor"
+ revision="$number_revision"
+ ;;
+ freebsd-aout|freebsd-elf|sunos)
+ current="$number_major"
+ revision="$number_minor"
+ age="0"
+ ;;
+ irix|nonstopux)
+ current=`expr $number_major + $number_minor - 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]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
+ *)
+ $echo "$modename: CURRENT \`$current' must be a nonnegative integer" 1>&2
+ $echo "$modename: \`$vinfo' is not valid version information" 1>&2
+ exit $EXIT_FAILURE
+ ;;
+ esac
+
+ case $revision in
+ 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
+ *)
+ $echo "$modename: REVISION \`$revision' must be a nonnegative integer" 1>&2
+ $echo "$modename: \`$vinfo' is not valid version information" 1>&2
+ exit $EXIT_FAILURE
+ ;;
+ esac
+
+ case $age in
+ 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
+ *)
+ $echo "$modename: AGE \`$age' must be a nonnegative integer" 1>&2
+ $echo "$modename: \`$vinfo' is not valid version information" 1>&2
+ exit $EXIT_FAILURE
+ ;;
+ esac
+
+ if test "$age" -gt "$current"; then
+ $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
+ $echo "$modename: \`$vinfo' is not valid version information" 1>&2
+ exit $EXIT_FAILURE
+ fi
+
+ # Calculate the version variables.
+ major=
+ versuffix=
+ verstring=
+ case $version_type in
+ none) ;;
+
+ darwin)
+ # Like Linux, but with the current version available in
+ # verstring for coding it into the library header
+ major=.`expr $current - $age`
+ versuffix="$major.$age.$revision"
+ # Darwin ld doesn't like 0 for these options...
+ minor_current=`expr $current + 1`
+ 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* | *-*-dragonfly*)
+ # Do not include libc due to us having libc/libc_r.
+ ;;
+ *-*-sco3.2v5* | *-*-sco5v6*)
+ # Causes problems with __ctype
+ ;;
+ *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
+ # Compiler inserts libc in the correct place for threads to work
+ ;;
+ *)
+ # Add libc to deplibs on all other systems if necessary.
+ if test "$build_libtool_need_lc" = "yes"; then
+ deplibs="$deplibs -lc"
+ fi
+ ;;
+ esac
+ fi
+
+ # Transform deplibs into only deplibs that can be linked in shared.
+ name_save=$name
+ libname_save=$libname
+ release_save=$release
+ versuffix_save=$versuffix
+ major_save=$major
+ # I'm not sure if I'm treating the release correctly. I think
+ # release should show up in the -l (ie -lgmp5) so we don't want to
+ # add it in twice. Is that correct?
+ release=""
+ versuffix=""
+ major=""
+ newdeplibs=
+ droppeddeps=no
+ case $deplibs_check_method in
+ pass_all)
+ # Don't check for shared/static. Everything works.
+ # This might be a little naive. We might want to check
+ # whether the library exists or not. But this is on
+ # osf3 & osf4 and I'm not really sure... Just
+ # implementing what was already the behavior.
+ newdeplibs=$deplibs
+ ;;
+ test_compile)
+ # This code stresses the "libraries are programs" paradigm to its
+ # limits. Maybe even breaks it. We compile a program, linking it
+ # against the deplibs as a proxy for the library. Then we can check
+ # whether they linked in statically or dynamically with ldd.
+ $rm conftest.c
+ cat > conftest.c <<EOF
+ int main() { return 0; }
+EOF
+ $rm conftest
+ if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then
+ ldd_output=`ldd conftest`
+ for i in $deplibs; do
+ name=`expr $i : '-l\(.*\)'`
+ # If $name is empty we are operating on a -L argument.
+ if test "$name" != "" && test "$name" != "0"; then
+ if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
+ case " $predeps $postdeps " in
+ *" $i "*)
+ newdeplibs="$newdeplibs $i"
+ i=""
+ ;;
+ esac
+ fi
+ if test -n "$i" ; then
+ libname=`eval \\$echo \"$libname_spec\"`
+ deplib_matches=`eval \\$echo \"$library_names_spec\"`
+ set dummy $deplib_matches
+ deplib_match=$2
+ if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
+ newdeplibs="$newdeplibs $i"
+ else
+ droppeddeps=yes
+ $echo
+ $echo "*** Warning: dynamic linker does not accept needed library $i."
+ $echo "*** I have the capability to make that library automatically link in when"
+ $echo "*** you link to this library. But I can only do this if you have a"
+ $echo "*** shared version of the library, which I believe you do not have"
+ $echo "*** because a test_compile did reveal that the linker did not use it for"
+ $echo "*** its dynamic dependency list that programs get resolved with at runtime."
+ fi
+ fi
+ else
+ newdeplibs="$newdeplibs $i"
+ fi
+ done
+ else
+ # Error occurred in the first compile. Let's try to salvage
+ # the situation: Compile a separate program for each library.
+ for i in $deplibs; do
+ name=`expr $i : '-l\(.*\)'`
+ # If $name is empty we are operating on a -L argument.
+ if test "$name" != "" && test "$name" != "0"; then
+ $rm conftest
+ if $LTCC $LTCFLAGS -o conftest conftest.c $i; then
+ ldd_output=`ldd conftest`
+ if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
+ case " $predeps $postdeps " in
+ *" $i "*)
+ newdeplibs="$newdeplibs $i"
+ i=""
+ ;;
+ esac
+ fi
+ if test -n "$i" ; then
+ libname=`eval \\$echo \"$libname_spec\"`
+ deplib_matches=`eval \\$echo \"$library_names_spec\"`
+ set dummy $deplib_matches
+ deplib_match=$2
+ if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
+ newdeplibs="$newdeplibs $i"
+ else
+ droppeddeps=yes
+ $echo
+ $echo "*** Warning: dynamic linker does not accept needed library $i."
+ $echo "*** I have the capability to make that library automatically link in when"
+ $echo "*** you link to this library. But I can only do this if you have a"
+ $echo "*** shared version of the library, which you do not appear to have"
+ $echo "*** because a test_compile did reveal that the linker did not use this one"
+ $echo "*** as a dynamic dependency that programs can get resolved with at runtime."
+ fi
+ fi
+ else
+ droppeddeps=yes
+ $echo
+ $echo "*** Warning! Library $i is needed by this library but I was not able to"
+ $echo "*** make it link in! You will probably need to install it or some"
+ $echo "*** library that it depends on before this library will be fully"
+ $echo "*** functional. Installing it before continuing would be even better."
+ fi
+ else
+ newdeplibs="$newdeplibs $i"
+ fi
+ done
+ fi
+ ;;
+ file_magic*)
+ set dummy $deplibs_check_method
+ file_magic_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 "$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
+ # Follow soft links.
+ if ls -lLd "$potent_lib" 2>/dev/null \
+ | grep " -> " >/dev/null; then
+ continue
+ fi
+ # The statement above tries to avoid entering an
+ # endless loop below, in case of cyclic links.
+ # We might still enter an endless loop, since a link
+ # loop can be closed while we follow links,
+ # but so what?
+ potlib="$potent_lib"
+ while test -h "$potlib" 2>/dev/null; do
+ potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
+ case $potliblink in
+ [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
+ *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
+ esac
+ done
+ if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
+ | ${SED} 10q \
+ | $EGREP "$file_magic_regex" > /dev/null; then
+ newdeplibs="$newdeplibs $a_deplib"
+ a_deplib=""
+ break 2
+ fi
+ done
+ done
+ fi
+ if test -n "$a_deplib" ; then
+ droppeddeps=yes
+ $echo
+ $echo "*** Warning: linker path does not have real file for library $a_deplib."
+ $echo "*** I have the capability to make that library automatically link in when"
+ $echo "*** you link to this library. But I can only do this if you have a"
+ $echo "*** shared version of the library, which you do not appear to have"
+ $echo "*** because I did check the linker path looking for a file starting"
+ if test -z "$potlib" ; then
+ $echo "*** with $libname but no candidates were found. (...for file magic test)"
+ else
+ $echo "*** with $libname and none of the candidates passed a file format test"
+ $echo "*** using a file magic. Last file checked: $potlib"
+ fi
+ fi
+ else
+ # Add a -L argument.
+ newdeplibs="$newdeplibs $a_deplib"
+ fi
+ done # Gone through all deplibs.
+ ;;
+ match_pattern*)
+ set dummy $deplibs_check_method
+ match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
+ for a_deplib in $deplibs; do
+ name=`expr $a_deplib : '-l\(.*\)'`
+ # If $name is empty we are operating on a -L argument.
+ if test -n "$name" && test "$name" != "0"; then
+ if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
+ case " $predeps $postdeps " in
+ *" $a_deplib "*)
+ newdeplibs="$newdeplibs $a_deplib"
+ a_deplib=""
+ ;;
+ esac
+ fi
+ if test -n "$a_deplib" ; then
+ libname=`eval \\$echo \"$libname_spec\"`
+ for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
+ potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
+ for potent_lib in $potential_libs; do
+ potlib="$potent_lib" # see symlink-check above in file_magic test
+ if eval $echo \"$potent_lib\" 2>/dev/null \
+ | ${SED} 10q \
+ | $EGREP "$match_pattern_regex" > /dev/null; then
+ newdeplibs="$newdeplibs $a_deplib"
+ a_deplib=""
+ break 2
+ fi
+ done
+ done
+ fi
+ if test -n "$a_deplib" ; then
+ droppeddeps=yes
+ $echo
+ $echo "*** Warning: linker path does not have real file for library $a_deplib."
+ $echo "*** I have the capability to make that library automatically link in when"
+ $echo "*** you link to this library. But I can only do this if you have a"
+ $echo "*** shared version of the library, which you do not appear to have"
+ $echo "*** because I did check the linker path looking for a file starting"
+ if test -z "$potlib" ; then
+ $echo "*** with $libname but no candidates were found. (...for regex pattern test)"
+ else
+ $echo "*** with $libname and none of the candidates passed a file format test"
+ $echo "*** using a regex pattern. Last file checked: $potlib"
+ fi
+ fi
+ else
+ # Add a -L argument.
+ newdeplibs="$newdeplibs $a_deplib"
+ fi
+ done # Gone through all deplibs.
+ ;;
+ none | unknown | *)
+ newdeplibs=""
+ tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
+ -e 's/ -[LR][^ ]*//g'`
+ if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
+ for i in $predeps $postdeps ; do
+ # can't use Xsed below, because $i might contain '/'
+ tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"`
+ done
+ fi
+ if $echo "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' \
+ | grep . >/dev/null; then
+ $echo
+ if test "X$deplibs_check_method" = "Xnone"; then
+ $echo "*** Warning: inter-library dependencies are not supported in this platform."
+ else
+ $echo "*** Warning: inter-library dependencies are not known to be supported."
+ fi
+ $echo "*** All declared inter-library dependencies are being dropped."
+ droppeddeps=yes
+ fi
+ ;;
+ esac
+ versuffix=$versuffix_save
+ major=$major_save
+ release=$release_save
+ libname=$libname_save
+ name=$name_save
+
+ case $host in
+ *-*-rhapsody* | *-*-darwin1.[012])
+ # On Rhapsody replace the C library is the System framework
+ newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'`
+ ;;
+ esac
+
+ if test "$droppeddeps" = yes; then
+ if test "$module" = yes; then
+ $echo
+ $echo "*** Warning: libtool could not satisfy all declared inter-library"
+ $echo "*** dependencies of module $libname. Therefore, libtool will create"
+ $echo "*** a static module, that should work as long as the dlopening"
+ $echo "*** application is linked with the -dlopen flag."
+ if test -z "$global_symbol_pipe"; then
+ $echo
+ $echo "*** However, this would only work if libtool was able to extract symbol"
+ $echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
+ $echo "*** not find such a program. So, this module is probably useless."
+ $echo "*** \`nm' from GNU binutils and a full rebuild may help."
+ fi
+ if test "$build_old_libs" = no; then
+ oldlibs="$output_objdir/$libname.$libext"
+ build_libtool_libs=module
+ build_old_libs=yes
+ else
+ build_libtool_libs=no
+ fi
+ else
+ $echo "*** The inter-library dependencies that have been dropped here will be"
+ $echo "*** automatically added whenever a program is linked with this library"
+ $echo "*** or is declared to -dlopen it."
+
+ if test "$allow_undefined" = no; then
+ $echo
+ $echo "*** Since this library must not contain undefined symbols,"
+ $echo "*** because either the platform does not support them or"
+ $echo "*** it was explicitly requested with -no-undefined,"
+ $echo "*** libtool will only create a static version of it."
+ if test "$build_old_libs" = no; then
+ oldlibs="$output_objdir/$libname.$libext"
+ build_libtool_libs=module
+ build_old_libs=yes
+ else
+ build_libtool_libs=no
+ fi
+ fi
+ fi
+ fi
+ # Done checking deplibs!
+ deplibs=$newdeplibs
+ fi
+
+
+ # move library search paths that coincide with paths to not yet
+ # installed libraries to the beginning of the library search list
+ new_libs=
+ for path in $notinst_path; do
+ case " $new_libs " in
+ *" -L$path/$objdir "*) ;;
+ *)
+ case " $deplibs " in
+ *" -L$path/$objdir "*)
+ new_libs="$new_libs -L$path/$objdir" ;;
+ esac
+ ;;
+ esac
+ done
+ for deplib in $deplibs; do
+ case $deplib in
+ -L*)
+ case " $new_libs " in
+ *" $deplib "*) ;;
+ *) new_libs="$new_libs $deplib" ;;
+ esac
+ ;;
+ *) new_libs="$new_libs $deplib" ;;
+ esac
+ done
+ deplibs="$new_libs"
+
+
+ # All the library-specific variables (install_libdir is set above).
+ library_names=
+ old_library=
+ dlname=
+
+ # Test again, we may have decided not to build it any more
+ if test "$build_libtool_libs" = yes; then
+ if test "$hardcode_into_libs" = yes; then
+ # Hardcode the library paths
+ hardcode_libdirs=
+ dep_rpath=
+ rpath="$finalize_rpath"
+ test "$mode" != relink && rpath="$compile_rpath$rpath"
+ for libdir in $rpath; do
+ if test -n "$hardcode_libdir_flag_spec"; then
+ if test -n "$hardcode_libdir_separator"; then
+ if test -z "$hardcode_libdirs"; then
+ hardcode_libdirs="$libdir"
+ else
+ # Just accumulate the unique libdirs.
+ case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
+ *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
+ ;;
+ *)
+ hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
+ ;;
+ esac
+ fi
+ else
+ eval flag=\"$hardcode_libdir_flag_spec\"
+ dep_rpath="$dep_rpath $flag"
+ fi
+ elif test -n "$runpath_var"; then
+ case "$perm_rpath " in
+ *" $libdir "*) ;;
+ *) perm_rpath="$perm_rpath $libdir" ;;
+ esac
+ fi
+ done
+ # Substitute the hardcoded libdirs into the rpath.
+ if test -n "$hardcode_libdir_separator" &&
+ test -n "$hardcode_libdirs"; then
+ libdir="$hardcode_libdirs"
+ if test -n "$hardcode_libdir_flag_spec_ld"; then
+ 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"
+ linknames=
+ for link
+ do
+ linknames="$linknames $link"
+ done
+
+ # Use standard objects if they are pic
+ test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
+
+ # Prepare the list of exported symbols
+ if test -z "$export_symbols"; then
+ if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
+ $show "generating symbol list for \`$libname.la'"
+ export_symbols="$output_objdir/$libname.exp"
+ $run $rm $export_symbols
+ cmds=$export_symbols_cmds
+ save_ifs="$IFS"; IFS='~'
+ for cmd in $cmds; do
+ IFS="$save_ifs"
+ eval cmd=\"$cmd\"
+ if len=`expr "X$cmd" : ".*"` &&
+ test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
+ $show "$cmd"
+ $run eval "$cmd" || exit $?
+ skipped_export=false
+ else
+ # The command line is too long to execute in one step.
+ $show "using reloadable object file for export list..."
+ skipped_export=:
+ # Break out early, otherwise skipped_export may be
+ # set to false by a later but shorter cmd.
+ break
+ fi
+ done
+ IFS="$save_ifs"
+ if test -n "$export_symbols_regex"; then
+ $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
+ $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
+ $show "$mv \"${export_symbols}T\" \"$export_symbols\""
+ $run eval '$mv "${export_symbols}T" "$export_symbols"'
+ fi
+ fi
+ fi
+
+ if test -n "$export_symbols" && test -n "$include_expsyms"; then
+ $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
+ fi
+
+ tmp_deplibs=
+ for test_deplib in $deplibs; do
+ case " $convenience " in
+ *" $test_deplib "*) ;;
+ *)
+ tmp_deplibs="$tmp_deplibs $test_deplib"
+ ;;
+ esac
+ done
+ deplibs="$tmp_deplibs"
+
+ if test -n "$convenience"; then
+ if test -n "$whole_archive_flag_spec"; then
+ save_libobjs=$libobjs
+ eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
+ else
+ gentop="$output_objdir/${outputname}x"
+ generated="$generated $gentop"
+
+ func_extract_archives $gentop $convenience
+ libobjs="$libobjs $func_extract_archives_result"
+ fi
+ fi
+
+ if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
+ eval flag=\"$thread_safe_flag_spec\"
+ linker_flags="$linker_flags $flag"
+ fi
+
+ # Make a backup of the uninstalled library when relinking
+ if test "$mode" = relink; then
+ $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $?
+ fi
+
+ # Do each of the archive commands.
+ if test "$module" = yes && test -n "$module_cmds" ; then
+ if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
+ eval test_cmds=\"$module_expsym_cmds\"
+ cmds=$module_expsym_cmds
+ else
+ eval test_cmds=\"$module_cmds\"
+ cmds=$module_cmds
+ fi
+ else
+ if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
+ eval test_cmds=\"$archive_expsym_cmds\"
+ cmds=$archive_expsym_cmds
+ else
+ eval test_cmds=\"$archive_cmds\"
+ cmds=$archive_cmds
+ fi
+ fi
+
+ if test "X$skipped_export" != "X:" &&
+ len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
+ test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
+ :
+ else
+ # The command line is too long to link in one step, link piecewise.
+ $echo "creating reloadable object files..."
+
+ # Save the value of $output and $libobjs because we want to
+ # use them later. If we have whole_archive_flag_spec, we
+ # want to use save_libobjs as it was before
+ # whole_archive_flag_spec was expanded, because we can't
+ # assume the linker understands whole_archive_flag_spec.
+ # This may have to be revisited, in case too many
+ # convenience libraries get linked in and end up exceeding
+ # the spec.
+ if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
+ save_libobjs=$libobjs
+ fi
+ save_output=$output
+ output_la=`$echo "X$output" | $Xsed -e "$basename"`
+
+ # Clear the reloadable object creation command queue and
+ # initialize k to one.
+ test_cmds=
+ concat_cmds=
+ objlist=
+ delfiles=
+ last_robj=
+ k=1
+ output=$output_objdir/$output_la-${k}.$objext
+ # Loop over the list of objects to be linked.
+ for obj in $save_libobjs
+ do
+ eval test_cmds=\"$reload_cmds $objlist $last_robj\"
+ if test "X$objlist" = X ||
+ { len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
+ test "$len" -le "$max_cmd_len"; }; then
+ objlist="$objlist $obj"
+ else
+ # The command $test_cmds is almost too long, add a
+ # command to the queue.
+ if test "$k" -eq 1 ; then
+ # The first file doesn't have a previous command to add.
+ eval concat_cmds=\"$reload_cmds $objlist $last_robj\"
+ else
+ # All subsequent reloadable object files will link in
+ # the last one created.
+ eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\"
+ fi
+ last_robj=$output_objdir/$output_la-${k}.$objext
+ k=`expr $k + 1`
+ output=$output_objdir/$output_la-${k}.$objext
+ objlist=$obj
+ len=1
+ fi
+ done
+ # Handle the remaining objects by creating one last
+ # reloadable object file. All subsequent reloadable object
+ # files will link in the last one created.
+ test -z "$concat_cmds" || concat_cmds=$concat_cmds~
+ eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\"
+
+ if ${skipped_export-false}; then
+ $show "generating symbol list for \`$libname.la'"
+ export_symbols="$output_objdir/$libname.exp"
+ $run $rm $export_symbols
+ libobjs=$output
+ # Append the command to create the export file.
+ eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\"
+ fi
+
+ # Set up a command to remove the reloadable object files
+ # after they are used.
+ i=0
+ while test "$i" -lt "$k"
+ do
+ i=`expr $i + 1`
+ delfiles="$delfiles $output_objdir/$output_la-${i}.$objext"
+ done
+
+ $echo "creating a temporary reloadable object file: $output"
+
+ # Loop through the commands generated above and execute them.
+ save_ifs="$IFS"; IFS='~'
+ for cmd in $concat_cmds; do
+ IFS="$save_ifs"
+ $show "$cmd"
+ $run eval "$cmd" || exit $?
+ done
+ IFS="$save_ifs"
+
+ libobjs=$output
+ # Restore the value of output.
+ output=$save_output
+
+ if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
+ eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
+ fi
+ # Expand the library linking commands again to reset the
+ # value of $libobjs for piecewise linking.
+
+ # Do each of the archive commands.
+ if test "$module" = yes && test -n "$module_cmds" ; then
+ if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
+ cmds=$module_expsym_cmds
+ else
+ cmds=$module_cmds
+ fi
+ else
+ if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
+ cmds=$archive_expsym_cmds
+ else
+ cmds=$archive_cmds
+ fi
+ fi
+
+ # Append the command to remove the reloadable object files
+ # to the just-reset $cmds.
+ eval cmds=\"\$cmds~\$rm $delfiles\"
+ fi
+ save_ifs="$IFS"; IFS='~'
+ for cmd in $cmds; do
+ IFS="$save_ifs"
+ eval cmd=\"$cmd\"
+ $show "$cmd"
+ $run eval "$cmd" || {
+ lt_exit=$?
+
+ # Restore the uninstalled library and exit
+ if test "$mode" = relink; then
+ $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)'
+ fi
+
+ exit $lt_exit
+ }
+ done
+ IFS="$save_ifs"
+
+ # Restore the uninstalled library and exit
+ if test "$mode" = relink; then
+ $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $?
+
+ if test -n "$convenience"; then
+ if test -z "$whole_archive_flag_spec"; then
+ $show "${rm}r $gentop"
+ $run ${rm}r "$gentop"
+ fi
+ fi
+
+ exit $EXIT_SUCCESS
+ fi
+
+ # Create links to the real library.
+ for linkname in $linknames; do
+ if test "$realname" != "$linkname"; then
+ $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)"
+ $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $?
+ fi
+ done
+
+ # If -module or -export-dynamic was specified, set the dlname.
+ if test "$module" = yes || test "$export_dynamic" = yes; then
+ # On all known operating systems, these are identical.
+ dlname="$soname"
+ fi
+ fi
+ ;;
+
+ obj)
+ 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 and hope we can get by with
+ # turning comma into space..
+ wl=
+
+ if test -n "$convenience"; then
+ if test -n "$whole_archive_flag_spec"; then
+ eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
+ reload_conv_objs=$reload_objs\ `$echo "X$tmp_whole_archive_flags" | $Xsed -e 's|,| |g'`
+ else
+ gentop="$output_objdir/${obj}x"
+ generated="$generated $gentop"
+
+ func_extract_archives $gentop $convenience
+ reload_conv_objs="$reload_objs $func_extract_archives_result"
+ fi
+ fi
+
+ # Create the old-style object.
+ reload_objs="$objs$old_deplibs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test
+
+ output="$obj"
+ cmds=$reload_cmds
+ save_ifs="$IFS"; IFS='~'
+ for cmd in $cmds; do
+ IFS="$save_ifs"
+ eval cmd=\"$cmd\"
+ $show "$cmd"
+ $run eval "$cmd" || exit $?
+ done
+ IFS="$save_ifs"
+
+ # Exit if we aren't doing a library object file.
+ if test -z "$libobj"; then
+ if test -n "$gentop"; then
+ $show "${rm}r $gentop"
+ $run ${rm}r $gentop
+ fi
+
+ exit $EXIT_SUCCESS
+ fi
+
+ if test "$build_libtool_libs" != yes; then
+ if test -n "$gentop"; then
+ $show "${rm}r $gentop"
+ $run ${rm}r $gentop
+ fi
+
+ # Create an invalid libtool object if no PIC, so that we don't
+ # accidentally link it into a program.
+ # $show "echo timestamp > $libobj"
+ # $run eval "echo timestamp > $libobj" || exit $?
+ exit $EXIT_SUCCESS
+ fi
+
+ if test -n "$pic_flag" || test "$pic_mode" != default; then
+ # Only do commands if we really have different PIC objects.
+ reload_objs="$libobjs $reload_conv_objs"
+ output="$libobj"
+ cmds=$reload_cmds
+ save_ifs="$IFS"; IFS='~'
+ for cmd in $cmds; do
+ IFS="$save_ifs"
+ eval cmd=\"$cmd\"
+ $show "$cmd"
+ $run eval "$cmd" || exit $?
+ done
+ IFS="$save_ifs"
+ fi
+
+ if test -n "$gentop"; then
+ $show "${rm}r $gentop"
+ $run ${rm}r $gentop
+ fi
+
+ exit $EXIT_SUCCESS
+ ;;
+
+ prog)
+ case $host in
+ *cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;;
+ esac
+ if test -n "$vinfo"; then
+ $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
+ fi
+
+ if test -n "$release"; then
+ $echo "$modename: warning: \`-release' is ignored for programs" 1>&2
+ fi
+
+ if test "$preload" = yes; then
+ if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown &&
+ test "$dlopen_self_static" = unknown; then
+ $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support."
+ fi
+ fi
+
+ case $host in
+ *-*-rhapsody* | *-*-darwin1.[012])
+ # On Rhapsody replace the C library is the System framework
+ compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
+ finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
+ ;;
+ esac
+
+ case $host in
+ *darwin*)
+ # Don't allow lazy linking, it breaks C++ global constructors
+ if test "$tagname" = CXX ; then
+ compile_command="$compile_command ${wl}-bind_at_load"
+ finalize_command="$finalize_command ${wl}-bind_at_load"
+ fi
+ ;;
+ esac
+
+
+ # move library search paths that coincide with paths to not yet
+ # installed libraries to the beginning of the library search list
+ new_libs=
+ for path in $notinst_path; do
+ case " $new_libs " in
+ *" -L$path/$objdir "*) ;;
+ *)
+ case " $compile_deplibs " in
+ *" -L$path/$objdir "*)
+ new_libs="$new_libs -L$path/$objdir" ;;
+ esac
+ ;;
+ esac
+ done
+ for deplib in $compile_deplibs; do
+ case $deplib in
+ -L*)
+ case " $new_libs " in
+ *" $deplib "*) ;;
+ *) new_libs="$new_libs $deplib" ;;
+ esac
+ ;;
+ *) new_libs="$new_libs $deplib" ;;
+ esac
+ done
+ compile_deplibs="$new_libs"
+
+
+ compile_command="$compile_command $compile_deplibs"
+ finalize_command="$finalize_command $finalize_deplibs"
+
+ if test -n "$rpath$xrpath"; then
+ # If the user specified any rpath flags, then add them.
+ for libdir in $rpath $xrpath; do
+ # This is the magic to use -rpath.
+ case "$finalize_rpath " in
+ *" $libdir "*) ;;
+ *) finalize_rpath="$finalize_rpath $libdir" ;;
+ esac
+ done
+ fi
+
+ # Now hardcode the library paths
+ rpath=
+ hardcode_libdirs=
+ for libdir in $compile_rpath $finalize_rpath; do
+ if test -n "$hardcode_libdir_flag_spec"; then
+ if test -n "$hardcode_libdir_separator"; then
+ if test -z "$hardcode_libdirs"; then
+ hardcode_libdirs="$libdir"
+ else
+ # Just accumulate the unique libdirs.
+ case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
+ *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
+ ;;
+ *)
+ hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
+ ;;
+ esac
+ fi
+ else
+ eval flag=\"$hardcode_libdir_flag_spec\"
+ rpath="$rpath $flag"
+ fi
+ elif test -n "$runpath_var"; then
+ case "$perm_rpath " in
+ *" $libdir "*) ;;
+ *) perm_rpath="$perm_rpath $libdir" ;;
+ esac
+ fi
+ case $host in
+ *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
+ testbindir=`$echo "X$libdir" | $Xsed -e 's*/lib$*/bin*'`
+ case :$dllsearchpath: in
+ *":$libdir:"*) ;;
+ *) dllsearchpath="$dllsearchpath:$libdir";;
+ esac
+ case :$dllsearchpath: in
+ *":$testbindir:"*) ;;
+ *) dllsearchpath="$dllsearchpath:$testbindir";;
+ esac
+ ;;
+ esac
+ done
+ # Substitute the hardcoded libdirs into the rpath.
+ if test -n "$hardcode_libdir_separator" &&
+ test -n "$hardcode_libdirs"; then
+ libdir="$hardcode_libdirs"
+ eval rpath=\" $hardcode_libdir_flag_spec\"
+ fi
+ compile_rpath="$rpath"
+
+ rpath=
+ hardcode_libdirs=
+ for libdir in $finalize_rpath; do
+ if test -n "$hardcode_libdir_flag_spec"; then
+ if test -n "$hardcode_libdir_separator"; then
+ if test -z "$hardcode_libdirs"; then
+ hardcode_libdirs="$libdir"
+ else
+ # Just accumulate the unique libdirs.
+ case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
+ *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
+ ;;
+ *)
+ hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
+ ;;
+ esac
+ fi
+ else
+ eval flag=\"$hardcode_libdir_flag_spec\"
+ rpath="$rpath $flag"
+ fi
+ elif test -n "$runpath_var"; then
+ case "$finalize_perm_rpath " in
+ *" $libdir "*) ;;
+ *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
+ esac
+ fi
+ done
+ # Substitute the hardcoded libdirs into the rpath.
+ if test -n "$hardcode_libdir_separator" &&
+ test -n "$hardcode_libdirs"; then
+ libdir="$hardcode_libdirs"
+ eval rpath=\" $hardcode_libdir_flag_spec\"
+ fi
+ finalize_rpath="$rpath"
+
+ if test -n "$libobjs" && test "$build_old_libs" = yes; then
+ # Transform all the library objects into standard objects.
+ compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
+ finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
+ fi
+
+ dlsyms=
+ if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
+ if test -n "$NM" && test -n "$global_symbol_pipe"; then
+ dlsyms="${outputname}S.c"
+ else
+ $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2
+ fi
+ fi
+
+ if test -n "$dlsyms"; then
+ case $dlsyms in
+ "") ;;
+ *.c)
+ # Discover the nlist of each of the dlfiles.
+ nlist="$output_objdir/${outputname}.nm"
+
+ $show "$rm $nlist ${nlist}S ${nlist}T"
+ $run $rm "$nlist" "${nlist}S" "${nlist}T"
+
+ # Parse the name list into a source file.
+ $show "creating $output_objdir/$dlsyms"
+
+ test -z "$run" && $echo > "$output_objdir/$dlsyms" "\
+/* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */
+/* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */
+
+#ifdef __cplusplus
+extern \"C\" {
+#endif
+
+/* Prevent the only kind of declaration conflicts we can make. */
+#define lt_preloaded_symbols some_other_symbol
+
+/* External symbol declarations for the compiler. */\
+"
+
+ if test "$dlself" = yes; then
+ $show "generating symbol list for \`$output'"
+
+ test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist"
+
+ # Add our own program objects to the symbol list.
+ progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
+ for arg in $progfiles; do
+ $show "extracting global C symbols from \`$arg'"
+ $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
+ done
+
+ if test -n "$exclude_expsyms"; then
+ $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
+ $run eval '$mv "$nlist"T "$nlist"'
+ fi
+
+ if test -n "$export_symbols_regex"; then
+ $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
+ $run eval '$mv "$nlist"T "$nlist"'
+ fi
+
+ # Prepare the list of exported symbols
+ if test -z "$export_symbols"; then
+ export_symbols="$output_objdir/$outputname.exp"
+ $run $rm $export_symbols
+ $run eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
+ case $host in
+ *cygwin* | *mingw* )
+ $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
+ $run eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
+ ;;
+ esac
+ else
+ $run eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
+ $run eval 'grep -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
+ $run eval 'mv "$nlist"T "$nlist"'
+ case $host in
+ *cygwin* | *mingw* )
+ $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
+ $run eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
+ ;;
+ esac
+ fi
+ fi
+
+ for arg in $dlprefiles; do
+ $show "extracting global C symbols from \`$arg'"
+ name=`$echo "$arg" | ${SED} -e 's%^.*/%%'`
+ $run eval '$echo ": $name " >> "$nlist"'
+ $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
+ done
+
+ if test -z "$run"; then
+ # Make sure we have at least an empty file.
+ test -f "$nlist" || : > "$nlist"
+
+ if test -n "$exclude_expsyms"; then
+ $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
+ $mv "$nlist"T "$nlist"
+ fi
+
+ # Try sorting and uniquifying the output.
+ if grep -v "^: " < "$nlist" |
+ if sort -k 3 </dev/null >/dev/null 2>&1; then
+ sort -k 3
+ else
+ sort +2
+ fi |
+ uniq > "$nlist"S; then
+ :
+ else
+ grep -v "^: " < "$nlist" > "$nlist"S
+ fi
+
+ if test -f "$nlist"S; then
+ eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"'
+ else
+ $echo '/* NONE */' >> "$output_objdir/$dlsyms"
+ fi
+
+ $echo >> "$output_objdir/$dlsyms" "\
+
+#undef lt_preloaded_symbols
+
+#if defined (__STDC__) && __STDC__
+# define lt_ptr void *
+#else
+# define lt_ptr char *
+# define const
+#endif
+
+/* The mapping between symbol names and symbols. */
+"
+
+ case $host in
+ *cygwin* | *mingw* )
+ $echo >> "$output_objdir/$dlsyms" "\
+/* DATA imports from DLLs on WIN32 can't be const, because
+ runtime relocations are performed -- see ld's documentation
+ on pseudo-relocs */
+struct {
+"
+ ;;
+ * )
+ $echo >> "$output_objdir/$dlsyms" "\
+const struct {
+"
+ ;;
+ esac
+
+
+ $echo >> "$output_objdir/$dlsyms" "\
+ const char *name;
+ lt_ptr address;
+}
+lt_preloaded_symbols[] =
+{\
+"
+
+ eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms"
+
+ $echo >> "$output_objdir/$dlsyms" "\
+ {0, (lt_ptr) 0}
+};
+
+/* This works around a problem in FreeBSD linker */
+#ifdef FREEBSD_WORKAROUND
+static const void *lt_preloaded_setup() {
+ return lt_preloaded_symbols;
+}
+#endif
+
+#ifdef __cplusplus
+}
+#endif\
+"
+ fi
+
+ pic_flag_for_symtable=
+ case $host in
+ # compiling the symbol table file with pic_flag works around
+ # a FreeBSD bug that causes programs to crash when -lm is
+ # linked before any other PIC object. But we must not use
+ # pic_flag when linking with -static. The problem exists in
+ # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
+ *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
+ case "$compile_command " in
+ *" -static "*) ;;
+ *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";;
+ esac;;
+ *-*-hpux*)
+ case "$compile_command " in
+ *" -static "*) ;;
+ *) pic_flag_for_symtable=" $pic_flag";;
+ esac
+ esac
+
+ # Now compile the dynamic symbol file.
+ $show "(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
+ $run eval '(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
+
+ # Clean up the generated files.
+ $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
+ $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
+
+ # Transform the symbol file into the correct name.
+ case $host in
+ *cygwin* | *mingw* )
+ if test -f "$output_objdir/${outputname}.def" ; then
+ compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%" | $NL2SP`
+ finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%" | $NL2SP`
+ else
+ compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
+ finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
+ fi
+ ;;
+ * )
+ compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
+ finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
+ ;;
+ esac
+ ;;
+ *)
+ $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
+ exit $EXIT_FAILURE
+ ;;
+ esac
+ else
+ # We keep going just in case the user didn't refer to
+ # lt_preloaded_symbols. The linker will fail if global_symbol_pipe
+ # really was required.
+
+ # Nullify the symbol file.
+ compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s% @SYMFILE@%%" | $NL2SP`
+ finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s% @SYMFILE@%%" | $NL2SP`
+ fi
+
+ if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
+ # Replace the output file specification.
+ compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e 's%@OUTPUT@%'"$output"'%g' | $NL2SP`
+ link_command="$compile_command$compile_rpath"
+
+ # We have no uninstalled library dependencies, so finalize right now.
+ $show "$link_command"
+ $run eval "$link_command"
+ exit_status=$?
+
+ # Delete the generated files.
+ if test -n "$dlsyms"; then
+ $show "$rm $output_objdir/${outputname}S.${objext}"
+ $run $rm "$output_objdir/${outputname}S.${objext}"
+ fi
+
+ exit $exit_status
+ fi
+
+ if test -n "$shlibpath_var"; then
+ # We should set the shlibpath_var
+ rpath=
+ for dir in $temp_rpath; do
+ case $dir in
+ [\\/]* | [A-Za-z]:[\\/]*)
+ # Absolute path.
+ rpath="$rpath$dir:"
+ ;;
+ *)
+ # Relative path: add a thisdir entry.
+ rpath="$rpath\$thisdir/$dir:"
+ ;;
+ esac
+ done
+ temp_rpath="$rpath"
+ fi
+
+ if test -n "$compile_shlibpath$finalize_shlibpath"; then
+ compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
+ fi
+ if test -n "$finalize_shlibpath"; then
+ finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
+ fi
+
+ compile_var=
+ finalize_var=
+ if test -n "$runpath_var"; then
+ if test -n "$perm_rpath"; then
+ # We should set the runpath_var.
+ rpath=
+ for dir in $perm_rpath; do
+ rpath="$rpath$dir:"
+ done
+ compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
+ fi
+ if test -n "$finalize_perm_rpath"; then
+ # We should set the runpath_var.
+ rpath=
+ for dir in $finalize_perm_rpath; do
+ rpath="$rpath$dir:"
+ done
+ finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
+ fi
+ fi
+
+ if test "$no_install" = yes; then
+ # We don't need to create a wrapper script.
+ link_command="$compile_var$compile_command$compile_rpath"
+ # Replace the output file specification.
+ link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
+ # Delete the old output file.
+ $run $rm $output
+ # Link the executable and exit
+ $show "$link_command"
+ $run eval "$link_command" || exit $?
+ exit $EXIT_SUCCESS
+ fi
+
+ if test "$hardcode_action" = relink; then
+ # Fast installation is not supported
+ link_command="$compile_var$compile_command$compile_rpath"
+ relink_command="$finalize_var$finalize_command$finalize_rpath"
+
+ $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2
+ $echo "$modename: \`$output' will be relinked during installation" 1>&2
+ else
+ if test "$fast_install" != no; then
+ link_command="$finalize_var$compile_command$finalize_rpath"
+ if test "$fast_install" = yes; then
+ relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $SP2NL | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g' | $NL2SP`
+ else
+ # fast_install is set to needless
+ relink_command=
+ fi
+ else
+ link_command="$compile_var$compile_command$compile_rpath"
+ relink_command="$finalize_var$finalize_command$finalize_rpath"
+ fi
+ fi
+
+ # Replace the output file specification.
+ link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
+
+ # Delete the old output files.
+ $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname
+
+ $show "$link_command"
+ $run eval "$link_command" || exit $?
+
+ # Now create the wrapper script.
+ $show "creating $output"
+
+ # Quote the relink command for shipping.
+ if test -n "$relink_command"; then
+ # Preserve any variables that may affect compiler behavior
+ for var in $variables_saved_for_relink; do
+ if eval test -z \"\${$var+set}\"; then
+ relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
+ elif eval var_value=\$$var; test -z "$var_value"; then
+ relink_command="$var=; export $var; $relink_command"
+ else
+ var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
+ relink_command="$var=\"$var_value\"; export $var; $relink_command"
+ fi
+ done
+ relink_command="(cd `pwd`; $relink_command)"
+ relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e "$sed_quote_subst" | $NL2SP`
+ fi
+
+ # Quote $echo for shipping.
+ if test "X$echo" = "X$SHELL $progpath --fallback-echo"; then
+ case $progpath in
+ [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";;
+ *) qecho="$SHELL `pwd`/$progpath --fallback-echo";;
+ esac
+ qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
+ else
+ qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"`
+ fi
+
+ # Only actually do things if our run command is non-null.
+ if test -z "$run"; then
+ # win32 will think the script is a binary if it has
+ # a .exe suffix, so we strip it off here.
+ case $output in
+ *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;;
+ esac
+ # test for cygwin because mv fails w/o .exe extensions
+ case $host in
+ *cygwin*)
+ exeext=.exe
+ outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;;
+ *) exeext= ;;
+ esac
+ case $host in
+ *cygwin* | *mingw* )
+ output_name=`basename $output`
+ output_path=`dirname $output`
+ cwrappersource="$output_path/$objdir/lt-$output_name.c"
+ cwrapper="$output_path/$output_name.exe"
+ $rm $cwrappersource $cwrapper
+ trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
+
+ cat > $cwrappersource <<EOF
+
+/* $cwrappersource - temporary wrapper executable 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 executable should never be moved out of the build directory.
+ If it is, it will not operate correctly.
+
+ Currently, it simply execs the wrapper *script* "/bin/sh $output",
+ but could eventually absorb all of the scripts functionality and
+ exec $objdir/$outputname directly.
+*/
+EOF
+ cat >> $cwrappersource<<"EOF"
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <malloc.h>
+#include <stdarg.h>
+#include <assert.h>
+#include <string.h>
+#include <ctype.h>
+#include <sys/stat.h>
+
+#if defined(PATH_MAX)
+# define LT_PATHMAX PATH_MAX
+#elif defined(MAXPATHLEN)
+# define LT_PATHMAX MAXPATHLEN
+#else
+# define LT_PATHMAX 1024
+#endif
+
+#ifndef DIR_SEPARATOR
+# define DIR_SEPARATOR '/'
+# define PATH_SEPARATOR ':'
+#endif
+
+#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
+ defined (__OS2__)
+# define HAVE_DOS_BASED_FILE_SYSTEM
+# ifndef DIR_SEPARATOR_2
+# define DIR_SEPARATOR_2 '\\'
+# endif
+# ifndef PATH_SEPARATOR_2
+# define PATH_SEPARATOR_2 ';'
+# endif
+#endif
+
+#ifndef DIR_SEPARATOR_2
+# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
+#else /* DIR_SEPARATOR_2 */
+# define IS_DIR_SEPARATOR(ch) \
+ (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
+#endif /* DIR_SEPARATOR_2 */
+
+#ifndef PATH_SEPARATOR_2
+# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
+#else /* PATH_SEPARATOR_2 */
+# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
+#endif /* PATH_SEPARATOR_2 */
+
+#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type)))
+#define XFREE(stale) do { \
+ if (stale) { free ((void *) stale); stale = 0; } \
+} while (0)
+
+/* -DDEBUG is fairly common in CFLAGS. */
+#undef DEBUG
+#if defined DEBUGWRAPPER
+# define DEBUG(format, ...) fprintf(stderr, format, __VA_ARGS__)
+#else
+# define DEBUG(format, ...)
+#endif
+
+const char *program_name = NULL;
+
+void * xmalloc (size_t num);
+char * xstrdup (const char *string);
+const char * base_name (const char *name);
+char * find_executable(const char *wrapper);
+int check_executable(const char *path);
+char * strendzap(char *str, const char *pat);
+void lt_fatal (const char *message, ...);
+
+int
+main (int argc, char *argv[])
+{
+ char **newargz;
+ int i;
+
+ program_name = (char *) xstrdup (base_name (argv[0]));
+ DEBUG("(main) argv[0] : %s\n",argv[0]);
+ DEBUG("(main) program_name : %s\n",program_name);
+ newargz = XMALLOC(char *, argc+2);
+EOF
+
+ cat >> $cwrappersource <<EOF
+ newargz[0] = (char *) xstrdup("$SHELL");
+EOF
+
+ cat >> $cwrappersource <<"EOF"
+ newargz[1] = find_executable(argv[0]);
+ if (newargz[1] == NULL)
+ lt_fatal("Couldn't find %s", argv[0]);
+ DEBUG("(main) found exe at : %s\n",newargz[1]);
+ /* we know the script has the same name, without the .exe */
+ /* so make sure newargz[1] doesn't end in .exe */
+ strendzap(newargz[1],".exe");
+ for (i = 1; i < argc; i++)
+ newargz[i+1] = xstrdup(argv[i]);
+ newargz[argc+1] = NULL;
+
+ for (i=0; i<argc+1; i++)
+ {
+ DEBUG("(main) newargz[%d] : %s\n",i,newargz[i]);
+ ;
+ }
+
+EOF
+
+ case $host_os in
+ mingw*)
+ cat >> $cwrappersource <<EOF
+ execv("$SHELL",(char const **)newargz);
+EOF
+ ;;
+ *)
+ cat >> $cwrappersource <<EOF
+ execv("$SHELL",newargz);
+EOF
+ ;;
+ esac
+
+ cat >> $cwrappersource <<"EOF"
+ return 127;
+}
+
+void *
+xmalloc (size_t num)
+{
+ void * p = (void *) malloc (num);
+ if (!p)
+ lt_fatal ("Memory exhausted");
+
+ return p;
+}
+
+char *
+xstrdup (const char *string)
+{
+ return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL
+;
+}
+
+const char *
+base_name (const char *name)
+{
+ const char *base;
+
+#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
+ /* Skip over the disk name in MSDOS pathnames. */
+ if (isalpha ((unsigned char)name[0]) && name[1] == ':')
+ name += 2;
+#endif
+
+ for (base = name; *name; name++)
+ if (IS_DIR_SEPARATOR (*name))
+ base = name + 1;
+ return base;
+}
+
+int
+check_executable(const char * path)
+{
+ struct stat st;
+
+ DEBUG("(check_executable) : %s\n", path ? (*path ? path : "EMPTY!") : "NULL!");
+ if ((!path) || (!*path))
+ return 0;
+
+ if ((stat (path, &st) >= 0) &&
+ (
+ /* MinGW & native WIN32 do not support S_IXOTH or S_IXGRP */
+#if defined (S_IXOTH)
+ ((st.st_mode & S_IXOTH) == S_IXOTH) ||
+#endif
+#if defined (S_IXGRP)
+ ((st.st_mode & S_IXGRP) == S_IXGRP) ||
+#endif
+ ((st.st_mode & S_IXUSR) == S_IXUSR))
+ )
+ return 1;
+ else
+ return 0;
+}
+
+/* Searches for the full path of the wrapper. Returns
+ newly allocated full path name if found, NULL otherwise */
+char *
+find_executable (const char* wrapper)
+{
+ int has_slash = 0;
+ const char* p;
+ const char* p_next;
+ /* static buffer for getcwd */
+ char tmp[LT_PATHMAX + 1];
+ int tmp_len;
+ char* concat_name;
+
+ DEBUG("(find_executable) : %s\n", wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!");
+
+ if ((wrapper == NULL) || (*wrapper == '\0'))
+ return NULL;
+
+ /* Absolute path? */
+#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
+ if (isalpha ((unsigned char)wrapper[0]) && wrapper[1] == ':')
+ {
+ concat_name = xstrdup (wrapper);
+ if (check_executable(concat_name))
+ return concat_name;
+ XFREE(concat_name);
+ }
+ else
+ {
+#endif
+ if (IS_DIR_SEPARATOR (wrapper[0]))
+ {
+ concat_name = xstrdup (wrapper);
+ if (check_executable(concat_name))
+ return concat_name;
+ XFREE(concat_name);
+ }
+#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
+ }
+#endif
+
+ for (p = wrapper; *p; p++)
+ if (*p == '/')
+ {
+ has_slash = 1;
+ break;
+ }
+ if (!has_slash)
+ {
+ /* no slashes; search PATH */
+ const char* path = getenv ("PATH");
+ if (path != NULL)
+ {
+ for (p = path; *p; p = p_next)
+ {
+ const char* q;
+ size_t p_len;
+ for (q = p; *q; q++)
+ if (IS_PATH_SEPARATOR(*q))
+ break;
+ p_len = q - p;
+ p_next = (*q == '\0' ? q : q + 1);
+ if (p_len == 0)
+ {
+ /* empty path: current directory */
+ if (getcwd (tmp, LT_PATHMAX) == NULL)
+ lt_fatal ("getcwd failed");
+ tmp_len = strlen(tmp);
+ concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
+ memcpy (concat_name, tmp, tmp_len);
+ concat_name[tmp_len] = '/';
+ strcpy (concat_name + tmp_len + 1, wrapper);
+ }
+ else
+ {
+ concat_name = XMALLOC(char, p_len + 1 + strlen(wrapper) + 1);
+ memcpy (concat_name, p, p_len);
+ concat_name[p_len] = '/';
+ strcpy (concat_name + p_len + 1, wrapper);
+ }
+ if (check_executable(concat_name))
+ return concat_name;
+ XFREE(concat_name);
+ }
+ }
+ /* not found in PATH; assume curdir */
+ }
+ /* Relative path | not found in path: prepend cwd */
+ if (getcwd (tmp, LT_PATHMAX) == NULL)
+ lt_fatal ("getcwd failed");
+ tmp_len = strlen(tmp);
+ concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
+ memcpy (concat_name, tmp, tmp_len);
+ concat_name[tmp_len] = '/';
+ strcpy (concat_name + tmp_len + 1, wrapper);
+
+ if (check_executable(concat_name))
+ return concat_name;
+ XFREE(concat_name);
+ return NULL;
+}
+
+char *
+strendzap(char *str, const char *pat)
+{
+ size_t len, patlen;
+
+ assert(str != NULL);
+ assert(pat != NULL);
+
+ len = strlen(str);
+ patlen = strlen(pat);
+
+ if (patlen <= len)
+ {
+ str += len - patlen;
+ if (strcmp(str, pat) == 0)
+ *str = '\0';
+ }
+ return str;
+}
+
+static void
+lt_error_core (int exit_status, const char * mode,
+ const char * message, va_list ap)
+{
+ fprintf (stderr, "%s: %s: ", program_name, mode);
+ vfprintf (stderr, message, ap);
+ fprintf (stderr, ".\n");
+
+ if (exit_status >= 0)
+ exit (exit_status);
+}
+
+void
+lt_fatal (const char *message, ...)
+{
+ va_list ap;
+ va_start (ap, message);
+ lt_error_core (EXIT_FAILURE, "FATAL", message, ap);
+ va_end (ap);
+}
+EOF
+ # we should really use a build-platform specific compiler
+ # here, but OTOH, the wrappers (shell script and this C one)
+ # are only useful if you want to execute the "real" binary.
+ # Since the "real" binary is built for $host, then this
+ # wrapper might as well be built for $host, too.
+ $run $LTCC $LTCFLAGS -s -o $cwrapper $cwrappersource
+ ;;
+ esac
+ $rm $output
+ trap "$rm $output; exit $EXIT_FAILURE" 1 2 15
+
+ $echo > $output "\
+#! $SHELL
+
+# $output - temporary wrapper script for $objdir/$outputname
+# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
+#
+# The $output program cannot be directly executed until all the libtool
+# libraries that it depends on are installed.
+#
+# This wrapper script should never be moved out of the build directory.
+# If it is, it will not operate correctly.
+
+# Sed substitution that helps us do robust quoting. It backslashifies
+# metacharacters that are still active within double-quoted strings.
+Xsed='${SED} -e 1s/^X//'
+sed_quote_subst='$sed_quote_subst'
+
+# Be Bourne compatible (taken from Autoconf:_AS_BOURNE_COMPATIBLE).
+if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
+ emulate sh
+ NULLCMD=:
+ # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
+ # is contrary to our usage. Disable this feature.
+ alias -g '\${1+\"\$@\"}'='\"\$@\"'
+ setopt NO_GLOB_SUBST
+else
+ case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
+fi
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+relink_command=\"$relink_command\"
+
+# This environment variable determines our operation mode.
+if test \"\$libtool_install_magic\" = \"$magic\"; then
+ # install mode needs the following variable:
+ notinst_deplibs='$notinst_deplibs'
+else
+ # When we are sourced in execute mode, \$file and \$echo are already set.
+ if test \"\$libtool_execute_magic\" != \"$magic\"; then
+ echo=\"$qecho\"
+ file=\"\$0\"
+ # Make sure echo works.
+ if test \"X\$1\" = X--no-reexec; then
+ # Discard the --no-reexec flag, and continue.
+ shift
+ elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then
+ # Yippee, \$echo works!
+ :
+ else
+ # Restart under the correct shell, and then maybe \$echo will work.
+ exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
+ fi
+ fi\
+"
+ $echo >> $output "\
+
+ # Find the directory that this script lives in.
+ thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
+ test \"x\$thisdir\" = \"x\$file\" && thisdir=.
+
+ # Follow symbolic links until we get to the real thisdir.
+ file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\`
+ while test -n \"\$file\"; do
+ destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
+
+ # If there was a directory component, then change thisdir.
+ if test \"x\$destdir\" != \"x\$file\"; then
+ case \"\$destdir\" in
+ [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
+ *) thisdir=\"\$thisdir/\$destdir\" ;;
+ esac
+ fi
+
+ file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
+ file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\`
+ done
+
+ # Try to get the absolute directory name.
+ absdir=\`cd \"\$thisdir\" && pwd\`
+ test -n \"\$absdir\" && thisdir=\"\$absdir\"
+"
+
+ if test "$fast_install" = yes; then
+ $echo >> $output "\
+ program=lt-'$outputname'$exeext
+ progdir=\"\$thisdir/$objdir\"
+
+ if test ! -f \"\$progdir/\$program\" || \\
+ { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
+ test \"X\$file\" != \"X\$progdir/\$program\"; }; then
+
+ file=\"\$\$-\$program\"
+
+ if test ! -d \"\$progdir\"; then
+ $mkdir \"\$progdir\"
+ else
+ $rm \"\$progdir/\$file\"
+ fi"
+
+ $echo >> $output "\
+
+ # relink executable if necessary
+ if test -n \"\$relink_command\"; then
+ if relink_command_output=\`eval \$relink_command 2>&1\`; then :
+ else
+ $echo \"\$relink_command_output\" >&2
+ $rm \"\$progdir/\$file\"
+ exit $EXIT_FAILURE
+ fi
+ fi
+
+ $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
+ { $rm \"\$progdir/\$program\";
+ $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; }
+ $rm \"\$progdir/\$file\"
+ fi"
+ else
+ $echo >> $output "\
+ program='$outputname'
+ progdir=\"\$thisdir/$objdir\"
+"
+ fi
+
+ $echo >> $output "\
+
+ if test -f \"\$progdir/\$program\"; then"
+
+ # Export our shlibpath_var if we have one.
+ if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
+ $echo >> $output "\
+ # Add our own library path to $shlibpath_var
+ $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
+
+ # Some systems cannot cope with colon-terminated $shlibpath_var
+ # The second colon is a workaround for a bug in BeOS R4 sed
+ $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
+
+ export $shlibpath_var
+"
+ fi
+
+ # fixup the dll searchpath if we need to.
+ if test -n "$dllsearchpath"; then
+ $echo >> $output "\
+ # Add the dll search path components to the executable PATH
+ PATH=$dllsearchpath:\$PATH
+"
+ fi
+
+ $echo >> $output "\
+ if test \"\$libtool_execute_magic\" != \"$magic\"; then
+ # Run the actual program with our arguments.
+"
+ case $host in
+ # Backslashes separate directories on plain windows
+ *-*-mingw | *-*-os2*)
+ $echo >> $output "\
+ exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
+"
+ ;;
+
+ *)
+ $echo >> $output "\
+ exec \"\$progdir/\$program\" \${1+\"\$@\"}
+"
+ ;;
+ esac
+ $echo >> $output "\
+ \$echo \"\$0: cannot exec \$program \$*\"
+ exit $EXIT_FAILURE
+ fi
+ else
+ # The program doesn't exist.
+ \$echo \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
+ \$echo \"This script is just a wrapper for \$program.\" 1>&2
+ $echo \"See the $PACKAGE documentation for more information.\" 1>&2
+ exit $EXIT_FAILURE
+ fi
+fi\
+"
+ chmod +x $output
+ fi
+ exit $EXIT_SUCCESS
+ ;;
+ esac
+
+ # See if we need to build an old-fashioned archive.
+ for oldlib in $oldlibs; do
+
+ if test "$build_libtool_libs" = convenience; then
+ oldobjs="$libobjs_save"
+ addlibs="$convenience"
+ build_libtool_libs=no
+ else
+ if test "$build_libtool_libs" = module; then
+ oldobjs="$libobjs_save"
+ build_libtool_libs=no
+ else
+ oldobjs="$old_deplibs $non_pic_objects"
+ fi
+ addlibs="$old_convenience"
+ fi
+
+ if test -n "$addlibs"; then
+ gentop="$output_objdir/${outputname}x"
+ generated="$generated $gentop"
+
+ func_extract_archives $gentop $addlibs
+ oldobjs="$oldobjs $func_extract_archives_result"
+ fi
+
+ # Do each command in the archive commands.
+ if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
+ cmds=$old_archive_from_new_cmds
+ else
+ # POSIX demands no paths to be encoded in archives. We have
+ # to avoid creating archives with duplicate basenames if we
+ # might have to extract them afterwards, e.g., when creating a
+ # static archive out of a convenience library, or when linking
+ # the entirety of a libtool archive into another (currently
+ # not supported by libtool).
+ if (for obj in $oldobjs
+ do
+ $echo "X$obj" | $Xsed -e 's%^.*/%%'
+ done | sort | sort -uc >/dev/null 2>&1); then
+ :
+ else
+ $echo "copying selected object files to avoid basename conflicts..."
+
+ if test -z "$gentop"; then
+ gentop="$output_objdir/${outputname}x"
+ generated="$generated $gentop"
+
+ $show "${rm}r $gentop"
+ $run ${rm}r "$gentop"
+ $show "$mkdir $gentop"
+ $run $mkdir "$gentop"
+ exit_status=$?
+ if test "$exit_status" -ne 0 && test ! -d "$gentop"; then
+ exit $exit_status
+ fi
+ fi
+
+ save_oldobjs=$oldobjs
+ oldobjs=
+ counter=1
+ for obj in $save_oldobjs
+ do
+ objbase=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
+ case " $oldobjs " in
+ " ") oldobjs=$obj ;;
+ *[\ /]"$objbase "*)
+ while :; do
+ # Make sure we don't pick an alternate name that also
+ # overlaps.
+ newobj=lt$counter-$objbase
+ counter=`expr $counter + 1`
+ case " $oldobjs " in
+ *[\ /]"$newobj "*) ;;
+ *) if test ! -f "$gentop/$newobj"; then break; fi ;;
+ esac
+ done
+ $show "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
+ $run ln "$obj" "$gentop/$newobj" ||
+ $run cp "$obj" "$gentop/$newobj"
+ oldobjs="$oldobjs $gentop/$newobj"
+ ;;
+ *) oldobjs="$oldobjs $obj" ;;
+ esac
+ done
+ fi
+
+ eval cmds=\"$old_archive_cmds\"
+
+ if len=`expr "X$cmds" : ".*"` &&
+ test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
+ cmds=$old_archive_cmds
+ else
+ # the command line is too long to link in one step, link in parts
+ $echo "using piecewise archive linking..."
+ save_RANLIB=$RANLIB
+ RANLIB=:
+ objlist=
+ concat_cmds=
+ save_oldobjs=$oldobjs
+
+ # Is there a better way of finding the last object in the list?
+ for obj in $save_oldobjs
+ do
+ last_oldobj=$obj
+ done
+ for obj in $save_oldobjs
+ do
+ oldobjs="$objlist $obj"
+ objlist="$objlist $obj"
+ eval test_cmds=\"$old_archive_cmds\"
+ if len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
+ test "$len" -le "$max_cmd_len"; then
+ :
+ else
+ # the above command should be used before it gets too long
+ oldobjs=$objlist
+ if test "$obj" = "$last_oldobj" ; then
+ RANLIB=$save_RANLIB
+ fi
+ test -z "$concat_cmds" || concat_cmds=$concat_cmds~
+ eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
+ objlist=
+ fi
+ done
+ RANLIB=$save_RANLIB
+ oldobjs=$objlist
+ if test "X$oldobjs" = "X" ; then
+ eval cmds=\"\$concat_cmds\"
+ else
+ eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
+ fi
+ fi
+ fi
+ save_ifs="$IFS"; IFS='~'
+ for cmd in $cmds; do
+ eval cmd=\"$cmd\"
+ IFS="$save_ifs"
+ $show "$cmd"
+ $run eval "$cmd" || exit $?
+ done
+ IFS="$save_ifs"
+ done
+
+ if test -n "$generated"; then
+ $show "${rm}r$generated"
+ $run ${rm}r$generated
+ fi
+
+ # Now create the libtool archive.
+ case $output in
+ *.la)
+ old_library=
+ test "$build_old_libs" = yes && old_library="$libname.$libext"
+ $show "creating $output"
+
+ # Preserve any variables that may affect compiler behavior
+ for var in $variables_saved_for_relink; do
+ if eval test -z \"\${$var+set}\"; then
+ relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
+ elif eval var_value=\$$var; test -z "$var_value"; then
+ relink_command="$var=; export $var; $relink_command"
+ else
+ var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
+ relink_command="$var=\"$var_value\"; export $var; $relink_command"
+ fi
+ done
+ # Quote the link command for shipping.
+ relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
+ relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e "$sed_quote_subst" | $NL2SP`
+ if test "$hardcode_automatic" = yes ; then
+ relink_command=
+ fi
+
+
+ # Only create the output if not a dry run.
+ if test -z "$run"; then
+ for installed in no yes; do
+ if test "$installed" = yes; then
+ if test -z "$install_libdir"; then
+ break
+ fi
+ output="$output_objdir/$outputname"i
+ # Replace all uninstalled libtool libraries with the installed ones
+ newdependency_libs=
+ for deplib in $dependency_libs; do
+ case $deplib in
+ *.la)
+ name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'`
+ eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
+ if test -z "$libdir"; then
+ $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
+ exit $EXIT_FAILURE
+ fi
+ newdependency_libs="$newdependency_libs $libdir/$name"
+ ;;
+ *) newdependency_libs="$newdependency_libs $deplib" ;;
+ esac
+ done
+ dependency_libs="$newdependency_libs"
+ newdlfiles=
+ for lib in $dlfiles; do
+ name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
+ eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
+ if test -z "$libdir"; then
+ $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
+ exit $EXIT_FAILURE
+ fi
+ newdlfiles="$newdlfiles $libdir/$name"
+ done
+ dlfiles="$newdlfiles"
+ newdlprefiles=
+ for lib in $dlprefiles; do
+ name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
+ eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
+ if test -z "$libdir"; then
+ $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
+ exit $EXIT_FAILURE
+ fi
+ newdlprefiles="$newdlprefiles $libdir/$name"
+ done
+ dlprefiles="$newdlprefiles"
+ else
+ newdlfiles=
+ for lib in $dlfiles; do
+ case $lib in
+ [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
+ *) abs=`pwd`"/$lib" ;;
+ esac
+ newdlfiles="$newdlfiles $abs"
+ done
+ dlfiles="$newdlfiles"
+ newdlprefiles=
+ for lib in $dlprefiles; do
+ case $lib in
+ [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
+ *) abs=`pwd`"/$lib" ;;
+ esac
+ newdlprefiles="$newdlprefiles $abs"
+ done
+ dlprefiles="$newdlprefiles"
+ fi
+ $rm $output
+ # place dlname in correct position for cygwin
+ tdlname=$dlname
+ case $host,$output,$installed,$module,$dlname in
+ *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
+ esac
+ $echo > $output "\
+# $outputname - a libtool library file
+# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
+#
+# Please DO NOT delete this file!
+# It is necessary for linking the library.
+
+# The name that we can dlopen(3).
+dlname='$tdlname'
+
+# Names of this library.
+library_names='$library_names'
+
+# The name of the static archive.
+old_library='$old_library'
+
+# Libraries that this one depends upon.
+dependency_libs='$dependency_libs'
+
+# Version information for $libname.
+current=$current
+age=$age
+revision=$revision
+
+# Is this an already installed library?
+installed=$installed
+
+# Should we warn about portability when linking against -modules?
+shouldnotlink=$module
+
+# Files to dlopen/dlpreopen
+dlopen='$dlfiles'
+dlpreopen='$dlprefiles'
+
+# Directory that this library needs to be installed in:
+libdir='$install_libdir'"
+ if test "$installed" = no && test "$need_relink" = yes; then
+ $echo >> $output "\
+relink_command=\"$relink_command\""
+ fi
+ done
+ fi
+
+ # Do a symbolic link so that the libtool archive can be found in
+ # LD_LIBRARY_PATH before the program is installed.
+ $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)"
+ $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $?
+ ;;
+ esac
+ exit $EXIT_SUCCESS
+ ;;
+
+ # libtool install mode
+ install)
+ modename="$modename: install"
+
+ # There may be an optional sh(1) argument at the beginning of
+ # install_prog (especially on Windows NT).
+ if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
+ # Allow the use of GNU shtool's install command.
+ $echo "X$nonopt" | grep shtool > /dev/null; then
+ # Aesthetically quote it.
+ arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
+ case $arg in
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
+ arg="\"$arg\""
+ ;;
+ esac
+ install_prog="$arg "
+ arg="$1"
+ shift
+ else
+ install_prog=
+ arg=$nonopt
+ fi
+
+ # The real first argument should be the name of the installation program.
+ # Aesthetically quote it.
+ arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
+ case $arg in
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
+ arg="\"$arg\""
+ ;;
+ esac
+ install_prog="$install_prog$arg"
+
+ # We need to accept at least all the BSD install flags.
+ dest=
+ files=
+ opts=
+ prev=
+ install_type=
+ isdir=no
+ stripme=
+ for arg
+ do
+ if test -n "$dest"; then
+ files="$files $dest"
+ dest=$arg
+ continue
+ fi
+
+ case $arg in
+ -d) isdir=yes ;;
+ -f)
+ case " $install_prog " in
+ *[\\\ /]cp\ *) ;;
+ *) prev=$arg ;;
+ esac
+ ;;
+ -g | -m | -o) prev=$arg ;;
+ -s)
+ stripme=" -s"
+ continue
+ ;;
+ -*)
+ ;;
+ *)
+ # If the previous option needed an argument, then skip it.
+ if test -n "$prev"; then
+ prev=
+ else
+ dest=$arg
+ continue
+ fi
+ ;;
+ esac
+
+ # Aesthetically quote the argument.
+ arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
+ case $arg in
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
+ arg="\"$arg\""
+ ;;
+ esac
+ install_prog="$install_prog $arg"
+ done
+
+ if test -z "$install_prog"; then
+ $echo "$modename: you must specify an install program" 1>&2
+ $echo "$help" 1>&2
+ exit $EXIT_FAILURE
+ fi
+
+ if test -n "$prev"; then
+ $echo "$modename: the \`$prev' option requires an argument" 1>&2
+ $echo "$help" 1>&2
+ exit $EXIT_FAILURE
+ fi
+
+ if test -z "$files"; then
+ if test -z "$dest"; then
+ $echo "$modename: no file or destination specified" 1>&2
+ else
+ $echo "$modename: you must specify a destination" 1>&2
+ fi
+ $echo "$help" 1>&2
+ exit $EXIT_FAILURE
+ fi
+
+ # Strip any trailing slash from the destination.
+ dest=`$echo "X$dest" | $Xsed -e 's%/$%%'`
+
+ # Check to see that the destination is a directory.
+ test -d "$dest" && isdir=yes
+ if test "$isdir" = yes; then
+ destdir="$dest"
+ destname=
+ else
+ destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'`
+ test "X$destdir" = "X$dest" && destdir=.
+ destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'`
+
+ # Not a directory, so check to see that there is only one file specified.
+ set dummy $files
+ if test "$#" -gt 2; then
+ $echo "$modename: \`$dest' is not a directory" 1>&2
+ $echo "$help" 1>&2
+ exit $EXIT_FAILURE
+ fi
+ fi
+ case $destdir in
+ [\\/]* | [A-Za-z]:[\\/]*) ;;
+ *)
+ for file in $files; do
+ case $file in
+ *.lo) ;;
+ *)
+ $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
+ $echo "$help" 1>&2
+ exit $EXIT_FAILURE
+ ;;
+ esac
+ done
+ ;;
+ esac
+
+ # This variable tells wrapper scripts just to set variables rather
+ # than running their programs.
+ libtool_install_magic="$magic"
+
+ staticlibs=
+ future_libdirs=
+ current_libdirs=
+ for file in $files; do
+
+ # Do each installation.
+ case $file in
+ *.$libext)
+ # Do the static libraries later.
+ staticlibs="$staticlibs $file"
+ ;;
+
+ *.la)
+ # Check to see that this really is a libtool archive.
+ if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
+ else
+ $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
+ $echo "$help" 1>&2
+ exit $EXIT_FAILURE
+ fi
+
+ library_names=
+ old_library=
+ relink_command=
+ # If there is no directory component, then add one.
+ case $file in
+ */* | *\\*) . $file ;;
+ *) . ./$file ;;
+ esac
+
+ # Add the libdir to current_libdirs if it is the destination.
+ if test "X$destdir" = "X$libdir"; then
+ case "$current_libdirs " in
+ *" $libdir "*) ;;
+ *) current_libdirs="$current_libdirs $libdir" ;;
+ esac
+ else
+ # Note the libdir as a future libdir.
+ case "$future_libdirs " in
+ *" $libdir "*) ;;
+ *) future_libdirs="$future_libdirs $libdir" ;;
+ esac
+ fi
+
+ dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/
+ test "X$dir" = "X$file/" && dir=
+ dir="$dir$objdir"
+
+ if test -n "$relink_command"; then
+ # Determine the prefix the user has applied to our future dir.
+ inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"`
+
+ # Don't allow the user to place us outside of our expected
+ # location b/c this prevents finding dependent libraries that
+ # are installed to the same prefix.
+ # At present, this check doesn't affect windows .dll's that
+ # are installed into $libdir/../bin (currently, that works fine)
+ # but it's something to keep an eye on.
+ if test "$inst_prefix_dir" = "$destdir"; then
+ $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2
+ exit $EXIT_FAILURE
+ fi
+
+ if test -n "$inst_prefix_dir"; then
+ # Stick the inst_prefix_dir data into the link command.
+ relink_command=`$echo "$relink_command" | $SP2NL | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%" | $NL2SP`
+ else
+ relink_command=`$echo "$relink_command" | $SP2NL | $SED "s%@inst_prefix_dir@%%" | $NL2SP`
+ fi
+
+ $echo "$modename: warning: relinking \`$file'" 1>&2
+ $show "$relink_command"
+ if $run eval "$relink_command"; then :
+ else
+ $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
+ exit $EXIT_FAILURE
+ fi
+ fi
+
+ # See the names of the shared library.
+ set dummy $library_names
+ if test -n "$2"; then
+ realname="$2"
+ shift
+ shift
+
+ srcname="$realname"
+ test -n "$relink_command" && srcname="$realname"T
+
+ # Install the shared library and build the symlinks.
+ $show "$install_prog $dir/$srcname $destdir/$realname"
+ $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $?
+ if test -n "$stripme" && test -n "$striplib"; then
+ $show "$striplib $destdir/$realname"
+ $run eval "$striplib $destdir/$realname" || exit $?
+ fi
+
+ if test "$#" -gt 0; then
+ # Delete the old symlinks, and create new ones.
+ # Try `ln -sf' first, because the `ln' binary might depend on
+ # the symlink we replace! Solaris /bin/ln does not understand -f,
+ # so we also need to try rm && ln -s.
+ for linkname
+ do
+ if test "$linkname" != "$realname"; then
+ $show "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })"
+ $run eval "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })"
+ fi
+ done
+ fi
+
+ # Do each command in the postinstall commands.
+ lib="$destdir/$realname"
+ cmds=$postinstall_cmds
+ save_ifs="$IFS"; IFS='~'
+ for cmd in $cmds; do
+ IFS="$save_ifs"
+ eval cmd=\"$cmd\"
+ $show "$cmd"
+ $run eval "$cmd" || {
+ lt_exit=$?
+
+ # Restore the uninstalled library and exit
+ if test "$mode" = relink; then
+ $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)'
+ fi
+
+ exit $lt_exit
+ }
+ done
+ IFS="$save_ifs"
+ fi
+
+ # Install the pseudo-library for information purposes.
+ name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
+ instname="$dir/$name"i
+ $show "$install_prog $instname $destdir/$name"
+ $run eval "$install_prog $instname $destdir/$name" || exit $?
+
+ # Maybe install the static library, too.
+ test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
+ ;;
+
+ *.lo)
+ # Install (i.e. copy) a libtool object.
+
+ # Figure out destination file name, if it wasn't already specified.
+ if test -n "$destname"; then
+ destfile="$destdir/$destname"
+ else
+ destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
+ destfile="$destdir/$destfile"
+ fi
+
+ # Deduce the name of the destination old-style object file.
+ case $destfile in
+ *.lo)
+ staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"`
+ ;;
+ *.$objext)
+ staticdest="$destfile"
+ destfile=
+ ;;
+ *)
+ $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
+ $echo "$help" 1>&2
+ exit $EXIT_FAILURE
+ ;;
+ esac
+
+ # Install the libtool object if requested.
+ if test -n "$destfile"; then
+ $show "$install_prog $file $destfile"
+ $run eval "$install_prog $file $destfile" || exit $?
+ fi
+
+ # Install the old object if enabled.
+ if test "$build_old_libs" = yes; then
+ # Deduce the name of the old-style object file.
+ staticobj=`$echo "X$file" | $Xsed -e "$lo2o"`
+
+ $show "$install_prog $staticobj $staticdest"
+ $run eval "$install_prog \$staticobj \$staticdest" || exit $?
+ fi
+ exit $EXIT_SUCCESS
+ ;;
+
+ *)
+ # Figure out destination file name, if it wasn't already specified.
+ if test -n "$destname"; then
+ destfile="$destdir/$destname"
+ else
+ destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
+ destfile="$destdir/$destfile"
+ fi
+
+ # If the file is missing, and there is a .exe on the end, strip it
+ # because it is most likely a libtool script we actually want to
+ # install
+ stripped_ext=""
+ case $file in
+ *.exe)
+ if test ! -f "$file"; then
+ file=`$echo $file|${SED} 's,.exe$,,'`
+ stripped_ext=".exe"
+ fi
+ ;;
+ esac
+
+ # Do a test to see if this is really a libtool program.
+ case $host in
+ *cygwin*|*mingw*)
+ wrapper=`$echo $file | ${SED} -e 's,.exe$,,'`
+ ;;
+ *)
+ wrapper=$file
+ ;;
+ esac
+ if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then
+ notinst_deplibs=
+ relink_command=
+
+ # Note that it is not necessary on cygwin/mingw to append a dot to
+ # foo even if both foo and FILE.exe exist: automatic-append-.exe
+ # behavior happens only for exec(3), not for open(2)! Also, sourcing
+ # `FILE.' does not work on cygwin managed mounts.
+ #
+ # If there is no directory component, then add one.
+ case $wrapper in
+ */* | *\\*) . ${wrapper} ;;
+ *) . ./${wrapper} ;;
+ esac
+
+ # Check the variables that should have been set.
+ if test -z "$notinst_deplibs"; then
+ $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2
+ exit $EXIT_FAILURE
+ fi
+
+ finalize=yes
+ for lib in $notinst_deplibs; do
+ # Check to see that each library is installed.
+ libdir=
+ if test -f "$lib"; then
+ # If there is no directory component, then add one.
+ case $lib in
+ */* | *\\*) . $lib ;;
+ *) . ./$lib ;;
+ esac
+ fi
+ libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
+ if test -n "$libdir" && test ! -f "$libfile"; then
+ $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
+ finalize=no
+ fi
+ done
+
+ relink_command=
+ # Note that it is not necessary on cygwin/mingw to append a dot to
+ # foo even if both foo and FILE.exe exist: automatic-append-.exe
+ # behavior happens only for exec(3), not for open(2)! Also, sourcing
+ # `FILE.' does not work on cygwin managed mounts.
+ #
+ # If there is no directory component, then add one.
+ case $wrapper in
+ */* | *\\*) . ${wrapper} ;;
+ *) . ./${wrapper} ;;
+ esac
+
+ outputname=
+ if test "$fast_install" = no && test -n "$relink_command"; then
+ if test "$finalize" = yes && test -z "$run"; then
+ tmpdir=`func_mktempdir`
+ file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'`
+ outputname="$tmpdir/$file"
+ # Replace the output file specification.
+ relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g' | $NL2SP`
+
+ $show "$relink_command"
+ if $run eval "$relink_command"; then :
+ else
+ $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
+ ${rm}r "$tmpdir"
+ continue
+ fi
+ file="$outputname"
+ else
+ $echo "$modename: warning: cannot relink \`$file'" 1>&2
+ fi
+ else
+ # Install the binary that we compiled earlier.
+ file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
+ fi
+ fi
+
+ # remove .exe since cygwin /usr/bin/install will append another
+ # one anyway
+ case $install_prog,$host in
+ */usr/bin/install*,*cygwin*)
+ case $file:$destfile in
+ *.exe:*.exe)
+ # this is ok
+ ;;
+ *.exe:*)
+ destfile=$destfile.exe
+ ;;
+ *:*.exe)
+ destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'`
+ ;;
+ esac
+ ;;
+ esac
+ $show "$install_prog$stripme $file $destfile"
+ $run eval "$install_prog\$stripme \$file \$destfile" || exit $?
+ test -n "$outputname" && ${rm}r "$tmpdir"
+ ;;
+ esac
+ done
+
+ for file in $staticlibs; do
+ name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
+
+ # Set up the ranlib parameters.
+ oldlib="$destdir/$name"
+
+ $show "$install_prog $file $oldlib"
+ $run eval "$install_prog \$file \$oldlib" || exit $?
+
+ if test -n "$stripme" && test -n "$old_striplib"; then
+ $show "$old_striplib $oldlib"
+ $run eval "$old_striplib $oldlib" || exit $?
+ fi
+
+ # Do each command in the postinstall commands.
+ cmds=$old_postinstall_cmds
+ save_ifs="$IFS"; IFS='~'
+ for cmd in $cmds; do
+ IFS="$save_ifs"
+ eval cmd=\"$cmd\"
+ $show "$cmd"
+ $run eval "$cmd" || exit $?
+ done
+ IFS="$save_ifs"
+ done
+
+ if test -n "$future_libdirs"; then
+ $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
+ fi
+
+ if test -n "$current_libdirs"; then
+ # Maybe just do a dry run.
+ test -n "$run" && current_libdirs=" -n$current_libdirs"
+ exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
+ else
+ exit $EXIT_SUCCESS
+ fi
+ ;;
+
+ # libtool finish mode
+ finish)
+ modename="$modename: finish"
+ libdirs="$nonopt"
+ admincmds=
+
+ if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
+ for dir
+ do
+ libdirs="$libdirs $dir"
+ done
+
+ for libdir in $libdirs; do
+ if test -n "$finish_cmds"; then
+ # Do each command in the finish commands.
+ cmds=$finish_cmds
+ save_ifs="$IFS"; IFS='~'
+ for cmd in $cmds; do
+ IFS="$save_ifs"
+ eval cmd=\"$cmd\"
+ $show "$cmd"
+ $run eval "$cmd" || admincmds="$admincmds
+ $cmd"
+ done
+ IFS="$save_ifs"
+ fi
+ if test -n "$finish_eval"; then
+ # Do the single finish_eval.
+ eval cmds=\"$finish_eval\"
+ $run eval "$cmds" || admincmds="$admincmds
+ $cmds"
+ fi
+ done
+ fi
+
+ # Exit here if they wanted silent mode.
+ test "$show" = : && exit $EXIT_SUCCESS
+
+ $echo "X----------------------------------------------------------------------" | $Xsed
+ $echo "Libraries have been installed in:"
+ for libdir in $libdirs; do
+ $echo " $libdir"
+ done
+ $echo
+ $echo "If you ever happen to want to link against installed libraries"
+ $echo "in a given directory, LIBDIR, you must either use libtool, and"
+ $echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
+ $echo "flag during linking and do at least one of the following:"
+ if test -n "$shlibpath_var"; then
+ $echo " - add LIBDIR to the \`$shlibpath_var' environment variable"
+ $echo " during execution"
+ fi
+ if test -n "$runpath_var"; then
+ $echo " - add LIBDIR to the \`$runpath_var' environment variable"
+ $echo " during linking"
+ fi
+ if test -n "$hardcode_libdir_flag_spec"; then
+ libdir=LIBDIR
+ eval flag=\"$hardcode_libdir_flag_spec\"
+
+ $echo " - use the \`$flag' linker flag"
+ fi
+ if test -n "$admincmds"; then
+ $echo " - have your system administrator run these commands:$admincmds"
+ fi
+ if test -f /etc/ld.so.conf; then
+ $echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
+ fi
+ $echo
+ $echo "See any operating system documentation about shared libraries for"
+ $echo "more information, such as the ld(1) and ld.so(8) manual pages."
+ $echo "X----------------------------------------------------------------------" | $Xsed
+ exit $EXIT_SUCCESS
+ ;;
+
+ # libtool execute mode
+ execute)
+ modename="$modename: execute"
+
+ # The first argument is the command name.
+ cmd="$nonopt"
+ if test -z "$cmd"; then
+ $echo "$modename: you must specify a COMMAND" 1>&2
+ $echo "$help"
+ exit $EXIT_FAILURE
+ fi
+
+ # Handle -dlopen flags immediately.
+ for file in $execute_dlfiles; do
+ if test ! -f "$file"; then
+ $echo "$modename: \`$file' is not a file" 1>&2
+ $echo "$help" 1>&2
+ exit $EXIT_FAILURE
+ fi
+
+ dir=
+ case $file in
+ *.la)
+ # Check to see that this really is a libtool archive.
+ if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
+ else
+ $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
+ $echo "$help" 1>&2
+ exit $EXIT_FAILURE
+ fi
+
+ # Read the libtool library.
+ dlname=
+ library_names=
+
+ # If there is no directory component, then add one.
+ case $file in
+ */* | *\\*) . $file ;;
+ *) . ./$file ;;
+ esac
+
+ # Skip this library if it cannot be dlopened.
+ if test -z "$dlname"; then
+ # Warn if it was a shared library.
+ test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'"
+ continue
+ fi
+
+ dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
+ test "X$dir" = "X$file" && dir=.
+
+ if test -f "$dir/$objdir/$dlname"; then
+ dir="$dir/$objdir"
+ else
+ $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
+ for lt_var in LANG LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
+ do
+ eval "if test \"\${save_$lt_var+set}\" = set; then
+ $lt_var=\$save_$lt_var; export $lt_var
+ else
+ $lt_unset $lt_var
+ fi"
+ done
+
+
+ # Now prepare to actually exec the command.
+ exec_cmd="\$cmd$args"
+ else
+ # Display what would be done.
+ if test -n "$shlibpath_var"; then
+ eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
+ $echo "export $shlibpath_var"
+ fi
+ $echo "$cmd$args"
+ exit $EXIT_SUCCESS
+ fi
+ ;;
+
+ # libtool clean and uninstall mode
+ clean | uninstall)
+ modename="$modename: $mode"
+ rm="$nonopt"
+ files=
+ rmforce=
+ exit_status=0
+
+ # This variable tells wrapper scripts just to set variables rather
+ # than running their programs.
+ libtool_install_magic="$magic"
+
+ for arg
+ do
+ case $arg in
+ -f) rm="$rm $arg"; rmforce=yes ;;
+ -*) rm="$rm $arg" ;;
+ *) files="$files $arg" ;;
+ esac
+ done
+
+ if test -z "$rm"; then
+ $echo "$modename: you must specify an RM program" 1>&2
+ $echo "$help" 1>&2
+ exit $EXIT_FAILURE
+ fi
+
+ rmdirs=
+
+ origobjdir="$objdir"
+ for file in $files; do
+ dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
+ if test "X$dir" = "X$file"; then
+ dir=.
+ objdir="$origobjdir"
+ else
+ objdir="$dir/$origobjdir"
+ fi
+ name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
+ test "$mode" = uninstall && objdir="$dir"
+
+ # Remember objdir for removal later, being careful to avoid duplicates
+ if test "$mode" = clean; then
+ case " $rmdirs " in
+ *" $objdir "*) ;;
+ *) rmdirs="$rmdirs $objdir" ;;
+ esac
+ fi
+
+ # Don't error if the file doesn't exist and rm -f was used.
+ if (test -L "$file") >/dev/null 2>&1 \
+ || (test -h "$file") >/dev/null 2>&1 \
+ || test -f "$file"; then
+ :
+ elif test -d "$file"; then
+ exit_status=1
+ continue
+ elif test "$rmforce" = yes; then
+ continue
+ fi
+
+ rmfiles="$file"
+
+ case $name in
+ *.la)
+ # Possibly a libtool archive, so verify it.
+ if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
+ . $dir/$name
+
+ # Delete the libtool libraries and symlinks.
+ for n in $library_names; do
+ rmfiles="$rmfiles $objdir/$n"
+ done
+ test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
+
+ case "$mode" in
+ clean)
+ case " $library_names " in
+ # " " in the beginning catches empty $dlname
+ *" $dlname "*) ;;
+ *) rmfiles="$rmfiles $objdir/$dlname" ;;
+ esac
+ test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
+ ;;
+ uninstall)
+ if test -n "$library_names"; then
+ # Do each command in the postuninstall commands.
+ cmds=$postuninstall_cmds
+ save_ifs="$IFS"; IFS='~'
+ for cmd in $cmds; do
+ IFS="$save_ifs"
+ eval cmd=\"$cmd\"
+ $show "$cmd"
+ $run eval "$cmd"
+ if test "$?" -ne 0 && test "$rmforce" != yes; then
+ exit_status=1
+ fi
+ done
+ IFS="$save_ifs"
+ fi
+
+ if test -n "$old_library"; then
+ # Do each command in the old_postuninstall commands.
+ cmds=$old_postuninstall_cmds
+ save_ifs="$IFS"; IFS='~'
+ for cmd in $cmds; do
+ IFS="$save_ifs"
+ eval cmd=\"$cmd\"
+ $show "$cmd"
+ $run eval "$cmd"
+ if test "$?" -ne 0 && test "$rmforce" != yes; then
+ exit_status=1
+ fi
+ done
+ IFS="$save_ifs"
+ fi
+ # FIXME: should reinstall the best remaining shared library.
+ ;;
+ esac
+ fi
+ ;;
+
+ *.lo)
+ # Possibly a libtool object, so verify it.
+ if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
+
+ # Read the .lo file
+ . $dir/$name
+
+ # Add PIC object to the list of files to remove.
+ if test -n "$pic_object" \
+ && test "$pic_object" != none; then
+ rmfiles="$rmfiles $dir/$pic_object"
+ fi
+
+ # Add non-PIC object to the list of files to remove.
+ if test -n "$non_pic_object" \
+ && test "$non_pic_object" != none; then
+ rmfiles="$rmfiles $dir/$non_pic_object"
+ fi
+ fi
+ ;;
+
+ *)
+ if test "$mode" = clean ; then
+ noexename=$name
+ case $file in
+ *.exe)
+ file=`$echo $file|${SED} 's,.exe$,,'`
+ noexename=`$echo $name|${SED} 's,.exe$,,'`
+ # $file with .exe has already been added to rmfiles,
+ # add $file without .exe
+ rmfiles="$rmfiles $file"
+ ;;
+ esac
+ # Do a test to see if this is a libtool program.
+ if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
+ relink_command=
+ . $dir/$noexename
+
+ # note $name still contains .exe if it was in $file originally
+ # as does the version of $file that was added into $rmfiles
+ rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
+ if test "$fast_install" = yes && test -n "$relink_command"; then
+ rmfiles="$rmfiles $objdir/lt-$name"
+ fi
+ if test "X$noexename" != "X$name" ; then
+ rmfiles="$rmfiles $objdir/lt-${noexename}.c"
+ fi
+ fi
+ fi
+ ;;
+ esac
+ $show "$rm $rmfiles"
+ $run $rm $rmfiles || exit_status=1
+ done
+ objdir="$origobjdir"
+
+ # Try to remove the ${objdir}s in the directories where we deleted files
+ for dir in $rmdirs; do
+ if test -d "$dir"; then
+ $show "rmdir $dir"
+ $run rmdir $dir >/dev/null 2>&1
+ fi
+ done
+
+ exit $exit_status
+ ;;
+
+ "")
+ $echo "$modename: you must specify a MODE" 1>&2
+ $echo "$generic_help" 1>&2
+ exit $EXIT_FAILURE
+ ;;
+ esac
+
+ if test -z "$exec_cmd"; then
+ $echo "$modename: invalid operation mode \`$mode'" 1>&2
+ $echo "$generic_help" 1>&2
+ exit $EXIT_FAILURE
+ fi
+fi # test -z "$show_help"
+
+if test -n "$exec_cmd"; then
+ eval exec $exec_cmd
+ exit $EXIT_FAILURE
+fi
+
+# We need to display help for each of the modes.
+case $mode in
+"") $echo \
+"Usage: $modename [OPTION]... [MODE-ARG]...
+
+Provide generalized library-building support services.
+
+ --config show all configuration variables
+ --debug enable verbose shell tracing
+-n, --dry-run display commands without modifying any files
+ --features display basic configuration information and exit
+ --finish same as \`--mode=finish'
+ --help display this help message and exit
+ --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS]
+ --quiet same as \`--silent'
+ --silent don't print informational messages
+ --tag=TAG use configuration variables from tag TAG
+ --version print version information
+
+MODE must be one of the following:
+
+ clean remove files from the build directory
+ compile compile a source file into a libtool object
+ execute automatically set library path, then run a program
+ finish complete the installation of libtool libraries
+ install install libraries or executables
+ link create a library or an executable
+ uninstall remove libraries from an installed directory
+
+MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for
+a more detailed description of MODE.
+
+Report bugs to <bug-libtool@gnu.org>."
+ exit $EXIT_SUCCESS
+ ;;
+
+clean)
+ $echo \
+"Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
+
+Remove files from the build directory.
+
+RM is the name of the program to use to delete files associated with each FILE
+(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
+to RM.
+
+If FILE is a libtool library, object or program, all the files associated
+with it are deleted. Otherwise, only FILE itself is deleted using RM."
+ ;;
+
+compile)
+ $echo \
+"Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
+
+Compile a source file into a libtool library object.
+
+This mode accepts the following additional options:
+
+ -o OUTPUT-FILE set the output file name to OUTPUT-FILE
+ -prefer-pic try to building PIC objects only
+ -prefer-non-pic try to building non-PIC objects only
+ -static always build a \`.o' file suitable for static linking
+
+COMPILE-COMMAND is a command to be used in creating a \`standard' object file
+from the given SOURCEFILE.
+
+The output file name is determined by removing the directory component from
+SOURCEFILE, then substituting the C source code suffix \`.c' with the
+library object suffix, \`.lo'."
+ ;;
+
+execute)
+ $echo \
+"Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]...
+
+Automatically set library path, then run a program.
+
+This mode accepts the following additional options:
+
+ -dlopen FILE add the directory containing FILE to the library path
+
+This mode sets the library path environment variable according to \`-dlopen'
+flags.
+
+If any of the ARGS are libtool executable wrappers, then they are translated
+into their corresponding uninstalled binary, and any of their required library
+directories are added to the library path.
+
+Then, COMMAND is executed, with ARGS as arguments."
+ ;;
+
+finish)
+ $echo \
+"Usage: $modename [OPTION]... --mode=finish [LIBDIR]...
+
+Complete the installation of libtool libraries.
+
+Each LIBDIR is a directory that contains libtool libraries.
+
+The commands that this mode executes may require superuser privileges. Use
+the \`--dry-run' option if you just want to see what would be executed."
+ ;;
+
+install)
+ $echo \
+"Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND...
+
+Install executables or libraries.
+
+INSTALL-COMMAND is the installation command. The first component should be
+either the \`install' or \`cp' program.
+
+The rest of the components are interpreted as arguments to that command (only
+BSD-compatible install options are recognized)."
+ ;;
+
+link)
+ $echo \
+"Usage: $modename [OPTION]... --mode=link LINK-COMMAND...
+
+Link object files or libraries together to form another library, or to
+create an executable program.
+
+LINK-COMMAND is a command using the C compiler that you would use to create
+a program from several object files.
+
+The following components of LINK-COMMAND are treated specially:
+
+ -all-static do not do any dynamic linking at all
+ -avoid-version do not add a version suffix if possible
+ -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
+ -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
+ -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
+ -export-symbols SYMFILE
+ try to export only the symbols listed in SYMFILE
+ -export-symbols-regex REGEX
+ try to export only the symbols matching REGEX
+ -LLIBDIR search LIBDIR for required installed libraries
+ -lNAME OUTPUT-FILE requires the installed library libNAME
+ -module build a library that can dlopened
+ -no-fast-install disable the fast-install mode
+ -no-install link a not-installable executable
+ -no-undefined declare that a library does not refer to external symbols
+ -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
+ -objectlist FILE Use a list of object files found in FILE to specify objects
+ -precious-files-regex REGEX
+ don't remove output files matching REGEX
+ -release RELEASE specify package release information
+ -rpath LIBDIR the created library will eventually be installed in LIBDIR
+ -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
+ -static do not do any dynamic linking of uninstalled libtool libraries
+ -static-libtool-libs
+ do not do any dynamic linking of libtool libraries
+ -version-info CURRENT[:REVISION[:AGE]]
+ specify library version info [each variable defaults to 0]
+
+All other options (arguments beginning with \`-') are ignored.
+
+Every other argument is treated as a filename. Files ending in \`.la' are
+treated as uninstalled libtool libraries, other files are standard or library
+object files.
+
+If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
+only library objects (\`.lo' files) may be specified, and \`-rpath' is
+required, except when creating a convenience library.
+
+If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
+using \`ar' and \`ranlib', or on Windows using \`lib'.
+
+If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
+is created, otherwise an executable program is created."
+ ;;
+
+uninstall)
+ $echo \
+"Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
+
+Remove libraries from an installation directory.
+
+RM is the name of the program to use to delete files associated with each FILE
+(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
+to RM.
+
+If FILE is a libtool library, all the files associated with it are deleted.
+Otherwise, only FILE itself is deleted using RM."
+ ;;
+
+*)
+ $echo "$modename: invalid operation mode \`$mode'" 1>&2
+ $echo "$help" 1>&2
+ exit $EXIT_FAILURE
+ ;;
+esac
+
+$echo
+$echo "Try \`$modename --help' for more information about other modes."
+
+exit $?
+
+# The TAGs below are defined such that we never get into a situation
+# in which we disable both kinds of libraries. Given conflicting
+# choices, we go for a static library, that is the most portable,
+# since we can't tell whether shared libraries were disabled because
+# the user asked for that or because the platform doesn't support
+# them. This is particularly important on AIX, because we don't
+# support having both static and shared libraries enabled at the same
+# time on that platform, so we default to a shared-only configuration.
+# If a disable-shared tag is given, we'll fallback to a static-only
+# configuration. But we'll never go from static-only to shared-only.
+
+# ### BEGIN LIBTOOL TAG CONFIG: disable-shared
+disable_libs=shared
+# ### END LIBTOOL TAG CONFIG: disable-shared
+
+# ### BEGIN LIBTOOL TAG CONFIG: disable-static
+disable_libs=static
+# ### END LIBTOOL TAG CONFIG: disable-static
+
+# Local Variables:
+# mode:shell-script
+# sh-indentation:2
+# End:
--- /dev/null
+MANDIR = @mandir@/man8
+
+install:
+ $(INSTALL) -m 644 -D \
+ ./l7vsd.8.gz \
+ ./l7vsadm.8.gz \
+ ./l7directord.8.gz \
+ $(MANDIR)
--- /dev/null
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = man
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+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)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+GLIB_CFLAGS = @GLIB_CFLAGS@
+GLIB_GENMARSHAL = @GLIB_GENMARSHAL@
+GLIB_LIBS = @GLIB_LIBS@
+GLIB_MKENUMS = @GLIB_MKENUMS@
+GOBJECT_QUERY = @GOBJECT_QUERY@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MANDIR = @mandir@/man8
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PKG_CONFIG = @PKG_CONFIG@
+RANLIB = @RANLIB@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+ac_ct_RANLIB = @ac_ct_RANLIB@
+ac_ct_STRIP = @ac_ct_STRIP@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+l7vs_maxvs = @l7vs_maxvs@
+l7vs_moddir = @l7vs_moddir@
+l7vsadm_sockdir = @l7vsadm_sockdir@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+snmpagent_libs = @snmpagent_libs@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu man/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --gnu man/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+distclean-libtool:
+ -rm -f libtool
+uninstall-info-am:
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+ list='$(DISTFILES)'; for file in $$list; do \
+ case $$file in \
+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+ esac; \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ dir="/$$dir"; \
+ $(mkdir_p) "$(distdir)$$dir"; \
+ else \
+ dir=''; \
+ fi; \
+ if test -d $$d/$$file; then \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile
+installdirs:
+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-libtool mostlyclean-am
+
+distclean: distclean-am
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic distclean-libtool
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-exec-am:
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-info-am
+
+.PHONY: all all-am check check-am clean clean-generic clean-libtool \
+ distclean distclean-generic distclean-libtool distdir dvi \
+ dvi-am html html-am info info-am install install-am \
+ install-data install-data-am install-exec install-exec-am \
+ install-info install-info-am install-man install-strip \
+ installcheck installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-generic \
+ mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am \
+ uninstall-info-am
+
+
+install:
+ $(INSTALL) -m 644 -D \
+ ./l7vsd.8.gz \
+ ./l7vsadm.8.gz \
+ ./l7directord.8.gz \
+ $(MANDIR)
+# 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:
--- /dev/null
+/usr/share/automake-1.9/missing
\ No newline at end of file
--- /dev/null
+SUBDIRS = protocol schedule
--- /dev/null
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = module
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+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)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+ html-recursive info-recursive install-data-recursive \
+ install-exec-recursive install-info-recursive \
+ install-recursive installcheck-recursive installdirs-recursive \
+ pdf-recursive ps-recursive uninstall-info-recursive \
+ uninstall-recursive
+ETAGS = etags
+CTAGS = ctags
+DIST_SUBDIRS = $(SUBDIRS)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+GLIB_CFLAGS = @GLIB_CFLAGS@
+GLIB_GENMARSHAL = @GLIB_GENMARSHAL@
+GLIB_LIBS = @GLIB_LIBS@
+GLIB_MKENUMS = @GLIB_MKENUMS@
+GOBJECT_QUERY = @GOBJECT_QUERY@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MANDIR = @MANDIR@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PKG_CONFIG = @PKG_CONFIG@
+RANLIB = @RANLIB@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+ac_ct_RANLIB = @ac_ct_RANLIB@
+ac_ct_STRIP = @ac_ct_STRIP@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+l7vs_maxvs = @l7vs_maxvs@
+l7vs_moddir = @l7vs_moddir@
+l7vsadm_sockdir = @l7vsadm_sockdir@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+snmpagent_libs = @snmpagent_libs@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+SUBDIRS = protocol schedule
+all: all-recursive
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu module/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --gnu module/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+distclean-libtool:
+ -rm -f libtool
+uninstall-info-am:
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+# (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+$(RECURSIVE_TARGETS):
+ @failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ target=`echo $@ | sed s/-recursive//`; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ dot_seen=yes; \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done; \
+ if test "$$dot_seen" = "no"; then \
+ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+ fi; test -z "$$fail"
+
+mostlyclean-recursive clean-recursive distclean-recursive \
+maintainer-clean-recursive:
+ @failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ case "$@" in \
+ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+ *) list='$(SUBDIRS)' ;; \
+ esac; \
+ rev=''; for subdir in $$list; do \
+ if test "$$subdir" = "."; then :; else \
+ rev="$$subdir $$rev"; \
+ fi; \
+ done; \
+ rev="$$rev ."; \
+ target=`echo $@ | sed s/-recursive//`; \
+ for subdir in $$rev; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done && test -z "$$fail"
+tags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+ done
+ctags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+ 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: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
+ include_option=--etags-include; \
+ empty_fix=.; \
+ else \
+ include_option=--include; \
+ empty_fix=; \
+ fi; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test ! -f $$subdir/TAGS || \
+ tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
+ fi; \
+ done; \
+ 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: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+ list='$(DISTFILES)'; for file in $$list; do \
+ case $$file in \
+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+ esac; \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ dir="/$$dir"; \
+ $(mkdir_p) "$(distdir)$$dir"; \
+ else \
+ dir=''; \
+ fi; \
+ if test -d $$d/$$file; then \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+ list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test -d "$(distdir)/$$subdir" \
+ || $(mkdir_p) "$(distdir)/$$subdir" \
+ || exit 1; \
+ distdir=`$(am__cd) $(distdir) && pwd`; \
+ top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
+ (cd $$subdir && \
+ $(MAKE) $(AM_MAKEFLAGS) \
+ top_distdir="$$top_distdir" \
+ distdir="$$distdir/$$subdir" \
+ distdir) \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-recursive
+all-am: Makefile
+installdirs: installdirs-recursive
+installdirs-am:
+install: install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+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-recursive
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-recursive
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic distclean-libtool \
+ distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+html: html-recursive
+
+info: info-recursive
+
+info-am:
+
+install-data-am:
+
+install-exec-am:
+
+install-info: install-info-recursive
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-recursive
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-recursive
+
+pdf-am:
+
+ps: ps-recursive
+
+ps-am:
+
+uninstall-am: uninstall-info-am
+
+uninstall-info: uninstall-info-recursive
+
+.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am \
+ clean clean-generic clean-libtool clean-recursive ctags \
+ ctags-recursive distclean distclean-generic distclean-libtool \
+ distclean-recursive distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-data \
+ install-data-am install-exec install-exec-am install-info \
+ install-info-am install-man install-strip installcheck \
+ installcheck-am installdirs installdirs-am maintainer-clean \
+ maintainer-clean-generic maintainer-clean-recursive \
+ mostlyclean mostlyclean-generic mostlyclean-libtool \
+ mostlyclean-recursive pdf pdf-am ps ps-am tags tags-recursive \
+ uninstall uninstall-am uninstall-info-am
+
+# 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:
--- /dev/null
+AUTOMAKE_OPTIONS = foreign
+L7VS_MODDIR = @l7vs_moddir@
+AM_CFLAGS = -fPIC $(GLIB_CFLAGS) -I../../include -I../../logger
+AM_CPPFLAGS = -fPIC $(GLIB_CFLAGS) -I../../include -I../../logger
+
+lib_LTLIBRARIES = \
+ libprotomod_url.la \
+ libprotomod_pfilter.la \
+ libprotomod_sslid.la \
+ libprotomod_ip.la \
+ libprotomod_sessionless.la
+libprotomod_sslid_la_SOURCES = protomod_sslid.c protomod_sslid.h module_http.c module_http.h module_sslid_hash.cpp module_sslid_hash.h module_sslid_hash_map.cpp module_sslid_hash_map.h
+libprotomod_sslid_la_LIBADD = $(GLIB_LIB) -lrt
+libprotomod_url_la_SOURCES = protomod_url.c module_http.c module_http.h
+libprotomod_url_la_LIBADD = $(GLIB_LIB) -lrt -lboost_regex
+libprotomod_pfilter_la_SOURCES = protomod_pfilter.c
+libprotomod_pfilter_la_LIBADD = $(GLIB_LIB) -lrt -lboost_regex
+libprotomod_ip_la_SOURCES = protomod_ip.c module_http.c module_http.h
+libprotomod_ip_la_LIBADD = $(GLIB_LIB) -lrt
+libprotomod_sessionless_la_SOURCES = protomod_sessionless.c module_http.c module_http.h
+libprotomod_sessionless_la_LIBADD = $(GLIB_LIB) -lrt
+
+install:
+ cp ./.libs/libprotomod_sslid.so ./.libs/protomod_sslid.so && \
+ cp ./.libs/libprotomod_url.so ./.libs/protomod_url.so && \
+ cp ./.libs/libprotomod_pfilter.so ./.libs/protomod_pfilter.so && \
+ cp ./.libs/libprotomod_ip.so ./.libs/protomod_ip.so && \
+ cp ./.libs/libprotomod_sessionless.so ./.libs/protomod_sessionless.so && \
+ $(INSTALL) -m 755 -d $(L7VS_MODDIR)
+ $(INSTALL) -m 755 -D \
+ ./.libs/protomod_sslid.so \
+ ./.libs/protomod_url.so \
+ ./.libs/protomod_pfilter.so \
+ ./.libs/protomod_ip.so \
+ ./.libs/protomod_sessionless.so $(L7VS_MODDIR)
--- /dev/null
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = module/protocol
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+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)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__installdirs = "$(DESTDIR)$(libdir)"
+libLTLIBRARIES_INSTALL = $(INSTALL)
+LTLIBRARIES = $(lib_LTLIBRARIES)
+libprotomod_cinsert_la_DEPENDENCIES =
+am_libprotomod_cinsert_la_OBJECTS = protomod_cinsert.lo module_http.lo
+libprotomod_cinsert_la_OBJECTS = $(am_libprotomod_cinsert_la_OBJECTS)
+libprotomod_cpassive_la_DEPENDENCIES =
+am_libprotomod_cpassive_la_OBJECTS = protomod_cpassive.lo module_http.lo
+libprotomod_cpassive_la_OBJECTS = $(am_libprotomod_cpassive_la_OBJECTS)
+libprotomod_crewrite_la_DEPENDENCIES =
+am_libprotomod_crewrite_la_OBJECTS = protomod_crewrite.lo module_http.lo
+libprotomod_crewrite_la_OBJECTS = $(am_libprotomod_crewrite_la_OBJECTS)
+libprotomod_ip_la_DEPENDENCIES =
+am_libprotomod_ip_la_OBJECTS = protomod_ip.lo module_http.lo
+libprotomod_ip_la_OBJECTS = $(am_libprotomod_ip_la_OBJECTS)
+libprotomod_sessionless_la_DEPENDENCIES =
+am_libprotomod_sessionless_la_OBJECTS = protomod_sessionless.lo \
+ module_http.lo
+libprotomod_sessionless_la_OBJECTS = \
+ $(am_libprotomod_sessionless_la_OBJECTS)
+libprotomod_sslid_la_DEPENDENCIES =
+am_libprotomod_sslid_la_OBJECTS = protomod_sslid.lo module_http.lo \
+ module_sslid_hash.lo module_sslid_hash_map.lo
+libprotomod_sslid_la_OBJECTS = $(am_libprotomod_sslid_la_OBJECTS)
+libprotomod_url_la_DEPENDENCIES =
+am_libprotomod_url_la_OBJECTS = protomod_url.lo module_http.lo
+libprotomod_url_la_OBJECTS = $(am_libprotomod_url_la_OBJECTS)
+libprotomod_pfilter_la_DEPENDENCIES =
+am_libprotomod_pfilter_la_OBJECTS = protomod_pfilter.lo
+libprotomod_pfilter_la_OBJECTS = $(am_libprotomod_pfilter_la_OBJECTS)
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+LTCXXCOMPILE = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+CXXLD = $(CXX)
+CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+SOURCES = \
+ $(libprotomod_cinsert_la_SOURCES) \
+ $(libprotomod_cpassive_la_SOURCES) \
+ $(libprotomod_crewrite_la_SOURCES) \
+ $(libprotomod_ip_la_SOURCES) \
+ $(libprotomod_sessionless_la_SOURCES) \
+ $(libprotomod_sslid_la_SOURCES) \
+ $(libprotomod_url_la_SOURCES) \
+ $(libprotomod_pfilter_la_SOURCES)
+DIST_SOURCES = \
+ $(libprotomod_cinsert_la_SOURCES) \
+ $(libprotomod_cpassive_la_SOURCES) \
+ $(libprotomod_crewrite_la_SOURCES) \
+ $(libprotomod_ip_la_SOURCES) \
+ $(libprotomod_sessionless_la_SOURCES) \
+ $(libprotomod_sslid_la_SOURCES) \
+ $(libprotomod_url_la_SOURCES) \
+ $(libprotomod_pfilter_la_SOURCES)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DSYMUTIL = @DSYMUTIL@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+GLIB_CFLAGS = @GLIB_CFLAGS@
+GLIB_GENMARSHAL = @GLIB_GENMARSHAL@
+GLIB_LIBS = @GLIB_LIBS@
+GLIB_MKENUMS = @GLIB_MKENUMS@
+GOBJECT_QUERY = @GOBJECT_QUERY@
+GREP = @GREP@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MANDIR = @MANDIR@
+MKDIR_P = @MKDIR_P@
+NMEDIT = @NMEDIT@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PKG_CONFIG = @PKG_CONFIG@
+RANLIB = @RANLIB@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+l7vs_maxvs = @l7vs_maxvs@
+l7vs_moddir = @l7vs_moddir@
+l7vsadm_sockdir = @l7vsadm_sockdir@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+snmpagent_libs = @snmpagent_libs@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+AUTOMAKE_OPTIONS = foreign
+L7VS_MODDIR = @l7vs_moddir@
+AM_CFLAGS = -fPIC $(GLIB_CFLAGS) -I../../include -I../../logger
+AM_CPPFLAGS = -fPIC $(GLIB_CFLAGS) -I../../include -I../../logger
+lib_LTLIBRARIES = \
+ libprotomod_cinsert.la \
+ libprotomod_cpassive.la \
+ libprotomod_crewrite.la \
+ libprotomod_ip.la \
+ libprotomod_url.la \
+ libprotomod_pfilter.la \
+ libprotomod_sslid.la \
+ libprotomod_sessionless.la
+libprotomod_cinsert_la_SOURCES = protomod_cinsert.c module_http.c module_http.h
+libprotomod_cinsert_la_LIBADD = $(GLIB_LIB) -lrt
+libprotomod_cpassive_la_SOURCES = protomod_cpassive.c module_http.c module_http.h
+libprotomod_cpassive_la_LIBADD = $(GLIB_LIB) -lrt
+libprotomod_crewrite_la_SOURCES = protomod_crewrite.c module_http.c module_http.h
+libprotomod_crewrite_la_LIBADD = $(GLIB_LIB) -lrt
+libprotomod_ip_la_SOURCES = protomod_ip.c module_http.c module_http.h
+libprotomod_ip_la_LIBADD = $(GLIB_LIB) -lrt
+libprotomod_sslid_la_SOURCES = protomod_sslid.c protomod_sslid.h module_http.c module_http.h module_sslid_hash.cpp module_sslid_hash.h module_sslid_hash_map.cpp module_sslid_hash_map.h
+libprotomod_sslid_la_LIBADD = $(GLIB_LIB) -lrt
+libprotomod_url_la_SOURCES = protomod_url.c module_http.c module_http.h
+libprotomod_url_la_LIBADD = $(GLIB_LIB) -lrt -lboost_regex
+libprotomod_pfilter_la_SOURCES = protomod_pfilter.c
+libprotomod_pfilter_la_LIBADD = $(GLIB_LIB) -lrt -lboost_regex
+libprotomod_sessionless_la_SOURCES = protomod_sessionless.c module_http.c module_http.h
+libprotomod_sessionless_la_LIBADD = $(GLIB_LIB) -lrt
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .cpp .lo .o .obj
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign module/protocol/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign module/protocol/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+install-libLTLIBRARIES: $(lib_LTLIBRARIES)
+ @$(NORMAL_INSTALL)
+ test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)"
+ @list='$(lib_LTLIBRARIES)'; for p in $$list; do \
+ if test -f $$p; then \
+ f=$(am__strip_dir) \
+ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \
+ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(libdir)/$$f"; \
+ else :; fi; \
+ done
+
+uninstall-libLTLIBRARIES:
+ @$(NORMAL_UNINSTALL)
+ @list='$(lib_LTLIBRARIES)'; for p in $$list; do \
+ p=$(am__strip_dir) \
+ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$p'"; \
+ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --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
+libprotomod_cinsert.la: $(libprotomod_cinsert_la_OBJECTS) $(libprotomod_cinsert_la_DEPENDENCIES)
+ $(LINK) -rpath $(libdir) $(libprotomod_cinsert_la_OBJECTS) $(libprotomod_cinsert_la_LIBADD) $(LIBS)
+libprotomod_cpassive.la: $(libprotomod_cpassive_la_OBJECTS) $(libprotomod_cpassive_la_DEPENDENCIES)
+ $(LINK) -rpath $(libdir) $(libprotomod_cpassive_la_LDFLAGS) $(libprotomod_cpassive_la_OBJECTS) $(libprotomod_cpassive_la_LIBADD) $(LIBS)
+libprotomod_crewrite.la: $(libprotomod_crewrite_la_OBJECTS) $(libprotomod_crewrite_la_DEPENDENCIES)
+ $(LINK) -rpath $(libdir) $(libprotomod_crewrite_la_LDFLAGS) $(libprotomod_crewrite_la_OBJECTS) $(libprotomod_crewrite_la_LIBADD) $(LIBS)
+libprotomod_ip.la: $(libprotomod_ip_la_OBJECTS) $(libprotomod_ip_la_DEPENDENCIES)
+ $(LINK) -rpath $(libdir) $(libprotomod_ip_la_LDFLAGS) $(libprotomod_ip_la_OBJECTS) $(libprotomod_ip_la_LIBADD) $(LIBS)
+libprotomod_sessionless.la: $(libprotomod_sessionless_la_OBJECTS) $(libprotomod_sessionless_la_DEPENDENCIES)
+ $(LINK) -rpath $(libdir) $(libprotomod_sessionless_la_OBJECTS) $(libprotomod_sessionless_la_LIBADD) $(LIBS)
+libprotomod_sslid.la: $(libprotomod_sslid_la_OBJECTS) $(libprotomod_sslid_la_DEPENDENCIES)
+ $(CXXLINK) -rpath $(libdir) $(libprotomod_sslid_la_OBJECTS) $(libprotomod_sslid_la_LIBADD) $(LIBS)
+libprotomod_url.la: $(libprotomod_url_la_OBJECTS) $(libprotomod_url_la_DEPENDENCIES)
+ $(LINK) -rpath $(libdir) $(libprotomod_url_la_OBJECTS) $(libprotomod_url_la_LIBADD) $(LIBS)
+libprotomod_pfilter.la: $(libprotomod_pfilter_la_OBJECTS) $(libprotomod_pfilter_la_DEPENDENCIES)
+ $(LINK) -rpath $(libdir) $(libprotomod_pfilter_la_LDFLAGS) $(libprotomod_pfilter_la_OBJECTS) $(libprotomod_pfilter_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/module_http.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/module_sslid_hash.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/module_sslid_hash_map.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/protomod_cinsert.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/protomod_cpassive.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/protomod_crewrite.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/protomod_ip.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/protomod_sessionless.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/protomod_sslid.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/protomod_url.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/protomod_pfilter.Plo@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+
+.cpp.o:
+@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $<
+
+.cpp.obj:
+@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+
+.cpp.lo:
+@am__fastdepCXX_TRUE@ $(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+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; nonemtpy = 1; } \
+ END { if (nonempty) { 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; nonempty = 1; } \
+ END { if (nonempty) { 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=; \
+ 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; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LTLIBRARIES)
+installdirs:
+ for dir in "$(DESTDIR)$(libdir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install-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-libLTLIBRARIES clean-libtool \
+ mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-exec-am: install-libLTLIBRARIES
+
+install-html: install-html-am
+
+install-info: install-info-am
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-libLTLIBRARIES
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+ clean-libLTLIBRARIES clean-libtool ctags distclean \
+ distclean-compile distclean-generic distclean-libtool \
+ distclean-tags distdir dvi dvi-am html html-am info info-am \
+ install install-am install-data install-data-am install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am \
+ install-libLTLIBRARIES install-man install-pdf install-pdf-am \
+ install-ps install-ps-am 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-libLTLIBRARIES
+
+
+install:
+ cp ./.libs/libprotomod_cinsert.so ./.libs/protomod_cinsert.so && \
+ cp ./.libs/libprotomod_cpassive.so ./.libs/protomod_cpassive.so && \
+ cp ./.libs/libprotomod_crewrite.so ./.libs/protomod_crewrite.so && \
+ cp ./.libs/libprotomod_ip.so ./.libs/protomod_ip.so && \
+ cp ./.libs/libprotomod_sslid.so ./.libs/protomod_sslid.so && \
+ cp ./.libs/libprotomod_url.so ./.libs/protomod_url.so && \
+ cp ./.libs/libprotomod_pfilter.so ./.libs/protomod_pfilter.so && \
+ cp ./.libs/libprotomod_sessionless.so ./.libs/protomod_sessionless.so && \
+ $(INSTALL) -m 755 -d $(L7VS_MODDIR)
+ $(INSTALL) -m 755 -D \
+ ./.libs/protomod_cinsert.so \
+ ./.libs/protomod_cpassive.so \
+ ./.libs/protomod_crewrite.so \
+ ./.libs/protomod_ip.so \
+ ./.libs/protomod_sslid.so \
+ ./.libs/protomod_url.so \
+ ./.libs/protomod_pfilter.so \
+ ./.libs/protomod_sessionless.so $(L7VS_MODDIR)
+# 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:
--- /dev/null
+/*
+ * @file module_http.c
+ * @brief Library of HTTP protocol for protocol module.
+ * @brief this library provide HTTP header control.
+ *
+ * L7VSD: Linux Virtual Server for Layer7 Load Balancing
+ * Copyright (C) 2008 NTT COMWARE Corporation.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ **********************************************************************/
+
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <ctype.h>
+#include <unistd.h>
+#include <time.h>
+#include "module_http.h"
+
+char* _http_search_header_cookie_value(char*, char*, char*);
+
+/*!
+ * create a expire string of HTTP cookie header field.
+ * @param expire_t expire time
+ * @param expire_c return expire string
+ * @return void
+ */
+extern void
+http_cookie_expire(time_t expire_t, char* expire_c)
+{
+ struct tm *date;
+
+ date = gmtime(&expire_t);
+ strftime(expire_c, EXPIRE_MAXSIZE, "%a, %d-%b-%Y %H:%M:%S GMT", date);
+}
+
+/*!
+ * check the HTTP status that is included in a HTTP Response header.
+ * (RFC2616 http://www.ietf.org/rfc/rfc2616.txt)
+ * @param *res HTTP Response header
+ * @retval 0 HTTP status is 2xx or 3xx, or 1xx.
+ * @retval -1 HTTP status is 4xx or 5xx, or is not able to be found.
+ */
+extern int
+http_check_response_status(char *res)
+{
+ /* check NULL */
+ if (res == NULL) {
+ return -1;
+ }
+
+ /* pattern match "HTTP/X.Y ZYY " (X: 0 or 1) (Y: 0 ~ 9) (Z: 1 ~ 3) */
+ if ( res[0] != 'H' || res[1] != 'T' || res[2] != 'T' || res[3] != 'P' ||
+ res[4] != '/' || ( res[5] != '1' && res[5] != '0' ) ||
+ res[6] != '.' || !isdigit(res[7]) || res[8] != ' ' ||
+ ( res[9] != '2' && res[9] != '3' && res[9] != '1' ) ||
+ !isdigit(res[10]) || !isdigit(res[11]) || res[12] != ' ' ) {
+ return -1;
+ }
+
+ return 0;
+}
+
+/*!
+ * check the HTTP method that is included in a HTTP Request header.
+ * (RFC2616 http://www.ietf.org/rfc/rfc2616.txt)
+ * @param *req HTTP Request header
+ * @return points to request-URI when HTTP method is valid.
+ * (It means that method is one of below.
+ * GET, HEAD, POST, PUT, DELETE, OPTIONS, TRACE, CONNECT,
+ * PROPFIND, PROPPATCH, COPY, MOVE, MKCOL, LOCK, UNLOCK)
+ * NULL when HTTP method is not valid.
+ */
+extern char *
+http_check_request_method(char *req, size_t *length)
+{
+ char *uri = NULL;
+ char *ptr = NULL;
+ char *S = NULL;
+ char *check_len =" HTTP/1." ;
+ size_t len_count;
+ size_t len = *length;
+ int ret;
+
+ /* check NULL */
+ if (req == NULL) {
+ return NULL;
+ }
+
+ /* check length size */
+ if (len < 16)
+ {
+ return NULL;
+ }
+
+ /* request check */
+ switch(req[0])
+ {
+ case 'G':
+ /* GET method */
+ if (req[1] != 'E' || req[2] != 'T' || req[3] != ' ') {
+ return NULL;
+ }
+ uri = req + 4;
+ break;
+
+ case 'H':
+ /* HEAD method */
+ if (req[1] != 'E' || req[2] != 'A' || req[3] != 'D' || req[4] != ' ') {
+ return NULL;
+ }
+ uri = req + 5;
+ break;
+
+ case 'P':
+ switch(req[1])
+ {
+ case 'O':
+ /* POST method */
+ if (req[2] != 'S' || req[3] != 'T' || req[4] != ' ') {
+ return NULL;
+ }
+ uri = req + 5;
+ break;
+
+ case 'U':
+ /* PUT method */
+ if (req[2] != 'T' || req[3] != ' ') {
+ return NULL;
+ }
+ uri = req + 4;
+ break;
+
+ case 'R':
+ if (req[2] != 'O' || req[3] != 'P') {
+ return NULL;
+ }
+ switch(req[4])
+ {
+ case 'F':
+ /* PROPFIND method (WebDAV) */
+ if (req[5] != 'I' || req[6] != 'N' || req[7] != 'D' ||
+ req[8] != ' ') {
+ return NULL;
+ }
+ uri = req + 9;
+ break;
+
+ case 'P':
+ /* PROPPATCH method (WebDAV) */
+ if (req[5] != 'A' || req[6] != 'T' || req[7] != 'C' || req[8] != 'H' ||
+ req[9] != ' ') {
+ return NULL;
+ }
+ uri = req + 10;
+ break;
+
+ default:
+ /* other PROP method */
+ return NULL;
+ }
+ break;
+
+ default:
+ /* other P method */
+ return NULL;
+ }
+ break;
+
+ case 'O':
+ /* OPTIONS method */
+ if (req[1] != 'P' || req[2] != 'T' || req[3] != 'I' || req[4] != 'O' ||
+ req[5] != 'N' || req[6] != 'S' || req[7] != ' ') {
+ return NULL;
+ }
+ uri = req + 8;
+ break;
+
+ case 'C':
+ if (req[1] != 'O') {
+ /* other C method */
+ return NULL;
+ }
+ switch(req[2])
+ {
+ case 'N':
+ /* CONNECT method */
+ if (req[3] != 'N' || req[4] != 'E' || req[5] != 'C' || req[6] != 'T' ||
+ req[7] != ' ') {
+ return NULL;
+ }
+ uri = req + 8;
+ break;
+
+ case 'P':
+ /* COPY method (WebDAV) */
+ if (req[3] != 'Y' || req[4] != ' ') {
+ return NULL;
+ }
+ uri = req + 5;
+ break;
+
+ default:
+ /* other CO method */
+ return NULL;
+ }
+ break;
+
+ case 'T':
+ /* TRACE method */
+ if (req[1] != 'R' || req[2] != 'A' || req[3] != 'C' || req[4] != 'E' ||
+ req[5] != ' ') {
+ return NULL;
+ }
+ uri = req + 6;
+ break;
+
+ case 'D':
+ /* DELETE method */
+ if (req[1] != 'E' || req[2] != 'L' || req[3] != 'E' || req[4] != 'T' ||
+ req[5] != 'E' || req[6] != ' ') {
+ return NULL;
+ }
+ uri = req + 7;
+ break;
+
+ case 'L':
+ /* LOCK method (WebDAV) */
+ if (req[1] != 'O' || req[2] != 'C' || req[3] != 'K' || req[4] != ' ') {
+ return NULL;
+ }
+ uri = req + 5;
+ break;
+
+ case 'U':
+ /* UNLOCK method */
+ if (req[1] != 'N' || req[2] != 'L' || req[3] != 'O' || req[4] != 'C' ||
+ req[5] != 'K' || req[6] != ' ') {
+ return NULL;
+ }
+ uri = req + 7;
+ break;
+
+ case 'M':
+ switch(req[1])
+ {
+ case 'O':
+ /* MOVE method (WebDAV) */
+ if (req[2] != 'V' || req[3] != 'E' || req[4] != ' ') {
+ return NULL;
+ }
+ uri = req + 5;
+ break;
+
+ case 'K':
+ /* MKCOL method (WebDAV) */
+ if (req[2] != 'C' || req[3] != 'O' || req[4] != 'L' || req[5] != ' ') {
+ return NULL;
+ }
+ uri = req + 6;
+ break;
+
+ default:
+ /* other M method */
+ return NULL;
+ }
+ break;
+
+ default:
+ /* other method */
+ return NULL;
+ }
+
+ /*substitute ptr for uri */
+ ptr = uri;
+
+ /* looks for the 2nd blank address */
+ for(len_count = 0; *(ptr+len_count) != '\x0D' && *(ptr+len_count) != '\x0A' ; len_count++)
+ {
+ if( *(ptr+len_count) == ' ' )
+ {
+ S = ptr+len_count;
+ break;
+ }
+
+ /* Up to the length of the request */
+ if(len_count == (len))
+ {
+ return NULL;
+ }
+ }
+
+ /* there is no blank */
+ if(S == NULL)
+ {
+ return NULL;
+ }
+
+ /* string check */
+ ret = strncmp(S, check_len, 8);
+
+ /* string is not equal */
+ if (ret != 0)
+ {
+ return NULL;
+ }
+
+ /* ver is 1.0 or 1.1 */
+ if(S[8] !='0' && S[8]!='1')
+ {
+ return NULL;
+ }
+
+ /* end is changing line. */
+ if(S[9] !='\x0D' || S[10]!='\x0A')
+ {
+ return NULL;
+ }
+
+ *length = len_count;
+
+ return uri;
+}
+
+/*!
+ * Encode IP address and port number.
+ * @param encoded encoded strings
+ * @param s_addr IP address (cf. inet_addr("xxx.xxx.xxx.xxx") => s_addr)
+ * @param sin_port port number
+ * @return void
+ */
+extern void
+http_encode_address(char *encoded, const u_long s_addr, const u_short sin_port)
+{
+ /* check null */
+ if (encoded != NULL) {
+ /* encoded address formed XXXXXXXXXXPPPPP */
+ /* XXXXXXXXXX : IP address(10 bytes, number with left zero pad) */
+ /* PPPPP : port number(5 bytes, number with left zero pad) */
+
+ sprintf(encoded, "%010lu%05u", s_addr, sin_port);
+ }
+}
+
+/*!
+ * Decode encoded strings of IP address and port number.
+ * @param encoded encoded strings
+ * @param s_addr decoded IP address (cf. inet_addr("xxx.xxx.xxx.xxx") => s_addr)
+ * @param sin_port decoded port number
+ * @return void
+ */
+extern void
+http_decode_address(char *encoded, u_long *s_addr, u_short *sin_port)
+{
+ char decode_buf[11];
+
+ if (encoded != NULL && s_addr != NULL && sin_port != NULL) {
+ /* get encoded ip address strings */
+ memcpy(decode_buf, encoded, 10);
+ decode_buf[10] = '\0';
+ *s_addr = strtoul(decode_buf, NULL, 10);
+
+ /* get encoded port number strings */
+ memcpy(decode_buf, encoded + 10, 5);
+ decode_buf[5] = '\0';
+ *sin_port = atoi(decode_buf);
+ }
+}
+
+/*!
+ * Search a HTTP cookie field and check the existence of the cookie name.
+ * @param http_header HTTP request header
+ * @param cookie_name HTTP cookie name
+ * @return char points to cookie value of found cookie name, or NULL.
+ */
+extern char*
+http_search_header_cookie_value(char *http_header, char *cookie_name)
+{
+ return _http_search_header_cookie_value(http_header, "Cookie", cookie_name);
+}
+
+/*!
+ * Search a set HTTP cookie field and check the existence of the cookie name.
+ * @param http_header HTTP request header
+ * @param cookie_name HTTP cookie name
+ * @return char points to cookie value of found cookie name, or NULL.
+ */
+extern char*
+http_search_header_set_cookie_value(char *http_header, char *cookie_name)
+{
+ return _http_search_header_cookie_value(http_header, "Set-Cookie", cookie_name);
+}
+
+char*
+_http_search_header_cookie_value(char *http_header, char *field, char *cookie_name)
+{
+ int check;
+ char *field_ptr;
+
+ /* check NULL */
+ if (http_header == NULL || field == NULL || cookie_name == NULL) {
+ return NULL;
+ }
+
+ /* search cookie header field from HTTP request header */
+ field_ptr = http_search_header_field(http_header, field);
+ if (field_ptr == NULL) {
+ return NULL;
+ }
+
+ while (1) {
+ /* compare cookie field and cookie name */
+ for (check = 0;
+ field_ptr[check] == cookie_name[check] && cookie_name[check] != '\0';
+ ++check);
+
+ /* when header match the cookie name, next word of cookie name must be '=' */
+ /* cf. CookieName'=' and CookieName'V'alue= */
+ if (cookie_name[check] == '\0' && field_ptr[check] == '=') {
+ /* matched cookie name completely! */
+ ++check;
+ /* return pointer of searched cookie name's value */
+ return &field_ptr[check];
+ }
+
+ /* skip until next cookie's value */
+ for ( ;
+ field_ptr[check] != ';' && field_ptr[check] != ',';
+ ++check) {
+ if (field_ptr[check] == '\r' || field_ptr[check] == '\0') {
+ return NULL;
+ }
+ }
+
+ /* skip a space, tab, etc. */
+ for ( ++check;
+ !isgraph(field_ptr[check]) && field_ptr[check] != '\r' && field_ptr[check] != '\0';
+ ++check );
+
+ /* cookie name was not found */
+ if (field_ptr[check] == '\r' || field_ptr[check] == '\0') {
+ return NULL;
+ }
+
+ field_ptr += check;
+ }
+}
+
+/*!
+ * Search a HTTP header field.
+ * @param http_header HTTP request/response header
+ * @param field_name HTTP header field name
+ * @return char points to field value of found header field, or NULL.
+ */
+extern char*
+http_search_header_field(char *http_header, char *field_name)
+{
+ int check;
+ char *word_ptr;
+
+ /* check NULL */
+ if (http_header == NULL || field_name == NULL) {
+ return NULL;
+ }
+
+ /* skip a HTTP method line or HTTP response status line */
+ word_ptr = http_skip_header_line(http_header);
+
+ while (1) {
+ /* word_ptr is always pointing to line top here */
+
+ /* null check */
+ if (word_ptr == NULL) {
+ return NULL;
+ }
+
+ /* "\r\n\r" matched */
+ if (*word_ptr == '\r') {
+ return NULL;
+ }
+
+ /* compare header string and search name header */
+ for (check = 0;
+ toupper(word_ptr[check]) == toupper(field_name[check]) && field_name[check] != '\0';
+ ++check);
+
+ /* when header match the search name, next word of search name must be colon */
+ /* cf. Accept':' and Accept'-'Language: */
+ if (field_name[check] == '\0' && word_ptr[check] == ':') {
+ /* matched search name header completely! */
+ ++check;
+
+ /* skip a space, tab, etc. */
+ for ( ;
+ !isgraph(word_ptr[check]) && word_ptr[check] != '\r' && word_ptr[check] != '\0';
+ ++check );
+
+ /* return pointer of searched name header's value */
+ return &word_ptr[check];
+ }
+
+ /* go next line */
+ word_ptr = http_skip_header_line(word_ptr);
+ }
+}
+
+/*!
+ * Insert any header field to HTTP header
+ * @param[in,out] header HTTP header strings
+ * @param[in] offset_length offset length
+ * @param[in] insert_field insert header field strings
+ * @param[in,out] header_length all of HTTP header length
+ * @retval 0 successfully insert header field
+ * @retval -1 some errors occur.
+ */
+extern int
+http_insert_field(char *header, int offset_length, char *insert_field, int header_length)
+{
+ char *copy_buffer;
+
+ /* check args */
+ if (header == NULL)
+ return -1;
+ if (insert_field == NULL)
+ return -1;
+ if (offset_length < 0)
+ return -1;
+ if (header_length < 0)
+ return -1;
+ if (header_length < offset_length)
+ return -1;
+
+ /* calloc buffer */
+ copy_buffer = (char *) calloc(1, header_length - offset_length);
+ if (copy_buffer == NULL)
+ return -1;
+
+ /* backup strings */
+ memcpy(copy_buffer, header + offset_length, header_length - offset_length);
+
+ /* insert field */
+ memcpy(header + offset_length, insert_field, strlen(insert_field));
+
+ /* append backup strings and terminate null*/
+ memcpy(header + offset_length + strlen(insert_field), copy_buffer, header_length - offset_length);
+ header[offset_length + strlen(insert_field) + header_length - offset_length] = '\0';
+
+ /* free */
+ free(copy_buffer);
+ copy_buffer = NULL;
+
+ return 0;
+}
+
+/*!
+ * Skip current HTTP header line
+ * @param top_ptr
+ * @return char points to next line top. if there are no next, return NULL.
+ */
+extern char*
+http_skip_header_line(char *line)
+{
+ char *top_ptr;
+
+ /* check null */
+ if (line == NULL) {
+ return NULL;
+ }
+
+ top_ptr = (char *) line;
+
+ /* skip until match '\r' or '\n' */
+ for ( ; *top_ptr != '\0' && *top_ptr != '\r'; ++top_ptr) {
+ if (*top_ptr == '\n') {
+ /* "\n" matched */
+ ++top_ptr;
+ return top_ptr;
+ }
+ }
+
+ /* no next line */
+ if (*top_ptr == '\0') {
+ return NULL;
+ }
+
+ /* '\r' matched */
+ /* then next word have to be '\n' */
+ ++top_ptr;
+ if (*top_ptr != '\n') {
+ return NULL;
+ }
+
+ /* "\r\n" matched */
+ ++top_ptr;
+
+ return top_ptr;
+}
--- /dev/null
+/**********************************************************************
+ * module_http.h May 2007
+ *
+ * L7VSD: Linux Virtual Server for Layer7 Load Balancing
+ * Copyright (C) 2005 NTT COMWARE Corporation.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ **********************************************************************/
+#ifndef MODULE_HTTP_H
+#define MODULE_HTTP_H
+
+#define EXPIRE_MAXSIZE (64)
+
+//
+// functions
+//
+
+extern void http_cookie_expire(time_t expire_t, char* expire_c);
+extern int http_check_response_status(char *res);
+extern char* http_check_request_method(char *req, size_t *length);
+extern void http_encode_address(char *encoded, const u_long s_addr, const u_short sin_port);
+extern void http_decode_address(char *encoded, u_long *s_addr, u_short *sin_port);
+extern char* http_search_header_cookie_value(char *http_header, char *cookie_name);
+extern char* http_search_header_set_cookie_value(char *http_header, char *cookie_name);
+extern char* http_search_header_field(char *http_header, char *search_name);
+extern int http_insert_field(char *header, int offset_length, char *insert_field, int header_length);
+extern char* http_skip_header_line(char *top_ptr);
+
+#endif //MODULE_HTTP_H
--- /dev/null
+/*
+ * @file module_sslid_hash.cpp
+ * @brief sslid hashmap container wrapper.
+ * @brief this module provide session persistence by SSL session ID.
+ *
+ * L7VSD: Linux Virtual Server for Layer7 Load Balancing
+ * Copyright (C) 2008 NTT COMWARE Corporation.
+ * Copyright (C) 2009 Shinya TAKEBAYASHI
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ **********************************************************************/
+
+#include <list>
+#include <string>
+#include <tr1/unordered_map>
+#include "l7vs_dest.h"
+#include "module_sslid_hash.h"
+#include "module_sslid_hash_map.h"
+
+static CSSLIDMap idmap;
+
+void hash_setPointer(const void *keymap, const void *keylist, unsigned int size)
+{
+ idmap.setPointer((IDLIST *)keymap, (IDLIST *)keylist, size);
+}
+
+
+void hash_add(const char *key, struct l7vs_dest data)
+{
+ idmap.add(key, data);
+}
+
+
+int hash_search(const char *key, struct l7vs_dest **data)
+{
+ struct l7vs_dest *tmpdata;
+ int retval;
+ bool retval_boolean;
+
+ retval_boolean = idmap.search(key, &tmpdata);
+
+ if (true == retval_boolean) {
+ *data = tmpdata;
+ retval = 0;
+
+ } else {
+ retval = -1;
+
+ }
+
+ return retval;
+}
+
+
+void hash_allocate(unsigned int size)
+{
+ idmap.allocate(size);
+}
+
+
+void hash_destroy(void)
+{
+ idmap.destroy();
+}
+
+
+void *hash_getIDMAP(void)
+{
+ return idmap.getIDMAP();
+}
+
+
+void *hash_getIDLIST(void)
+{
+ return idmap.getIDLIST();
+}
+
+
+int hash_getLISTSIZE(void)
+{
+ idmap.getLISTSIZE();
+}
+
+
+void hash_construct_sessionlist(struct l7vs_sslid_service* sslid_service)
+{
+ idmap.construct_sessionlist(sslid_service);
+}
+
+
+void hash_rebuild_sessionlist(struct l7vs_sslid_service* sslid_service)
+{
+ idmap.rebuild_sessionlist(sslid_service);
+}
--- /dev/null
+/*
+ * @file module_sslid_hash.h
+ * @brief sslid hashmap container wrapper.
+ * @brief this module provide session persistence by SSL session ID.
+ *
+ * L7VSD: Linux Virtual Server for Layer7 Load Balancing
+ * Copyright (C) 2008 NTT COMWARE Corporation.
+ * Copyright (C) 2009 Shinya TAKEBAYASHI
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ **********************************************************************/
+
+#ifndef __MODULE_SSLID_HASH_H_8507CFEA_9D4D_4C6A_9E9C_300AD5340ED8__
+#define __MODULE_SSLID_HASH_H_8507CFEA_9D4D_4C6A_9E9C_300AD5340ED8__
+
+extern "C" void hash_add(const char*, struct l7vs_dest);
+extern "C" int hash_search(const char *, struct l7vs_dest**);
+
+extern "C" void hash_allocate(unsigned int);
+extern "C" void hash_destroy(void);
+
+extern "C" void *hash_getIDMAP(void);
+extern "C" void *hash_getIDLIST(void);
+extern "C" int hash_getLISTSIZE(void);
+extern "C" void hash_setPointer(const void *, const void*, unsigned int);
+
+extern "C" void hash_construct_sessionlist(struct l7vs_sslid_service*);
+extern "C" void hash_rebuild_sessionlist(struct l7vs_sslid_service*);
+
+#endif // __MODULE_SSLID_HASH_H_8507CFEA_9D4D_4C6A_9E9C_300AD5340ED8__
--- /dev/null
+/*
+ * @file module_sslid_hash_map.cpp
+ * @brief sslid hashmap container.
+ * @brief this module provide session persistence by SSL session ID.
+ *
+ * L7VSD: Linux Virtual Server for Layer7 Load Balancing
+ * Copyright (C) 2008 NTT COMWARE Corporation.
+ * Copyright (C) 2009 Shinya TAKEBAYASHI
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ **********************************************************************/
+
+#include <iostream>
+#include <sstream>
+#include <list>
+#include <string>
+#include <tr1/unordered_map>
+#include <string.h>
+#include "l7vs_dest.h"
+#include "protomod_sslid.h"
+#include "module_sslid_hash_map.h"
+
+
+CSSLIDMap::CSSLIDMap()
+{
+ listsize = 0;
+}
+
+
+CSSLIDMap::~CSSLIDMap()
+{
+}
+
+
+void CSSLIDMap::allocate(unsigned int size)
+{
+ m = new IDMAP;
+ l = new IDLIST;
+ listsize = size;
+}
+
+
+void CSSLIDMap::destroy(void)
+{
+ if (m) {
+ delete m;
+ m = NULL;
+ }
+
+ if (l) {
+ delete l;
+ l = NULL;
+ }
+}
+
+
+void CSSLIDMap::add(const std::string key, struct l7vs_dest data)
+{
+ IDMAP::iterator it;
+
+ if (m->size() >= listsize) {
+ m->erase(*(l->begin()));
+ l->pop_front();
+
+ }
+
+ m->insert(IDMAP::value_type(key, data));
+ it = m->find(key);
+ l->push_back(it);
+}
+
+
+bool CSSLIDMap::search(const std::string key, l7vs_dest **data)
+{
+ bool retval;
+
+ IDMAP::const_iterator it = m->find(key);
+
+ if (it == m->end()) {
+ retval = false;
+
+ } else {
+ *data = (struct l7vs_dest*)&it->second;
+ retval = true;
+ }
+
+ return retval;
+}
+
+
+void *CSSLIDMap::getIDMAP(void)
+{
+ return (void *)m;
+}
+
+
+void *CSSLIDMap::getIDLIST(void)
+{
+ return (void *)l;
+}
+
+int CSSLIDMap::getLISTSIZE(void)
+{
+ return listsize;
+}
+
+
+void CSSLIDMap::setPointer(const void *keymap, const void *keylist, unsigned int size)
+{
+ m = static_cast<IDMAP *> (const_cast<void*> (keymap));
+ l = static_cast<IDLIST *> (const_cast<void*> (keylist));
+ listsize = size;
+}
+
+
+void CSSLIDMap::construct_sessionlist(struct l7vs_sslid_service* sslid_service)
+{
+ int pick = 0;
+ IDMAP::const_iterator it;
+
+ for (it = m->begin(); it != m->end(); it++, pick++) {
+ memcpy((sslid_service->session + pick)->id, &(it->first), 32);
+ memcpy(&(sslid_service->session + pick)->dest, &(it->second), sizeof(struct l7vs_dest));
+
+ }
+}
+
+
+void CSSLIDMap::rebuild_sessionlist(struct l7vs_sslid_service* sslid_service)
+{
+ int pick;
+ struct ssl_session tmp_session;
+
+ m->clear();
+ l->clear();
+
+ for (pick = 0; pick < sslid_service->maxlist; pick++) {
+ memset(&tmp_session, 0, sizeof (struct ssl_session));
+ memcpy(&(tmp_session.id), &(sslid_service->session + pick)->id, 32);
+ memcpy(&(tmp_session.dest), &(sslid_service->session + pick)->dest, sizeof(struct l7vs_dest));
+ add(tmp_session.id, tmp_session.dest);
+
+ }
+}
--- /dev/null
+/*
+ * @file module_sslid_hash_map.h
+ * @brief sslid hashmap container.
+ * @brief this module provide session persistence by SSL session ID.
+ *
+ * L7VSD: Linux Virtual Server for Layer7 Load Balancing
+ * Copyright (C) 2008 NTT COMWARE Corporation.
+ * Copyright (C) 2009 Shinya TAKEBAYASHI
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ **********************************************************************/
+
+#ifndef __MODULE_SSLID_HASH_MAP_H_5D6935E5_0C3D_447D_8E13_BEFC7619F621__
+#define __MODULE_SSLID_HASH_MAP_H_5D6935E5_0C3D_447D_8E13_BEFC7619F621__
+
+
+typedef std::tr1::unordered_map<std::string, struct l7vs_dest> IDMAP;
+typedef std::list<IDMAP::iterator> IDLIST;
+
+
+class CSSLIDMap
+{
+ public:
+ CSSLIDMap();
+ ~CSSLIDMap();
+
+ void add(const std::string, struct l7vs_dest);
+ bool search(const std::string, struct l7vs_dest**);
+
+ void allocate(unsigned int);
+ void destroy(void);
+
+ void *getIDMAP(void);
+ void *getIDLIST(void);
+ int getLISTSIZE(void);
+ void setPointer(const void *, const void *, unsigned int);
+ void construct_sessionlist(struct l7vs_sslid_service*);
+ void rebuild_sessionlist(struct l7vs_sslid_service*);
+
+ private:
+ IDMAP *m;
+ IDLIST *l;
+ unsigned int listsize;
+};
+
+
+#endif // __MODULE_SSLID_HASH_MAP_H_5D6935E5_0C3D_447D_8E13_BEFC7619F621__
--- /dev/null
+/*
+ * @file protomod_ip.c
+ * @brief protocol module of any protocol.
+ * @brief this module never keep session persistence.
+ *
+ * L7VSD: Linux Virtual Server for Layer7 Load Balancing
+ * Copyright (C) 2008 NTT COMWARE Corporation.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ **********************************************************************/
+
+#define __STDC_LIMIT_MACROS
+#include <stdlib.h>
+#include <time.h>
+#include <getopt.h>
+#include "l7vs_service.h"
+#include "l7vs_conn.h"
+#include "l7vs_dest.h"
+#include "l7vs_module.h"
+#include "module_http.h"
+
+#define SERVICE_ARG_MAXSIZE (512)
+#define IP_SERVICE_NUMBER (128)
+#define X_FORWARDED_FOR_LENGTH (48)
+
+#define HASH_TABLE_BITS 8
+#define HASH_TABLE_SIZE (1 << HASH_TABLE_BITS)
+/* 2^31 + 2^29 - 2^25 + 2^22 - 2^19 - 2^16 + 1 */
+#define GOLDEN_RATIO_PRIME 0x9e370001UL
+
+struct l7vs_ip_service {
+ handle_t service_handle;
+ struct sockaddr_in dest[HASH_TABLE_SIZE];
+ int forwarded_for;
+ int reschedule;
+};
+
+struct l7vs_ip_service_arg {
+ int forwarded_for;
+ int reschedule;
+};
+
+static void fini(void);
+static int create(void*, handle_t);
+static void* create_sa(struct l7vs_service_arg*);
+static int compare(handle_t, handle_t);
+static int match_cldata(struct l7vs_service*, struct l7vs_conn*,
+ char*, size_t*, struct l7vs_dest**, int*);
+static int analyze_rsdata(struct l7vs_service*, struct l7vs_conn*,
+ char*, size_t*);
+static int destroy(handle_t);
+static void destroy_sa(void**);
+static int service_arg(struct l7vs_service_arg_multi*, handle_t);
+static int parse(void*, int, char**);
+
+static struct l7vs_ip_service *l7vs_protomod_ip_search_service(handle_t);
+static struct l7vs_ip_service *l7vs_protomod_ip_create_service();
+static struct l7vs_ip_service *l7vs_protomod_ip_create_temp_service();
+
+static void l7vs_ip_service_c_str(char*, struct l7vs_ip_service*);
+static void l7vs_ip_service_arg_c_str(char*, struct l7vs_ip_service_arg*);
+unsigned int l7vs_ip_service_calc_hash(struct l7vs_conn*);
+
+struct l7vs_ip_service *ip_service_list[IP_SERVICE_NUMBER];
+
+static struct l7vs_protomod ip_protomod = {
+ NULL, /* handle */
+ "ip", /* modname */
+ 0, /* refcnt */
+ 1, /* fast schedule */
+ create, /* create function */
+ compare, /* compare function */
+ match_cldata, /* match_cldata function */
+ analyze_rsdata, /* analyze_rsdata function */
+ destroy, /* destroy function */
+ fini, /* fini function */
+ create_sa, /* create_sa function */
+ service_arg, /* service_arg function */
+ parse, /* parse function */
+ destroy_sa, /* destroy_sa function */
+ NULL, /* initialize function */
+ NULL, /* finalize function */
+ NULL, /* get_log_level function */
+ NULL, /* put_log_debug function */
+ NULL, /* put_log_info function */
+ NULL, /* put_log_warn function */
+ NULL, /* put_log_error function */
+ NULL /* put_log_fatal function */
+};
+
+/*!
+ * Protocol module initialize function. This function run when dlopen and dlsym at first time.
+ * @param[in] handle dlopen's handle
+ * @return l7vs_protomod struct
+ */
+extern "C" struct l7vs_protomod *
+init(void *handle)
+{
+ struct l7vs_protomod* return_value = NULL;
+
+ /*-------- DEBUG LOG --------*/
+ if (ip_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == ip_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ PUT_LOG_DEBUG(ip_protomod, LOG_CAT_L7VSD_PROTOCOL,249,
+ "in_function: struct l7vs_protomod* init(void* handle): handle=%p", handle);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ /* check null */
+ if (handle == NULL) {
+ PUT_LOG_ERROR(ip_protomod, LOG_CAT_L7VSD_PROTOCOL,217, "Arg(handle) is NULL pointer.");
+ goto init_out;
+ }
+
+ /* initialize ip service list */
+ memset(ip_service_list, 0, sizeof(struct l7vs_ip_service *) * IP_SERVICE_NUMBER);
+ /* set dlopen's handle */
+ ip_protomod.handle = handle;
+
+ return_value = &ip_protomod;
+
+init_out:
+ /*-------- DEBUG LOG --------*/
+ if (ip_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == ip_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ char protomod_str[DEBUG_STR_LEN] = {0};
+ l7vs_protomod_c_str(protomod_str, &ip_protomod);
+ PUT_LOG_DEBUG(ip_protomod, LOG_CAT_L7VSD_PROTOCOL,250,
+ "out_function: struct l7vs_protomod* init(void* handle): return=&(%s)", protomod_str);
+ }
+ /*------ DEBUG LOG END ------*/
+ return return_value;
+}
+
+/*!
+ * Protocol module finalize function. free all ip service list just in case.
+ * @param void
+ * @return void
+ */
+static void
+fini(void)
+{
+ /* ip service list counter */
+ int service_number = 0;
+
+ /*-------- DEBUG LOG --------*/
+ if (ip_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == ip_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ PUT_LOG_DEBUG(ip_protomod, LOG_CAT_L7VSD_PROTOCOL,251, "in_function: void fini(void)");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ /* check all ip service list */
+ for (service_number = 0; service_number < IP_SERVICE_NUMBER; ++service_number) {
+ /* if pointer that does not point NULL exists ... */
+ if (ip_service_list[service_number] != NULL) {
+ /*-------- DEBUG LOG --------*/
+ if (ip_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == ip_protomod.get_log_level(LOG_CAT_L7VSD_SYSTEM_MEMORY)) {
+ PUT_LOG_DEBUG(ip_protomod, LOG_CAT_L7VSD_SYSTEM_MEMORY,58, "free: %p",
+ ip_service_list[service_number]);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ /* free and points NULL */
+ free(ip_service_list[service_number]);
+ ip_service_list[service_number] = NULL;
+ }
+ }
+
+ /*-------- DEBUG LOG --------*/
+ if (ip_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == ip_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ PUT_LOG_DEBUG(ip_protomod, LOG_CAT_L7VSD_PROTOCOL,252, "out_function: void fini(void)");
+ }
+ /*------ DEBUG LOG END ------*/
+}
+
+/*!
+ * Create ip service struct.
+ * @param[in] ip_arg ip service argument struct
+ * @param[in] service_handle a unique service ID
+ * @retval 0 successfully create ip service.
+ * @retval -1 some errors occur.
+ */
+static int
+create(void *ip_arg, handle_t service_handle)
+{
+ struct l7vs_ip_service *ip_service;
+ struct l7vs_ip_service_arg *ip_service_arg;
+ int return_value = 0;
+
+ /*-------- DEBUG LOG --------*/
+ if (ip_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == ip_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ char ip_arg_str[DEBUG_STR_LEN] = {0};
+ l7vs_ip_service_arg_c_str(ip_arg_str, (struct l7vs_ip_service_arg*) ip_arg);
+ PUT_LOG_DEBUG(ip_protomod, LOG_CAT_L7VSD_PROTOCOL,253,
+ "in_function: int create(void* ip_arg, handle_t service_handle):ip_arg=&(%s), "
+ "service_handle=%d", ip_arg_str, service_handle);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ /* check null */
+ if (ip_arg == NULL) {
+ PUT_LOG_ERROR(ip_protomod, LOG_CAT_L7VSD_PROTOCOL,218, "Arg(ip_arg) is NULL pointer.");
+ return_value = -1;
+ goto create_out;
+ }
+
+
+ if (service_handle != TEMP_SERVICEHANDLE) {
+ /* search empty ip service list and create ip service */
+ ip_service = l7vs_protomod_ip_create_service();
+ } else {
+ /* create temporary ip service */
+ ip_service = l7vs_protomod_ip_create_temp_service();
+ }
+
+ /*-------- DEBUG LOG --------*/
+ if (ip_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == ip_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ char ip_str[DEBUG_STR_LEN] = {0};
+ l7vs_ip_service_c_str(ip_str, ip_service);
+ PUT_LOG_DEBUG(ip_protomod, LOG_CAT_L7VSD_PROTOCOL,254, "pointer assign: ip_service=&(%s)",
+ ip_str);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ if (ip_service == NULL) {
+ PUT_LOG_ERROR(ip_protomod, LOG_CAT_L7VSD_PROTOCOL,219, "Could not make ip service.");
+ return_value = -1;
+ goto create_out;
+ }
+
+ ip_service_arg = (struct l7vs_ip_service_arg *) ip_arg;
+
+ /* set service handle */
+ ip_service->service_handle = service_handle;
+ /* set x-forwarded-for flag */
+ ip_service->forwarded_for = ip_service_arg->forwarded_for;
+ /* set reschedule */
+ ip_service->reschedule = ip_service_arg->reschedule;
+
+create_out:
+ /*-------- DEBUG LOG --------*/
+ if (ip_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == ip_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ PUT_LOG_DEBUG(ip_protomod, LOG_CAT_L7VSD_PROTOCOL,255,
+ "out_function: int create(void* ip_arg, handle_t service_handle):return_value=%d",
+ return_value);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return return_value;
+}
+
+/*!
+ * Create ip service argument struct.
+ * @param[out] srv_arg service argument struct
+ * @return ip service argument struct
+ */
+static void *
+create_sa(struct l7vs_service_arg *srv_arg)
+{
+ struct l7vs_ip_service_arg *ip_service_arg;
+
+ /*-------- DEBUG LOG --------*/
+ if (ip_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == ip_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ char service_arg_str[DEBUG_STR_LEN] = {0};
+ l7vs_service_arg_c_str(service_arg_str, srv_arg);
+ PUT_LOG_DEBUG(ip_protomod, LOG_CAT_L7VSD_PROTOCOL,256,
+ "in_function: void* create_sa(struct l7vs_service_arg* srv_arg):srv_arg=&(%s)",
+ service_arg_str);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ /* check null */
+ if (srv_arg == NULL) {
+ PUT_LOG_ERROR(ip_protomod, LOG_CAT_L7VSD_PROTOCOL,220, "Arg(srv_arg) is NULL pointer.");
+ ip_service_arg = NULL;
+ goto create_sa_out;
+ }
+
+ /* create ip service argument struct */
+ ip_service_arg = (struct l7vs_ip_service_arg *) calloc(1, sizeof(struct l7vs_ip_service_arg));
+
+ /*-------- DEBUG LOG --------*/
+ if (ip_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == ip_protomod.get_log_level(LOG_CAT_L7VSD_SYSTEM_MEMORY)) {
+ PUT_LOG_DEBUG(ip_protomod, LOG_CAT_L7VSD_SYSTEM_MEMORY,59, "calloc: addr=%p, size=%ld",
+ ip_service_arg, (unsigned long int) sizeof(struct l7vs_ip_service_arg));
+ }
+ /*------ DEBUG LOG END ------*/
+
+ if (ip_service_arg == NULL) {
+ PUT_LOG_ERROR(ip_protomod, LOG_CAT_L7VSD_SYSTEM_MEMORY,53, "Could not allocate memory.");
+ goto create_sa_out;
+ }
+
+ /* set ip service argument size and protomod name "ip" */
+ srv_arg->len = sizeof(struct l7vs_ip_service_arg);
+ strcpy(srv_arg->protomod, ip_protomod.modname);
+
+create_sa_out:
+ /*-------- DEBUG LOG --------*/
+ if (ip_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == ip_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ char ip_service_arg_str[DEBUG_STR_LEN] = {0};
+ l7vs_ip_service_arg_c_str(ip_service_arg_str, ip_service_arg);
+ PUT_LOG_DEBUG(ip_protomod, LOG_CAT_L7VSD_PROTOCOL,257,
+ "out_function: void* create_sa(struct l7vs_service_arg* srv_arg):return_value=&(%s)",
+ ip_service_arg_str);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return (void *) ip_service_arg;
+}
+
+/*!
+ * Compare two service.
+ * @param[in] srv_handle1 one of a unique service ID
+ * @param[in] srv_handle2 one of a unique service ID
+ * @retval 0 they matched perfectly.
+ * @retval -1 they are different.
+ */
+static int
+compare(handle_t srv_handle1, handle_t srv_handle2)
+{
+ int return_value = 0;
+
+ /*-------- DEBUG LOG --------*/
+ if (ip_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == ip_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ PUT_LOG_DEBUG(ip_protomod, LOG_CAT_L7VSD_PROTOCOL,258,
+ "in_function: int compare(handle_t srv_handle1, handle_t srv_handle2):"
+ "srv_handle1=%u, srv_handle2=%u", srv_handle1, srv_handle2);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ /*-------- DEBUG LOG --------*/
+ if (ip_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == ip_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ PUT_LOG_DEBUG(ip_protomod, LOG_CAT_L7VSD_PROTOCOL,259,
+ "out_function: int compare(handle_t srv_handle1, handle_t srv_handle2):return_value=%d",
+ return_value);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return return_value;
+}
+
+/*!
+ * Do not check the request packet.
+ * @param[in] srv service struct include service handle, protocol module and schedule module.
+ * @param[in] conn connection data.
+ * @param[in] request packet data from client
+ * @param[in] len length of packet data
+ * @param[out] dest destination (real server) list
+ * @param[out] tcps TCP Splicer flag
+ * @retval 0 successfully check packet data
+ * @retval -1 some errors occur.
+ */
+static int
+match_cldata(struct l7vs_service *srv, struct l7vs_conn *conn,
+ char *request, size_t *len, struct l7vs_dest **dest, int *tcps)
+{
+ struct l7vs_ip_service *ip_service;
+ struct l7vs_dest destination;
+ int ret;
+ int offset_length;
+ char *x_forwarded_value;
+ char *next_line = NULL;
+ char x_forwarded_for_header[X_FORWARDED_FOR_LENGTH];
+ size_t uri_len = 0;
+ int return_value = 0;
+ unsigned int hash;
+
+ /*-------- DEBUG LOG --------*/
+ if (ip_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == ip_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ char srv_str[DEBUG_STR_LEN] = {0};
+ char conn_str[DEBUG_STR_LEN] = {0};
+ char dest_str[DEBUG_STR_LEN] = {0};
+ char len_str[DEBUG_STR_LEN] = {0};
+ l7vs_service_c_str(srv_str, srv);
+ l7vs_conn_c_str(conn_str, conn);
+ if (dest != NULL) {
+ l7vs_dest_c_str(dest_str, *dest);
+ }
+ else {
+ strncpy(dest_str, "NULL", DEBUG_STR_LEN);
+ }
+ if (len != NULL) {
+ snprintf(len_str, DEBUG_STR_LEN, "%lu", (unsigned long int) *len);
+ }
+ else {
+ strncpy(len_str, "NULL", DEBUG_STR_LEN);
+ }
+ PUT_LOG_DEBUG(ip_protomod, LOG_CAT_L7VSD_PROTOCOL,260,
+ "in_function: int match_cldata(struct l7vs_service* srv, struct l7vs_conn* conn, "
+ "char* request, size_t* len, struct l7vs_dest** dest, int* tcps):srv=&(%s), conn=&(%s), "
+ "request=\"%s\", len=&(%s), dest=&(&(%s)), tcps=&(%d)",
+ srv_str, conn_str, request, len_str, dest_str, *tcps);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ /* check null */
+ if (srv == NULL) {
+ PUT_LOG_ERROR(ip_protomod, LOG_CAT_L7VSD_PROTOCOL,221, "Arg(srv) is NULL pointer.");
+ return_value = -1;
+ goto match_cldata_out;
+ }
+ if (srv->pm == NULL) {
+ PUT_LOG_ERROR(ip_protomod, LOG_CAT_L7VSD_PROTOCOL,222, "Arg(srv->pm) is NULL pointer.");
+ return_value = -1;
+ goto match_cldata_out;
+ }
+ if (request == NULL) {
+ PUT_LOG_ERROR(ip_protomod, LOG_CAT_L7VSD_PROTOCOL,223, "Arg(request) is NULL pointer.");
+ return_value = -1;
+ goto match_cldata_out;
+ }
+ if (len == NULL) {
+ PUT_LOG_ERROR(ip_protomod, LOG_CAT_L7VSD_PROTOCOL,224, "Arg(len) is NULL pointer.");
+ return_value = -1;
+ goto match_cldata_out;
+ }
+ if (dest == NULL) {
+ PUT_LOG_ERROR(ip_protomod, LOG_CAT_L7VSD_PROTOCOL,225, "Arg(dest) is NULL pointer.");
+ return_value = -1;
+ goto match_cldata_out;
+ }
+ if (tcps == NULL) {
+ PUT_LOG_ERROR(ip_protomod, LOG_CAT_L7VSD_PROTOCOL,226, "Arg(tcps) is NULL pointer.");
+ return_value = -1;
+ goto match_cldata_out;
+ }
+
+ /* search service that has such a service ID */
+ ip_service = l7vs_protomod_ip_search_service(srv->handle);
+
+ /*-------- DEBUG LOG --------*/
+ if (ip_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == ip_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ char ip_str[DEBUG_STR_LEN] = {0};
+ l7vs_ip_service_c_str(ip_str, ip_service);
+ PUT_LOG_DEBUG(ip_protomod, LOG_CAT_L7VSD_PROTOCOL,261, "pointer assign: ip_service=&(%s)",
+ ip_str);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ if (ip_service == NULL) {
+ PUT_LOG_ERROR(ip_protomod, LOG_CAT_L7VSD_PROTOCOL,227, "Could not find such service handle's ip service.");
+ return_value = -1;
+ goto match_cldata_out;
+ }
+
+ /* initialize protocol module ... clear destination list */
+ ret = srv->pm->initialize(srv, conn, request, *len, dest);
+ if (ret != 0){
+ PUT_LOG_ERROR(ip_protomod, LOG_CAT_L7VSD_PROTOCOL,228, "Could not initialize protomod.");
+ return_value = -1;
+ goto match_cldata_out;
+ }
+
+ hash = l7vs_ip_service_calc_hash(conn);
+ if (ip_service->dest[hash].sin_addr.s_addr &&
+ ip_service->dest[hash].sin_port) {
+ destination.addr.sin_addr.s_addr = ip_service->dest[hash].sin_addr.s_addr;
+ destination.addr.sin_port = ip_service->dest[hash].sin_port;
+ *dest = &destination;
+ }
+
+ /* set X-Forwarded-For field */
+ if (ip_service->forwarded_for) {
+ uri_len = *len;
+ /* check request */
+ if (http_check_request_method(request, &uri_len) == NULL)
+ goto match_cldata_finalize;
+
+ x_forwarded_value = http_search_header_field(request, "X-Forwarded-For");
+
+ /* already exists X-Forwarded-For field */
+ if (x_forwarded_value) {
+ next_line = http_skip_header_line(x_forwarded_value);
+ /* backtrack to look up insert point */
+ if (next_line) {
+ next_line--; // *next_line == '\n'
+ if (*(next_line - 1) == '\r') {
+ next_line--;
+ }
+ /* append client IP address */
+ snprintf(x_forwarded_for_header, X_FORWARDED_FOR_LENGTH, ", %s", inet_ntoa(conn->caddr.sin_addr));
+ }
+ }
+
+ /* not exists X-Forwarded-For field */
+ if (!next_line) {
+ /* construct new X-Forwarded-For header item */
+ snprintf(x_forwarded_for_header, X_FORWARDED_FOR_LENGTH, "X-Forwarded-For: %s\r\n", inet_ntoa(conn->caddr.sin_addr));
+
+ next_line = http_skip_header_line(request);
+ }
+
+ /* when insert point exist */
+ if (next_line != NULL) {
+ offset_length = (int) (next_line - request);
+
+ /* insert X-Forwarded-For header field */
+ http_insert_field(request, offset_length, x_forwarded_for_header, *len);
+
+ /* add header length */
+ *len += strlen(x_forwarded_for_header);
+ }
+ }
+
+match_cldata_finalize:
+ *tcps = 0;
+
+ /* finalize */
+ ret = srv->pm->finalize(srv, conn, request, *len, dest, ip_service->reschedule);
+
+ if (ret != 0){
+ PUT_LOG_INFO(ip_protomod, LOG_CAT_L7VSD_PROTOCOL,17, "Could not finalize protomod. (Realserver decision failure)");
+ return_value = -1;
+ goto match_cldata_out;
+ }
+
+match_cldata_out:
+ /*-------- DEBUG LOG --------*/
+ if (ip_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == ip_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ PUT_LOG_DEBUG(ip_protomod, LOG_CAT_L7VSD_PROTOCOL,262,
+ "out_function: int match_cldata(struct l7vs_service* srv, struct l7vs_conn* conn, "
+ "char* request, size_t* len, struct l7vs_dest** dest, int* tcps):return_value=%d",
+ return_value);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return return_value;
+}
+
+/*!
+ * Do nothing.
+ * @param[in] srv service struct include service handle, protocol module and schedule module.
+ * @param[in] conn connection data.
+ * @param[in] response packet data from real server
+ * @param[in] len length of packet data. it will be lengthened.
+ * @retval 0 successfully check packet data.
+ * @retval -1 some errors occur.
+ */
+static int
+analyze_rsdata(struct l7vs_service *srv, struct l7vs_conn *conn,
+ char *response, size_t *len)
+{
+ struct l7vs_ip_service *ip_service;
+ unsigned int hash;
+ int return_value = 0;
+
+ /*-------- DEBUG LOG --------*/
+ if (ip_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == ip_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ char srv_str[DEBUG_STR_LEN] = {0};
+ char conn_str[DEBUG_STR_LEN] = {0};
+ char len_str[DEBUG_STR_LEN] = {0};
+ l7vs_service_c_str(srv_str, srv);
+ l7vs_conn_c_str(conn_str, conn);
+ if (len != NULL) {
+ snprintf(len_str, DEBUG_STR_LEN, "%lu", (unsigned long int) *len);
+ }
+ else {
+ strncpy(len_str, "NULL", DEBUG_STR_LEN);
+ }
+ PUT_LOG_DEBUG(ip_protomod, LOG_CAT_L7VSD_PROTOCOL,263,
+ "in_function: int analyze_rsdata(struct l7vs_service* srv, struct l7vs_conn* conn, "
+ "char* response, size_t* len):srv=&(%s), conn=&(%s), response=\"%s\", len=&(%s)",
+ srv_str, conn_str, response, len_str);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ /* check null */
+ if (srv == NULL) {
+ PUT_LOG_ERROR(ip_protomod, LOG_CAT_L7VSD_PROTOCOL,229, "Arg(srv) is NULL pointer.");
+ return_value = -1;
+ goto analyze_rsdata_out;
+ }
+ if (conn == NULL) {
+ PUT_LOG_ERROR(ip_protomod, LOG_CAT_L7VSD_PROTOCOL,230, "Arg(conn) is NULL pointer.");
+ return_value = -1;
+ goto analyze_rsdata_out;
+ }
+ if (conn->dest == NULL) {
+ PUT_LOG_ERROR(ip_protomod, LOG_CAT_L7VSD_PROTOCOL,231, "Arg(conn->dest) is NULL pointer.");
+ return_value = -1;
+ goto analyze_rsdata_out;
+ }
+ if (response == NULL) {
+ PUT_LOG_ERROR(ip_protomod, LOG_CAT_L7VSD_PROTOCOL,232, "Arg(response) is NULL pointer.");
+ return_value = -1;
+ goto analyze_rsdata_out;
+ }
+ if (len == NULL) {
+ PUT_LOG_ERROR(ip_protomod, LOG_CAT_L7VSD_PROTOCOL,233, "Arg(len) is NULL pointer.");
+ return_value = -1;
+ goto analyze_rsdata_out;
+ }
+
+ /* sorry flag check */
+ if (conn->sorry_conn_flag == 1) {
+ /*-------- DEBUG LOG --------*/
+ if (ip_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == ip_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ PUT_LOG_DEBUG(ip_protomod, LOG_CAT_L7VSD_PROTOCOL,264, "Response from sorry server.");
+ }
+ /*------ DEBUG LOG END ------*/
+ goto analyze_rsdata_out;
+ }
+
+ /* search service that has such a service ID */
+ ip_service = l7vs_protomod_ip_search_service(srv->handle);
+
+ /*-------- DEBUG LOG --------*/
+ if (ip_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == ip_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ char ip_str[DEBUG_STR_LEN];
+ l7vs_ip_service_c_str(ip_str, ip_service);
+ PUT_LOG_DEBUG(ip_protomod, LOG_CAT_L7VSD_PROTOCOL,265, "pointer assign: ip_service=&(%s)",
+ ip_str);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ if (ip_service == NULL) {
+ PUT_LOG_ERROR(ip_protomod, LOG_CAT_L7VSD_PROTOCOL,234,
+ "Could not find such service handle's ip service.");
+ return_value = -1;
+ goto analyze_rsdata_out;
+ }
+
+ hash = l7vs_ip_service_calc_hash(conn);
+ memcpy(&ip_service->dest[hash], &conn->dest->addr, sizeof(struct sockaddr_in));
+
+analyze_rsdata_out:
+ /*-------- DEBUG LOG --------*/
+ if (ip_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == ip_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ PUT_LOG_DEBUG(ip_protomod, LOG_CAT_L7VSD_PROTOCOL,266,
+ "out_function: int analyze_rsdata(struct l7vs_service* srv, struct l7vs_conn* conn, "
+ "char* response, size_t* len):return_value=%d", return_value);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return return_value;
+}
+
+/*!
+ * Destroy ip service
+ * @param[in] srv_handle a unique service ID
+ * @retval 0 successfully check packet data.
+ * @retval -1 some errors occur.
+ */
+static int
+destroy(handle_t srv_handle)
+{
+ /* ip service list counter */
+ int service_number = 0;
+ int free_flag = 0;
+ int return_value = 0;
+
+ /*-------- DEBUG LOG --------*/
+ if (ip_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == ip_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ PUT_LOG_DEBUG(ip_protomod, LOG_CAT_L7VSD_PROTOCOL,267,
+ "in_function: int destroy(handle_t srv_handle):srv_handle=%u",
+ srv_handle);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ /* check all ip service list */
+ for (service_number = 0; service_number < IP_SERVICE_NUMBER; ++service_number) {
+ /* found ip service that has srv_handle */
+ if (ip_service_list[service_number] != NULL &&
+ ip_service_list[service_number]->service_handle == srv_handle) {
+
+ /* free and NULL */
+ free(ip_service_list[service_number]);
+ ip_service_list[service_number] = NULL;
+
+ free_flag = 1;
+ break;
+ }
+ }
+
+ /* ip service was not found */
+ if (free_flag == 0) {
+ PUT_LOG_ERROR(ip_protomod, LOG_CAT_L7VSD_PROTOCOL,235, "Could not find such service handle's ip service.");
+ return_value = -1;
+ goto destroy_out;
+ }
+
+destroy_out:
+ /*-------- DEBUG LOG --------*/
+ if (ip_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == ip_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ PUT_LOG_DEBUG(ip_protomod, LOG_CAT_L7VSD_PROTOCOL,268,
+ "out_function: int destroy(handle_t srv_handle):return_value=%d",
+ srv_handle);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return return_value;
+}
+
+/*!
+ * Destroy ip service argument
+ * @param[in] ip_arg ip service argument
+ * @return void
+ */
+static void
+destroy_sa(void **ip_arg)
+{
+ /*-------- DEBUG LOG --------*/
+ if (ip_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == ip_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ char ip_arg_str[DEBUG_STR_LEN] = {0};
+ if (ip_arg != NULL) {
+ l7vs_ip_service_arg_c_str(ip_arg_str, (struct l7vs_ip_service_arg*) *ip_arg);
+ }
+ else {
+ strncpy(ip_arg_str, "NULL", DEBUG_STR_LEN);
+ }
+ PUT_LOG_DEBUG(ip_protomod, LOG_CAT_L7VSD_PROTOCOL,269,
+ "in_function: void destroy_sa(void** ip_arg):ip_arg=&(&(%s))",
+ ip_arg_str);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ /* check null */
+ if (ip_arg == NULL) {
+ PUT_LOG_ERROR(ip_protomod, LOG_CAT_L7VSD_PROTOCOL,236, "Arg(ip_arg) is NULL pointer.");
+ }
+ else if (*ip_arg == NULL) {
+ PUT_LOG_ERROR(ip_protomod, LOG_CAT_L7VSD_PROTOCOL,237, "Arg(*ip_arg) is NULL pointer.");
+ }
+ else {
+ /*-------- DEBUG LOG --------*/
+ if (ip_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == ip_protomod.get_log_level(LOG_CAT_L7VSD_SYSTEM_MEMORY)) {
+ PUT_LOG_DEBUG(ip_protomod, LOG_CAT_L7VSD_SYSTEM_MEMORY,60, "free: %p",
+ *ip_arg);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ /* free and NULL */
+ free((struct l7vs_ip_service_arg*) *ip_arg);
+ *ip_arg = NULL;
+ }
+
+ /*-------- DEBUG LOG --------*/
+ if (ip_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == ip_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ PUT_LOG_DEBUG(ip_protomod, LOG_CAT_L7VSD_PROTOCOL,270,
+ "out_function: void destroy_sa(void** ip_arg)");
+ }
+ /*------ DEBUG LOG END ------*/
+}
+
+/*!
+ * Create strings for service list of l7vsadm
+ * @param[out] srv_arg service argument struct
+ * @param[in] srv_handle a unique service ID
+ * @retval 0 successfully create strings
+ * @retval -1 some errors occur.
+ */
+static int
+service_arg(struct l7vs_service_arg_multi *srv_arg_mt, handle_t srv_handle)
+{
+ struct l7vs_ip_service *ip_service;
+ struct l7vs_ip_service_arg c_sarg;
+ char ip_argument[SERVICE_ARG_MAXSIZE];
+ int return_value = 0;
+
+ /*-------- DEBUG LOG --------*/
+ if (ip_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == ip_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ char srv_arg_mt_str[DEBUG_STR_LEN] = {0};
+ l7vs_service_arg_multi_c_str(srv_arg_mt_str, srv_arg_mt);
+ PUT_LOG_DEBUG(ip_protomod, LOG_CAT_L7VSD_PROTOCOL,271,
+ "in_function: int service_arg(struct l7vs_service_arg_multi* srv_arg_mt, "
+ "handle_t srv_handle):srv_arg_mt=&(%s), srv_handle=%u",
+ srv_arg_mt_str, srv_handle);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ /* check null */
+ if (srv_arg_mt == NULL) {
+ PUT_LOG_ERROR(ip_protomod, LOG_CAT_L7VSD_PROTOCOL,238, "Arg(srv_arg_mt) is NULL pointer.");
+ return_value = -1;
+ goto service_arg_out;
+ }
+
+ /* search service that has such a service ID */
+ ip_service = l7vs_protomod_ip_search_service(srv_handle);
+
+ /*-------- DEBUG LOG --------*/
+ if (ip_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == ip_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ char ip_str[DEBUG_STR_LEN] = {0};
+ l7vs_ip_service_c_str(ip_str, ip_service);
+ PUT_LOG_DEBUG(ip_protomod, LOG_CAT_L7VSD_PROTOCOL,272, "pointer assign: ip_service=&(%s)",
+ ip_str);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ if (ip_service == NULL) {
+ PUT_LOG_ERROR(ip_protomod, LOG_CAT_L7VSD_PROTOCOL,239, "Could not find such service handle's ip service.");
+ return_value = -1;
+ goto service_arg_out;
+ }
+
+ /* initialize argument strings */
+ memset(ip_argument, 0, SERVICE_ARG_MAXSIZE);
+
+ /* set ip args to service argument struct */
+ srv_arg_mt->srv_arg.reschedule = ip_service->reschedule;
+
+ /* create long argument (l7vsadm option -L/-l) */
+ strncpy(srv_arg_mt->srv_arg.protomod_key_string, "", 256);
+
+ /* create verbose argument (l7vsadm option -V/-v) */
+ strncpy(srv_arg_mt->srv_arg.protomod_opt_string, "", 512);
+ if (ip_service->forwarded_for) {
+ strncpy(srv_arg_mt->srv_arg.protomod_opt_string, "--forwarded-for", 512);
+ }
+
+ c_sarg.reschedule = ip_service->reschedule;
+
+ memcpy(srv_arg_mt->protomod_arg, &c_sarg, sizeof(struct l7vs_ip_service_arg));
+
+ /*-------- DEBUG LOG --------*/
+ if (ip_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == ip_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ char ip_arg_str[DEBUG_STR_LEN] = {0};
+ l7vs_ip_service_arg_c_str(ip_arg_str, &c_sarg);
+ PUT_LOG_DEBUG(ip_protomod, LOG_CAT_L7VSD_PROTOCOL,273,
+ "pointer assign: srv_arg_mt->protomod_arg=&(%s)", ip_arg_str);
+ }
+ /*------ DEBUG LOG END ------*/
+
+service_arg_out:
+ /*-------- DEBUG LOG --------*/
+ if (ip_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == ip_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ PUT_LOG_DEBUG(ip_protomod, LOG_CAT_L7VSD_PROTOCOL,274,
+ "out_function: int service_arg(struct l7vs_service_arg_multi* srv_arg_mt, "
+ "handle_t srv_handle):return_value=%d", return_value);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return return_value;
+}
+
+/*!
+ * Parse l7vsadm options to ip argument
+ * @param[out] ip_arg ip service argument struct
+ * @param[in] argc number of l7vsadm argument
+ * @param[in] argv l7vsadm argument list
+ * @retval 0 successfully parse argument
+ * @retval -1 some errors occur.
+ */
+static int
+parse(void *ip_arg, int argc, char *argv[])
+{
+ struct l7vs_ip_service_arg *ip_service_arg;
+ static struct option opt[] = {
+ {"forwarded-for", no_argument, NULL, 'F'},
+ {"reschedule", no_argument, NULL, 'R'},
+ {"no-reschedule", no_argument, NULL, 'N'},
+ {NULL, 0, NULL, 0 }
+ };
+ int c;
+ int return_value = 0;
+ int forwarded_for_flag = 0;
+ int reschedule_flag = 0;
+
+ /*-------- DEBUG LOG --------*/
+ if (ip_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == ip_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ int i;
+ char argv_str[DEBUG_STR_LEN] = {0};
+ char ip_arg_str[DEBUG_STR_LEN] = {0};
+ l7vs_ip_service_arg_c_str(ip_arg_str, (struct l7vs_ip_service_arg*) ip_arg);
+ argv_str[0] = '\0';
+ if (argv == NULL)
+ snprintf(argv_str, DEBUG_STR_LEN, "NULL");
+ else {
+ for (i = 0; i < argc; i++) {
+ snprintf(argv_str, DEBUG_STR_LEN, "%sargv[%d]=\"%s\", ", argv_str, i, argv[i]);
+ }
+ i = strnlen(argv_str, DEBUG_STR_LEN);
+ if (i > 1)
+ argv_str[i - 2] = '\0';
+ }
+ PUT_LOG_DEBUG(ip_protomod, LOG_CAT_L7VSD_PROTOCOL,275,
+ "in_function: int parse(void* ip_arg, int argc, char* argv[]):ip_arg=&(%s), "
+ "argc=%d, %s", ip_arg_str, argc, argv_str);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ /* check null */
+ if (ip_arg == NULL) {
+ PUT_LOG_ERROR(ip_protomod, LOG_CAT_L7VSD_PROTOCOL,240, "Arg(ip_arg) is NULL pointer.");
+ return_value = -1;
+ goto parse_out;
+ }
+ if (argv == NULL) {
+ PUT_LOG_ERROR(ip_protomod, LOG_CAT_L7VSD_PROTOCOL,241, "Arg(argv) is NULL pointer.");
+ return_value = -1;
+ goto parse_out;
+ }
+
+ ip_service_arg = (struct l7vs_ip_service_arg *) ip_arg;
+ optind = 0;
+
+ /* check all argument */
+ while ((c = getopt_long(argc, argv, "FRN", opt, NULL)) != -1) {
+ switch (c) {
+ /* --forwarded-for / -F */
+ case 'F':
+ /* x-forwarded-for on */
+ ip_service_arg->forwarded_for = 1;
+ forwarded_for_flag++;
+ break;
+ /* --reschedule / -R */
+ case 'R':
+ /* reschedule on */
+ ip_service_arg->reschedule = 1;
+ reschedule_flag++;
+ break;
+
+ /* --no-reschedule / -N */
+ case 'N':
+ /* reschedule off */
+ ip_service_arg->reschedule = 0;
+ reschedule_flag++;
+ break;
+
+ /* else error */
+ default:
+ PUT_LOG_ERROR(ip_protomod, LOG_CAT_L7VSD_PROTOCOL,242, "Option error.");
+ return_value = -1;
+ goto parse_out;
+ }
+ }
+
+ /* when set both -R and -N at the same time */
+ if (reschedule_flag > 1) {
+ PUT_LOG_ERROR(ip_protomod, LOG_CAT_L7VSD_PROTOCOL,243,
+ "You have to choose either of reschdule or no-reschedule.");
+ return_value = -1;
+ goto parse_out;
+ }
+
+ /* set default no reschedule */
+ if (reschedule_flag == 0) {
+ ip_service_arg->reschedule = 0;
+ }
+
+ /* set default no forwarded_for */
+ if (forwarded_for_flag == 0) {
+ ip_service_arg->forwarded_for = 0;
+ }
+
+parse_out:
+ /*-------- DEBUG LOG --------*/
+ if (ip_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == ip_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ PUT_LOG_DEBUG(ip_protomod, LOG_CAT_L7VSD_PROTOCOL,276,
+ "out_function: int parse(void* ip_arg, int argc, char* argv[]):return_value=%d",
+ return_value);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return return_value;
+}
+
+/*!
+ * Search ip service from ip service list using service handle
+ * @param[in] service_handle a unique service ID
+ * @return ip service struct when service was found. NULL when service was not found.
+ */
+static struct l7vs_ip_service *
+l7vs_protomod_ip_search_service(handle_t service_handle)
+{
+ /* ip service list counter */
+ int service_number = 0;
+ struct l7vs_ip_service* return_value = NULL;
+
+ /*-------- DEBUG LOG --------*/
+ if (ip_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == ip_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ PUT_LOG_DEBUG(ip_protomod, LOG_CAT_L7VSD_PROTOCOL,277,
+ "in_function: struct l7vs_ip_service* l7vs_protomod_ip_search_service(handle_t service_handle):"
+ "service_handle=%d", service_handle);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ /* check all ip service list */
+ for (service_number = 0; service_number < IP_SERVICE_NUMBER; ++service_number) {
+ /* found the service has same service handle */
+ if (ip_service_list[service_number] != NULL &&
+ ip_service_list[service_number]->service_handle == service_handle) {
+ return ip_service_list[service_number];
+ }
+ }
+
+ /*-------- DEBUG LOG --------*/
+ if (ip_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == ip_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ char ssl_str[DEBUG_STR_LEN] = {0};
+ l7vs_ip_service_c_str(ssl_str, return_value);
+ PUT_LOG_DEBUG(ip_protomod, LOG_CAT_L7VSD_PROTOCOL,278,
+ "out_function: struct l7vs_ip_service* l7vs_protomod_ip_search_service(handle_t service_handle):"
+ "return_value=&(%s)", ssl_str);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return return_value;
+}
+
+/*!
+ * Create ip service.
+ * @param void
+ * @return ip service struct when create a service. NULL when cannot create service.
+ */
+static struct l7vs_ip_service *
+l7vs_protomod_ip_create_service()
+{
+ /* ip service list counter */
+ int service_number = 0;
+ struct l7vs_ip_service* return_value = NULL;
+
+ /*-------- DEBUG LOG --------*/
+ if (ip_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == ip_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ PUT_LOG_DEBUG(ip_protomod, LOG_CAT_L7VSD_PROTOCOL,279,
+ "in_function: struct l7vs_ip_service* l7vs_protomod_ip_create_service()");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ /* check all ip service list */
+ for (service_number = 0; service_number < IP_SERVICE_NUMBER - 1; ++service_number) {
+ /* if pointer that does not point NULL exists ... */
+ if (ip_service_list[service_number] == NULL) {
+ /* create a service at empty pointer */
+ ip_service_list[service_number] = (struct l7vs_ip_service *) calloc(1, sizeof(struct l7vs_ip_service));
+
+ /*-------- DEBUG LOG --------*/
+ if (ip_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == ip_protomod.get_log_level(LOG_CAT_L7VSD_SYSTEM_MEMORY)) {
+ PUT_LOG_DEBUG(ip_protomod, LOG_CAT_L7VSD_SYSTEM_MEMORY,61, "calloc: addr=%p, size=%ld",
+ ip_service_list[service_number], (unsigned long int) sizeof(struct l7vs_ip_service));
+ }
+ /*------ DEBUG LOG END ------*/
+
+ if (ip_service_list[service_number] == NULL) {
+ PUT_LOG_ERROR(ip_protomod, LOG_CAT_L7VSD_SYSTEM_MEMORY,54, "Could not allocate memory.");
+ goto create_service_out;
+ }
+ return_value = ip_service_list[service_number];
+ goto create_service_out;
+ }
+ }
+
+ /* all service list is full */
+ PUT_LOG_ERROR(ip_protomod, LOG_CAT_L7VSD_PROTOCOL,244, "ip service list is full.");
+
+create_service_out:
+ /*-------- DEBUG LOG --------*/
+ if (ip_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == ip_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ char ssl_str[DEBUG_STR_LEN] = {0};
+ l7vs_ip_service_c_str(ssl_str, return_value);
+ PUT_LOG_DEBUG(ip_protomod, LOG_CAT_L7VSD_PROTOCOL,280,
+ "out_function: struct l7vs_ip_service* l7vs_protomod_ip_create_service():"
+ "return_value=&(%s)", ssl_str);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return return_value;
+}
+
+/*!
+ * Create temporary ip service.
+ * @param void
+ * @return ip service struct when create a service. NULL when cannot create service.
+ */
+static struct l7vs_ip_service *
+l7vs_protomod_ip_create_temp_service()
+{
+ struct l7vs_ip_service* return_value = NULL;
+
+ /*-------- DEBUG LOG --------*/
+ if (ip_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == ip_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ PUT_LOG_DEBUG(ip_protomod, LOG_CAT_L7VSD_PROTOCOL,281,
+ "in_function: struct l7vs_ip_service* l7vs_protomod_ip_create_temp_service()");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ /* if pointer that does not point NULL exists ... */
+ if (ip_service_list[IP_SERVICE_NUMBER - 1] != NULL) {
+ PUT_LOG_ERROR(ip_protomod, LOG_CAT_L7VSD_PROTOCOL,245, "Temporary ip service is being used by other process.");
+ goto create_temp_service_out;
+ }
+
+ /* create temp service */
+ ip_service_list[IP_SERVICE_NUMBER - 1] = (struct l7vs_ip_service *) calloc(1, sizeof(struct l7vs_ip_service));
+
+ /*-------- DEBUG LOG --------*/
+ if (ip_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == ip_protomod.get_log_level(LOG_CAT_L7VSD_SYSTEM_MEMORY)) {
+ PUT_LOG_DEBUG(ip_protomod, LOG_CAT_L7VSD_SYSTEM_MEMORY,62, "calloc: addr=%p, size=%ld",
+ ip_service_list[IP_SERVICE_NUMBER - 1], (unsigned long int) sizeof(struct l7vs_ip_service));
+ }
+ /*------ DEBUG LOG END ------*/
+
+ if (ip_service_list[IP_SERVICE_NUMBER - 1] == NULL) {
+ PUT_LOG_ERROR(ip_protomod, LOG_CAT_L7VSD_SYSTEM_MEMORY,55, "Could not allocate memory");
+ goto create_temp_service_out;
+ }
+
+ return_value = ip_service_list[IP_SERVICE_NUMBER - 1];
+
+create_temp_service_out:
+ /*-------- DEBUG LOG --------*/
+ if (ip_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == ip_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ char ssl_str[DEBUG_STR_LEN] = {0};
+ l7vs_ip_service_c_str(ssl_str, return_value);
+ PUT_LOG_DEBUG(ip_protomod, LOG_CAT_L7VSD_PROTOCOL,282,
+ "out_function: struct l7vs_ip_service* l7vs_protomod_ip_create_service():"
+ "return_value=&(%s)", ssl_str);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return return_value;
+}
+
+/*!
+ * Serialize struct l7vs_ip_service for debug log.
+ * @param[out] buf serialized string
+ * @param[in] ip l7vs_ip_service struct
+ */
+static void l7vs_ip_service_c_str(char* buf, struct l7vs_ip_service* ip) {
+ if (ip == NULL) {
+ snprintf(buf, DEBUG_STR_LEN, "NULL");
+ }
+ else {
+ snprintf(buf, DEBUG_STR_LEN, "service_handle=%d, forwarded_for=%d, reschedule=%d",
+ ip->service_handle, ip->forwarded_for, ip->reschedule);
+ }
+}
+
+/*!
+ * Serialize struct l7vs_ip_service_arg for debug log.
+ * @param[out] buf serialized string
+ * @param[in] ip_arg l7vs_ip_service_arg struct
+ */
+void l7vs_ip_service_arg_c_str(char* buf, struct l7vs_ip_service_arg* ip_arg) {
+ if (ip_arg == NULL) {
+ snprintf(buf, DEBUG_STR_LEN, "NULL");
+ }
+ else {
+ snprintf(buf, DEBUG_STR_LEN, "forwarded_for=%d, reschedule=%d",
+ ip_arg->forwarded_for, ip_arg->reschedule);
+ }
+}
+
+unsigned int l7vs_ip_service_calc_hash(struct l7vs_conn* conn) {
+ unsigned int hash = ntohl(conn->caddr.sin_addr.s_addr) * GOLDEN_RATIO_PRIME;
+ return hash >> 32 - HASH_TABLE_BITS;
+}
--- /dev/null
+/*
+ * @file protomod_pfilter.c
+ * @brief protocol module of HTTP.
+ * @brief this module provide session persistence by URL.
+ *
+ * L7VSD: Linux Virtual Server for Layer7 Load Balancing
+ * Copyright (C) 2008 NTT COMWARE Corporation.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ **********************************************************************/
+
+#define __STDC_LIMIT_MACROS
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+#include <getopt.h>
+#include "l7vs_service.h"
+#include "l7vs_conn.h"
+#include "l7vs_dest.h"
+#include "l7vs_module.h"
+#include <fnmatch.h>
+
+#include <iostream>
+#ifdef USE_BOOST_XPRESSIVE
+ #include <boost/xpressive/xpressive.hpp>
+#else
+ #include <boost/regex.hpp>
+#endif
+
+#define SERVICE_ARG_MAXSIZE (512)
+#define PATTERN_MATCH_MAXSIZE (128)
+#define URL_SERVICE_NUMBER (128)
+#define X_FORWARDED_FOR_LENGTH (48)
+
+struct l7vs_pfilter_service {
+ handle_t service_handle;
+ char pattern_match[PATTERN_MATCH_MAXSIZE];
+ int read_byte;
+#ifdef USE_BOOST_XPRESSIVE
+ boost::xpressive::sregex regex;
+#else
+ boost::regex regex;
+#endif
+ int reschedule;
+};
+
+struct l7vs_pfilter_service_arg {
+ char pattern_match[PATTERN_MATCH_MAXSIZE];
+ int read_byte;
+ int reschedule;
+};
+
+static void fini(void);
+static int create(void*, handle_t);
+static void* create_sa(struct l7vs_service_arg*);
+static int compare(handle_t, handle_t);
+static int match_cldata(struct l7vs_service*, struct l7vs_conn*,
+ char*, size_t*, struct l7vs_dest**, int*);
+static int analyze_rsdata(struct l7vs_service*, struct l7vs_conn*,
+ char*, size_t*);
+static int destroy(handle_t);
+static void destroy_sa(void**);
+static int service_arg(struct l7vs_service_arg_multi*, handle_t);
+static int parse(void*, int, char**);
+
+static struct l7vs_pfilter_service *l7vs_protomod_pfilter_search_service(handle_t);
+static struct l7vs_pfilter_service *l7vs_protomod_pfilter_create_service();
+static struct l7vs_pfilter_service *l7vs_protomod_pfilter_create_temp_service();
+
+static void l7vs_pfilter_service_c_str(char*, struct l7vs_pfilter_service*);
+static void l7vs_pfilter_service_arg_c_str(char*, struct l7vs_pfilter_service_arg*);
+
+struct l7vs_pfilter_service *pfilter_service_list[URL_SERVICE_NUMBER];
+
+static struct l7vs_protomod pfilter_protomod = {
+ NULL, /* handle */
+ "pfilter", /* modname */
+ 0, /* refcnt */
+ 0, /* fast schedule */
+ create, /* create function */
+ compare, /* compare function */
+ match_cldata, /* match_cldata function */
+ analyze_rsdata, /* analyze_rsdata function */
+ destroy, /* destroy function */
+ fini, /* fini function */
+ create_sa, /* create_sa function */
+ service_arg, /* service_arg function */
+ parse, /* parse function */
+ destroy_sa, /* destroy_sa function */
+ NULL, /* initialize function */
+ NULL, /* finalize function */
+ NULL, /* get_log_level function */
+ NULL, /* put_log_debug function */
+ NULL, /* put_log_info function */
+ NULL, /* put_log_warn function */
+ NULL, /* put_log_error function */
+ NULL /* put_log_fatal function */
+};
+
+/*!
+ * Protocol module initialize function. This function run when dlopen and dlsym at first time.
+ * @param[in] handle dlopen's handle
+ * @return l7vs_protomod struct
+ */
+extern "C" struct l7vs_protomod *
+init(void *handle)
+{
+ struct l7vs_protomod* return_value = NULL;
+
+ /*-------- DEBUG LOG --------*/
+ if (pfilter_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == pfilter_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ PUT_LOG_DEBUG(pfilter_protomod, LOG_CAT_L7VSD_PROTOCOL,283,
+ "in_function: struct l7vs_protomod* init(void* handle): handle=%p", handle);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ /* check null */
+ if (handle == NULL) {
+ PUT_LOG_ERROR(pfilter_protomod, LOG_CAT_L7VSD_PROTOCOL,246, "Arg(handle) is NULL pointer.");
+ goto init_out;
+ }
+
+ /* initialize pfilter service list */
+ memset(pfilter_service_list, 0, sizeof(struct l7vs_pfilter_service *) * URL_SERVICE_NUMBER);
+ /* set dlopen's handle */
+ pfilter_protomod.handle = handle;
+
+ return_value = &pfilter_protomod;
+
+init_out:
+ /*-------- DEBUG LOG --------*/
+ if (pfilter_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == pfilter_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ char protomod_str[DEBUG_STR_LEN] = {0};
+ l7vs_protomod_c_str(protomod_str, &pfilter_protomod);
+ PUT_LOG_DEBUG(pfilter_protomod, LOG_CAT_L7VSD_PROTOCOL,284,
+ "out_function: struct l7vs_protomod* init(void* handle): return=&(%s)", protomod_str);
+ }
+ /*------ DEBUG LOG END ------*/
+ return return_value;
+}
+
+/*!
+ * Protocol module finalize function. free all pfilter service list just in case.
+ * @param void
+ * @return void
+ */
+static void
+fini(void)
+{
+ /* pfilter service list counter */
+ int service_number = 0;
+
+ /*-------- DEBUG LOG --------*/
+ if (pfilter_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == pfilter_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ PUT_LOG_DEBUG(pfilter_protomod, LOG_CAT_L7VSD_PROTOCOL,285, "in_function: void fini(void)");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ /* check all pfilter service list */
+ for (service_number = 0; service_number < URL_SERVICE_NUMBER; ++service_number) {
+ /* if pointer that does not point NULL exists ... */
+ if (pfilter_service_list[service_number] != NULL) {
+
+ /*-------- DEBUG LOG --------*/
+ if (pfilter_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == pfilter_protomod.get_log_level(LOG_CAT_L7VSD_SYSTEM_MEMORY)) {
+ PUT_LOG_DEBUG(pfilter_protomod, LOG_CAT_L7VSD_SYSTEM_MEMORY,63, "free: %p",
+ pfilter_service_list[service_number]);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ /* free and points NULL */
+ free(pfilter_service_list[service_number]);
+ pfilter_service_list[service_number] = NULL;
+ }
+ }
+ /*-------- DEBUG LOG --------*/
+ if (pfilter_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == pfilter_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ PUT_LOG_DEBUG(pfilter_protomod, LOG_CAT_L7VSD_PROTOCOL,286, "out_function: void fini(void)");
+ }
+ /*------ DEBUG LOG END ------*/
+}
+
+/*!
+ * Create pfilter service struct.
+ * @param pfilter_arg pfilter service argument struct
+ * @param service_handle a unique service ID
+ * @retval 0 successfully create pfilter service.
+ * @retval -1 some errors occur.
+ */
+static int
+create(void *pfilter_arg, handle_t service_handle)
+{
+ struct l7vs_pfilter_service *pfilter_service;
+ struct l7vs_pfilter_service_arg *pfilter_service_arg;
+ int return_value = 0;
+
+ /*-------- DEBUG LOG --------*/
+ if (pfilter_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == pfilter_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ char pfilter_arg_str[DEBUG_STR_LEN] = {0};
+ l7vs_pfilter_service_arg_c_str(pfilter_arg_str, (struct l7vs_pfilter_service_arg*) pfilter_arg);
+ PUT_LOG_DEBUG(pfilter_protomod, LOG_CAT_L7VSD_PROTOCOL,287,
+ "in_function: int create(void* pfilter_arg, handle_t service_handle):pfilter_arg=&(%s), "
+ "service_handle=%d", pfilter_arg_str, service_handle);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ /* check null */
+ if (pfilter_arg == NULL) {
+ PUT_LOG_ERROR(pfilter_protomod, LOG_CAT_L7VSD_PROTOCOL,247, "Arg(pfilter_arg) is NULL pointer.");
+ return_value = -1;
+ goto create_out;
+ }
+
+ if (service_handle != TEMP_SERVICEHANDLE) {
+ /* search empty pfilter service list and create pfilter service */
+ pfilter_service = l7vs_protomod_pfilter_create_service();
+ } else {
+ /* create temporary pfilter service */
+ pfilter_service = l7vs_protomod_pfilter_create_temp_service();
+ }
+
+ /*-------- DEBUG LOG --------*/
+ if (pfilter_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == pfilter_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ char pfilter_str[DEBUG_STR_LEN] = {0};
+ l7vs_pfilter_service_c_str(pfilter_str, pfilter_service);
+ PUT_LOG_DEBUG(pfilter_protomod, LOG_CAT_L7VSD_PROTOCOL,288, "pointer assign: pfilter_service=&(%s)",
+ pfilter_str);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ if (pfilter_service == NULL) {
+ PUT_LOG_ERROR(pfilter_protomod, LOG_CAT_L7VSD_PROTOCOL,248, "Could not make pfilter service.");
+ return_value = -1;
+ goto create_out;
+ }
+
+ pfilter_service_arg = (struct l7vs_pfilter_service_arg *) pfilter_arg;
+
+ /* set service handle, pattern match and reschedule flag */
+ pfilter_service->service_handle = service_handle;
+ strncpy(pfilter_service->pattern_match, pfilter_service_arg->pattern_match, PATTERN_MATCH_MAXSIZE);
+ pfilter_service->read_byte = pfilter_service_arg->read_byte;
+ if (pfilter_service_arg->pattern_match) {
+ try {
+#ifdef USE_BOOST_XPRESSIVE
+ pfilter_service->regex = boost::xpressive::sregex::compile(pfilter_service_arg->pattern_match);
+#else
+ pfilter_service->regex.assign(pfilter_service_arg->pattern_match);
+#endif
+ }
+ catch (...) {
+ PUT_LOG_ERROR(pfilter_protomod, LOG_CAT_L7VSD_PROTOCOL,249, "Regex pattern error.");
+ return_value = -1;
+ goto create_out;
+ }
+ }
+ pfilter_service->reschedule = pfilter_service_arg->reschedule;
+
+create_out:
+ /*-------- DEBUG LOG --------*/
+ if (pfilter_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == pfilter_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ PUT_LOG_DEBUG(pfilter_protomod, LOG_CAT_L7VSD_PROTOCOL,289,
+ "out_function: int create(void* pfilter_arg, handle_t service_handle):return_value=%d",
+ return_value);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return return_value;
+}
+
+/*!
+ * Create pfilter service argument struct.
+ * @param[out] srv_arg service argument struct
+ * @return pfilter service argument struct
+ */
+static void *
+create_sa(struct l7vs_service_arg *srv_arg)
+{
+ struct l7vs_pfilter_service_arg *pfilter_service_arg;
+
+ /*-------- DEBUG LOG --------*/
+ if (pfilter_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == pfilter_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ char service_arg_str[DEBUG_STR_LEN] = {0};
+ l7vs_service_arg_c_str(service_arg_str, srv_arg);
+ PUT_LOG_DEBUG(pfilter_protomod, LOG_CAT_L7VSD_PROTOCOL,290,
+ "in_function: void* create_sa(struct l7vs_service_arg* srv_arg):srv_arg=&(%s)",
+ service_arg_str);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ /* check null */
+ if (srv_arg == NULL) {
+ PUT_LOG_ERROR(pfilter_protomod, LOG_CAT_L7VSD_PROTOCOL,250, "Arg(srv_arg) is NULL pointer.");
+ pfilter_service_arg = NULL;
+ goto create_sa_out;
+ }
+
+ /* create pfilter service argument struct */
+ pfilter_service_arg = (struct l7vs_pfilter_service_arg *) calloc(1, sizeof(struct l7vs_pfilter_service_arg));
+
+ /*-------- DEBUG LOG --------*/
+ if (pfilter_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == pfilter_protomod.get_log_level(LOG_CAT_L7VSD_SYSTEM_MEMORY)) {
+ PUT_LOG_DEBUG(pfilter_protomod, LOG_CAT_L7VSD_SYSTEM_MEMORY,64, "calloc: addr=%p, size=%ld",
+ pfilter_service_arg, (unsigned long int) sizeof(struct l7vs_pfilter_service_arg));
+ }
+ /*------ DEBUG LOG END ------*/
+
+ if (pfilter_service_arg == NULL) {
+ PUT_LOG_ERROR(pfilter_protomod, LOG_CAT_L7VSD_SYSTEM_MEMORY,56, "Could not allocate memory.");
+ goto create_sa_out;
+ }
+
+ /* set pfilter service argument size and protomod name "pfilter" */
+ srv_arg->len = sizeof(struct l7vs_pfilter_service_arg);
+ strcpy(srv_arg->protomod, pfilter_protomod.modname);
+
+create_sa_out:
+ /*-------- DEBUG LOG --------*/
+ if (pfilter_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == pfilter_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ char pfilter_service_arg_str[DEBUG_STR_LEN] = {0};
+ l7vs_pfilter_service_arg_c_str(pfilter_service_arg_str, pfilter_service_arg);
+ PUT_LOG_DEBUG(pfilter_protomod, LOG_CAT_L7VSD_PROTOCOL,291,
+ "out_function: void* create_sa(struct l7vs_service_arg* srv_arg):return_value=&(%s)",
+ pfilter_service_arg_str);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return (void*) pfilter_service_arg;
+}
+
+/*!
+ * Compare two service.
+ * @param[in] srv_handle1 one of a unique service ID
+ * @param[in] srv_handle2 one of a unique service ID
+ * @retval 0 they matched perfectly.
+ * @retval -1 they are different.
+ */
+static int
+compare(handle_t srv_handle1, handle_t srv_handle2)
+{
+ struct l7vs_pfilter_service *pfilter_srv1, *pfilter_srv2;
+ int return_value = 0;
+
+ /*-------- DEBUG LOG --------*/
+ if (pfilter_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == pfilter_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ PUT_LOG_DEBUG(pfilter_protomod, LOG_CAT_L7VSD_PROTOCOL,292,
+ "in_function: int compare(handle_t srv_handle1, handle_t srv_handle2):"
+ "srv_handle1=%u, srv_handle2=%u", srv_handle1, srv_handle2);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ /* search service that has such a service ID(1) */
+ pfilter_srv1 = l7vs_protomod_pfilter_search_service(srv_handle1);
+
+ /*-------- DEBUG LOG --------*/
+ if (pfilter_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == pfilter_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ char pfilter_str[DEBUG_STR_LEN] = {0};
+ l7vs_pfilter_service_c_str(pfilter_str, pfilter_srv1);
+ PUT_LOG_DEBUG(pfilter_protomod, LOG_CAT_L7VSD_PROTOCOL,293, "pointer assign: pfilter_srv1=&(%s)",
+ pfilter_str);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ if (pfilter_srv1 == NULL) {
+ PUT_LOG_ERROR(pfilter_protomod, LOG_CAT_L7VSD_PROTOCOL,251,
+ "Could not find such service handle's pfilter service.");
+ return_value = -1;
+ goto compare_out;
+ }
+
+ /* search service that has such a service ID(2) */
+ pfilter_srv2 = l7vs_protomod_pfilter_search_service(srv_handle2);
+
+ /*-------- DEBUG LOG --------*/
+ if (pfilter_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == pfilter_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ char pfilter_str[DEBUG_STR_LEN] = {0};
+ l7vs_pfilter_service_c_str(pfilter_str, pfilter_srv2);
+ PUT_LOG_DEBUG(pfilter_protomod, LOG_CAT_L7VSD_PROTOCOL,294, "pointer assign: pfilter_srv2=&(%s)",
+ pfilter_str);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ if (pfilter_srv2 == NULL) {
+ PUT_LOG_ERROR(pfilter_protomod, LOG_CAT_L7VSD_PROTOCOL,252,
+ "Could not find such service handle's pfilter service.");
+ return_value = -1;
+ goto compare_out;
+ }
+
+ /* compare two pattern match */
+ if (strcmp(pfilter_srv1->pattern_match, pfilter_srv2->pattern_match) != 0) {
+ return_value = -1;
+ goto compare_out;
+ }
+
+compare_out:
+ /*-------- DEBUG LOG --------*/
+ if (pfilter_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == pfilter_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ PUT_LOG_DEBUG(pfilter_protomod, LOG_CAT_L7VSD_PROTOCOL,295,
+ "out_function: int compare(handle_t srv_handle1, handle_t srv_handle2):return_value=%d",
+ return_value);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return return_value;
+}
+
+/*!
+ * Check the client packet and determine a real server.
+ * @param[in] srv service struct include service handle, protocol module and schedule module.
+ * @param[in] conn connection data.
+ * @param[in] request packet data from client
+ * @param[in] len length of packet data
+ * @param[out] dest destination (real server) list
+ * @param[out] tcps TCP Splicer flag
+ * @retval 0 successfully check packet data
+ * @retval -1 some errors occur.
+ */
+static int
+match_cldata(struct l7vs_service *srv, struct l7vs_conn *conn,
+ char *request, size_t *len, struct l7vs_dest **dest, int *tcps)
+{
+ struct l7vs_pfilter_service *pfilter_service;
+ int ret;
+ int return_value = 0;
+ std::string packet_data;
+
+ /*-------- DEBUG LOG --------*/
+ if (pfilter_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == pfilter_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ char srv_str[DEBUG_STR_LEN] = {0};
+ char conn_str[DEBUG_STR_LEN] = {0};
+ char dest_str[DEBUG_STR_LEN] = {0};
+ char len_str[DEBUG_STR_LEN] = {0};
+ char tcps_str[DEBUG_STR_LEN] = {0};
+ l7vs_service_c_str(srv_str, srv);
+ l7vs_conn_c_str(conn_str, conn);
+ if (dest != NULL) {
+ l7vs_dest_c_str(dest_str, *dest);
+ }
+ else {
+ strncpy(dest_str, "NULL", DEBUG_STR_LEN);
+ }
+ if (len != NULL) {
+ snprintf(len_str, DEBUG_STR_LEN, "%lu", (unsigned long int) *len);
+ }
+ else {
+ strncpy(len_str, "NULL", DEBUG_STR_LEN);
+ }
+ if (tcps != NULL) {
+ snprintf(tcps_str, DEBUG_STR_LEN, "%d", *tcps);
+ }
+ else {
+ strncpy(tcps_str, "NULL", DEBUG_STR_LEN);
+ }
+ PUT_LOG_DEBUG(pfilter_protomod, LOG_CAT_L7VSD_PROTOCOL,296,
+ "in_function: int match_cldata(struct l7vs_service* srv, struct l7vs_conn* conn, "
+ "char* request, size_t* len, struct l7vs_dest** dest, int* tcps):srv=&(%s), conn=&(%s), "
+ "request=\"%s\", len=&(%s), dest=&(&(%s)), tcps=&(%s)",
+ srv_str, conn_str, request, len_str, dest_str, tcps_str);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ /* check null */
+ if (srv == NULL) {
+ PUT_LOG_ERROR(pfilter_protomod, LOG_CAT_L7VSD_PROTOCOL,253, "Arg(srv) is NULL pointer.");
+ return_value = -1;
+ goto match_cldata_out;
+ }
+ if (srv->pm == NULL) {
+ PUT_LOG_ERROR(pfilter_protomod, LOG_CAT_L7VSD_PROTOCOL,254, "Arg(srv->pm) is NULL pointer.");
+ return_value = -1;
+ goto match_cldata_out;
+ }
+ if (request == NULL) {
+ PUT_LOG_ERROR(pfilter_protomod, LOG_CAT_L7VSD_PROTOCOL,255, "Arg(request) is NULL pointer.");
+ return_value = -1;
+ goto match_cldata_out;
+ }
+ if (len == NULL) {
+ PUT_LOG_ERROR(pfilter_protomod, LOG_CAT_L7VSD_PROTOCOL,256, "Arg(len) is NULL pointer.");
+ return_value = -1;
+ goto match_cldata_out;
+ }
+ if (dest == NULL) {
+ PUT_LOG_ERROR(pfilter_protomod, LOG_CAT_L7VSD_PROTOCOL,257, "Arg(dest) is NULL pointer.");
+ return_value = -1;
+ goto match_cldata_out;
+ }
+ if (tcps == NULL) {
+ PUT_LOG_ERROR(pfilter_protomod, LOG_CAT_L7VSD_PROTOCOL,258, "Arg(tcps) is NULL pointer.");
+ return_value = -1;
+ goto match_cldata_out;
+ }
+
+ /* search service that has such a service ID */
+ pfilter_service = l7vs_protomod_pfilter_search_service(srv->handle);
+
+ /*-------- DEBUG LOG --------*/
+ if (pfilter_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == pfilter_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ char pfilter_str[DEBUG_STR_LEN] = {0};
+ l7vs_pfilter_service_c_str(pfilter_str, pfilter_service);
+ PUT_LOG_DEBUG(pfilter_protomod, LOG_CAT_L7VSD_PROTOCOL,297, "pointer assign: pfilter_service=&(%s)",
+ pfilter_str);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ if (pfilter_service == NULL) {
+ PUT_LOG_ERROR(pfilter_protomod, LOG_CAT_L7VSD_PROTOCOL,259, "Could not find such service handle's pfilter service.");
+ return_value = -1;
+ goto match_cldata_out;
+ }
+
+ /* initialize protocol module ... clear destination list */
+ ret = srv->pm->initialize(srv, conn, request, *len, dest);
+ if (ret != 0) {
+ PUT_LOG_ERROR(pfilter_protomod, LOG_CAT_L7VSD_PROTOCOL,260, "Could not initialize protomod.");
+ return_value = -1;
+ goto match_cldata_out;
+ }
+
+ /* check pattern_match != 0 */
+ if (pfilter_service->pattern_match[0] == '\0') {
+ PUT_LOG_ERROR(pfilter_protomod, LOG_CAT_L7VSD_PROTOCOL,261, "Pattern match is NULL pointer");
+ return_value = -1;
+ goto match_cldata_out;
+ }
+
+ /* check pattern match */
+ if (*len > pfilter_service->read_byte) {
+ packet_data = std::string(request, pfilter_service->read_byte);
+ }
+ else {
+ packet_data = std::string(request, *len);
+ }
+
+#ifdef USE_BOOST_XPRESSIVE
+ if ( boost::xpressive::regex_search(packet_data, pfilter_service->regex) ) {
+#else
+ if ( boost::regex_search(packet_data, pfilter_service->regex) ) {
+#endif
+ return_value = -1;
+ goto match_cldata_out;
+ }
+
+ *tcps = 0;
+
+ /* finalize */
+ ret = srv->pm->finalize(srv, conn, request, *len, dest, pfilter_service->reschedule);
+ if (ret != 0) {
+ PUT_LOG_INFO(pfilter_protomod, LOG_CAT_L7VSD_PROTOCOL,18, "Could not finalize protomod. (Realserver decision failure)");
+ return_value = -1;
+ goto match_cldata_out;
+ }
+
+match_cldata_out:
+ /*-------- DEBUG LOG --------*/
+ if (pfilter_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == pfilter_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ PUT_LOG_DEBUG(pfilter_protomod, LOG_CAT_L7VSD_PROTOCOL,298,
+ "out_function: int match_cldata(struct l7vs_service* srv, struct l7vs_conn* conn, "
+ "char* request, size_t* len, struct l7vs_dest** dest, int* tcps):return_value=%d",
+ return_value);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return return_value;
+}
+
+/*!
+ * Check the real server packet and insert a Set-Cookie field.
+ * @param[in] srv service struct include service handle, protocol module and schedule module.
+ * @param[in] conn connection data.
+ * @param[in] response packet data from real server
+ * @param[in] len length of packet data. it will be lengthened.
+ * @retval 0 successfully check packet data.
+ * @retval -1 some errors occur.
+ */
+static int
+analyze_rsdata(struct l7vs_service *srv, struct l7vs_conn *conn,
+ char *response, size_t *len)
+{
+ int return_value = 0;
+
+ /*-------- DEBUG LOG --------*/
+ if (pfilter_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == pfilter_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ char srv_str[DEBUG_STR_LEN] = {0};
+ char conn_str[DEBUG_STR_LEN] = {0};
+ char len_str[DEBUG_STR_LEN] = {0};
+ l7vs_service_c_str(srv_str, srv);
+ l7vs_conn_c_str(conn_str, conn);
+ if (len != NULL) {
+ snprintf(len_str, DEBUG_STR_LEN, "%lu", (unsigned long int) *len);
+ }
+ else {
+ strncpy(len_str, "NULL", DEBUG_STR_LEN);
+ }
+ PUT_LOG_DEBUG(pfilter_protomod, LOG_CAT_L7VSD_PROTOCOL,299,
+ "in_function: int analyze_rsdata(struct l7vs_service* srv, struct l7vs_conn* conn, "
+ "char* response, size_t* len):srv=&(%s), conn=&(%s), response=\"%s\", len=&(%s)",
+ srv_str, conn_str, response, len_str);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ /* check null */
+ if (srv == NULL) {
+ PUT_LOG_ERROR(pfilter_protomod, LOG_CAT_L7VSD_PROTOCOL,262, "Arg(srv) is NULL pointer.");
+ return_value = -1;
+ goto analyze_rsdata_out;
+ }
+ if (conn == NULL) {
+ PUT_LOG_ERROR(pfilter_protomod, LOG_CAT_L7VSD_PROTOCOL,263, "Arg(conn) is NULL pointer.");
+ return_value = -1;
+ goto analyze_rsdata_out;
+ }
+ if (conn->dest == NULL) {
+ PUT_LOG_ERROR(pfilter_protomod, LOG_CAT_L7VSD_PROTOCOL,264, "Arg(conn->dest) is NULL pointer.");
+ return_value = -1;
+ goto analyze_rsdata_out;
+ }
+ if (response == NULL) {
+ PUT_LOG_ERROR(pfilter_protomod, LOG_CAT_L7VSD_PROTOCOL,265, "Arg(response) is NULL pointer.");
+ return_value = -1;
+ goto analyze_rsdata_out;
+ }
+ if (len == NULL) {
+ PUT_LOG_ERROR(pfilter_protomod, LOG_CAT_L7VSD_PROTOCOL,266, "Arg(len) is NULL pointer.");
+ return_value = -1;
+ goto analyze_rsdata_out;
+ }
+
+ /* sorry flag check */
+ if (conn->sorry_conn_flag == 1) {
+ /*-------- DEBUG LOG --------*/
+ if (pfilter_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == pfilter_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ PUT_LOG_DEBUG(pfilter_protomod, LOG_CAT_L7VSD_PROTOCOL,300, "Response from sorry server.");
+ }
+ /*------ DEBUG LOG END ------*/
+ goto analyze_rsdata_out;
+ }
+
+analyze_rsdata_out:
+ /*-------- DEBUG LOG --------*/
+ if (pfilter_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == pfilter_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ PUT_LOG_DEBUG(pfilter_protomod, LOG_CAT_L7VSD_PROTOCOL,301,
+ "out_function: int analyze_rsdata(struct l7vs_service* srv, struct l7vs_conn* conn, "
+ "char* response, size_t* len):return_value=%d", return_value);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return return_value;
+}
+
+/*!
+ * Destroy pfilter service
+ * @param[in] srv_handle a unique service ID
+ * @retval 0 successfully check packet data.
+ * @retval -1 some errors occur.
+ */
+static int
+destroy(handle_t srv_handle)
+{
+ /* pfilter service list counter */
+ int service_number = 0;
+ int free_flag = 0;
+ int return_value = 0;
+
+ /*-------- DEBUG LOG --------*/
+ if (pfilter_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == pfilter_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ PUT_LOG_DEBUG(pfilter_protomod, LOG_CAT_L7VSD_PROTOCOL,302,
+ "in_function: int destroy(handle_t srv_handle):srv_handle=%u",
+ srv_handle);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ /* check all pfilter service list */
+ for (service_number = 0; service_number < URL_SERVICE_NUMBER; ++service_number) {
+ /* found pfilter service that has srv_handle */
+ if (pfilter_service_list[service_number] != NULL &&
+ pfilter_service_list[service_number]->service_handle == srv_handle) {
+
+ /*-------- DEBUG LOG --------*/
+ if (pfilter_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == pfilter_protomod.get_log_level(LOG_CAT_L7VSD_SYSTEM_MEMORY)) {
+ PUT_LOG_DEBUG(pfilter_protomod, LOG_CAT_L7VSD_SYSTEM_MEMORY,65, "free: %p",
+ pfilter_service_list[service_number]);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ /* free and NULL */
+ free(pfilter_service_list[service_number]);
+ pfilter_service_list[service_number] = NULL;
+
+ free_flag = 1;
+ break;
+ }
+ }
+
+ /* pfilter service was not found */
+ if (free_flag == 0) {
+ PUT_LOG_ERROR(pfilter_protomod, LOG_CAT_L7VSD_PROTOCOL,267, "Could not find such service handle's pfilter service.");
+ return_value = -1;
+ goto destroy_out;
+ }
+
+destroy_out:
+ /*-------- DEBUG LOG --------*/
+ if (pfilter_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == pfilter_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ PUT_LOG_DEBUG(pfilter_protomod, LOG_CAT_L7VSD_PROTOCOL,303,
+ "out_function: int destroy(handle_t srv_handle):return_value=%d",
+ srv_handle);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return return_value;
+}
+
+/*!
+ * Destroy pfilter service argument
+ * @param[in] pfilter_arg pfilter service argument
+ * @return void
+ */
+static void
+destroy_sa(void **pfilter_arg)
+{
+ /*-------- DEBUG LOG --------*/
+ if (pfilter_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == pfilter_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ char pfilter_arg_str[DEBUG_STR_LEN] = {0};
+ if (pfilter_arg != NULL) {
+ l7vs_pfilter_service_arg_c_str(pfilter_arg_str, (struct l7vs_pfilter_service_arg*) *pfilter_arg);
+ }
+ else {
+ strncpy(pfilter_arg_str, "NULL", DEBUG_STR_LEN);
+ }
+ PUT_LOG_DEBUG(pfilter_protomod, LOG_CAT_L7VSD_PROTOCOL,304,
+ "in_function: void destroy_sa(void** pfilter_arg):pfilter_arg=&(&(%s))",
+ pfilter_arg_str);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ /* check null */
+ if (pfilter_arg == NULL) {
+ PUT_LOG_ERROR(pfilter_protomod, LOG_CAT_L7VSD_PROTOCOL,268, "Arg(pfilter_arg) is NULL pointer.");
+ }
+ else if (*pfilter_arg == NULL) {
+ PUT_LOG_ERROR(pfilter_protomod, LOG_CAT_L7VSD_PROTOCOL,269, "Arg(*pfilter_arg) is NULL pointer.");
+ }
+ else {
+ /*-------- DEBUG LOG --------*/
+ if (pfilter_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == pfilter_protomod.get_log_level(LOG_CAT_L7VSD_SYSTEM_MEMORY)) {
+ PUT_LOG_DEBUG(pfilter_protomod, LOG_CAT_L7VSD_SYSTEM_MEMORY,66, "free: %p",
+ *pfilter_arg);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ /* free and NULL */
+ free((struct l7vs_pfilter_service_arg*) *pfilter_arg);
+ *pfilter_arg = NULL;
+ }
+
+ /*-------- DEBUG LOG --------*/
+ if (pfilter_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == pfilter_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ PUT_LOG_DEBUG(pfilter_protomod, LOG_CAT_L7VSD_PROTOCOL,305,
+ "out_function: void destroy_sa(void** pfilter_arg)");
+ }
+ /*------ DEBUG LOG END ------*/
+}
+
+/*!
+ * Create strings for service list of l7vsadm
+ * @param srv_arg service argument struct
+ * @param srv_handle a unique service ID
+ * @retval 0 successfully create strings
+ * @retval -1 some errors occur.
+ */
+static int
+service_arg(struct l7vs_service_arg_multi *srv_arg_mt, handle_t srv_handle)
+{
+ struct l7vs_pfilter_service *pfilter_service;
+ struct l7vs_pfilter_service_arg c_sarg;
+ char pfilter_argument[SERVICE_ARG_MAXSIZE];
+ int return_value = 0;
+
+ /*-------- DEBUG LOG --------*/
+ if (pfilter_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == pfilter_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ char srv_arg_mt_str[DEBUG_STR_LEN] = {0};
+ l7vs_service_arg_multi_c_str(srv_arg_mt_str, srv_arg_mt);
+ PUT_LOG_DEBUG(pfilter_protomod, LOG_CAT_L7VSD_PROTOCOL,306,
+ "in_function: int service_arg(struct l7vs_service_arg_multi* srv_arg_mt, "
+ "handle_t srv_handle):srv_arg_mt=&(%s), srv_handle=%u",
+ srv_arg_mt_str, srv_handle);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ /* check null */
+ if (srv_arg_mt == NULL) {
+ PUT_LOG_ERROR(pfilter_protomod, LOG_CAT_L7VSD_PROTOCOL,270, "Arg(srv_arg_mt) is NULL pointer.");
+ return_value = -1;
+ goto service_arg_out;
+ }
+
+ /* search service that has such a service ID */
+ pfilter_service = l7vs_protomod_pfilter_search_service(srv_handle);
+
+ /*-------- DEBUG LOG --------*/
+ if (pfilter_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == pfilter_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ char pfilter_str[DEBUG_STR_LEN] = {0};
+ l7vs_pfilter_service_c_str(pfilter_str, pfilter_service);
+ PUT_LOG_DEBUG(pfilter_protomod, LOG_CAT_L7VSD_PROTOCOL,307, "pointer assign: pfilter_service=&(%s)",
+ pfilter_str);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ if (pfilter_service == NULL) {
+ PUT_LOG_ERROR(pfilter_protomod, LOG_CAT_L7VSD_PROTOCOL,271, "Could not find such service handle's pfilter service.");
+ return_value = -1;
+ goto service_arg_out;
+ }
+
+ /* initialize argument strings */
+ memset(pfilter_argument, 0, SERVICE_ARG_MAXSIZE);
+
+ /* set pfilter args to service argument struct */
+ srv_arg_mt->srv_arg.reschedule = pfilter_service->reschedule;
+
+
+ /* create long argument (l7vsadm option -L/-l) */
+ snprintf(pfilter_argument, SERVICE_ARG_MAXSIZE, "--pattern-match %s", pfilter_service->pattern_match);
+ strncpy(srv_arg_mt->srv_arg.protomod_key_string, pfilter_argument, 256);
+
+ /* create verbose argument (l7vsadm option -V/-v) */
+ snprintf(pfilter_argument, SERVICE_ARG_MAXSIZE, "--pattern-match %s --read-byte %d", pfilter_service->pattern_match, pfilter_service->read_byte);
+ strncpy(srv_arg_mt->srv_arg.protomod_opt_string, pfilter_argument, 512);
+
+ strncpy(c_sarg.pattern_match, pfilter_service->pattern_match, PATTERN_MATCH_MAXSIZE);
+ c_sarg.reschedule = pfilter_service->reschedule;
+
+ memcpy(srv_arg_mt->protomod_arg, &c_sarg, sizeof(struct l7vs_pfilter_service_arg));
+
+ /*-------- DEBUG LOG --------*/
+ if (pfilter_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == pfilter_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ char pfilter_arg_str[DEBUG_STR_LEN] = {0};
+ l7vs_pfilter_service_arg_c_str(pfilter_arg_str, &c_sarg);
+ PUT_LOG_DEBUG(pfilter_protomod, LOG_CAT_L7VSD_PROTOCOL,308,
+ "pointer assign: srv_arg_mt->protomod_arg=&(%s)", pfilter_arg_str);
+ }
+ /*------ DEBUG LOG END ------*/
+
+service_arg_out:
+ /*-------- DEBUG LOG --------*/
+ if (pfilter_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == pfilter_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ PUT_LOG_DEBUG(pfilter_protomod, LOG_CAT_L7VSD_PROTOCOL,309,
+ "out_function: int service_arg(struct l7vs_service_arg_multi* srv_arg_mt, "
+ "handle_t srv_handle):return_value=%d", return_value);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return return_value;
+}
+
+/*!
+ * Parse l7vsadm options to pfilter argument
+ * @param[out] pfilter_arg pfilter service argument struct
+ * @param[int] argc number of l7vsadm argument
+ * @param[int] argv l7vsadm argument list
+ * @retval 0 successfully parse argument
+ * @retval -1 some errors occur.
+ */
+static int
+parse(void *pfilter_arg, int argc, char *argv[])
+{
+ struct l7vs_pfilter_service_arg *pfilter_service_arg;
+ static struct option opt[] = {
+ {"pattern-match", required_argument, NULL, 'P'},
+ {"read-byte", required_argument, NULL, 'R'},
+ {NULL, 0, NULL, 0 }
+ };
+ int c;
+ unsigned long buffer;
+ int pattern_match_flag = 0;
+ int read_byte_flag = 0;
+ int return_value = 0;
+#ifndef USE_BOOST_XPRESSIVE
+ boost::regex regex;
+#endif
+
+ /*-------- DEBUG LOG --------*/
+ if (pfilter_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == pfilter_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ int i;
+ char argv_str[DEBUG_STR_LEN] = {0};
+ char pfilter_arg_str[DEBUG_STR_LEN] = {0};
+ l7vs_pfilter_service_arg_c_str(pfilter_arg_str, (struct l7vs_pfilter_service_arg*) pfilter_arg);
+ argv_str[0] = '\0';
+ if (argv == NULL)
+ snprintf(argv_str, DEBUG_STR_LEN, "NULL");
+ else {
+ for (i = 0; i < argc; i++) {
+ snprintf(argv_str, DEBUG_STR_LEN, "%sargv[%d]=\"%s\", ", argv_str, i, argv[i]);
+ }
+ i = strnlen(argv_str, DEBUG_STR_LEN);
+ if (i > 1)
+ argv_str[i - 2] = '\0';
+ }
+ PUT_LOG_DEBUG(pfilter_protomod, LOG_CAT_L7VSD_PROTOCOL,310,
+ "in_function: int parse(void* pfilter_arg, int argc, char* argv[]):pfilter_arg=&(%s), "
+ "argc=%d, %s", pfilter_arg_str, argc, argv_str);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ /* check null */
+ if (pfilter_arg == NULL) {
+ PUT_LOG_ERROR(pfilter_protomod, LOG_CAT_L7VSD_PROTOCOL,272, "Arg(pfilter_arg) is NULL pointer.");
+ return_value = -1;
+ goto parse_out;
+ }
+ if (argv == NULL) {
+ PUT_LOG_ERROR(pfilter_protomod, LOG_CAT_L7VSD_PROTOCOL,273, "Arg(argv) is NULL pointer.");
+ return_value = -1;
+ goto parse_out;
+ }
+
+ pfilter_service_arg = (struct l7vs_pfilter_service_arg *) pfilter_arg;
+ optind = 0;
+
+ /* check all argument */
+ while ((c = getopt_long(argc, argv, "P:F", opt, NULL)) != -1) {
+ switch (c) {
+ /* --pattern-match / -P */
+ case 'P':
+ /* check maximum length */
+ if (strnlen(optarg, PATTERN_MATCH_MAXSIZE) >= PATTERN_MATCH_MAXSIZE) {
+ PUT_LOG_ERROR(pfilter_protomod, LOG_CAT_L7VSD_PROTOCOL,274,
+ "-P/--pattern-match option value '%s' too long", optarg);
+ return_value = -1;
+ goto parse_out;
+ }
+ /* check minimum length */
+ if (strnlen(optarg, PATTERN_MATCH_MAXSIZE) <= 0 ) {
+ PUT_LOG_ERROR(pfilter_protomod, LOG_CAT_L7VSD_PROTOCOL,275,
+ "-P/--pattern-match option value '%s' invalid", optarg);
+ return_value = -1;
+ goto parse_out;
+ }
+ strncpy(pfilter_service_arg->pattern_match, optarg, PATTERN_MATCH_MAXSIZE);
+ pattern_match_flag++;
+ break;
+
+ /* --read_byte / -R */
+ case 'R':
+ if (sscanf(optarg, "%lu", &buffer) == 0) {
+ PUT_LOG_ERROR(pfilter_protomod, LOG_CAT_L7VSD_PROTOCOL,276,
+ "-R/--read-byte option value '%s' is invalid.", optarg);
+ return_value = -1;
+ goto parse_out;
+ }
+ if (buffer > INT32_MAX) {
+ PUT_LOG_ERROR(pfilter_protomod, LOG_CAT_L7VSD_PROTOCOL,277,
+ "-R/--read-byte option value '%s' is too large.", optarg);
+ return_value = -1;
+ goto parse_out;
+ }
+ else
+ pfilter_service_arg->read_byte = buffer;
+ read_byte_flag++;
+ break;
+
+ /* else error */
+ default:
+ PUT_LOG_ERROR(pfilter_protomod, LOG_CAT_L7VSD_PROTOCOL,278, "Option error.");
+ return_value = -1;
+ goto parse_out;
+ }
+ }
+
+ /* set default read byte */
+ if (read_byte_flag == 0) {
+ pfilter_service_arg->read_byte = 1024;
+ }
+
+ /* set default no reschedule */
+ pfilter_service_arg->reschedule = 0;
+
+ /* no pattern-match value */
+ if (pattern_match_flag == 0) {
+ PUT_LOG_ERROR(pfilter_protomod, LOG_CAT_L7VSD_PROTOCOL,279,
+ "You have to set '--pattern-match' option.");
+ return_value = -1;
+ goto parse_out;
+ }
+ /* same option */
+ if (pattern_match_flag > 1) {
+ PUT_LOG_ERROR(pfilter_protomod, LOG_CAT_L7VSD_PROTOCOL,280,
+ "Cannot set multiple option '--pattern-match/-P'.");
+ return_value = -1;
+ goto parse_out;
+ }
+ /* compile regex */
+ try {
+#ifdef USE_BOOST_XPRESSIVE
+ boost::xpressive::sregex::compile(pfilter_service_arg->pattern_match);
+#else
+ regex.assign(pfilter_service_arg->pattern_match);
+#endif
+ }
+ catch (...) {
+ PUT_LOG_ERROR(pfilter_protomod, LOG_CAT_L7VSD_PROTOCOL,281,
+ "Regex pattern error.");
+ return_value = -1;
+ goto parse_out;
+ }
+
+parse_out:
+ /*-------- DEBUG LOG --------*/
+ if (pfilter_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == pfilter_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ PUT_LOG_DEBUG(pfilter_protomod, LOG_CAT_L7VSD_PROTOCOL,311,
+ "out_function: int parse(void* pfilter_arg, int argc, char* argv[]):return_value=%d",
+ return_value);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return return_value;
+}
+
+/*!
+ * Search pfilter service from pfilter service list using service handle
+ * @param[in] service_handle a unique service ID
+ * @return pfilter service struct when service was found. NULL when service was not found.
+ */
+static struct l7vs_pfilter_service *
+l7vs_protomod_pfilter_search_service(handle_t service_handle)
+{
+ /* pfilter service list counter */
+ int service_number = 0;
+ struct l7vs_pfilter_service* return_value = NULL;
+
+ /*-------- DEBUG LOG --------*/
+ if (pfilter_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == pfilter_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ PUT_LOG_DEBUG(pfilter_protomod, LOG_CAT_L7VSD_PROTOCOL,312,
+ "in_function: struct l7vs_pfilter_service* l7vs_protomod_pfilter_search_service(handle_t service_handle):"
+ "service_handle=%d", service_handle);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ /* check all pfilter service list */
+ for (service_number = 0; service_number < URL_SERVICE_NUMBER; ++service_number) {
+ /* found the service has same service handle */
+ if (pfilter_service_list[service_number] != NULL &&
+ pfilter_service_list[service_number]->service_handle == service_handle) {
+ return_value = pfilter_service_list[service_number];
+ break;
+ }
+ }
+
+ /*-------- DEBUG LOG --------*/
+ if (pfilter_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == pfilter_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ char ssl_str[DEBUG_STR_LEN] = {0};
+ l7vs_pfilter_service_c_str(ssl_str, return_value);
+ PUT_LOG_DEBUG(pfilter_protomod, LOG_CAT_L7VSD_PROTOCOL,313,
+ "out_function: struct l7vs_pfilter_service* l7vs_protomod_pfilter_search_service(handle_t service_handle):"
+ "return_value=&(%s)", ssl_str);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return return_value;
+}
+
+/*!
+ * Create pfilter service.
+ * @param void
+ * @return pfilter service struct when create a service. NULL when cannot create service.
+ */
+static struct l7vs_pfilter_service *
+l7vs_protomod_pfilter_create_service()
+{
+ struct l7vs_pfilter_service* return_value = NULL;
+ int service_number = 0;
+
+ /*-------- DEBUG LOG --------*/
+ if (pfilter_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == pfilter_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ PUT_LOG_DEBUG(pfilter_protomod, LOG_CAT_L7VSD_PROTOCOL,314,
+ "in_function: struct l7vs_pfilter_service* l7vs_protomod_pfilter_create_service()");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ /* check all pfilter service list */
+ for (service_number = 0; service_number < URL_SERVICE_NUMBER - 1; ++service_number) {
+ /* if pointer that does not point NULL exists ... */
+ if (pfilter_service_list[service_number] == NULL) {
+ /* create a service at empty pointer */
+ pfilter_service_list[service_number] = (struct l7vs_pfilter_service *) calloc(1, sizeof(struct l7vs_pfilter_service));
+
+ /*-------- DEBUG LOG --------*/
+ if (pfilter_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == pfilter_protomod.get_log_level(LOG_CAT_L7VSD_SYSTEM_MEMORY)) {
+ PUT_LOG_DEBUG(pfilter_protomod, LOG_CAT_L7VSD_SYSTEM_MEMORY,67, "calloc: addr=%p, size=%ld",
+ pfilter_service_list[service_number], (unsigned long int) sizeof(struct l7vs_pfilter_service));
+ }
+ /*------ DEBUG LOG END ------*/
+
+ if (pfilter_service_list[service_number] == NULL) {
+ PUT_LOG_ERROR(pfilter_protomod, LOG_CAT_L7VSD_SYSTEM_MEMORY,57, "Could not allocate memory.");
+ goto create_service_out;
+ }
+ return_value = pfilter_service_list[service_number];
+ goto create_service_out;
+ }
+ }
+
+ /* all service list is full */
+ PUT_LOG_ERROR(pfilter_protomod, LOG_CAT_L7VSD_PROTOCOL,282, "pfilter service list is full.");
+
+create_service_out:
+ /*-------- DEBUG LOG --------*/
+ if (pfilter_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == pfilter_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ char ssl_str[DEBUG_STR_LEN] = {0};
+ l7vs_pfilter_service_c_str(ssl_str, return_value);
+ PUT_LOG_DEBUG(pfilter_protomod, LOG_CAT_L7VSD_PROTOCOL,315,
+ "out_function: struct l7vs_pfilter_service* l7vs_protomod_pfilter_create_service():"
+ "return_value=&(%s)", ssl_str);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return return_value;
+}
+
+/*!
+ * Create temporary pfilter service.
+ * @param void
+ * @return pfilter service struct when create a service. NULL when cannot create service.
+ */
+static struct l7vs_pfilter_service *
+l7vs_protomod_pfilter_create_temp_service()
+{
+ struct l7vs_pfilter_service* return_value = NULL;
+
+ /*-------- DEBUG LOG --------*/
+ if (pfilter_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == pfilter_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ PUT_LOG_DEBUG(pfilter_protomod, LOG_CAT_L7VSD_PROTOCOL,316,
+ "in_function: struct l7vs_pfilter_service* l7vs_protomod_pfilter_create_temp_service()");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ /* if pointer that does not point NULL exists ... */
+ if (pfilter_service_list[URL_SERVICE_NUMBER - 1] != NULL) {
+ PUT_LOG_ERROR(pfilter_protomod, LOG_CAT_L7VSD_PROTOCOL,283, "Temporary pfilter service is being used by other process.");
+ goto create_temp_service_out;
+ }
+
+ /* create temp service */
+ pfilter_service_list[URL_SERVICE_NUMBER - 1] = (struct l7vs_pfilter_service *) calloc(1, sizeof(struct l7vs_pfilter_service));
+
+ /*-------- DEBUG LOG --------*/
+ if (pfilter_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == pfilter_protomod.get_log_level(LOG_CAT_L7VSD_SYSTEM_MEMORY)) {
+ PUT_LOG_DEBUG(pfilter_protomod, LOG_CAT_L7VSD_SYSTEM_MEMORY,68, "calloc: addr=%p, size=%ld",
+ pfilter_service_list[URL_SERVICE_NUMBER - 1], (unsigned long int) sizeof(struct l7vs_pfilter_service));
+ }
+ /*------ DEBUG LOG END ------*/
+
+ if (pfilter_service_list[URL_SERVICE_NUMBER - 1] == NULL) {
+ PUT_LOG_ERROR(pfilter_protomod, LOG_CAT_L7VSD_SYSTEM_MEMORY,58, "Could not allocate memory");
+ goto create_temp_service_out;
+ }
+
+ return_value = pfilter_service_list[URL_SERVICE_NUMBER - 1];
+
+create_temp_service_out:
+ /*-------- DEBUG LOG --------*/
+ if (pfilter_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == pfilter_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ char ssl_str[DEBUG_STR_LEN] = {0};
+ l7vs_pfilter_service_c_str(ssl_str, return_value);
+ PUT_LOG_DEBUG(pfilter_protomod, LOG_CAT_L7VSD_PROTOCOL,317,
+ "out_function: struct l7vs_pfilter_service* l7vs_protomod_pfilter_create_service():"
+ "return_value=&(%s)", ssl_str);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return return_value;
+}
+
+/*!
+ * Serialize struct l7vs_pfilter_service for debug log.
+ * @param[out] buf serialized string
+ * @param[in] pfilter l7vs_pfilter_service struct
+ */
+static void l7vs_pfilter_service_c_str(char* buf, struct l7vs_pfilter_service* pfilter) {
+ if (pfilter == NULL) {
+ snprintf(buf, DEBUG_STR_LEN, "NULL");
+ }
+ else {
+ snprintf(buf, DEBUG_STR_LEN, "service_handle=%d, pattern_match=\"%s\", "
+ "read_byte=%d, reschedule=%d", pfilter->service_handle, pfilter->pattern_match,
+ pfilter->read_byte, pfilter->reschedule);
+ }
+}
+
+/*!
+ * Serialize struct l7vs_pfilter_service_arg for debug log.
+ * @param[out] buf serialized string
+ * @param[in] pfilter_arg l7vs_pfilter_service_arg struct
+ */
+void l7vs_pfilter_service_arg_c_str(char* buf, struct l7vs_pfilter_service_arg* pfilter_arg) {
+ if (pfilter_arg == NULL) {
+ snprintf(buf, DEBUG_STR_LEN, "NULL");
+ }
+ else {
+ snprintf(buf, DEBUG_STR_LEN, "pattern_match=\"%s\", read_byte=%d, reschedule=%d",
+ pfilter_arg->pattern_match, pfilter_arg->read_byte, pfilter_arg->reschedule);
+ }
+}
--- /dev/null
+/*
+ * @file protomod_sessionless.c
+ * @brief protocol module of any protocol.
+ * @brief this module never keep session persistence.
+ *
+ * L7VSD: Linux Virtual Server for Layer7 Load Balancing
+ * Copyright (C) 2008 NTT COMWARE Corporation.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ **********************************************************************/
+
+#define __STDC_LIMIT_MACROS
+#include <stdlib.h>
+#include <time.h>
+#include <getopt.h>
+#include "l7vs_service.h"
+#include "l7vs_conn.h"
+#include "l7vs_dest.h"
+#include "l7vs_module.h"
+#include "module_http.h"
+
+#define SERVICE_ARG_MAXSIZE (512)
+#define SESSIONLESS_SERVICE_NUMBER (128)
+#define X_FORWARDED_FOR_LENGTH (48)
+
+struct l7vs_sessionless_service {
+ handle_t service_handle;
+ int forwarded_for;
+ int reschedule;
+};
+
+struct l7vs_sessionless_service_arg {
+ int forwarded_for;
+ int reschedule;
+};
+
+static void fini(void);
+static int create(void*, handle_t);
+static void* create_sa(struct l7vs_service_arg*);
+static int compare(handle_t, handle_t);
+static int match_cldata(struct l7vs_service*, struct l7vs_conn*,
+ char*, size_t*, struct l7vs_dest**, int*);
+static int analyze_rsdata(struct l7vs_service*, struct l7vs_conn*,
+ char*, size_t*);
+static int destroy(handle_t);
+static void destroy_sa(void**);
+static int service_arg(struct l7vs_service_arg_multi*, handle_t);
+static int parse(void*, int, char**);
+
+static struct l7vs_sessionless_service *l7vs_protomod_sessionless_search_service(handle_t);
+static struct l7vs_sessionless_service *l7vs_protomod_sessionless_create_service();
+static struct l7vs_sessionless_service *l7vs_protomod_sessionless_create_temp_service();
+
+static void l7vs_sessionless_service_c_str(char*, struct l7vs_sessionless_service*);
+static void l7vs_sessionless_service_arg_c_str(char*, struct l7vs_sessionless_service_arg*);
+
+struct l7vs_sessionless_service *sessionless_service_list[SESSIONLESS_SERVICE_NUMBER];
+
+static struct l7vs_protomod sessionless_protomod = {
+ NULL, /* handle */
+ "sessionless", /* modname */
+ 0, /* refcnt */
+ 1, /* fast schedule */
+ create, /* create function */
+ compare, /* compare function */
+ match_cldata, /* match_cldata function */
+ analyze_rsdata, /* analyze_rsdata function */
+ destroy, /* destroy function */
+ fini, /* fini function */
+ create_sa, /* create_sa function */
+ service_arg, /* service_arg function */
+ parse, /* parse function */
+ destroy_sa, /* destroy_sa function */
+ NULL, /* initialize function */
+ NULL, /* finalize function */
+ NULL, /* get_log_level function */
+ NULL, /* put_log_debug function */
+ NULL, /* put_log_info function */
+ NULL, /* put_log_warn function */
+ NULL, /* put_log_error function */
+ NULL /* put_log_fatal function */
+};
+
+/*!
+ * Protocol module initialize function. This function run when dlopen and dlsym at first time.
+ * @param[in] handle dlopen's handle
+ * @return l7vs_protomod struct
+ */
+extern "C" struct l7vs_protomod *
+init(void *handle)
+{
+ struct l7vs_protomod* return_value = NULL;
+
+ /*-------- DEBUG LOG --------*/
+ if (sessionless_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == sessionless_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ PUT_LOG_DEBUG(sessionless_protomod, LOG_CAT_L7VSD_PROTOCOL,59,
+ "in_function: struct l7vs_protomod* init(void* handle): handle=%p", handle);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ /* check null */
+ if (handle == NULL) {
+ PUT_LOG_ERROR(sessionless_protomod, LOG_CAT_L7VSD_PROTOCOL,51, "Arg(handle) is NULL pointer.");
+ goto init_out;
+ }
+
+ /* initialize sessionless service list */
+ memset(sessionless_service_list, 0, sizeof(struct l7vs_sessionless_service *) * SESSIONLESS_SERVICE_NUMBER);
+ /* set dlopen's handle */
+ sessionless_protomod.handle = handle;
+
+ return_value = &sessionless_protomod;
+
+init_out:
+ /*-------- DEBUG LOG --------*/
+ if (sessionless_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == sessionless_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ char protomod_str[DEBUG_STR_LEN] = {0};
+ l7vs_protomod_c_str(protomod_str, &sessionless_protomod);
+ PUT_LOG_DEBUG(sessionless_protomod, LOG_CAT_L7VSD_PROTOCOL,60,
+ "out_function: struct l7vs_protomod* init(void* handle): return=&(%s)", protomod_str);
+ }
+ /*------ DEBUG LOG END ------*/
+ return return_value;
+}
+
+/*!
+ * Protocol module finalize function. free all sessionless service list just in case.
+ * @param void
+ * @return void
+ */
+static void
+fini(void)
+{
+ /* sessionless service list counter */
+ int service_number = 0;
+
+ /*-------- DEBUG LOG --------*/
+ if (sessionless_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == sessionless_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ PUT_LOG_DEBUG(sessionless_protomod, LOG_CAT_L7VSD_PROTOCOL,61, "in_function: void fini(void)");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ /* check all sessionless service list */
+ for (service_number = 0; service_number < SESSIONLESS_SERVICE_NUMBER; ++service_number) {
+ /* if pointer that does not point NULL exists ... */
+ if (sessionless_service_list[service_number] != NULL) {
+ /*-------- DEBUG LOG --------*/
+ if (sessionless_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == sessionless_protomod.get_log_level(LOG_CAT_L7VSD_SYSTEM_MEMORY)) {
+ PUT_LOG_DEBUG(sessionless_protomod, LOG_CAT_L7VSD_SYSTEM_MEMORY,20, "free: %p",
+ sessionless_service_list[service_number]);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ /* free and points NULL */
+ free(sessionless_service_list[service_number]);
+ sessionless_service_list[service_number] = NULL;
+ }
+ }
+
+ /*-------- DEBUG LOG --------*/
+ if (sessionless_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == sessionless_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ PUT_LOG_DEBUG(sessionless_protomod, LOG_CAT_L7VSD_PROTOCOL,62, "out_function: void fini(void)");
+ }
+ /*------ DEBUG LOG END ------*/
+}
+
+/*!
+ * Create sessionless service struct.
+ * @param[in] sessionless_arg sessionless service argument struct
+ * @param[in] service_handle a unique service ID
+ * @retval 0 successfully create sessionless service.
+ * @retval -1 some errors occur.
+ */
+static int
+create(void *sessionless_arg, handle_t service_handle)
+{
+ struct l7vs_sessionless_service *sessionless_service;
+ struct l7vs_sessionless_service_arg *sessionless_service_arg;
+ int return_value = 0;
+
+ /*-------- DEBUG LOG --------*/
+ if (sessionless_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == sessionless_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ char sessionless_arg_str[DEBUG_STR_LEN] = {0};
+ l7vs_sessionless_service_arg_c_str(sessionless_arg_str, (struct l7vs_sessionless_service_arg*) sessionless_arg);
+ PUT_LOG_DEBUG(sessionless_protomod, LOG_CAT_L7VSD_PROTOCOL,63,
+ "in_function: int create(void* sessionless_arg, handle_t service_handle):sessionless_arg=&(%s), "
+ "service_handle=%d", sessionless_arg_str, service_handle);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ /* check null */
+ if (sessionless_arg == NULL) {
+ PUT_LOG_ERROR(sessionless_protomod, LOG_CAT_L7VSD_PROTOCOL,52, "Arg(sessionless_arg) is NULL pointer.");
+ return_value = -1;
+ goto create_out;
+ }
+
+
+ if (service_handle != TEMP_SERVICEHANDLE) {
+ /* search empty sessionless service list and create sessionless service */
+ sessionless_service = l7vs_protomod_sessionless_create_service();
+ } else {
+ /* create temporary sessionless service */
+ sessionless_service = l7vs_protomod_sessionless_create_temp_service();
+ }
+
+ /*-------- DEBUG LOG --------*/
+ if (sessionless_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == sessionless_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ char sessionless_str[DEBUG_STR_LEN] = {0};
+ l7vs_sessionless_service_c_str(sessionless_str, sessionless_service);
+ PUT_LOG_DEBUG(sessionless_protomod, LOG_CAT_L7VSD_PROTOCOL,64, "pointer assign: sessionless_service=&(%s)",
+ sessionless_str);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ if (sessionless_service == NULL) {
+ PUT_LOG_ERROR(sessionless_protomod, LOG_CAT_L7VSD_PROTOCOL,53, "Could not make sessionless service.");
+ return_value = -1;
+ goto create_out;
+ }
+
+ sessionless_service_arg = (struct l7vs_sessionless_service_arg *) sessionless_arg;
+
+ /* set service handle */
+ sessionless_service->service_handle = service_handle;
+ /* set x-forwarded-for flag */
+ sessionless_service->forwarded_for = sessionless_service_arg->forwarded_for;
+ /* set reschedule */
+ sessionless_service->reschedule = sessionless_service_arg->reschedule;
+
+create_out:
+ /*-------- DEBUG LOG --------*/
+ if (sessionless_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == sessionless_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ PUT_LOG_DEBUG(sessionless_protomod, LOG_CAT_L7VSD_PROTOCOL,65,
+ "out_function: int create(void* sessionless_arg, handle_t service_handle):return_value=%d",
+ return_value);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return return_value;
+}
+
+/*!
+ * Create sessionless service argument struct.
+ * @param[out] srv_arg service argument struct
+ * @return sessionless service argument struct
+ */
+static void *
+create_sa(struct l7vs_service_arg *srv_arg)
+{
+ struct l7vs_sessionless_service_arg *sessionless_service_arg;
+
+ /*-------- DEBUG LOG --------*/
+ if (sessionless_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == sessionless_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ char service_arg_str[DEBUG_STR_LEN] = {0};
+ l7vs_service_arg_c_str(service_arg_str, srv_arg);
+ PUT_LOG_DEBUG(sessionless_protomod, LOG_CAT_L7VSD_PROTOCOL,66,
+ "in_function: void* create_sa(struct l7vs_service_arg* srv_arg):srv_arg=&(%s)",
+ service_arg_str);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ /* check null */
+ if (srv_arg == NULL) {
+ PUT_LOG_ERROR(sessionless_protomod, LOG_CAT_L7VSD_PROTOCOL,54, "Arg(srv_arg) is NULL pointer.");
+ sessionless_service_arg = NULL;
+ goto create_sa_out;
+ }
+
+ /* create sessionless service argument struct */
+ sessionless_service_arg = (struct l7vs_sessionless_service_arg *) calloc(1, sizeof(struct l7vs_sessionless_service_arg));
+
+ /*-------- DEBUG LOG --------*/
+ if (sessionless_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == sessionless_protomod.get_log_level(LOG_CAT_L7VSD_SYSTEM_MEMORY)) {
+ PUT_LOG_DEBUG(sessionless_protomod, LOG_CAT_L7VSD_SYSTEM_MEMORY,21, "calloc: addr=%p, size=%ld",
+ sessionless_service_arg, (unsigned long int) sizeof(struct l7vs_sessionless_service_arg));
+ }
+ /*------ DEBUG LOG END ------*/
+
+ if (sessionless_service_arg == NULL) {
+ PUT_LOG_ERROR(sessionless_protomod, LOG_CAT_L7VSD_SYSTEM_MEMORY,19, "Could not allocate memory.");
+ goto create_sa_out;
+ }
+
+ /* set sessionless service argument size and protomod name "sessionless" */
+ srv_arg->len = sizeof(struct l7vs_sessionless_service_arg);
+ strcpy(srv_arg->protomod, sessionless_protomod.modname);
+
+create_sa_out:
+ /*-------- DEBUG LOG --------*/
+ if (sessionless_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == sessionless_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ char sessionless_service_arg_str[DEBUG_STR_LEN] = {0};
+ l7vs_sessionless_service_arg_c_str(sessionless_service_arg_str, sessionless_service_arg);
+ PUT_LOG_DEBUG(sessionless_protomod, LOG_CAT_L7VSD_PROTOCOL,67,
+ "out_function: void* create_sa(struct l7vs_service_arg* srv_arg):return_value=&(%s)",
+ sessionless_service_arg_str);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return (void *) sessionless_service_arg;
+}
+
+/*!
+ * Compare two service.
+ * @param[in] srv_handle1 one of a unique service ID
+ * @param[in] srv_handle2 one of a unique service ID
+ * @retval 0 they matched perfectly.
+ * @retval -1 they are different.
+ */
+static int
+compare(handle_t srv_handle1, handle_t srv_handle2)
+{
+ int return_value = 0;
+
+ /*-------- DEBUG LOG --------*/
+ if (sessionless_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == sessionless_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ PUT_LOG_DEBUG(sessionless_protomod, LOG_CAT_L7VSD_PROTOCOL,68,
+ "in_function: int compare(handle_t srv_handle1, handle_t srv_handle2):"
+ "srv_handle1=%u, srv_handle2=%u", srv_handle1, srv_handle2);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ /*-------- DEBUG LOG --------*/
+ if (sessionless_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == sessionless_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ PUT_LOG_DEBUG(sessionless_protomod, LOG_CAT_L7VSD_PROTOCOL,69,
+ "out_function: int compare(handle_t srv_handle1, handle_t srv_handle2):return_value=%d",
+ return_value);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return return_value;
+}
+
+/*!
+ * Do not check the request packet.
+ * @param[in] srv service struct include service handle, protocol module and schedule module.
+ * @param[in] conn connection data.
+ * @param[in] request packet data from client
+ * @param[in] len length of packet data
+ * @param[out] dest destination (real server) list
+ * @param[out] tcps TCP Splicer flag
+ * @retval 0 successfully check packet data
+ * @retval -1 some errors occur.
+ */
+static int
+match_cldata(struct l7vs_service *srv, struct l7vs_conn *conn,
+ char *request, size_t *len, struct l7vs_dest **dest, int *tcps)
+{
+ struct l7vs_sessionless_service *sessionless_service;
+ int ret;
+ int offset_length;
+ char *x_forwarded_value;
+ char *next_line = NULL;
+ char x_forwarded_for_header[X_FORWARDED_FOR_LENGTH];
+ size_t uri_len = 0;
+ int return_value = 0;
+
+ /*-------- DEBUG LOG --------*/
+ if (sessionless_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == sessionless_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ char srv_str[DEBUG_STR_LEN] = {0};
+ char conn_str[DEBUG_STR_LEN] = {0};
+ char dest_str[DEBUG_STR_LEN] = {0};
+ char len_str[DEBUG_STR_LEN] = {0};
+ l7vs_service_c_str(srv_str, srv);
+ l7vs_conn_c_str(conn_str, conn);
+ if (dest != NULL) {
+ l7vs_dest_c_str(dest_str, *dest);
+ }
+ else {
+ strncpy(dest_str, "NULL", DEBUG_STR_LEN);
+ }
+ if (len != NULL) {
+ snprintf(len_str, DEBUG_STR_LEN, "%lu", (unsigned long int) *len);
+ }
+ else {
+ strncpy(len_str, "NULL", DEBUG_STR_LEN);
+ }
+ PUT_LOG_DEBUG(sessionless_protomod, LOG_CAT_L7VSD_PROTOCOL,70,
+ "in_function: int match_cldata(struct l7vs_service* srv, struct l7vs_conn* conn, "
+ "char* request, size_t* len, struct l7vs_dest** dest, int* tcps):srv=&(%s), conn=&(%s), "
+ "request=\"%s\", len=&(%s), dest=&(&(%s)), tcps=&(%d)",
+ srv_str, conn_str, request, len_str, dest_str, *tcps);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ /* check null */
+ if (srv == NULL) {
+ PUT_LOG_ERROR(sessionless_protomod, LOG_CAT_L7VSD_PROTOCOL,55, "Arg(srv) is NULL pointer.");
+ return_value = -1;
+ goto match_cldata_out;
+ }
+ if (srv->pm == NULL) {
+ PUT_LOG_ERROR(sessionless_protomod, LOG_CAT_L7VSD_PROTOCOL,56, "Arg(srv->pm) is NULL pointer.");
+ return_value = -1;
+ goto match_cldata_out;
+ }
+ if (request == NULL) {
+ PUT_LOG_ERROR(sessionless_protomod, LOG_CAT_L7VSD_PROTOCOL,57, "Arg(request) is NULL pointer.");
+ return_value = -1;
+ goto match_cldata_out;
+ }
+ if (len == NULL) {
+ PUT_LOG_ERROR(sessionless_protomod, LOG_CAT_L7VSD_PROTOCOL,58, "Arg(len) is NULL pointer.");
+ return_value = -1;
+ goto match_cldata_out;
+ }
+ if (dest == NULL) {
+ PUT_LOG_ERROR(sessionless_protomod, LOG_CAT_L7VSD_PROTOCOL,59, "Arg(dest) is NULL pointer.");
+ return_value = -1;
+ goto match_cldata_out;
+ }
+ if (tcps == NULL) {
+ PUT_LOG_ERROR(sessionless_protomod, LOG_CAT_L7VSD_PROTOCOL,60, "Arg(tcps) is NULL pointer.");
+ return_value = -1;
+ goto match_cldata_out;
+ }
+
+ /* search service that has such a service ID */
+ sessionless_service = l7vs_protomod_sessionless_search_service(srv->handle);
+
+ /*-------- DEBUG LOG --------*/
+ if (sessionless_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == sessionless_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ char sessionless_str[DEBUG_STR_LEN] = {0};
+ l7vs_sessionless_service_c_str(sessionless_str, sessionless_service);
+ PUT_LOG_DEBUG(sessionless_protomod, LOG_CAT_L7VSD_PROTOCOL,71, "pointer assign: sessionless_service=&(%s)",
+ sessionless_str);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ if (sessionless_service == NULL) {
+ PUT_LOG_ERROR(sessionless_protomod, LOG_CAT_L7VSD_PROTOCOL,61, "Could not find such service handle's sessionless service.");
+ return_value = -1;
+ goto match_cldata_out;
+ }
+
+ /* initialize protocol module ... clear destination list */
+ ret = srv->pm->initialize(srv, conn, request, *len, dest);
+ if (ret != 0){
+ PUT_LOG_ERROR(sessionless_protomod, LOG_CAT_L7VSD_PROTOCOL,62, "Could not initialize protomod.");
+ return_value = -1;
+ goto match_cldata_out;
+ }
+
+ /* set X-Forwarded-For field */
+ if (sessionless_service->forwarded_for) {
+ uri_len = *len;
+ /* check request */
+ if (http_check_request_method(request, &uri_len) == NULL)
+ goto match_cldata_finalize;
+
+ x_forwarded_value = http_search_header_field(request, "X-Forwarded-For");
+
+ /* already exists X-Forwarded-For field */
+ if (x_forwarded_value) {
+ next_line = http_skip_header_line(x_forwarded_value);
+ /* backtrack to look up insert point */
+ if (next_line) {
+ next_line--; // *next_line == '\n'
+ if (*(next_line - 1) == '\r') {
+ next_line--;
+ }
+ /* append client IP address */
+ snprintf(x_forwarded_for_header, X_FORWARDED_FOR_LENGTH, ", %s", inet_ntoa(conn->caddr.sin_addr));
+ }
+ }
+
+ /* not exists X-Forwarded-For field */
+ if (!next_line) {
+ /* construct new X-Forwarded-For header item */
+ snprintf(x_forwarded_for_header, X_FORWARDED_FOR_LENGTH, "X-Forwarded-For: %s\r\n", inet_ntoa(conn->caddr.sin_addr));
+
+ next_line = http_skip_header_line(request);
+ }
+
+ /* when insert point exist */
+ if (next_line != NULL) {
+ offset_length = (int) (next_line - request);
+
+ /* insert X-Forwarded-For header field */
+ http_insert_field(request, offset_length, x_forwarded_for_header, *len);
+
+ /* add header length */
+ *len += strlen(x_forwarded_for_header);
+ }
+ }
+
+match_cldata_finalize:
+ *tcps = 0;
+
+ /* finalize, always set reschedule flag */
+ ret = srv->pm->finalize(srv, conn, request, *len, dest, 1);
+
+ if (ret != 0){
+ PUT_LOG_INFO(sessionless_protomod, LOG_CAT_L7VSD_PROTOCOL,10, "Could not finalize protomod. (Realserver decision failure)");
+ return_value = -1;
+ goto match_cldata_out;
+ }
+
+match_cldata_out:
+ /*-------- DEBUG LOG --------*/
+ if (sessionless_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == sessionless_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ PUT_LOG_DEBUG(sessionless_protomod, LOG_CAT_L7VSD_PROTOCOL,72,
+ "out_function: int match_cldata(struct l7vs_service* srv, struct l7vs_conn* conn, "
+ "char* request, size_t* len, struct l7vs_dest** dest, int* tcps):return_value=%d",
+ return_value);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return return_value;
+}
+
+/*!
+ * Do nothing.
+ * @param[in] srv service struct include service handle, protocol module and schedule module.
+ * @param[in] conn connection data.
+ * @param[in] response packet data from real server
+ * @param[in] len length of packet data. it will be lengthened.
+ * @retval 0 successfully check packet data.
+ * @retval -1 some errors occur.
+ */
+static int
+analyze_rsdata(struct l7vs_service *srv, struct l7vs_conn *conn,
+ char *response, size_t *len)
+{
+ int return_value = 0;
+
+ /*-------- DEBUG LOG --------*/
+ if (sessionless_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == sessionless_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ char srv_str[DEBUG_STR_LEN] = {0};
+ char conn_str[DEBUG_STR_LEN] = {0};
+ char len_str[DEBUG_STR_LEN] = {0};
+ l7vs_service_c_str(srv_str, srv);
+ l7vs_conn_c_str(conn_str, conn);
+ if (len != NULL) {
+ snprintf(len_str, DEBUG_STR_LEN, "%lu", (unsigned long int) *len);
+ }
+ else {
+ strncpy(len_str, "NULL", DEBUG_STR_LEN);
+ }
+ PUT_LOG_DEBUG(sessionless_protomod, LOG_CAT_L7VSD_PROTOCOL,73,
+ "in_function: int analyze_rsdata(struct l7vs_service* srv, struct l7vs_conn* conn, "
+ "char* response, size_t* len):srv=&(%s), conn=&(%s), response=\"%s\", len=&(%s)",
+ srv_str, conn_str, response, len_str);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ /* check null */
+ if (srv == NULL) {
+ PUT_LOG_ERROR(sessionless_protomod, LOG_CAT_L7VSD_PROTOCOL,64, "Arg(srv) is NULL pointer.");
+ return_value = -1;
+ goto analyze_rsdata_out;
+ }
+ if (conn == NULL) {
+ PUT_LOG_ERROR(sessionless_protomod, LOG_CAT_L7VSD_PROTOCOL,65, "Arg(conn) is NULL pointer.");
+ return_value = -1;
+ goto analyze_rsdata_out;
+ }
+ if (conn->dest == NULL) {
+ PUT_LOG_ERROR(sessionless_protomod, LOG_CAT_L7VSD_PROTOCOL,66, "Arg(conn->dest) is NULL pointer.");
+ return_value = -1;
+ goto analyze_rsdata_out;
+ }
+ if (response == NULL) {
+ PUT_LOG_ERROR(sessionless_protomod, LOG_CAT_L7VSD_PROTOCOL,67, "Arg(response) is NULL pointer.");
+ return_value = -1;
+ goto analyze_rsdata_out;
+ }
+ if (len == NULL) {
+ PUT_LOG_ERROR(sessionless_protomod, LOG_CAT_L7VSD_PROTOCOL,68, "Arg(len) is NULL pointer.");
+ return_value = -1;
+ goto analyze_rsdata_out;
+ }
+
+ /* sorry flag check */
+ if (conn->sorry_conn_flag == 1) {
+ /*-------- DEBUG LOG --------*/
+ if (sessionless_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == sessionless_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ PUT_LOG_DEBUG(sessionless_protomod, LOG_CAT_L7VSD_PROTOCOL,74, "Response from sorry server.");
+ }
+ /*------ DEBUG LOG END ------*/
+ goto analyze_rsdata_out;
+ }
+
+analyze_rsdata_out:
+ /*-------- DEBUG LOG --------*/
+ if (sessionless_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == sessionless_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ PUT_LOG_DEBUG(sessionless_protomod, LOG_CAT_L7VSD_PROTOCOL,75,
+ "out_function: int analyze_rsdata(struct l7vs_service* srv, struct l7vs_conn* conn, "
+ "char* response, size_t* len):return_value=%d", return_value);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return return_value;
+}
+
+/*!
+ * Destroy sessionless service
+ * @param[in] srv_handle a unique service ID
+ * @retval 0 successfully check packet data.
+ * @retval -1 some errors occur.
+ */
+static int
+destroy(handle_t srv_handle)
+{
+ /* sessionless service list counter */
+ int service_number = 0;
+ int free_flag = 0;
+ int return_value = 0;
+
+ /*-------- DEBUG LOG --------*/
+ if (sessionless_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == sessionless_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ PUT_LOG_DEBUG(sessionless_protomod, LOG_CAT_L7VSD_PROTOCOL,76,
+ "in_function: int destroy(handle_t srv_handle):srv_handle=%u",
+ srv_handle);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ /* check all sessionless service list */
+ for (service_number = 0; service_number < SESSIONLESS_SERVICE_NUMBER; ++service_number) {
+ /* found sessionless service that has srv_handle */
+ if (sessionless_service_list[service_number] != NULL &&
+ sessionless_service_list[service_number]->service_handle == srv_handle) {
+
+ /* free and NULL */
+ free(sessionless_service_list[service_number]);
+ sessionless_service_list[service_number] = NULL;
+
+ free_flag = 1;
+ break;
+ }
+ }
+
+ /* sessionless service was not found */
+ if (free_flag == 0) {
+ PUT_LOG_ERROR(sessionless_protomod, LOG_CAT_L7VSD_PROTOCOL,69, "Could not find such service handle's sessionless service.");
+ return_value = -1;
+ goto destroy_out;
+ }
+
+destroy_out:
+ /*-------- DEBUG LOG --------*/
+ if (sessionless_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == sessionless_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ PUT_LOG_DEBUG(sessionless_protomod, LOG_CAT_L7VSD_PROTOCOL,77,
+ "out_function: int destroy(handle_t srv_handle):return_value=%d",
+ srv_handle);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return return_value;
+}
+
+/*!
+ * Destroy sessionless service argument
+ * @param[in] sessionless_arg sessionless service argument
+ * @return void
+ */
+static void
+destroy_sa(void **sessionless_arg)
+{
+ /*-------- DEBUG LOG --------*/
+ if (sessionless_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == sessionless_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ char sessionless_arg_str[DEBUG_STR_LEN] = {0};
+ if (sessionless_arg != NULL) {
+ l7vs_sessionless_service_arg_c_str(sessionless_arg_str, (struct l7vs_sessionless_service_arg*) *sessionless_arg);
+ }
+ else {
+ strncpy(sessionless_arg_str, "NULL", DEBUG_STR_LEN);
+ }
+ PUT_LOG_DEBUG(sessionless_protomod, LOG_CAT_L7VSD_PROTOCOL,78,
+ "in_function: void destroy_sa(void** sessionless_arg):sessionless_arg=&(&(%s))",
+ sessionless_arg_str);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ /* check null */
+ if (sessionless_arg == NULL) {
+ PUT_LOG_ERROR(sessionless_protomod, LOG_CAT_L7VSD_PROTOCOL,70, "Arg(sessionless_arg) is NULL pointer.");
+ }
+ else if (*sessionless_arg == NULL) {
+ PUT_LOG_ERROR(sessionless_protomod, LOG_CAT_L7VSD_PROTOCOL,71, "Arg(*sessionless_arg) is NULL pointer.");
+ }
+ else {
+ /*-------- DEBUG LOG --------*/
+ if (sessionless_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == sessionless_protomod.get_log_level(LOG_CAT_L7VSD_SYSTEM_MEMORY)) {
+ PUT_LOG_DEBUG(sessionless_protomod, LOG_CAT_L7VSD_SYSTEM_MEMORY,22, "free: %p",
+ *sessionless_arg);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ /* free and NULL */
+ free((struct l7vs_sessionless_service_arg*) *sessionless_arg);
+ *sessionless_arg = NULL;
+ }
+
+ /*-------- DEBUG LOG --------*/
+ if (sessionless_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == sessionless_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ PUT_LOG_DEBUG(sessionless_protomod, LOG_CAT_L7VSD_PROTOCOL,79,
+ "out_function: void destroy_sa(void** sessionless_arg)");
+ }
+ /*------ DEBUG LOG END ------*/
+}
+
+/*!
+ * Create strings for service list of l7vsadm
+ * @param[out] srv_arg service argument struct
+ * @param[in] srv_handle a unique service ID
+ * @retval 0 successfully create strings
+ * @retval -1 some errors occur.
+ */
+static int
+service_arg(struct l7vs_service_arg_multi *srv_arg_mt, handle_t srv_handle)
+{
+ struct l7vs_sessionless_service *sessionless_service;
+ struct l7vs_sessionless_service_arg c_sarg;
+ char sessionless_argument[SERVICE_ARG_MAXSIZE];
+ int return_value = 0;
+
+ /*-------- DEBUG LOG --------*/
+ if (sessionless_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == sessionless_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ char srv_arg_mt_str[DEBUG_STR_LEN] = {0};
+ l7vs_service_arg_multi_c_str(srv_arg_mt_str, srv_arg_mt);
+ PUT_LOG_DEBUG(sessionless_protomod, LOG_CAT_L7VSD_PROTOCOL,80,
+ "in_function: int service_arg(struct l7vs_service_arg_multi* srv_arg_mt, "
+ "handle_t srv_handle):srv_arg_mt=&(%s), srv_handle=%u",
+ srv_arg_mt_str, srv_handle);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ /* check null */
+ if (srv_arg_mt == NULL) {
+ PUT_LOG_ERROR(sessionless_protomod, LOG_CAT_L7VSD_PROTOCOL,72, "Arg(srv_arg_mt) is NULL pointer.");
+ return_value = -1;
+ goto service_arg_out;
+ }
+
+ /* search service that has such a service ID */
+ sessionless_service = l7vs_protomod_sessionless_search_service(srv_handle);
+
+ /*-------- DEBUG LOG --------*/
+ if (sessionless_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == sessionless_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ char sessionless_str[DEBUG_STR_LEN] = {0};
+ l7vs_sessionless_service_c_str(sessionless_str, sessionless_service);
+ PUT_LOG_DEBUG(sessionless_protomod, LOG_CAT_L7VSD_PROTOCOL,81, "pointer assign: sessionless_service=&(%s)",
+ sessionless_str);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ if (sessionless_service == NULL) {
+ PUT_LOG_ERROR(sessionless_protomod, LOG_CAT_L7VSD_PROTOCOL,73, "Could not find such service handle's sessionless service.");
+ return_value = -1;
+ goto service_arg_out;
+ }
+
+ /* initialize argument strings */
+ memset(sessionless_argument, 0, SERVICE_ARG_MAXSIZE);
+
+ /* set sessionless args to service argument struct */
+ srv_arg_mt->srv_arg.reschedule = sessionless_service->reschedule;
+
+ /* create long argument (l7vsadm option -L/-l) */
+ strncpy(srv_arg_mt->srv_arg.protomod_key_string, "", 256);
+
+ /* create verbose argument (l7vsadm option -V/-v) */
+ strncpy(srv_arg_mt->srv_arg.protomod_opt_string, "", 512);
+ if (sessionless_service->forwarded_for) {
+ strncpy(srv_arg_mt->srv_arg.protomod_opt_string, "--forwarded-for", 512);
+ }
+
+ c_sarg.reschedule = sessionless_service->reschedule;
+
+ memcpy(srv_arg_mt->protomod_arg, &c_sarg, sizeof(struct l7vs_sessionless_service_arg));
+
+ /*-------- DEBUG LOG --------*/
+ if (sessionless_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == sessionless_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ char sessionless_arg_str[DEBUG_STR_LEN] = {0};
+ l7vs_sessionless_service_arg_c_str(sessionless_arg_str, &c_sarg);
+ PUT_LOG_DEBUG(sessionless_protomod, LOG_CAT_L7VSD_PROTOCOL,82,
+ "pointer assign: srv_arg_mt->protomod_arg=&(%s)", sessionless_arg_str);
+ }
+ /*------ DEBUG LOG END ------*/
+
+service_arg_out:
+ /*-------- DEBUG LOG --------*/
+ if (sessionless_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == sessionless_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ PUT_LOG_DEBUG(sessionless_protomod, LOG_CAT_L7VSD_PROTOCOL,83,
+ "out_function: int service_arg(struct l7vs_service_arg_multi* srv_arg_mt, "
+ "handle_t srv_handle):return_value=%d", return_value);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return return_value;
+}
+
+/*!
+ * Parse l7vsadm options to sessionless argument
+ * @param[out] sessionless_arg sessionless service argument struct
+ * @param[in] argc number of l7vsadm argument
+ * @param[in] argv l7vsadm argument list
+ * @retval 0 successfully parse argument
+ * @retval -1 some errors occur.
+ */
+static int
+parse(void *sessionless_arg, int argc, char *argv[])
+{
+ struct l7vs_sessionless_service_arg *sessionless_service_arg;
+ static struct option opt[] = {
+ {"forwarded-for", no_argument, NULL, 'F'},
+ {NULL, 0, NULL, 0 }
+ };
+ int c;
+ int return_value = 0;
+ int forwarded_for_flag = 0;
+
+ /*-------- DEBUG LOG --------*/
+ if (sessionless_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == sessionless_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ int i;
+ char argv_str[DEBUG_STR_LEN] = {0};
+ char sessionless_arg_str[DEBUG_STR_LEN] = {0};
+ l7vs_sessionless_service_arg_c_str(sessionless_arg_str, (struct l7vs_sessionless_service_arg*) sessionless_arg);
+ argv_str[0] = '\0';
+ if (argv == NULL)
+ snprintf(argv_str, DEBUG_STR_LEN, "NULL");
+ else {
+ for (i = 0; i < argc; i++) {
+ snprintf(argv_str, DEBUG_STR_LEN, "%sargv[%d]=\"%s\", ", argv_str, i, argv[i]);
+ }
+ i = strnlen(argv_str, DEBUG_STR_LEN);
+ if (i > 1)
+ argv_str[i - 2] = '\0';
+ }
+ PUT_LOG_DEBUG(sessionless_protomod, LOG_CAT_L7VSD_PROTOCOL,84,
+ "in_function: int parse(void* sessionless_arg, int argc, char* argv[]):sessionless_arg=&(%s), "
+ "argc=%d, %s", sessionless_arg_str, argc, argv_str);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ /* check null */
+ if (sessionless_arg == NULL) {
+ PUT_LOG_ERROR(sessionless_protomod, LOG_CAT_L7VSD_PROTOCOL,74, "Arg(sessionless_arg) is NULL pointer.");
+ return_value = -1;
+ goto parse_out;
+ }
+ if (argv == NULL) {
+ PUT_LOG_ERROR(sessionless_protomod, LOG_CAT_L7VSD_PROTOCOL,75, "Arg(argv) is NULL pointer.");
+ return_value = -1;
+ goto parse_out;
+ }
+
+ sessionless_service_arg = (struct l7vs_sessionless_service_arg *) sessionless_arg;
+ optind = 0;
+
+ /* check all argument */
+ while ((c = getopt_long(argc, argv, "F", opt, NULL)) != -1) {
+ switch (c) {
+ /* --forwarded-for / -F */
+ case 'F':
+ /* x-forwarded-for on */
+ sessionless_service_arg->forwarded_for = 1;
+ forwarded_for_flag++;
+ break;
+ /* else error */
+ default:
+ PUT_LOG_ERROR(sessionless_protomod, LOG_CAT_L7VSD_PROTOCOL,76, "Option error.");
+ return_value = -1;
+ goto parse_out;
+ }
+ }
+
+ /* set default reschedule */
+ sessionless_service_arg->reschedule = 1;
+
+ /* set default no forwarded_for */
+ if (forwarded_for_flag == 0) {
+ sessionless_service_arg->forwarded_for = 0;
+ }
+
+parse_out:
+ /*-------- DEBUG LOG --------*/
+ if (sessionless_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == sessionless_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ PUT_LOG_DEBUG(sessionless_protomod, LOG_CAT_L7VSD_PROTOCOL,85,
+ "out_function: int parse(void* sessionless_arg, int argc, char* argv[]):return_value=%d",
+ return_value);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return return_value;
+}
+
+/*!
+ * Search sessionless service from sessionless service list using service handle
+ * @param[in] service_handle a unique service ID
+ * @return sessionless service struct when service was found. NULL when service was not found.
+ */
+static struct l7vs_sessionless_service *
+l7vs_protomod_sessionless_search_service(handle_t service_handle)
+{
+ /* sessionless service list counter */
+ int service_number = 0;
+ struct l7vs_sessionless_service* return_value = NULL;
+
+ /*-------- DEBUG LOG --------*/
+ if (sessionless_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == sessionless_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ PUT_LOG_DEBUG(sessionless_protomod, LOG_CAT_L7VSD_PROTOCOL,86,
+ "in_function: struct l7vs_sessionless_service* l7vs_protomod_sessionless_search_service(handle_t service_handle):"
+ "service_handle=%d", service_handle);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ /* check all sessionless service list */
+ for (service_number = 0; service_number < SESSIONLESS_SERVICE_NUMBER; ++service_number) {
+ /* found the service has same service handle */
+ if (sessionless_service_list[service_number] != NULL &&
+ sessionless_service_list[service_number]->service_handle == service_handle) {
+ return sessionless_service_list[service_number];
+ }
+ }
+
+ /*-------- DEBUG LOG --------*/
+ if (sessionless_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == sessionless_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ char ssl_str[DEBUG_STR_LEN] = {0};
+ l7vs_sessionless_service_c_str(ssl_str, return_value);
+ PUT_LOG_DEBUG(sessionless_protomod, LOG_CAT_L7VSD_PROTOCOL,87,
+ "out_function: struct l7vs_sessionless_service* l7vs_protomod_sessionless_search_service(handle_t service_handle):"
+ "return_value=&(%s)", ssl_str);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return return_value;
+}
+
+/*!
+ * Create sessionless service.
+ * @param void
+ * @return sessionless service struct when create a service. NULL when cannot create service.
+ */
+static struct l7vs_sessionless_service *
+l7vs_protomod_sessionless_create_service()
+{
+ /* sessionless service list counter */
+ int service_number = 0;
+ struct l7vs_sessionless_service* return_value = NULL;
+
+ /*-------- DEBUG LOG --------*/
+ if (sessionless_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == sessionless_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ PUT_LOG_DEBUG(sessionless_protomod, LOG_CAT_L7VSD_PROTOCOL,88,
+ "in_function: struct l7vs_sessionless_service* l7vs_protomod_sessionless_create_service()");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ /* check all sessionless service list */
+ for (service_number = 0; service_number < SESSIONLESS_SERVICE_NUMBER - 1; ++service_number) {
+ /* if pointer that does not point NULL exists ... */
+ if (sessionless_service_list[service_number] == NULL) {
+ /* create a service at empty pointer */
+ sessionless_service_list[service_number] = (struct l7vs_sessionless_service *) calloc(1, sizeof(struct l7vs_sessionless_service));
+
+ /*-------- DEBUG LOG --------*/
+ if (sessionless_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == sessionless_protomod.get_log_level(LOG_CAT_L7VSD_SYSTEM_MEMORY)) {
+ PUT_LOG_DEBUG(sessionless_protomod, LOG_CAT_L7VSD_SYSTEM_MEMORY,23, "calloc: addr=%p, size=%ld",
+ sessionless_service_list[service_number], (unsigned long int) sizeof(struct l7vs_sessionless_service));
+ }
+ /*------ DEBUG LOG END ------*/
+
+ if (sessionless_service_list[service_number] == NULL) {
+ PUT_LOG_ERROR(sessionless_protomod, LOG_CAT_L7VSD_SYSTEM_MEMORY,20, "Could not allocate memory.");
+ goto create_service_out;
+ }
+ return_value = sessionless_service_list[service_number];
+ goto create_service_out;
+ }
+ }
+
+ /* all service list is full */
+ PUT_LOG_ERROR(sessionless_protomod, LOG_CAT_L7VSD_PROTOCOL,77, "sessionless service list is full.");
+
+create_service_out:
+ /*-------- DEBUG LOG --------*/
+ if (sessionless_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == sessionless_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ char ssl_str[DEBUG_STR_LEN] = {0};
+ l7vs_sessionless_service_c_str(ssl_str, return_value);
+ PUT_LOG_DEBUG(sessionless_protomod, LOG_CAT_L7VSD_PROTOCOL,89,
+ "out_function: struct l7vs_sessionless_service* l7vs_protomod_sessionless_create_service():"
+ "return_value=&(%s)", ssl_str);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return return_value;
+}
+
+/*!
+ * Create temporary sessionless service.
+ * @param void
+ * @return sessionless service struct when create a service. NULL when cannot create service.
+ */
+static struct l7vs_sessionless_service *
+l7vs_protomod_sessionless_create_temp_service()
+{
+ struct l7vs_sessionless_service* return_value = NULL;
+
+ /*-------- DEBUG LOG --------*/
+ if (sessionless_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == sessionless_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ PUT_LOG_DEBUG(sessionless_protomod, LOG_CAT_L7VSD_PROTOCOL,90,
+ "in_function: struct l7vs_sessionless_service* l7vs_protomod_sessionless_create_temp_service()");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ /* if pointer that does not point NULL exists ... */
+ if (sessionless_service_list[SESSIONLESS_SERVICE_NUMBER - 1] != NULL) {
+ PUT_LOG_ERROR(sessionless_protomod, LOG_CAT_L7VSD_PROTOCOL,78, "Temporary sessionless service is being used by other process.");
+ goto create_temp_service_out;
+ }
+
+ /* create temp service */
+ sessionless_service_list[SESSIONLESS_SERVICE_NUMBER - 1] = (struct l7vs_sessionless_service *) calloc(1, sizeof(struct l7vs_sessionless_service));
+
+ /*-------- DEBUG LOG --------*/
+ if (sessionless_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == sessionless_protomod.get_log_level(LOG_CAT_L7VSD_SYSTEM_MEMORY)) {
+ PUT_LOG_DEBUG(sessionless_protomod, LOG_CAT_L7VSD_SYSTEM_MEMORY,24, "calloc: addr=%p, size=%ld",
+ sessionless_service_list[SESSIONLESS_SERVICE_NUMBER - 1], (unsigned long int) sizeof(struct l7vs_sessionless_service));
+ }
+ /*------ DEBUG LOG END ------*/
+
+ if (sessionless_service_list[SESSIONLESS_SERVICE_NUMBER - 1] == NULL) {
+ PUT_LOG_ERROR(sessionless_protomod, LOG_CAT_L7VSD_SYSTEM_MEMORY,21, "Could not allocate memory");
+ goto create_temp_service_out;
+ }
+
+ return_value = sessionless_service_list[SESSIONLESS_SERVICE_NUMBER - 1];
+
+create_temp_service_out:
+ /*-------- DEBUG LOG --------*/
+ if (sessionless_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == sessionless_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ char ssl_str[DEBUG_STR_LEN] = {0};
+ l7vs_sessionless_service_c_str(ssl_str, return_value);
+ PUT_LOG_DEBUG(sessionless_protomod, LOG_CAT_L7VSD_PROTOCOL,91,
+ "out_function: struct l7vs_sessionless_service* l7vs_protomod_sessionless_create_service():"
+ "return_value=&(%s)", ssl_str);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return return_value;
+}
+
+/*!
+ * Serialize struct l7vs_sessionless_service for debug log.
+ * @param[out] buf serialized string
+ * @param[in] sessionless l7vs_sessionless_service struct
+ */
+static void l7vs_sessionless_service_c_str(char* buf, struct l7vs_sessionless_service* sessionless) {
+ if (sessionless == NULL) {
+ snprintf(buf, DEBUG_STR_LEN, "NULL");
+ }
+ else {
+ snprintf(buf, DEBUG_STR_LEN, "service_handle=%d, forwarded_for=%d, reschedule=%d",
+ sessionless->service_handle, sessionless->forwarded_for, sessionless->reschedule);
+ }
+}
+
+/*!
+ * Serialize struct l7vs_sessionless_service_arg for debug log.
+ * @param[out] buf serialized string
+ * @param[in] sessionless_arg l7vs_sessionless_service_arg struct
+ */
+void l7vs_sessionless_service_arg_c_str(char* buf, struct l7vs_sessionless_service_arg* sessionless_arg) {
+ if (sessionless_arg == NULL) {
+ snprintf(buf, DEBUG_STR_LEN, "NULL");
+ }
+ else {
+ snprintf(buf, DEBUG_STR_LEN, "forwarded_for=%d, reschedule=%d",
+ sessionless_arg->forwarded_for, sessionless_arg->reschedule);
+ }
+}
--- /dev/null
+/*
+ * @file protomod_sslid.c
+ * @brief protocol module of HTTPS(SSL/TLS).
+ * @brief this module provide session persistence by SSL session ID.
+ *
+ * L7VSD: Linux Virtual Server for Layer7 Load Balancing
+ * Copyright (C) 2008 NTT COMWARE Corporation.
+ * Copyright (C) 2009 Shinya TAKEBAYASHI
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ **********************************************************************/
+
+#define __STDC_LIMIT_MACROS
+#include <stdint.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <time.h>
+#include <getopt.h>
+#include "l7vs_service.h"
+#include "l7vs_conn.h"
+#include "l7vs_lsock.h"
+#include "l7vs_dest.h"
+#include "l7vs_replication.h"
+#include "l7vs_module.h"
+#include "module_http.h"
+#include "module_sslid_hash.h"
+#include "protomod_sslid.h"
+
+static void fini(void);
+static int create(void*, handle_t);
+static void* create_sa(struct l7vs_service_arg*);
+static int compare(handle_t, handle_t);
+static int match_cldata(struct l7vs_service*, struct l7vs_conn*,
+ char*, size_t*, struct l7vs_dest**, int*);
+static int analyze_rsdata(struct l7vs_service*, struct l7vs_conn*,
+ char*, size_t*);
+static int destroy(handle_t);
+static void destroy_sa(void**);
+static int service_arg(struct l7vs_service_arg_multi*, handle_t);
+static int parse(void*, int, char**);
+
+static struct l7vs_sslid_service* l7vs_protomod_sslid_search_service(handle_t);
+static struct l7vs_sslid_service* l7vs_protomod_sslid_create_service();
+static struct l7vs_sslid_service* l7vs_protomod_sslid_create_temp_service();
+
+static void l7vs_protomod_sslid_read_replication_data(struct l7vs_sslid_service*, struct l7vs_service*);
+static void l7vs_protomod_sslid_write_replication_data(struct l7vs_sslid_service*);
+
+static void l7vs_sslid_service_c_str(char*, struct l7vs_sslid_service*);
+static void l7vs_sslid_service_arg_c_str(char*, struct l7vs_sslid_service_arg*);
+static void ssl_session_c_str(char*, struct ssl_session*);
+static void replication_header_c_str(char*, struct replication_header*);
+static void id_c_str(char*, char*);
+
+struct l7vs_sslid_service* sslid_service_list[SSLID_SERVICE_NUMBER];
+
+static struct l7vs_protomod sslid_protomod = {
+ NULL, /* handle */
+ "sslid", /* modname */
+ 0, /* refcnt */
+ 0, /* fast schedule */
+ create, /* create function */
+ compare, /* compare function */
+ match_cldata, /* match_cldata function */
+ analyze_rsdata, /* analyze_rsdata function */
+ destroy, /* destroy function */
+ fini, /* fini function */
+ create_sa, /* create_sa function */
+ service_arg, /* service_arg function */
+ parse, /* parse function */
+ destroy_sa, /* destroy_sa function */
+ NULL, /* initialize function */
+ NULL, /* finalize function */
+ NULL, /* get_log_level function */
+ NULL, /* put_log_debug function */
+ NULL, /* put_log_info function */
+ NULL, /* put_log_warn function */
+ NULL, /* put_log_error function */
+ NULL, /* put_log_fatal function */
+ NULL /* replication_pay_memory function */
+};
+
+/*!
+ * Protocol module initialize function. This function run when dlopen and dlsym at first time.
+ * @param[in] handle dlopen's handle
+ * @return l7vs_protomod struct
+ */
+extern "C" struct l7vs_protomod*
+init(void* handle)
+{
+ struct l7vs_protomod* return_value = NULL;
+
+ /*-------- DEBUG LOG --------*/
+ if (sslid_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == sslid_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ PUT_LOG_DEBUG(sslid_protomod, LOG_CAT_L7VSD_PROTOCOL,92,
+ "in_function: struct l7vs_protomod* init(void* handle): handle=%p", handle);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ /* check null */
+ if (handle == NULL) {
+ PUT_LOG_ERROR(sslid_protomod, LOG_CAT_L7VSD_PROTOCOL,79, "Arg(handle) is NULL pointer.");
+ goto init_out;
+ }
+
+ /* initialize sslid service list */
+ memset(sslid_service_list, 0, sizeof(struct l7vs_sslid_service*) * SSLID_SERVICE_NUMBER);
+ /* set dlopen's handle */
+ sslid_protomod.handle = handle;
+
+ return_value = &sslid_protomod;
+
+init_out:
+ /*-------- DEBUG LOG --------*/
+ if (sslid_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == sslid_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ char protomod_str[DEBUG_STR_LEN] = {0};
+ l7vs_protomod_c_str(protomod_str, &sslid_protomod);
+ PUT_LOG_DEBUG(sslid_protomod, LOG_CAT_L7VSD_PROTOCOL,93,
+ "out_function: struct l7vs_protomod* init(void* handle): return=&(%s)", protomod_str);
+ }
+ /*------ DEBUG LOG END ------*/
+ return return_value;
+}
+
+/*!
+ * Protocol module finalize function. free all sslid service list just in case.
+ * @param void
+ * @return void
+ */
+static void
+fini(void)
+{
+ /* sslid service list counter */
+ int service_number = 0;
+
+ /*-------- DEBUG LOG --------*/
+ if (sslid_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == sslid_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ PUT_LOG_DEBUG(sslid_protomod, LOG_CAT_L7VSD_PROTOCOL,94, "in_function: void fini(void)");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ /* check all sslid service list */
+ for (service_number = 0; service_number < SSLID_SERVICE_NUMBER; ++service_number) {
+ /* if pointer that does not point NULL exists ... */
+ if (sslid_service_list[service_number] != NULL) {
+ /* free and points NULL */
+ if (sslid_service_list[service_number]->session != NULL) {
+
+ /*-------- DEBUG LOG --------*/
+ if (sslid_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == sslid_protomod.get_log_level(LOG_CAT_L7VSD_SYSTEM_MEMORY)) {
+ PUT_LOG_DEBUG(sslid_protomod, LOG_CAT_L7VSD_SYSTEM_MEMORY,25, "free: %p",
+ sslid_service_list[service_number]->session);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ free(sslid_service_list[service_number]->session);
+ sslid_service_list[service_number]->session = NULL;
+ hash_setPointer(sslid_service_list[service_number]->hash_map, sslid_service_list[service_number]->hash_list, sslid_service_list[service_number]->maxlist);
+ hash_destroy();
+ }
+
+ /*-------- DEBUG LOG --------*/
+ if (sslid_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == sslid_protomod.get_log_level(LOG_CAT_L7VSD_SYSTEM_MEMORY)) {
+ PUT_LOG_DEBUG(sslid_protomod, LOG_CAT_L7VSD_SYSTEM_MEMORY,26, "free: %p",
+ sslid_service_list[service_number]);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ free(sslid_service_list[service_number]);
+ sslid_service_list[service_number] = NULL;
+ }
+ }
+
+ /*-------- DEBUG LOG --------*/
+ if (sslid_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == sslid_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ PUT_LOG_DEBUG(sslid_protomod, LOG_CAT_L7VSD_PROTOCOL,95, "out_function: void fini(void)");
+ }
+ /*------ DEBUG LOG END ------*/
+}
+
+/*!
+ * Create sslid service struct.
+ * @param[in] sslid_arg sslid service argument struct
+ * @param[in] service_handle a unique service ID
+ * @retval 0 successfully create sslid service.
+ * @retval -1 some errors occur.
+ */
+static int
+create(void* sslid_arg, handle_t service_handle)
+{
+ struct l7vs_sslid_service* sslid_service;
+ struct l7vs_sslid_service_arg* sslid_service_arg;
+ int return_value = 0;
+
+ /*-------- DEBUG LOG --------*/
+ if (sslid_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == sslid_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ char sslid_arg_str[DEBUG_STR_LEN] = {0};
+ l7vs_sslid_service_arg_c_str(sslid_arg_str, (struct l7vs_sslid_service_arg*) sslid_arg);
+ PUT_LOG_DEBUG(sslid_protomod, LOG_CAT_L7VSD_PROTOCOL,96,
+ "in_function: int create(void* sslid_arg, handle_t service_handle):sslid_arg=&(%s), "
+ "service_handle=%d", sslid_arg_str, service_handle);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ /* check null */
+ if (sslid_arg == NULL) {
+ PUT_LOG_ERROR(sslid_protomod, LOG_CAT_L7VSD_PROTOCOL,80, "Arg(sslid_arg) is NULL pointer.");
+ return_value = -1;
+ goto create_out;
+ }
+
+ if (service_handle != TEMP_SERVICEHANDLE) {
+ /* search empty sslid service list and create sslid service */
+ sslid_service = l7vs_protomod_sslid_create_service();
+ }
+ else {
+ /* create temporary sslid service */
+ sslid_service = l7vs_protomod_sslid_create_temp_service();
+ }
+
+ /*-------- DEBUG LOG --------*/
+ if (sslid_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == sslid_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ char sslid_str[DEBUG_STR_LEN] = {0};
+ l7vs_sslid_service_c_str(sslid_str, sslid_service);
+ PUT_LOG_DEBUG(sslid_protomod, LOG_CAT_L7VSD_PROTOCOL,97, "pointer assign: sslid_service=&(%s)",
+ sslid_str);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ if (sslid_service == NULL) {
+ PUT_LOG_ERROR(sslid_protomod, LOG_CAT_L7VSD_PROTOCOL,81, "Could not make sslid service.");
+ return_value = -1;
+ goto create_out;
+ }
+
+ sslid_service_arg = (struct l7vs_sslid_service_arg*) sslid_arg;
+
+ /* set service handle */
+ sslid_service->service_handle = service_handle;
+
+ /* set option value */
+ sslid_service->timeout = sslid_service_arg->timeout;
+ sslid_service->maxlist = sslid_service_arg->maxlist;
+ sslid_service->replication_addr = NULL;
+ sslid_service->reschedule = sslid_service_arg->reschedule;
+
+ if (service_handle != TEMP_SERVICEHANDLE) {
+ /* create session area */
+ sslid_service->session = (struct ssl_session*) calloc(sizeof(struct ssl_session), sslid_service->maxlist);
+ hash_allocate(sslid_service_arg->maxlist);
+ sslid_service->hash_map = hash_getIDMAP();
+ sslid_service->hash_list = hash_getIDLIST();
+
+ /*-------- DEBUG LOG --------*/
+ if (sslid_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == sslid_protomod.get_log_level(LOG_CAT_L7VSD_SYSTEM_MEMORY)) {
+ PUT_LOG_DEBUG(sslid_protomod, LOG_CAT_L7VSD_SYSTEM_MEMORY,27, "calloc: addr=%p, size=%ld",
+ sslid_service->session, (unsigned long int) sizeof(struct ssl_session) * sslid_service->maxlist);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ if (sslid_service->session == NULL) {
+ PUT_LOG_ERROR(sslid_protomod, LOG_CAT_L7VSD_SYSTEM_MEMORY,22, "Could not allocate memory.");
+ if (destroy(service_handle)) {
+ PUT_LOG_ERROR(sslid_protomod, LOG_CAT_L7VSD_SYSTEM_MEMORY,23,
+ "Could not destroy SSL service. (handle=%d)", service_handle);
+ }
+ return_value = -1;
+ goto create_out;
+ }
+ }
+
+create_out:
+ /*-------- DEBUG LOG --------*/
+ if (sslid_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == sslid_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ PUT_LOG_DEBUG(sslid_protomod, LOG_CAT_L7VSD_PROTOCOL,98,
+ "out_function: int create(void* sslid_arg, handle_t service_handle):return_value=%d",
+ return_value);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return return_value;
+}
+
+/*!
+ * Create sslid service argument struct.
+ * @param[out] srv_arg service argument struct
+ * @return sslid service argument struct
+ */
+static void*
+create_sa(struct l7vs_service_arg* srv_arg)
+{
+ struct l7vs_sslid_service_arg* sslid_service_arg;
+
+ /*-------- DEBUG LOG --------*/
+ if (sslid_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == sslid_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ char service_arg_str[DEBUG_STR_LEN] = {0};
+ l7vs_service_arg_c_str(service_arg_str, srv_arg);
+ PUT_LOG_DEBUG(sslid_protomod, LOG_CAT_L7VSD_PROTOCOL,99,
+ "in_function: void* create_sa(struct l7vs_service_arg* srv_arg):srv_arg=&(%s)",
+ service_arg_str);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ /* check null */
+ if (srv_arg == NULL) {
+ PUT_LOG_ERROR(sslid_protomod, LOG_CAT_L7VSD_PROTOCOL,82, "Arg(srv_arg) is NULL pointer.");
+ sslid_service_arg = NULL;
+ goto create_sa_out;
+ }
+
+ /* create sslid service argument struct */
+ sslid_service_arg = (struct l7vs_sslid_service_arg*) calloc(1, sizeof(struct l7vs_sslid_service_arg));
+
+ /*-------- DEBUG LOG --------*/
+ if (sslid_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == sslid_protomod.get_log_level(LOG_CAT_L7VSD_SYSTEM_MEMORY)) {
+ PUT_LOG_DEBUG(sslid_protomod, LOG_CAT_L7VSD_SYSTEM_MEMORY,28, "calloc: addr=%p, size=%ld",
+ sslid_service_arg, (unsigned long int) sizeof(struct l7vs_sslid_service_arg));
+ }
+ /*------ DEBUG LOG END ------*/
+
+ if (sslid_service_arg == NULL) {
+ PUT_LOG_ERROR(sslid_protomod, LOG_CAT_L7VSD_SYSTEM_MEMORY,24, "Could not allocate memory.");
+ goto create_sa_out;
+ }
+
+ /* set sslid service argument size and protomod name "sslid" */
+ srv_arg->len = sizeof(struct l7vs_sslid_service_arg);
+ strcpy(srv_arg->protomod, sslid_protomod.modname);
+
+create_sa_out:
+ /*-------- DEBUG LOG --------*/
+ if (sslid_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == sslid_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ char sslid_service_arg_str[DEBUG_STR_LEN] = {0};
+ l7vs_sslid_service_arg_c_str(sslid_service_arg_str, sslid_service_arg);
+ PUT_LOG_DEBUG(sslid_protomod, LOG_CAT_L7VSD_PROTOCOL,100,
+ "out_function: void* create_sa(struct l7vs_service_arg* srv_arg):return_value=&(%s)",
+ sslid_service_arg_str);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return (void*) sslid_service_arg;
+}
+
+/*!
+ * Always match 'cause SSL-Session-ID module does not have module key.
+ * @param[in] srv_handle1 one of a unique service ID
+ * @param[in] srv_handle2 one of a unique service ID
+ * @retval 0 they matched perfectly.
+ * @retval -1 they are different.
+ */
+static int
+compare(handle_t srv_handle1, handle_t srv_handle2)
+{
+ int return_value = 0;
+
+ /*-------- DEBUG LOG --------*/
+ if (sslid_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == sslid_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ PUT_LOG_DEBUG(sslid_protomod, LOG_CAT_L7VSD_PROTOCOL,101,
+ "in_function: int compare(handle_t srv_handle1, handle_t srv_handle2):"
+ "srv_handle1=%u, srv_handle2=%u", srv_handle1, srv_handle2);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ /*-------- DEBUG LOG --------*/
+ if (sslid_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == sslid_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ PUT_LOG_DEBUG(sslid_protomod, LOG_CAT_L7VSD_PROTOCOL,102,
+ "out_function: int compare(handle_t srv_handle1, handle_t srv_handle2):return_value=%d",
+ return_value);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return return_value;
+}
+
+/*!
+ * Check and modify request packet.
+ * @param[in] srv service struct include service handle, protocol module and schedule module.
+ * @param[in] conn connection data.
+ * @param[in] request packet data from client
+ * @param[in] len length of packet data
+ * @param[out] dest destination (real server) list
+ * @param[out] tcps TCP Splicer flag
+ * @retval 0 successfully check packet data
+ * @retval -1 some errors occur.
+ */
+static int
+match_cldata(struct l7vs_service* srv, struct l7vs_conn* conn,
+ char* request, size_t* len, struct l7vs_dest** dest, int* tcps)
+{
+ struct l7vs_sslid_service* sslid_service;
+ int i;
+ int ret;
+ int return_value = 0;
+ time_t now;
+ char id_str[DEBUG_STR_LEN] = {0};
+ struct l7vs_dest *tmpdest = NULL;
+ int searchret = -1;
+
+ /*-------- DEBUG LOG --------*/
+ if (sslid_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == sslid_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ char srv_str[DEBUG_STR_LEN] = {0};
+ char conn_str[DEBUG_STR_LEN] = {0};
+ char dest_str[DEBUG_STR_LEN] = {0};
+ char len_str[DEBUG_STR_LEN] = {0};
+ l7vs_service_c_str(srv_str, srv);
+ l7vs_conn_c_str(conn_str, conn);
+ if (dest != NULL) {
+ l7vs_dest_c_str(dest_str, *dest);
+ }
+ else {
+ strncpy(dest_str, "NULL", DEBUG_STR_LEN);
+ }
+ if (len != NULL) {
+ snprintf(len_str, DEBUG_STR_LEN, "%lu", (unsigned long int) *len);
+ }
+ else {
+ strncpy(len_str, "NULL", DEBUG_STR_LEN);
+ }
+ PUT_LOG_DEBUG(sslid_protomod, LOG_CAT_L7VSD_PROTOCOL,103,
+ "in_function: int match_cldata(struct l7vs_service* srv, struct l7vs_conn* conn, "
+ "char* request, size_t* len, struct l7vs_dest** dest, int* tcps):srv=&(%s), conn=&(%s), "
+ "request=\"%s\", len=&(%s), dest=&(&(%s)), tcps=&(%d)",
+ srv_str, conn_str, request, len_str, dest_str, *tcps);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ /* check null */
+ if (srv == NULL) {
+ PUT_LOG_ERROR(sslid_protomod, LOG_CAT_L7VSD_PROTOCOL,83, "Arg(srv) is NULL pointer.");
+ return_value = -1;
+ goto match_cldata_out;
+ }
+ if (srv->pm == NULL) {
+ PUT_LOG_ERROR(sslid_protomod, LOG_CAT_L7VSD_PROTOCOL,84, "Arg(srv->pm) is NULL pointer.");
+ return_value = -1;
+ goto match_cldata_out;
+ }
+ if (request == NULL) {
+ PUT_LOG_ERROR(sslid_protomod, LOG_CAT_L7VSD_PROTOCOL,85, "Arg(request) is NULL pointer.");
+ return_value = -1;
+ goto match_cldata_out;
+ }
+ if (len == NULL) {
+ PUT_LOG_ERROR(sslid_protomod, LOG_CAT_L7VSD_PROTOCOL,86, "Arg(len) is NULL pointer.");
+ return_value = -1;
+ goto match_cldata_out;
+ }
+ if (dest == NULL) {
+ PUT_LOG_ERROR(sslid_protomod, LOG_CAT_L7VSD_PROTOCOL,87, "Arg(dest) is NULL pointer.");
+ return_value = -1;
+ goto match_cldata_out;
+ }
+ if (tcps == NULL) {
+ PUT_LOG_ERROR(sslid_protomod, LOG_CAT_L7VSD_PROTOCOL,88, "Arg(tcps) is NULL pointer.");
+ return_value = -1;
+ goto match_cldata_out;
+ }
+
+ /* search service that has such a service ID */
+ sslid_service = l7vs_protomod_sslid_search_service(srv->handle);
+
+ /*-------- DEBUG LOG --------*/
+ if (sslid_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == sslid_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ char sslid_str[DEBUG_STR_LEN] = {0};
+ l7vs_sslid_service_c_str(sslid_str, sslid_service);
+ PUT_LOG_DEBUG(sslid_protomod, LOG_CAT_L7VSD_PROTOCOL,104, "pointer assign: sslid_service=&(%s)",
+ sslid_str);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ if (sslid_service == NULL) {
+ PUT_LOG_ERROR(sslid_protomod, LOG_CAT_L7VSD_PROTOCOL,89, "Could not find such service handle's sslid service.");
+ return_value = -1;
+ goto match_cldata_out;
+ }
+ if (sslid_service->session == NULL) {
+ PUT_LOG_ERROR(sslid_protomod, LOG_CAT_L7VSD_PROTOCOL,90,
+ "Service has NULL pointer session.");
+ return_value = -1;
+ goto match_cldata_out;
+ }
+
+ /* read replication data */
+ l7vs_protomod_sslid_read_replication_data(sslid_service, srv);
+ hash_rebuild_sessionlist(sslid_service);
+
+ /* initialize protocol module ... clear destination list */
+ ret = srv->pm->initialize(srv, conn, request, *len, dest);
+ if (ret != 0){
+ PUT_LOG_ERROR(sslid_protomod, LOG_CAT_L7VSD_PROTOCOL,91, "Could not initialize protomod.");
+ return_value = -1;
+ goto match_cldata_out;
+ }
+
+ /* check payload */
+ if (
+ *len > 75 &&
+ (
+ (request[1] == 0x03 && request[2] == 0x00 && request[9] == 0x03 && request [10] == 0x00) || // SSL v3
+ (request[1] == 0x03 && request[2] == 0x01 && request[9] == 0x03 && request [10] == 0x01) // TLS v1
+ ) &&
+ request[5] == 0x01 && // Client Hello
+ request[43] == 0x20 // Session ID Length
+ ) {
+ /*-------- DEBUG LOG --------*/
+ if (sslid_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == sslid_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ char id_str[DEBUG_STR_LEN] = {0};
+ id_c_str(id_str, &request[44]);
+ PUT_LOG_DEBUG(sslid_protomod, LOG_CAT_L7VSD_PROTOCOL,105,
+ "Client Hello/SessionID=%s", id_str);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ hash_setPointer(sslid_service->hash_map, sslid_service->hash_list, sslid_service->maxlist);
+ id_c_str(id_str, &request[44]);
+ searchret = hash_search(id_str, &tmpdest);
+
+ if (searchret == 0) {
+ *dest = tmpdest;
+ }
+
+ }
+
+ *tcps = 0;
+
+ /* finalize, always set reschedule flag */
+ ret = srv->pm->finalize(srv, conn, request, *len, dest, sslid_service->reschedule);
+ if (ret != 0){
+ PUT_LOG_INFO(sslid_protomod, LOG_CAT_L7VSD_PROTOCOL,11, "Could not finalize protomod. (Realserver decision failure)");
+ return_value = -1;
+ goto match_cldata_out;
+ }
+
+match_cldata_out:
+ /*-------- DEBUG LOG --------*/
+ if (sslid_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == sslid_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ PUT_LOG_DEBUG(sslid_protomod, LOG_CAT_L7VSD_PROTOCOL,107,
+ "out_function: int match_cldata(struct l7vs_service* srv, struct l7vs_conn* conn, "
+ "char* request, size_t* len, struct l7vs_dest** dest, int* tcps):return_value=%d",
+ return_value);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return return_value;
+}
+
+/*!
+ * Check and modify response packet.
+ * @param[in] srv service struct include service handle, protocol module and schedule module.
+ * @param[in] conn connection data.
+ * @param[in] response packet data from real server
+ * @param[in] len length of packet data. it will be lengthened.
+ * @retval 0 successfully check packet data.
+ * @retval -1 some errors occur.
+ */
+static int
+analyze_rsdata(struct l7vs_service* srv, struct l7vs_conn* conn,
+ char* response, size_t* len)
+{
+ struct l7vs_sslid_service* sslid_service;
+ int exist = 0;
+ int return_value = 0;
+ int i;
+ int pick;
+ time_t now, oldest = 0;
+ char session_full = 1;
+ char id_str[DEBUG_STR_LEN] = {0};
+
+ /*-------- DEBUG LOG --------*/
+ if (sslid_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == sslid_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ char srv_str[DEBUG_STR_LEN] = {0};
+ char conn_str[DEBUG_STR_LEN] = {0};
+ char len_str[DEBUG_STR_LEN] = {0};
+ l7vs_service_c_str(srv_str, srv);
+ l7vs_conn_c_str(conn_str, conn);
+ if (len != NULL) {
+ snprintf(len_str, DEBUG_STR_LEN, "%lu", (unsigned long int) *len);
+ }
+ else {
+ strncpy(len_str, "NULL", DEBUG_STR_LEN);
+ }
+ PUT_LOG_DEBUG(sslid_protomod, LOG_CAT_L7VSD_PROTOCOL,108,
+ "in_function: int analyze_rsdata(struct l7vs_service* srv, struct l7vs_conn* conn, "
+ "char* response, size_t* len):srv=&(%s), conn=&(%s), response=\"%s\", len=&(%s)",
+ srv_str, conn_str, response, len_str);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ /* check null */
+ if (srv == NULL) {
+ PUT_LOG_ERROR(sslid_protomod, LOG_CAT_L7VSD_PROTOCOL,93, "Arg(srv) is NULL pointer.");
+ return_value = -1;
+ goto analyze_rsdata_out;
+ }
+ if (conn == NULL) {
+ PUT_LOG_ERROR(sslid_protomod, LOG_CAT_L7VSD_PROTOCOL,94, "Arg(conn) is NULL pointer.");
+ return_value = -1;
+ goto analyze_rsdata_out;
+ }
+ if (conn->dest == NULL) {
+ PUT_LOG_ERROR(sslid_protomod, LOG_CAT_L7VSD_PROTOCOL,95, "Arg(conn->dest) is NULL pointer.");
+ return_value = -1;
+ goto analyze_rsdata_out;
+ }
+ if (response == NULL) {
+ PUT_LOG_ERROR(sslid_protomod, LOG_CAT_L7VSD_PROTOCOL,96, "Arg(response) is NULL pointer.");
+ return_value = -1;
+ goto analyze_rsdata_out;
+ }
+ if (len == NULL) {
+ PUT_LOG_ERROR(sslid_protomod, LOG_CAT_L7VSD_PROTOCOL,97, "Arg(len) is NULL pointer.");
+ return_value = -1;
+ goto analyze_rsdata_out;
+ }
+
+ /* sorry flag check */
+ if (conn->sorry_conn_flag == 1) {
+ /*-------- DEBUG LOG --------*/
+ if (sslid_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == sslid_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ PUT_LOG_DEBUG(sslid_protomod, LOG_CAT_L7VSD_PROTOCOL,109, "Response from sorry server.");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ goto analyze_rsdata_out;
+ }
+
+ /* search service that has such a service ID */
+ sslid_service = l7vs_protomod_sslid_search_service(srv->handle);
+
+ /*-------- DEBUG LOG --------*/
+ if (sslid_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == sslid_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ char sslid_str[DEBUG_STR_LEN] = {0};
+ l7vs_sslid_service_c_str(sslid_str, sslid_service);
+ PUT_LOG_DEBUG(sslid_protomod, LOG_CAT_L7VSD_PROTOCOL,110, "pointer assign: sslid_service=&(%s)",
+ sslid_str);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ if (sslid_service == NULL) {
+ PUT_LOG_ERROR(sslid_protomod, LOG_CAT_L7VSD_PROTOCOL,98,
+ "Could not find such service handle's sslid service.");
+ return_value = -1;
+ goto analyze_rsdata_out;
+ }
+ if (sslid_service->session == NULL) {
+ PUT_LOG_ERROR(sslid_protomod, LOG_CAT_L7VSD_PROTOCOL,99,
+ "Service has NULL pointer session.");
+ return_value = -1;
+ goto analyze_rsdata_out;
+ }
+
+ /* check payload */
+ if (
+ *len > 75 &&
+ (
+ (response[1] == 0x03 && response[2] == 0x00 && response[9] == 0x03 && response [10] == 0x00) || // SSL v3
+ (response[1] == 0x03 && response[2] == 0x01 && response[9] == 0x03 && response [10] == 0x01) // TLS v1
+ ) &&
+ response[5] == 0x02 && // Server Hello
+ response[43] == 0x20 // Session ID Length
+ ) {
+ /*-------- DEBUG LOG --------*/
+ if (sslid_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == sslid_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ char id_str[DEBUG_STR_LEN] = {0};
+ id_c_str(id_str, &response[44]);
+ PUT_LOG_DEBUG(sslid_protomod, LOG_CAT_L7VSD_PROTOCOL,111,
+ "Server Hello/SessionID=%s", id_str);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ hash_setPointer(sslid_service->hash_map, sslid_service->hash_list, sslid_service->maxlist);
+ id_c_str(id_str, &response[44]);
+ hash_add(id_str, *conn->dest);
+ hash_construct_sessionlist(sslid_service);
+ l7vs_protomod_sslid_write_replication_data(sslid_service);
+ }
+
+analyze_rsdata_out:
+ /*-------- DEBUG LOG --------*/
+ if (sslid_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == sslid_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ PUT_LOG_DEBUG(sslid_protomod, LOG_CAT_L7VSD_PROTOCOL,114,
+ "out_function: int analyze_rsdata(struct l7vs_service* srv, struct l7vs_conn* conn, "
+ "char* response, size_t* len):return_value=%d", return_value);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return return_value;
+}
+
+/*!
+ * Destroy sslid service
+ * @param[in] srv_handle a unique service ID
+ * @retval 0 successfully check packet data.
+ * @retval -1 some errors occur.
+ */
+static int
+destroy(handle_t srv_handle)
+{
+ /* sslid service list counter */
+ int service_number = 0;
+ int free_flag = 0;
+ int return_value = 0;
+
+ /*-------- DEBUG LOG --------*/
+ if (sslid_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == sslid_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ PUT_LOG_DEBUG(sslid_protomod, LOG_CAT_L7VSD_PROTOCOL,115,
+ "in_function: int destroy(handle_t srv_handle):srv_handle=%u",
+ srv_handle);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ /* check all sslid service list */
+ for (service_number = 0; service_number < SSLID_SERVICE_NUMBER; ++service_number) {
+ /* found sslid service that has srv_handle */
+ if (sslid_service_list[service_number] != NULL &&
+ sslid_service_list[service_number]->service_handle == srv_handle) {
+
+ /* free and NULL */
+ if (sslid_service_list[service_number]->session != NULL) {
+
+ /*-------- DEBUG LOG --------*/
+ if (sslid_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == sslid_protomod.get_log_level(LOG_CAT_L7VSD_SYSTEM_MEMORY)) {
+ PUT_LOG_DEBUG(sslid_protomod, LOG_CAT_L7VSD_SYSTEM_MEMORY,29, "free: %p",
+ sslid_service_list[service_number]->session);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ free(sslid_service_list[service_number]->session);
+ sslid_service_list[service_number]->session = NULL;
+ hash_setPointer(sslid_service_list[service_number]->hash_map, sslid_service_list[service_number]->hash_list, sslid_service_list[service_number]->maxlist);
+ hash_destroy();
+ }
+
+ /*-------- DEBUG LOG --------*/
+ if (sslid_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == sslid_protomod.get_log_level(LOG_CAT_L7VSD_SYSTEM_MEMORY)) {
+ PUT_LOG_DEBUG(sslid_protomod, LOG_CAT_L7VSD_SYSTEM_MEMORY,30, "free: %p",
+ sslid_service_list[service_number]);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ free(sslid_service_list[service_number]);
+ sslid_service_list[service_number] = NULL;
+
+ free_flag = 1;
+ break;
+ }
+ }
+
+ /* sslid service was not found */
+ if (free_flag == 0) {
+ PUT_LOG_ERROR(sslid_protomod, LOG_CAT_L7VSD_PROTOCOL,100, "Could not find such service handle's sslid service.");
+ return_value = -1;
+ goto destroy_out;
+ }
+
+destroy_out:
+ /*-------- DEBUG LOG --------*/
+ if (sslid_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == sslid_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ PUT_LOG_DEBUG(sslid_protomod, LOG_CAT_L7VSD_PROTOCOL,116,
+ "out_function: int destroy(handle_t srv_handle):return_value=%d",
+ srv_handle);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return return_value;
+}
+
+/*!
+ * Destroy sslid service argument
+ * @param[in] sslid_arg sslid service argument
+ * @return void
+ */
+static void
+destroy_sa(void** sslid_arg)
+{
+ /*-------- DEBUG LOG --------*/
+ if (sslid_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == sslid_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ char sslid_arg_str[DEBUG_STR_LEN] = {0};
+ if (sslid_arg != NULL) {
+ l7vs_sslid_service_arg_c_str(sslid_arg_str, (struct l7vs_sslid_service_arg*) *sslid_arg);
+ }
+ else {
+ strncpy(sslid_arg_str, "NULL", DEBUG_STR_LEN);
+ }
+ PUT_LOG_DEBUG(sslid_protomod, LOG_CAT_L7VSD_PROTOCOL,117,
+ "in_function: void destroy_sa(void** sslid_arg):sslid_arg=&(&(%s))",
+ sslid_arg_str);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ /* check null */
+ if (sslid_arg == NULL) {
+ PUT_LOG_ERROR(sslid_protomod, LOG_CAT_L7VSD_PROTOCOL,101, "Arg(sslid_arg) is NULL pointer.");
+ }
+ else if (*sslid_arg == NULL) {
+ PUT_LOG_ERROR(sslid_protomod, LOG_CAT_L7VSD_PROTOCOL,102, "Arg(*sslid_arg) is NULL pointer.");
+ }
+ else {
+ /*-------- DEBUG LOG --------*/
+ if (sslid_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == sslid_protomod.get_log_level(LOG_CAT_L7VSD_SYSTEM_MEMORY)) {
+ PUT_LOG_DEBUG(sslid_protomod, LOG_CAT_L7VSD_SYSTEM_MEMORY,31, "free: %p",
+ *sslid_arg);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ /* free and NULL */
+ free((struct l7vs_sslid_service_arg*) *sslid_arg);
+ *sslid_arg = NULL;
+ }
+
+ /*-------- DEBUG LOG --------*/
+ if (sslid_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == sslid_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ PUT_LOG_DEBUG(sslid_protomod, LOG_CAT_L7VSD_PROTOCOL,118,
+ "out_function: void destroy_sa(void** sslid_arg)");
+ }
+ /*------ DEBUG LOG END ------*/
+}
+
+/*!
+ * Create strings for service list of l7vsadm
+ * @param[out] srv_arg_mt service argument struct
+ * @param[in] srv_handle a unique service ID
+ * @retval 0 successfully create strings
+ * @retval -1 some errors occur.
+ */
+static int
+service_arg(struct l7vs_service_arg_multi* srv_arg_mt, handle_t srv_handle)
+{
+ struct l7vs_sslid_service* sslid_service;
+ struct l7vs_sslid_service_arg s_sarg;
+ char sslid_argument[SERVICE_ARG_MAXSIZE];
+ int return_value = 0;
+
+ /*-------- DEBUG LOG --------*/
+ if (sslid_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == sslid_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ char srv_arg_mt_str[DEBUG_STR_LEN] = {0};
+ l7vs_service_arg_multi_c_str(srv_arg_mt_str, srv_arg_mt);
+ PUT_LOG_DEBUG(sslid_protomod, LOG_CAT_L7VSD_PROTOCOL,119,
+ "in_function: int service_arg(struct l7vs_service_arg_multi* srv_arg_mt, "
+ "handle_t srv_handle):srv_arg_mt=&(%s), srv_handle=%u",
+ srv_arg_mt_str, srv_handle);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ /* check null */
+ if (srv_arg_mt == NULL) {
+ PUT_LOG_ERROR(sslid_protomod, LOG_CAT_L7VSD_PROTOCOL,103, "Arg(srv_arg_mt) is NULL pointer.");
+ return_value = -1;
+ goto service_arg_out;
+ }
+
+ /* search service that has such a service ID */
+ sslid_service = l7vs_protomod_sslid_search_service(srv_handle);
+
+ /*-------- DEBUG LOG --------*/
+ if (sslid_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == sslid_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ char sslid_str[DEBUG_STR_LEN] = {0};
+ l7vs_sslid_service_c_str(sslid_str, sslid_service);
+ PUT_LOG_DEBUG(sslid_protomod, LOG_CAT_L7VSD_PROTOCOL,120, "pointer assign: sslid_service=&(%s)",
+ sslid_str);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ if (sslid_service == NULL) {
+ PUT_LOG_ERROR(sslid_protomod, LOG_CAT_L7VSD_PROTOCOL,104, "Could not find such service handle's sslid service.");
+ return_value = -1;
+ goto service_arg_out;
+ }
+
+ /* initialize argument strings */
+ memset(sslid_argument, 0, SERVICE_ARG_MAXSIZE);
+
+ /* set sslid args to service argument struct */
+ srv_arg_mt->srv_arg.reschedule = sslid_service->reschedule;
+
+ /* create long argument (l7vsadm option -l) */
+ strncpy(srv_arg_mt->srv_arg.protomod_key_string, sslid_argument, 256);
+
+ /* create verbose argument (l7vsadm option -V) */
+ snprintf(sslid_argument + strlen(sslid_argument), SERVICE_ARG_MAXSIZE - strlen(sslid_argument),
+ "--timeout %d --maxlist %d", sslid_service->timeout, sslid_service->maxlist);
+ strncpy(srv_arg_mt->srv_arg.protomod_opt_string, sslid_argument, 512);
+
+ /* set option value */
+ s_sarg.timeout = sslid_service->timeout;
+ s_sarg.maxlist = sslid_service->maxlist;
+ s_sarg.reschedule = sslid_service->reschedule;
+
+ memcpy(srv_arg_mt->protomod_arg, &s_sarg, sizeof(struct l7vs_sslid_service_arg));
+
+ /*-------- DEBUG LOG --------*/
+ if (sslid_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == sslid_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ char sslid_arg_str[DEBUG_STR_LEN] = {0};
+ l7vs_sslid_service_arg_c_str(sslid_arg_str, &s_sarg);
+ PUT_LOG_DEBUG(sslid_protomod, LOG_CAT_L7VSD_PROTOCOL,121,
+ "pointer assign: srv_arg_mt->protomod_arg=&(%s)", sslid_arg_str);
+ }
+ /*------ DEBUG LOG END ------*/
+
+service_arg_out:
+ /*-------- DEBUG LOG --------*/
+ if (sslid_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == sslid_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ PUT_LOG_DEBUG(sslid_protomod, LOG_CAT_L7VSD_PROTOCOL,122,
+ "out_function: int service_arg(struct l7vs_service_arg_multi* srv_arg_mt, "
+ "handle_t srv_handle):return_value=%d", return_value);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return return_value;
+}
+
+/*!
+ * Parse l7vsadm options to sslid argument
+ * @param[out] sslid_arg sslid service argument struct
+ * @param[in] argc number of l7vsadm argument
+ * @param[in] argv l7vsadm argument list
+ * @retval 0 successfully parse argument
+ * @retval -1 some errors occur.
+ */
+static int
+parse(void* sslid_arg, int argc, char* argv[])
+{
+ struct l7vs_sslid_service_arg* sslid_service_arg;
+ static struct option opt[] = {
+ {"timeout", required_argument, NULL, 'T'},
+ {"maxlist", required_argument, NULL, 'M'},
+ {"reschedule", no_argument, NULL, 'R'},
+ {"no-reschedule", no_argument, NULL, 'N'},
+ {NULL, 0, NULL, 0 }
+ };
+ int c;
+ unsigned long buffer;
+ int timeout_flag = 0;
+ int maxlist_flag = 0;
+ int reschedule_flag = 0;
+ int return_value = 0;
+
+ /*-------- DEBUG LOG --------*/
+ if (sslid_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == sslid_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ int i;
+ char argv_str[DEBUG_STR_LEN] = {0};
+ char sslid_arg_str[DEBUG_STR_LEN] = {0};
+ l7vs_sslid_service_arg_c_str(sslid_arg_str, (struct l7vs_sslid_service_arg*) sslid_arg);
+ argv_str[0] = '\0';
+ if (argv == NULL)
+ snprintf(argv_str, DEBUG_STR_LEN, "NULL");
+ else {
+ for (i = 0; i < argc; i++) {
+ snprintf(argv_str, DEBUG_STR_LEN, "%sargv[%d]=\"%s\", ", argv_str, i, argv[i]);
+ }
+ i = strnlen(argv_str, DEBUG_STR_LEN);
+ if (i > 1)
+ argv_str[i - 2] = '\0';
+ }
+ PUT_LOG_DEBUG(sslid_protomod, LOG_CAT_L7VSD_PROTOCOL,123,
+ "in_function: int parse(void* sslid_arg, int argc, char* argv[]):sslid_arg=&(%s), "
+ "argc=%d, %s", sslid_arg_str, argc, argv_str);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ /* check null */
+ if (sslid_arg == NULL) {
+ PUT_LOG_ERROR(sslid_protomod, LOG_CAT_L7VSD_PROTOCOL,105, "Arg(sslid_arg) is NULL pointer.");
+ return_value = -1;
+ goto parse_out;
+ }
+ if (argv == NULL) {
+ PUT_LOG_ERROR(sslid_protomod, LOG_CAT_L7VSD_PROTOCOL,106, "Arg(argv) is NULL pointer.");
+ return_value = -1;
+ goto parse_out;
+ }
+
+ sslid_service_arg = (struct l7vs_sslid_service_arg*) sslid_arg;
+ optind = 0;
+
+ /* check all argument */
+ while ((c = getopt_long(argc, argv, "T:M:RN", opt, NULL)) != -1) {
+ switch (c) {
+ /* --timeout / -T */
+ case 'T':
+ if (sscanf(optarg, "%lu", &buffer) == 0) {
+ PUT_LOG_ERROR(sslid_protomod, LOG_CAT_L7VSD_PROTOCOL,107,
+ "-T/--timeout option value '%s' is invalid.", optarg);
+ return_value = -1;
+ goto parse_out;
+ }
+ if (buffer > INT_MAX) {
+ PUT_LOG_ERROR(sslid_protomod, LOG_CAT_L7VSD_PROTOCOL,108,
+ "-T/--timeout option value '%s' is too large.", optarg);
+ return_value = -1;
+ goto parse_out;
+ }
+ else
+ sslid_service_arg->timeout = buffer;
+ timeout_flag++;
+ break;
+
+ /* --maxlist / -M */
+ case 'M':
+ if (sscanf(optarg, "%lu", &buffer) == 0) {
+ PUT_LOG_ERROR(sslid_protomod, LOG_CAT_L7VSD_PROTOCOL,109,
+ "-M/--maxlist option value '%s' is invalid.", optarg);
+ return_value = -1;
+ goto parse_out;
+ }
+ if (buffer > INT_MAX) {
+ PUT_LOG_ERROR(sslid_protomod, LOG_CAT_L7VSD_PROTOCOL,110,
+ "-M/--maxlist option value '%s' is too large.", optarg);
+ return_value = -1;
+ goto parse_out;
+ }
+ else
+ sslid_service_arg->maxlist = buffer;
+ maxlist_flag++;
+ break;
+
+ /* --reschedule / -R */
+ case 'R':
+ /* reschedule on */
+ sslid_service_arg->reschedule = 1;
+ reschedule_flag++;
+ break;
+
+ /* --no-reschedule / -N */
+ case 'N':
+ /* reschedule off */
+ sslid_service_arg->reschedule = 0;
+ reschedule_flag++;
+ break;
+
+ /* else error */
+ default:
+ PUT_LOG_ERROR(sslid_protomod, LOG_CAT_L7VSD_PROTOCOL,111, "Option error.");
+ return_value = -1;
+ goto parse_out;
+ }
+ }
+
+ /* when set both -R and -N at the same time */
+ if (reschedule_flag > 1) {
+ PUT_LOG_ERROR(sslid_protomod, LOG_CAT_L7VSD_PROTOCOL,112,
+ "You should choose either reschdule or no-reschedule.");
+ return_value = -1;
+ goto parse_out;
+ }
+ /* same option */
+ if (timeout_flag > 1) {
+ PUT_LOG_ERROR(sslid_protomod, LOG_CAT_L7VSD_PROTOCOL,113,
+ "Cannot set multiple option '--timeout/-T'.");
+ return_value = -1;
+ goto parse_out;
+ }
+ if (maxlist_flag > 1) {
+ PUT_LOG_ERROR(sslid_protomod, LOG_CAT_L7VSD_PROTOCOL,114,
+ "Cannot set multiple option '--maxlist/-M'.");
+ return_value = -1;
+ goto parse_out;
+ }
+
+ /* set default no reschedule */
+ if (reschedule_flag == 0) {
+ sslid_service_arg->reschedule = 0;
+ }
+
+ /* set default options */
+ if (timeout_flag == 0) {
+ sslid_service_arg->timeout = 3600;
+ }
+ if (maxlist_flag == 0 || sslid_service_arg->maxlist == 0) {
+ sslid_service_arg->maxlist = 1024;
+ }
+
+parse_out:
+ /*-------- DEBUG LOG --------*/
+ if (sslid_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == sslid_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ PUT_LOG_DEBUG(sslid_protomod, LOG_CAT_L7VSD_PROTOCOL,124,
+ "out_function: int parse(void* sslid_arg, int argc, char* argv[]):return_value=%d",
+ return_value);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return return_value;
+}
+
+/*!
+ * Search sslid service from sslid service list using service handle
+ * @param[in] service_handle a unique service ID
+ * @return sslid service struct when service was found. NULL when service was not found.
+ */
+static struct l7vs_sslid_service*
+l7vs_protomod_sslid_search_service(handle_t service_handle)
+{
+ /* sslid service list counter */
+ int service_number = 0;
+ struct l7vs_sslid_service* return_value = NULL;
+
+ /*-------- DEBUG LOG --------*/
+ if (sslid_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == sslid_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ PUT_LOG_DEBUG(sslid_protomod, LOG_CAT_L7VSD_PROTOCOL,125,
+ "in_function: struct l7vs_sslid_service* l7vs_protomod_sslid_search_service(handle_t service_handle):"
+ "service_handle=%d", service_handle);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ /* check all sslid service list */
+ for (service_number = 0; service_number < SSLID_SERVICE_NUMBER; ++service_number) {
+ /* found the service has same service handle */
+ if (sslid_service_list[service_number] != NULL &&
+ sslid_service_list[service_number]->service_handle == service_handle) {
+ return_value = sslid_service_list[service_number];
+ break;
+ }
+ }
+
+ /*-------- DEBUG LOG --------*/
+ if (sslid_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == sslid_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ char ssl_str[DEBUG_STR_LEN] = {0};
+ l7vs_sslid_service_c_str(ssl_str, return_value);
+ PUT_LOG_DEBUG(sslid_protomod, LOG_CAT_L7VSD_PROTOCOL,126,
+ "out_function: struct l7vs_sslid_service* l7vs_protomod_sslid_search_service(handle_t service_handle):"
+ "return_value=&(%s)", ssl_str);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return return_value;
+}
+
+/*!
+ * Create sslid service.
+ * @param void
+ * @return sslid service struct when create a service. NULL when cannot create service.
+ */
+static struct l7vs_sslid_service*
+l7vs_protomod_sslid_create_service()
+{
+ int service_number = 0;
+ struct l7vs_sslid_service* return_value = NULL;
+
+ /*-------- DEBUG LOG --------*/
+ if (sslid_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == sslid_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ PUT_LOG_DEBUG(sslid_protomod, LOG_CAT_L7VSD_PROTOCOL,127,
+ "in_function: struct l7vs_sslid_service* l7vs_protomod_sslid_create_service()");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ /* check all sslid service list */
+ for (service_number = 0; service_number < SSLID_SERVICE_NUMBER - 1; ++service_number) {
+ /* if pointer that does not point NULL exists ... */
+ if (sslid_service_list[service_number] == NULL) {
+ /* create a service at empty pointer */
+ sslid_service_list[service_number] = (struct l7vs_sslid_service*) calloc(1, sizeof(struct l7vs_sslid_service));
+
+ /*-------- DEBUG LOG --------*/
+ if (sslid_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == sslid_protomod.get_log_level(LOG_CAT_L7VSD_SYSTEM_MEMORY)) {
+ PUT_LOG_DEBUG(sslid_protomod, LOG_CAT_L7VSD_SYSTEM_MEMORY,32, "calloc: addr=%p, size=%ld",
+ sslid_service_list[service_number], (unsigned long int) sizeof(struct l7vs_sslid_service));
+ }
+ /*------ DEBUG LOG END ------*/
+
+ if (sslid_service_list[service_number] == NULL) {
+ PUT_LOG_ERROR(sslid_protomod, LOG_CAT_L7VSD_SYSTEM_MEMORY,25, "Could not allocate memory.");
+ goto create_service_out;
+ }
+ return_value = sslid_service_list[service_number];
+ goto create_service_out;
+ }
+ }
+
+ /* all service list is full */
+ PUT_LOG_ERROR(sslid_protomod, LOG_CAT_L7VSD_PROTOCOL,115, "sslid service list is full.");
+
+create_service_out:
+ /*-------- DEBUG LOG --------*/
+ if (sslid_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == sslid_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ char ssl_str[DEBUG_STR_LEN] = {0};
+ l7vs_sslid_service_c_str(ssl_str, return_value);
+ PUT_LOG_DEBUG(sslid_protomod, LOG_CAT_L7VSD_PROTOCOL,128,
+ "out_function: struct l7vs_sslid_service* l7vs_protomod_sslid_create_service():"
+ "return_value=&(%s)", ssl_str);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return return_value;
+}
+
+/*!
+ * Create temporary sslid service.
+ * @param void
+ * @return sslid service struct when create a service. NULL when cannot create service.
+ */
+static struct l7vs_sslid_service*
+l7vs_protomod_sslid_create_temp_service()
+{
+ struct l7vs_sslid_service* return_value = NULL;
+
+ /*-------- DEBUG LOG --------*/
+ if (sslid_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == sslid_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ PUT_LOG_DEBUG(sslid_protomod, LOG_CAT_L7VSD_PROTOCOL,129,
+ "in_function: struct l7vs_sslid_service* l7vs_protomod_sslid_create_temp_service()");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ /* if pointer that does not point NULL exists ... */
+ if (sslid_service_list[SSLID_SERVICE_NUMBER - 1] != NULL) {
+ PUT_LOG_ERROR(sslid_protomod, LOG_CAT_L7VSD_PROTOCOL,116, "Temporary sslid service is being used by other process.");
+ goto create_temp_service_out;
+ }
+
+ /* create temp service */
+ sslid_service_list[SSLID_SERVICE_NUMBER - 1] = (struct l7vs_sslid_service*) calloc(1, sizeof(struct l7vs_sslid_service));
+
+ /*-------- DEBUG LOG --------*/
+ if (sslid_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == sslid_protomod.get_log_level(LOG_CAT_L7VSD_SYSTEM_MEMORY)) {
+ PUT_LOG_DEBUG(sslid_protomod, LOG_CAT_L7VSD_SYSTEM_MEMORY,33, "calloc: addr=%p, size=%ld",
+ sslid_service_list[SSLID_SERVICE_NUMBER - 1], (unsigned long int) sizeof(struct l7vs_sslid_service));
+ }
+ /*------ DEBUG LOG END ------*/
+
+ if (sslid_service_list[SSLID_SERVICE_NUMBER - 1] == NULL) {
+ PUT_LOG_ERROR(sslid_protomod, LOG_CAT_L7VSD_SYSTEM_MEMORY,26, "Could not allocate memory");
+ goto create_temp_service_out;
+ }
+
+ return_value = sslid_service_list[SSLID_SERVICE_NUMBER - 1];
+
+create_temp_service_out:
+ /*-------- DEBUG LOG --------*/
+ if (sslid_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == sslid_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ char ssl_str[DEBUG_STR_LEN] = {0};
+ l7vs_sslid_service_c_str(ssl_str, return_value);
+ PUT_LOG_DEBUG(sslid_protomod, LOG_CAT_L7VSD_PROTOCOL,130,
+ "out_function: struct l7vs_sslid_service* l7vs_protomod_sslid_create_service():"
+ "return_value=&(%s)", ssl_str);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return return_value;
+}
+
+/*!
+ * Read replication area and set session data.
+ * @param[in] sslid_service read this sslid service's session.
+ * @return void
+ */
+static void l7vs_protomod_sslid_read_replication_data(struct l7vs_sslid_service* sslid_service, struct l7vs_service* srv)
+{
+ struct replication_header* head;
+ struct replication_header* pick = NULL;
+ unsigned int data_size = 0;
+ unsigned int used = 0;
+ void* data_addr = NULL;
+ char exist = -1;
+ int srv_num;
+
+ /*-------- DEBUG LOG --------*/
+ if (sslid_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == sslid_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ char ssl_str[DEBUG_STR_LEN] = {0};
+ l7vs_sslid_service_c_str(ssl_str, sslid_service);
+ PUT_LOG_DEBUG(sslid_protomod, LOG_CAT_L7VSD_PROTOCOL,131,
+ "in_function: void l7vs_protomod_sslid_read_replication_data(struct "
+ "l7vs_sslid_service* sslid_service):sslid_service=&(%s)", ssl_str);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ /* check null */
+ if (sslid_service == NULL) {
+ PUT_LOG_ERROR(sslid_protomod, LOG_CAT_L7VSD_PROTOCOL, 0, "Arg(sslid_service) is NULL pointer.");
+ goto read_replication_data_out;
+ }
+ if (sslid_service->session == NULL) {
+ PUT_LOG_ERROR(sslid_protomod, LOG_CAT_L7VSD_PROTOCOL, 0, "Arg(sslid_service->session) is NULL pointer.");
+ goto read_replication_data_out;
+ }
+ if (srv == NULL) {
+ PUT_LOG_ERROR(sslid_protomod, LOG_CAT_L7VSD_PROTOCOL, 0,
+ "Service that has handle(%d) is not found.", sslid_service->service_handle);
+ goto read_replication_data_out;
+ }
+ if (srv->lsock == NULL) {
+ PUT_LOG_ERROR(sslid_protomod, LOG_CAT_L7VSD_PROTOCOL, 0,
+ "Conn of service that has handle(%d) is NULL pointer.", sslid_service->service_handle);
+ goto read_replication_data_out;
+ }
+
+ /* get replication area address */
+ data_addr = sslid_protomod.replication_pay_memory(sslid_protomod.modname, &data_size);
+ if (data_addr == NULL || data_size <= 0)
+ goto read_replication_data_out;
+
+ /* check replication area header */
+ for (srv_num = 0; srv_num < SSLID_SERVICE_NUMBER; srv_num++) {
+ head = (struct replication_header*) data_addr + srv_num;
+ used += head->size;
+
+ if (data_size * DATA_SIZE < sizeof(struct replication_header) * (SSLID_SERVICE_NUMBER - 1) + used) {
+ PUT_LOG_ERROR(sslid_protomod, LOG_CAT_L7VSD_PROTOCOL, 0, "Over replication area.");
+ goto read_replication_data_out;
+ }
+
+ if (pick == NULL && head->size == 0)
+ pick = head;
+ if (exist >= 0 && pick != NULL)
+ break;
+
+ /* match ip and port, this is pre-used session information */
+ if (memcmp(&head->sin_addr, &srv->lsock->addr.sin_addr, sizeof(struct in_addr)) == 0 &&
+ head->sin_port == srv->lsock->addr.sin_port) {
+ exist = srv_num;
+ }
+ }
+
+ if (exist >= 0) {
+ head = (struct replication_header*) data_addr + exist;
+
+ /* restore session information */
+ if (sslid_service->maxlist * sizeof(struct ssl_session) > head->size) {
+ // resize if maxlist set bigger than old
+ if (pick != NULL) {
+ /* area size check */
+ if (sizeof(struct replication_header) * (SSLID_SERVICE_NUMBER - 1) +
+ used + sslid_service->maxlist * sizeof(struct ssl_session) > data_size * DATA_SIZE) {
+ PUT_LOG_ERROR(sslid_protomod, LOG_CAT_L7VSD_PROTOCOL, 0,
+ "Replication area is full.");
+ goto read_replication_data_out;
+ }
+ else {
+ memcpy(sslid_service->session, (char*) data_addr + head->offset, head->size);
+ memset(sslid_service->replication_addr, 0, head->size);
+ sslid_service->replication_addr = (char*) data_addr +
+ sizeof(struct replication_header) * (SSLID_SERVICE_NUMBER - 1) + used;
+ pick->sin_addr = srv->lsock->addr.sin_addr;
+ pick->sin_port = srv->lsock->addr.sin_port;
+ pick->size = sslid_service->maxlist * sizeof(struct ssl_session);
+ pick->offset = sizeof(struct replication_header) * (SSLID_SERVICE_NUMBER - 1) + used;
+
+ /*-------- DEBUG LOG --------*/
+ if (sslid_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == sslid_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ char head_str[DEBUG_STR_LEN];
+ replication_header_c_str(head_str, pick);
+ PUT_LOG_DEBUG(sslid_protomod, LOG_CAT_L7VSD_PROTOCOL, 0,
+ "Write replication area: head=(%s)", head_str);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ // you should garbage old session area...
+ }
+ }
+ else {
+ PUT_LOG_ERROR(sslid_protomod, LOG_CAT_L7VSD_PROTOCOL, 0,
+ "Replication area is full.");
+ goto read_replication_data_out;
+ }
+ }
+ else {
+ sslid_service->replication_addr = (char*) data_addr + head->offset;
+ memcpy(sslid_service->session, sslid_service->replication_addr,
+ sslid_service->maxlist * sizeof(struct ssl_session));
+ head->size = sslid_service->maxlist * sizeof(struct ssl_session);
+
+ /*-------- DEBUG LOG --------*/
+ if (sslid_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == sslid_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ char head_str[DEBUG_STR_LEN];
+ replication_header_c_str(head_str, head);
+ PUT_LOG_DEBUG(sslid_protomod, LOG_CAT_L7VSD_PROTOCOL, 0,
+ "Write replication area: head=(%s)", head_str);
+ }
+ /*------ DEBUG LOG END ------*/
+ }
+ }
+
+ if (exist == -1) {
+ if (pick != NULL) {
+ /* area size check */
+ if (sizeof(struct replication_header) * (SSLID_SERVICE_NUMBER - 1) +
+ used + sslid_service->maxlist * sizeof(struct ssl_session) > data_size * DATA_SIZE) {
+ PUT_LOG_ERROR(sslid_protomod, LOG_CAT_L7VSD_PROTOCOL, 0,
+ "Replication area is full.");
+ goto read_replication_data_out;
+ }
+ else {
+ /* initialize replication information */
+ sslid_service->replication_addr = (char*) data_addr +
+ sizeof(struct replication_header) * (SSLID_SERVICE_NUMBER - 1) + used;
+ pick->sin_addr = srv->lsock->addr.sin_addr;
+ pick->sin_port = srv->lsock->addr.sin_port;
+ pick->size = sslid_service->maxlist * sizeof(struct ssl_session);
+ pick->offset = sizeof(struct replication_header) * (SSLID_SERVICE_NUMBER - 1) + used;
+
+ /*-------- DEBUG LOG --------*/
+ if (sslid_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == sslid_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ char head_str[DEBUG_STR_LEN];
+ replication_header_c_str(head_str, pick);
+ PUT_LOG_DEBUG(sslid_protomod, LOG_CAT_L7VSD_PROTOCOL, 0,
+ "Write replication area: head=(%s)", head_str);
+ }
+ /*------ DEBUG LOG END ------*/
+ }
+ }
+ else {
+ PUT_LOG_ERROR(sslid_protomod, LOG_CAT_L7VSD_PROTOCOL, 0,
+ "Replication area is full.");
+ goto read_replication_data_out;
+ }
+ }
+
+read_replication_data_out:
+ /*-------- DEBUG LOG --------*/
+ if (sslid_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == sslid_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ PUT_LOG_DEBUG(sslid_protomod, LOG_CAT_L7VSD_PROTOCOL,132,
+ "out_function: l7vs_protomod_sslid_read_replication_data(struct "
+ "l7vs_sslid_service* sslid_service)");
+ }
+ /*------ DEBUG LOG END ------*/
+}
+
+/*!
+ * Write session data to replication area.
+ * @param[in] sslid_service save this sslid service's session.
+ * @return void
+ */
+static void l7vs_protomod_sslid_write_replication_data(struct l7vs_sslid_service* sslid_service)
+{
+ /*-------- DEBUG LOG --------*/
+ if (sslid_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == sslid_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ char ssl_str[DEBUG_STR_LEN] = {0};
+ l7vs_sslid_service_c_str(ssl_str, sslid_service);
+ PUT_LOG_DEBUG(sslid_protomod, LOG_CAT_L7VSD_PROTOCOL,133,
+ "in_function: void l7vs_protomod_sslid_write_replication_data(struct "
+ "l7vs_sslid_service* sslid_service):sslid_service=&(%s)", ssl_str);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ /* check null */
+ if (sslid_service == NULL) {
+ PUT_LOG_ERROR(sslid_protomod, LOG_CAT_L7VSD_PROTOCOL, 0, "Arg(sslid_service) is NULL pointer.");
+ goto write_replication_data_out;
+ }
+ if (sslid_service->session == NULL) {
+ PUT_LOG_ERROR(sslid_protomod, LOG_CAT_L7VSD_PROTOCOL, 0, "Arg(sslid_service->session) is NULL pointer.");
+ goto write_replication_data_out;
+ }
+ /* no replicate setting */
+ if (sslid_service->replication_addr == NULL) {
+ goto write_replication_data_out;
+ }
+
+ /* copy session data */
+ memcpy(sslid_service->replication_addr, sslid_service->session,
+ sizeof(struct ssl_session) * sslid_service->maxlist);
+
+ /*-------- DEBUG LOG --------*/
+ if (sslid_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == sslid_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ char session_str[DEBUG_STR_LEN];
+ ssl_session_c_str(session_str, (struct ssl_session*) sslid_service->replication_addr);
+ PUT_LOG_DEBUG(sslid_protomod, LOG_CAT_L7VSD_PROTOCOL, 0, "Write replication area: session=(%s)",
+ session_str);
+ }
+ /*------ DEBUG LOG END ------*/
+
+write_replication_data_out:
+ /*-------- DEBUG LOG --------*/
+ if (sslid_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == sslid_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ PUT_LOG_DEBUG(sslid_protomod, LOG_CAT_L7VSD_PROTOCOL,134,
+ "out_function: void l7vs_protomod_sslid_write_replication_data(struct "
+ "l7vs_sslid_service* sslid_service)");
+ }
+ /*------ DEBUG LOG END ------*/
+}
+
+/*!
+ * Serialize struct l7vs_sslid_service for debug log.
+ * @param[out] buf serialized string
+ * @param[in] sslid l7vs_sslid_service struct
+ */
+static void l7vs_sslid_service_c_str(char* buf, struct l7vs_sslid_service* sslid) {
+ if (sslid == NULL) {
+ snprintf(buf, DEBUG_STR_LEN, "NULL");
+ }
+ else {
+ char session_str[DEBUG_STR_LEN] = {0};
+ ssl_session_c_str(session_str, sslid->session);
+ snprintf(buf, DEBUG_STR_LEN, "service_handle=%d, timeout=%d, maxlist=%d, "
+ "session=(%s), replication_addr=%p, reschedule=%d", sslid->service_handle,
+ sslid->timeout, sslid->maxlist, session_str, sslid->replication_addr,
+ sslid->reschedule);
+ }
+}
+
+/*!
+ * Serialize struct l7vs_sslid_service_arg for debug log.
+ * @param[out] buf serialized string
+ * @param[in] sslid_arg l7vs_sslid_service_arg struct
+ */
+void l7vs_sslid_service_arg_c_str(char* buf, struct l7vs_sslid_service_arg* sslid_arg) {
+ if (sslid_arg == NULL) {
+ snprintf(buf, DEBUG_STR_LEN, "NULL");
+ }
+ else {
+ snprintf(buf, DEBUG_STR_LEN, "timeout=%d, maxlist=%d, reschedule=%d",
+ sslid_arg->timeout, sslid_arg->maxlist, sslid_arg->reschedule);
+ }
+}
+
+/*!
+ * Serialize struct ssl_session for debug log.
+ * @param[out] buf serialized string
+ * @param[in] session ssl_session struct
+ */
+static void ssl_session_c_str(char* buf, struct ssl_session* session) {
+ if (session == NULL) {
+ snprintf(buf, DEBUG_STR_LEN, "NULL");
+ }
+ else {
+ char dest_str[DEBUG_STR_LEN] = {0};
+ char session_str[SSLID_LENGTH * 2 + 1];
+ l7vs_dest_c_str(dest_str, &session->dest);
+ id_c_str(session_str, session->id);
+ snprintf(buf, DEBUG_STR_LEN, "id=%s, dest=(%s), last_time=%d, valid=%d",
+ session_str, dest_str, (u_int) session->last_time, (int)session->valid);
+ }
+}
+
+/*!
+ * Serialize struct replication_header for debug log.
+ * @param[out] buf serialized string
+ * @param[in] head replication_header struct
+ */
+static void replication_header_c_str(char* buf, struct replication_header* head) {
+ if (head == NULL) {
+ snprintf(buf, DEBUG_STR_LEN, "NULL");
+ }
+ else {
+ snprintf(buf, DEBUG_STR_LEN, "sin_addr=(s_addr=%ld), sin_port=%d, size=%d, offset=%d",
+ (u_long) head->sin_addr.s_addr, head->sin_port, head->size, head->offset);
+ }
+}
+
+/*!
+ * Convert SSL session ID (binary to hex)
+ * @param[out] buf hex string
+ * @param[in] id SSL session ID
+ */
+static void id_c_str(char* buf, char* id) {
+ int i;
+ if (id == NULL) {
+ snprintf(buf, DEBUG_STR_LEN, "NULL");
+ }
+ else {
+ for (i = 0; i < SSLID_LENGTH; i++) {
+ snprintf(buf + i * 2, DEBUG_STR_LEN - i * 2, "%02X", (unsigned int)id[i]);
+ }
+ }
+}
--- /dev/null
+/*
+ * @file protomod_sslid.h
+ * @brief protocol module of HTTPS(SSL/TLS).
+ * @brief this module provide session persistence by SSL session ID.
+ *
+ * L7VSD: Linux Virtual Server for Layer7 Load Balancing
+ * Copyright (C) 2008 NTT COMWARE Corporation.
+ * Copyright (C) 2009 Shinya TAKEBAYASHI
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ **********************************************************************/
+
+#ifndef __PROTOMOD_SSLID_H_7E0F0EB6_200B_4839_8C5D_60E4473F9E40__
+#define __PROTOMOD_SSLID_H_7E0F0EB6_200B_4839_8C5D_60E4473F9E40__
+
+#include "l7vs_service.h"
+
+#define SERVICE_ARG_MAXSIZE (512)
+#define SSLID_SERVICE_NUMBER (128)
+#define SSLID_LENGTH (32)
+
+struct l7vs_sslid_service {
+ handle_t service_handle;
+ int timeout;
+ int maxlist;
+ struct ssl_session* session;
+ void* hash_map;
+ void* hash_list;
+ void* replication_addr;
+ int reschedule;
+};
+
+struct l7vs_sslid_service_arg {
+ int timeout;
+ int maxlist;
+ int reschedule;
+};
+
+struct ssl_session {
+ char id[SSLID_LENGTH];
+ struct l7vs_dest dest;
+ time_t last_time;
+ char valid;
+};
+
+struct replication_header {
+ struct in_addr sin_addr;
+ unsigned short sin_port;
+ unsigned int size;
+ unsigned int offset;
+};
+
+#endif // __PROTOMOD_SSLID_H_7E0F0EB6_200B_4839_8C5D_60E4473F9E40__
+
--- /dev/null
+/*
+ * @file protomod_url.c
+ * @brief protocol module of HTTP.
+ * @brief this module provide session persistence by URL.
+ *
+ * L7VSD: Linux Virtual Server for Layer7 Load Balancing
+ * Copyright (C) 2008 NTT COMWARE Corporation.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ **********************************************************************/
+
+#define __STDC_LIMIT_MACROS
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+#include <getopt.h>
+#include "l7vs_service.h"
+#include "l7vs_conn.h"
+#include "l7vs_dest.h"
+#include "l7vs_module.h"
+#include "module_http.h"
+#include <fnmatch.h>
+
+#include <iostream>
+#ifdef USE_BOOST_XPRESSIVE
+ #include <boost/xpressive/xpressive.hpp>
+#else
+ #include <boost/regex.hpp>
+#endif
+
+#define SERVICE_ARG_MAXSIZE (512)
+#define PATTERN_MATCH_MAXSIZE (128)
+#define REGEX_PATTERN_MATCH_MAXSIZE (32)
+#define URL_SERVICE_NUMBER (128)
+#define X_FORWARDED_FOR_LENGTH (48)
+
+struct l7vs_url_service {
+ handle_t service_handle;
+ char pattern_match[PATTERN_MATCH_MAXSIZE];
+ char uri_pattern_match[REGEX_PATTERN_MATCH_MAXSIZE];
+ char host_pattern_match[REGEX_PATTERN_MATCH_MAXSIZE];
+ int forwarded_for;
+#ifdef USE_BOOST_XPRESSIVE
+ boost::xpressive::sregex uri_regex;
+ boost::xpressive::sregex host_regex;
+#else
+ boost::regex uri_regex;
+ boost::regex host_regex;
+#endif
+ int reschedule;
+};
+
+struct l7vs_url_service_arg {
+ char pattern_match[PATTERN_MATCH_MAXSIZE];
+ char uri_pattern_match[REGEX_PATTERN_MATCH_MAXSIZE];
+ char host_pattern_match[REGEX_PATTERN_MATCH_MAXSIZE];
+ int forwarded_for;
+ int reschedule;
+};
+
+static void fini(void);
+static int create(void*, handle_t);
+static void* create_sa(struct l7vs_service_arg*);
+static int compare(handle_t, handle_t);
+static int match_cldata(struct l7vs_service*, struct l7vs_conn*,
+ char*, size_t*, struct l7vs_dest**, int*);
+static int analyze_rsdata(struct l7vs_service*, struct l7vs_conn*,
+ char*, size_t*);
+static int destroy(handle_t);
+static void destroy_sa(void**);
+static int service_arg(struct l7vs_service_arg_multi*, handle_t);
+static int parse(void*, int, char**);
+
+static struct l7vs_url_service *l7vs_protomod_url_search_service(handle_t);
+static struct l7vs_url_service *l7vs_protomod_url_create_service();
+static struct l7vs_url_service *l7vs_protomod_url_create_temp_service();
+
+static void l7vs_url_service_c_str(char*, struct l7vs_url_service*);
+static void l7vs_url_service_arg_c_str(char*, struct l7vs_url_service_arg*);
+
+struct l7vs_url_service *url_service_list[URL_SERVICE_NUMBER];
+
+static struct l7vs_protomod url_protomod = {
+ NULL, /* handle */
+ "url", /* modname */
+ 0, /* refcnt */
+ 0, /* fast schedule */
+ create, /* create function */
+ compare, /* compare function */
+ match_cldata, /* match_cldata function */
+ analyze_rsdata, /* analyze_rsdata function */
+ destroy, /* destroy function */
+ fini, /* fini function */
+ create_sa, /* create_sa function */
+ service_arg, /* service_arg function */
+ parse, /* parse function */
+ destroy_sa, /* destroy_sa function */
+ NULL, /* initialize function */
+ NULL, /* finalize function */
+ NULL, /* get_log_level function */
+ NULL, /* put_log_debug function */
+ NULL, /* put_log_info function */
+ NULL, /* put_log_warn function */
+ NULL, /* put_log_error function */
+ NULL /* put_log_fatal function */
+};
+
+/*!
+ * Protocol module initialize function. This function run when dlopen and dlsym at first time.
+ * @param[in] handle dlopen's handle
+ * @return l7vs_protomod struct
+ */
+extern "C" struct l7vs_protomod *
+init(void *handle)
+{
+ struct l7vs_protomod* return_value = NULL;
+
+ /*-------- DEBUG LOG --------*/
+ if (url_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == url_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ PUT_LOG_DEBUG(url_protomod, LOG_CAT_L7VSD_PROTOCOL,135,
+ "in_function: struct l7vs_protomod* init(void* handle): handle=%p", handle);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ /* check null */
+ if (handle == NULL) {
+ PUT_LOG_ERROR(url_protomod, LOG_CAT_L7VSD_PROTOCOL,117, "Arg(handle) is NULL pointer.");
+ goto init_out;
+ }
+
+ /* initialize url service list */
+ memset(url_service_list, 0, sizeof(struct l7vs_url_service *) * URL_SERVICE_NUMBER);
+ /* set dlopen's handle */
+ url_protomod.handle = handle;
+
+ return_value = &url_protomod;
+
+init_out:
+ /*-------- DEBUG LOG --------*/
+ if (url_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == url_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ char protomod_str[DEBUG_STR_LEN] = {0};
+ l7vs_protomod_c_str(protomod_str, &url_protomod);
+ PUT_LOG_DEBUG(url_protomod, LOG_CAT_L7VSD_PROTOCOL,136,
+ "out_function: struct l7vs_protomod* init(void* handle): return=&(%s)", protomod_str);
+ }
+ /*------ DEBUG LOG END ------*/
+ return return_value;
+}
+
+/*!
+ * Protocol module finalize function. free all url service list just in case.
+ * @param void
+ * @return void
+ */
+static void
+fini(void)
+{
+ /* url service list counter */
+ int service_number = 0;
+
+ /*-------- DEBUG LOG --------*/
+ if (url_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == url_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ PUT_LOG_DEBUG(url_protomod, LOG_CAT_L7VSD_PROTOCOL,137, "in_function: void fini(void)");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ /* check all url service list */
+ for (service_number = 0; service_number < URL_SERVICE_NUMBER; ++service_number) {
+ /* if pointer that does not point NULL exists ... */
+ if (url_service_list[service_number] != NULL) {
+
+ /*-------- DEBUG LOG --------*/
+ if (url_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == url_protomod.get_log_level(LOG_CAT_L7VSD_SYSTEM_MEMORY)) {
+ PUT_LOG_DEBUG(url_protomod, LOG_CAT_L7VSD_SYSTEM_MEMORY,34, "free: %p",
+ url_service_list[service_number]);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ /* free and points NULL */
+ free(url_service_list[service_number]);
+ url_service_list[service_number] = NULL;
+ }
+ }
+ /*-------- DEBUG LOG --------*/
+ if (url_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == url_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ PUT_LOG_DEBUG(url_protomod, LOG_CAT_L7VSD_PROTOCOL,138, "out_function: void fini(void)");
+ }
+ /*------ DEBUG LOG END ------*/
+}
+
+/*!
+ * Create url service struct.
+ * @param url_arg url service argument struct
+ * @param service_handle a unique service ID
+ * @retval 0 successfully create url service.
+ * @retval -1 some errors occur.
+ */
+static int
+create(void *url_arg, handle_t service_handle)
+{
+ struct l7vs_url_service *url_service;
+ struct l7vs_url_service_arg *url_service_arg;
+ int return_value = 0;
+
+ /*-------- DEBUG LOG --------*/
+ if (url_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == url_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ char url_arg_str[DEBUG_STR_LEN] = {0};
+ l7vs_url_service_arg_c_str(url_arg_str, (struct l7vs_url_service_arg*) url_arg);
+ PUT_LOG_DEBUG(url_protomod, LOG_CAT_L7VSD_PROTOCOL,139,
+ "in_function: int create(void* url_arg, handle_t service_handle):url_arg=&(%s), "
+ "service_handle=%d", url_arg_str, service_handle);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ /* check null */
+ if (url_arg == NULL) {
+ PUT_LOG_ERROR(url_protomod, LOG_CAT_L7VSD_PROTOCOL,118, "Arg(url_arg) is NULL pointer.");
+ return_value = -1;
+ goto create_out;
+ }
+
+ if (service_handle != TEMP_SERVICEHANDLE) {
+ /* search empty url service list and create url service */
+ url_service = l7vs_protomod_url_create_service();
+ } else {
+ /* create temporary url service */
+ url_service = l7vs_protomod_url_create_temp_service();
+ }
+
+ /*-------- DEBUG LOG --------*/
+ if (url_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == url_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ char url_str[DEBUG_STR_LEN] = {0};
+ l7vs_url_service_c_str(url_str, url_service);
+ PUT_LOG_DEBUG(url_protomod, LOG_CAT_L7VSD_PROTOCOL,140, "pointer assign: url_service=&(%s)",
+ url_str);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ if (url_service == NULL) {
+ PUT_LOG_ERROR(url_protomod, LOG_CAT_L7VSD_PROTOCOL,119, "Could not make url service.");
+ return_value = -1;
+ goto create_out;
+ }
+
+ url_service_arg = (struct l7vs_url_service_arg *) url_arg;
+
+ /* set service handle, pattern match and reschedule flag */
+ url_service->service_handle = service_handle;
+ strncpy(url_service->pattern_match, url_service_arg->pattern_match, PATTERN_MATCH_MAXSIZE);
+ strncpy(url_service->uri_pattern_match, url_service_arg->uri_pattern_match, REGEX_PATTERN_MATCH_MAXSIZE);
+ strncpy(url_service->host_pattern_match, url_service_arg->host_pattern_match, REGEX_PATTERN_MATCH_MAXSIZE);
+ url_service->forwarded_for = url_service_arg->forwarded_for;
+ if ( strnlen(url_service_arg->uri_pattern_match, REGEX_PATTERN_MATCH_MAXSIZE) ) {
+ try {
+#ifdef USE_BOOST_XPRESSIVE
+ url_service->uri_regex = boost::xpressive::sregex::compile(url_service_arg->uri_pattern_match);
+#else
+ url_service->uri_regex.assign(url_service_arg->uri_pattern_match);
+#endif
+ }
+ catch (...) {
+ PUT_LOG_ERROR(url_protomod, LOG_CAT_L7VSD_PROTOCOL,284, "Regex pattern error of uri_pattern_match");
+ return_value = -1;
+ goto create_out;
+ }
+ }
+ if ( strnlen(url_service_arg->host_pattern_match, REGEX_PATTERN_MATCH_MAXSIZE) ) {
+ try {
+#ifdef USE_BOOST_XPRESSIVE
+ url_service->host_regex = boost::xpressive::sregex::compile(url_service_arg->host_pattern_match);
+#else
+ url_service->host_regex.assign(url_service_arg->host_pattern_match);
+#endif
+ }
+ catch (...) {
+ PUT_LOG_ERROR(url_protomod, LOG_CAT_L7VSD_PROTOCOL,285, "Regex pattern error of host_pattern_match.");
+ return_value = -1;
+ goto create_out;
+ }
+ }
+ url_service->reschedule = url_service_arg->reschedule;
+
+create_out:
+ /*-------- DEBUG LOG --------*/
+ if (url_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == url_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ PUT_LOG_DEBUG(url_protomod, LOG_CAT_L7VSD_PROTOCOL,141,
+ "out_function: int create(void* url_arg, handle_t service_handle):return_value=%d",
+ return_value);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return return_value;
+}
+
+/*!
+ * Create url service argument struct.
+ * @param[out] srv_arg service argument struct
+ * @return url service argument struct
+ */
+static void *
+create_sa(struct l7vs_service_arg *srv_arg)
+{
+ struct l7vs_url_service_arg *url_service_arg;
+
+ /*-------- DEBUG LOG --------*/
+ if (url_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == url_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ char service_arg_str[DEBUG_STR_LEN] = {0};
+ l7vs_service_arg_c_str(service_arg_str, srv_arg);
+ PUT_LOG_DEBUG(url_protomod, LOG_CAT_L7VSD_PROTOCOL,142,
+ "in_function: void* create_sa(struct l7vs_service_arg* srv_arg):srv_arg=&(%s)",
+ service_arg_str);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ /* check null */
+ if (srv_arg == NULL) {
+ PUT_LOG_ERROR(url_protomod, LOG_CAT_L7VSD_PROTOCOL,120, "Arg(srv_arg) is NULL pointer.");
+ url_service_arg = NULL;
+ goto create_sa_out;
+ }
+
+ /* create url service argument struct */
+ url_service_arg = (struct l7vs_url_service_arg *) calloc(1, sizeof(struct l7vs_url_service_arg));
+
+ /*-------- DEBUG LOG --------*/
+ if (url_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == url_protomod.get_log_level(LOG_CAT_L7VSD_SYSTEM_MEMORY)) {
+ PUT_LOG_DEBUG(url_protomod, LOG_CAT_L7VSD_SYSTEM_MEMORY,35, "calloc: addr=%p, size=%ld",
+ url_service_arg, (unsigned long int) sizeof(struct l7vs_url_service_arg));
+ }
+ /*------ DEBUG LOG END ------*/
+
+ if (url_service_arg == NULL) {
+ PUT_LOG_ERROR(url_protomod, LOG_CAT_L7VSD_SYSTEM_MEMORY,27, "Could not allocate memory.");
+ goto create_sa_out;
+ }
+
+ /* set url service argument size and protomod name "url" */
+ srv_arg->len = sizeof(struct l7vs_url_service_arg);
+ strcpy(srv_arg->protomod, url_protomod.modname);
+
+create_sa_out:
+ /*-------- DEBUG LOG --------*/
+ if (url_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == url_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ char url_service_arg_str[DEBUG_STR_LEN] = {0};
+ l7vs_url_service_arg_c_str(url_service_arg_str, url_service_arg);
+ PUT_LOG_DEBUG(url_protomod, LOG_CAT_L7VSD_PROTOCOL,143,
+ "out_function: void* create_sa(struct l7vs_service_arg* srv_arg):return_value=&(%s)",
+ url_service_arg_str);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return (void*) url_service_arg;
+}
+
+/*!
+ * Compare two service.
+ * @param[in] srv_handle1 one of a unique service ID
+ * @param[in] srv_handle2 one of a unique service ID
+ * @retval 0 they matched perfectly.
+ * @retval -1 they are different.
+ */
+static int
+compare(handle_t srv_handle1, handle_t srv_handle2)
+{
+ struct l7vs_url_service *url_srv1, *url_srv2;
+ int return_value = 0;
+
+ /*-------- DEBUG LOG --------*/
+ if (url_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == url_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ PUT_LOG_DEBUG(url_protomod, LOG_CAT_L7VSD_PROTOCOL,144,
+ "in_function: int compare(handle_t srv_handle1, handle_t srv_handle2):"
+ "srv_handle1=%u, srv_handle2=%u", srv_handle1, srv_handle2);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ /* search service that has such a service ID(1) */
+ url_srv1 = l7vs_protomod_url_search_service(srv_handle1);
+
+ /*-------- DEBUG LOG --------*/
+ if (url_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == url_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ char url_str[DEBUG_STR_LEN] = {0};
+ l7vs_url_service_c_str(url_str, url_srv1);
+ PUT_LOG_DEBUG(url_protomod, LOG_CAT_L7VSD_PROTOCOL,145, "pointer assign: url_srv1=&(%s)",
+ url_str);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ if (url_srv1 == NULL) {
+ PUT_LOG_ERROR(url_protomod, LOG_CAT_L7VSD_PROTOCOL,121,
+ "Could not find such service handle's url service.");
+ return_value = -1;
+ goto compare_out;
+ }
+
+ /* search service that has such a service ID(2) */
+ url_srv2 = l7vs_protomod_url_search_service(srv_handle2);
+
+ /*-------- DEBUG LOG --------*/
+ if (url_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == url_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ char url_str[DEBUG_STR_LEN] = {0};
+ l7vs_url_service_c_str(url_str, url_srv2);
+ PUT_LOG_DEBUG(url_protomod, LOG_CAT_L7VSD_PROTOCOL,146, "pointer assign: url_srv2=&(%s)",
+ url_str);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ if (url_srv2 == NULL) {
+ PUT_LOG_ERROR(url_protomod, LOG_CAT_L7VSD_PROTOCOL,122,
+ "Could not find such service handle's url service.");
+ return_value = -1;
+ goto compare_out;
+ }
+
+ /* compare two pattern match */
+ if (strncmp(url_srv1->pattern_match, url_srv2->pattern_match, PATTERN_MATCH_MAXSIZE) != 0) {
+ return_value = -1;
+ goto compare_out;
+ }
+ if (strncmp(url_srv1->uri_pattern_match, url_srv2->uri_pattern_match, REGEX_PATTERN_MATCH_MAXSIZE) != 0) {
+ return_value = -1;
+ goto compare_out;
+ }
+ if (strncmp(url_srv1->host_pattern_match, url_srv2->host_pattern_match, REGEX_PATTERN_MATCH_MAXSIZE) != 0) {
+ return_value = -1;
+ goto compare_out;
+ }
+
+compare_out:
+ /*-------- DEBUG LOG --------*/
+ if (url_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == url_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ PUT_LOG_DEBUG(url_protomod, LOG_CAT_L7VSD_PROTOCOL,147,
+ "out_function: int compare(handle_t srv_handle1, handle_t srv_handle2):return_value=%d",
+ return_value);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return return_value;
+}
+
+/*!
+ * Check the client packet and determine a real server.
+ * @param[in] srv service struct include service handle, protocol module and schedule module.
+ * @param[in] conn connection data.
+ * @param[in] request packet data from client
+ * @param[in] len length of packet data
+ * @param[out] dest destination (real server) list
+ * @param[out] tcps TCP Splicer flag
+ * @retval 0 successfully check packet data
+ * @retval -1 some errors occur.
+ */
+static int
+match_cldata(struct l7vs_service *srv, struct l7vs_conn *conn,
+ char *request, size_t *len, struct l7vs_dest **dest, int *tcps)
+{
+ struct l7vs_url_service *url_service;
+ int ret;
+ int i;
+ int asterisk_num = 0;
+ size_t pattern_len;
+ size_t uri_len;
+ char *uri, *host, pattern[PATTERN_MATCH_MAXSIZE + 2];
+ int offset_length;
+ char *x_forwarded_value;
+ char *next_line = NULL;
+ char x_forwarded_for_header[X_FORWARDED_FOR_LENGTH];
+ char backup_char;
+ int return_value = 0;
+
+ std::string packet_data;
+
+ /*-------- DEBUG LOG --------*/
+ if (url_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == url_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ char srv_str[DEBUG_STR_LEN] = {0};
+ char conn_str[DEBUG_STR_LEN] = {0};
+ char dest_str[DEBUG_STR_LEN] = {0};
+ char len_str[DEBUG_STR_LEN] = {0};
+ char tcps_str[DEBUG_STR_LEN] = {0};
+ l7vs_service_c_str(srv_str, srv);
+ l7vs_conn_c_str(conn_str, conn);
+ if (dest != NULL) {
+ l7vs_dest_c_str(dest_str, *dest);
+ }
+ else {
+ strncpy(dest_str, "NULL", DEBUG_STR_LEN);
+ }
+ if (len != NULL) {
+ snprintf(len_str, DEBUG_STR_LEN, "%lu", (unsigned long int) *len);
+ }
+ else {
+ strncpy(len_str, "NULL", DEBUG_STR_LEN);
+ }
+ if (tcps != NULL) {
+ snprintf(tcps_str, DEBUG_STR_LEN, "%d", *tcps);
+ }
+ else {
+ strncpy(tcps_str, "NULL", DEBUG_STR_LEN);
+ }
+ PUT_LOG_DEBUG(url_protomod, LOG_CAT_L7VSD_PROTOCOL,148,
+ "in_function: int match_cldata(struct l7vs_service* srv, struct l7vs_conn* conn, "
+ "char* request, size_t* len, struct l7vs_dest** dest, int* tcps):srv=&(%s), conn=&(%s), "
+ "request=\"%s\", len=&(%s), dest=&(&(%s)), tcps=&(%s)",
+ srv_str, conn_str, request, len_str, dest_str, tcps_str);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ /* check null */
+ if (srv == NULL) {
+ PUT_LOG_ERROR(url_protomod, LOG_CAT_L7VSD_PROTOCOL,123, "Arg(srv) is NULL pointer.");
+ return_value = -1;
+ goto match_cldata_out;
+ }
+ if (srv->pm == NULL) {
+ PUT_LOG_ERROR(url_protomod, LOG_CAT_L7VSD_PROTOCOL,124, "Arg(srv->pm) is NULL pointer.");
+ return_value = -1;
+ goto match_cldata_out;
+ }
+ if (request == NULL) {
+ PUT_LOG_ERROR(url_protomod, LOG_CAT_L7VSD_PROTOCOL,125, "Arg(request) is NULL pointer.");
+ return_value = -1;
+ goto match_cldata_out;
+ }
+ if (len == NULL) {
+ PUT_LOG_ERROR(url_protomod, LOG_CAT_L7VSD_PROTOCOL,126, "Arg(len) is NULL pointer.");
+ return_value = -1;
+ goto match_cldata_out;
+ }
+ if (dest == NULL) {
+ PUT_LOG_ERROR(url_protomod, LOG_CAT_L7VSD_PROTOCOL,127, "Arg(dest) is NULL pointer.");
+ return_value = -1;
+ goto match_cldata_out;
+ }
+ if (tcps == NULL) {
+ PUT_LOG_ERROR(url_protomod, LOG_CAT_L7VSD_PROTOCOL,128, "Arg(tcps) is NULL pointer.");
+ return_value = -1;
+ goto match_cldata_out;
+ }
+
+ /* search service that has such a service ID */
+ url_service = l7vs_protomod_url_search_service(srv->handle);
+
+ /*-------- DEBUG LOG --------*/
+ if (url_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == url_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ char url_str[DEBUG_STR_LEN] = {0};
+ l7vs_url_service_c_str(url_str, url_service);
+ PUT_LOG_DEBUG(url_protomod, LOG_CAT_L7VSD_PROTOCOL,149, "pointer assign: url_service=&(%s)",
+ url_str);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ if (url_service == NULL) {
+ PUT_LOG_ERROR(url_protomod, LOG_CAT_L7VSD_PROTOCOL,129, "Could not find such service handle's url service.");
+ return_value = -1;
+ goto match_cldata_out;
+ }
+
+ /* initialize protocol module ... clear destination list */
+ ret = srv->pm->initialize(srv, conn, request, *len, dest);
+ if (ret != 0) {
+ PUT_LOG_ERROR(url_protomod, LOG_CAT_L7VSD_PROTOCOL,130, "Could not initialize protomod.");
+ return_value = -1;
+ goto match_cldata_out;
+ }
+
+ /* check pattern_match length */
+ if (url_service->pattern_match[0] != '\0') {
+// remove log because of add new key --uri-pattern-match, --host-pattern-match)
+// PUT_LOG_ERROR(url_protomod, LOG_CAT_L7VSD_PROTOCOL,131, "Pattern match is NULL pointer");
+ /* check the size of request data */
+ pattern_len = strnlen(url_service->pattern_match, PATTERN_MATCH_MAXSIZE);
+ /* When '*' is included in pattern_match, number of '*' is decreased from pattern_len */
+ for (i = 0; i < (int)pattern_len; i++) {
+ if (url_service->pattern_match[i] == '*') {
+ asterisk_num++;
+ }
+ }
+ pattern_len -= (size_t)asterisk_num;
+ if (*len < (15 + pattern_len) ) {
+ PUT_LOG_INFO(url_protomod, LOG_CAT_L7VSD_PROTOCOL,6, "Request data is too short.");
+ return_value = 1;
+ goto match_cldata_out;
+ }
+ }
+
+ /* check the HTTP method in HTTP request header */
+ uri_len = *len;
+ uri = http_check_request_method(request, &uri_len);
+ if (uri == NULL) {
+ PUT_LOG_INFO(url_protomod, LOG_CAT_L7VSD_PROTOCOL,7, "Client message is not HTTP request.");
+ return_value = 1;
+ goto match_cldata_out;
+ }
+
+ /* check keyword (URI/--uri-pattern-match)*/
+ if (url_service->uri_pattern_match[0] != '\0') {
+ packet_data = std::string(uri, uri_len);
+#ifdef USE_BOOST_XPRESSIVE
+ if ( !boost::xpressive::regex_search(packet_data, url_service->uri_regex) ) {
+#else
+ if ( !boost::regex_search(packet_data, url_service->uri_regex) ) {
+#endif
+ return_value = -1;
+ goto match_cldata_out;
+ }
+ }
+ /* check keyword (URI/--pattern-match)*/
+ if (url_service->pattern_match[0] != '\0') {
+ backup_char = uri[uri_len];
+ uri[uri_len] = '\0';
+ snprintf(pattern, pattern_len + 3, "*%s*", url_service->pattern_match);
+ ret = fnmatch(pattern, uri, 0);
+ uri[uri_len] = backup_char;
+ }
+ if ( (url_service->pattern_match[0] != '\0' && ret != 0) ||
+ (url_service->host_pattern_match[0] != '\0') ) {
+
+ /* search Host field in HTTP request header */
+ host = http_search_header_field(request, "Host");
+ if (host == NULL) {
+ PUT_LOG_INFO(url_protomod, LOG_CAT_L7VSD_PROTOCOL,8, "Could not find Host field.");
+ return_value = 1;
+ goto match_cldata_out;
+ }
+ else {
+ next_line = http_skip_header_line(host);
+ if (next_line) {
+ next_line--; // *next_line == '\n'
+ if (*(next_line - 1) == '\r') {
+ next_line--;
+ }
+ /* check keyword (HOST/--host-pattern-match) */
+ if (url_service->host_pattern_match[0] != '\0') {
+ packet_data = std::string(host, next_line - host);
+#ifdef USE_BOOST_XPRESSIVE
+ if ( !boost::xpressive::regex_search(packet_data, url_service->host_regex) ) {
+#else
+ if ( !boost::regex_search(packet_data, url_service->host_regex) ) {
+#endif
+ return_value = -1;
+ goto match_cldata_out;
+ }
+ }
+ /* check keyword (HOST/--pattern-match) */
+ if (url_service->pattern_match[0] != '\0' && ret != 0) {
+ backup_char = *next_line;
+ *next_line = '\0';
+ ret = fnmatch(pattern, host, 0);
+ *next_line = backup_char;
+ if ( ret != 0 ) {
+ return_value = 1;
+ goto match_cldata_out;
+ }
+ }
+ }
+ next_line = NULL;
+ }
+ }
+
+ /* add X-Forwarded-For field */
+ if (url_service->forwarded_for) {
+ x_forwarded_value = http_search_header_field(request, "X-Forwarded-For");
+
+ /* already exists X-Forwarded-For field */
+ if (x_forwarded_value) {
+ next_line = http_skip_header_line(x_forwarded_value);
+ /* backtrack to look up insert point */
+ if (next_line) {
+ next_line--; // *next_line == '\n'
+ if (*(next_line - 1) == '\r') {
+ next_line--;
+ }
+ /* append client IP address */
+ snprintf(x_forwarded_for_header, X_FORWARDED_FOR_LENGTH, ", %s", inet_ntoa(conn->caddr.sin_addr));
+ }
+ }
+
+ /* not exists X-Forwarded-For field */
+ if (!next_line) {
+ /* construct new X-Forwarded-For header item */
+ snprintf(x_forwarded_for_header, X_FORWARDED_FOR_LENGTH, "X-Forwarded-For: %s\r\n", inet_ntoa(conn->caddr.sin_addr));
+
+ next_line = http_skip_header_line(request);
+ }
+
+ /* when insert point exist */
+ if (next_line != NULL) {
+ offset_length = (int) (next_line - request);
+
+ /* insert X-Forwarded-For header field */
+ http_insert_field(request, offset_length, x_forwarded_for_header, *len);
+
+ /* add header length */
+ *len += strlen(x_forwarded_for_header);
+ }
+ }
+
+ *tcps = 0;
+
+ /* finalize */
+ ret = srv->pm->finalize(srv, conn, request, *len, dest, url_service->reschedule);
+ if (ret != 0) {
+ PUT_LOG_INFO(url_protomod, LOG_CAT_L7VSD_PROTOCOL,12, "Could not finalize protomod. (Realserver decision failure)");
+ return_value = -1;
+ goto match_cldata_out;
+ }
+
+match_cldata_out:
+ /*-------- DEBUG LOG --------*/
+ if (url_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == url_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ PUT_LOG_DEBUG(url_protomod, LOG_CAT_L7VSD_PROTOCOL,150,
+ "out_function: int match_cldata(struct l7vs_service* srv, struct l7vs_conn* conn, "
+ "char* request, size_t* len, struct l7vs_dest** dest, int* tcps):return_value=%d",
+ return_value);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return return_value;
+}
+
+/*!
+ * Check the real server packet and insert a Set-Cookie field.
+ * @param[in] srv service struct include service handle, protocol module and schedule module.
+ * @param[in] conn connection data.
+ * @param[in] response packet data from real server
+ * @param[in] len length of packet data. it will be lengthened.
+ * @retval 0 successfully check packet data.
+ * @retval -1 some errors occur.
+ */
+static int
+analyze_rsdata(struct l7vs_service *srv, struct l7vs_conn *conn,
+ char *response, size_t *len)
+{
+ int return_value = 0;
+
+ /*-------- DEBUG LOG --------*/
+ if (url_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == url_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ char srv_str[DEBUG_STR_LEN] = {0};
+ char conn_str[DEBUG_STR_LEN] = {0};
+ char len_str[DEBUG_STR_LEN] = {0};
+ l7vs_service_c_str(srv_str, srv);
+ l7vs_conn_c_str(conn_str, conn);
+ if (len != NULL) {
+ snprintf(len_str, DEBUG_STR_LEN, "%lu", (unsigned long int) *len);
+ }
+ else {
+ strncpy(len_str, "NULL", DEBUG_STR_LEN);
+ }
+ PUT_LOG_DEBUG(url_protomod, LOG_CAT_L7VSD_PROTOCOL,151,
+ "in_function: int analyze_rsdata(struct l7vs_service* srv, struct l7vs_conn* conn, "
+ "char* response, size_t* len):srv=&(%s), conn=&(%s), response=\"%s\", len=&(%s)",
+ srv_str, conn_str, response, len_str);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ /* check null */
+ if (srv == NULL) {
+ PUT_LOG_ERROR(url_protomod, LOG_CAT_L7VSD_PROTOCOL,133, "Arg(srv) is NULL pointer.");
+ return_value = -1;
+ goto analyze_rsdata_out;
+ }
+ if (conn == NULL) {
+ PUT_LOG_ERROR(url_protomod, LOG_CAT_L7VSD_PROTOCOL,134, "Arg(conn) is NULL pointer.");
+ return_value = -1;
+ goto analyze_rsdata_out;
+ }
+ if (conn->dest == NULL) {
+ PUT_LOG_ERROR(url_protomod, LOG_CAT_L7VSD_PROTOCOL,135, "Arg(conn->dest) is NULL pointer.");
+ return_value = -1;
+ goto analyze_rsdata_out;
+ }
+ if (response == NULL) {
+ PUT_LOG_ERROR(url_protomod, LOG_CAT_L7VSD_PROTOCOL,136, "Arg(response) is NULL pointer.");
+ return_value = -1;
+ goto analyze_rsdata_out;
+ }
+ if (len == NULL) {
+ PUT_LOG_ERROR(url_protomod, LOG_CAT_L7VSD_PROTOCOL,137, "Arg(len) is NULL pointer.");
+ return_value = -1;
+ goto analyze_rsdata_out;
+ }
+
+ /* sorry flag check */
+ if (conn->sorry_conn_flag == 1) {
+ /*-------- DEBUG LOG --------*/
+ if (url_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == url_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ PUT_LOG_DEBUG(url_protomod, LOG_CAT_L7VSD_PROTOCOL,152, "Response from sorry server.");
+ }
+ /*------ DEBUG LOG END ------*/
+ goto analyze_rsdata_out;
+ }
+
+analyze_rsdata_out:
+ /*-------- DEBUG LOG --------*/
+ if (url_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == url_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ PUT_LOG_DEBUG(url_protomod, LOG_CAT_L7VSD_PROTOCOL,153,
+ "out_function: int analyze_rsdata(struct l7vs_service* srv, struct l7vs_conn* conn, "
+ "char* response, size_t* len):return_value=%d", return_value);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return return_value;
+}
+
+/*!
+ * Destroy url service
+ * @param[in] srv_handle a unique service ID
+ * @retval 0 successfully check packet data.
+ * @retval -1 some errors occur.
+ */
+static int
+destroy(handle_t srv_handle)
+{
+ /* url service list counter */
+ int service_number = 0;
+ int free_flag = 0;
+ int return_value = 0;
+
+ /*-------- DEBUG LOG --------*/
+ if (url_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == url_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ PUT_LOG_DEBUG(url_protomod, LOG_CAT_L7VSD_PROTOCOL,154,
+ "in_function: int destroy(handle_t srv_handle):srv_handle=%u",
+ srv_handle);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ /* check all url service list */
+ for (service_number = 0; service_number < URL_SERVICE_NUMBER; ++service_number) {
+ /* found url service that has srv_handle */
+ if (url_service_list[service_number] != NULL &&
+ url_service_list[service_number]->service_handle == srv_handle) {
+
+ /*-------- DEBUG LOG --------*/
+ if (url_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == url_protomod.get_log_level(LOG_CAT_L7VSD_SYSTEM_MEMORY)) {
+ PUT_LOG_DEBUG(url_protomod, LOG_CAT_L7VSD_SYSTEM_MEMORY,36, "free: %p",
+ url_service_list[service_number]);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ /* free and NULL */
+ free(url_service_list[service_number]);
+ url_service_list[service_number] = NULL;
+
+ free_flag = 1;
+ break;
+ }
+ }
+
+ /* url service was not found */
+ if (free_flag == 0) {
+ PUT_LOG_ERROR(url_protomod, LOG_CAT_L7VSD_PROTOCOL,138, "Could not find such service handle's url service.");
+ return_value = -1;
+ goto destroy_out;
+ }
+
+destroy_out:
+ /*-------- DEBUG LOG --------*/
+ if (url_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == url_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ PUT_LOG_DEBUG(url_protomod, LOG_CAT_L7VSD_PROTOCOL,155,
+ "out_function: int destroy(handle_t srv_handle):return_value=%d",
+ srv_handle);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return return_value;
+}
+
+/*!
+ * Destroy url service argument
+ * @param[in] url_arg url service argument
+ * @return void
+ */
+static void
+destroy_sa(void **url_arg)
+{
+ /*-------- DEBUG LOG --------*/
+ if (url_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == url_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ char url_arg_str[DEBUG_STR_LEN] = {0};
+ if (url_arg != NULL) {
+ l7vs_url_service_arg_c_str(url_arg_str, (struct l7vs_url_service_arg*) *url_arg);
+ }
+ else {
+ strncpy(url_arg_str, "NULL", DEBUG_STR_LEN);
+ }
+ PUT_LOG_DEBUG(url_protomod, LOG_CAT_L7VSD_PROTOCOL,156,
+ "in_function: void destroy_sa(void** url_arg):url_arg=&(&(%s))",
+ url_arg_str);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ /* check null */
+ if (url_arg == NULL) {
+ PUT_LOG_ERROR(url_protomod, LOG_CAT_L7VSD_PROTOCOL,139, "Arg(url_arg) is NULL pointer.");
+ }
+ else if (*url_arg == NULL) {
+ PUT_LOG_ERROR(url_protomod, LOG_CAT_L7VSD_PROTOCOL,140, "Arg(*url_arg) is NULL pointer.");
+ }
+ else {
+ /*-------- DEBUG LOG --------*/
+ if (url_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == url_protomod.get_log_level(LOG_CAT_L7VSD_SYSTEM_MEMORY)) {
+ PUT_LOG_DEBUG(url_protomod, LOG_CAT_L7VSD_SYSTEM_MEMORY,37, "free: %p",
+ *url_arg);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ /* free and NULL */
+ free((struct l7vs_url_service_arg*) *url_arg);
+ *url_arg = NULL;
+ }
+
+ /*-------- DEBUG LOG --------*/
+ if (url_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == url_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ PUT_LOG_DEBUG(url_protomod, LOG_CAT_L7VSD_PROTOCOL,157,
+ "out_function: void destroy_sa(void** url_arg)");
+ }
+ /*------ DEBUG LOG END ------*/
+}
+
+/*!
+ * Create strings for service list of l7vsadm
+ * @param srv_arg service argument struct
+ * @param srv_handle a unique service ID
+ * @retval 0 successfully create strings
+ * @retval -1 some errors occur.
+ */
+static int
+service_arg(struct l7vs_service_arg_multi *srv_arg_mt, handle_t srv_handle)
+{
+ struct l7vs_url_service *url_service;
+ struct l7vs_url_service_arg c_sarg;
+ char url_argument[SERVICE_ARG_MAXSIZE];
+ int return_value = 0;
+
+ /*-------- DEBUG LOG --------*/
+ if (url_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == url_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ char srv_arg_mt_str[DEBUG_STR_LEN] = {0};
+ l7vs_service_arg_multi_c_str(srv_arg_mt_str, srv_arg_mt);
+ PUT_LOG_DEBUG(url_protomod, LOG_CAT_L7VSD_PROTOCOL,158,
+ "in_function: int service_arg(struct l7vs_service_arg_multi* srv_arg_mt, "
+ "handle_t srv_handle):srv_arg_mt=&(%s), srv_handle=%u",
+ srv_arg_mt_str, srv_handle);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ /* check null */
+ if (srv_arg_mt == NULL) {
+ PUT_LOG_ERROR(url_protomod, LOG_CAT_L7VSD_PROTOCOL,141, "Arg(srv_arg_mt) is NULL pointer.");
+ return_value = -1;
+ goto service_arg_out;
+ }
+
+ /* search service that has such a service ID */
+ url_service = l7vs_protomod_url_search_service(srv_handle);
+
+ /*-------- DEBUG LOG --------*/
+ if (url_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == url_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ char url_str[DEBUG_STR_LEN] = {0};
+ l7vs_url_service_c_str(url_str, url_service);
+ PUT_LOG_DEBUG(url_protomod, LOG_CAT_L7VSD_PROTOCOL,159, "pointer assign: url_service=&(%s)",
+ url_str);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ if (url_service == NULL) {
+ PUT_LOG_ERROR(url_protomod, LOG_CAT_L7VSD_PROTOCOL,142, "Could not find such service handle's url service.");
+ return_value = -1;
+ goto service_arg_out;
+ }
+
+ /* initialize argument strings */
+ memset(url_argument, 0, SERVICE_ARG_MAXSIZE);
+
+ /* set url args to service argument struct */
+ srv_arg_mt->srv_arg.reschedule = url_service->reschedule;
+
+ /* create long argument (l7vsadm option -L/-l) */
+ if ( strnlen(url_service->pattern_match, PATTERN_MATCH_MAXSIZE) ) {
+ snprintf(url_argument, SERVICE_ARG_MAXSIZE, "--pattern-match %s", url_service->pattern_match);
+ }
+ if ( strnlen(url_service->uri_pattern_match, REGEX_PATTERN_MATCH_MAXSIZE) ) {
+ snprintf(url_argument + strlen(url_argument), SERVICE_ARG_MAXSIZE - strlen(url_argument),
+ " --uri-pattern-match %s", url_service->uri_pattern_match);
+ }
+ if ( strnlen(url_service->host_pattern_match, REGEX_PATTERN_MATCH_MAXSIZE) ) {
+ snprintf(url_argument + strlen(url_argument), SERVICE_ARG_MAXSIZE - strlen(url_argument),
+ " --host-pattern-match %s", url_service->host_pattern_match);
+ }
+ strncpy(srv_arg_mt->srv_arg.protomod_key_string, url_argument, 256);
+
+ /* create verbose argument (l7vsadm option -V/-v) */
+ if (url_service->forwarded_for) {
+ snprintf(url_argument + strlen(url_argument), SERVICE_ARG_MAXSIZE - strlen(url_argument),
+ " --forwarded-for");
+ }
+ strncpy(srv_arg_mt->srv_arg.protomod_opt_string, url_argument, 512);
+
+ strncpy(c_sarg.pattern_match, url_service->pattern_match, PATTERN_MATCH_MAXSIZE);
+ strncpy(c_sarg.uri_pattern_match, url_service->uri_pattern_match, REGEX_PATTERN_MATCH_MAXSIZE);
+ strncpy(c_sarg.host_pattern_match, url_service->host_pattern_match, REGEX_PATTERN_MATCH_MAXSIZE);
+ c_sarg.reschedule = url_service->reschedule;
+
+ memcpy(srv_arg_mt->protomod_arg, &c_sarg, sizeof(struct l7vs_url_service_arg));
+
+ /*-------- DEBUG LOG --------*/
+ if (url_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == url_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ char url_arg_str[DEBUG_STR_LEN] = {0};
+ l7vs_url_service_arg_c_str(url_arg_str, &c_sarg);
+ PUT_LOG_DEBUG(url_protomod, LOG_CAT_L7VSD_PROTOCOL,160,
+ "pointer assign: srv_arg_mt->protomod_arg=&(%s)", url_arg_str);
+ }
+ /*------ DEBUG LOG END ------*/
+
+service_arg_out:
+ /*-------- DEBUG LOG --------*/
+ if (url_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == url_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ PUT_LOG_DEBUG(url_protomod, LOG_CAT_L7VSD_PROTOCOL,161,
+ "out_function: int service_arg(struct l7vs_service_arg_multi* srv_arg_mt, "
+ "handle_t srv_handle):return_value=%d", return_value);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return return_value;
+}
+
+/*!
+ * Parse l7vsadm options to url argument
+ * @param[out] url_arg url service argument struct
+ * @param[int] argc number of l7vsadm argument
+ * @param[int] argv l7vsadm argument list
+ * @retval 0 successfully parse argument
+ * @retval -1 some errors occur.
+ */
+static int
+parse(void *url_arg, int argc, char *argv[])
+{
+ struct l7vs_url_service_arg *url_service_arg;
+ static struct option opt[] = {
+ {"pattern-match", required_argument, NULL, 'P'},
+ {"uri-pattern-match", required_argument, NULL, 'U'},
+ {"host-pattern-match", required_argument, NULL, 'H'},
+ {"forwarded-for", no_argument, NULL, 'F'},
+ {NULL, 0, NULL, 0 }
+ };
+ int c;
+ int pattern_match_flag = 0;
+ int uri_pattern_match_flag = 0;
+ int host_pattern_match_flag = 0;
+ int forwarded_for_flag = 0;
+ int return_value = 0;
+#ifndef USE_BOOST_XPRESSIVE
+ boost::regex regex;
+#endif
+
+ /*-------- DEBUG LOG --------*/
+ if (url_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == url_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ int i;
+ char argv_str[DEBUG_STR_LEN] = {0};
+ char url_arg_str[DEBUG_STR_LEN] = {0};
+ l7vs_url_service_arg_c_str(url_arg_str, (struct l7vs_url_service_arg*) url_arg);
+ argv_str[0] = '\0';
+ if (argv == NULL)
+ snprintf(argv_str, DEBUG_STR_LEN, "NULL");
+ else {
+ for (i = 0; i < argc; i++) {
+ snprintf(argv_str, DEBUG_STR_LEN, "%sargv[%d]=\"%s\", ", argv_str, i, argv[i]);
+ }
+ i = strnlen(argv_str, DEBUG_STR_LEN);
+ if (i > 1)
+ argv_str[i - 2] = '\0';
+ }
+ PUT_LOG_DEBUG(url_protomod, LOG_CAT_L7VSD_PROTOCOL,162,
+ "in_function: int parse(void* url_arg, int argc, char* argv[]):url_arg=&(%s), "
+ "argc=%d, %s", url_arg_str, argc, argv_str);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ /* check null */
+ if (url_arg == NULL) {
+ PUT_LOG_ERROR(url_protomod, LOG_CAT_L7VSD_PROTOCOL,143, "Arg(url_arg) is NULL pointer.");
+ return_value = -1;
+ goto parse_out;
+ }
+ if (argv == NULL) {
+ PUT_LOG_ERROR(url_protomod, LOG_CAT_L7VSD_PROTOCOL,144, "Arg(argv) is NULL pointer.");
+ return_value = -1;
+ goto parse_out;
+ }
+
+ url_service_arg = (struct l7vs_url_service_arg *) url_arg;
+ optind = 0;
+
+ /* check all argument */
+ while ((c = getopt_long(argc, argv, "P:U:H:F", opt, NULL)) != -1) {
+ switch (c) {
+ /* --pattern-match / -P */
+ case 'P':
+ /* check maximum length */
+ if (strnlen(optarg, PATTERN_MATCH_MAXSIZE) >= PATTERN_MATCH_MAXSIZE) {
+ PUT_LOG_ERROR(url_protomod, LOG_CAT_L7VSD_PROTOCOL,145,
+ "-P/--pattern-match option value '%s' too long", optarg);
+ return_value = -1;
+ goto parse_out;
+ }
+ /* check minimum length */
+ if (strnlen(optarg, PATTERN_MATCH_MAXSIZE) <= 0 ) {
+ PUT_LOG_ERROR(url_protomod, LOG_CAT_L7VSD_PROTOCOL,146,
+ "-P/--pattern-match option value '%s' invalid", optarg);
+ return_value = -1;
+ goto parse_out;
+ }
+ strncpy(url_service_arg->pattern_match, optarg, PATTERN_MATCH_MAXSIZE);
+ pattern_match_flag++;
+ break;
+
+ /* --uri-pattern-match / -U */
+ case 'U':
+ /* check maximum length */
+ if (strnlen(optarg, REGEX_PATTERN_MATCH_MAXSIZE) >= REGEX_PATTERN_MATCH_MAXSIZE) {
+ PUT_LOG_ERROR(url_protomod, LOG_CAT_L7VSD_PROTOCOL,286,
+ "-U/--uri-pattern-match option value '%s' too long", optarg);
+ return_value = -1;
+ goto parse_out;
+ }
+ /* check minimum length */
+ if (strnlen(optarg, REGEX_PATTERN_MATCH_MAXSIZE) <= 0 ) {
+ PUT_LOG_ERROR(url_protomod, LOG_CAT_L7VSD_PROTOCOL,287,
+ "-U/--uri-pattern-match option value '%s' invalid", optarg);
+ return_value = -1;
+ goto parse_out;
+ }
+ strncpy(url_service_arg->uri_pattern_match, optarg, REGEX_PATTERN_MATCH_MAXSIZE);
+ uri_pattern_match_flag++;
+ break;
+
+ /* --host-pattern-match / -H */
+ case 'H':
+ /* check maximum length */
+ if (strnlen(optarg, REGEX_PATTERN_MATCH_MAXSIZE) >= REGEX_PATTERN_MATCH_MAXSIZE) {
+ PUT_LOG_ERROR(url_protomod, LOG_CAT_L7VSD_PROTOCOL,288,
+ "-H/--host-pattern-match option value '%s' too long", optarg);
+ return_value = -1;
+ goto parse_out;
+ }
+ /* check minimum length */
+ if (strnlen(optarg, REGEX_PATTERN_MATCH_MAXSIZE) <= 0 ) {
+ PUT_LOG_ERROR(url_protomod, LOG_CAT_L7VSD_PROTOCOL,289,
+ "-H/--host-pattern-match option value '%s' invalid", optarg);
+ return_value = -1;
+ goto parse_out;
+ }
+ strncpy(url_service_arg->host_pattern_match, optarg, REGEX_PATTERN_MATCH_MAXSIZE);
+ host_pattern_match_flag++;
+ break;
+
+ /* --forwarded-for / -F */
+ case 'F':
+ /* x-forwarded-for on */
+ url_service_arg->forwarded_for = 1;
+ forwarded_for_flag++;
+ break;
+
+ /* else error */
+ default:
+ PUT_LOG_ERROR(url_protomod, LOG_CAT_L7VSD_PROTOCOL,147, "Option error.");
+ return_value = -1;
+ goto parse_out;
+ }
+ }
+
+ /* set default no forwarded_for */
+ if (forwarded_for_flag == 0) {
+ url_service_arg->forwarded_for = 0;
+ }
+
+ /* set default no reschedule */
+ url_service_arg->reschedule = 0;
+
+ /* no pattern-match value */
+ if (pattern_match_flag == 0 && uri_pattern_match_flag == 0 && host_pattern_match_flag ==0) {
+ PUT_LOG_ERROR(url_protomod, LOG_CAT_L7VSD_PROTOCOL,148,
+ "You have to set any of '--pattern-match', '--uri-pattern-match' or '--host-pattern-match' option.");
+ return_value = -1;
+ goto parse_out;
+ }
+ /* same option */
+ if (pattern_match_flag > 1) {
+ PUT_LOG_ERROR(url_protomod, LOG_CAT_L7VSD_PROTOCOL,149,
+ "Cannot set multiple option '--pattern-match/-P'.");
+ return_value = -1;
+ goto parse_out;
+ }
+ if (uri_pattern_match_flag > 1) {
+ PUT_LOG_ERROR(url_protomod, LOG_CAT_L7VSD_PROTOCOL,290,
+ "Cannot set multiple option '--uri-pattern-match/-U'.");
+ return_value = -1;
+ goto parse_out;
+ }
+ if (host_pattern_match_flag > 1) {
+ PUT_LOG_ERROR(url_protomod, LOG_CAT_L7VSD_PROTOCOL,291,
+ "Cannot set multiple option '--host-pattern-match/-H'.");
+ return_value = -1;
+ goto parse_out;
+ }
+ /* compile regex */
+ if (uri_pattern_match_flag) {
+ try {
+#ifdef USE_BOOST_XPRESSIVE
+ boost::xpressive::sregex::compile(url_service_arg->uri_pattern_match);
+#else
+ regex.assign(url_service_arg->uri_pattern_match);
+#endif
+ }
+ catch (...) {
+ PUT_LOG_ERROR(url_protomod, LOG_CAT_L7VSD_PROTOCOL,292,
+ "Regex pattern error of option '--uri-pattern-match/-U'.");
+ return_value = -1;
+ goto parse_out;
+ }
+ }
+ if (host_pattern_match_flag) {
+ try {
+#ifdef USE_BOOST_XPRESSIVE
+ boost::xpressive::sregex::compile(url_service_arg->host_pattern_match);
+#else
+ regex.assign(url_service_arg->host_pattern_match);
+#endif
+ }
+ catch (...) {
+ PUT_LOG_ERROR(url_protomod, LOG_CAT_L7VSD_PROTOCOL,293,
+ "Regex pattern error of option '--host-pattern-match/-H'.");
+ return_value = -1;
+ goto parse_out;
+ }
+ }
+
+parse_out:
+ /*-------- DEBUG LOG --------*/
+ if (url_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == url_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ PUT_LOG_DEBUG(url_protomod, LOG_CAT_L7VSD_PROTOCOL,163,
+ "out_function: int parse(void* url_arg, int argc, char* argv[]):return_value=%d",
+ return_value);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return return_value;
+}
+
+/*!
+ * Search url service from url service list using service handle
+ * @param[in] service_handle a unique service ID
+ * @return url service struct when service was found. NULL when service was not found.
+ */
+static struct l7vs_url_service *
+l7vs_protomod_url_search_service(handle_t service_handle)
+{
+ /* url service list counter */
+ int service_number = 0;
+ struct l7vs_url_service* return_value = NULL;
+
+ /*-------- DEBUG LOG --------*/
+ if (url_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == url_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ PUT_LOG_DEBUG(url_protomod, LOG_CAT_L7VSD_PROTOCOL,164,
+ "in_function: struct l7vs_url_service* l7vs_protomod_url_search_service(handle_t service_handle):"
+ "service_handle=%d", service_handle);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ /* check all url service list */
+ for (service_number = 0; service_number < URL_SERVICE_NUMBER; ++service_number) {
+ /* found the service has same service handle */
+ if (url_service_list[service_number] != NULL &&
+ url_service_list[service_number]->service_handle == service_handle) {
+ return_value = url_service_list[service_number];
+ break;
+ }
+ }
+
+ /*-------- DEBUG LOG --------*/
+ if (url_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == url_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ char ssl_str[DEBUG_STR_LEN] = {0};
+ l7vs_url_service_c_str(ssl_str, return_value);
+ PUT_LOG_DEBUG(url_protomod, LOG_CAT_L7VSD_PROTOCOL,165,
+ "out_function: struct l7vs_url_service* l7vs_protomod_url_search_service(handle_t service_handle):"
+ "return_value=&(%s)", ssl_str);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return return_value;
+}
+
+/*!
+ * Create url service.
+ * @param void
+ * @return url service struct when create a service. NULL when cannot create service.
+ */
+static struct l7vs_url_service *
+l7vs_protomod_url_create_service()
+{
+ struct l7vs_url_service* return_value = NULL;
+ int service_number = 0;
+
+ /*-------- DEBUG LOG --------*/
+ if (url_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == url_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ PUT_LOG_DEBUG(url_protomod, LOG_CAT_L7VSD_PROTOCOL,166,
+ "in_function: struct l7vs_url_service* l7vs_protomod_url_create_service()");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ /* check all url service list */
+ for (service_number = 0; service_number < URL_SERVICE_NUMBER - 1; ++service_number) {
+ /* if pointer that does not point NULL exists ... */
+ if (url_service_list[service_number] == NULL) {
+ /* create a service at empty pointer */
+ url_service_list[service_number] = (struct l7vs_url_service *) calloc(1, sizeof(struct l7vs_url_service));
+
+ /*-------- DEBUG LOG --------*/
+ if (url_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == url_protomod.get_log_level(LOG_CAT_L7VSD_SYSTEM_MEMORY)) {
+ PUT_LOG_DEBUG(url_protomod, LOG_CAT_L7VSD_SYSTEM_MEMORY,38, "calloc: addr=%p, size=%ld",
+ url_service_list[service_number], (unsigned long int) sizeof(struct l7vs_url_service));
+ }
+ /*------ DEBUG LOG END ------*/
+
+ if (url_service_list[service_number] == NULL) {
+ PUT_LOG_ERROR(url_protomod, LOG_CAT_L7VSD_SYSTEM_MEMORY,28, "Could not allocate memory.");
+ goto create_service_out;
+ }
+ return_value = url_service_list[service_number];
+ goto create_service_out;
+ }
+ }
+
+ /* all service list is full */
+ PUT_LOG_ERROR(url_protomod, LOG_CAT_L7VSD_PROTOCOL,150, "url service list is full.");
+
+create_service_out:
+ /*-------- DEBUG LOG --------*/
+ if (url_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == url_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ char ssl_str[DEBUG_STR_LEN] = {0};
+ l7vs_url_service_c_str(ssl_str, return_value);
+ PUT_LOG_DEBUG(url_protomod, LOG_CAT_L7VSD_PROTOCOL,167,
+ "out_function: struct l7vs_url_service* l7vs_protomod_url_create_service():"
+ "return_value=&(%s)", ssl_str);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return return_value;
+}
+
+/*!
+ * Create temporary url service.
+ * @param void
+ * @return url service struct when create a service. NULL when cannot create service.
+ */
+static struct l7vs_url_service *
+l7vs_protomod_url_create_temp_service()
+{
+ struct l7vs_url_service* return_value = NULL;
+
+ /*-------- DEBUG LOG --------*/
+ if (url_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == url_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ PUT_LOG_DEBUG(url_protomod, LOG_CAT_L7VSD_PROTOCOL,168,
+ "in_function: struct l7vs_url_service* l7vs_protomod_url_create_temp_service()");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ /* if pointer that does not point NULL exists ... */
+ if (url_service_list[URL_SERVICE_NUMBER - 1] != NULL) {
+ PUT_LOG_ERROR(url_protomod, LOG_CAT_L7VSD_PROTOCOL,151, "Temporary url service is being used by other process.");
+ goto create_temp_service_out;
+ }
+
+ /* create temp service */
+ url_service_list[URL_SERVICE_NUMBER - 1] = (struct l7vs_url_service *) calloc(1, sizeof(struct l7vs_url_service));
+
+ /*-------- DEBUG LOG --------*/
+ if (url_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == url_protomod.get_log_level(LOG_CAT_L7VSD_SYSTEM_MEMORY)) {
+ PUT_LOG_DEBUG(url_protomod, LOG_CAT_L7VSD_SYSTEM_MEMORY,39, "calloc: addr=%p, size=%ld",
+ url_service_list[URL_SERVICE_NUMBER - 1], (unsigned long int) sizeof(struct l7vs_url_service));
+ }
+ /*------ DEBUG LOG END ------*/
+
+ if (url_service_list[URL_SERVICE_NUMBER - 1] == NULL) {
+ PUT_LOG_ERROR(url_protomod, LOG_CAT_L7VSD_SYSTEM_MEMORY,29, "Could not allocate memory");
+ goto create_temp_service_out;
+ }
+
+ return_value = url_service_list[URL_SERVICE_NUMBER - 1];
+
+create_temp_service_out:
+ /*-------- DEBUG LOG --------*/
+ if (url_protomod.get_log_level != NULL &&
+ LOG_LV_DEBUG == url_protomod.get_log_level(LOG_CAT_L7VSD_PROTOCOL)) {
+ char ssl_str[DEBUG_STR_LEN] = {0};
+ l7vs_url_service_c_str(ssl_str, return_value);
+ PUT_LOG_DEBUG(url_protomod, LOG_CAT_L7VSD_PROTOCOL,169,
+ "out_function: struct l7vs_url_service* l7vs_protomod_url_create_service():"
+ "return_value=&(%s)", ssl_str);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return return_value;
+}
+
+/*!
+ * Serialize struct l7vs_url_service for debug log.
+ * @param[out] buf serialized string
+ * @param[in] url l7vs_url_service struct
+ */
+static void l7vs_url_service_c_str(char* buf, struct l7vs_url_service* url) {
+ if (url == NULL) {
+ snprintf(buf, DEBUG_STR_LEN, "NULL");
+ }
+ else {
+ snprintf(buf, DEBUG_STR_LEN, "service_handle=%d, pattern_match=\"%s\", uri_pattern_match=\"%s\", host_pattern_match=\"%s\", "
+ "forwarded_for=%d, reschedule=%d", url->service_handle, url->pattern_match, url->uri_pattern_match, url->host_pattern_match,
+ url->forwarded_for, url->reschedule);
+ }
+}
+
+/*!
+ * Serialize struct l7vs_url_service_arg for debug log.
+ * @param[out] buf serialized string
+ * @param[in] url_arg l7vs_url_service_arg struct
+ */
+void l7vs_url_service_arg_c_str(char* buf, struct l7vs_url_service_arg* url_arg) {
+ if (url_arg == NULL) {
+ snprintf(buf, DEBUG_STR_LEN, "NULL");
+ }
+ else {
+ snprintf(buf, DEBUG_STR_LEN, "pattern_match=\"%s\", uri_pattern_match=\"%s\", host_pattern_match=\"%s\", forwarded_for=%d, reschedule=%d",
+ url_arg->pattern_match, url_arg->uri_pattern_match, url_arg->host_pattern_match, url_arg->forwarded_for, url_arg->reschedule);
+ }
+}
--- /dev/null
+AUTOMAKE_OPTIONS = foreign
+L7VS_MODDIR = @l7vs_moddir@
+AM_CFLAGS = -fPIC $(GLIB_CFLAGS) -I../../include -I../../logger
+lib_LTLIBRARIES = libsched_lc.la libsched_rr.la libsched_wrr.la
+libsched_lc_la_SOURCES = sched_lc.c
+libsched_lc_la_LIBADD = $(GLIB_LIB) -lrt
+libsched_rr_la_SOURCES = sched_rr.c
+libsched_rr_la_LIBADD = $(GLIB_LIB) -lrt
+libsched_wrr_la_SOURCES = sched_wrr.c
+libsched_wrr_la_LIBADD = $(GLIB_LIB) -lrt
+
+install:
+ cp ./.libs/libsched_lc.so ./.libs/sched_lc.so && \
+ cp ./.libs/libsched_rr.so ./.libs/sched_rr.so && \
+ cp ./.libs/libsched_wrr.so ./.libs/sched_wrr.so && \
+ $(INSTALL) -m 755 -d $(L7VS_MODDIR)
+ $(INSTALL) -m 755 -D \
+ ./.libs/sched_lc.so \
+ ./.libs/sched_rr.so \
+ ./.libs/sched_wrr.so \
+ $(L7VS_MODDIR)
--- /dev/null
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ../..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = module/schedule
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+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)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__installdirs = "$(DESTDIR)$(libdir)"
+libLTLIBRARIES_INSTALL = $(INSTALL)
+LTLIBRARIES = $(lib_LTLIBRARIES)
+libsched_lc_la_DEPENDENCIES =
+am_libsched_lc_la_OBJECTS = sched_lc.lo
+libsched_lc_la_OBJECTS = $(am_libsched_lc_la_OBJECTS)
+libsched_rr_la_DEPENDENCIES =
+am_libsched_rr_la_OBJECTS = sched_rr.lo
+libsched_rr_la_OBJECTS = $(am_libsched_rr_la_OBJECTS)
+libsched_wrr_la_DEPENDENCIES =
+am_libsched_wrr_la_OBJECTS = sched_wrr.lo
+libsched_wrr_la_OBJECTS = $(am_libsched_wrr_la_OBJECTS)
+DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \
+ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+ $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(AM_LDFLAGS) $(LDFLAGS) -o $@
+SOURCES = $(libsched_lc_la_SOURCES) $(libsched_rr_la_SOURCES) \
+ $(libsched_wrr_la_SOURCES)
+DIST_SOURCES = $(libsched_lc_la_SOURCES) $(libsched_rr_la_SOURCES) \
+ $(libsched_wrr_la_SOURCES)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+GLIB_CFLAGS = @GLIB_CFLAGS@
+GLIB_GENMARSHAL = @GLIB_GENMARSHAL@
+GLIB_LIBS = @GLIB_LIBS@
+GLIB_MKENUMS = @GLIB_MKENUMS@
+GOBJECT_QUERY = @GOBJECT_QUERY@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MANDIR = @MANDIR@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PKG_CONFIG = @PKG_CONFIG@
+RANLIB = @RANLIB@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+ac_ct_RANLIB = @ac_ct_RANLIB@
+ac_ct_STRIP = @ac_ct_STRIP@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+l7vs_maxvs = @l7vs_maxvs@
+l7vs_moddir = @l7vs_moddir@
+l7vsadm_sockdir = @l7vsadm_sockdir@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+snmpagent_libs = @snmpagent_libs@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+AUTOMAKE_OPTIONS = foreign
+L7VS_MODDIR = @l7vs_moddir@
+AM_CFLAGS = -fPIC $(GLIB_CFLAGS) -I../../include -I../../logger
+lib_LTLIBRARIES = libsched_lc.la libsched_rr.la libsched_wrr.la
+libsched_lc_la_SOURCES = sched_lc.c
+libsched_lc_la_LIBADD = $(GLIB_LIB) -lrt
+libsched_rr_la_SOURCES = sched_rr.c
+libsched_rr_la_LIBADD = $(GLIB_LIB) -lrt
+libsched_wrr_la_SOURCES = sched_wrr.c
+libsched_wrr_la_LIBADD = $(GLIB_LIB) -lrt
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign module/schedule/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign module/schedule/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+install-libLTLIBRARIES: $(lib_LTLIBRARIES)
+ @$(NORMAL_INSTALL)
+ test -z "$(libdir)" || $(mkdir_p) "$(DESTDIR)$(libdir)"
+ @list='$(lib_LTLIBRARIES)'; for p in $$list; do \
+ if test -f $$p; then \
+ f=$(am__strip_dir) \
+ echo " $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \
+ $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(libdir)/$$f"; \
+ else :; fi; \
+ done
+
+uninstall-libLTLIBRARIES:
+ @$(NORMAL_UNINSTALL)
+ @set -x; list='$(lib_LTLIBRARIES)'; for p in $$list; do \
+ p=$(am__strip_dir) \
+ echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$p'"; \
+ $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$p"; \
+ done
+
+clean-libLTLIBRARIES:
+ -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
+ @list='$(lib_LTLIBRARIES)'; for p in $$list; do \
+ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+ test "$$dir" != "$$p" || dir=.; \
+ echo "rm -f \"$${dir}/so_locations\""; \
+ rm -f "$${dir}/so_locations"; \
+ done
+libsched_lc.la: $(libsched_lc_la_OBJECTS) $(libsched_lc_la_DEPENDENCIES)
+ $(LINK) -rpath $(libdir) $(libsched_lc_la_LDFLAGS) $(libsched_lc_la_OBJECTS) $(libsched_lc_la_LIBADD) $(LIBS)
+libsched_rr.la: $(libsched_rr_la_OBJECTS) $(libsched_rr_la_DEPENDENCIES)
+ $(LINK) -rpath $(libdir) $(libsched_rr_la_LDFLAGS) $(libsched_rr_la_OBJECTS) $(libsched_rr_la_LIBADD) $(LIBS)
+libsched_wrr.la: $(libsched_wrr_la_OBJECTS) $(libsched_wrr_la_DEPENDENCIES)
+ $(LINK) -rpath $(libdir) $(libsched_wrr_la_LDFLAGS) $(libsched_wrr_la_OBJECTS) $(libsched_wrr_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sched_lc.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sched_rr.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sched_wrr.Plo@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+distclean-libtool:
+ -rm -f libtool
+uninstall-info-am:
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+ list='$(DISTFILES)'; for file in $$list; do \
+ case $$file in \
+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+ esac; \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ dir="/$$dir"; \
+ $(mkdir_p) "$(distdir)$$dir"; \
+ else \
+ dir=''; \
+ fi; \
+ if test -d $$d/$$file; then \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LTLIBRARIES)
+installdirs:
+ for dir in "$(DESTDIR)$(libdir)"; do \
+ test -z "$$dir" || $(mkdir_p) "$$dir"; \
+ done
+install-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-libLTLIBRARIES clean-libtool \
+ mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-libtool distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-exec-am: install-libLTLIBRARIES
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-info-am uninstall-libLTLIBRARIES
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+ clean-libLTLIBRARIES clean-libtool ctags distclean \
+ distclean-compile distclean-generic distclean-libtool \
+ distclean-tags distdir dvi dvi-am html html-am info info-am \
+ install install-am install-data install-data-am install-exec \
+ install-exec-am install-info install-info-am \
+ install-libLTLIBRARIES install-man install-strip installcheck \
+ installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ tags uninstall uninstall-am uninstall-info-am \
+ uninstall-libLTLIBRARIES
+
+
+install:
+ cp ./.libs/libsched_lc.so ./.libs/sched_lc.so && \
+ cp ./.libs/libsched_rr.so ./.libs/sched_rr.so && \
+ cp ./.libs/libsched_wrr.so ./.libs/sched_wrr.so && \
+ $(INSTALL) -m 755 -d $(L7VS_MODDIR)
+ $(INSTALL) -m 755 -D \
+ ./.libs/sched_lc.so \
+ ./.libs/sched_rr.so \
+ ./.libs/sched_wrr.so \
+ $(L7VS_MODDIR)
+# 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:
--- /dev/null
+ /*
+ * @file sched_lc.c
+ * @brief Least-Connection Scheduling Module for UltraMonkey-L7
+ *
+ * L7VSD: Linux Virtual Server for Layer7 Load Balancing
+ * Copyright (C) 2005 NTT COMWARE Corporation.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ **********************************************************************/
+
+#include <sys/types.h>
+#include <netinet/in.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <glib.h>
+#include <limits.h>
+#include "l7vs_dest.h"
+#include "l7vs_service.h"
+#include "l7vs_conn.h"
+#include "l7vs_sched.h"
+
+#define IS_SCHEDLC_DEBUG if( LOG_LV_DEBUG == IS_DEBUG<struct l7vs_scheduler>( sched_lc_scheduler, LOG_CAT_L7VSD_SCHEDULE ))
+#define SCHED_DEBUG(X,Y...) PUT_LOG_DEBUG( sched_lc_scheduler, LOG_CAT_L7VSD_SCHEDULE, X, ##Y )
+#define SCHED_INFO(X,Y...) PUT_LOG_INFO( sched_lc_scheduler, LOG_CAT_L7VSD_SCHEDULE, X, ##Y )
+#define SCHED_WARN(X,Y...) PUT_LOG_WARN( sched_lc_scheduler, LOG_CAT_L7VSD_SCHEDULE, X, ##Y )
+#define SCHED_ERROR(X,Y...) PUT_LOG_ERROR( sched_lc_scheduler, LOG_CAT_L7VSD_SCHEDULE, X, ##Y )
+#define SCHED_FATAL(X,Y...) PUT_LOG_FATAL( sched_lc_scheduler, LOG_CAT_L7VSD_SCHEDULE, X, ##Y )
+
+/*!
+ * schedule module finalize function
+ * @param void
+ * @return void
+ */
+static void fini(void);
+
+/*!
+ * schedule module scheduling function
+ * @param[in] service pointer
+ * @param[in] connection pointer
+ * @return l7vs_dest struct for scheduleing
+ */
+static struct l7vs_dest *l7vs_sched_lc_schedule(struct l7vs_service *srv,
+ struct l7vs_conn *conn);
+
+/*!
+ * Least-Connection Scheduling struct
+ */
+static struct l7vs_scheduler sched_lc_scheduler = {
+ NULL, /*! schedule handle*/
+ "lc", /*! leastconnection schleduler module name*/
+ 0, /*! refarence count*/
+ l7vs_sched_lc_schedule, /*! schedule function */
+ NULL, /*! bind function */
+ NULL, /*! unbind function */
+ fini, /*! fini function */
+ NULL, /*! loglevel get function */
+ NULL, /*! debug log put function */
+ NULL, /*! info log put function */
+ NULL, /*! warn log put function */
+ NULL, /*! error log put function */
+ NULL /*! fatal log put function */
+};
+
+
+/*!
+ * LeastConnection schedule module initialize function
+ * @param[in] shared object handle
+ * @return l7vs_scheduler struct pointer
+ */
+extern "C" struct l7vs_scheduler *
+init(void *handle)
+{
+ IS_SCHEDLC_DEBUG{
+ SCHED_DEBUG(23, "in function struct l7vs_scheduler* init( void* handle ) handle = %p", handle );
+ }
+
+ sched_lc_scheduler.handle = handle;
+
+ IS_SCHEDLC_DEBUG{
+ SCHED_DEBUG(24, "out_function: struct l7vs_scheduler* init( void* handle ) return: %p", &sched_lc_scheduler );
+ }
+ return &sched_lc_scheduler;
+}
+
+/*!
+ * LeastConnection schedule module finalize function.
+ * this function is empty.
+ * @param[in] void
+ * @return void
+ */
+static void
+fini(void)
+{
+ IS_SCHEDLC_DEBUG{
+ SCHED_DEBUG(25, "in_function: void fini(void)" );
+ }
+ IS_SCHEDLC_DEBUG{
+ SCHED_DEBUG(26, "out_function: void fini(void)" );
+ }
+}
+
+/*!
+ * LeastConnection schedule module scheduling function
+ * @param[in] srv l7vs_service struct pointer
+ * @param[in] conn l7vs_connection struct pointer
+ * @return scheduled dest pointer
+ */
+static struct l7vs_dest *
+l7vs_sched_lc_schedule(struct l7vs_service *srv,
+ struct l7vs_conn *conn)
+{
+ IS_SCHEDLC_DEBUG{
+ char BUFF[DEBUG_STR_LEN];
+ char SRV_BUFF[DEBUG_STR_LEN];
+ char CON_BUFF[DEBUG_STR_LEN];
+ l7vs_service_c_str( SRV_BUFF, srv );
+ l7vs_conn_c_str( CON_BUFF, conn );
+ snprintf( BUFF, DEBUG_STR_LEN, "in_function: static struct l7vs_dest*"
+ " l7vs_sched_lc_schedule( struct l7vs_service* srv ,"
+ " struct l7vs_conn* conn ) srv = "
+ );
+ strncat( BUFF, SRV_BUFF, DEBUG_STR_LEN - strlen( BUFF) );
+ strncat( BUFF, " / conn = ", DEBUG_STR_LEN - strlen( BUFF ) );
+ strncat( BUFF, CON_BUFF, DEBUG_STR_LEN - strlen( BUFF ) );
+ SCHED_DEBUG(27, BUFF );
+ }
+ int nactive = INT_MAX;
+ GList* active_dest_list = NULL;
+ GList* ptr = NULL;
+ struct l7vs_dest* rect = NULL;
+ struct l7vs_dest* target = NULL;
+ if( !srv ) return NULL;
+
+
+ //create active list
+ for( ptr = g_list_first( srv->dest_list ); ptr; ptr = g_list_next(ptr) ){
+ struct l7vs_dest* dest = (struct l7vs_dest*)ptr->data;
+ if( dest->weight > 0 ) active_dest_list = g_list_append( active_dest_list, dest );
+ }
+
+ //active dest don't have
+ if( !active_dest_list ){
+ SCHED_INFO(1, "active dest don't have in dest-list" );
+ return NULL;
+ }
+
+ for( ptr = g_list_first( active_dest_list ); ptr; ptr = g_list_next( ptr ) ){
+ target = ( struct l7vs_dest* ) ptr->data;
+ if( nactive > target->nactive ){
+ rect = target;
+ nactive = target->nactive;
+ }
+ }
+ IS_SCHEDLC_DEBUG{
+ SCHED_DEBUG(28, "free active_dest_list %p" , active_dest_list );
+ }
+ g_list_free( active_dest_list );
+
+ IS_SCHEDLC_DEBUG{
+ SCHED_DEBUG(29, "out_function static struct l7vs_dest* l7vs_sched_lc_schedule( struct l7vs_service* srv , struct l7vs_conn* conn ) return = %p", rect );
+ }
+ return rect;
+}
--- /dev/null
+/*
+ * @file sched_rr.c
+ * @brief Round-Robin Scheduling Module for UltraMonkey-L7
+ *
+ * L7VSD: Linux Virtual Server for Layer7 Load Balancing
+ * Copyright (C) 2005 NTT COMWARE Corporation.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ **********************************************************************/
+
+#include <sys/types.h>
+#include <netinet/in.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <glib.h>
+#include <string.h>
+#include "l7vs_dest.h"
+#include "l7vs_service.h"
+#include "l7vs_conn.h"
+#include "l7vs_sched.h"
+
+#define IS_SCHEDRR_DEBUG if( LOG_LV_DEBUG == IS_DEBUG<struct l7vs_scheduler>( sched_rr_scheduler, LOG_CAT_L7VSD_SCHEDULE ))
+#define SCHED_DEBUG(X,Y...) PUT_LOG_DEBUG( sched_rr_scheduler, LOG_CAT_L7VSD_SCHEDULE, X, ##Y )
+#define SCHED_INFO(X,Y...) PUT_LOG_INFO( sched_rr_scheduler, LOG_CAT_L7VSD_SCHEDULE, X, ##Y )
+#define SCHED_WARN(X,Y...) PUT_LOG_WARN( sched_rr_scheduler, LOG_CAT_L7VSD_SCHEDULE, X, ##Y )
+#define SCHED_ERROR(X,Y...) PUT_LOG_ERROR( sched_rr_scheduler, LOG_CAT_L7VSD_SCHEDULE, X, ##Y )
+#define SCHED_FATAL(X,Y...) PUT_LOG_FATAL( sched_rr_scheduler, LOG_CAT_L7VSD_SCHEDULE, X, ##Y )
+
+/*!
+ * servicedest contenor struct
+ */
+struct servicedest_contenor{
+ handle_t handle; //! service handle
+ struct in_addr addr; //! dest address
+ u_short port; //! dest port
+};
+
+/*! service dest list */
+GList* servicedest_list;
+
+/*!
+ * schedule module finalize fnction
+ * @param void
+ * @return void
+ */
+static void fini(void);
+
+/*!
+ * schedule module scheduler function
+ * @param[in] struct l7vs_service* srv vitual service struct pointer
+ * @param[in] struct l7vs_conn* conn connection struct pointer
+ */
+static struct l7vs_dest *l7vs_sched_rr_schedule(struct l7vs_service *srv,
+ struct l7vs_conn *conn);
+
+/*!
+ * RoundRobin Scheduling struct
+ */
+static struct l7vs_scheduler sched_rr_scheduler = {
+ NULL, /*! schedule handle */
+ "rr", /*! RoundRobin schedule module name */
+ 0, /*! refarence count */
+ l7vs_sched_rr_schedule, /*! schedule function */
+ NULL, /*! bind function */
+ NULL, /*! unbind function */
+ fini, /*! fini function */
+ NULL, /*! loglevel get function */
+ NULL, /*! debug log put function */
+ NULL, /*! info log put function */
+ NULL, /*! warn log put function */
+ NULL, /*! error log put function */
+ NULL /*! fatal log put function */
+};
+
+/*!
+ * RoundRoin schedule module initialize function
+ * @param[in] shared object handle;
+ * @return l7vs_scheduler struct pointer
+ */
+extern "C" struct l7vs_scheduler *
+init(void *handle)
+{
+ IS_SCHEDRR_DEBUG{
+ SCHED_DEBUG(30, "in_function struct l7vs_scheduler* init( void* handle ) handle = %p", handle );
+ }
+
+ servicedest_list = NULL;
+ sched_rr_scheduler.handle = handle;
+
+ IS_SCHEDRR_DEBUG{
+ SCHED_DEBUG(31, "out_function struct l7vs_scheduler* init( void* handle ) return = %p", &sched_rr_scheduler );
+ }
+ return &sched_rr_scheduler;
+}
+
+/*
+ * RoundRobin module finalize function
+ * remove servicedest_list.
+ * @param[in] void
+ * @return void
+ */
+
+static void
+fini(void)
+{
+ IS_SCHEDRR_DEBUG{
+ SCHED_DEBUG(32, "in_function static void fini(void)" );
+ }
+ GList* ptr = NULL;
+ for( ptr = g_list_first( servicedest_list ); ptr ; ptr = g_list_next(ptr) ){
+ IS_SCHEDRR_DEBUG{
+ SCHED_DEBUG(33, "service_dest_list free element = %p" , ptr->data );
+ }
+ free( ptr->data );
+ ptr->data = NULL;
+ }
+ g_list_free(servicedest_list);
+ servicedest_list = NULL;
+ IS_SCHEDRR_DEBUG{
+ SCHED_DEBUG(34, "out_function static void fini(void)" );
+ }
+}
+
+/*!
+ * RoundRobin module scheduling function
+ * @param[in] struct l7vs_service* srv virtual service struct pointer
+ * @param[in] struct l7vs_conn* conn connection struct pointer
+ * @return l7vs_dest* scheduled dest pointer
+ */
+static struct l7vs_dest *
+l7vs_sched_rr_schedule(struct l7vs_service *srv, struct l7vs_conn *conn)
+{
+ IS_SCHEDRR_DEBUG{
+ char buff[DEBUG_STR_LEN];
+ char srv_buff[DEBUG_STR_LEN];
+ char con_buff[DEBUG_STR_LEN];
+ snprintf( buff, DEBUG_STR_LEN, "in_function static struct l7vs_dest* l7vs_sched_rr_schedule( struct l7vs_service*, struct l7vs_conn* ) /" );
+ l7vs_service_c_str( srv_buff, srv );
+ l7vs_conn_c_str( con_buff, conn );
+ strncat( buff, "srv = ", DEBUG_STR_LEN - strlen(buff) );
+ strncat( buff, srv_buff, DEBUG_STR_LEN - strlen(buff) );
+ strncat( buff, " / conn = ", DEBUG_STR_LEN - strlen(buff) );
+ strncat( buff, con_buff, DEBUG_STR_LEN - strlen(buff) );
+ SCHED_DEBUG(35, buff );
+ }
+ struct l7vs_dest* ret = NULL;
+ GList* active_dest_list = NULL;
+ GList* ptr = NULL;
+ struct servicedest_contenor* contenor = NULL;
+
+ if( !srv ){
+ SCHED_ERROR(16, "service struct pointer is NULL" );
+ IS_SCHEDRR_DEBUG{
+ SCHED_DEBUG(36, "out_function static struct l7vs_dest* l7vs_sched_rr_schedule( struct l7vs_service*, struct l7vs_conn* return NULL" );
+ }
+ return NULL;
+ }
+
+ //create active list
+ for( ptr = g_list_first( srv->dest_list ); ptr ; ptr = g_list_next(ptr) ){
+ if( ((struct l7vs_dest*) ( ptr->data ))->weight > 0 ) active_dest_list = g_list_append( active_dest_list, ptr->data );
+ }
+
+ //active dest don't have
+ if( !active_dest_list ){
+ SCHED_INFO(2, "active dist none. don't schedule dest" );
+ IS_SCHEDRR_DEBUG{
+ SCHED_DEBUG(37, "out_function static struct l7vs_dest* l7vs_sched_rr_schedule( struct l7vs_service*, struct l7vs_conn ) return NULL" );
+ }
+ return NULL;
+ }
+
+
+ //first use on service
+ if( !srv->sched_data ){
+ ptr = g_list_first( active_dest_list );
+ ret = (struct l7vs_dest*) ptr->data;
+ contenor = (struct servicedest_contenor*) malloc( sizeof(struct servicedest_contenor) );
+ servicedest_list = g_list_append( servicedest_list, contenor );
+ srv->sched_data = (void*) contenor;
+ goto L7VS_SCHED_RR_SCHEDULE_END;
+ }
+ contenor = (struct servicedest_contenor*) srv->sched_data;
+ for( ptr = g_list_first( active_dest_list ); ptr ; ptr = g_list_next( ptr ) ){
+ struct l7vs_dest* dest = (struct l7vs_dest*) ptr->data;
+ if( !memcmp( &(dest->addr.sin_addr), &(contenor->addr), sizeof( struct in_addr ) )
+ &&
+ dest->addr.sin_port == contenor->port ){
+ ret = (struct l7vs_dest*)ptr->data;
+ break;
+ }
+ }
+ if( ! ret ){//not have dest list
+ ptr = g_list_first( active_dest_list );
+ ret = ( struct l7vs_dest* ) ptr->data;
+ goto L7VS_SCHED_RR_SCHEDULE_END;
+ }
+ ptr = g_list_next( ptr );
+ if( !ptr ){
+ ptr = g_list_first( active_dest_list );
+ ret = ( struct l7vs_dest* ) ptr->data;
+ goto L7VS_SCHED_RR_SCHEDULE_END;
+ }
+ ret = ( struct l7vs_dest* ) ptr->data;
+
+L7VS_SCHED_RR_SCHEDULE_END:
+ contenor->handle = srv->handle;
+ contenor->addr = ret->addr.sin_addr;
+ contenor->port = ret->addr.sin_port;
+ g_list_free( active_dest_list );
+ IS_SCHEDRR_DEBUG{
+ SCHED_DEBUG(38, "out_function static struct l7vs_dest* l7vs_sched_rr_schedule( struct l7vs_service*, struct l7vs_conn* ) return %p" , ret );
+ }
+ return ret;
+}
--- /dev/null
+ /*
+ * @file sched_wrr.c
+ * @brief Weighted Round-Robin Scheduling Module for UltraMonkey-L7
+ * @auther nakai norihisa.
+ * August 2007
+ *
+ * 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 3 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, see <http://www.gnu.org/licenses/>.
+ *
+ **********************************************************************/
+
+#include <sys/types.h>
+#include <netinet/in.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <glib.h>
+#include <string.h>
+#include "l7vs.h"
+#include "l7vs_conn.h"
+#include "l7vs_service.h"
+#include "l7vs_sched.h"
+#include "l7vs_dest.h"
+
+#define IS_SCHEDWRR_DEBUG if( LOG_LV_DEBUG == IS_DEBUG<struct l7vs_scheduler>( sched_wrr_scheduler, LOG_CAT_L7VSD_SCHEDULE ))
+#define SCHED_DEBUG(X,Y...) PUT_LOG_DEBUG( sched_wrr_scheduler, LOG_CAT_L7VSD_SCHEDULE, X, ##Y )
+#define SCHED_INFO(X,Y...) PUT_LOG_INFO( sched_wrr_scheduler, LOG_CAT_L7VSD_SCHEDULE, X, ##Y )
+#define SCHED_WARN(X,Y...) PUT_LOG_WARN( sched_wrr_scheduler, LOG_CAT_L7VSD_SCHEDULE, X, ##Y )
+#define SCHED_ERROR(X,Y...) PUT_LOG_ERROR( sched_wrr_scheduler, LOG_CAT_L7VSD_SCHEDULE, X, ##Y )
+#define SCHED_FATAL(X,Y...) PUT_LOG_FATAL( sched_wrr_scheduler, LOG_CAT_L7VSD_SCHEDULE, X, ##Y )
+
+#define MAX_VS 128
+#define VS_INITIALIZED 1
+#define VS_NOTINUSE 0
+
+struct wrr_weights {
+ int currentWeight; /*! Current Weight */
+ int maxWeight; /*! Max of Weight */
+ int gcd; /*! GCD of dest_list */
+};
+
+struct servicedest_contenor{
+ handle_t handle;
+ struct in_addr addr;
+ u_short port;
+};
+
+GList* servicedest_list;
+
+static int vs_initialized_flags[MAX_VS];
+static struct wrr_weights *vs_weights[MAX_VS];
+
+static void fini(void);
+struct l7vs_dest* l7vs_sched_wrr_schedule(struct l7vs_service*, struct l7vs_conn*);
+static int l7vs_sched_wrr_service_init(struct l7vs_service*);
+static int l7vs_sched_wrr_recalc(struct l7vs_service*);
+static int l7vs_sched_wrr_getMaxWeight(struct l7vs_service*);
+static int l7vs_sched_wrr_gcd(int, int);
+static int l7vs_sched_wrr_getGCD(struct l7vs_service*);
+static GList* l7vs_sched_wrr_search_suitableRS(GList*, int);
+
+
+static struct l7vs_scheduler sched_wrr_scheduler = {
+ NULL,
+ "wrr",
+ 0,
+ l7vs_sched_wrr_schedule,
+ NULL,
+ NULL,
+ fini,
+ NULL, /*! loglevel get function */
+ NULL, /*! debug log put function */
+ NULL, /*! info log put function */
+ NULL, /*! warn log put function */
+ NULL, /*! error log put function */
+ NULL /*! fatal log put function */
+};
+
+extern "C" struct l7vs_scheduler* init(void *handle){
+ IS_SCHEDWRR_DEBUG{
+ SCHED_DEBUG(39, "in_function extern \"C\" struct l7vs_scheduler* init( void* handle ) : handle = %p" , handle );
+ }
+ servicedest_list = NULL;
+ memset(vs_initialized_flags, VS_NOTINUSE, sizeof (vs_initialized_flags));
+ memset(vs_weights, 0, sizeof (vs_weights));
+ sched_wrr_scheduler.handle = handle;
+ IS_SCHEDWRR_DEBUG{
+ SCHED_DEBUG(40, "out_function extern \"C\" struct l7vs_scheduler* init( void* handle ) : return = %p" , &sched_wrr_scheduler );
+ }
+ return &sched_wrr_scheduler;
+}
+
+void fini(void){
+ IS_SCHEDWRR_DEBUG{
+ SCHED_DEBUG(41, "in_function void fini(void)" );
+ }
+
+ int i;
+ GList* ptr = NULL;
+
+ for (i = 0; i < MAX_VS; ++i) {
+ if (vs_initialized_flags[i]) {
+ if(vs_weights[i] != NULL){
+ IS_SCHEDWRR_DEBUG{
+ SCHED_DEBUG(42, "virtual service[%d] weight memory free: address = %p", i , vs_weights[i] );
+ }
+ free(vs_weights[i]);
+ vs_weights[i] = NULL;
+ }
+ vs_initialized_flags[i] = VS_NOTINUSE;
+ }
+ }
+
+ for( ptr = g_list_first(servicedest_list); ptr; ptr = g_list_next(ptr) ){
+ IS_SCHEDWRR_DEBUG{
+ SCHED_DEBUG(43, "service dest list contenor data memory free: address = %p", ptr->data );
+ }
+ free( ptr->data );
+ ptr->data = NULL;
+ }
+ g_list_free( servicedest_list );
+ servicedest_list = NULL;
+}
+
+
+struct l7vs_dest* l7vs_sched_wrr_schedule(struct l7vs_service *srv, struct l7vs_conn *conn){
+ IS_SCHEDWRR_DEBUG{
+ SCHED_DEBUG(44, "in_function stuct l7vs_dest* l7vs_sched_wrr_schedule( struct l7vs_service* srv, struct l7vs_conn* conn ) srv = %p, conn = %p ", srv, conn );
+ }
+
+ struct l7vs_dest *dest;
+ GList* active_dest_list = NULL;
+ GList* ptr;
+ GList *now = NULL;
+
+ if(srv == NULL || srv->handle >= MAX_VS || srv->dest_list == NULL || srv->dest_list->data == NULL)
+ {
+ SCHED_WARN(1, " service pointer is NULL or service handle is MaxHandle over or service dest list is NULL or service dest list data pointer is NULL" );
+ dest = NULL;
+ goto OUT;
+ }
+
+ //create active dest
+ for( ptr = g_list_first( srv->dest_list ); ptr; ptr = g_list_next(ptr) ){
+ if( ((struct l7vs_dest*) ( ptr->data ))->weight > 0 ) active_dest_list = g_list_append( active_dest_list, ptr->data );
+ }
+ if( !active_dest_list ) {
+ IS_SCHEDWRR_DEBUG{
+ SCHED_DEBUG(45, " don't serch wieght > 0 dests. not scheduling." );
+ }
+ dest = NULL;
+ goto OUT;
+ }
+
+ if (vs_initialized_flags[srv->handle] == VS_NOTINUSE) {
+
+ if (l7vs_sched_wrr_service_init(srv) == -1) {
+ SCHED_WARN(2, "l7vs_sched_wrr_service_init is error don't scheduling." );
+ dest = NULL;
+ goto OUT;
+ }
+
+ vs_weights[srv->handle]->currentWeight = vs_weights[srv->handle]->maxWeight;
+ } else {
+ if (l7vs_sched_wrr_recalc(srv) != 0) {
+ SCHED_WARN(3, "l7vs_sched_wrr_recalc is error don't scheduling." );
+ dest = NULL;
+ goto OUT;
+ }
+ }
+
+ if (srv->sched_data) {
+ for( ptr = g_list_first( active_dest_list ); ptr; ptr = g_list_next(ptr) ){
+ struct l7vs_dest* tdest = (struct l7vs_dest*) ptr->data;
+ struct servicedest_contenor* contenor = (struct servicedest_contenor*) srv->sched_data;
+ if( !memcmp( &(tdest->addr.sin_addr), &(contenor->addr), sizeof( struct in_addr ) )
+ &&
+ tdest->addr.sin_port == contenor->port ){
+ now = (GList*) ptr;
+ break;
+ }
+ }
+ }
+ if (now == NULL || srv->sched_data == NULL) {
+ struct servicedest_contenor* contenor = (struct servicedest_contenor*) malloc( sizeof( struct servicedest_contenor ) );
+ IS_SCHEDWRR_DEBUG{
+ SCHED_DEBUG(46, "memory allocate struct service contenor. contenor address = %p" , contenor );
+ }
+ now = g_list_first( active_dest_list );
+ struct l7vs_dest* tdest = ( struct l7vs_dest* ) now->data;
+ contenor->handle = srv->handle;
+ contenor->addr = tdest->addr.sin_addr;
+ contenor->port = tdest->addr.sin_port;
+ servicedest_list = g_list_append( servicedest_list, contenor );
+ srv->sched_data = contenor;
+ }
+
+ while (1)
+ {
+ if (((struct l7vs_dest*)now->data)->weight >= vs_weights[srv->handle]->currentWeight)
+ {
+ dest = (struct l7vs_dest*)now->data;
+
+ ptr = (GList*)l7vs_sched_wrr_search_suitableRS(now, vs_weights[srv->handle]->currentWeight);
+ if (ptr == NULL)
+ {
+ ptr = g_list_first(active_dest_list);
+ vs_weights[srv->handle]->currentWeight -= vs_weights[srv->handle]->gcd;
+
+ if (vs_weights[srv->handle]->currentWeight <= 0)
+ {
+ vs_weights[srv->handle]->currentWeight = vs_weights[srv->handle]->maxWeight;
+ }
+ }
+ struct servicedest_contenor* contenor = ( struct servicedest_contenor* )srv->sched_data;
+ struct l7vs_dest* tdest = (struct l7vs_dest*) ptr->data;
+ contenor->handle = srv->handle;
+ contenor->addr = tdest->addr.sin_addr;
+ contenor->port = tdest->addr.sin_port;
+ goto OUT;
+ }
+ else
+ {
+ now = g_list_next(now);
+ if (now == NULL) {
+ now = g_list_first(srv->dest_list);
+ vs_weights[srv->handle]->currentWeight -= vs_weights[srv->handle]->gcd;
+
+ if (vs_weights[srv->handle]->currentWeight <= 0) {
+ vs_weights[srv->handle]->currentWeight = vs_weights[srv->handle]->maxWeight;
+ }
+ }
+ }
+ }
+
+OUT:
+ g_list_free( active_dest_list );
+
+ IS_SCHEDWRR_DEBUG{
+ SCHED_DEBUG(47, "out_function: truct l7vs_dest* l7vs_sched_wrr_schedule(struct l7vs_service *srv, struct l7vs_conn *conn) : return = %p" , dest );
+ }
+ return dest;
+
+}
+
+
+static int l7vs_sched_wrr_service_init(struct l7vs_service *srv){
+ IS_SCHEDWRR_DEBUG{
+ SCHED_DEBUG(48, "in function static int l7vs_sched_wrr_service_init( struct l7vs_service *srv ) srv = %p" , srv );
+ }
+
+ if(srv == NULL || srv->handle >= MAX_VS){
+ SCHED_WARN(4, "l7vs_service pointer is NULL or service handle is orver MAX_VS" );
+ IS_SCHEDWRR_DEBUG{
+ SCHED_DEBUG(49, "out_function static int l7vs_sched_wrr_service_init( struct l7vs_service* srv ) : return = -1" );
+ }
+ return -1;
+ }
+
+ vs_weights[srv->handle] = (struct wrr_weights*)malloc(sizeof(struct wrr_weights));
+ IS_SCHEDWRR_DEBUG{
+ SCHED_DEBUG(50, "allocate memory struct wrr_weights. address = %p" , vs_weights[srv->handle] );
+ }
+
+ if (vs_weights[srv->handle] == NULL) {
+ SCHED_WARN(5, "don't allocate memory. vs_weights[srv->handle] is NULL" );
+ IS_SCHEDWRR_DEBUG{
+ SCHED_DEBUG(51, "out_function: static int l7vs_sched_wrr_service_init( struct l7vs_service *srv ) : return -1" );
+ }
+ return -1;
+ }
+
+ memset(vs_weights[srv->handle], 0, sizeof(struct wrr_weights));
+ vs_weights[srv->handle]->gcd = l7vs_sched_wrr_getGCD(srv);
+ if(vs_weights[srv->handle]->gcd < 0){
+ SCHED_WARN(6, "calc gcd Negative value %d", vs_weights[srv->handle]->gcd );
+ IS_SCHEDWRR_DEBUG{
+ SCHED_DEBUG(52, "out_function: static int l7vs_sched_wrr_service_init( struct l7vs_service* srv ) : return -1" );
+ }
+ return -1;
+ }
+ vs_weights[srv->handle]->maxWeight = l7vs_sched_wrr_getMaxWeight(srv);
+ if(vs_weights[srv->handle]->maxWeight < 0){
+ SCHED_WARN(7, "maxWeight is Negative value %d", vs_weights[srv->handle]->maxWeight );
+ IS_SCHEDWRR_DEBUG{
+ SCHED_DEBUG(53, "out_function: static int l7vs_sched_wrr_service_init( struct l7vs_service* srv ) : return -1" );
+ }
+ return -1;
+ }
+ vs_initialized_flags[srv->handle] = VS_INITIALIZED;
+
+ IS_SCHEDWRR_DEBUG{
+ SCHED_DEBUG(54, "out_function: static int l7vs_sched_wrr_service_init( struct l7vs_service* srv ) : return 0" );
+ }
+ return 0;
+}
+
+static int l7vs_sched_wrr_recalc(struct l7vs_service *srv){
+ IS_SCHEDWRR_DEBUG{
+ SCHED_DEBUG(55, "in_function: static int l7vs_sched_wrr_recalc( struct l7vs_serivce* srv ) : srv = %p" , srv );
+ }
+
+ if(srv == NULL || srv->handle >= MAX_VS){
+ SCHED_WARN(8, "srevice pointer is NULL or srv->handle is orver MAX_VS" );
+ IS_SCHEDWRR_DEBUG{
+ SCHED_DEBUG(56, "out_function: static int l7vs_sched_wrr_recalc( struct l7vs_service* srv ) : return -1" );
+ }
+ return -1;
+ }
+
+ if (vs_weights[srv->handle] == NULL){
+ SCHED_WARN(9, "virtual service weight is NULL (vs_weights[srv->handle])" );
+ IS_SCHEDWRR_DEBUG{
+ SCHED_DEBUG(57, "out_function: static int l7vs_sched_wrr_recalc( struct l7vs_service* srv ) : return -1" );
+ }
+ return -1;
+ }
+
+ vs_weights[srv->handle]->gcd = l7vs_sched_wrr_getGCD(srv);
+ if(vs_weights[srv->handle]->gcd < 0 ){
+ SCHED_WARN(10, "gcd is negative value = %d", vs_weights[srv->handle]->gcd );
+ IS_SCHEDWRR_DEBUG{
+ SCHED_DEBUG(58, "out_function: static int l7vs_sched_wrr_recalc( struct l7vs_service* srv ) : return -1" );
+ }
+ return -1;
+ }
+ vs_weights[srv->handle]->maxWeight = l7vs_sched_wrr_getMaxWeight(srv);
+ if(vs_weights[srv->handle]->maxWeight < 0){
+ SCHED_WARN(11, "maxWeight is negative value = %d" , vs_weights[srv->handle]->maxWeight );
+ IS_SCHEDWRR_DEBUG{
+ SCHED_DEBUG(59, "out_function: static int l7vs_sched_wrr_recalc( struct l7vs_service* srv ) : return -1" );
+ }
+ return -1;
+ }
+ if (vs_weights[srv->handle]->currentWeight > vs_weights[srv->handle]->maxWeight){
+ vs_weights[srv->handle]->currentWeight = vs_weights[srv->handle]->maxWeight;
+ }
+
+ IS_SCHEDWRR_DEBUG{
+ SCHED_DEBUG(60, "out_function: static int l7vs_sched_wrr_recalc( struct l7vs_service* srv ) : return 0" );
+ }
+ return 0;
+
+}
+
+
+static int l7vs_sched_wrr_getMaxWeight(struct l7vs_service *srv){
+ IS_SCHEDWRR_DEBUG{
+ SCHED_DEBUG(61, "in_function: static int l7vs_sched_wrr_getMaxWeight( struct l7vs_service* srv ) : srv = %p", srv );
+ }
+ GList *l, *now;
+ struct l7vs_dest *dest;
+ int weight = 0;
+
+ if(srv == NULL || srv->dest_list == NULL){
+ SCHED_WARN(12, "service pointer is NULL or service dest list is NULL" );
+ IS_SCHEDWRR_DEBUG{
+ SCHED_DEBUG(62, "out_function: static int l7vs_sched_wrr_getMaxWeight( struct l7vs_service* srv ) : return -1" );
+ }
+ return -1;
+ }
+ l = srv->dest_list;
+
+ for (now = g_list_first(l); now != NULL; now = g_list_next(now)) {
+ dest = (struct l7vs_dest*)now->data;
+ if (dest->weight > weight) {
+ weight = dest->weight;
+ }
+ }
+
+ IS_SCHEDWRR_DEBUG{
+ SCHED_DEBUG(63, "out_function: static int l7vs_sched_wrr_getMaxWeight( struct l7vs_service* srv ) : return %d" , weight );
+ }
+ return weight;
+}
+
+
+static int l7vs_sched_wrr_gcd(int a, int b){
+
+ IS_SCHEDWRR_DEBUG{
+ SCHED_DEBUG(64, "in_function: static int l7vs_sched_wrr_gcd( int a, int b ) : a = %d, b = %d" , a, b );
+ }
+ if (a == b || b == 0) {
+ IS_SCHEDWRR_DEBUG{
+ SCHED_DEBUG(65, "out_function static int l7vs_sched_wrr_gcd( int a, int b ) : return %d" , a );
+ }
+ return a;
+ }
+ else if (a > b) {
+ IS_SCHEDWRR_DEBUG{
+ SCHED_DEBUG(66, "out_function static int l7vs_sched_wrr_gcd( int a, int b ) : return l7vs_sched_wrr_gcd( a - b, b )" );
+ }
+ return l7vs_sched_wrr_gcd (a - b, b);
+ }
+ else {
+ IS_SCHEDWRR_DEBUG{
+ SCHED_DEBUG(67, "out_function static int l7vs_sched_wrr_gcd( int a, int b ) : return l7vs_svhed_wrr_gcd( b, a )" );
+ }
+ return l7vs_sched_wrr_gcd (b, a);
+ }
+}
+
+
+static int l7vs_sched_wrr_getGCD(struct l7vs_service *srv){
+ IS_SCHEDWRR_DEBUG{
+ SCHED_DEBUG(68, "in_function static int l7vs_sched_wrr_getGCD( struct l7vs_service* srv ) : srv = %p" , srv );
+ }
+ GList *now;
+ int currentGCD = 1;
+
+ if(srv == NULL || srv->dest_list == NULL || srv->dest_list->data == NULL){
+ SCHED_WARN(13, "service pointer is NULL or srv->dest_list pointer is NULL or srv->dest_list->data pointer is NULL" );
+ IS_SCHEDWRR_DEBUG{
+ SCHED_DEBUG(69, "out_function: static int l7vs_sched_wrr_getGCD( struct l7vs_service* srv ) return -1" );
+ }
+ return -1;
+ }
+
+ now = g_list_first(srv->dest_list);
+ currentGCD = ((struct l7vs_dest*)now->data)->weight;
+ now = g_list_next(now);
+
+ while (now != NULL) {
+ currentGCD = l7vs_sched_wrr_gcd(currentGCD, ((struct l7vs_dest*)now->data)->weight);
+ now = g_list_next(now);
+ }
+
+ IS_SCHEDWRR_DEBUG{
+ SCHED_DEBUG(70, "out_function: static int l7vs_sched_wrr_getGCD( struct l7vs_service* srv ) return %d", currentGCD );
+ }
+ return currentGCD;
+}
+
+static GList* l7vs_sched_wrr_search_suitableRS(GList *list, int weight){
+ IS_SCHEDWRR_DEBUG{
+ SCHED_DEBUG(71, "in_function: static GList* l7vs_sched_wrr_serch_suitableRS( GList* list, int weight) list = %p, weight = %d", list, weight );
+ }
+ GList *now, *candidate;
+
+ now = g_list_next(list);
+ candidate = NULL;
+
+ while (now != NULL) {
+ if (((struct l7vs_dest*)now->data)->weight >= weight) {
+ candidate = now;
+ goto OUT;
+ }
+ now = g_list_next(now);
+ }
+
+ OUT:
+ IS_SCHEDWRR_DEBUG{
+ SCHED_DEBUG(72, "out_function: static GList* l7vs_sched_wrr_serch_sutableRS( GList* list, int weight ) : return %p" , candidate );
+ }
+ return candidate;
+}
--- /dev/null
+noinst_LIBRARIES= libl7vsd_parameter.a libl7vsadm_parameter.a libsnmpagent_parameter.a
+AUTOMAKE_OPTIONS = foreign
+
+libl7vsd_parameter_a_SOURCES = \
+ parameter_enum.h \
+ parameter.h \
+ parameter_impl.h \
+ parameter.cpp \
+ parameter_impl.cpp
+
+libl7vsd_parameter_a_CPPFLAGS = -O2 -g -I../../include -I../logger \
+ -DLOGGER_PROCESS_VSD \
+ -DVERSION=\"$(VERSION)\"
+
+libl7vsadm_parameter_a_SOURCES = \
+ parameter_enum.h \
+ parameter.h \
+ parameter_impl.h \
+ parameter.cpp \
+ parameter_impl.cpp
+
+libl7vsadm_parameter_a_CPPFLAGS = -O2 -g -I../../include -I../logger \
+ -DLOGGER_PROCESS_ADM \
+ -DVERSION=\"$(VERSION)\"
+
+libsnmpagent_parameter_a_SOURCES = \
+ parameter_enum.h \
+ parameter.h \
+ parameter_impl.h \
+ parameter.cpp \
+ parameter_impl.cpp
+
+libsnmpagent_parameter_a_CPPFLAGS = -O2 -g -I../../include -I../logger \
+ -DLOGGER_PROCESS_SNM \
+ -DVERSION=\"$(VERSION)\"
+
--- /dev/null
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = parameter
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+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)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+LIBRARIES = $(noinst_LIBRARIES)
+ARFLAGS = cru
+libl7vsadm_parameter_a_AR = $(AR) $(ARFLAGS)
+libl7vsadm_parameter_a_LIBADD =
+am_libl7vsadm_parameter_a_OBJECTS = \
+ libl7vsadm_parameter_a-parameter.$(OBJEXT) \
+ libl7vsadm_parameter_a-parameter_impl.$(OBJEXT)
+libl7vsadm_parameter_a_OBJECTS = $(am_libl7vsadm_parameter_a_OBJECTS)
+libl7vsd_parameter_a_AR = $(AR) $(ARFLAGS)
+libl7vsd_parameter_a_LIBADD =
+am_libl7vsd_parameter_a_OBJECTS = \
+ libl7vsd_parameter_a-parameter.$(OBJEXT) \
+ libl7vsd_parameter_a-parameter_impl.$(OBJEXT)
+libl7vsd_parameter_a_OBJECTS = $(am_libl7vsd_parameter_a_OBJECTS)
+libsnmpagent_parameter_a_AR = $(AR) $(ARFLAGS)
+libsnmpagent_parameter_a_LIBADD =
+am_libsnmpagent_parameter_a_OBJECTS = \
+ libsnmpagent_parameter_a-parameter.$(OBJEXT) \
+ libsnmpagent_parameter_a-parameter_impl.$(OBJEXT)
+libsnmpagent_parameter_a_OBJECTS = \
+ $(am_libsnmpagent_parameter_a_OBJECTS)
+DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+LTCXXCOMPILE = $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) \
+ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+ $(AM_CXXFLAGS) $(CXXFLAGS)
+CXXLD = $(CXX)
+CXXLINK = $(LIBTOOL) --tag=CXX --mode=link $(CXXLD) $(AM_CXXFLAGS) \
+ $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \
+ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+ $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(AM_LDFLAGS) $(LDFLAGS) -o $@
+SOURCES = $(libl7vsadm_parameter_a_SOURCES) \
+ $(libl7vsd_parameter_a_SOURCES) \
+ $(libsnmpagent_parameter_a_SOURCES)
+DIST_SOURCES = $(libl7vsadm_parameter_a_SOURCES) \
+ $(libl7vsd_parameter_a_SOURCES) \
+ $(libsnmpagent_parameter_a_SOURCES)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+GLIB_CFLAGS = @GLIB_CFLAGS@
+GLIB_GENMARSHAL = @GLIB_GENMARSHAL@
+GLIB_LIBS = @GLIB_LIBS@
+GLIB_MKENUMS = @GLIB_MKENUMS@
+GOBJECT_QUERY = @GOBJECT_QUERY@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MANDIR = @MANDIR@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PKG_CONFIG = @PKG_CONFIG@
+RANLIB = @RANLIB@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+ac_ct_RANLIB = @ac_ct_RANLIB@
+ac_ct_STRIP = @ac_ct_STRIP@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+l7vs_maxvs = @l7vs_maxvs@
+l7vs_moddir = @l7vs_moddir@
+l7vsadm_sockdir = @l7vsadm_sockdir@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+snmpagent_libs = @snmpagent_libs@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+noinst_LIBRARIES = libl7vsd_parameter.a libl7vsadm_parameter.a libsnmpagent_parameter.a
+AUTOMAKE_OPTIONS = foreign
+libl7vsd_parameter_a_SOURCES = \
+ parameter_enum.h \
+ parameter.h \
+ parameter_impl.h \
+ parameter.cpp \
+ parameter_impl.cpp
+
+libl7vsd_parameter_a_CPPFLAGS = -O2 -g -I../../include -I../logger \
+ -DLOGGER_PROCESS_VSD \
+ -DVERSION=\"$(VERSION)\"
+
+libl7vsadm_parameter_a_SOURCES = \
+ parameter_enum.h \
+ parameter.h \
+ parameter_impl.h \
+ parameter.cpp \
+ parameter_impl.cpp
+
+libl7vsadm_parameter_a_CPPFLAGS = -O2 -g -I../../include -I../logger \
+ -DLOGGER_PROCESS_ADM \
+ -DVERSION=\"$(VERSION)\"
+
+libsnmpagent_parameter_a_SOURCES = \
+ parameter_enum.h \
+ parameter.h \
+ parameter_impl.h \
+ parameter.cpp \
+ parameter_impl.cpp
+
+libsnmpagent_parameter_a_CPPFLAGS = -O2 -g -I../../include -I../logger \
+ -DLOGGER_PROCESS_SNM \
+ -DVERSION=\"$(VERSION)\"
+
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .cpp .lo .o .obj
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign parameter/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign parameter/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+clean-noinstLIBRARIES:
+ -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
+libl7vsadm_parameter.a: $(libl7vsadm_parameter_a_OBJECTS) $(libl7vsadm_parameter_a_DEPENDENCIES)
+ -rm -f libl7vsadm_parameter.a
+ $(libl7vsadm_parameter_a_AR) libl7vsadm_parameter.a $(libl7vsadm_parameter_a_OBJECTS) $(libl7vsadm_parameter_a_LIBADD)
+ $(RANLIB) libl7vsadm_parameter.a
+libl7vsd_parameter.a: $(libl7vsd_parameter_a_OBJECTS) $(libl7vsd_parameter_a_DEPENDENCIES)
+ -rm -f libl7vsd_parameter.a
+ $(libl7vsd_parameter_a_AR) libl7vsd_parameter.a $(libl7vsd_parameter_a_OBJECTS) $(libl7vsd_parameter_a_LIBADD)
+ $(RANLIB) libl7vsd_parameter.a
+libsnmpagent_parameter.a: $(libsnmpagent_parameter_a_OBJECTS) $(libsnmpagent_parameter_a_DEPENDENCIES)
+ -rm -f libsnmpagent_parameter.a
+ $(libsnmpagent_parameter_a_AR) libsnmpagent_parameter.a $(libsnmpagent_parameter_a_OBJECTS) $(libsnmpagent_parameter_a_LIBADD)
+ $(RANLIB) libsnmpagent_parameter.a
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libl7vsadm_parameter_a-parameter.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libl7vsadm_parameter_a-parameter_impl.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libl7vsd_parameter_a-parameter.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libl7vsd_parameter_a-parameter_impl.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsnmpagent_parameter_a-parameter.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsnmpagent_parameter_a-parameter_impl.Po@am__quote@
+
+.cpp.o:
+@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $<
+
+.cpp.obj:
+@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
+@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+
+.cpp.lo:
+@am__fastdepCXX_TRUE@ if $(LTCXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $<
+
+libl7vsadm_parameter_a-parameter.o: parameter.cpp
+@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libl7vsadm_parameter_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libl7vsadm_parameter_a-parameter.o -MD -MP -MF "$(DEPDIR)/libl7vsadm_parameter_a-parameter.Tpo" -c -o libl7vsadm_parameter_a-parameter.o `test -f 'parameter.cpp' || echo '$(srcdir)/'`parameter.cpp; \
+@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libl7vsadm_parameter_a-parameter.Tpo" "$(DEPDIR)/libl7vsadm_parameter_a-parameter.Po"; else rm -f "$(DEPDIR)/libl7vsadm_parameter_a-parameter.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='parameter.cpp' object='libl7vsadm_parameter_a-parameter.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libl7vsadm_parameter_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libl7vsadm_parameter_a-parameter.o `test -f 'parameter.cpp' || echo '$(srcdir)/'`parameter.cpp
+
+libl7vsadm_parameter_a-parameter.obj: parameter.cpp
+@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libl7vsadm_parameter_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libl7vsadm_parameter_a-parameter.obj -MD -MP -MF "$(DEPDIR)/libl7vsadm_parameter_a-parameter.Tpo" -c -o libl7vsadm_parameter_a-parameter.obj `if test -f 'parameter.cpp'; then $(CYGPATH_W) 'parameter.cpp'; else $(CYGPATH_W) '$(srcdir)/parameter.cpp'; fi`; \
+@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libl7vsadm_parameter_a-parameter.Tpo" "$(DEPDIR)/libl7vsadm_parameter_a-parameter.Po"; else rm -f "$(DEPDIR)/libl7vsadm_parameter_a-parameter.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='parameter.cpp' object='libl7vsadm_parameter_a-parameter.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libl7vsadm_parameter_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libl7vsadm_parameter_a-parameter.obj `if test -f 'parameter.cpp'; then $(CYGPATH_W) 'parameter.cpp'; else $(CYGPATH_W) '$(srcdir)/parameter.cpp'; fi`
+
+libl7vsadm_parameter_a-parameter_impl.o: parameter_impl.cpp
+@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libl7vsadm_parameter_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libl7vsadm_parameter_a-parameter_impl.o -MD -MP -MF "$(DEPDIR)/libl7vsadm_parameter_a-parameter_impl.Tpo" -c -o libl7vsadm_parameter_a-parameter_impl.o `test -f 'parameter_impl.cpp' || echo '$(srcdir)/'`parameter_impl.cpp; \
+@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libl7vsadm_parameter_a-parameter_impl.Tpo" "$(DEPDIR)/libl7vsadm_parameter_a-parameter_impl.Po"; else rm -f "$(DEPDIR)/libl7vsadm_parameter_a-parameter_impl.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='parameter_impl.cpp' object='libl7vsadm_parameter_a-parameter_impl.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libl7vsadm_parameter_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libl7vsadm_parameter_a-parameter_impl.o `test -f 'parameter_impl.cpp' || echo '$(srcdir)/'`parameter_impl.cpp
+
+libl7vsadm_parameter_a-parameter_impl.obj: parameter_impl.cpp
+@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libl7vsadm_parameter_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libl7vsadm_parameter_a-parameter_impl.obj -MD -MP -MF "$(DEPDIR)/libl7vsadm_parameter_a-parameter_impl.Tpo" -c -o libl7vsadm_parameter_a-parameter_impl.obj `if test -f 'parameter_impl.cpp'; then $(CYGPATH_W) 'parameter_impl.cpp'; else $(CYGPATH_W) '$(srcdir)/parameter_impl.cpp'; fi`; \
+@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libl7vsadm_parameter_a-parameter_impl.Tpo" "$(DEPDIR)/libl7vsadm_parameter_a-parameter_impl.Po"; else rm -f "$(DEPDIR)/libl7vsadm_parameter_a-parameter_impl.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='parameter_impl.cpp' object='libl7vsadm_parameter_a-parameter_impl.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libl7vsadm_parameter_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libl7vsadm_parameter_a-parameter_impl.obj `if test -f 'parameter_impl.cpp'; then $(CYGPATH_W) 'parameter_impl.cpp'; else $(CYGPATH_W) '$(srcdir)/parameter_impl.cpp'; fi`
+
+libl7vsd_parameter_a-parameter.o: parameter.cpp
+@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libl7vsd_parameter_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libl7vsd_parameter_a-parameter.o -MD -MP -MF "$(DEPDIR)/libl7vsd_parameter_a-parameter.Tpo" -c -o libl7vsd_parameter_a-parameter.o `test -f 'parameter.cpp' || echo '$(srcdir)/'`parameter.cpp; \
+@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libl7vsd_parameter_a-parameter.Tpo" "$(DEPDIR)/libl7vsd_parameter_a-parameter.Po"; else rm -f "$(DEPDIR)/libl7vsd_parameter_a-parameter.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='parameter.cpp' object='libl7vsd_parameter_a-parameter.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libl7vsd_parameter_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libl7vsd_parameter_a-parameter.o `test -f 'parameter.cpp' || echo '$(srcdir)/'`parameter.cpp
+
+libl7vsd_parameter_a-parameter.obj: parameter.cpp
+@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libl7vsd_parameter_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libl7vsd_parameter_a-parameter.obj -MD -MP -MF "$(DEPDIR)/libl7vsd_parameter_a-parameter.Tpo" -c -o libl7vsd_parameter_a-parameter.obj `if test -f 'parameter.cpp'; then $(CYGPATH_W) 'parameter.cpp'; else $(CYGPATH_W) '$(srcdir)/parameter.cpp'; fi`; \
+@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libl7vsd_parameter_a-parameter.Tpo" "$(DEPDIR)/libl7vsd_parameter_a-parameter.Po"; else rm -f "$(DEPDIR)/libl7vsd_parameter_a-parameter.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='parameter.cpp' object='libl7vsd_parameter_a-parameter.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libl7vsd_parameter_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libl7vsd_parameter_a-parameter.obj `if test -f 'parameter.cpp'; then $(CYGPATH_W) 'parameter.cpp'; else $(CYGPATH_W) '$(srcdir)/parameter.cpp'; fi`
+
+libl7vsd_parameter_a-parameter_impl.o: parameter_impl.cpp
+@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libl7vsd_parameter_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libl7vsd_parameter_a-parameter_impl.o -MD -MP -MF "$(DEPDIR)/libl7vsd_parameter_a-parameter_impl.Tpo" -c -o libl7vsd_parameter_a-parameter_impl.o `test -f 'parameter_impl.cpp' || echo '$(srcdir)/'`parameter_impl.cpp; \
+@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libl7vsd_parameter_a-parameter_impl.Tpo" "$(DEPDIR)/libl7vsd_parameter_a-parameter_impl.Po"; else rm -f "$(DEPDIR)/libl7vsd_parameter_a-parameter_impl.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='parameter_impl.cpp' object='libl7vsd_parameter_a-parameter_impl.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libl7vsd_parameter_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libl7vsd_parameter_a-parameter_impl.o `test -f 'parameter_impl.cpp' || echo '$(srcdir)/'`parameter_impl.cpp
+
+libl7vsd_parameter_a-parameter_impl.obj: parameter_impl.cpp
+@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libl7vsd_parameter_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libl7vsd_parameter_a-parameter_impl.obj -MD -MP -MF "$(DEPDIR)/libl7vsd_parameter_a-parameter_impl.Tpo" -c -o libl7vsd_parameter_a-parameter_impl.obj `if test -f 'parameter_impl.cpp'; then $(CYGPATH_W) 'parameter_impl.cpp'; else $(CYGPATH_W) '$(srcdir)/parameter_impl.cpp'; fi`; \
+@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libl7vsd_parameter_a-parameter_impl.Tpo" "$(DEPDIR)/libl7vsd_parameter_a-parameter_impl.Po"; else rm -f "$(DEPDIR)/libl7vsd_parameter_a-parameter_impl.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='parameter_impl.cpp' object='libl7vsd_parameter_a-parameter_impl.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libl7vsd_parameter_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libl7vsd_parameter_a-parameter_impl.obj `if test -f 'parameter_impl.cpp'; then $(CYGPATH_W) 'parameter_impl.cpp'; else $(CYGPATH_W) '$(srcdir)/parameter_impl.cpp'; fi`
+
+libsnmpagent_parameter_a-parameter.o: parameter.cpp
+@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsnmpagent_parameter_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libsnmpagent_parameter_a-parameter.o -MD -MP -MF "$(DEPDIR)/libsnmpagent_parameter_a-parameter.Tpo" -c -o libsnmpagent_parameter_a-parameter.o `test -f 'parameter.cpp' || echo '$(srcdir)/'`parameter.cpp; \
+@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libsnmpagent_parameter_a-parameter.Tpo" "$(DEPDIR)/libsnmpagent_parameter_a-parameter.Po"; else rm -f "$(DEPDIR)/libsnmpagent_parameter_a-parameter.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='parameter.cpp' object='libsnmpagent_parameter_a-parameter.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsnmpagent_parameter_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libsnmpagent_parameter_a-parameter.o `test -f 'parameter.cpp' || echo '$(srcdir)/'`parameter.cpp
+
+libsnmpagent_parameter_a-parameter.obj: parameter.cpp
+@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsnmpagent_parameter_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libsnmpagent_parameter_a-parameter.obj -MD -MP -MF "$(DEPDIR)/libsnmpagent_parameter_a-parameter.Tpo" -c -o libsnmpagent_parameter_a-parameter.obj `if test -f 'parameter.cpp'; then $(CYGPATH_W) 'parameter.cpp'; else $(CYGPATH_W) '$(srcdir)/parameter.cpp'; fi`; \
+@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libsnmpagent_parameter_a-parameter.Tpo" "$(DEPDIR)/libsnmpagent_parameter_a-parameter.Po"; else rm -f "$(DEPDIR)/libsnmpagent_parameter_a-parameter.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='parameter.cpp' object='libsnmpagent_parameter_a-parameter.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsnmpagent_parameter_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libsnmpagent_parameter_a-parameter.obj `if test -f 'parameter.cpp'; then $(CYGPATH_W) 'parameter.cpp'; else $(CYGPATH_W) '$(srcdir)/parameter.cpp'; fi`
+
+libsnmpagent_parameter_a-parameter_impl.o: parameter_impl.cpp
+@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsnmpagent_parameter_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libsnmpagent_parameter_a-parameter_impl.o -MD -MP -MF "$(DEPDIR)/libsnmpagent_parameter_a-parameter_impl.Tpo" -c -o libsnmpagent_parameter_a-parameter_impl.o `test -f 'parameter_impl.cpp' || echo '$(srcdir)/'`parameter_impl.cpp; \
+@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libsnmpagent_parameter_a-parameter_impl.Tpo" "$(DEPDIR)/libsnmpagent_parameter_a-parameter_impl.Po"; else rm -f "$(DEPDIR)/libsnmpagent_parameter_a-parameter_impl.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='parameter_impl.cpp' object='libsnmpagent_parameter_a-parameter_impl.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsnmpagent_parameter_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libsnmpagent_parameter_a-parameter_impl.o `test -f 'parameter_impl.cpp' || echo '$(srcdir)/'`parameter_impl.cpp
+
+libsnmpagent_parameter_a-parameter_impl.obj: parameter_impl.cpp
+@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsnmpagent_parameter_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libsnmpagent_parameter_a-parameter_impl.obj -MD -MP -MF "$(DEPDIR)/libsnmpagent_parameter_a-parameter_impl.Tpo" -c -o libsnmpagent_parameter_a-parameter_impl.obj `if test -f 'parameter_impl.cpp'; then $(CYGPATH_W) 'parameter_impl.cpp'; else $(CYGPATH_W) '$(srcdir)/parameter_impl.cpp'; fi`; \
+@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/libsnmpagent_parameter_a-parameter_impl.Tpo" "$(DEPDIR)/libsnmpagent_parameter_a-parameter_impl.Po"; else rm -f "$(DEPDIR)/libsnmpagent_parameter_a-parameter_impl.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='parameter_impl.cpp' object='libsnmpagent_parameter_a-parameter_impl.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsnmpagent_parameter_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libsnmpagent_parameter_a-parameter_impl.obj `if test -f 'parameter_impl.cpp'; then $(CYGPATH_W) 'parameter_impl.cpp'; else $(CYGPATH_W) '$(srcdir)/parameter_impl.cpp'; fi`
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+distclean-libtool:
+ -rm -f libtool
+uninstall-info-am:
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+ list='$(DISTFILES)'; for file in $$list; do \
+ case $$file in \
+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+ esac; \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ dir="/$$dir"; \
+ $(mkdir_p) "$(distdir)$$dir"; \
+ else \
+ dir=''; \
+ fi; \
+ if test -d $$d/$$file; then \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LIBRARIES)
+installdirs:
+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-libtool clean-noinstLIBRARIES \
+ mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-libtool distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-exec-am:
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-info-am
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+ clean-libtool clean-noinstLIBRARIES ctags distclean \
+ distclean-compile distclean-generic distclean-libtool \
+ distclean-tags distdir dvi dvi-am html html-am info info-am \
+ install install-am install-data install-data-am install-exec \
+ install-exec-am install-info install-info-am install-man \
+ install-strip installcheck installcheck-am installdirs \
+ maintainer-clean maintainer-clean-generic mostlyclean \
+ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
+ pdf pdf-am ps ps-am tags uninstall uninstall-am \
+ uninstall-info-am
+
+# 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:
--- /dev/null
+#include "parameter_enum.h"
+#include "parameter.h"
+#include "parameter_impl.h"
+#include "logger_wrapper.h"
+
+#if !defined(LOGGER_PROCESS_VSD) && !defined(LOGGER_PROCESS_ADM) && !defined(LOGGER_PROCESS_SNM)
+#define LOGGER_PROCESS_VSD
+#endif
+
+#ifdef LOGGER_PROCESS_SNM
+LOG_CATEGORY_TAG param_cat = LOG_CAT_SNMPAGENT_PARAMETER;
+#elif LOGGER_PROCESS_ADM
+LOG_CATEGORY_TAG param_cat = LOG_CAT_L7VSADM_PARAMETER;
+#else
+LOG_CATEGORY_TAG param_cat = LOG_CAT_L7VSD_PARAMETER;
+#endif
+
+/*!
+ * Constructor of Parameter class
+ */
+l7vs::Parameter::Parameter()
+{
+ if( !ParameterImpl::getInstance().init() ){
+ LOGGER_PUT_LOG_FATAL( param_cat, 1, "Parameter initialize failure" );
+ switch( param_cat ){
+ case LOG_CAT_L7VSADM_PARAMETER:
+ break;
+ default:
+// throw 1; //don't throw exception at singleton constructor...
+ exit(1);
+ }
+ }
+}
+
+/*!
+ * Destructor of Parameter class
+ */
+l7vs::Parameter::~Parameter()
+{
+}
+
+/*!
+ * reload config file
+ * @param[in] comp section TAG
+ * @return true = success read file / false = failure read file
+ */
+bool
+l7vs::Parameter::rereadFile(PARAMETER_COMPONENT_TAG comp)
+{
+ return ParameterImpl::getInstance().rereadFile(comp);
+}
+
+/*!
+ * check whether integer data exists.
+ * @param[in] comp section TAG
+ * @param[in] key key string
+ * @return true = exist setting value / false = non exist setting value
+ */
+bool
+l7vs::Parameter::isIntExist(const PARAMETER_COMPONENT_TAG comp, const std::string& key)
+{
+ return ParameterImpl::getInstance().isIntExist(comp, key);
+}
+
+/*!
+ * check whether character data exists.
+ * @param[in] comp section TAG
+ * @param[in] key key string
+ * @return true = exist setting value / false = non exist setting value
+ */
+bool
+l7vs::Parameter::isStringExist(const PARAMETER_COMPONENT_TAG comp, const std::string& key)
+{
+ return ParameterImpl::getInstance().isStringExist(comp, key);
+}
+
+/*!
+ * get integer data.
+ * @param[in] comp section TAG
+ * @param[in] key key string
+ * @return value
+ */
+int
+l7vs::Parameter::getIntValue(const PARAMETER_COMPONENT_TAG comp, const std::string& key)
+{
+ return ParameterImpl::getInstance().getIntValue(comp, key);
+}
+
+/*!
+ * get character data.
+ * @param[in] comp section TAG
+ * @param[in] key key string
+ * @return value
+ */
+std::string
+l7vs::Parameter::getStringValue(const PARAMETER_COMPONENT_TAG comp, const std::string& key)
+{
+ return ParameterImpl::getInstance().getStringValue(comp, key);
+}
+
+/*!
+ * set-parameter function pointer relates component-tag
+ * @param[in] comp section TAG
+ * @param[in] p_func function pointer
+ */
+void
+l7vs::Parameter::registerFunctionPointer(const PARAMETER_COMPONENT_TAG comp, void(*p_func)())
+{
+ ParameterImpl::getInstance().registerFunctionPointer(comp, p_func);
+}
+
--- /dev/null
+#ifndef __PARAMETER_H__
+#define __PARAMETER_H__
+
+#include <iostream>
+#include "parameter_enum.h"
+
+namespace l7vs
+{
+ class ParameterImpl;
+ class Parameter
+ {
+ private:
+ static Parameter instance;
+
+ protected:
+ Parameter();
+ Parameter( const Parameter& );
+ Parameter& operator=( const Parameter& );
+ ~Parameter();
+
+ public:
+ bool rereadFile(const PARAMETER_COMPONENT_TAG);
+
+ inline static Parameter& getInstance(){
+ return instance;
+ }
+ bool isIntExist(const PARAMETER_COMPONENT_TAG, const std::string&);
+ bool isStringExist(const PARAMETER_COMPONENT_TAG, const std::string&);
+ int getIntValue(const PARAMETER_COMPONENT_TAG, const std::string&);
+ std::string getStringValue(const PARAMETER_COMPONENT_TAG, const std::string&);
+ void registerFunctionPointer(const PARAMETER_COMPONENT_TAG, void(*)());
+ };
+}
+
+#endif //__PARAMETER_H__
--- /dev/null
+#ifndef __PARAMETER_ENUM_H__
+#define __PARAMETER_ENUM_H__
+
+/*!
+ * enumerate section
+ */
+enum PARAMETER_COMPONENT_TAG
+{
+ PARAM_COMP_ALL,
+ PARAM_COMP_NOCAT,
+ PARAM_COMP_L7VSD,
+ PARAM_COMP_IOMUX,
+ PARAM_COMP_LSOCK,
+ PARAM_COMP_CONN,
+ PARAM_COMP_DEST,
+ PARAM_COMP_SERVICE,
+ PARAM_COMP_MODULE,
+ PARAM_COMP_REPLICATION,
+ PARAM_COMP_LOGGER,
+ PARAM_COMP_L7VSADM,
+ PARAM_COMP_SNMPAGENT
+};
+
+#endif //__PARAMETER_ENUM_H__
--- /dev/null
+#include <vector>
+#include <fstream>
+#include <stdexcept>
+#include "parameter_impl.h"
+#include "logger_wrapper.h"
+
+//#include "lexical_cast.h"
+#include <boost/lexical_cast.hpp>
+
+#ifndef PARAMETER_FILE
+#define PARAMETER_FILE "/etc/l7vs/l7vs.cf"
+#endif //PARAMETER_FILE
+
+#define LINE_LENGTH 4096
+
+#if !defined(LOGGER_PROCESS_VSD) && !defined(LOGGER_PROCESS_ADM) && !defined(LOGGER_PROCESS_SNM)
+#define LOGGER_PROCESS_VSD
+#endif
+
+#ifdef LOGGER_PROCESS_SNM
+LOG_CATEGORY_TAG parameter_cat = LOG_CAT_SNMPAGENT_PARAMETER;
+#elif LOGGER_PROCESS_ADM
+LOG_CATEGORY_TAG parameter_cat = LOG_CAT_L7VSADM_PARAMETER;
+#else
+LOG_CATEGORY_TAG parameter_cat = LOG_CAT_L7VSD_PARAMETER;
+#endif
+
+void loadLoggerConf(){
+ l7vs::Logger::getInstance().loadConf();
+}
+
+/*!
+ * ParameterImpl class Constructor
+ */
+l7vs::ParameterImpl::ParameterImpl()
+{
+}
+
+/*!
+ * Initialize ParameterImpl class
+ */
+bool l7vs::ParameterImpl::init()
+{
+ bool retbool = true;
+ //clrear map objects
+ compTable.clear();
+ stringMap.clear();
+ intMap.clear();
+
+ //add member to component table
+ compTable[PARAM_COMP_ALL] = component("all", NULL);
+ compTable[PARAM_COMP_NOCAT] = component("nocategory", NULL);
+ compTable[PARAM_COMP_L7VSD] = component("l7vsd", NULL);
+ compTable[PARAM_COMP_IOMUX] = component("iomux", NULL);
+ compTable[PARAM_COMP_LSOCK] = component("lsock", NULL);
+ compTable[PARAM_COMP_CONN] = component("conn", NULL);
+ compTable[PARAM_COMP_DEST] = component("dest", NULL);
+ compTable[PARAM_COMP_SERVICE] = component("service", NULL);
+ compTable[PARAM_COMP_MODULE] = component("module", NULL);
+ compTable[PARAM_COMP_REPLICATION] = component("replication", NULL);
+ compTable[PARAM_COMP_LOGGER] = component("logger", loadLoggerConf);
+ compTable[PARAM_COMP_L7VSADM] = component("l7vsadm", NULL);
+ compTable[PARAM_COMP_SNMPAGENT] = component("snmpagent", NULL);
+
+ //read all parameters
+ retbool = rereadFile( PARAM_COMP_ALL );
+
+ return retbool;
+}
+
+/*!
+ * checks that an argument is a numeric.
+ * @param[in] const std::string
+ * @return is numeric = true / not numeric = false
+ */
+bool l7vs::ParameterImpl::isNumeric(const std::string& val)
+{
+ try {
+// l7vs::lexical_cast<int>(val);
+ boost::lexical_cast<int>(val);
+ }
+// catch (std::exception& ex) {
+ catch (boost::bad_lexical_cast& ex) {
+ return false;
+ }
+ return true;
+}
+
+/*!
+ * delete blank before and behind a sentence
+ * @param[in] const std::string
+ * @return std::string
+ */
+std::string l7vs::ParameterImpl::removebrank( const std::string& val )
+{
+ std::string str = val;
+ //remove brank(head of the sentence and end of the sentence)
+ std::string::iterator its;
+ its = str.begin();
+ while( its != str.end() ){
+ if( ( ' ' == *its ) || ( '\t' == *its ) ){
+ str.erase(its);
+ }else break;
+ }
+ if( "" == str )return str;
+ //remove brank(head of the sentence and end of the sentence)
+ its = str.end() - 1;
+ while( its != str.begin() ){
+ if( ( ' ' == *its ) || ( '\t' == *its ) ){
+ str.erase(its);
+ its--;
+ }else break;
+ }
+ return str;
+}
+
+/*!
+ * Read Parameter from file
+ * @param[in] void
+ * @return success = true / fail = false
+ */
+bool l7vs::ParameterImpl::readParameterFile( const std::string& val )
+{
+ bool retval = true;
+ char readbuf[LINE_LENGTH];
+
+ LOGGER_PUT_LOG_INFO( parameter_cat,1, "read parameter file : %s", val.c_str() );
+
+ std::vector<std::string> paramlines;
+ try{
+ paramlines.clear();
+ preparse.clear();
+
+ std::ifstream ifs( val.c_str() );
+ if( ifs.fail() ){
+ return false;
+ }
+ while( !ifs.eof() ){
+ memset( readbuf, 0, LINE_LENGTH );
+ ifs.getline( readbuf, ( LINE_LENGTH - 1 ) );
+ std::string str = readbuf;
+ str = removebrank( str );
+ //remove coment line
+ if( '#' == str[0] )continue;
+ //remove brank
+ if( !str.empty() )paramlines.push_back( str );
+ }
+ std::string sectionname = compTable[PARAM_COMP_NOCAT].section;
+ for( std::vector<std::string>::iterator it = paramlines.begin();
+ it != paramlines.end(); it++ ){
+ //pre-parse
+ std::string str = *it;
+ if( '[' == str[0] ){
+ std::string tmpstr = str.substr( str.rfind("]")+1 );
+ tmpstr = removebrank( tmpstr.substr( 0, tmpstr.find( "#" ) ) );
+ if( !tmpstr.empty() )continue;
+ //section string validity check
+ //invalid "#","[","]","\" character
+ tmpstr = removebrank( str.substr( str.find( "[" )+1, str.rfind( "]", str.length() )-1 ) );
+ if( std::string::npos != tmpstr.find( "[" ) )tmpstr = compTable[PARAM_COMP_NOCAT].section;
+ if( std::string::npos != tmpstr.find( "]" ) )tmpstr = compTable[PARAM_COMP_NOCAT].section;
+ if( std::string::npos != tmpstr.find( "\\" ) )tmpstr = compTable[PARAM_COMP_NOCAT].section;
+ if( std::string::npos != tmpstr.find( "#" ) )tmpstr = compTable[PARAM_COMP_NOCAT].section;
+ if( std::string::npos != tmpstr.find( "=" ) )tmpstr = compTable[PARAM_COMP_NOCAT].section;
+ sectionname = tmpstr;
+ }else{
+ preparse.insert( std::pair<std::string,std::string>( sectionname,str ) );
+ }
+ }
+ }
+ catch( ... ){
+ preparse.clear();
+ retval = false;
+ }
+ if( preparse.empty() )retval = false;
+ return retval;
+}
+
+/*!
+ * read parameter and parse
+ * @param[in] void
+ * @return success = true / fail = false
+ */
+bool l7vs::ParameterImpl::rereadFile(PARAMETER_COMPONENT_TAG comp)
+{
+ bool retbool = true;
+
+ LOGGER_PUT_LOG_INFO( parameter_cat,2, "read parameter : COMPONENT = %s", compTable[comp].section.c_str() );
+
+ if( !readParameterFile( PARAMETER_FILE ) )return false;
+
+ std::multimap<std::string,std::string>::iterator it;
+ std::multimap<std::string,std::string>::iterator ite;
+ if( PARAM_COMP_ALL == comp ){
+ it = preparse.begin();
+ }else{
+ it = preparse.find( compTable[comp].section );
+ }
+ ite = preparse.end();
+
+ for( std::multimap<std::string,std::string>::iterator its = it; its !=ite; its++ ){
+ //be made an invalid line if there is no = in a setting line.
+ if( std::string::npos == its->second.find( "=" ) )continue;
+ std::string key = removebrank( its->second.substr( 0, its->second.find( "=" ) ) );
+ //Key string validity check
+ if( key.empty() )continue;
+ //invalid "#","[","]","\" character
+ if( std::string::npos != key.find( "[" ))continue;
+ if( std::string::npos != key.find( "]" ))continue;
+ if( std::string::npos != key.find( "\\" ))continue;
+ if( std::string::npos != key.find( "#" ) )continue;
+
+ key = its->first + "." + key;
+
+ std::string value = removebrank( its->second.substr( its->second.find( "=" )+1, std::string::npos ) );
+ //Value string validity check
+ if( '"' == value[0] ) {
+ if( std::string::npos == value.find( "\"", 1 ) )continue;
+ std::string tmpstr = removebrank( value.substr( value.find( "\"", 1 )+1, value.find( "#", value.find( "\"", 1 )+1 ) ) );
+ if( !tmpstr.empty() )continue;
+ tmpstr = removebrank( value.substr( 1, value.find( "\"", 1 )-1 ) );
+
+
+
+ stringMap[key] = tmpstr;
+ }else{
+ value = value.substr( 0, value.find_first_of( "#", 0 ) );
+ if( std::string::npos != value.find( "\\" ))continue;
+ if( std::string::npos != value.find( "=" ))continue;
+ if( value.empty() )continue;
+ if( isNumeric( value ) ){
+ try{
+// intMap[key] = l7vs::lexical_cast<int>( value );
+ intMap[key] = boost::lexical_cast<int>( value );
+ }
+// catch(std::exception& ex){
+ catch (boost::bad_lexical_cast& ex) {
+ stringMap[key] = value;
+ }
+ }else{
+ stringMap[key] = value;
+ }
+ }
+ }
+
+ //set parameter
+ std::map<PARAMETER_COMPONENT_TAG, component>::iterator itr = compTable.find( comp );
+ if( itr != compTable.end() ){
+ try{
+ if( NULL != itr->second.function )itr->second.function();
+ }
+ catch( const std::logic_error& err ){
+ LOGGER_PUT_LOG_ERROR( parameter_cat,1, "set parameter function failure at category: %s", itr->second.section.c_str() );
+ retbool = false;
+ }
+ }
+ if( PARAM_COMP_ALL == comp ){
+ for( itr = compTable.begin(); itr != compTable.end(); ++itr ){
+ try{
+ if( NULL != itr->second.function )itr->second.function();
+ }
+ catch( const std::logic_error& err ){
+ LOGGER_PUT_LOG_ERROR( parameter_cat,2, "set parameter function failure at category: %s", itr->second.section.c_str() );
+ retbool = false;
+ }
+ }
+ }
+
+ return retbool;
+}
+
+/*!
+ * Existence of a integer parameter is checked
+ * @param[in] PARAMETER_COMPONENT_TAG
+ * @param[in] const std::string
+ * @return exist = true / not exist = false
+ */
+bool l7vs::ParameterImpl::isIntExist(const PARAMETER_COMPONENT_TAG comp, const std::string& key)
+{
+ bool retval = false;
+ std::string comp_key = compTable[comp].section + "." + key;
+ if( intMap.end() != intMap.find( comp_key ) ){
+ retval = true;
+ }
+ return retval;
+}
+
+/*!
+ * Existence of a string parameter is checked
+ * @param[in] PARAMETER_COMPONENT_TAG
+ * @param[in] const std::string
+ * @return exist = true / not exist = false
+ */
+bool l7vs::ParameterImpl::isStringExist(const PARAMETER_COMPONENT_TAG comp, const std::string& key)
+{
+ bool retval = false;
+ std::string comp_key = compTable[comp].section + "." + key;
+ if( stringMap.end() != stringMap.find( comp_key ) ){
+ retval = true;
+ }
+ return retval;
+}
+
+/*!
+ * get a integer parameter
+ * @param[in] PARAMETER_COMPONENT_TAG
+ * @param[in] const std::string
+ * @return integer
+ */
+int l7vs::ParameterImpl::getIntValue(const PARAMETER_COMPONENT_TAG comp, const std::string& key)
+{
+ std::string comp_key = compTable[comp].section + "." + key;
+ return intMap.find( comp_key )->second;
+}
+
+/*!
+ * get a string parameter
+ * @param[in] PARAMETER_COMPONENT_TAG
+ * @param[in] const std::string
+ * @return std::string
+ */
+std::string l7vs::ParameterImpl::getStringValue(const PARAMETER_COMPONENT_TAG comp, const std::string& key)
+{
+ std::string retstr = "";
+ std::string comp_key = compTable[comp].section + "." + key;
+ std::map<std::string,std::string>::iterator it = stringMap.find( comp_key );
+ if( it != stringMap.end() )
+ retstr = stringMap.find( comp_key )->second;
+ return retstr;
+}
+
+/*!
+ * set-parameter function pointer relates component-tag
+ * @param[in] comp section TAG
+ * @param[in] p_func function pointer
+ */
+void l7vs::ParameterImpl::registerFunctionPointer( const PARAMETER_COMPONENT_TAG comp, void (*p_func)() )
+{
+ compTable[comp].function = p_func;
+}
+
--- /dev/null
+#ifndef __PARAMETER_IMPL_H__
+#define __PARAMETER_IMPL_H__
+
+#include "parameter_enum.h"
+#include <iostream>
+#include <string>
+#include <map>
+
+
+namespace l7vs
+{
+ struct component{
+ std::string section;
+ void (*function)();
+ component(){ section = ""; function = NULL;}
+ component( std::string str, void (*p_func)() ){ section = str; function = p_func;}
+ component& operator=(const component& in_comp){ section = in_comp.section; function = in_comp.function;return *this;}
+ };
+ class ParameterImpl
+ {
+ private:
+ std::string removebrank( const std::string& );
+ bool readParameterFile( const std::string& );
+ bool isNumeric( const std::string& );
+
+ std::multimap<std::string,std::string> preparse;
+
+ std::map<PARAMETER_COMPONENT_TAG, component> compTable;
+ std::map<std::string, std::string> stringMap;
+ std::map<std::string, int> intMap;
+
+ protected:
+ ParameterImpl();
+ ParameterImpl( const ParameterImpl& );
+ ParameterImpl& operator=( const ParameterImpl& );
+
+ public:
+ static ParameterImpl & getInstance(){
+ static ParameterImpl instance;
+ return instance;
+ }
+ bool init();
+ bool rereadFile( const PARAMETER_COMPONENT_TAG );
+
+ bool isIntExist( const PARAMETER_COMPONENT_TAG, const std::string& );
+ bool isStringExist( const PARAMETER_COMPONENT_TAG, const std::string& );
+ int getIntValue( const PARAMETER_COMPONENT_TAG, const std::string& );
+ std::string getStringValue( const PARAMETER_COMPONENT_TAG, const std::string& );
+
+ void registerFunctionPointer( const PARAMETER_COMPONENT_TAG, void (*)() );
+ };
+}
+#endif //__PARAMETER_IMPL_H__
--- /dev/null
+#ifndef PARAMETER_WRAPPER
+#define PARAMETER_WRAPPER
+
+#include "parameter.h"
+
+/*!
+ * check whether integer data exists.
+ * @param[in] comp section TAG
+ * @param[in] *key key string
+ * @return 1 = exist setting value / 0 = non exist setting value
+ */
+inline int parameter_is_int_exist(const PARAMETER_COMPONENT_TAG comp, const char* key)
+{
+ if (l7vs::Parameter::getInstance().isIntExist(comp, key)) {
+ return 1;
+ }
+ return 0;
+}
+
+/*!
+ * check whether character data exists.
+ * @param[in] comp section TAG
+ * @param[in] *key key string
+ * @return 1 = exist setting value / 0 = non exist setting value
+ */
+inline int parameter_is_char_exist(const PARAMETER_COMPONENT_TAG comp, const char* key)
+{
+ if (l7vs::Parameter::getInstance().isStringExist(comp, key)) {
+ return 1;
+ }
+ return 0;
+}
+
+/*!
+ * get integer data.
+ * @param[in] comp section TAG
+ * @param[in] *key key string
+ * @return value
+ */
+inline int parameter_get_int_value(const PARAMETER_COMPONENT_TAG comp, const char* key)
+{
+ return l7vs::Parameter::getInstance().getIntValue(comp, key);
+}
+
+/*!
+ * get character data.
+ * @param[in] comp section TAG
+ * @param[in] *key key string
+ * @return value
+ */
+inline const char* parameter_get_char_value(const PARAMETER_COMPONENT_TAG comp, const char* key)
+{
+ return (l7vs::Parameter::getInstance().getStringValue(comp, key)).c_str();
+}
+
+/*!
+ * reload config file
+ * @param[in] comp section TAG
+ * @return 0 = success read file / -1 = failure read file
+ */
+inline int parameter_reread_file(const PARAMETER_COMPONENT_TAG comp)
+{
+ if (l7vs::Parameter::getInstance().rereadFile(comp)) {
+ return 0;
+ }
+ return -1;
+}
+
+/*!
+ * set-parameter function pointer relates component-tag
+ * @param[in] comp section TAG
+ * @param[in] p_func function pointer
+ */
+inline void parameter_register_function_pointer(const PARAMETER_COMPONENT_TAG comp, void(*p_func)())
+{
+ l7vs::Parameter::getInstance().registerFunctionPointer(comp, p_func);
+}
+
+#endif //PARAMETER_WRAPPER
+
--- /dev/null
+bin_PROGRAMS= l7snmpagent
+AUTOMAKE_OPTIONS = foreign
+
+l7snmpagent_SOURCES = \
+ ../logger/logger_wrapper.h \
+ ../parameter/parameter_wrapper.h \
+ UltraMonkeyL7.h \
+ dispatch_message.h \
+ interproccom.h \
+ l7ag_socket.h \
+ proc_mibcollectmessage.h \
+ proc_settingrequest.h \
+ proc_trapsendrequest.h \
+ queue_sendtrap.h \
+ store_mibdata.h \
+ subagent.h \
+ tag_threadstat.h \
+ tag_trapid.h \
+ watch_l7vsd.h \
+ dispatch_message.cpp \
+ l7ag_socket.cpp \
+ interproccom.cpp \
+ proc_mibcollectmessage.cpp \
+ proc_settingrequest.cpp \
+ proc_trapsendrequest.cpp \
+ queue_sendtrap.cpp \
+ store_mibdata.cpp \
+ subagent.cpp \
+ watch_l7vsd.cpp \
+ l7snmpagent.cpp
+
+l7snmpagent_CPPFLAGS = -O2 -g -I../../include -I../logger -I../parameter -DLOGGER_PROCESS_SNM -DVERSION=\"$(VERSION)\"
+
+l7snmpagent_LDADD = $(GLIB_LIBS) \
+ ../logger/libsnmpagent_logger.a \
+ ../parameter/libsnmpagent_parameter.a \
+ -llog4cxx \
+ -lrt
+
--- /dev/null
+# Makefile.in generated by automake 1.10 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+bin_PROGRAMS = l7snmpagent$(EXEEXT)
+subdir = snmpagent
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+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)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+am__installdirs = "$(DESTDIR)$(bindir)"
+binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
+PROGRAMS = $(bin_PROGRAMS)
+am_l7snmpagent_OBJECTS = l7snmpagent-dispatch_message.$(OBJEXT) \
+ l7snmpagent-l7ag_socket.$(OBJEXT) \
+ l7snmpagent-interproccom.$(OBJEXT) \
+ l7snmpagent-proc_mibcollectmessage.$(OBJEXT) \
+ l7snmpagent-proc_settingrequest.$(OBJEXT) \
+ l7snmpagent-proc_trapsendrequest.$(OBJEXT) \
+ l7snmpagent-queue_sendtrap.$(OBJEXT) \
+ l7snmpagent-store_mibdata.$(OBJEXT) \
+ l7snmpagent-subagent.$(OBJEXT) \
+ l7snmpagent-watch_l7vsd.$(OBJEXT) \
+ l7snmpagent-l7snmpagent.$(OBJEXT)
+l7snmpagent_OBJECTS = $(am_l7snmpagent_OBJECTS)
+am__DEPENDENCIES_1 =
+l7snmpagent_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+ ../logger/libsnmpagent_logger.a \
+ ../parameter/libsnmpagent_parameter.a
+DEFAULT_INCLUDES = -I. -I$(top_builddir)@am__isrc@
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+LTCXXCOMPILE = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+CXXLD = $(CXX)
+CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+SOURCES = $(l7snmpagent_SOURCES)
+DIST_SOURCES = $(l7snmpagent_SOURCES)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+GLIB_CFLAGS = @GLIB_CFLAGS@
+GLIB_GENMARSHAL = @GLIB_GENMARSHAL@
+GLIB_LIBS = @GLIB_LIBS@
+GLIB_MKENUMS = @GLIB_MKENUMS@
+GOBJECT_QUERY = @GOBJECT_QUERY@
+GREP = @GREP@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MANDIR = @MANDIR@
+MKDIR_P = @MKDIR_P@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PKG_CONFIG = @PKG_CONFIG@
+RANLIB = @RANLIB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+l7vs_maxvs = @l7vs_maxvs@
+l7vs_moddir = @l7vs_moddir@
+l7vsadm_sockdir = @l7vsadm_sockdir@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+snmpagent_libs = @snmpagent_libs@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+AUTOMAKE_OPTIONS = foreign
+l7snmpagent_SOURCES = \
+ ../logger/logger_wrapper.h \
+ ../parameter/parameter_wrapper.h \
+ UltraMonkeyL7.h \
+ dispatch_message.h \
+ interproccom.h \
+ l7ag_socket.h \
+ proc_mibcollectmessage.h \
+ proc_settingrequest.h \
+ proc_trapsendrequest.h \
+ queue_sendtrap.h \
+ store_mibdata.h \
+ subagent.h \
+ tag_threadstat.h \
+ tag_trapid.h \
+ watch_l7vsd.h \
+ dispatch_message.cpp \
+ l7ag_socket.cpp \
+ interproccom.cpp \
+ proc_mibcollectmessage.cpp \
+ proc_settingrequest.cpp \
+ proc_trapsendrequest.cpp \
+ queue_sendtrap.cpp \
+ store_mibdata.cpp \
+ subagent.cpp \
+ watch_l7vsd.cpp \
+ l7snmpagent.cpp
+
+l7snmpagent_CPPFLAGS = -O2 -g -I../../include -I../logger -I../parameter -DLOGGER_PROCESS_SNM -DVERSION=\"$(VERSION)\"
+l7snmpagent_LDADD = $(GLIB_LIBS) \
+ ../logger/libsnmpagent_logger.a \
+ ../parameter/libsnmpagent_parameter.a \
+ -llog4cxx \
+ -lrt
+
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .cpp .lo .o .obj
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign snmpagent/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign snmpagent/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+install-binPROGRAMS: $(bin_PROGRAMS)
+ @$(NORMAL_INSTALL)
+ test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+ if test -f $$p \
+ || test -f $$p1 \
+ ; then \
+ f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
+ echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \
+ $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \
+ else :; fi; \
+ done
+
+uninstall-binPROGRAMS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
+ echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \
+ rm -f "$(DESTDIR)$(bindir)/$$f"; \
+ done
+
+clean-binPROGRAMS:
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+ echo " rm -f $$p $$f"; \
+ rm -f $$p $$f ; \
+ done
+l7snmpagent$(EXEEXT): $(l7snmpagent_OBJECTS) $(l7snmpagent_DEPENDENCIES)
+ @rm -f l7snmpagent$(EXEEXT)
+ $(CXXLINK) $(l7snmpagent_OBJECTS) $(l7snmpagent_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/l7snmpagent-dispatch_message.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/l7snmpagent-interproccom.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/l7snmpagent-l7ag_socket.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/l7snmpagent-l7snmpagent.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/l7snmpagent-proc_mibcollectmessage.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/l7snmpagent-proc_settingrequest.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/l7snmpagent-proc_trapsendrequest.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/l7snmpagent-queue_sendtrap.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/l7snmpagent-store_mibdata.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/l7snmpagent-subagent.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/l7snmpagent-watch_l7vsd.Po@am__quote@
+
+.cpp.o:
+@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $<
+
+.cpp.obj:
+@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+
+.cpp.lo:
+@am__fastdepCXX_TRUE@ $(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $<
+
+l7snmpagent-dispatch_message.o: dispatch_message.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(l7snmpagent_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT l7snmpagent-dispatch_message.o -MD -MP -MF $(DEPDIR)/l7snmpagent-dispatch_message.Tpo -c -o l7snmpagent-dispatch_message.o `test -f 'dispatch_message.cpp' || echo '$(srcdir)/'`dispatch_message.cpp
+@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/l7snmpagent-dispatch_message.Tpo $(DEPDIR)/l7snmpagent-dispatch_message.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='dispatch_message.cpp' object='l7snmpagent-dispatch_message.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(l7snmpagent_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o l7snmpagent-dispatch_message.o `test -f 'dispatch_message.cpp' || echo '$(srcdir)/'`dispatch_message.cpp
+
+l7snmpagent-dispatch_message.obj: dispatch_message.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(l7snmpagent_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT l7snmpagent-dispatch_message.obj -MD -MP -MF $(DEPDIR)/l7snmpagent-dispatch_message.Tpo -c -o l7snmpagent-dispatch_message.obj `if test -f 'dispatch_message.cpp'; then $(CYGPATH_W) 'dispatch_message.cpp'; else $(CYGPATH_W) '$(srcdir)/dispatch_message.cpp'; fi`
+@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/l7snmpagent-dispatch_message.Tpo $(DEPDIR)/l7snmpagent-dispatch_message.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='dispatch_message.cpp' object='l7snmpagent-dispatch_message.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(l7snmpagent_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o l7snmpagent-dispatch_message.obj `if test -f 'dispatch_message.cpp'; then $(CYGPATH_W) 'dispatch_message.cpp'; else $(CYGPATH_W) '$(srcdir)/dispatch_message.cpp'; fi`
+
+l7snmpagent-l7ag_socket.o: l7ag_socket.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(l7snmpagent_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT l7snmpagent-l7ag_socket.o -MD -MP -MF $(DEPDIR)/l7snmpagent-l7ag_socket.Tpo -c -o l7snmpagent-l7ag_socket.o `test -f 'l7ag_socket.cpp' || echo '$(srcdir)/'`l7ag_socket.cpp
+@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/l7snmpagent-l7ag_socket.Tpo $(DEPDIR)/l7snmpagent-l7ag_socket.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='l7ag_socket.cpp' object='l7snmpagent-l7ag_socket.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(l7snmpagent_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o l7snmpagent-l7ag_socket.o `test -f 'l7ag_socket.cpp' || echo '$(srcdir)/'`l7ag_socket.cpp
+
+l7snmpagent-l7ag_socket.obj: l7ag_socket.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(l7snmpagent_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT l7snmpagent-l7ag_socket.obj -MD -MP -MF $(DEPDIR)/l7snmpagent-l7ag_socket.Tpo -c -o l7snmpagent-l7ag_socket.obj `if test -f 'l7ag_socket.cpp'; then $(CYGPATH_W) 'l7ag_socket.cpp'; else $(CYGPATH_W) '$(srcdir)/l7ag_socket.cpp'; fi`
+@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/l7snmpagent-l7ag_socket.Tpo $(DEPDIR)/l7snmpagent-l7ag_socket.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='l7ag_socket.cpp' object='l7snmpagent-l7ag_socket.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(l7snmpagent_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o l7snmpagent-l7ag_socket.obj `if test -f 'l7ag_socket.cpp'; then $(CYGPATH_W) 'l7ag_socket.cpp'; else $(CYGPATH_W) '$(srcdir)/l7ag_socket.cpp'; fi`
+
+l7snmpagent-interproccom.o: interproccom.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(l7snmpagent_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT l7snmpagent-interproccom.o -MD -MP -MF $(DEPDIR)/l7snmpagent-interproccom.Tpo -c -o l7snmpagent-interproccom.o `test -f 'interproccom.cpp' || echo '$(srcdir)/'`interproccom.cpp
+@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/l7snmpagent-interproccom.Tpo $(DEPDIR)/l7snmpagent-interproccom.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='interproccom.cpp' object='l7snmpagent-interproccom.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(l7snmpagent_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o l7snmpagent-interproccom.o `test -f 'interproccom.cpp' || echo '$(srcdir)/'`interproccom.cpp
+
+l7snmpagent-interproccom.obj: interproccom.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(l7snmpagent_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT l7snmpagent-interproccom.obj -MD -MP -MF $(DEPDIR)/l7snmpagent-interproccom.Tpo -c -o l7snmpagent-interproccom.obj `if test -f 'interproccom.cpp'; then $(CYGPATH_W) 'interproccom.cpp'; else $(CYGPATH_W) '$(srcdir)/interproccom.cpp'; fi`
+@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/l7snmpagent-interproccom.Tpo $(DEPDIR)/l7snmpagent-interproccom.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='interproccom.cpp' object='l7snmpagent-interproccom.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(l7snmpagent_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o l7snmpagent-interproccom.obj `if test -f 'interproccom.cpp'; then $(CYGPATH_W) 'interproccom.cpp'; else $(CYGPATH_W) '$(srcdir)/interproccom.cpp'; fi`
+
+l7snmpagent-proc_mibcollectmessage.o: proc_mibcollectmessage.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(l7snmpagent_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT l7snmpagent-proc_mibcollectmessage.o -MD -MP -MF $(DEPDIR)/l7snmpagent-proc_mibcollectmessage.Tpo -c -o l7snmpagent-proc_mibcollectmessage.o `test -f 'proc_mibcollectmessage.cpp' || echo '$(srcdir)/'`proc_mibcollectmessage.cpp
+@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/l7snmpagent-proc_mibcollectmessage.Tpo $(DEPDIR)/l7snmpagent-proc_mibcollectmessage.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='proc_mibcollectmessage.cpp' object='l7snmpagent-proc_mibcollectmessage.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(l7snmpagent_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o l7snmpagent-proc_mibcollectmessage.o `test -f 'proc_mibcollectmessage.cpp' || echo '$(srcdir)/'`proc_mibcollectmessage.cpp
+
+l7snmpagent-proc_mibcollectmessage.obj: proc_mibcollectmessage.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(l7snmpagent_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT l7snmpagent-proc_mibcollectmessage.obj -MD -MP -MF $(DEPDIR)/l7snmpagent-proc_mibcollectmessage.Tpo -c -o l7snmpagent-proc_mibcollectmessage.obj `if test -f 'proc_mibcollectmessage.cpp'; then $(CYGPATH_W) 'proc_mibcollectmessage.cpp'; else $(CYGPATH_W) '$(srcdir)/proc_mibcollectmessage.cpp'; fi`
+@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/l7snmpagent-proc_mibcollectmessage.Tpo $(DEPDIR)/l7snmpagent-proc_mibcollectmessage.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='proc_mibcollectmessage.cpp' object='l7snmpagent-proc_mibcollectmessage.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(l7snmpagent_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o l7snmpagent-proc_mibcollectmessage.obj `if test -f 'proc_mibcollectmessage.cpp'; then $(CYGPATH_W) 'proc_mibcollectmessage.cpp'; else $(CYGPATH_W) '$(srcdir)/proc_mibcollectmessage.cpp'; fi`
+
+l7snmpagent-proc_settingrequest.o: proc_settingrequest.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(l7snmpagent_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT l7snmpagent-proc_settingrequest.o -MD -MP -MF $(DEPDIR)/l7snmpagent-proc_settingrequest.Tpo -c -o l7snmpagent-proc_settingrequest.o `test -f 'proc_settingrequest.cpp' || echo '$(srcdir)/'`proc_settingrequest.cpp
+@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/l7snmpagent-proc_settingrequest.Tpo $(DEPDIR)/l7snmpagent-proc_settingrequest.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='proc_settingrequest.cpp' object='l7snmpagent-proc_settingrequest.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(l7snmpagent_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o l7snmpagent-proc_settingrequest.o `test -f 'proc_settingrequest.cpp' || echo '$(srcdir)/'`proc_settingrequest.cpp
+
+l7snmpagent-proc_settingrequest.obj: proc_settingrequest.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(l7snmpagent_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT l7snmpagent-proc_settingrequest.obj -MD -MP -MF $(DEPDIR)/l7snmpagent-proc_settingrequest.Tpo -c -o l7snmpagent-proc_settingrequest.obj `if test -f 'proc_settingrequest.cpp'; then $(CYGPATH_W) 'proc_settingrequest.cpp'; else $(CYGPATH_W) '$(srcdir)/proc_settingrequest.cpp'; fi`
+@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/l7snmpagent-proc_settingrequest.Tpo $(DEPDIR)/l7snmpagent-proc_settingrequest.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='proc_settingrequest.cpp' object='l7snmpagent-proc_settingrequest.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(l7snmpagent_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o l7snmpagent-proc_settingrequest.obj `if test -f 'proc_settingrequest.cpp'; then $(CYGPATH_W) 'proc_settingrequest.cpp'; else $(CYGPATH_W) '$(srcdir)/proc_settingrequest.cpp'; fi`
+
+l7snmpagent-proc_trapsendrequest.o: proc_trapsendrequest.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(l7snmpagent_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT l7snmpagent-proc_trapsendrequest.o -MD -MP -MF $(DEPDIR)/l7snmpagent-proc_trapsendrequest.Tpo -c -o l7snmpagent-proc_trapsendrequest.o `test -f 'proc_trapsendrequest.cpp' || echo '$(srcdir)/'`proc_trapsendrequest.cpp
+@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/l7snmpagent-proc_trapsendrequest.Tpo $(DEPDIR)/l7snmpagent-proc_trapsendrequest.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='proc_trapsendrequest.cpp' object='l7snmpagent-proc_trapsendrequest.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(l7snmpagent_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o l7snmpagent-proc_trapsendrequest.o `test -f 'proc_trapsendrequest.cpp' || echo '$(srcdir)/'`proc_trapsendrequest.cpp
+
+l7snmpagent-proc_trapsendrequest.obj: proc_trapsendrequest.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(l7snmpagent_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT l7snmpagent-proc_trapsendrequest.obj -MD -MP -MF $(DEPDIR)/l7snmpagent-proc_trapsendrequest.Tpo -c -o l7snmpagent-proc_trapsendrequest.obj `if test -f 'proc_trapsendrequest.cpp'; then $(CYGPATH_W) 'proc_trapsendrequest.cpp'; else $(CYGPATH_W) '$(srcdir)/proc_trapsendrequest.cpp'; fi`
+@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/l7snmpagent-proc_trapsendrequest.Tpo $(DEPDIR)/l7snmpagent-proc_trapsendrequest.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='proc_trapsendrequest.cpp' object='l7snmpagent-proc_trapsendrequest.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(l7snmpagent_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o l7snmpagent-proc_trapsendrequest.obj `if test -f 'proc_trapsendrequest.cpp'; then $(CYGPATH_W) 'proc_trapsendrequest.cpp'; else $(CYGPATH_W) '$(srcdir)/proc_trapsendrequest.cpp'; fi`
+
+l7snmpagent-queue_sendtrap.o: queue_sendtrap.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(l7snmpagent_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT l7snmpagent-queue_sendtrap.o -MD -MP -MF $(DEPDIR)/l7snmpagent-queue_sendtrap.Tpo -c -o l7snmpagent-queue_sendtrap.o `test -f 'queue_sendtrap.cpp' || echo '$(srcdir)/'`queue_sendtrap.cpp
+@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/l7snmpagent-queue_sendtrap.Tpo $(DEPDIR)/l7snmpagent-queue_sendtrap.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='queue_sendtrap.cpp' object='l7snmpagent-queue_sendtrap.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(l7snmpagent_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o l7snmpagent-queue_sendtrap.o `test -f 'queue_sendtrap.cpp' || echo '$(srcdir)/'`queue_sendtrap.cpp
+
+l7snmpagent-queue_sendtrap.obj: queue_sendtrap.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(l7snmpagent_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT l7snmpagent-queue_sendtrap.obj -MD -MP -MF $(DEPDIR)/l7snmpagent-queue_sendtrap.Tpo -c -o l7snmpagent-queue_sendtrap.obj `if test -f 'queue_sendtrap.cpp'; then $(CYGPATH_W) 'queue_sendtrap.cpp'; else $(CYGPATH_W) '$(srcdir)/queue_sendtrap.cpp'; fi`
+@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/l7snmpagent-queue_sendtrap.Tpo $(DEPDIR)/l7snmpagent-queue_sendtrap.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='queue_sendtrap.cpp' object='l7snmpagent-queue_sendtrap.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(l7snmpagent_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o l7snmpagent-queue_sendtrap.obj `if test -f 'queue_sendtrap.cpp'; then $(CYGPATH_W) 'queue_sendtrap.cpp'; else $(CYGPATH_W) '$(srcdir)/queue_sendtrap.cpp'; fi`
+
+l7snmpagent-store_mibdata.o: store_mibdata.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(l7snmpagent_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT l7snmpagent-store_mibdata.o -MD -MP -MF $(DEPDIR)/l7snmpagent-store_mibdata.Tpo -c -o l7snmpagent-store_mibdata.o `test -f 'store_mibdata.cpp' || echo '$(srcdir)/'`store_mibdata.cpp
+@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/l7snmpagent-store_mibdata.Tpo $(DEPDIR)/l7snmpagent-store_mibdata.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='store_mibdata.cpp' object='l7snmpagent-store_mibdata.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(l7snmpagent_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o l7snmpagent-store_mibdata.o `test -f 'store_mibdata.cpp' || echo '$(srcdir)/'`store_mibdata.cpp
+
+l7snmpagent-store_mibdata.obj: store_mibdata.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(l7snmpagent_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT l7snmpagent-store_mibdata.obj -MD -MP -MF $(DEPDIR)/l7snmpagent-store_mibdata.Tpo -c -o l7snmpagent-store_mibdata.obj `if test -f 'store_mibdata.cpp'; then $(CYGPATH_W) 'store_mibdata.cpp'; else $(CYGPATH_W) '$(srcdir)/store_mibdata.cpp'; fi`
+@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/l7snmpagent-store_mibdata.Tpo $(DEPDIR)/l7snmpagent-store_mibdata.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='store_mibdata.cpp' object='l7snmpagent-store_mibdata.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(l7snmpagent_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o l7snmpagent-store_mibdata.obj `if test -f 'store_mibdata.cpp'; then $(CYGPATH_W) 'store_mibdata.cpp'; else $(CYGPATH_W) '$(srcdir)/store_mibdata.cpp'; fi`
+
+l7snmpagent-subagent.o: subagent.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(l7snmpagent_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT l7snmpagent-subagent.o -MD -MP -MF $(DEPDIR)/l7snmpagent-subagent.Tpo -c -o l7snmpagent-subagent.o `test -f 'subagent.cpp' || echo '$(srcdir)/'`subagent.cpp
+@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/l7snmpagent-subagent.Tpo $(DEPDIR)/l7snmpagent-subagent.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='subagent.cpp' object='l7snmpagent-subagent.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(l7snmpagent_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o l7snmpagent-subagent.o `test -f 'subagent.cpp' || echo '$(srcdir)/'`subagent.cpp
+
+l7snmpagent-subagent.obj: subagent.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(l7snmpagent_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT l7snmpagent-subagent.obj -MD -MP -MF $(DEPDIR)/l7snmpagent-subagent.Tpo -c -o l7snmpagent-subagent.obj `if test -f 'subagent.cpp'; then $(CYGPATH_W) 'subagent.cpp'; else $(CYGPATH_W) '$(srcdir)/subagent.cpp'; fi`
+@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/l7snmpagent-subagent.Tpo $(DEPDIR)/l7snmpagent-subagent.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='subagent.cpp' object='l7snmpagent-subagent.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(l7snmpagent_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o l7snmpagent-subagent.obj `if test -f 'subagent.cpp'; then $(CYGPATH_W) 'subagent.cpp'; else $(CYGPATH_W) '$(srcdir)/subagent.cpp'; fi`
+
+l7snmpagent-watch_l7vsd.o: watch_l7vsd.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(l7snmpagent_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT l7snmpagent-watch_l7vsd.o -MD -MP -MF $(DEPDIR)/l7snmpagent-watch_l7vsd.Tpo -c -o l7snmpagent-watch_l7vsd.o `test -f 'watch_l7vsd.cpp' || echo '$(srcdir)/'`watch_l7vsd.cpp
+@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/l7snmpagent-watch_l7vsd.Tpo $(DEPDIR)/l7snmpagent-watch_l7vsd.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='watch_l7vsd.cpp' object='l7snmpagent-watch_l7vsd.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(l7snmpagent_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o l7snmpagent-watch_l7vsd.o `test -f 'watch_l7vsd.cpp' || echo '$(srcdir)/'`watch_l7vsd.cpp
+
+l7snmpagent-watch_l7vsd.obj: watch_l7vsd.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(l7snmpagent_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT l7snmpagent-watch_l7vsd.obj -MD -MP -MF $(DEPDIR)/l7snmpagent-watch_l7vsd.Tpo -c -o l7snmpagent-watch_l7vsd.obj `if test -f 'watch_l7vsd.cpp'; then $(CYGPATH_W) 'watch_l7vsd.cpp'; else $(CYGPATH_W) '$(srcdir)/watch_l7vsd.cpp'; fi`
+@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/l7snmpagent-watch_l7vsd.Tpo $(DEPDIR)/l7snmpagent-watch_l7vsd.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='watch_l7vsd.cpp' object='l7snmpagent-watch_l7vsd.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(l7snmpagent_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o l7snmpagent-watch_l7vsd.obj `if test -f 'watch_l7vsd.cpp'; then $(CYGPATH_W) 'watch_l7vsd.cpp'; else $(CYGPATH_W) '$(srcdir)/watch_l7vsd.cpp'; fi`
+
+l7snmpagent-l7snmpagent.o: l7snmpagent.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(l7snmpagent_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT l7snmpagent-l7snmpagent.o -MD -MP -MF $(DEPDIR)/l7snmpagent-l7snmpagent.Tpo -c -o l7snmpagent-l7snmpagent.o `test -f 'l7snmpagent.cpp' || echo '$(srcdir)/'`l7snmpagent.cpp
+@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/l7snmpagent-l7snmpagent.Tpo $(DEPDIR)/l7snmpagent-l7snmpagent.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='l7snmpagent.cpp' object='l7snmpagent-l7snmpagent.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(l7snmpagent_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o l7snmpagent-l7snmpagent.o `test -f 'l7snmpagent.cpp' || echo '$(srcdir)/'`l7snmpagent.cpp
+
+l7snmpagent-l7snmpagent.obj: l7snmpagent.cpp
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(l7snmpagent_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT l7snmpagent-l7snmpagent.obj -MD -MP -MF $(DEPDIR)/l7snmpagent-l7snmpagent.Tpo -c -o l7snmpagent-l7snmpagent.obj `if test -f 'l7snmpagent.cpp'; then $(CYGPATH_W) 'l7snmpagent.cpp'; else $(CYGPATH_W) '$(srcdir)/l7snmpagent.cpp'; fi`
+@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/l7snmpagent-l7snmpagent.Tpo $(DEPDIR)/l7snmpagent-l7snmpagent.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='l7snmpagent.cpp' object='l7snmpagent-l7snmpagent.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(l7snmpagent_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o l7snmpagent-l7snmpagent.obj `if test -f 'l7snmpagent.cpp'; then $(CYGPATH_W) 'l7snmpagent.cpp'; else $(CYGPATH_W) '$(srcdir)/l7snmpagent.cpp'; fi`
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(PROGRAMS)
+installdirs:
+ for dir in "$(DESTDIR)$(bindir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-binPROGRAMS clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-exec-am: install-binPROGRAMS
+
+install-html: install-html-am
+
+install-info: install-info-am
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-binPROGRAMS
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
+ clean-generic clean-libtool ctags distclean distclean-compile \
+ distclean-generic distclean-libtool distclean-tags distdir dvi \
+ dvi-am html html-am info info-am install install-am \
+ install-binPROGRAMS install-data install-data-am install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am install-man \
+ install-pdf install-pdf-am install-ps install-ps-am \
+ install-strip installcheck installcheck-am installdirs \
+ maintainer-clean maintainer-clean-generic mostlyclean \
+ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
+ pdf pdf-am ps ps-am tags uninstall uninstall-am \
+ uninstall-binPROGRAMS
+
+# 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:
--- /dev/null
+UML7-MIB DEFINITIONS ::= BEGIN
+IMPORTS
+ OBJECT-TYPE, MODULE-IDENTITY, enterprises FROM SNMPv2-SMI
+
+ TEXTUAL-CONVENTION, DisplayString FROM SNMPv2-TC;
+
+UltraMonkeyL7 MODULE-IDENTITY
+ LAST-UPDATED "200801150000Z"
+ ORGANIZATION "UltraMonkey-L7"
+ CONTACT-INFO "email: ultramonkey-l7-users@lists.sourceforge.jp"
+ DESCRIPTION "Defines the MIBs that would be used for L7VS SNMP and for process monitoring of UltraMonkey-L7."
+ ::= { enterprises 60000 }
+
+l7vsd MODULE-IDENTITY
+ LAST-UPDATED "200801020000Z"
+ ORGANIZATION "L7VS"
+ CONTACT-INFO "Email: ultramonkey-l7-users@lists.sourceforge.jp"
+ DESCRIPTION "L7VS MIB"
+ ::= { UltraMonkeyL7 1 }
+
+l7vsTraps OBJECT IDENTIFIER ::= { l7vsd 0 }
+l7vsInfo OBJECT IDENTIFIER ::= { l7vsd 1 }
+
+l7vsError NOTIFICATION-TYPE
+ SYNTAX DisplayString
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "L7VS Error Status"
+ ::= { l7vsTraps 1 }
+
+
+NumberVS OBJECT-TYPE
+ SYNTAX INTEGER
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "This value is number of VirtualService."
+ ::= { l7vsInfo 1 }
+
+TableVS OBJECT-TYPE
+ SYNTAX SEQUENCE OF ENTRYVS
+ MAX-ACCESS not-accessible
+ STATUS current
+ ::= { l7vsInfo 2 }
+
+EntryVS OBJECT-TYPE
+ SYNTAX ENTRYVS
+ MAX-ACCESS not-accessible
+ STATUS current
+ INDEX { IndexVS }
+ ::= { TableVS 1 }
+
+ENTRYVS ::= SEQUENCE {
+ IndexVS INTEGER(0..500)
+ Addr DisplayString
+ Port INTEGER(0..70000)
+ ScheduleModuleName DisplayString
+}
+
+IndexVS OBJECT-TYPE
+ SYNTAX INTEGER(0..500)
+ MAX-ACCESS read-only
+ STATUS current
+ ::= { EntryVS 1 }
+
+Addr OBJECT-TYPE
+ SYNTAX DisplayString
+ MAX-ACCESS read-only
+ STATUS current
+ ::= { EntryVS 2 }
+
+Port OBJECT-TYPE
+ SYNTAX INTEGER(0..70000)
+ MAX-ACCESS read-only
+ STATUS current
+ ::= { EntryVS 3 }
+
+ScheduleModuleName OBJECT-TYPE
+ SYNTAX DisplayString
+ MAX-ACCESS read-only
+ STATUS current
+ ::= { EntryVS 4 }
+
+END
--- /dev/null
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * : mib2c.notify.conf,v 5.3 2004/04/15 12:29:19 dts12 Exp $
+ */
+
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include "UltraMonkeyL7.h"
+
+static oid snmptrap_oid[] = { 1, 3, 6, 1, 6, 3, 1, 1, 4, 1, 0 };
+
+int
+send_l7vsError_trap(void)
+{
+ netsnmp_variable_list *var_list = NULL;
+ oid l7vsError_oid[] = { 1, 3, 6, 1, 4, 1, 60000, 1, 0, 1 };
+
+ /*
+ * Set the snmpTrapOid.0 value
+ */
+ snmp_varlist_add_variable(&var_list,
+ snmptrap_oid, OID_LENGTH(snmptrap_oid),
+ ASN_OBJECT_ID,
+ l7vsError_oid, sizeof(l7vsError_oid));
+
+
+ /*
+ * Add any extra (optional) objects here
+ */
+
+ /*
+ * Send the trap to the list of configured destinations
+ * and clean up
+ */
+ send_v2trap(var_list);
+ snmp_free_varbind(var_list);
+
+ return SNMP_ERR_NOERROR;
+}
--- /dev/null
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * : mib2c.notify.conf,v 5.3 2004/04/15 12:29:19 dts12 Exp $
+ */
+#ifndef ULTRAMONKEYL7_H
+#define ULTRAMONKEYL7_H
+
+/*
+ * function declarations
+ */
+int send_l7vsError_trap(void);
+
+#endif /* ULTRAMONKEYL7_H */
--- /dev/null
+
+#include "dispatch_message.h"
+
+
+l7ag_dispatch_message::l7ag_dispatch_message()
+{
+
+
+}
+
+
+l7ag_dispatch_message::~l7ag_dispatch_message()
+{
+
+
+}
+
+
+void l7ag_dispatch_message::add_message( std::string in_msg )
+{
+
+
+}
+
+
+void l7ag_dispatch_message::do_dispatch()
+{
+
+
+}
+
--- /dev/null
+#ifndef __L7AG_DISPATCH_MESSAGE_H__
+#define __L7AG_DISPATCH_MESSAGE_H__
+
+#include <string>
+
+#include "proc_mibcollectmessage.h"
+#include "proc_trapsendrequest.h"
+#include "proc_settingrequest.h"
+
+
+class l7ag_dispatch_message
+{
+ protected:
+
+ private:
+ std::string message;
+ public:
+ l7ag_dispatch_message();
+ ~l7ag_dispatch_message();
+
+ void add_message( std::string in_msg );
+ void do_dispatch();
+};
+
+#endif //__L7AG_DISPATCH_MESSAGE_H__
--- /dev/null
+
+#include "interproccom.h"
+#include "subagent.h"
+
+
+#define SCOPED_LOCK(m) \
+ pthread_mutex_lock(&m); /* エラー処理は略 */ \
+ void u_(pthread_mutex_t** m_) { pthread_mutex_unlock(*m_); } \
+ __attribute__((__cleanup__(u_))) pthread_mutex_t* scoped_lock_ = &m
+
+
+/*!
+ *
+ */
+l7ag_interproccommunicate::l7ag_interproccommunicate()
+{
+ status = STOP;
+ stop_flag = false;
+
+ pthread_mutex_init( &mutex_sbuf, NULL );
+ pthread_mutex_init( &mutex_rbuf, NULL );
+}
+
+
+/*!
+ *
+ */
+l7ag_interproccommunicate::l7ag_interproccommunicate( l7ag_subagent * p_subagent )
+{
+ status = STOP;
+ stop_flag = false;
+
+ pthread_mutex_init( &mutex_sbuf, NULL );
+ pthread_mutex_init( &mutex_rbuf, NULL );
+
+ set_parent( p_subagent );
+}
+
+
+/*!
+ *
+ */
+l7ag_interproccommunicate::~l7ag_interproccommunicate()
+{
+
+
+}
+
+
+/*!
+ *
+ */
+void
+l7ag_interproccommunicate::start_thread()
+{
+
+
+}
+
+
+/*!
+ *
+ */
+void
+l7ag_interproccommunicate::send_mibdatacollect( std::string oid )
+{
+ //make request message
+
+}
+
+
+/*!
+ *
+ */
+void
+l7ag_interproccommunicate::set_parent( l7ag_subagent * p_subagent )
+{
+ parent = p_subagent;
+}
+
+
+/*!
+ *
+ */
+void *
+l7ag_interproccommunicate::do_communicate( void * args )
+{
+ l7ag_interproccommunicate* proccom = (l7ag_interproccommunicate*)args;
+ //initialize
+
+ while(1){
+ //recv
+ //send
+ //stop
+ if( proccom->getStopFlag() ){
+ //
+ }
+ }
+ //finalize
+}
+
+
+/*!
+ *
+ */
+void
+l7ag_interproccommunicate::setRequestMessage()
+{
+}
+
--- /dev/null
+#ifndef __INTERPROCCOM_H__
+#define __INTERPROCCOM_H__
+
+#include <string>
+#include <pthread.h>
+
+#include "l7ag_socket.h"
+#include "tag_threadstat.h"
+#include "dispatch_message.h"
+#include "store_mibdata.h"
+
+class l7ag_subagent;
+
+class l7ag_interproccommunicate : public l7ag_socket
+{
+private:
+ l7ag_subagent * parent;
+ THREAD_STAT_TAG status;
+ bool stop_flag;
+
+ pthread_mutex_t mutex_sbuf;
+ pthread_mutex_t mutex_rbuf;
+ char * buffer_send;
+ char * buffer_recv;
+
+protected:
+ l7ag_interproccommunicate();
+
+ static void * do_communicate( void * args );
+
+public:
+ l7ag_interproccommunicate( l7ag_subagent * p_subagent );
+ ~l7ag_interproccommunicate();
+
+ void set_parent( l7ag_subagent * p_subagent );
+
+ void start_thread();
+ void stop_thread(){stop_flag=true;}
+
+ void send_mibdatacollect( std::string oid );
+ bool getStopFlag(){return stop_flag;}
+ void setRequestMessage();
+};
+
+#endif //__INTERPROCCOM_H__
+
--- /dev/null
+#ifndef __L7AG_PARAMETER_H__
+#define __L7AG_PARAMETER_H__
+
+#include <string>
+#include <map>
+
+struct l7ag_parameter{
+ std::string nic;
+ std::string address;
+ int portno;
+ int interval;
+ int status;
+ std::map<LOG_CATEGORY_TAG,LOG_LEVEL_TAG> loglevel;
+};
+
+#endif //__L7AG_PARAMETER_H__
+
--- /dev/null
+#include "l7ag_socket.h"
+
+
+/*!
+ *
+ */
+void l7ag_socket::connect()
+{
+ //socket
+ //connect
+}
+
+/*!
+ *
+ */
+void l7ag_socket::disconnect()
+{
+ //close
+}
+
+/*!
+ *
+ */
+void l7ag_socket::send()
+{
+ //send
+}
+
+/*!
+ *
+ */
+void l7ag_socket::recv()
+{
+ //recv
+}
+
+
--- /dev/null
+#ifndef __L7AG_SOCKET_H__
+#define __L7AG_SOCKET_H__
+
+class l7ag_socket
+{
+ private:
+ int sockfd;
+ public:
+ l7ag_socket(){};
+ virtual ~l7ag_socket(){};
+
+ void connect();
+ void disconnect();
+ void send();
+ void recv();
+};
+
+#endif //__L7AG_SOCKET_H__
--- /dev/null
+#include <signal.h>
+
+#include "logger_wrapper.h"
+#include "parameter_wrapper.h"
+
+using namespace l7vs;
+
+Logger Logger::instance;
+Parameter Parameter::instance;
+
+/*!
+ *
+ */
+static void
+handler_sig_exit(int sig)
+{
+}
+
+/*!
+ * setup signal handler
+ */
+static int
+set_sighandler(int sig, void (*handler)(int))
+{
+ struct sigaction act;
+ int ret;
+
+ ret = sigaction(sig, NULL, &act);
+ if (ret < 0) {
+ return ret;
+ }
+ act.sa_flags &= ~SA_RESETHAND;
+ act.sa_handler = handler;
+ ret = sigaction(sig, &act, NULL);
+ if (ret < 0) {
+ return ret;
+ }
+ return 0;
+}
+
+/*!
+ *esetup all signal handlers
+ */
+static int
+set_sighandlers()
+{
+ //debug log out
+ if( LOG_LV_DEBUG == logger_get_log_level( LOG_CAT_SNMPAGENT_START_STOP ) ){
+ char debugstr[DEBUG_STR_LEN];
+ sprintf( debugstr, "in_function set_sighandler()" );
+ LOGGER_PUT_LOG_DEBUG( LOG_CAT_SNMPAGENT_START_STOP,1, debugstr );
+ }
+
+ int ret;
+
+#define SET_SIGHANDLER(sig, handler) \
+ do { \
+ ret = set_sighandler((sig), (handler)); \
+ if (ret < 0) { \
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_PROGRAM)) { \
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_PROGRAM, 0, \
+ "out_function: static int set_sighandlers(void) " \
+ "return_value: %d", \
+ ret); \
+ } \
+ return ret; \
+ } \
+ } while (0)
+
+ SET_SIGHANDLER( SIGHUP, handler_sig_exit );
+ SET_SIGHANDLER( SIGINT, handler_sig_exit );
+ SET_SIGHANDLER( SIGQUIT, handler_sig_exit );
+ SET_SIGHANDLER( SIGTERM, handler_sig_exit );
+ SET_SIGHANDLER( SIGUSR1, SIG_IGN );
+ SET_SIGHANDLER( SIGUSR2, SIG_IGN );
+ SET_SIGHANDLER( SIGALRM, SIG_IGN );
+ SET_SIGHANDLER( SIGCHLD, SIG_IGN );
+
+#undef SET_SIGHANDLER
+
+ //debug log out
+ if( LOG_LV_DEBUG == logger_get_log_level( LOG_CAT_SNMPAGENT_START_STOP ) ){
+ char debugstr[DEBUG_STR_LEN];
+ sprintf( debugstr, "out_function set_sighandler()" );
+ LOGGER_PUT_LOG_DEBUG( LOG_CAT_SNMPAGENT_START_STOP,2, debugstr );
+ }
+}
+
+/*!
+ * l7snmpagent main
+ * @param[in] argc number of argument
+ * @param[in] argv array of argument
+ */
+int main( int argc, char * argv[] )
+{
+ LOGGER_PUT_LOG_INFO( LOG_CAT_SNMPAGENT_START_STOP,1, "start l7snmpagent" );
+ //debug log out
+ if( LOG_LV_DEBUG == logger_get_log_level( LOG_CAT_SNMPAGENT_START_STOP ) ){
+ char debugstr[DEBUG_STR_LEN];
+ LOGGER_PUT_LOG_DEBUG( LOG_CAT_SNMPAGENT_START_STOP,3, debugstr );
+ }
+
+ set_sighandlers();
+
+ LOGGER_PUT_LOG_INFO( LOG_CAT_SNMPAGENT_START_STOP,2, "stop l7snmpagent" );
+}
+
+
--- /dev/null
+#ifndef __PROC_MESSAGE_H__\r
+#define __PROC_MESSAGE_H__\r
+\r
+\r
+class proc_message\r
+{\r
+private:\r
+ \r
+public:\r
+ proc_message(){};\r
+ virtual ~proc_message(){};\r
+ \r
+ virtual void do_process() = 0;\r
+};\r
+\r
+\r
+#endif //__PROC_MESSAGE_H__\r
--- /dev/null
+
+#include "proc_mibcollectmessage.h"
+
+
+proc_mibcollectmessage::proc_mibcollectmessage()
+{
+
+
+}
+
+
+proc_mibcollectmessage::~proc_mibcollectmessage()
+{
+
+
+}
+
+
+void proc_mibcollectmessage::do_process()
+{
+
+
+}
+
--- /dev/null
+#ifndef __PROC_MIBCOLLECTMESSAGE_H__\r
+#define __PROC_MIBCOLLECTMESSAGE_H__\r
+\r
+#include "proc_message.h"\r
+\r
+class proc_mibcollectmessage : public proc_message\r
+{\r
+private:\r
+ \r
+public:\r
+ proc_mibcollectmessage();\r
+ ~proc_mibcollectmessage();\r
+ \r
+ void do_process();\r
+};\r
+\r
+#endif //__PROC_MIBCOLLECTMESSAGE_H__\r
--- /dev/null
+
+#include "proc_settingrequest.h"
+
+
+proc_settingrequest::proc_settingrequest()
+{
+
+
+}
+
+
+proc_settingrequest::~proc_settingrequest()
+{
+
+
+}
+
+
+void proc_settingrequest::do_process()
+{
+
+
+}
+
--- /dev/null
+#ifndef __PROC_SETTINGREQUEST_H__\r
+#define __PROC_SETTINGREQUEST_H__\r
+\r
+#include "proc_message.h"\r
+\r
+class proc_settingrequest : public proc_message\r
+{\r
+private:\r
+ \r
+public:\r
+ proc_settingrequest();\r
+ ~proc_settingrequest();\r
+ \r
+ void do_process();\r
+};\r
+\r
+#endif //__PROC_SETTINGREQUEST_H__\r
+\r
--- /dev/null
+
+#include "proc_trapsendrequest.h"
+
+
+proc_trapsendrequest::proc_trapsendrequest()
+{
+
+
+}
+
+
+proc_trapsendrequest::~proc_trapsendrequest()
+{
+
+
+}
+
+
+void proc_trapsendrequest::do_process()
+{
+
+
+}
+
--- /dev/null
+#ifndef __PROC_TRAPSENDREQUEST_H__\r
+#define __PROC_TRAPSENDREQUEST_H__\r
+\r
+#include "proc_message.h"\r
+\r
+class proc_trapsendrequest : public proc_message\r
+{\r
+private:\r
+ \r
+public:\r
+ proc_trapsendrequest();\r
+ ~proc_trapsendrequest();\r
+ \r
+ void do_process();\r
+};\r
+\r
+#endif //__PROC_TRAPSENDREQUEST_H__\r
--- /dev/null
+
+#include "queue_sendtrap.h"
+
+
+l7ag_queuesendtrap::l7ag_queuesendtrap()
+{
+
+
+
+}
+
+
+l7ag_queuesendtrap::~l7ag_queuesendtrap()
+{
+
+
+}
+
+
+void l7ag_queuesendtrap::get_queuedata()
+{
+
+
+}
+
+
+void l7ag_queuesendtrap::make_queuedata( std::string oid, std::string trapmessage )
+{
+
+
+}
+
+
+void l7ag_queuesendtrap::set_queuedata()
+{
+
+
+}
+
--- /dev/null
+#ifndef __QUEUE_SENDTRAP_H__
+#define __QUEUE_SENDTRAP_H__
+
+#include <string>
+
+class l7ag_queuesendtrap
+{
+private:
+ void set_queuedata();
+
+public:
+ l7ag_queuesendtrap();
+ ~l7ag_queuesendtrap();
+
+ void get_queuedata();
+ void make_queuedata( std::string oid, std::string trapmessage );
+};
+
+#endif //__QUEUE_SENDTRAP_H__
--- /dev/null
+
+#include "store_mibdata.h"
+
+
+l7ag_store_mibdata::l7ag_store_mibdata()
+{
+
+
+}
+
+
+l7ag_store_mibdata::~l7ag_store_mibdata()
+{
+
+
+}
+
+
+std::string l7ag_store_mibdata::get_mibdata( std::string oid )
+{
+ std::string retstr;
+
+
+
+ return retstr;
+}
+
+
+void l7ag_store_mibdata::set_mibdata( std::string oid, std::string value )
+{
+
+
+}
+
--- /dev/null
+#ifndef __STORE_MIBDATA_H__
+#define __STORE_MIBDATA_H__
+
+#include <string>
+
+class l7ag_store_mibdata
+{
+ protected:
+
+ private:
+
+ public:
+ l7ag_store_mibdata();
+ ~l7ag_store_mibdata();
+
+ std::string get_mibdata( std::string oid );
+
+ void set_mibdata( std::string oid, std::string value );
+};
+
+#endif //__STORE_MIBDATA_H__
--- /dev/null
+#include "subagent.h"
+
+/*!
+ * l7ag_subagent class constructor
+ */
+l7ag_subagent::l7ag_subagent()
+{
+ stop_flag = false;
+ stat = STOP;
+}
+
+/*!
+ * main loop
+ */
+void
+l7ag_subagent::do_subagent()
+{
+ //initialize
+
+ //loop
+ while(1){
+ if( stop_flag ){
+ break;
+ }
+ }
+
+ //finalize
+}
+
+/*!
+ * stop main loop
+ */
+void
+l7ag_subagent::stop_subagent()
+{
+ stop_flag = true;
+}
+
--- /dev/null
+#ifndef __SUBAGENT_H__
+#define __SUBAGENT_H__
+
+//#include <pthread.h>
+
+#include "UltraMonkeyL7.h"
+#include "tag_threadstat.h"
+#include "store_mibdata.h"
+#include "queue_sendtrap.h"
+#include "interproccom.h"
+#include "watch_l7vsd.h"
+
+class l7ag_subagent
+{
+private:
+ bool stop_flag;
+ THREAD_STAT_TAG stat;
+
+ l7ag_store_mibdata mibdata;
+ l7ag_queuesendtrap trapqueue;
+
+ l7ag_interproccommunicate * communicator;
+
+ l7ag_watch_l7vsd * watchdog;
+
+// pthread_t t_ipc;
+// pthread_t t_watcher;
+
+public:
+ l7ag_subagent();
+ ~l7ag_subagent();
+
+ void do_subagent();
+ void stop_subagent();
+
+};
+
+#endif //__SUBAGENT_H__
--- /dev/null
+#ifndef __THREADSTAT_TAG_H__
+#define __THREADSTAT_TAG_H__
+
+enum THREAD_STAT_TAG { STOP, INITIALIZING, RUNNING, FINALIZING };
+
+#endif //__THREADSTAT_TAG_H__
--- /dev/null
+#ifndef __TRAPID_TAG_H__
+#define __TRAPID_TAG_H__
+
+enum TRAPID_TAG { id_error };
+
+#endif //__TRAPID_TAG_H__
--- /dev/null
+
+#include "watch_l7vsd.h"
+
+/*!
+ *
+ */
+l7ag_watch_l7vsd::l7ag_watch_l7vsd()
+{
+
+
+}
+
+/*!
+ *
+ */
+l7ag_watch_l7vsd::l7ag_watch_l7vsd( l7ag_queuesendtrap * p_queueclass )
+{
+ set_TrapQueueClass( p_queueclass );
+}
+
+/*!
+ *
+ */
+l7ag_watch_l7vsd::~l7ag_watch_l7vsd()
+{
+
+
+}
+
+/*!
+ *
+ */
+void l7ag_watch_l7vsd::start_thread()
+{
+
+
+}
+
+/*!
+ *
+ */
+void l7ag_watch_l7vsd::stop_thread()
+{
+
+
+}
+
+/*!
+ *
+ */
+THREAD_STAT_TAG l7ag_watch_l7vsd::get_threadstatus()
+{
+
+
+}
+
+/*!
+ *
+ */
+void * l7ag_watch_l7vsd::watch( void * args )
+{
+
+
+}
+
--- /dev/null
+#ifndef __WATCH_L7VSD_H__
+#define __WATCH_L7VSD_H__
+
+#include <string>
+#include "tag_threadstat.h"
+
+class l7ag_queuesendtrap;
+class l7ag_watch_l7vsd
+{
+private:
+ l7ag_queuesendtrap * queueclass;
+
+protected:
+ l7ag_watch_l7vsd();
+
+ static void * watch( void * args );
+
+public:
+ l7ag_watch_l7vsd( l7ag_queuesendtrap * p_queueclass );
+ ~l7ag_watch_l7vsd();
+
+ void set_TrapQueueClass( l7ag_queuesendtrap * p_queueclass ){ queueclass = p_queueclass; }
+
+ void start_thread();
+ void stop_thread();
+ THREAD_STAT_TAG get_threadstatus();
+};
+
+#endif //__WATCH_L7VSD_H__
--- /dev/null
+sbin_PROGRAMS = l7vsd l7vsadm
+pkglibdir = @l7vs_moddir@
+CONFIG_SOCK_PATH= @l7vsadm_sockdir@
+AUTOMAKE_OPTIONS = foreign
+L7VS_SBINDIR = @sbindir@
+
+l7vsd_CFLAGS = -O2 -g $(GLIB_CFLAGS) -I../include \
+ -I../logger -I../parameter -I../snmpagent \
+ -DL7VS_MODULE_PATH="\"@l7vs_moddir@\"" \
+ -DL7VS_CONFIG_SOCK_PATH="\"$(CONFIG_SOCK_PATH)\"" \
+ -DMAX_SERVICES="@l7vs_maxvs@" \
+ -DLOGGER_PROCESS_VSD \
+ -DVERSION=\"$(VERSION)\"
+
+l7vsd_SOURCES = \
+ ../logger/logger_wrapper.h \
+ ../parameter/parameter_wrapper.h \
+ ../include/l7vs.h \
+ ../include/l7vs_conn.h \
+ ../include/l7vs_iom.h \
+ ../include/l7vs_lsock.h \
+ ../include/l7vs_sched.h \
+ ../include/l7vs_config.h \
+ ../include/l7vs_dest.h \
+ ../include/l7vs_iomuxlist.h \
+ ../include/l7vs_module.h \
+ ../include/l7vs_service.h \
+ ../include/l7vs_replication.h \
+ ../include/l7vs_snmpbridge.h \
+ l7vsd.c \
+ iomux.c \
+ lsock.c \
+ service.c \
+ conn.c \
+ dest.c \
+ config.c \
+ module.c \
+ protomod.c \
+ sched.c \
+ replication.c \
+ snmpbridge.c
+
+l7vsd_LDADD = $(GLIB_LIBS) \
+ ../logger/libl7vsd_logger.a \
+ ../parameter/libl7vsd_parameter.a \
+ -llog4cxx \
+ -lrt
+
+l7vsadm_CFLAGS = -O2 -g $(GLIB_CFLAGS) -I../include \
+ -I../logger -I../parameter -I../snmpagent \
+ -DL7VS_MODULE_PATH="\"@l7vs_moddir@\"" \
+ -DL7VS_CONFIG_SOCK_PATH="\"$(CONFIG_SOCK_PATH)\"" \
+ -DLOGGER_PROCESS_ADM \
+ -DVERSION=\"$(VERSION)\"
+
+l7vsadm_SOURCES = \
+ ../logger/logger_wrapper.h \
+ ../parameter/parameter_wrapper.h \
+ module.c \
+ protomod.c \
+ l7vsadm.c \
+ l7vsadm_main.c
+
+l7vsadm_LDADD = $(GLIB_LIBS) \
+ ../logger/libl7vsadm_logger.a \
+ ../parameter/libl7vsadm_parameter.a \
+ -llog4cxx \
+ -lrt
+
+install:
+ $(INSTALL) -m 755 -d $(CONFIG_SOCK_PATH)
+ $(INSTALL) -m 755 -D \
+ ./l7vsd \
+ ./l7vsadm \
+ $(L7VS_SBINDIR)
--- /dev/null
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+sbin_PROGRAMS = l7vsd$(EXEEXT) l7vsadm$(EXEEXT)
+subdir = src
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+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)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+am__installdirs = "$(DESTDIR)$(sbindir)"
+sbinPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
+PROGRAMS = $(sbin_PROGRAMS)
+am_l7vsadm_OBJECTS = l7vsadm-module.$(OBJEXT) \
+ l7vsadm-protomod.$(OBJEXT) l7vsadm-l7vsadm.$(OBJEXT) \
+ l7vsadm-l7vsadm_main.$(OBJEXT)
+l7vsadm_OBJECTS = $(am_l7vsadm_OBJECTS)
+am__DEPENDENCIES_1 =
+l7vsadm_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+ ../logger/libl7vsadm_logger.a \
+ ../parameter/libl7vsadm_parameter.a
+am_l7vsd_OBJECTS = l7vsd-l7vsd.$(OBJEXT) l7vsd-iomux.$(OBJEXT) \
+ l7vsd-lsock.$(OBJEXT) l7vsd-service.$(OBJEXT) \
+ l7vsd-conn.$(OBJEXT) l7vsd-dest.$(OBJEXT) \
+ l7vsd-config.$(OBJEXT) l7vsd-module.$(OBJEXT) \
+ l7vsd-protomod.$(OBJEXT) l7vsd-sched.$(OBJEXT) \
+ l7vsd-replication.$(OBJEXT) l7vsd-snmpbridge.$(OBJEXT)
+l7vsd_OBJECTS = $(am_l7vsd_OBJECTS)
+l7vsd_DEPENDENCIES = $(am__DEPENDENCIES_1) ../logger/libl7vsd_logger.a \
+ ../parameter/libl7vsd_parameter.a
+DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \
+ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+ $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(AM_LDFLAGS) $(LDFLAGS) -o $@
+SOURCES = $(l7vsadm_SOURCES) $(l7vsd_SOURCES)
+DIST_SOURCES = $(l7vsadm_SOURCES) $(l7vsd_SOURCES)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+pkglibdir = @l7vs_moddir@
+ACLOCAL = @ACLOCAL@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+GLIB_CFLAGS = @GLIB_CFLAGS@
+GLIB_GENMARSHAL = @GLIB_GENMARSHAL@
+GLIB_LIBS = @GLIB_LIBS@
+GLIB_MKENUMS = @GLIB_MKENUMS@
+GOBJECT_QUERY = @GOBJECT_QUERY@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MANDIR = @MANDIR@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PKG_CONFIG = @PKG_CONFIG@
+RANLIB = @RANLIB@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+ac_ct_RANLIB = @ac_ct_RANLIB@
+ac_ct_STRIP = @ac_ct_STRIP@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+l7vs_maxvs = @l7vs_maxvs@
+l7vs_moddir = @l7vs_moddir@
+l7vsadm_sockdir = @l7vsadm_sockdir@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+snmpagent_libs = @snmpagent_libs@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+CONFIG_SOCK_PATH = @l7vsadm_sockdir@
+AUTOMAKE_OPTIONS = foreign
+L7VS_SBINDIR = @sbindir@
+l7vsd_CFLAGS = -O2 -g $(GLIB_CFLAGS) -I../include \
+ -I../logger -I../parameter -I../snmpagent \
+ -DL7VS_MODULE_PATH="\"@l7vs_moddir@\"" \
+ -DL7VS_CONFIG_SOCK_PATH="\"$(CONFIG_SOCK_PATH)\"" \
+ -DMAX_SERVICES="@l7vs_maxvs@" \
+ -DLOGGER_PROCESS_VSD \
+ -DVERSION=\"$(VERSION)\"
+
+l7vsd_SOURCES = \
+ ../logger/logger_wrapper.h \
+ ../parameter/parameter_wrapper.h \
+ ../include/l7vs.h \
+ ../include/l7vs_conn.h \
+ ../include/l7vs_iom.h \
+ ../include/l7vs_lsock.h \
+ ../include/l7vs_sched.h \
+ ../include/l7vs_config.h \
+ ../include/l7vs_dest.h \
+ ../include/l7vs_iomuxlist.h \
+ ../include/l7vs_module.h \
+ ../include/l7vs_service.h \
+ ../include/l7vs_replication.h \
+ ../include/l7vs_snmpbridge.h \
+ l7vsd.c \
+ iomux.c \
+ lsock.c \
+ service.c \
+ conn.c \
+ dest.c \
+ config.c \
+ module.c \
+ protomod.c \
+ sched.c \
+ replication.c \
+ snmpbridge.c
+
+l7vsd_LDADD = $(GLIB_LIBS) \
+ ../logger/libl7vsd_logger.a \
+ ../parameter/libl7vsd_parameter.a \
+ -llog4cxx \
+ -lrt
+
+l7vsadm_CFLAGS = -O2 -g $(GLIB_CFLAGS) -I../include \
+ -I../logger -I../parameter -I../snmpagent \
+ -DL7VS_MODULE_PATH="\"@l7vs_moddir@\"" \
+ -DL7VS_CONFIG_SOCK_PATH="\"$(CONFIG_SOCK_PATH)\"" \
+ -DLOGGER_PROCESS_ADM \
+ -DVERSION=\"$(VERSION)\"
+
+l7vsadm_SOURCES = \
+ ../logger/logger_wrapper.h \
+ ../parameter/parameter_wrapper.h \
+ module.c \
+ protomod.c \
+ l7vsadm.c \
+ l7vsadm_main.c
+
+l7vsadm_LDADD = $(GLIB_LIBS) \
+ ../logger/libl7vsadm_logger.a \
+ ../parameter/libl7vsadm_parameter.a \
+ -llog4cxx \
+ -lrt
+
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign src/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+install-sbinPROGRAMS: $(sbin_PROGRAMS)
+ @$(NORMAL_INSTALL)
+ test -z "$(sbindir)" || $(mkdir_p) "$(DESTDIR)$(sbindir)"
+ @list='$(sbin_PROGRAMS)'; for p in $$list; do \
+ p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+ if test -f $$p \
+ || test -f $$p1 \
+ ; then \
+ f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
+ echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(sbinPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(sbindir)/$$f'"; \
+ $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(sbinPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(sbindir)/$$f" || exit 1; \
+ else :; fi; \
+ done
+
+uninstall-sbinPROGRAMS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(sbin_PROGRAMS)'; for p in $$list; do \
+ f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
+ echo " rm -f '$(DESTDIR)$(sbindir)/$$f'"; \
+ rm -f "$(DESTDIR)$(sbindir)/$$f"; \
+ done
+
+clean-sbinPROGRAMS:
+ @list='$(sbin_PROGRAMS)'; for p in $$list; do \
+ f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+ echo " rm -f $$p $$f"; \
+ rm -f $$p $$f ; \
+ done
+l7vsadm$(EXEEXT): $(l7vsadm_OBJECTS) $(l7vsadm_DEPENDENCIES)
+ @rm -f l7vsadm$(EXEEXT)
+ $(LINK) $(l7vsadm_LDFLAGS) $(l7vsadm_OBJECTS) $(l7vsadm_LDADD) $(LIBS)
+l7vsd$(EXEEXT): $(l7vsd_OBJECTS) $(l7vsd_DEPENDENCIES)
+ @rm -f l7vsd$(EXEEXT)
+ $(LINK) $(l7vsd_LDFLAGS) $(l7vsd_OBJECTS) $(l7vsd_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/l7vsadm-l7vsadm.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/l7vsadm-l7vsadm_main.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/l7vsadm-module.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/l7vsadm-protomod.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/l7vsd-config.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/l7vsd-conn.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/l7vsd-dest.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/l7vsd-iomux.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/l7vsd-l7vsd.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/l7vsd-lsock.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/l7vsd-module.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/l7vsd-protomod.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/l7vsd-replication.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/l7vsd-sched.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/l7vsd-service.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/l7vsd-snmpbridge.Po@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+
+l7vsadm-module.o: module.c
+@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(l7vsadm_CFLAGS) $(CFLAGS) -MT l7vsadm-module.o -MD -MP -MF "$(DEPDIR)/l7vsadm-module.Tpo" -c -o l7vsadm-module.o `test -f 'module.c' || echo '$(srcdir)/'`module.c; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/l7vsadm-module.Tpo" "$(DEPDIR)/l7vsadm-module.Po"; else rm -f "$(DEPDIR)/l7vsadm-module.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='module.c' object='l7vsadm-module.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(l7vsadm_CFLAGS) $(CFLAGS) -c -o l7vsadm-module.o `test -f 'module.c' || echo '$(srcdir)/'`module.c
+
+l7vsadm-module.obj: module.c
+@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(l7vsadm_CFLAGS) $(CFLAGS) -MT l7vsadm-module.obj -MD -MP -MF "$(DEPDIR)/l7vsadm-module.Tpo" -c -o l7vsadm-module.obj `if test -f 'module.c'; then $(CYGPATH_W) 'module.c'; else $(CYGPATH_W) '$(srcdir)/module.c'; fi`; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/l7vsadm-module.Tpo" "$(DEPDIR)/l7vsadm-module.Po"; else rm -f "$(DEPDIR)/l7vsadm-module.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='module.c' object='l7vsadm-module.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(l7vsadm_CFLAGS) $(CFLAGS) -c -o l7vsadm-module.obj `if test -f 'module.c'; then $(CYGPATH_W) 'module.c'; else $(CYGPATH_W) '$(srcdir)/module.c'; fi`
+
+l7vsadm-protomod.o: protomod.c
+@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(l7vsadm_CFLAGS) $(CFLAGS) -MT l7vsadm-protomod.o -MD -MP -MF "$(DEPDIR)/l7vsadm-protomod.Tpo" -c -o l7vsadm-protomod.o `test -f 'protomod.c' || echo '$(srcdir)/'`protomod.c; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/l7vsadm-protomod.Tpo" "$(DEPDIR)/l7vsadm-protomod.Po"; else rm -f "$(DEPDIR)/l7vsadm-protomod.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='protomod.c' object='l7vsadm-protomod.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(l7vsadm_CFLAGS) $(CFLAGS) -c -o l7vsadm-protomod.o `test -f 'protomod.c' || echo '$(srcdir)/'`protomod.c
+
+l7vsadm-protomod.obj: protomod.c
+@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(l7vsadm_CFLAGS) $(CFLAGS) -MT l7vsadm-protomod.obj -MD -MP -MF "$(DEPDIR)/l7vsadm-protomod.Tpo" -c -o l7vsadm-protomod.obj `if test -f 'protomod.c'; then $(CYGPATH_W) 'protomod.c'; else $(CYGPATH_W) '$(srcdir)/protomod.c'; fi`; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/l7vsadm-protomod.Tpo" "$(DEPDIR)/l7vsadm-protomod.Po"; else rm -f "$(DEPDIR)/l7vsadm-protomod.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='protomod.c' object='l7vsadm-protomod.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(l7vsadm_CFLAGS) $(CFLAGS) -c -o l7vsadm-protomod.obj `if test -f 'protomod.c'; then $(CYGPATH_W) 'protomod.c'; else $(CYGPATH_W) '$(srcdir)/protomod.c'; fi`
+
+l7vsadm-l7vsadm.o: l7vsadm.c
+@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(l7vsadm_CFLAGS) $(CFLAGS) -MT l7vsadm-l7vsadm.o -MD -MP -MF "$(DEPDIR)/l7vsadm-l7vsadm.Tpo" -c -o l7vsadm-l7vsadm.o `test -f 'l7vsadm.c' || echo '$(srcdir)/'`l7vsadm.c; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/l7vsadm-l7vsadm.Tpo" "$(DEPDIR)/l7vsadm-l7vsadm.Po"; else rm -f "$(DEPDIR)/l7vsadm-l7vsadm.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='l7vsadm.c' object='l7vsadm-l7vsadm.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(l7vsadm_CFLAGS) $(CFLAGS) -c -o l7vsadm-l7vsadm.o `test -f 'l7vsadm.c' || echo '$(srcdir)/'`l7vsadm.c
+
+l7vsadm-l7vsadm.obj: l7vsadm.c
+@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(l7vsadm_CFLAGS) $(CFLAGS) -MT l7vsadm-l7vsadm.obj -MD -MP -MF "$(DEPDIR)/l7vsadm-l7vsadm.Tpo" -c -o l7vsadm-l7vsadm.obj `if test -f 'l7vsadm.c'; then $(CYGPATH_W) 'l7vsadm.c'; else $(CYGPATH_W) '$(srcdir)/l7vsadm.c'; fi`; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/l7vsadm-l7vsadm.Tpo" "$(DEPDIR)/l7vsadm-l7vsadm.Po"; else rm -f "$(DEPDIR)/l7vsadm-l7vsadm.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='l7vsadm.c' object='l7vsadm-l7vsadm.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(l7vsadm_CFLAGS) $(CFLAGS) -c -o l7vsadm-l7vsadm.obj `if test -f 'l7vsadm.c'; then $(CYGPATH_W) 'l7vsadm.c'; else $(CYGPATH_W) '$(srcdir)/l7vsadm.c'; fi`
+
+l7vsadm-l7vsadm_main.o: l7vsadm_main.c
+@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(l7vsadm_CFLAGS) $(CFLAGS) -MT l7vsadm-l7vsadm_main.o -MD -MP -MF "$(DEPDIR)/l7vsadm-l7vsadm_main.Tpo" -c -o l7vsadm-l7vsadm_main.o `test -f 'l7vsadm_main.c' || echo '$(srcdir)/'`l7vsadm_main.c; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/l7vsadm-l7vsadm_main.Tpo" "$(DEPDIR)/l7vsadm-l7vsadm_main.Po"; else rm -f "$(DEPDIR)/l7vsadm-l7vsadm_main.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='l7vsadm_main.c' object='l7vsadm-l7vsadm_main.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(l7vsadm_CFLAGS) $(CFLAGS) -c -o l7vsadm-l7vsadm_main.o `test -f 'l7vsadm_main.c' || echo '$(srcdir)/'`l7vsadm_main.c
+
+l7vsadm-l7vsadm_main.obj: l7vsadm_main.c
+@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(l7vsadm_CFLAGS) $(CFLAGS) -MT l7vsadm-l7vsadm_main.obj -MD -MP -MF "$(DEPDIR)/l7vsadm-l7vsadm_main.Tpo" -c -o l7vsadm-l7vsadm_main.obj `if test -f 'l7vsadm_main.c'; then $(CYGPATH_W) 'l7vsadm_main.c'; else $(CYGPATH_W) '$(srcdir)/l7vsadm_main.c'; fi`; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/l7vsadm-l7vsadm_main.Tpo" "$(DEPDIR)/l7vsadm-l7vsadm_main.Po"; else rm -f "$(DEPDIR)/l7vsadm-l7vsadm_main.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='l7vsadm_main.c' object='l7vsadm-l7vsadm_main.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(l7vsadm_CFLAGS) $(CFLAGS) -c -o l7vsadm-l7vsadm_main.obj `if test -f 'l7vsadm_main.c'; then $(CYGPATH_W) 'l7vsadm_main.c'; else $(CYGPATH_W) '$(srcdir)/l7vsadm_main.c'; fi`
+
+l7vsd-l7vsd.o: l7vsd.c
+@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(l7vsd_CFLAGS) $(CFLAGS) -MT l7vsd-l7vsd.o -MD -MP -MF "$(DEPDIR)/l7vsd-l7vsd.Tpo" -c -o l7vsd-l7vsd.o `test -f 'l7vsd.c' || echo '$(srcdir)/'`l7vsd.c; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/l7vsd-l7vsd.Tpo" "$(DEPDIR)/l7vsd-l7vsd.Po"; else rm -f "$(DEPDIR)/l7vsd-l7vsd.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='l7vsd.c' object='l7vsd-l7vsd.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(l7vsd_CFLAGS) $(CFLAGS) -c -o l7vsd-l7vsd.o `test -f 'l7vsd.c' || echo '$(srcdir)/'`l7vsd.c
+
+l7vsd-l7vsd.obj: l7vsd.c
+@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(l7vsd_CFLAGS) $(CFLAGS) -MT l7vsd-l7vsd.obj -MD -MP -MF "$(DEPDIR)/l7vsd-l7vsd.Tpo" -c -o l7vsd-l7vsd.obj `if test -f 'l7vsd.c'; then $(CYGPATH_W) 'l7vsd.c'; else $(CYGPATH_W) '$(srcdir)/l7vsd.c'; fi`; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/l7vsd-l7vsd.Tpo" "$(DEPDIR)/l7vsd-l7vsd.Po"; else rm -f "$(DEPDIR)/l7vsd-l7vsd.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='l7vsd.c' object='l7vsd-l7vsd.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(l7vsd_CFLAGS) $(CFLAGS) -c -o l7vsd-l7vsd.obj `if test -f 'l7vsd.c'; then $(CYGPATH_W) 'l7vsd.c'; else $(CYGPATH_W) '$(srcdir)/l7vsd.c'; fi`
+
+l7vsd-iomux.o: iomux.c
+@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(l7vsd_CFLAGS) $(CFLAGS) -MT l7vsd-iomux.o -MD -MP -MF "$(DEPDIR)/l7vsd-iomux.Tpo" -c -o l7vsd-iomux.o `test -f 'iomux.c' || echo '$(srcdir)/'`iomux.c; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/l7vsd-iomux.Tpo" "$(DEPDIR)/l7vsd-iomux.Po"; else rm -f "$(DEPDIR)/l7vsd-iomux.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='iomux.c' object='l7vsd-iomux.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(l7vsd_CFLAGS) $(CFLAGS) -c -o l7vsd-iomux.o `test -f 'iomux.c' || echo '$(srcdir)/'`iomux.c
+
+l7vsd-iomux.obj: iomux.c
+@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(l7vsd_CFLAGS) $(CFLAGS) -MT l7vsd-iomux.obj -MD -MP -MF "$(DEPDIR)/l7vsd-iomux.Tpo" -c -o l7vsd-iomux.obj `if test -f 'iomux.c'; then $(CYGPATH_W) 'iomux.c'; else $(CYGPATH_W) '$(srcdir)/iomux.c'; fi`; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/l7vsd-iomux.Tpo" "$(DEPDIR)/l7vsd-iomux.Po"; else rm -f "$(DEPDIR)/l7vsd-iomux.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='iomux.c' object='l7vsd-iomux.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(l7vsd_CFLAGS) $(CFLAGS) -c -o l7vsd-iomux.obj `if test -f 'iomux.c'; then $(CYGPATH_W) 'iomux.c'; else $(CYGPATH_W) '$(srcdir)/iomux.c'; fi`
+
+l7vsd-lsock.o: lsock.c
+@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(l7vsd_CFLAGS) $(CFLAGS) -MT l7vsd-lsock.o -MD -MP -MF "$(DEPDIR)/l7vsd-lsock.Tpo" -c -o l7vsd-lsock.o `test -f 'lsock.c' || echo '$(srcdir)/'`lsock.c; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/l7vsd-lsock.Tpo" "$(DEPDIR)/l7vsd-lsock.Po"; else rm -f "$(DEPDIR)/l7vsd-lsock.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='lsock.c' object='l7vsd-lsock.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(l7vsd_CFLAGS) $(CFLAGS) -c -o l7vsd-lsock.o `test -f 'lsock.c' || echo '$(srcdir)/'`lsock.c
+
+l7vsd-lsock.obj: lsock.c
+@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(l7vsd_CFLAGS) $(CFLAGS) -MT l7vsd-lsock.obj -MD -MP -MF "$(DEPDIR)/l7vsd-lsock.Tpo" -c -o l7vsd-lsock.obj `if test -f 'lsock.c'; then $(CYGPATH_W) 'lsock.c'; else $(CYGPATH_W) '$(srcdir)/lsock.c'; fi`; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/l7vsd-lsock.Tpo" "$(DEPDIR)/l7vsd-lsock.Po"; else rm -f "$(DEPDIR)/l7vsd-lsock.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='lsock.c' object='l7vsd-lsock.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(l7vsd_CFLAGS) $(CFLAGS) -c -o l7vsd-lsock.obj `if test -f 'lsock.c'; then $(CYGPATH_W) 'lsock.c'; else $(CYGPATH_W) '$(srcdir)/lsock.c'; fi`
+
+l7vsd-service.o: service.c
+@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(l7vsd_CFLAGS) $(CFLAGS) -MT l7vsd-service.o -MD -MP -MF "$(DEPDIR)/l7vsd-service.Tpo" -c -o l7vsd-service.o `test -f 'service.c' || echo '$(srcdir)/'`service.c; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/l7vsd-service.Tpo" "$(DEPDIR)/l7vsd-service.Po"; else rm -f "$(DEPDIR)/l7vsd-service.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='service.c' object='l7vsd-service.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(l7vsd_CFLAGS) $(CFLAGS) -c -o l7vsd-service.o `test -f 'service.c' || echo '$(srcdir)/'`service.c
+
+l7vsd-service.obj: service.c
+@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(l7vsd_CFLAGS) $(CFLAGS) -MT l7vsd-service.obj -MD -MP -MF "$(DEPDIR)/l7vsd-service.Tpo" -c -o l7vsd-service.obj `if test -f 'service.c'; then $(CYGPATH_W) 'service.c'; else $(CYGPATH_W) '$(srcdir)/service.c'; fi`; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/l7vsd-service.Tpo" "$(DEPDIR)/l7vsd-service.Po"; else rm -f "$(DEPDIR)/l7vsd-service.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='service.c' object='l7vsd-service.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(l7vsd_CFLAGS) $(CFLAGS) -c -o l7vsd-service.obj `if test -f 'service.c'; then $(CYGPATH_W) 'service.c'; else $(CYGPATH_W) '$(srcdir)/service.c'; fi`
+
+l7vsd-conn.o: conn.c
+@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(l7vsd_CFLAGS) $(CFLAGS) -MT l7vsd-conn.o -MD -MP -MF "$(DEPDIR)/l7vsd-conn.Tpo" -c -o l7vsd-conn.o `test -f 'conn.c' || echo '$(srcdir)/'`conn.c; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/l7vsd-conn.Tpo" "$(DEPDIR)/l7vsd-conn.Po"; else rm -f "$(DEPDIR)/l7vsd-conn.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='conn.c' object='l7vsd-conn.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(l7vsd_CFLAGS) $(CFLAGS) -c -o l7vsd-conn.o `test -f 'conn.c' || echo '$(srcdir)/'`conn.c
+
+l7vsd-conn.obj: conn.c
+@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(l7vsd_CFLAGS) $(CFLAGS) -MT l7vsd-conn.obj -MD -MP -MF "$(DEPDIR)/l7vsd-conn.Tpo" -c -o l7vsd-conn.obj `if test -f 'conn.c'; then $(CYGPATH_W) 'conn.c'; else $(CYGPATH_W) '$(srcdir)/conn.c'; fi`; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/l7vsd-conn.Tpo" "$(DEPDIR)/l7vsd-conn.Po"; else rm -f "$(DEPDIR)/l7vsd-conn.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='conn.c' object='l7vsd-conn.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(l7vsd_CFLAGS) $(CFLAGS) -c -o l7vsd-conn.obj `if test -f 'conn.c'; then $(CYGPATH_W) 'conn.c'; else $(CYGPATH_W) '$(srcdir)/conn.c'; fi`
+
+l7vsd-dest.o: dest.c
+@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(l7vsd_CFLAGS) $(CFLAGS) -MT l7vsd-dest.o -MD -MP -MF "$(DEPDIR)/l7vsd-dest.Tpo" -c -o l7vsd-dest.o `test -f 'dest.c' || echo '$(srcdir)/'`dest.c; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/l7vsd-dest.Tpo" "$(DEPDIR)/l7vsd-dest.Po"; else rm -f "$(DEPDIR)/l7vsd-dest.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='dest.c' object='l7vsd-dest.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(l7vsd_CFLAGS) $(CFLAGS) -c -o l7vsd-dest.o `test -f 'dest.c' || echo '$(srcdir)/'`dest.c
+
+l7vsd-dest.obj: dest.c
+@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(l7vsd_CFLAGS) $(CFLAGS) -MT l7vsd-dest.obj -MD -MP -MF "$(DEPDIR)/l7vsd-dest.Tpo" -c -o l7vsd-dest.obj `if test -f 'dest.c'; then $(CYGPATH_W) 'dest.c'; else $(CYGPATH_W) '$(srcdir)/dest.c'; fi`; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/l7vsd-dest.Tpo" "$(DEPDIR)/l7vsd-dest.Po"; else rm -f "$(DEPDIR)/l7vsd-dest.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='dest.c' object='l7vsd-dest.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(l7vsd_CFLAGS) $(CFLAGS) -c -o l7vsd-dest.obj `if test -f 'dest.c'; then $(CYGPATH_W) 'dest.c'; else $(CYGPATH_W) '$(srcdir)/dest.c'; fi`
+
+l7vsd-config.o: config.c
+@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(l7vsd_CFLAGS) $(CFLAGS) -MT l7vsd-config.o -MD -MP -MF "$(DEPDIR)/l7vsd-config.Tpo" -c -o l7vsd-config.o `test -f 'config.c' || echo '$(srcdir)/'`config.c; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/l7vsd-config.Tpo" "$(DEPDIR)/l7vsd-config.Po"; else rm -f "$(DEPDIR)/l7vsd-config.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='config.c' object='l7vsd-config.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(l7vsd_CFLAGS) $(CFLAGS) -c -o l7vsd-config.o `test -f 'config.c' || echo '$(srcdir)/'`config.c
+
+l7vsd-config.obj: config.c
+@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(l7vsd_CFLAGS) $(CFLAGS) -MT l7vsd-config.obj -MD -MP -MF "$(DEPDIR)/l7vsd-config.Tpo" -c -o l7vsd-config.obj `if test -f 'config.c'; then $(CYGPATH_W) 'config.c'; else $(CYGPATH_W) '$(srcdir)/config.c'; fi`; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/l7vsd-config.Tpo" "$(DEPDIR)/l7vsd-config.Po"; else rm -f "$(DEPDIR)/l7vsd-config.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='config.c' object='l7vsd-config.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(l7vsd_CFLAGS) $(CFLAGS) -c -o l7vsd-config.obj `if test -f 'config.c'; then $(CYGPATH_W) 'config.c'; else $(CYGPATH_W) '$(srcdir)/config.c'; fi`
+
+l7vsd-module.o: module.c
+@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(l7vsd_CFLAGS) $(CFLAGS) -MT l7vsd-module.o -MD -MP -MF "$(DEPDIR)/l7vsd-module.Tpo" -c -o l7vsd-module.o `test -f 'module.c' || echo '$(srcdir)/'`module.c; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/l7vsd-module.Tpo" "$(DEPDIR)/l7vsd-module.Po"; else rm -f "$(DEPDIR)/l7vsd-module.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='module.c' object='l7vsd-module.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(l7vsd_CFLAGS) $(CFLAGS) -c -o l7vsd-module.o `test -f 'module.c' || echo '$(srcdir)/'`module.c
+
+l7vsd-module.obj: module.c
+@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(l7vsd_CFLAGS) $(CFLAGS) -MT l7vsd-module.obj -MD -MP -MF "$(DEPDIR)/l7vsd-module.Tpo" -c -o l7vsd-module.obj `if test -f 'module.c'; then $(CYGPATH_W) 'module.c'; else $(CYGPATH_W) '$(srcdir)/module.c'; fi`; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/l7vsd-module.Tpo" "$(DEPDIR)/l7vsd-module.Po"; else rm -f "$(DEPDIR)/l7vsd-module.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='module.c' object='l7vsd-module.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(l7vsd_CFLAGS) $(CFLAGS) -c -o l7vsd-module.obj `if test -f 'module.c'; then $(CYGPATH_W) 'module.c'; else $(CYGPATH_W) '$(srcdir)/module.c'; fi`
+
+l7vsd-protomod.o: protomod.c
+@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(l7vsd_CFLAGS) $(CFLAGS) -MT l7vsd-protomod.o -MD -MP -MF "$(DEPDIR)/l7vsd-protomod.Tpo" -c -o l7vsd-protomod.o `test -f 'protomod.c' || echo '$(srcdir)/'`protomod.c; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/l7vsd-protomod.Tpo" "$(DEPDIR)/l7vsd-protomod.Po"; else rm -f "$(DEPDIR)/l7vsd-protomod.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='protomod.c' object='l7vsd-protomod.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(l7vsd_CFLAGS) $(CFLAGS) -c -o l7vsd-protomod.o `test -f 'protomod.c' || echo '$(srcdir)/'`protomod.c
+
+l7vsd-protomod.obj: protomod.c
+@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(l7vsd_CFLAGS) $(CFLAGS) -MT l7vsd-protomod.obj -MD -MP -MF "$(DEPDIR)/l7vsd-protomod.Tpo" -c -o l7vsd-protomod.obj `if test -f 'protomod.c'; then $(CYGPATH_W) 'protomod.c'; else $(CYGPATH_W) '$(srcdir)/protomod.c'; fi`; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/l7vsd-protomod.Tpo" "$(DEPDIR)/l7vsd-protomod.Po"; else rm -f "$(DEPDIR)/l7vsd-protomod.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='protomod.c' object='l7vsd-protomod.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(l7vsd_CFLAGS) $(CFLAGS) -c -o l7vsd-protomod.obj `if test -f 'protomod.c'; then $(CYGPATH_W) 'protomod.c'; else $(CYGPATH_W) '$(srcdir)/protomod.c'; fi`
+
+l7vsd-sched.o: sched.c
+@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(l7vsd_CFLAGS) $(CFLAGS) -MT l7vsd-sched.o -MD -MP -MF "$(DEPDIR)/l7vsd-sched.Tpo" -c -o l7vsd-sched.o `test -f 'sched.c' || echo '$(srcdir)/'`sched.c; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/l7vsd-sched.Tpo" "$(DEPDIR)/l7vsd-sched.Po"; else rm -f "$(DEPDIR)/l7vsd-sched.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='sched.c' object='l7vsd-sched.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(l7vsd_CFLAGS) $(CFLAGS) -c -o l7vsd-sched.o `test -f 'sched.c' || echo '$(srcdir)/'`sched.c
+
+l7vsd-sched.obj: sched.c
+@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(l7vsd_CFLAGS) $(CFLAGS) -MT l7vsd-sched.obj -MD -MP -MF "$(DEPDIR)/l7vsd-sched.Tpo" -c -o l7vsd-sched.obj `if test -f 'sched.c'; then $(CYGPATH_W) 'sched.c'; else $(CYGPATH_W) '$(srcdir)/sched.c'; fi`; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/l7vsd-sched.Tpo" "$(DEPDIR)/l7vsd-sched.Po"; else rm -f "$(DEPDIR)/l7vsd-sched.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='sched.c' object='l7vsd-sched.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(l7vsd_CFLAGS) $(CFLAGS) -c -o l7vsd-sched.obj `if test -f 'sched.c'; then $(CYGPATH_W) 'sched.c'; else $(CYGPATH_W) '$(srcdir)/sched.c'; fi`
+
+l7vsd-replication.o: replication.c
+@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(l7vsd_CFLAGS) $(CFLAGS) -MT l7vsd-replication.o -MD -MP -MF "$(DEPDIR)/l7vsd-replication.Tpo" -c -o l7vsd-replication.o `test -f 'replication.c' || echo '$(srcdir)/'`replication.c; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/l7vsd-replication.Tpo" "$(DEPDIR)/l7vsd-replication.Po"; else rm -f "$(DEPDIR)/l7vsd-replication.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='replication.c' object='l7vsd-replication.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(l7vsd_CFLAGS) $(CFLAGS) -c -o l7vsd-replication.o `test -f 'replication.c' || echo '$(srcdir)/'`replication.c
+
+l7vsd-replication.obj: replication.c
+@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(l7vsd_CFLAGS) $(CFLAGS) -MT l7vsd-replication.obj -MD -MP -MF "$(DEPDIR)/l7vsd-replication.Tpo" -c -o l7vsd-replication.obj `if test -f 'replication.c'; then $(CYGPATH_W) 'replication.c'; else $(CYGPATH_W) '$(srcdir)/replication.c'; fi`; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/l7vsd-replication.Tpo" "$(DEPDIR)/l7vsd-replication.Po"; else rm -f "$(DEPDIR)/l7vsd-replication.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='replication.c' object='l7vsd-replication.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(l7vsd_CFLAGS) $(CFLAGS) -c -o l7vsd-replication.obj `if test -f 'replication.c'; then $(CYGPATH_W) 'replication.c'; else $(CYGPATH_W) '$(srcdir)/replication.c'; fi`
+
+l7vsd-snmpbridge.o: snmpbridge.c
+@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(l7vsd_CFLAGS) $(CFLAGS) -MT l7vsd-snmpbridge.o -MD -MP -MF "$(DEPDIR)/l7vsd-snmpbridge.Tpo" -c -o l7vsd-snmpbridge.o `test -f 'snmpbridge.c' || echo '$(srcdir)/'`snmpbridge.c; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/l7vsd-snmpbridge.Tpo" "$(DEPDIR)/l7vsd-snmpbridge.Po"; else rm -f "$(DEPDIR)/l7vsd-snmpbridge.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='snmpbridge.c' object='l7vsd-snmpbridge.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(l7vsd_CFLAGS) $(CFLAGS) -c -o l7vsd-snmpbridge.o `test -f 'snmpbridge.c' || echo '$(srcdir)/'`snmpbridge.c
+
+l7vsd-snmpbridge.obj: snmpbridge.c
+@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(l7vsd_CFLAGS) $(CFLAGS) -MT l7vsd-snmpbridge.obj -MD -MP -MF "$(DEPDIR)/l7vsd-snmpbridge.Tpo" -c -o l7vsd-snmpbridge.obj `if test -f 'snmpbridge.c'; then $(CYGPATH_W) 'snmpbridge.c'; else $(CYGPATH_W) '$(srcdir)/snmpbridge.c'; fi`; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/l7vsd-snmpbridge.Tpo" "$(DEPDIR)/l7vsd-snmpbridge.Po"; else rm -f "$(DEPDIR)/l7vsd-snmpbridge.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='snmpbridge.c' object='l7vsd-snmpbridge.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(l7vsd_CFLAGS) $(CFLAGS) -c -o l7vsd-snmpbridge.obj `if test -f 'snmpbridge.c'; then $(CYGPATH_W) 'snmpbridge.c'; else $(CYGPATH_W) '$(srcdir)/snmpbridge.c'; fi`
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+distclean-libtool:
+ -rm -f libtool
+uninstall-info-am:
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+ list='$(DISTFILES)'; for file in $$list; do \
+ case $$file in \
+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+ esac; \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ dir="/$$dir"; \
+ $(mkdir_p) "$(distdir)$$dir"; \
+ else \
+ dir=''; \
+ fi; \
+ if test -d $$d/$$file; then \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(PROGRAMS)
+installdirs:
+ for dir in "$(DESTDIR)$(sbindir)"; do \
+ test -z "$$dir" || $(mkdir_p) "$$dir"; \
+ done
+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-libtool clean-sbinPROGRAMS \
+ mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-libtool distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-exec-am: install-sbinPROGRAMS
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-info-am uninstall-sbinPROGRAMS
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+ clean-libtool clean-sbinPROGRAMS ctags distclean \
+ distclean-compile distclean-generic distclean-libtool \
+ distclean-tags distdir dvi dvi-am html html-am info info-am \
+ install install-am install-data install-data-am install-exec \
+ install-exec-am install-info install-info-am install-man \
+ install-sbinPROGRAMS 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-sbinPROGRAMS
+
+
+install:
+ $(INSTALL) -m 755 -d $(CONFIG_SOCK_PATH)
+ $(INSTALL) -m 755 -D \
+ ./l7vsd \
+ ./l7vsadm \
+ $(L7VS_SBINDIR)
+# 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:
--- /dev/null
+/*
+ * @file config.c
+ * @brief the configulation interface component
+ * @brief it receives configulation command from l7vsadm,
+ * @brief execute coresponding action and return result
+ *
+ * L7VSD: Linux Virtual Server for Layer7 Load Balancing
+ * Copyright (C) 2005 NTT COMWARE Corporation.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ **********************************************************************/
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <sys/socket.h>
+#include <sys/un.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <glib.h>
+
+/* Added headers for sending messages to l7vsagent */
+#include <stdio.h>
+#include <errno.h>
+#include <sys/msg.h>
+#include <string.h>
+#include <netdb.h>
+
+#include "l7vs_config.h"
+#include "l7vs_iomuxlist.h"
+#include "l7vs_service.h"
+#include "l7vs_sched.h"
+
+
+
+static int l7vs_config_callback( struct l7vs_iomux* );
+static void l7vs_config_dispatch( union l7vs_config_req*, struct sockaddr_un* );
+static void l7vs_config_list_vs( union l7vs_config_req*, struct sockaddr_un* );
+static void l7vs_config_list_rs( union l7vs_config_req*, struct sockaddr_un* );
+static void l7vs_config_add_vs( union l7vs_config_req*, struct sockaddr_un* );
+static void l7vs_config_del_vs( union l7vs_config_req*, struct sockaddr_un* );
+static void l7vs_config_edit_vs( union l7vs_config_req*, struct sockaddr_un* );
+static void l7vs_config_add_rs( union l7vs_config_req*, struct sockaddr_un* );
+static void l7vs_config_del_rs( union l7vs_config_req*, struct sockaddr_un* );
+static void l7vs_config_edit_rs( union l7vs_config_req*, struct sockaddr_un* );
+static void l7vs_config_flush_vs( union l7vs_config_req*, struct sockaddr_un* );
+static void l7vs_config_get_replication_info( union l7vs_config_req*, struct sockaddr_un* );
+static void l7vs_config_get_log_info( union l7vs_config_req*, struct sockaddr_un* );
+static void l7vs_config_get_snmp_log_info( union l7vs_config_req*, struct sockaddr_un* );
+static void l7vs_config_get_snmp_connect_status( union l7vs_config_req*, struct sockaddr_un* );
+static void l7vs_config_replication( union l7vs_config_req*, struct sockaddr_un* );
+static void l7vs_config_log( union l7vs_config_req*, struct sockaddr_un* );
+static void l7vs_config_snmp( union l7vs_config_req*, struct sockaddr_un* );
+static void l7vs_config_snmp_all( union l7vs_config_req*, struct sockaddr_un* );
+static void l7vs_config_parameter( union l7vs_config_req*, struct sockaddr_un* );
+static int l7vs_config_send_response( struct sockaddr_un*, struct iovec*, int );
+
+char servicebuf[NI_MAXHOST + NI_MAXSERV + 2];
+const char l7vs_config_sockname[] = L7VS_CONFIG_SOCKNAME;
+
+static struct l7vs_iomux *l7vs_config_iomux;
+
+/*!
+ * Operate config init
+ * @return int result OK=0, NG=<0
+ */
+
+int
+l7vs_config_init(void)
+{
+ int s;
+ int ret;
+ int opt;
+ mode_t mode;
+ struct sockaddr_un addr;
+ struct sockaddr_in *in_addr;
+ socklen_t len;
+
+ if(logger_get_log_level(LOG_CAT_L7VSD_ENVIRONMENT) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_ENVIRONMENT,1,
+ "in_fuction: int l7vs_config_init return int");
+ }
+
+ if (l7vs_config_iomux) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_ENVIRONMENT,1,"config is already initialized.");
+ if(logger_get_log_level(LOG_CAT_L7VSD_ENVIRONMENT) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_ENVIRONMENT,2,
+ "out_fuction: int l7vs_config_init return -1");
+ }
+ return -1;
+ }
+
+ if (sizeof(addr.sun_path) < sizeof(l7vs_config_sockname)) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_NETWORK,1,"Internal error The config socket name is too large.");
+ if(logger_get_log_level(LOG_CAT_L7VSD_NETWORK) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,1,
+ "out_fuction: int l7vs_config_init return -1");
+ }
+ return -1;
+ }
+
+ s = socket(PF_LOCAL, SOCK_DGRAM, 0);
+ if (s < 0) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_SYSTEM_SOCKET,1,"socket: %s (Socket Type is SOCK_DGRAM)", strerror(errno));
+ if(logger_get_log_level(LOG_CAT_L7VSD_NETWORK) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,2,
+ "out_fuction: int l7vs_config_init return < 0");
+ }
+ return s;
+ }
+
+ opt = 1;
+ ret = setsockopt(s, SOL_SOCKET, SO_PASSCRED, &opt, sizeof(opt));
+ if (ret < 0) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_SYSTEM_SOCKET,2,"setsockopt SO_PASSCRED: %s", strerror(errno));
+ close(s);
+ if(logger_get_log_level(LOG_CAT_L7VSD_NETWORK) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,3,
+ "out_fuction: int l7vs_config_init return < 0");
+ }
+ return ret;
+ }
+
+ memset(&addr, 0, sizeof(addr));
+ addr.sun_family = AF_LOCAL;
+ strcpy(addr.sun_path, l7vs_config_sockname);
+ len = SUN_LEN(&addr);
+
+ mode = umask(0077);
+ if (mode < 0) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_SYSTEM,1,"umask: %s", strerror(errno));
+ close(s);
+ if(logger_get_log_level(LOG_CAT_L7VSD_SYSTEM) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_SYSTEM,1,
+ "out_fuction: int l7vs_config_init return -1");
+ }
+ return -1;
+ }
+
+ ret = bind(s, (struct sockaddr *)&addr, len);
+ if (ret < 0) {
+ in_addr = (struct sockaddr_in*)&addr;
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_SYSTEM_SOCKET,3,"cannot create socket file \"%s\": %s",
+ addr.sun_path, strerror(errno));
+ if (errno == EADDRINUSE) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_SYSTEM_SOCKET,4, "Config socket already exists. "
+ "You could remove it if" " the l7vs daemon is not running");
+ }
+ close(s);
+ umask(mode);
+ if(logger_get_log_level(LOG_CAT_L7VSD_SYSTEM_SOCKET) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_SYSTEM_SOCKET,1,
+ "out_fuction: int l7vs_config_init return < 0");
+ }
+ return ret;
+ }
+ umask(mode);
+
+ l7vs_config_iomux = l7vs_iomux_get_from_avail_list();
+ if (!l7vs_config_iomux) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_NETWORK,2,"can not get config_iomux");
+ if(logger_get_log_level(LOG_CAT_L7VSD_NETWORK) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,4,
+ "out_fuction: int l7vs_config_init return < 0");
+ }
+ return -1;
+ }
+
+ l7vs_config_iomux->fd = s;
+ l7vs_config_iomux->data = NULL;
+ l7vs_config_iomux->callback = l7vs_config_callback;
+ l7vs_config_iomux->status = iomux_config_command_waiting;
+ l7vs_iomux_add( l7vs_config_iomux, iom_read );
+
+ if(logger_get_log_level(LOG_CAT_L7VSD_SYSTEM_SOCKET) == LOG_LV_DEBUG){
+ char iomux_str[DEBUG_STR_LEN] = {0};
+ l7vs_iomux_c_str(iomux_str,l7vs_config_iomux);
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_PROGRAM,23,
+ "creat: l7vs_config_iomux=%s",
+ iomux_str);
+ }
+
+ return 0;
+}
+
+/*!
+ * Operate config finish
+ * @return void
+ */
+void
+l7vs_config_fini(void)
+{
+ if(logger_get_log_level(LOG_CAT_L7VSD_ENVIRONMENT) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_ENVIRONMENT,3,
+ "in_fuction: void l7vs_config_fini return void");
+ }
+ if (l7vs_config_iomux) {
+ l7vs_config_iomux->status = iomux_config_destroyed;
+ l7vs_iomux_remove(l7vs_config_iomux);
+ if (-1 != l7vs_config_iomux->fd) {
+ close(l7vs_config_iomux->fd);
+ }
+ l7vs_iomux_put_to_avail_list(l7vs_config_iomux);
+ l7vs_config_iomux = NULL;
+ }
+ unlink(l7vs_config_sockname);
+ if(logger_get_log_level(LOG_CAT_L7VSD_ENVIRONMENT) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_ENVIRONMENT,4,
+ "out_fuction: void l7vs_config_fini return void");
+ }
+}
+
+/*!
+ * config call back
+ * @param[in] struct l7vs_iomux l7vs_iomux pointer
+ * @return int number of VirtualService, NG<0
+ */
+static int
+l7vs_config_callback(struct l7vs_iomux *iom )
+{
+ struct msghdr msg;
+ struct sockaddr_un addr;
+ struct iovec iov;
+ struct ucred *cred;
+ struct cmsghdr *cmsg;
+ unsigned char cbuf[CMSG_LEN(sizeof(struct ucred))];
+ union l7vs_config_req req;
+ int ret;
+
+ if (!iom) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_ENVIRONMENT,2,"error / iom is null");
+ if(logger_get_log_level(LOG_CAT_L7VSD_ENVIRONMENT) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_ENVIRONMENT,5,
+ "out_fuction: int l7vs_config_callback (struct l7vs_iomux *iom) return -1");
+ }
+ return -1;
+ }
+ if (iomux_config_command_waiting != iom->status) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_EVENT,2,"error / invalid status(%d)", iom->status);
+ if(logger_get_log_level(LOG_CAT_L7VSD_ENVIRONMENT) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_ENVIRONMENT,6,
+ "out_fuction: int l7vs_config_callback (struct l7vs_iomux *iom) return -1");
+ }
+ return -1;
+ }
+
+ if(logger_get_log_level(LOG_CAT_L7VSD_ENVIRONMENT) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_ENVIRONMENT,7,
+ "in_fuction: int l7vs_config_callback (struct l7vs_iomux *iom) iom = %p",iom);
+ }
+
+ cmsg = (struct cmsghdr *)cbuf;
+ cmsg->cmsg_len = sizeof(cbuf);
+
+ memset(&addr, 0, sizeof(addr));
+ memset(&msg, 0, sizeof(msg));
+ msg.msg_name = &addr;
+ msg.msg_namelen = sizeof(addr);
+ msg.msg_iov = &iov;
+ msg.msg_iovlen = 1;
+ msg.msg_control = cmsg;
+ msg.msg_controllen = sizeof(cbuf);
+
+ iov.iov_base = &req;
+ iov.iov_len = sizeof(req);
+
+ ret = recvmsg(iom->fd, &msg, 0);
+ if (ret < 0) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_NETWORK,3,"recvmsg on config socket: %s", strerror(errno));
+ if(logger_get_log_level(LOG_CAT_L7VSD_NETWORK) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,5,
+ "out_fuction: int l7vs_config_callback (struct l7vs_iomux *iom) return -1");
+ }
+ return -1;
+ }
+
+ if (msg.msg_flags & (MSG_TRUNC|MSG_CTRUNC)) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_NETWORK,4,"msg_flags=%x", msg.msg_flags);
+ if(logger_get_log_level(LOG_CAT_L7VSD_NETWORK) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,6,
+ "out_fuction: int l7vs_config_callback (struct l7vs_iomux *iom) return -1");
+ }
+ return -1;
+ }
+
+ if (! (cmsg->cmsg_level == SOL_SOCKET &&
+ cmsg->cmsg_type == SCM_CREDENTIALS)) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_NETWORK,5,"Could not receive a remote credential");
+ if(logger_get_log_level(LOG_CAT_L7VSD_NETWORK) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,7,
+ "out_fuction: int l7vs_config_callback (struct l7vs_iomux *iom) return -1");
+ }
+ return -1;
+ }
+
+ /*
+ * actually credential check is unnecessary,
+ * at least for Linux 2.4.20.
+ */
+ cred = (struct ucred *)CMSG_DATA(cmsg);
+ if (cred->uid != 0) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_NETWORK,6,"Request from unprivileged user");
+ if(logger_get_log_level(LOG_CAT_L7VSD_NETWORK) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,8,
+ "out_fuction: int l7vs_config_callback (struct l7vs_iomux *iom) return -1");
+ }
+ return -1;
+ }
+
+ l7vs_config_dispatch(&req, &addr);
+
+ l7vs_config_iomux->status = iomux_config_command_waiting;
+ if(logger_get_log_level(LOG_CAT_L7VSD_NETWORK) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,9,
+ "out_fuction: int l7vs_config_callback (struct l7vs_iomux *iom) return 0");
+ }
+
+ return 0;
+}
+
+struct l7vs_config_table {
+ enum l7vs_config_command cmd;
+ void (*func)(union l7vs_config_req *req, struct sockaddr_un *addr);
+};
+
+struct l7vs_config_table l7vs_config_table[] = {
+ {L7VS_CONFIG_LIST_VS, l7vs_config_list_vs},
+ {L7VS_CONFIG_LIST_RS, l7vs_config_list_rs},
+ {L7VS_CONFIG_ADD_VS, l7vs_config_add_vs},
+ {L7VS_CONFIG_DEL_VS, l7vs_config_del_vs},
+ {L7VS_CONFIG_EDIT_VS, l7vs_config_edit_vs},
+ {L7VS_CONFIG_ADD_RS, l7vs_config_add_rs},
+ {L7VS_CONFIG_DEL_RS, l7vs_config_del_rs},
+ {L7VS_CONFIG_EDIT_RS, l7vs_config_edit_rs},
+ {L7VS_CONFIG_FLUSH_VS, l7vs_config_flush_vs},
+ {L7VS_CONFIG_GET_REPLICATION_INFO,l7vs_config_get_replication_info},
+ {L7VS_CONFIG_REPLICATION, l7vs_config_replication},
+ {L7VS_CONFIG_GET_LOG_INFO, l7vs_config_get_log_info},
+ {L7VS_CONFIG_SET_LOG_LEVEL, l7vs_config_log},
+ {L7VS_CONFIG_SET_LOG_LEVEL_ALL, l7vs_config_log},
+ {L7VS_CONFIG_GET_SNMP_LOG_INFO, l7vs_config_get_snmp_log_info},
+ {L7VS_CONFIG_GET_SNMP_CONNECT_STATUS, l7vs_config_get_snmp_connect_status},
+ {L7VS_CONFIG_SET_SNMP_LOG_LEVEL, l7vs_config_snmp},
+ {L7VS_CONFIG_SET_SNMP_LOG_LEVEL_ALL,l7vs_config_snmp_all},
+ {L7VS_CONFIG_PARAMETER, l7vs_config_parameter},
+ {L7VS_CONFIG_NONE, NULL}
+};
+
+/*!
+ * config event dispatch
+ * @param[in] union l7vs_config_req request messege from l7vsadm
+ * @param[in] struct sockaddr_un l7vsd socket pointer
+ * @return void
+ */
+static void
+l7vs_config_dispatch(union l7vs_config_req *req, struct sockaddr_un *addr)
+{
+ struct l7vs_config_table *t;
+ struct iovec iov;
+ struct l7vs_config_rsp_unknown_cmd rsp;
+
+ if(logger_get_log_level(LOG_CAT_L7VSD_NETWORK) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,10,
+ "in_fuction: void l7vs_config_dispatch (union l7vs_config_req *req, struct sockaddr_un *addr)"
+ "req= %p: addr= %p",req,addr);
+ }
+ for (t = l7vs_config_table; t->cmd != L7VS_CONFIG_NONE; t++) {
+ if (t->cmd == req->cmd) {
+ break;
+ }
+ }
+
+ if (t->cmd == L7VS_CONFIG_NONE) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_EVENT,3,"Unknown command from config socket");
+ rsp.cmd = req->cmd;
+ rsp.code = L7VS_CONFIG_ERR_INVALID_COMMAND;
+ iov.iov_base = &rsp;
+ iov.iov_len = sizeof(rsp);
+ l7vs_config_send_response(addr, &iov, 1);
+ return;
+ }
+
+ t->func(req, addr);
+ if(logger_get_log_level(LOG_CAT_L7VSD_NETWORK) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,11,
+ "out_fuction: void l7vs_config_dispatch return void");
+ }
+}
+
+/*!
+ * config event list virtual service
+ * @param[in] union l7vs_config_req request messege from l7vsadm
+ * @param[in] struct sockaddr_un l7vsd socket pointer
+ * @return void
+ */
+static void
+l7vs_config_list_vs(union l7vs_config_req *arg,
+ struct sockaddr_un *addr)
+{
+ struct l7vs_config_req_list_vs *req = &arg->list_vs;
+ struct l7vs_config_rsp_list_vs rsp;
+ struct l7vs_service_arg_multi *sas;
+ struct iovec iov[2];
+ int iovlen;
+ int len;
+
+
+ if(logger_get_log_level(LOG_CAT_L7VSD_NETWORK) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,12,
+ "in_fuction: void l7vs_config_list_vs (union l7vs_config_req *arg, struct sockaddr_un *addr)"
+ "arg= %p: addr= %p",arg,addr);
+ }
+ if (!l7vs_config_iomux) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_ENVIRONMENT,3,"error / iom is null");
+ return;
+ }
+ l7vs_config_iomux->status = iomux_config_command_list_vs_received;
+
+ sas = NULL;
+ rsp.cmd = req->cmd;
+ rsp.code = 0;
+ rsp.num = 0;
+ iov[0].iov_base = &rsp;
+ iov[0].iov_len = sizeof(rsp);
+
+ len = l7vs_service_list_service_arg(&sas, &rsp.num);
+ if (len < 0) {
+ l7vs_config_iomux->status = iomux_config_command_nomem_error;
+ rsp.code = L7VS_CONFIG_ERR_NOMEM;
+ l7vs_config_send_response(addr, iov, 1);
+ return;
+ }
+
+ if (rsp.num == 0) {
+ iovlen = 1;
+ } else {
+ iov[1].iov_base = sas;
+ iov[1].iov_len = len;
+ iovlen = 2;
+ }
+
+ l7vs_config_iomux->status = iomux_config_command_list_vs_succeeded;
+
+ if(logger_get_log_level(LOG_CAT_L7VSD_SYSTEM_SOCKET) == LOG_LV_DEBUG){
+ char config_str[DEBUG_STR_LEN] = {0};
+
+ snprintf(config_str,DEBUG_STR_LEN,
+ "cmd=%d: "
+ "code=%d: "
+ "num=%d: ",
+ rsp.cmd,rsp.code,rsp.num);
+
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_PROGRAM,24,
+ "list VirtualService: send data=%s",
+ config_str);
+ }
+
+ l7vs_config_send_response(addr, iov, iovlen);
+ if (sas != NULL) {
+ free(sas);
+ }
+ if(logger_get_log_level(LOG_CAT_L7VSD_NETWORK) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,13,
+ "out_fuction: void l7vs_config_list_vs return void");
+ }
+ return;
+}
+
+/*!
+ * config event list real server
+ * @param[in] union l7vs_config_req request messege from l7vsadm
+ * @param[in] struct sockaddr_un l7vsd socket pointer
+ * @return void
+ */
+static void
+l7vs_config_list_rs(union l7vs_config_req *arg,
+ struct sockaddr_un *addr)
+{
+ struct l7vs_config_req_list_rs *req = &arg->list_rs;
+ struct l7vs_config_rsp_list_rs rsp;
+ struct l7vs_service_arg_multi *sarg;
+ struct l7vs_service *srv=NULL;
+ struct l7vs_dest_arg *das=NULL;
+ struct iovec iov[2];
+ int iovlen;
+ int ret;
+
+ if(logger_get_log_level(LOG_CAT_L7VSD_NETWORK) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,14,
+ "in_fuction: void l7vs_config_list_rs (union l7vs_config_req *arg, struct sockaddr_un *addr)"
+ "arg= %p: addr= %p",arg,addr);
+ }
+ if (!l7vs_config_iomux) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_ENVIRONMENT,4,"error / iom is null");
+ return;
+ }
+ l7vs_config_iomux->status = iomux_config_command_list_rs_received;
+
+ rsp.cmd = req->cmd;
+ rsp.code = 0;
+ iov[0].iov_base = &rsp;
+ iov[0].iov_len = sizeof(rsp);
+
+ sarg = (struct l7vs_service_arg_multi *)(req + 1);
+
+ srv = l7vs_service_lookup(sarg);
+ if (srv == NULL) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_ENVIRONMENT,5,"error / service not found");
+
+ l7vs_config_iomux->status = iomux_config_command_novs_error;
+ rsp.code = L7VS_CONFIG_ERR_NOVS;
+
+ if(logger_get_log_level(LOG_CAT_L7VSD_SYSTEM_SOCKET) == LOG_LV_DEBUG){
+ char config_str[DEBUG_STR_LEN] = {0};
+ snprintf(config_str,DEBUG_STR_LEN,
+ "cmd=%d: "
+ "code=%d: ",
+ rsp.cmd,rsp.code);
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_SYSTEM_SOCKET,2,
+ "list RealServer: send data=%s",
+ config_str);
+ }
+ l7vs_config_send_response(addr, iov, 1);
+ return;
+ }
+
+ l7vs_config_iomux->status = iomux_config_command_list_rs_vs_found;
+
+ ret = l7vs_service_list_dest_arg(srv, &das);
+ if (ret < 0) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_ENVIRONMENT,6,"error / dest not found");
+ l7vs_config_iomux->status = iomux_config_command_nomem_error;
+ rsp.code = L7VS_CONFIG_ERR_NOMEM;
+ if(logger_get_log_level(LOG_CAT_L7VSD_SYSTEM_SOCKET) == LOG_LV_DEBUG){
+ char config_str[DEBUG_STR_LEN] = {0};
+ snprintf(config_str,DEBUG_STR_LEN,
+ "cmd=%d: "
+ "code=%d: ",
+ rsp.cmd,rsp.code);
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_SYSTEM_SOCKET,3,
+ "list RealServer: send data=%s",
+ config_str);
+ }
+ l7vs_config_send_response(addr, iov, 1);
+ return;
+ }
+
+ rsp.num = ret;
+ if (ret == 0) {
+ iovlen = 1;
+ } else {
+ iov[1].iov_base = das;
+ iov[1].iov_len = ret * sizeof(*das);
+ iovlen = 2;
+ }
+
+ l7vs_config_iomux->status = iomux_config_command_list_rs_succeeded;
+ if(logger_get_log_level(LOG_CAT_L7VSD_SYSTEM_SOCKET) == LOG_LV_DEBUG){
+ char config_str[DEBUG_STR_LEN] = {0};
+ snprintf(config_str,DEBUG_STR_LEN,
+ "cmd=%d: "
+ "code=%d: ",
+ rsp.cmd,rsp.code);
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_SYSTEM_SOCKET,4,
+ "list RealServer: send data=%s",
+ config_str);
+ }
+
+ l7vs_config_send_response(addr, iov, iovlen);
+ if (das != NULL) {
+ free(das);
+ das = NULL;
+ }
+
+ if(logger_get_log_level(LOG_CAT_L7VSD_NETWORK) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,15,
+ "out_fuction: void l7vs_config_list_rs return void");
+ }
+}
+
+/*!
+ * config event add virtual service
+ * @param[in] union l7vs_config_req request messege from l7vsadm
+ * @param[in] struct sockaddr_un l7vsd socket pointer
+ * @return void
+ */
+static void
+l7vs_config_add_vs(union l7vs_config_req *arg,
+ struct sockaddr_un *addr)
+{
+ struct l7vs_config_req_operate_vs *req = &arg->operate_vs;
+ struct l7vs_config_rsp_operate_vs rsp;
+ struct l7vs_service_arg_multi *sarg;
+ struct l7vs_service *srv;
+ struct iovec iov;
+
+ if(logger_get_log_level(LOG_CAT_L7VSD_NETWORK) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,16,
+ "in_fuction: void l7vs_config_add_vs (union l7vs_config_req *arg, struct sockaddr_un *addr)"
+ "arg= %p: addr= %p",arg,addr);
+ }
+ if (!l7vs_config_iomux) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_ENVIRONMENT,7,"error / iom is null");
+ return;
+ }
+ l7vs_config_iomux->status = iomux_config_command_add_vs_received;
+
+ rsp.cmd = req->cmd;
+ rsp.code = 0;
+
+ iov.iov_base = &rsp;
+ iov.iov_len = sizeof(rsp);
+
+ sarg = (struct l7vs_service_arg_multi *)(req + 1);
+ srv = l7vs_service_lookup(sarg);
+ if (srv != NULL) {
+ if(logger_get_log_level(LOG_CAT_L7VSD_VIRTUAL_SERVICE) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_VIRTUAL_SERVICE,1,"ADD_VS: service already exists");
+ }
+ l7vs_config_iomux->status = iomux_config_command_vs_exist_error;
+ rsp.code = L7VS_CONFIG_ERR_VS_EXISTS;
+ goto out;
+ }
+
+ l7vs_config_iomux->status = iomux_config_command_add_vs_vs_not_found;
+
+ srv = l7vs_service_create(sarg, &rsp.code);
+ if (srv == NULL) {
+ if(logger_get_log_level(LOG_CAT_L7VSD_VIRTUAL_SERVICE) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_VIRTUAL_SERVICE,2,"ADD_VS: service already exists");
+ }
+ l7vs_config_iomux->status = iomux_config_command_vs_create_error;
+ goto out;
+ } else {
+ l7vs_config_iomux->status = iomux_config_command_add_vs_vs_created;
+ LOGGER_PUT_LOG_INFO(LOG_CAT_L7VSD_VIRTUAL_SERVICE,1,"ADD_VS: IFRM001: created a service ");
+ }
+
+ l7vs_config_iomux->status = iomux_config_command_add_vs_succeeded;
+
+out:
+ if(logger_get_log_level(LOG_CAT_L7VSD_SYSTEM_SOCKET) == LOG_LV_DEBUG){
+ char config_str[DEBUG_STR_LEN] = {0};
+ snprintf(config_str,DEBUG_STR_LEN,
+ "cmd=%d: "
+ "code=%d: ",
+ rsp.cmd,rsp.code);
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_SYSTEM_SOCKET,5,
+ "add VertualService: send data=%s",
+ config_str);
+ }
+ l7vs_config_send_response(addr, &iov, 1);
+ if(logger_get_log_level(LOG_CAT_L7VSD_NETWORK) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,17,
+ "out_fuction: void l7vs_config_add_vs return void");
+ }
+}
+
+/*!
+ * config event delete virtual service
+ * @param[in] union l7vs_config_req request messege from l7vsadm
+ * @param[in] struct sockaddr_un l7vsd socket pointer
+ * @return void
+ */
+static void
+l7vs_config_del_vs(union l7vs_config_req *arg,
+ struct sockaddr_un *addr)
+{
+ struct l7vs_config_req_operate_vs *req = &arg->operate_vs;
+ struct l7vs_config_rsp_operate_vs rsp;
+ struct l7vs_service_arg_multi *sarg;
+ struct l7vs_service *srv;
+ struct l7vs_dest *dest;
+ struct iovec iov;
+
+ if(logger_get_log_level(LOG_CAT_L7VSD_NETWORK) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,18,
+ "in_fuction: void l7vs_config_del_vs (union l7vs_config_req *arg, struct sockaddr_un *addr)"
+ "arg= %p: addr= %p",arg,addr);
+ }
+ if (!l7vs_config_iomux) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_ENVIRONMENT,8,"error / iom is null");
+ return;
+ }
+ l7vs_config_iomux->status = iomux_config_command_del_vs_received;
+
+ rsp.cmd = req->cmd;
+ rsp.code = 0;
+
+ iov.iov_base = &rsp;
+ iov.iov_len = sizeof(rsp);
+
+ sarg = (struct l7vs_service_arg_multi *)(req + 1);
+ srv = l7vs_service_lookup(sarg);
+ if (srv == NULL) {
+ if(logger_get_log_level(LOG_CAT_L7VSD_VIRTUAL_SERVICE) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_VIRTUAL_SERVICE,3,"DEL_VS: service nonexistent");
+ }
+ l7vs_config_iomux->status = iomux_config_command_novs_error;
+ rsp.code = L7VS_CONFIG_ERR_NOVS;
+ goto out;
+ }
+
+ l7vs_config_iomux->status = iomux_config_command_del_vs_vs_found;
+
+ while (g_list_length(srv->dest_list) > 0) {
+ dest = (struct l7vs_dest *)((g_list_first(srv->dest_list))->data);
+ srv->dest_list = g_list_remove(srv->dest_list, dest);
+ l7vs_dest_destroy(dest);
+ }
+
+ l7vs_config_iomux->status = iomux_config_command_del_vs_dest_destroyed;
+
+ l7vs_service_destroy(srv);
+
+ LOGGER_PUT_LOG_INFO(LOG_CAT_L7VSD_VIRTUAL_SERVICE,3,"DEL_VS: IFRM003: released virtual service");
+ l7vs_config_iomux->status = iomux_config_command_del_vs_succeeded;
+
+out:
+ if(logger_get_log_level(LOG_CAT_L7VSD_SYSTEM_SOCKET) == LOG_LV_DEBUG){
+ char config_str[DEBUG_STR_LEN] = {0};
+ snprintf(config_str,DEBUG_STR_LEN,
+ "cmd=%d: "
+ "code=%d: ",
+ rsp.cmd,rsp.code);
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_SYSTEM_SOCKET,6,
+ "delete VertualService: send data=%s",
+ config_str);
+ }
+ l7vs_config_send_response(addr, &iov, 1);
+ if(logger_get_log_level(LOG_CAT_L7VSD_NETWORK) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,19,
+ "out_fuction: void l7vs_config_del_vs retrurn void");
+ }
+}
+
+/*!
+ * config event edit virtual service
+ * @param[in] union l7vs_config_req request messege from l7vsadm
+ * @param[in] struct sockaddr_un l7vsd socket pointer
+ * @return void
+ */
+static void
+l7vs_config_edit_vs(union l7vs_config_req *arg,
+ struct sockaddr_un *addr)
+{
+ struct l7vs_config_req_operate_vs *req = &arg->operate_vs;
+ struct l7vs_config_rsp_operate_vs rsp;
+ struct l7vs_service_arg_multi *sarg;
+ struct l7vs_service *srv;
+ struct l7vs_scheduler *sched, *sched_old;
+ struct iovec iov;
+ int retval;
+
+ struct l7vs_service_arg_multi tmp_sarg;
+
+ if(logger_get_log_level(LOG_CAT_L7VSD_NETWORK) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,20,
+ "in_fuction: void l7vs_config_edit_vs (union l7vs_config_req *arg, struct sockaddr_un *addr)"
+ "arg= %p: addr= %p",arg,addr);
+ }
+
+ memset(&tmp_sarg,0x00,sizeof(struct l7vs_service_arg_multi));
+
+ if (!l7vs_config_iomux) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_ENVIRONMENT,9,"error / iom is null");
+ return;
+ }
+ l7vs_config_iomux->status = iomux_config_command_edit_vs_received;
+
+ rsp.cmd = req->cmd;
+ rsp.code = 0;
+
+ iov.iov_base = &rsp;
+ iov.iov_len = sizeof(rsp);
+
+ sarg = (struct l7vs_service_arg_multi *)(req + 1);
+ srv = l7vs_service_lookup(sarg);
+ if (srv == NULL) {
+ if(logger_get_log_level(LOG_CAT_L7VSD_VIRTUAL_SERVICE) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_VIRTUAL_SERVICE,4,"EDIT_VS: service nonexistent");
+ }
+ l7vs_config_iomux->status = iomux_config_command_novs_error;
+ rsp.code = L7VS_CONFIG_ERR_NOVS;
+ goto out;
+ }
+
+ l7vs_config_iomux->status = iomux_config_command_edit_vs_vs_found;
+
+
+ if(sarg->srv_arg.sorry_cc != -1) {
+ tmp_sarg.srv_arg.sorry_cc = sarg->srv_arg.sorry_cc;
+ } else{
+ tmp_sarg.srv_arg.sorry_cc = srv->sorry_cc;
+ }
+
+ memset(&(tmp_sarg.srv_arg.sorry_addr),0xff,sizeof(struct sockaddr_storage));
+ if(memcmp(&(tmp_sarg.srv_arg.sorry_addr),&(sarg->srv_arg.sorry_addr),
+ sizeof(struct sockaddr_storage))) {
+ memcpy(&(tmp_sarg.srv_arg.sorry_addr),
+ &(sarg->srv_arg.sorry_addr),
+ sizeof(struct sockaddr_storage));
+ } else{
+ memcpy(&(tmp_sarg.srv_arg.sorry_addr),
+ &(srv->sorry_dest->addr),
+ sizeof(struct sockaddr_in));
+ }
+
+ if(sarg->srv_arg.sorry_flag != -1) {
+ tmp_sarg.srv_arg.sorry_flag = sarg->srv_arg.sorry_flag;
+ } else{
+ tmp_sarg.srv_arg.sorry_flag = srv->sorry_flag;
+ }
+
+ if(sarg->srv_arg.qos_threshold_up != ULLONG_MAX) {
+ tmp_sarg.srv_arg.qos_threshold_up = sarg->srv_arg.qos_threshold_up;
+ } else{
+ tmp_sarg.srv_arg.qos_threshold_up = srv->qos_threshold_up;
+ }
+
+ if(sarg->srv_arg.qos_threshold_down != ULLONG_MAX) {
+ tmp_sarg.srv_arg.qos_threshold_down = sarg->srv_arg.qos_threshold_down;
+ } else{
+ tmp_sarg.srv_arg.qos_threshold_down = srv->qos_threshold_down;
+ }
+
+ retval = l7vs_service_set_QoS_Threshold( srv, &tmp_sarg );
+ if( 0 > retval ){
+ if(logger_get_log_level(LOG_CAT_L7VSD_NETWORK_QOS) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK_QOS,1,"EDIT_VS: QoS set failure");
+ }
+ l7vs_config_iomux->status = iomux_config_command_set_qos_error;
+ rsp.code = L7VS_CONFIG_ERR_QOSSET;
+ goto out;
+ }
+ if(logger_get_log_level(LOG_CAT_L7VSD_NETWORK_QOS) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK_QOS,2,"EDIT_VS: QoS set success");
+ }
+
+ retval = l7vs_service_set_SorryServer_Values( srv, &tmp_sarg );
+ if( 0 > retval ){
+ if(logger_get_log_level(LOG_CAT_L7VSD_SORRY_SERVER) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_SORRY_SERVER,1,"EDIT_VS: SorryServer set failure");
+ }
+ l7vs_config_iomux->status = iomux_config_command_set_sorry_server_error;
+ rsp.code = L7VS_CONFIG_ERR_SORRYSET;
+ goto out;
+ }
+ if(logger_get_log_level(LOG_CAT_L7VSD_SORRY_SERVER) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_SORRY_SERVER,2,"EDIT_VS: SorryServer set success");
+ }
+
+ memset(&(tmp_sarg.srv_arg.schedmod),0x00,sizeof(tmp_sarg.srv_arg.schedmod));
+ if(memcmp(&(tmp_sarg.srv_arg.schedmod),&(sarg->srv_arg.schedmod),
+ sizeof(tmp_sarg.srv_arg.schedmod))) {
+
+ sched = (struct l7vs_scheduler* )l7vs_sched_get(sarg->srv_arg.schedmod);
+ if (sched == NULL) {
+ if(logger_get_log_level(LOG_CAT_L7VSD_SCHEDULE) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_SCHEDULE,1,"EDIT_VS: unknown scheduler");
+ }
+ l7vs_config_iomux->status = iomux_config_command_nosched_error;
+ rsp.code = L7VS_CONFIG_ERR_NOSCHED;
+ goto out;
+ } else {
+ if(logger_get_log_level(LOG_CAT_L7VSD_SCHEDULE) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_SCHEDULE,2,"EDIT_VS: scheduler set success");
+ }
+ }
+
+ l7vs_config_iomux->status = iomux_config_command_edit_vs_sched_got;
+
+ sched_old = srv->scheduler;
+ if (sched != sched_old) {
+ l7vs_sched_unbind(sched_old, srv);
+ l7vs_sched_put(sched_old);
+ l7vs_sched_bind(sched, srv);
+ }
+ }
+
+ LOGGER_PUT_LOG_INFO(LOG_CAT_L7VSD_VIRTUAL_SERVICE,2,"EDIT_VS: IFRM002: changed virtual service");
+ l7vs_config_iomux->status = iomux_config_command_edit_vs_succeeded;
+
+out:
+ if(logger_get_log_level(LOG_CAT_L7VSD_SYSTEM_SOCKET) == LOG_LV_DEBUG){
+ char config_str[DEBUG_STR_LEN] = {0};
+ snprintf(config_str,DEBUG_STR_LEN,
+ "cmd=%d: "
+ "code=%d: ",
+ rsp.cmd,rsp.code);
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_SYSTEM_SOCKET,7,
+ "edit VertualService: send data=%s",
+ config_str);
+ }
+ l7vs_config_send_response(addr, &iov, 1);
+ if(logger_get_log_level(LOG_CAT_L7VSD_NETWORK) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,21,
+ "out_fuction: void l7vs_config_edit_vs return void");
+ }
+}
+
+/*!
+ * config event add real server
+ * @param[in] union l7vs_config_req request messege from l7vsadm
+ * @param[in] struct sockaddr_un l7vsd socket pointer
+ * @return void
+ */
+static void
+l7vs_config_add_rs(union l7vs_config_req *arg,
+ struct sockaddr_un *addr)
+{
+ struct l7vs_config_req_operate_rs *req = &arg->operate_rs;
+ struct l7vs_config_rsp_operate_rs rsp;
+ struct l7vs_service_arg_multi *sarg;
+ struct l7vs_service *srv;
+ struct iovec iov;
+ int ret;
+
+ if(logger_get_log_level(LOG_CAT_L7VSD_NETWORK) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,22,
+ "in_fuction: void l7vs_config_add_rs (union l7vs_config_req *arg, struct sockaddr_un *addr)"
+ "arg= %p: addr= %p",arg,addr);
+ }
+ if (!l7vs_config_iomux) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_ENVIRONMENT,10,"error / iom is null");
+ return;
+ }
+ l7vs_config_iomux->status = iomux_config_command_add_rs_received;
+
+ rsp.cmd = req->cmd;
+ rsp.code = 0;
+
+ iov.iov_base = &rsp;
+ iov.iov_len = sizeof(rsp);
+
+ sarg = (struct l7vs_service_arg_multi *)(req + 1);
+ srv = l7vs_service_lookup(sarg);
+ if (srv == NULL) {
+ if(logger_get_log_level(LOG_CAT_L7VSD_REAL_SERVER) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REAL_SERVER,1,"ADD_RS: service nonexistent");
+ }
+ l7vs_config_iomux->status = iomux_config_command_novs_error;
+ rsp.code = L7VS_CONFIG_ERR_NOVS;
+ goto out;
+ }
+
+ l7vs_config_iomux->status = iomux_config_command_add_rs_vs_found;
+
+ if (l7vs_service_lookup_dest(srv, &req->darg.addr) != NULL) {
+ if(logger_get_log_level(LOG_CAT_L7VSD_REAL_SERVER) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REAL_SERVER,2,"ADD_RS: real server already exists");
+ }
+ l7vs_config_iomux->status = iomux_config_command_rs_exist_error;
+ rsp.code = L7VS_CONFIG_ERR_RS_EXISTS;
+ goto out;
+ }
+
+ l7vs_config_iomux->status = iomux_config_command_add_rs_rs_not_found;
+
+ ret = l7vs_service_add_dest(srv, &req->darg);
+ if (ret < 0) {
+ if(logger_get_log_level(LOG_CAT_L7VSD_REAL_SERVER) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REAL_SERVER,3,"ADD_RS: failed to add real server");
+ }
+ l7vs_config_iomux->status = iomux_config_command_nomem_error;
+ rsp.code = L7VS_CONFIG_ERR_NOMEM;
+ goto out;
+ }
+
+ l7vs_config_iomux->status = iomux_config_command_add_rs_succeeded;
+
+out:
+ if(logger_get_log_level(LOG_CAT_L7VSD_SYSTEM_SOCKET) == LOG_LV_DEBUG){
+ char config_str[DEBUG_STR_LEN] = {0};
+ snprintf(config_str,DEBUG_STR_LEN,
+ "cmd=%d: "
+ "code=%d: ",
+ rsp.cmd,rsp.code);
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_SYSTEM_SOCKET,8,
+ "add RealServer: send data=%s",
+ config_str);
+ }
+ l7vs_config_send_response(addr, &iov, 1);
+ if(logger_get_log_level(LOG_CAT_L7VSD_NETWORK) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,23,
+ "out_fuction: void l7vs_config_add_rs return void");
+ }
+}
+
+/*!
+ * config event delete real server
+ * @param[in] union l7vs_config_req request messege from l7vsadm
+ * @param[in] struct sockaddr_un l7vsd socket pointer
+ * @return void
+ */
+static void
+l7vs_config_del_rs(union l7vs_config_req *arg,
+ struct sockaddr_un *addr)
+{
+ struct l7vs_config_req_operate_rs *req = &arg->operate_rs;
+ struct l7vs_config_rsp_operate_rs rsp;
+ struct l7vs_service_arg_multi *sarg;
+ struct l7vs_service *srv;
+ struct l7vs_dest *dest;
+ struct iovec iov;
+ int ret;
+
+ if(logger_get_log_level(LOG_CAT_L7VSD_NETWORK) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,24,
+ "in_fuction: void l7vs_config_del_rs (union l7vs_config_req *arg, struct sockaddr_un *addr)"
+ "arg= %p: addr= %p",arg,addr);
+ }
+ if (!l7vs_config_iomux) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_ENVIRONMENT,11,"error / iom is null");
+ return;
+ }
+ l7vs_config_iomux->status = iomux_config_command_del_rs_received;
+
+ rsp.cmd = req->cmd;
+ rsp.code = 0;
+
+ iov.iov_base = &rsp;
+ iov.iov_len = sizeof(rsp);
+
+ sarg = (struct l7vs_service_arg_multi *)(req + 1);
+ srv = l7vs_service_lookup(sarg);
+ if (srv == NULL) {
+ if(logger_get_log_level(LOG_CAT_L7VSD_REAL_SERVER) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REAL_SERVER,4,"DEL_RS: service nonexistent");
+ }
+ l7vs_config_iomux->status = iomux_config_command_novs_error;
+ rsp.code = L7VS_CONFIG_ERR_NOVS;
+ goto out;
+ }
+
+ l7vs_config_iomux->status = iomux_config_command_del_rs_vs_found;
+
+ dest = l7vs_service_lookup_dest(srv, &req->darg.addr);
+ if (dest == NULL) {
+ if(logger_get_log_level(LOG_CAT_L7VSD_REAL_SERVER) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REAL_SERVER,5,"DEL_RS: destination nonexistent");
+ }
+ l7vs_config_iomux->status = iomux_config_command_nors_error;
+ rsp.code = L7VS_CONFIG_ERR_NORS;
+ goto out;
+ }
+
+ l7vs_config_iomux->status = iomux_config_command_del_rs_rs_found;
+
+ ret = l7vs_service_remove_dest(srv, &req->darg);
+ if (ret < 0) {
+ if(logger_get_log_level(LOG_CAT_L7VSD_REAL_SERVER) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REAL_SERVER,6,"DEL_RS: failed to remove real server");
+ }
+ /* XXX actually impossible */
+ rsp.code = L7VS_CONFIG_ERR_NORS;
+ goto out;
+ }
+
+ l7vs_config_iomux->status = iomux_config_command_del_rs_succeeded;
+
+out:
+ if(logger_get_log_level(LOG_CAT_L7VSD_SYSTEM_SOCKET) == LOG_LV_DEBUG){
+ char config_str[DEBUG_STR_LEN] = {0};
+ snprintf(config_str,DEBUG_STR_LEN,
+ "cmd=%d: "
+ "code=%d: ",
+ rsp.cmd,rsp.code);
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_SYSTEM_SOCKET,9,
+ "delete RealServer: send data=%s",
+ config_str);
+ }
+ l7vs_config_send_response(addr, &iov, 1);
+ if(logger_get_log_level(LOG_CAT_L7VSD_NETWORK) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,25,
+ "out_fuction: void l7vs_config_del_rs return void");
+ }
+}
+
+/*!
+ * config event edit real server
+ * @param[in] union l7vs_config_req request messege from l7vsadm
+ * @param[in] struct sockaddr_un l7vsd socket pointer
+ * @return void
+ */
+static void
+l7vs_config_edit_rs(union l7vs_config_req *arg,
+ struct sockaddr_un *addr)
+{
+ struct l7vs_config_req_operate_rs *req = &arg->operate_rs;
+ struct l7vs_config_rsp_operate_rs rsp;
+ struct l7vs_service_arg_multi *sarg;
+ struct l7vs_service *srv;
+ struct l7vs_dest *dest;
+ struct iovec iov;
+
+ if(logger_get_log_level(LOG_CAT_L7VSD_NETWORK) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,26,
+ "in_fuction: void l7vs_config_edit_rs (union l7vs_config_req *arg, struct sockaddr_un *addr)"
+ "arg= %p: addr= %p",arg,addr);
+ }
+ if (!l7vs_config_iomux) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_ENVIRONMENT,12,"error / iom is null");
+ return;
+ }
+ l7vs_config_iomux->status = iomux_config_command_edit_rs_received;
+
+ rsp.cmd = req->cmd;
+ rsp.code = 0;
+
+ iov.iov_base = &rsp;
+ iov.iov_len = sizeof(rsp);
+
+ sarg = (struct l7vs_service_arg_multi *)(req + 1);
+ srv = l7vs_service_lookup(sarg);
+ if (srv == NULL) {
+ if(logger_get_log_level(LOG_CAT_L7VSD_REAL_SERVER) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REAL_SERVER,7,"EDIT_RS: service nonexistent");
+ }
+ rsp.code = L7VS_CONFIG_ERR_NOVS;
+ goto out;
+ }
+
+ l7vs_config_iomux->status = iomux_config_command_edit_rs_vs_found;
+
+ dest = l7vs_service_lookup_dest(srv, &req->darg.addr);
+ if (dest == NULL) {
+ if(logger_get_log_level(LOG_CAT_L7VSD_REAL_SERVER) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REAL_SERVER,8,"EDIT_RS: destination nonexistent");
+ }
+ rsp.code = L7VS_CONFIG_ERR_NORS;
+ goto out;
+ }
+
+ l7vs_config_iomux->status = iomux_config_command_edit_rs_rs_found;
+
+ if(req->darg.weight != -1){
+ dest->weight = req->darg.weight;
+ }
+
+ l7vs_config_iomux->status = iomux_config_command_edit_rs_succeeded;
+
+out:
+ if(logger_get_log_level(LOG_CAT_L7VSD_SYSTEM_SOCKET) == LOG_LV_DEBUG){
+ char config_str[DEBUG_STR_LEN] = {0};
+ snprintf(config_str,DEBUG_STR_LEN,
+ "cmd=%d: "
+ "code=%d: ",
+ rsp.cmd,rsp.code);
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_SYSTEM_SOCKET,10,
+ "edit RealServer: send data=%s",
+ config_str);
+ }
+ l7vs_config_send_response(addr, &iov, 1);
+ if(logger_get_log_level(LOG_CAT_L7VSD_NETWORK) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,27,
+ "out_fuction: void l7vs_config_edit_rs return void");
+ }
+}
+
+/*!
+ * config event delete all viertual service
+ * @param[in] union l7vs_config_req request messege from l7vsadm
+ * @param[in] struct sockaddr_un l7vsd socket pointer
+ * @return void
+ */
+static void
+l7vs_config_flush_vs(union l7vs_config_req *arg, struct sockaddr_un *addr)
+{
+ struct l7vs_config_req_flush_vs *req = &arg->flush_vs;
+ struct l7vs_config_rsp_flush_vs rsp;
+ struct iovec iov;
+
+ if(logger_get_log_level(LOG_CAT_L7VSD_NETWORK) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,28,
+ "in_fuction: void l7vs_config_flush_vs (union l7vs_config_req *arg, struct sockaddr_un *addr)"
+ "arg= %p: addr= %p",arg,addr);
+ }
+ if (!l7vs_config_iomux) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_ENVIRONMENT,13,"error / iom is null");
+ return;
+ }
+ l7vs_config_iomux->status = iomux_config_command_flush_vs_received;
+
+ rsp.cmd = req->cmd;
+ rsp.code = 0;
+
+ iov.iov_base = &rsp;
+ iov.iov_len = sizeof(rsp);
+
+ l7vs_service_flush_all();
+
+ l7vs_config_iomux->status = iomux_config_command_flush_vs_succeeded;
+
+ if(logger_get_log_level(LOG_CAT_L7VSD_SYSTEM_SOCKET) == LOG_LV_DEBUG){
+ char config_str[DEBUG_STR_LEN] = {0};
+ snprintf(config_str,DEBUG_STR_LEN,
+ "cmd=%d: "
+ "code=%d: ",
+ rsp.cmd,rsp.code);
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_SYSTEM_SOCKET,11,
+ "flush VertualService: send data=%s",
+ config_str);
+ }
+ l7vs_config_send_response(addr, &iov, 1);
+ if(logger_get_log_level(LOG_CAT_L7VSD_NETWORK) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,29,
+ "in_fuction: void l7vs_config_flush_vs return void");
+ }
+}
+
+/*!
+ * config send response
+ * @param[in] struct sockaddr_un l7vsd socket pointer
+ * @param[in] struct iovec sending messege
+ * @param[in] int sending messege size
+ * @return int sendmsg NG<0 OK >=0
+ */
+static int
+l7vs_config_send_response(struct sockaddr_un *addr,
+ struct iovec *iov,
+ int iovlen)
+{
+ struct msghdr msg;
+ int ret;
+ struct l7vs_config_rsp_unknown_cmd rsp;
+ struct iovec err_iov;
+
+ if(logger_get_log_level(LOG_CAT_L7VSD_NETWORK) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,30,
+ "in_fuction: int l7vs_config_send_response (struct sockaddr_un *addr,struct iovec *iov,int iovlen)"
+ "addr= %p : iov= %p : iovlen= %d",addr,iov,iovlen);
+ }
+
+ if (!l7vs_config_iomux) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_ENVIRONMENT,14,"error / iom is null");
+ return -1;
+ }
+
+ memset(&msg, 0, sizeof(msg));
+ msg.msg_name = addr;
+ msg.msg_namelen = sizeof(*addr);
+ msg.msg_iov = iov;
+ msg.msg_iovlen = iovlen;
+
+ ret = sendmsg(l7vs_config_iomux->fd, &msg, 0);
+ if (ret < 0) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_SYSTEM_SOCKET,5,"sendmsg on config socket: %s", strerror(errno));
+ // Try sending error response to l7vsadm.
+ rsp.cmd = ((struct l7vs_config_rsp_unknown_cmd *)(&iov->iov_base))->cmd;
+ rsp.code = L7VS_CONFIG_ERR_SENDMSG;
+ err_iov.iov_base = &rsp;
+ err_iov.iov_len = sizeof(rsp);
+ memset(&msg, 0, sizeof(msg));
+ msg.msg_name = addr;
+ msg.msg_namelen = sizeof(*addr);
+ msg.msg_iov = &err_iov;
+ msg.msg_iovlen = 1;
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_SYSTEM_SOCKET,6,"Try sending error response to l7vsadm.");
+ if (sendmsg(l7vs_config_iomux->fd, &msg, 0) < 0) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_SYSTEM_SOCKET,7,"retry error sendmsg on config socket: %s", strerror(errno));
+ }
+ }
+ l7vs_config_iomux->status = iomux_config_command_response_sent;
+
+ if(logger_get_log_level(LOG_CAT_L7VSD_NETWORK) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,31,
+ "out_fuction: int l7vs_config_send_response return ret = %d",ret);
+ }
+ return ret;
+}
+
+/*!
+ * config event get replication information
+ * @param[in] union l7vs_config_req messege pointer
+ * @param[in] struct sockaddr_un l7vsd socket pointer
+ * @return void
+ */
+static void
+l7vs_config_get_replication_info (union l7vs_config_req *arg, struct sockaddr_un *addr)
+{
+ struct l7vs_config_msg_replication *req = &arg->msg_replication;
+ struct l7vs_config_msg_replication rsp;
+ struct iovec iov;
+
+ if(logger_get_log_level(LOG_CAT_L7VSD_NETWORK) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,32,
+ "in_fuction: void l7vs_config_get_replication_info (union l7vs_config_req *arg, struct sockaddr_un *addr)"
+ "arg= %p: addr= %p",arg,addr);
+ }
+
+ if (!l7vs_config_iomux) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_ENVIRONMENT,15,"error / iom is null");
+ return;
+ }
+
+ memset(&rsp,0x00,sizeof(struct l7vs_config_msg_replication));
+ rsp.cmd = req->cmd;
+ rsp.code = 0;
+ iov.iov_base = &rsp;
+ iov.iov_len = sizeof(struct l7vs_config_msg_replication);
+ rsp.replication_mode = l7vs_replication_get_status();
+ if(logger_get_log_level(LOG_CAT_L7VSD_SYSTEM_SOCKET) == LOG_LV_DEBUG){
+ char config_str[DEBUG_STR_LEN] = {0};
+ snprintf(config_str,DEBUG_STR_LEN,
+ "cmd=%d: "
+ "code=%d: ",
+ rsp.cmd,rsp.code);
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_SYSTEM_SOCKET,12,
+ "get replication info: send data=%s",
+ config_str);
+ }
+ l7vs_config_send_response(addr, &iov, 1);
+ if(logger_get_log_level(LOG_CAT_L7VSD_NETWORK) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,33,
+ "out_fuction: void l7vs_config_get_replication_info return void");
+ }
+}
+
+/*!
+ * config event get snmp information
+ * @param[in] union l7vs_config_req messege pointer
+ * @param[in] struct sockaddr_un l7vsd socket pointer
+ * @return void
+ */
+static void
+l7vs_config_get_snmp_log_info (union l7vs_config_req *arg, struct sockaddr_un *addr)
+{
+ struct l7vs_config_msg_snmp *req = &arg->msg_snmp;
+ struct l7vs_config_msg_snmp rsp;
+ struct iovec iov;
+
+ if(logger_get_log_level(LOG_CAT_L7VSD_NETWORK) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,34,
+ "in_fuction: void l7vs_config_get_snmp_log_info (union l7vs_config_req *arg, struct sockaddr_un *addr)"
+ "arg= %p: addr= %p",arg,addr);
+ }
+
+ if (!l7vs_config_iomux) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_ENVIRONMENT,16,"error / iom is null");
+ return;
+ }
+
+ memset(&rsp,0x00,sizeof(struct l7vs_config_msg_snmp));
+ memcpy(&rsp,req,sizeof(struct l7vs_config_msg_snmp));
+ rsp.code = 0;
+ iov.iov_base = &rsp;
+ iov.iov_len = sizeof(rsp);
+ rsp.snmp_log_level = l7vs_snmpbridge_get_loglevel(rsp.kind);
+ if(logger_get_log_level(LOG_CAT_L7VSD_SYSTEM_SOCKET) == LOG_LV_DEBUG){
+ char config_str[DEBUG_STR_LEN] = {0};
+ snprintf(config_str,DEBUG_STR_LEN,
+ "cmd=%d: "
+ "code=%d: ",
+ rsp.cmd,rsp.code);
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_SYSTEM_SOCKET,13,
+ "get snmp log level: send data=%s",
+ config_str);
+ }
+ l7vs_config_send_response(addr, &iov, 1);
+ if(logger_get_log_level(LOG_CAT_L7VSD_NETWORK) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,35,
+ "out_fuction: void l7vs_config_get_snmp_log_info return void");
+ }
+}
+
+/*!
+ * config event get snmp connect status
+ * @param[in] union l7vs_config_req messege pointer
+ * @param[in] struct sockaddr_un l7vsd socket pointer
+ * @return void
+ */
+static void
+l7vs_config_get_snmp_connect_status (union l7vs_config_req *arg, struct sockaddr_un *addr)
+{
+ struct l7vs_config_msg_snmp *req = &arg->msg_snmp;
+ struct l7vs_config_msg_snmp rsp;
+ struct iovec iov;
+
+ if(logger_get_log_level(LOG_CAT_L7VSD_NETWORK) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,36,
+ "in_fuction: void l7vs_config_get_snmp_connect_status (union l7vs_config_req *arg, struct sockaddr_un *addr)"
+ "arg= %p: addr= %p",arg,addr);
+ }
+
+ if (!l7vs_config_iomux) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_ENVIRONMENT,17,"error / iom is null");
+ return;
+ }
+
+ memset(&rsp,0x00,sizeof(struct l7vs_config_msg_snmp));
+ memcpy(&rsp,req,sizeof(struct l7vs_config_msg_snmp));
+ rsp.code = 0;
+ iov.iov_base = &rsp;
+ iov.iov_len = sizeof(rsp);
+ rsp.connection_status = l7vs_snmpbridge_get_connectionstate();
+ if(logger_get_log_level(LOG_CAT_L7VSD_SYSTEM_SOCKET) == LOG_LV_DEBUG){
+ char config_str[DEBUG_STR_LEN] = {0};
+ snprintf(config_str,DEBUG_STR_LEN,
+ "cmd=%d: "
+ "code=%d: ",
+ rsp.cmd,rsp.code);
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_PROGRAM,25,
+ "get snmp connect status: send data=%s",
+ config_str);
+ }
+ l7vs_config_send_response(addr, &iov, 1);
+ if(logger_get_log_level(LOG_CAT_L7VSD_NETWORK) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,37,
+ "out_fuction: void l7vs_config_get_snmp_connect_status return void");
+ }
+}
+
+/*!
+ * config event get log level information
+ * @param[in] union l7vs_config_req messege pointer
+ * @param[in] struct sockaddr_un l7vsd socket pointer
+ * @return void
+ */
+static void
+l7vs_config_get_log_info (union l7vs_config_req *arg, struct sockaddr_un *addr)
+{
+ struct l7vs_config_msg_log *req = &arg->msg_log;
+ struct l7vs_config_msg_log rsp;
+ struct iovec iov;
+
+ if(logger_get_log_level(LOG_CAT_L7VSD_NETWORK) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,38,
+ "in_fuction: void l7vs_config_get_log_info (union l7vs_config_req *arg, struct sockaddr_un *addr)"
+ "arg= %p: addr= %p",arg,addr);
+ }
+ if (!l7vs_config_iomux) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_ENVIRONMENT,18,"error / iom is null");
+ return;
+ }
+
+ memset(&rsp,0x00,sizeof(struct l7vs_config_msg_log));
+ memcpy(&rsp,req,sizeof(struct l7vs_config_msg_log));
+ iov.iov_base = &rsp;
+ iov.iov_len = sizeof(rsp);
+ rsp.vsd_log_level = logger_get_log_level(req->kind);
+ if(logger_get_log_level(LOG_CAT_L7VSD_SYSTEM_SOCKET) == LOG_LV_DEBUG){
+ char config_str[DEBUG_STR_LEN] = {0};
+ snprintf(config_str,DEBUG_STR_LEN,
+ "cmd=%d: "
+ "code=%d: ",
+ rsp.cmd,rsp.code);
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_SYSTEM_SOCKET,14,
+ "get snmp connect status: send data=%s",
+ config_str);
+ }
+ l7vs_config_send_response(addr, &iov, 1);
+ if(logger_get_log_level(LOG_CAT_L7VSD_NETWORK) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,39,
+ "out_fuction: void l7vs_config_get_log_info return void");
+ }
+}
+
+/*!
+ * config event action replication
+ * @param[in] union l7vs_config_req messege pointer
+ * @param[in] struct sockaddr_un l7vsd socket pointer
+ * @return void
+ */
+static void
+l7vs_config_replication (union l7vs_config_req *arg, struct sockaddr_un *addr)
+{
+ struct l7vs_config_msg_replication *req = &arg->msg_replication;
+ struct l7vs_config_msg_replication rsp;
+ struct iovec iov;
+
+ if(logger_get_log_level(LOG_CAT_L7VSD_NETWORK) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,40,
+ "in_fuction: void l7vs_config_replication (union l7vs_config_req *arg, struct sockaddr_un *addr)"
+ "arg= %p: addr= %p",arg,addr);
+ }
+ if (!l7vs_config_iomux) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_ENVIRONMENT,19,"error / iom is null");
+ return;
+ }
+ memset(&rsp,0x00,sizeof(struct l7vs_config_msg_replication));
+ memcpy(&rsp,req,sizeof(struct l7vs_config_msg_replication));
+ rsp.code = 0;
+ iov.iov_base = &rsp;
+ iov.iov_len = sizeof(rsp);
+ switch(rsp.kind){
+ case L7VS_CONFIG_REPLICATION_DUMP:
+ l7vs_replication_dump_memory();
+ break;
+ case L7VS_CONFIG_REPLICATION_START:
+ l7vs_replication_start();
+ break;
+ case L7VS_CONFIG_REPLICATION_STOP:
+ l7vs_replication_stop();
+ break;
+ case L7VS_CONFIG_REPLICATION_COMPULSORILY:
+ l7vs_replication_compulsorily();
+ break;
+ }
+ if(logger_get_log_level(LOG_CAT_L7VSD_SYSTEM_SOCKET) == LOG_LV_DEBUG){
+ char config_str[DEBUG_STR_LEN] = {0};
+ snprintf(config_str,DEBUG_STR_LEN,
+ "cmd=%d: "
+ "code=%d: ",
+ rsp.cmd,rsp.code);
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_SYSTEM_SOCKET,15,
+ "config replication: send data=%s",
+ config_str);
+ }
+ l7vs_config_send_response(addr, &iov, 1);
+ if(logger_get_log_level(LOG_CAT_L7VSD_NETWORK) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,41,
+ "out_fuction: void l7vs_config_replication return void");
+ }
+}
+
+/*!
+ * config event change snmp bridge apointed category log level
+ * @param[in] union l7vs_config_req messege pointer
+ * @param[in] struct sockaddr_un l7vsd socket pointer
+ * @return void
+ */
+static void
+l7vs_config_snmp (union l7vs_config_req *arg, struct sockaddr_un *addr)
+{
+ struct l7vs_config_msg_snmp *req = &arg->msg_snmp;
+ struct l7vs_config_msg_snmp rsp;
+ struct iovec iov;
+
+ if(logger_get_log_level(LOG_CAT_L7VSD_NETWORK) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,42,
+ "in_fuction: void l7vs_config_snmp (union l7vs_config_req *arg, struct sockaddr_un *addr)"
+ "arg= %p: addr= %p",arg,addr);
+ }
+ if (!l7vs_config_iomux) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_ENVIRONMENT,20,"error / iom is null");
+ return;
+ }
+ memset(&rsp,0x00,sizeof(struct l7vs_config_msg_snmp));
+ memcpy(&rsp,req,sizeof(struct l7vs_config_msg_snmp));
+ rsp.code = 0;
+ iov.iov_base = &rsp;
+ iov.iov_len = sizeof(rsp);
+ l7vs_snmpbridge_change_loglevel(req->kind,req->snmp_log_level);
+ if(logger_get_log_level(LOG_CAT_L7VSD_SYSTEM_SOCKET) == LOG_LV_DEBUG){
+ char config_str[DEBUG_STR_LEN] = {0};
+ snprintf(config_str,DEBUG_STR_LEN,
+ "cmd=%d: "
+ "code=%d: ",
+ rsp.cmd,rsp.code);
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_SYSTEM_SOCKET,16,
+ "config snmp: send data=%s",
+ config_str);
+ }
+ l7vs_config_send_response(addr, &iov, 1);
+ if(logger_get_log_level(LOG_CAT_L7VSD_NETWORK) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,43,
+ "out_fuction: void l7vs_config_snmp return void");
+ }
+}
+
+/*!
+ * config event change snmp bridge all category log level
+ * @param[in] union l7vs_config_req messege pointer
+ * @param[in] struct sockaddr_un l7vsd socket pointer
+ * @return void
+ */
+static void
+l7vs_config_snmp_all (union l7vs_config_req *arg, struct sockaddr_un *addr)
+{
+ struct l7vs_config_msg_snmp *req = &arg->msg_snmp;
+ struct l7vs_config_msg_snmp rsp;
+ struct iovec iov;
+
+ if(logger_get_log_level(LOG_CAT_L7VSD_NETWORK) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,44,
+ "in_fuction: void l7vs_config_snmp_all (union l7vs_config_req *arg, struct sockaddr_un *addr)"
+ "arg= %p: addr= %p",arg,addr);
+ }
+ if (!l7vs_config_iomux) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_ENVIRONMENT,21,"error / iom is null");
+ return;
+ }
+ memset(&rsp,0x00,sizeof(struct l7vs_config_msg_snmp));
+ memcpy(&rsp,req,sizeof(struct l7vs_config_msg_snmp));
+ rsp.code = 0;
+ iov.iov_base = &rsp;
+ iov.iov_len = sizeof(rsp);
+ l7vs_snmpbridge_change_loglevel_allcategory(req->snmp_log_level);
+ if(logger_get_log_level(LOG_CAT_L7VSD_SYSTEM_SOCKET) == LOG_LV_DEBUG){
+ char config_str[DEBUG_STR_LEN] = {0};
+ snprintf(config_str,DEBUG_STR_LEN,
+ "cmd=%d: "
+ "code=%d: ",
+ rsp.cmd,rsp.code);
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_SYSTEM_SOCKET,17,
+ "config snmp: send data=%s",
+ config_str);
+ }
+ l7vs_config_send_response(addr, &iov, 1);
+ if(logger_get_log_level(LOG_CAT_L7VSD_NETWORK) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,45,
+ "out_fuction: void l7vs_config_snmp_all return void");
+ }
+}
+
+/*!
+ * config event change l7vsd apointed category log level
+ * @param[in] union l7vs_config_req messege pointer
+ * @param[in] struct sockaddr_un l7vsd socket pointer
+ * @return void
+ */
+static void
+l7vs_config_log (union l7vs_config_req *arg, struct sockaddr_un *addr)
+{
+ struct l7vs_config_msg_log *req = &arg->msg_log;
+ struct l7vs_config_msg_log rsp;
+ struct iovec iov;
+ LOG_CATEGORY_TAG log_start,log_stop;
+ int l_start,l_stop,i;
+
+ if(logger_get_log_level(LOG_CAT_L7VSD_NETWORK) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,46,
+ "in_fuction: void l7vs_config_log (union l7vs_config_req *arg, struct sockaddr_un *addr)"
+ "arg= %p: addr= %p",arg,addr);
+ }
+ if (!l7vs_config_iomux) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_ENVIRONMENT,22,"error / iom is null");
+ return;
+ }
+ memset(&rsp,0x00,sizeof(struct l7vs_config_msg_log));
+ memcpy(&rsp,req,sizeof(struct l7vs_config_msg_log));
+ rsp.code = 0;
+ iov.iov_base = &rsp;
+ iov.iov_len = sizeof(rsp);
+ if(rsp.cmd == L7VS_CONFIG_SET_LOG_LEVEL_ALL){
+ log_start = logger_get_category_range_start(LOG_MOD_L7VSD);
+ log_stop = logger_get_category_range_end(LOG_MOD_L7VSD);
+ l_start =(int)log_start;
+ l_stop = (int)log_stop;
+ for(i = log_start;i <= l_stop; i++){
+ logger_set_log_level((LOG_CATEGORY_TAG)i,req->vsd_log_level);
+ }
+
+ }
+ else{
+ logger_set_log_level(req->kind,req->vsd_log_level);
+ }
+
+ if(logger_get_log_level(LOG_CAT_L7VSD_SYSTEM_SOCKET) == LOG_LV_DEBUG){
+ char config_str[DEBUG_STR_LEN] = {0};
+ snprintf(config_str,DEBUG_STR_LEN,
+ "cmd=%d: "
+ "code=%d: ",
+ rsp.cmd,rsp.code);
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_SYSTEM_SOCKET,18,
+ "config log level: send data=%s",
+ config_str);
+ }
+ l7vs_config_send_response(addr, &iov, 1);
+ if(logger_get_log_level(LOG_CAT_L7VSD_NETWORK) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,47,
+ "out_fuction: void l7vs_config_log return void");
+ }
+}
+
+/*!
+ * config event relead parameter file
+ * @param[in] union l7vs_config_req messege pointer
+ * @param[in] struct sockaddr_un l7vsd socket pointer
+ * @return void
+ */
+static void
+l7vs_config_parameter (union l7vs_config_req *arg, struct sockaddr_un *addr)
+{
+ struct l7vs_config_msg_parameter *req = &arg->msg_parameter;
+ struct l7vs_config_msg_parameter rsp;
+ struct iovec iov;
+
+ if(logger_get_log_level(LOG_CAT_L7VSD_NETWORK) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,48,
+ "in_fuction: void l7vs_config_parameter (union l7vs_config_req *arg, struct sockaddr_un *addr)"
+ "arg= %p: addr= %p",arg,addr);
+ }
+
+ if (!l7vs_config_iomux) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_ENVIRONMENT,23,"error / iom is null");
+ return;
+ }
+ memset(&rsp,0x00,sizeof(struct l7vs_config_msg_parameter));
+ memcpy(&rsp,req,sizeof(struct l7vs_config_msg_parameter));
+ rsp.code = 0;
+ iov.iov_base = &rsp;
+ iov.iov_len = sizeof(rsp);
+ parameter_reread_file(req->category);
+ if(logger_get_log_level(LOG_CAT_L7VSD_SYSTEM_SOCKET) == LOG_LV_DEBUG){
+ char config_str[DEBUG_STR_LEN] = {0};
+ snprintf(config_str,DEBUG_STR_LEN,
+ "cmd=%d: "
+ "code=%d: ",
+ rsp.cmd,rsp.code);
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_SYSTEM_SOCKET,19,
+ "config parameter: send data=%s",
+ config_str);
+ }
+ l7vs_config_send_response(addr, &iov, 1);
+ if(logger_get_log_level(LOG_CAT_L7VSD_NETWORK) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,49,
+ "in_fuction: void l7vs_config_parameter return void");
+ }
+}
--- /dev/null
+/*
+ * @file conn.c
+ * @brief the connection management component
+ * @brief transmit data between client and realserver
+ * @brief and calls protocol module to decide realserver
+ * @brief also modify realserver data
+ *
+ * L7VSD: Linux Virtual Server for Layer7 Load Balancing
+ * Copyright (C) 2005 NTT COMWARE Corporation.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ **********************************************************************/
+
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <sys/select.h>
+#include <sys/time.h>
+#include <netinet/in.h>
+#include <netinet/tcp.h>
+#include <arpa/inet.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <stdlib.h>
+#include <assert.h>
+#include <glib.h>
+#include <limits.h>
+#include <errno.h>
+#include "logger_wrapper.h"
+#include "l7vs_config.h"
+#include "l7vs_iomuxlist.h"
+#include "l7vs_lsock.h"
+#include "l7vs_conn.h"
+#include "l7vs_service.h"
+#include "l7vs.h"
+#include "l7vs_module.h"
+#include "l7vs_sched.h"
+
+static int l7vs_conn_cl_callback(struct l7vs_iomux*);
+static int l7vs_conn_client_receiving(struct l7vs_iomux*);
+static int l7vs_conn_is_rs_connected(struct l7vs_iomux*, struct l7vs_conn*, struct l7vs_service**, struct l7vs_dest**);
+static int l7vs_conn_connection_establish(struct l7vs_iomux*, struct l7vs_conn*, struct l7vs_service*, struct l7vs_dest*);
+static int l7vs_conn_block(struct l7vs_iomux*, struct l7vs_iomux*);
+static int l7vs_conn_busy(struct l7vs_iomux*);
+static int l7vs_conn_sending(struct l7vs_iomux*, struct l7vs_iomux*);
+static int l7vs_conn_sent_next_state(struct l7vs_iomux*, struct l7vs_iomux*);
+static int l7vs_conn_rs_callback(struct l7vs_iomux* );
+static int l7vs_conn_realserver_receiving(struct l7vs_iomux*);
+static int l7vs_conn_realserver_modify_data(struct l7vs_iomux*);
+static int l7vs_conn_recv(struct l7vs_iomux*, int);
+static int l7vs_conn_preread(struct l7vs_iomux*, int);
+static int l7vs_conn_send(struct l7vs_iomux*, int);
+static int l7vs_conn_change_connect_rs(struct l7vs_conn*, struct l7vs_dest*);
+static int l7vs_conn_QoS_control( struct l7vs_conn *conn, int direction );
+static void l7vs_conn_QoS_recvsize_register( struct l7vs_conn *conn, const size_t in_recvsize, int direction );
+static void l7vs_conn_dump_data(char* str_data, const char* data, const size_t len);
+static int l7vs_conn_read_bufsize = 20480; //! conn read buffer size
+static int throughput_interval = BPS_DEFAULT_INTERVAL; //! throughput interval
+
+int
+l7vs_conn_init(void)
+{
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,341,
+ "in_function: int lvs_conn_init() ");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ int ret = parameter_is_int_exist( PARAM_COMP_CONN, "read_bufsize" );
+ if (ret) {
+ int bufsize = parameter_get_int_value( PARAM_COMP_CONN, "read_bufsize" );
+ if (bufsize >= L7VS_CONN_READ_BUFSIZE_MIN && bufsize <= L7VS_CONN_READ_BUFSIZE_MAX)
+ l7vs_conn_read_bufsize = bufsize;
+// LOGGER_PUT_LOG_INFO(LOG_CAT_L7VSD_NETWORK,5,
+// "l7vsd uses read_bufsize = %d ",bufsize);
+ else if (bufsize > L7VS_CONN_READ_BUFSIZE_MAX) {
+ l7vs_conn_read_bufsize = L7VS_CONN_READ_BUFSIZE_MAX;
+ LOGGER_PUT_LOG_WARN(LOG_CAT_L7VSD_NETWORK,1,
+ "Your read_bufsize is over maximum size. l7vsd uses maximum read_bufsize = %d instead ",L7VS_CONN_READ_BUFSIZE_MAX);
+ }
+ else {
+ l7vs_conn_read_bufsize = L7VS_CONN_READ_BUFSIZE_MIN;
+ LOGGER_PUT_LOG_WARN(LOG_CAT_L7VSD_NETWORK,2,
+ "Your read_bufsize is under minimum size. l7vsd uses minimum read_bufsize = %d instead ",L7VS_CONN_READ_BUFSIZE_MIN);
+ }
+ }
+ else {
+ LOGGER_PUT_LOG_WARN(LOG_CAT_L7VSD_NETWORK,3,
+ "read_bufsize is not specified. l7vsd uses default read_bufsize = %d ",l7vs_conn_read_bufsize);
+ }
+
+ if ( parameter_is_int_exist( PARAM_COMP_L7VSD, "calc_throughput_interval" ) ) {
+ throughput_interval = parameter_get_int_value( PARAM_COMP_L7VSD, "calc_throughput_interval" );
+ }
+
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,345,
+ "out_function: int lvs_conn_init() ");
+ }
+ /*------ DEBUG LOG END ------*/
+ return 1;
+}
+
+/*!
+ * dump data
+ *
+ * @param[out] str_data dump string
+ * @param[in] data source data
+ * @param[in] len source data length
+ * @return void
+ */
+void l7vs_conn_dump_data(char* str_data, const char* data, const size_t len)
+{
+ if (!str_data) {
+ return;
+ }
+
+ if (!data) {
+ snprintf(str_data, DEBUG_STR_LEN, "(nil)");
+ return;
+ }
+
+ const char* table[] = {
+ "00 ", "01 ", "02 ", "03 ", "04 ", "05 ", "06 ", "07 ", "08 ", "09 ", "0a ", "0b ", "0c ", "0d ", "0e ", "0f ",
+ "10 ", "11 ", "12 ", "13 ", "14 ", "15 ", "16 ", "17 ", "18 ", "19 ", "1a ", "1b ", "1c ", "1d ", "1e ", "1f ",
+ "20 ", "21 ", "22 ", "23 ", "24 ", "25 ", "26 ", "27 ", "28 ", "29 ", "2a ", "2b ", "2c ", "2d ", "2e ", "2f ",
+ "30 ", "31 ", "32 ", "33 ", "34 ", "35 ", "36 ", "37 ", "38 ", "39 ", "3a ", "3b ", "3c ", "3d ", "3e ", "3f ",
+ "40 ", "41 ", "42 ", "43 ", "44 ", "45 ", "46 ", "47 ", "48 ", "49 ", "4a ", "4b ", "4c ", "4d ", "4e ", "4f ",
+ "50 ", "51 ", "52 ", "53 ", "54 ", "55 ", "56 ", "57 ", "58 ", "59 ", "5a ", "5b ", "5c ", "5d ", "5e ", "5f ",
+ "60 ", "61 ", "62 ", "63 ", "64 ", "65 ", "66 ", "67 ", "68 ", "69 ", "6a ", "6b ", "6c ", "6d ", "6e ", "6f ",
+ "70 ", "71 ", "72 ", "73 ", "74 ", "75 ", "76 ", "77 ", "78 ", "79 ", "7a ", "7b ", "7c ", "7d ", "7e ", "7f ",
+ "80 ", "81 ", "82 ", "83 ", "84 ", "85 ", "86 ", "87 ", "88 ", "89 ", "8a ", "8b ", "8c ", "8d ", "8e ", "8f ",
+ "90 ", "91 ", "92 ", "93 ", "94 ", "95 ", "96 ", "97 ", "98 ", "99 ", "9a ", "9b ", "9c ", "9d ", "9e ", "9f ",
+ "a0 ", "a1 ", "a2 ", "a3 ", "a4 ", "a5 ", "a6 ", "a7 ", "a8 ", "a9 ", "aa ", "ab ", "ac ", "ad ", "ae ", "af ",
+ "b0 ", "b1 ", "b2 ", "b3 ", "b4 ", "b5 ", "b6 ", "b7 ", "b8 ", "b9 ", "ba ", "bb ", "bc ", "bd ", "be ", "bf ",
+ "c0 ", "c1 ", "c2 ", "c3 ", "c4 ", "c5 ", "c6 ", "c7 ", "c8 ", "c9 ", "ca ", "cb ", "cc ", "cd ", "ce ", "cf ",
+ "d0 ", "d1 ", "d2 ", "d3 ", "d4 ", "d5 ", "d6 ", "d7 ", "d8 ", "d9 ", "da ", "db ", "dc ", "dd ", "de ", "df ",
+ "e0 ", "e1 ", "e2 ", "e3 ", "e4 ", "e5 ", "e6 ", "e7 ", "e8 ", "e9 ", "ea ", "eb ", "ec ", "ed ", "ee ", "ef ",
+ "f0 ", "f1 ", "f2 ", "f3 ", "f4 ", "f5 ", "f6 ", "f7 ", "f8 ", "f9 ", "fa ", "fb ", "fc ", "fd ", "fe ", "ff "
+ };
+ const int hx_len = 3;
+
+ size_t pos = 0;
+ for (size_t i = 0; i < len; ++i) {
+ if (DEBUG_STR_LEN <= pos + hx_len) {
+ break;
+ }
+ strncpy(str_data + pos, table[(unsigned char)*(data + i)], hx_len);
+ pos += hx_len;
+ }
+ *(str_data + pos) = '\0';
+}
+
+/*!
+ * connection create
+ *
+ * @param[in] lfd listening socket fd
+ * @param[in] lsock listening socket
+ * @return connection
+ */
+struct l7vs_conn *
+l7vs_conn_create(int lfd, struct l7vs_lsock *lsock)
+{
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ char lsock_str[DEBUG_STR_LEN] = {0};
+ l7vs_lsock_c_str(lsock_str, lsock);
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,50,
+ "in_function: struct l7vs_conn* lvs_conn_create(int fd, struct l7vs_lsock *lsock) "
+ "lfd=%d: "
+ "lsock=%s",
+ lfd, lsock_str);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ socklen_t len = 0;
+ struct l7vs_conn *conn = NULL;
+ int mss = 0;
+ int ret = 0;
+ int flags = 0;
+
+ if (-1 == lfd) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_PROGRAM,28, "error / lsock fd is not specified");
+ goto create_error;
+ }
+
+ if (!lsock) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_PROGRAM,29, "error / lsock is null");
+ goto create_error;
+ }
+
+ conn = (struct l7vs_conn*)malloc(sizeof(struct l7vs_conn));
+ if (!conn) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_SYSTEM_MEMORY,8, "error / can not allocate memory");
+ goto create_error;
+ }
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,51,
+ "malloc: conn=%p: size=%zu",
+ conn, sizeof(struct l7vs_conn));
+ }
+ /*------ DEBUG LOG END ------*/
+ memset(conn, 0, sizeof(struct l7vs_conn));
+
+ conn->ciom = l7vs_iomux_get_from_avail_list();
+ if (!conn->ciom) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_NETWORK,7, "error / can not get client iom");
+ goto create_error;
+ }
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ char ciom_str[DEBUG_STR_LEN] = {0};
+ l7vs_iomux_c_str(ciom_str, conn->ciom);
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,52,
+ "iom_get: conn->ciom=%s",
+ ciom_str);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ conn->riom = l7vs_iomux_get_from_avail_list();
+ if (!conn->riom) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_NETWORK,8, "error / can not get realserver iom");
+ goto create_error;
+ }
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ char riom_str[DEBUG_STR_LEN] = {0};
+ l7vs_iomux_c_str(riom_str, conn->riom);
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,53,
+ "iom_get: conn->riom=%s",
+ riom_str);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ conn->cldata_len = 0;
+ conn->cldata_bufsize = l7vs_conn_read_bufsize;
+ conn->cldata = (char *)malloc(conn->cldata_bufsize);
+ if (!conn->cldata) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_SYSTEM_MEMORY,9, "error / can not allocate memory for buffer");
+ goto create_error;
+ }
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,54,
+ "malloc: conn->cldata=%p: size=%zu",
+ conn->cldata, conn->cldata_bufsize);
+ }
+ /*------ DEBUG LOG END ------*/
+ memset(conn->cldata, 0, conn->cldata_bufsize);
+
+ len = sizeof(struct sockaddr_in);
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ char caddr_str[DEBUG_STR_LEN] = {0};
+ l7vs_conn_sockaddr_in_c_str(caddr_str, &conn->caddr);
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,55,
+ "accept param: lfd=%d: conn->caddr=%s: len=%d",
+ lfd, caddr_str, len);
+ }
+ /*------ DEBUG LOG END ------*/
+ conn->ciom->fd = accept(lfd, (struct sockaddr *)&conn->caddr, &len);
+ if (conn->ciom->fd < 0) {
+ char caddr_str[DEBUG_STR_LEN] = {0};
+ l7vs_conn_sockaddr_in_c_str(caddr_str, &conn->caddr);
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_SYSTEM_SOCKET,8,
+ "error / accept error accept param: lfd=%d: conn->caddr=%s: len=%d (%s)",
+ lfd, caddr_str, len,strerror(errno));
+ goto create_error;
+ }
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,56,
+ "accept result: conn->ciom->fd=%d",
+ conn->ciom->fd);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ // get current flag
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,57,
+ "fnctl param: conn->ciom->fd=%d: cmd=F_GETFL: flags=0",
+ conn->ciom->fd);
+ }
+ /*------ DEBUG LOG END ------*/
+ flags = fcntl(conn->ciom->fd, F_GETFL, 0);
+ if (0 > flags) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_SYSTEM_SOCKET,9,
+ "error / fcntl((conn->ciom->fd=%d),F_GETFL) error(%s)",
+ conn->ciom->fd,strerror(errno));
+ goto create_error;
+ }
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,58,
+ "fnctl result: flags=%d",
+ flags);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ // set nonblocking
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,59,
+ "fnctl param: conn->ciom->fd=%d: cmd=F_SETFL: flags=%d",
+ conn->ciom->fd, (flags | O_NONBLOCK));
+ }
+ /*------ DEBUG LOG END ------*/
+ flags = fcntl(conn->ciom->fd, F_SETFL, flags | O_NONBLOCK);
+ if (0 > flags) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_SYSTEM_SOCKET,10,
+ "error / fcntl((conn->ciom->fd=%d),F_SETFL) error(%s)",
+ conn->ciom->fd,strerror(errno));
+ goto create_error;
+ }
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,60,
+ "fnctl result: flags=%d",
+ flags);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ // get client mss
+ len = sizeof(int);
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,61,
+ "getsockopt param: conn->ciom->fd=%d: level=IPROTO_TCP: optname=TCP_MAXSEG: "
+ "len=%d",
+ conn->ciom->fd, len);
+ }
+ /*------ DEBUG LOG END ------*/
+ ret = getsockopt(conn->ciom->fd, IPPROTO_TCP, TCP_MAXSEG, &mss, &len);
+ if (0 > ret) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_SYSTEM_SOCKET,11, "error / getsockopt TCP_MAXSEG error(%s)", strerror(errno));
+ goto create_error;
+ }
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,62,
+ "getsockopt result: mss=%d: len=%d",
+ mss, len);
+ }
+ /*------ DEBUG LOG END ------*/
+ conn->cmss = mss;
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,63, "client %s mss %d",
+ inet_ntoa(conn->caddr.sin_addr), mss);
+ }
+
+ conn->lsock = lsock;
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ char lsock_str[DEBUG_STR_LEN] = {0};
+ l7vs_lsock_c_str(lsock_str, lsock);
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,64,
+ "pointer_assign: conn->lsock=%s",
+ lsock_str);
+ }
+ /*------ DEBUG LOG END ------*/
+ conn->proto = lsock->proto;
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,65,
+ "conn->ciom->status change: %d->%d",
+ conn->ciom->status, iomux_conn_receiving);
+ }
+ /*------ DEBUG LOG END ------*/
+ conn->ciom->status = iomux_conn_receiving;
+ conn->ciom->callback = l7vs_conn_cl_callback;
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,66,
+ "pointer_assign: conn->ciom->callback=%p",
+ l7vs_conn_cl_callback);
+ }
+ /*------ DEBUG LOG END ------*/
+ conn->ciom->data = conn;
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ char conn_str[DEBUG_STR_LEN] = {0};
+ l7vs_conn_c_str(conn_str, conn);
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,67,
+ "pointer_assign: conn->ciom->data=%s",
+ conn_str);
+ }
+ /*------ DEBUG LOG END ------*/
+ conn->sorry_conn_flag = 0;
+ conn->old_dest = NULL;
+ l7vs_iomux_add(conn->ciom, iom_read);
+
+ // connect real server immediately if all lsock services are fast schedule.
+ if (lsock->fast_schedule) {
+ struct l7vs_service* srv;
+ struct l7vs_dest* dest;
+ conn->ciom->status = iomux_conn_received;
+ if (!l7vs_conn_is_rs_connected(conn->ciom, conn, &srv, &dest)) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_NETWORK,16, "error / is realserver connected failed");
+ }
+ else {
+ switch (conn->ciom->status) {
+ case iomux_conn_block:
+ //already decided real server
+ break;
+ case iomux_conn_service_selected:
+ //service and destination were selected then attempt to connect the real server
+ if (!l7vs_conn_connection_establish(conn->ciom, conn, srv, dest)) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_NETWORK,17, "error / client connect rs failed");
+ }
+ break;
+ default:
+ //invalid status
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_PROGRAM,34, "error / invalid status(%d)", conn->ciom->status);
+ break;
+ }
+ }
+ }
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ char ret_conn_str[DEBUG_STR_LEN] = {0};
+ l7vs_conn_c_str(ret_conn_str, conn);
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,68,
+ "out_function: struct l7vs_conn* lvs_conn_create(int fd, struct l7vs_lsock *lsock) "
+ "return_value: conn=%s",
+ ret_conn_str);
+ }
+ /*------ DEBUG LOG END ------*/
+ return conn;
+
+create_error:
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,69,
+ "entering: create_error_label");
+ }
+ /*------ DEBUG LOG END ------*/
+ if (conn) {
+ if (conn->ciom) {
+ if (-1 != conn->ciom->fd) {
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,70,
+ "close: conn->ciom->fd=%d",
+ conn->ciom->fd);
+ }
+ /*------ DEBUG LOG END ------*/
+ close(conn->ciom->fd);
+ }
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ char put_ciom_str[DEBUG_STR_LEN] = {0};
+ l7vs_iomux_c_str(put_ciom_str, conn->ciom);
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,71,
+ "iom_put: conn->ciom=%s",
+ put_ciom_str);
+ }
+ /*------ DEBUG LOG END ------*/
+ l7vs_iomux_put_to_avail_list(conn->ciom);
+ }
+ if (conn->riom) {
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ char put_riom_str[DEBUG_STR_LEN] = {0};
+ l7vs_iomux_c_str(put_riom_str, conn->riom);
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,72,
+ "iom_put: conn->riom=%s",
+ put_riom_str);
+ }
+ /*------ DEBUG LOG END ------*/
+ l7vs_iomux_put_to_avail_list(conn->riom);
+ }
+ if (conn->cldata) {
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,73,
+ "free: conn->cldata=%p",
+ conn->cldata);
+ }
+ /*------ DEBUG LOG END ------*/
+ free(conn->cldata);
+ }
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,74,
+ "free: conn=%p",
+ conn);
+ }
+ /*------ DEBUG LOG END ------*/
+ free(conn);
+ }
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,75,
+ "out_function: struct l7vs_conn* lvs_conn_create(int fd, struct l7vs_lsock *lsock) "
+ "return_value: conn=NULL");
+ }
+ /*------ DEBUG LOG END ------*/
+ return NULL;
+}
+
+/*!
+ * connection destroy
+ *
+ * @param[in] conn connection
+ * @return void
+ */
+void
+l7vs_conn_destroy(struct l7vs_conn *conn)
+{
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ char conn_str[DEBUG_STR_LEN] = {0};
+ l7vs_conn_c_str(conn_str, conn);
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,76,
+ "in_function: void l7vs_conn_destroy(struct l7vs_conn *conn) "
+ "conn=%s",
+ conn_str);
+ }
+ /*------ DEBUG LOG END ------*/
+ if (!conn) {
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,77,
+ "out_function: void l7vs_conn_destroy(struct l7vs_conn *conn) "
+ "return_value: void");
+ }
+ /*------ DEBUG LOG END ------*/
+ return;
+ }
+
+ if (conn->srv) {
+ l7vs_service_remove_conn(conn->srv, conn);
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,78,
+ "pointer_assign: conn->srv=NULL");
+ }
+ /*------ DEBUG LOG END ------*/
+ conn->srv = NULL;
+ }
+
+ if (conn->ciom) {
+ if (-1 != conn->ciom->fd) {
+ l7vs_conn_close_csock(conn);
+ }
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ char put_ciom_str[DEBUG_STR_LEN] = {0};
+ l7vs_iomux_c_str(put_ciom_str, conn->ciom);
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,79,
+ "iom_put: conn->ciom=%s",
+ put_ciom_str);
+ }
+ /*------ DEBUG LOG END ------*/
+ l7vs_iomux_put_to_avail_list(conn->ciom);
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,80,
+ "pointer_assign: conn->ciom=NULL");
+ }
+ /*------ DEBUG LOG END ------*/
+ conn->ciom = NULL;
+ }
+
+ if (conn->riom) {
+ if (-1 != conn->riom->fd) {
+ l7vs_conn_close_rsock(conn);
+ }
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ char put_riom_str[DEBUG_STR_LEN] = {0};
+ l7vs_iomux_c_str(put_riom_str, conn->riom);
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,81,
+ "iom_put: conn->riom=%s",
+ put_riom_str);
+ }
+ /*------ DEBUG LOG END ------*/
+ l7vs_iomux_put_to_avail_list(conn->riom);
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,82,
+ "pointer_assign: conn->riom=NULL");
+ }
+ /*------ DEBUG LOG END ------*/
+ conn->riom = NULL;
+ }
+
+ if (conn->cldata) {
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,83,
+ "free: conn->cldata=%p",
+ conn->cldata);
+ }
+ /*------ DEBUG LOG END ------*/
+ free(conn->cldata);
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,84,
+ "pointer_assign: conn->cldata=NULL");
+ }
+ /*------ DEBUG LOG END ------*/
+ conn->cldata = NULL;
+ }
+
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,85,
+ "free: conn=%p",
+ conn);
+ }
+ /*------ DEBUG LOG END ------*/
+ free(conn);
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,86,
+ "out_function: void l7vs_conn_destroy(struct l7vs_conn *conn) "
+ "return_value: void");
+ }
+ /*------ DEBUG LOG END ------*/
+}
+
+/*!
+ * client connection callback
+ *
+ * @param[in] iom connection iomux
+ * @return status
+ * @retval 0 failed
+ * @retval 1 succeed
+ */
+static int
+l7vs_conn_cl_callback(struct l7vs_iomux *iom )
+{
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ char iom_str[DEBUG_STR_LEN] = {0};
+ l7vs_iomux_c_str(iom_str, iom);
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,87,
+ "in_function: static int l7vs_conn_cl_callback(struct l7vs_iomux *iom ) "
+ "iom=%s",
+ iom_str);
+ }
+ /*------ DEBUG LOG END ------*/
+ struct l7vs_conn* conn = NULL;
+
+ if (!iom) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_PROGRAM,30, "error / iom is null");
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,88,
+ "out_function: static int l7vs_conn_cl_callback(struct l7vs_iomux *iom ) "
+ "return_value: 0");
+ }
+ /*------ DEBUG LOG END ------*/
+ return 0;
+ }
+
+ conn = (struct l7vs_conn *)iom->data;
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ char conn_str[DEBUG_STR_LEN] = {0};
+ l7vs_conn_c_str(conn_str, conn);
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,89,
+ "pointer_assign: conn=%s",
+ conn_str);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ // invalid status check
+ if (iomux_conn_receiving != iom->status &&
+ iomux_conn_block != iom->status &&
+ iomux_conn_busy != iom->status &&
+ iomux_conn_sending != iom->status &&
+ iomux_conn_sending_busy != iom->status) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_PROGRAM,31, "error / invalid status(%d)", iom->status);
+ l7vs_conn_destroy(conn);
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,90,
+ "out_function: static int l7vs_conn_cl_callback(struct l7vs_iomux *iom ) "
+ "return_value: 0");
+ }
+ /*------ DEBUG LOG END ------*/
+ return 0;
+ }
+
+ // switch by current status
+ switch (iom->status) {
+ case iomux_conn_receiving:
+ if (!l7vs_conn_client_receiving(iom)) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_NETWORK,9, "error / cl_callback/client receiving failed");
+ l7vs_conn_destroy(conn);
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,91,
+ "out_function: static int l7vs_conn_cl_callback(struct l7vs_iomux *iom ) "
+ "return_value: 0");
+ }
+ /*------ DEBUG LOG END ------*/
+ return 0;
+ }
+ if (iomux_conn_disconnected == iom->status) {
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,92, "client connection disconnected");
+ }
+ l7vs_conn_destroy(conn);
+ }
+ break;
+ case iomux_conn_block:
+ if (!l7vs_conn_block(iom, conn->riom)) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_NETWORK,10, "error / cl_callback/block failed");
+ l7vs_conn_destroy(conn);
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,93,
+ "out_function: static int l7vs_conn_cl_callback(struct l7vs_iomux *iom ) "
+ "return_value: 0");
+ }
+ /*------ DEBUG LOG END ------*/
+ return 0;
+ }
+ break;
+ case iomux_conn_busy:
+ if (!l7vs_conn_busy(iom)) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_NETWORK,11, "error / cl_callback/busy failed");
+ l7vs_conn_destroy(conn);
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,94,
+ "out_function: static int l7vs_conn_cl_callback(struct l7vs_iomux *iom ) "
+ "return_value: 0");
+ }
+ /*------ DEBUG LOG END ------*/
+ return 0;
+ }
+ break;
+ case iomux_conn_sending:
+ if (!l7vs_conn_sending(iom, conn->riom)) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_NETWORK,12, "error / cl_callback/sending failed");
+ l7vs_conn_destroy(conn);
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,95,
+ "out_function: static int l7vs_conn_cl_callback(struct l7vs_iomux *iom ) "
+ "return_value: 0");
+ }
+ /*------ DEBUG LOG END ------*/
+ return 0;
+ }
+ break;
+ case iomux_conn_sending_busy:
+ if (!l7vs_conn_sending(iom, conn->riom)) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_NETWORK,13, "error / cl_callback/sending_busy failed");
+ l7vs_conn_destroy(conn);
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,96,
+ "out_function: static int l7vs_conn_cl_callback(struct l7vs_iomux *iom ) "
+ "return_value: 0");
+ }
+ /*------ DEBUG LOG END ------*/
+ return 0;
+ }
+ break;
+ default:
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_NETWORK,14, "error / invalid status(%d)", iom->status);
+ l7vs_conn_destroy(conn);
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,97,
+ "out_function: static int l7vs_conn_cl_callback(struct l7vs_iomux *iom ) "
+ "return_value: 0");
+ }
+ /*------ DEBUG LOG END ------*/
+ return 0;
+ }
+
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,98,
+ "out_function: static int l7vs_conn_cl_callback(struct l7vs_iomux *iom ) "
+ "return_value: 1");
+ }
+ /*------ DEBUG LOG END ------*/
+ return 1;
+}
+
+/*!
+ * client receiving
+ *
+ * @param[in] iom connection iomux
+ * @return status
+ * @retval 0 failed
+ * @retval 1 succeed
+ */
+static int
+l7vs_conn_client_receiving(struct l7vs_iomux *iom)
+{
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ char iom_str[DEBUG_STR_LEN] = {0};
+ l7vs_iomux_c_str(iom_str, iom);
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,99,
+ "in_function: static int l7vs_conn_client_receiving(struct l7vs_iomux *iom) "
+ "iom=%s",
+ iom_str);
+ }
+ /*------ DEBUG LOG END ------*/
+ struct l7vs_conn *conn = NULL;
+ struct l7vs_service *srv = NULL;
+ struct l7vs_dest *dest = NULL;
+
+ if (!iom) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_PROGRAM,32, "error / iom is null");
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,100,
+ "out_function: static int l7vs_conn_client_receiving(struct l7vs_iomux *iom) "
+ "return_value: 0");
+ }
+ /*------ DEBUG LOG END ------*/
+ return 0;
+ }
+
+ if (iomux_conn_receiving != iom->status) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_PROGRAM,33, "error / invalid status(%d)", iom->status);
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,101,
+ "out_function: static int l7vs_conn_client_receiving(struct l7vs_iomux *iom) "
+ "return_value: 0");
+ }
+ /*------ DEBUG LOG END ------*/
+ return 0;
+ }
+
+ conn = (struct l7vs_conn *)iom->data;
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ char conn_str[DEBUG_STR_LEN] = {0};
+ l7vs_conn_c_str(conn_str, conn);
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,102,
+ "pointer_assign: conn=%s",
+ conn_str);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ // when the real server is not set in read-blocked
+ if (iomux_conn_block != conn->riom->status && iomux_conn_busy != conn->riom->status) {
+ // set the real server in read-blocked
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,103,
+ "conn->riom->status change: %d->%d",
+ conn->riom->status, iomux_conn_block);
+ }
+ /*------ DEBUG LOG END ------*/
+ conn->riom->status = iomux_conn_block;
+ }
+
+ // receive client data
+ if (!l7vs_conn_recv(iom, iom->fd)) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_NETWORK,15, "error / recv failed");
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,104,
+ "out_function: static int l7vs_conn_client_receiving(struct l7vs_iomux *iom) "
+ "return_value: 0");
+ }
+ /*------ DEBUG LOG END ------*/
+ return 0;
+ }
+ switch (iom->status) {
+ case iomux_conn_receiving:
+ // data still remain, epoll re-registration for read
+ l7vs_iomux_mod(iom, iom_read);
+ break;
+ case iomux_conn_received:
+ // all data is received, service is selected by using the received data
+ if (!l7vs_conn_is_rs_connected(iom, conn, &srv, &dest)) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_NETWORK,16, "error / is realserver connected failed");
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,105,
+ "out_function: static int l7vs_conn_client_receiving(struct l7vs_iomux *iom) "
+ "return_value: 0");
+ }
+ /*------ DEBUG LOG END ------*/
+ return 0;
+ }
+ switch (iom->status) {
+ case iomux_conn_block:
+ //already decided real server
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,106,
+ "out_function: static int l7vs_conn_client_receiving(struct l7vs_iomux *iom) "
+ "return_value: 1");
+ }
+ /*------ DEBUG LOG END ------*/
+ return 1;
+ case iomux_conn_service_selected:
+ //service and destination were selected then attempt to connect the real server
+ if (!l7vs_conn_connection_establish(iom, conn, srv, dest)) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_NETWORK,17, "error / client connect rs failed");
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,107,
+ "out_function: static int l7vs_conn_client_receiving(struct l7vs_iomux *iom) "
+ "return_value: 0");
+ }
+ /*------ DEBUG LOG END ------*/
+ return 0;
+ }
+ l7vs_conn_QoS_recvsize_register( conn, conn->cldata_len, QOS_UP );
+ break;
+ default:
+ //invalid status
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_PROGRAM,34, "error / invalid status(%d)", iom->status);
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,108,
+ "out_function: static int l7vs_conn_client_receiving(struct l7vs_iomux *iom) "
+ "return_value: 0");
+ }
+ /*------ DEBUG LOG END ------*/
+ return 0;
+ }
+ break;
+ case iomux_conn_disconnected:
+ // client connection was disconnected
+ break;
+ default:
+ //invalid status
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_PROGRAM,35, "error / invalid status(%d)", iom->status);
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,109,
+ "out_function: static int l7vs_conn_client_receiving(struct l7vs_iomux *iom) "
+ "return_value: 0");
+ }
+ /*------ DEBUG LOG END ------*/
+ return 0;
+ }
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,110,
+ "out_function: static int l7vs_conn_client_receiving(struct l7vs_iomux *iom) "
+ "return_value: 1");
+ }
+ /*------ DEBUG LOG END ------*/
+ return 1;
+}
+
+/*!
+ * check realserver fd, and if real server not connected, call select_service function
+ *
+ * @param[in] iom connection_iomux
+ * @param[in] conn connection
+ * @param[out] srv service
+ * @param[out] dest destination(real server)
+ * @return status
+ * @retval 0 failed
+ * @retval 1 succeed
+ */
+static int
+l7vs_conn_is_rs_connected(struct l7vs_iomux *iom, struct l7vs_conn *conn, struct l7vs_service **srv, struct l7vs_dest **dest)
+{
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ char iom_str[DEBUG_STR_LEN] = {0};
+ char conn_str[DEBUG_STR_LEN] = {0};
+ char srv_str[DEBUG_STR_LEN] = {0};
+ char dest_str[DEBUG_STR_LEN] = {0};
+ l7vs_iomux_c_str(iom_str, iom);
+ l7vs_conn_c_str(conn_str, conn);
+ l7vs_service_c_str(srv_str, *srv);
+ l7vs_dest_c_str(dest_str, *dest);
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,111,
+ "in_function: static int l7vs_conn_is_rs_connected("
+ "struct l7vs_iomux *iom, struct l7vs_conn *conn, struct l7vs_service **srv, struct l7vs_dest **dest) "
+ "iom=%s: "
+ "conn=%s: "
+ "srv=%s: "
+ "dest=%s",
+ iom_str, conn_str, srv_str, dest_str);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ int ret = 0;
+ int temp_tcps = 0;
+ struct l7vs_dest *d; // destination for sorry-server
+ int sorry_state; // sorry state
+
+ struct l7vs_lsock *lsock = NULL;
+
+ if (!iom) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_PROGRAM,36, "error / iom is null");
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,112,
+ "out_function: static int l7vs_conn_is_rs_connected("
+ "struct l7vs_iomux *iom, struct l7vs_conn *conn, struct l7vs_service **srv, struct l7vs_dest **dest) "
+ "return_value: 0");
+ }
+ /*------ DEBUG LOG END ------*/
+ return 0;
+ }
+
+ if (!conn) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_PROGRAM,37, "error / conn is null");
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,113,
+ "out_function: static int l7vs_conn_is_rs_connected("
+ "struct l7vs_iomux *iom, struct l7vs_conn *conn, struct l7vs_service **srv, struct l7vs_dest **dest) "
+ "return_value: 0");
+ }
+ /*------ DEBUG LOG END ------*/
+ return 0;
+ }
+
+ if (iomux_conn_received != iom->status) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_PROGRAM,38, "error / invalid status(%d)", iom->status);
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,114,
+ "out_function: static int l7vs_conn_is_rs_connected("
+ "struct l7vs_iomux *iom, struct l7vs_conn *conn, struct l7vs_service **srv, struct l7vs_dest **dest) "
+ "return_value: 0");
+ }
+ /*------ DEBUG LOG END ------*/
+ return 0;
+ }
+
+ lsock = conn->lsock;
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ char lsock_str[DEBUG_STR_LEN] = {0};
+ l7vs_lsock_c_str(lsock_str, lsock);
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,115,
+ "pointer_assign: lsock=%s",
+ lsock_str);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ //is real server connected?
+ if (-1 != conn->riom->fd) {
+ // check sorry status of service
+ // argment 0 means no connection count check
+ sorry_state = l7vs_sched_sorry_check(conn->srv, 0);
+ if (sorry_state) {
+ // check connect to sorry-server now
+ if (!conn->sorry_conn_flag) {
+ // get sorry-server destination (argment 0)
+ d = l7vs_sched_sorry_dest(conn->srv, conn, 0);
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ char sorry_dest_str1[DEBUG_STR_LEN] = {0};
+ l7vs_dest_c_str(sorry_dest_str1, d);
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,116,
+ "pointer_assign: d=%s",
+ sorry_dest_str1);
+ }
+ /*------ DEBUG LOG END ------*/
+ if (!d) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_NETWORK,18, "error / sorry-server dest NG");
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,117,
+ "iom->status change: %d->%d",
+ iom->status, iomux_conn_rs_connect_error);
+ }
+ /*------ DEBUG LOG END ------*/
+ iom->status = iomux_conn_rs_connect_error;
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,118,
+ "out_function: static int l7vs_conn_is_rs_connected("
+ "struct l7vs_iomux *iom, struct l7vs_conn *conn, struct l7vs_service **srv, struct l7vs_dest **dest) "
+ "return_value: 0");
+ }
+ /*------ DEBUG LOG END ------*/
+ return 0;
+ }
+ conn->old_dest = conn->dest;
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ char old_dest_str[DEBUG_STR_LEN] = {0};
+ l7vs_dest_c_str(old_dest_str, conn->old_dest);
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,119,
+ "pointer_assign: conn->old_dest=%s",
+ old_dest_str);
+ }
+ /*------ DEBUG LOG END ------*/
+ // change connection to sorry-server
+ if (!l7vs_conn_change_connect_rs(conn, d)) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_NETWORK,19, "error / change connection to Sorry NG");
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,120,
+ "iom->status change: %d->%d",
+ iom->status, iomux_conn_rs_connect_error);
+ }
+ /*------ DEBUG LOG END ------*/
+ iom->status = iomux_conn_rs_connect_error;
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,121,
+ "out_function: static int l7vs_conn_is_rs_connected("
+ "struct l7vs_iomux *iom, struct l7vs_conn *conn, struct l7vs_service **srv, struct l7vs_dest **dest) "
+ "return_value: 0");
+ }
+ /*------ DEBUG LOG END ------*/
+ return 0;
+ }
+ conn->sorry_conn_flag = 1;
+ }
+ } else {
+ // check connect to sorry-server now
+ if (conn->sorry_conn_flag) {
+ // get old real-server destination (argment 1)
+ d = l7vs_sched_sorry_dest(conn->srv, conn, 1);
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ char sorry_dest_str2[DEBUG_STR_LEN] = {0};
+ l7vs_dest_c_str(sorry_dest_str2, d);
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,122,
+ "pointer_assign: d=%s",
+ sorry_dest_str2);
+ }
+ /*------ DEBUG LOG END ------*/
+ if (!d) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_NETWORK,20, "error / old real-server dest NG");
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,123,
+ "iom->status change: %d->%d",
+ iom->status, iomux_conn_rs_connect_error);
+ }
+ /*------ DEBUG LOG END ------*/
+ iom->status = iomux_conn_rs_connect_error;
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,124,
+ "out_function: static int l7vs_conn_is_rs_connected("
+ "struct l7vs_iomux *iom, struct l7vs_conn *conn, struct l7vs_service **srv, struct l7vs_dest **dest) "
+ "return_value: 0");
+ }
+ /*------ DEBUG LOG END ------*/
+ return 0;
+ }
+ // change connection to real-server
+ if (!l7vs_conn_change_connect_rs(conn, d)) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_NETWORK,21, "error / change connection to RS NG");
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,125,
+ "iom->status change: %d->%d",
+ iom->status, iomux_conn_rs_connect_error);
+ }
+ /*------ DEBUG LOG END ------*/
+ iom->status = iomux_conn_rs_connect_error;
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,126,
+ "out_function: static int l7vs_conn_is_rs_connected("
+ "struct l7vs_iomux *iom, struct l7vs_conn *conn, struct l7vs_service **srv, struct l7vs_dest **dest) "
+ "return_value: 0");
+ }
+ /*------ DEBUG LOG END ------*/
+ return 0;
+ }
+ conn->sorry_conn_flag = 0;
+ }
+ }
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,127,
+ "iom->status change: %d->%d",
+ iom->status, iomux_conn_block);
+ }
+ /*------ DEBUG LOG END ------*/
+ iom->status = iomux_conn_block;
+ if (iomux_conn_busy == conn->riom->status) {
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,128,
+ "conn->riom->status change: %d->%d",
+ conn->riom->status, iomux_conn_sending_busy);
+ }
+ /*------ DEBUG LOG END ------*/
+ conn->riom->status = iomux_conn_sending_busy;
+ }
+ else {
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,129,
+ "conn->riom->status change: %d->%d",
+ conn->riom->status, iomux_conn_sending);
+ }
+ /*------ DEBUG LOG END ------*/
+ conn->riom->status = iomux_conn_sending;
+ }
+ //epoll re-registration for write
+ l7vs_iomux_mod(conn->riom, iom_write);
+ }
+ else {
+ //select service
+ ret = l7vs_lsock_select_service(lsock, conn, conn->cldata,
+ conn->cldata_len, srv, dest, &temp_tcps);
+ if (0 >= ret) {
+ *srv = NULL;
+ *dest = NULL;
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_NETWORK,22, "error / no matching service found");
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,130,
+ "iom->status change: %d->%d",
+ iom->status, iomux_conn_receive_error);
+ }
+ /*------ DEBUG LOG END ------*/
+ iom->status = iomux_conn_receive_error;
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,131,
+ "out_function: static int l7vs_conn_is_rs_connected("
+ "struct l7vs_iomux *iom, struct l7vs_conn *conn, struct l7vs_service **srv, struct l7vs_dest **dest) "
+ "return_value: 0");
+ }
+ /*------ DEBUG LOG END ------*/
+ return 0;
+ }
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,132,
+ "iom->status change: %d->%d",
+ iom->status, iomux_conn_service_selected);
+ }
+ /*------ DEBUG LOG END ------*/
+ iom->status = iomux_conn_service_selected;
+ }
+
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,133,
+ "out_function: static int l7vs_conn_is_rs_connected("
+ "struct l7vs_iomux *iom, struct l7vs_conn *conn, struct l7vs_service **srv, struct l7vs_dest **dest) "
+ "return_value: 1");
+ }
+ /*------ DEBUG LOG END ------*/
+ return 1;
+}
+
+/*!
+ * connecction establish
+ *
+ * @param[in] iom connection_iomux
+ * @param[in] conn connection
+ * @param[in] srv service
+ * @param[in] dest destination(real server)
+ * @return status
+ * @retval 0 failed
+ * @retval 1 succeed
+ */
+static int
+l7vs_conn_connection_establish(struct l7vs_iomux *iom, struct l7vs_conn *conn, struct l7vs_service *srv, struct l7vs_dest *dest)
+{
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ char iom_str[DEBUG_STR_LEN] = {0};
+ char conn_str[DEBUG_STR_LEN] = {0};
+ char srv_str[DEBUG_STR_LEN] = {0};
+ char dest_str[DEBUG_STR_LEN] = {0};
+ l7vs_iomux_c_str(iom_str, iom);
+ l7vs_conn_c_str(conn_str, conn);
+ l7vs_service_c_str(srv_str, srv);
+ l7vs_dest_c_str(dest_str, dest);
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,134,
+ "in_function: static int l7vs_conn_connection_establish("
+ "struct l7vs_iomux *iom, struct l7vs_conn *conn, struct l7vs_service *srv, struct l7vs_dest *dest)"
+ "iom=%s: "
+ "conn=%s: "
+ "srv=%s: "
+ "dest=%s",
+ iom_str, conn_str, srv_str, dest_str);
+ }
+ /*------ DEBUG LOG END ------*/
+ int ret = 0;
+
+ if (!iom) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_PROGRAM,39, "error / iom is null");
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,135,
+ "out_function: static int l7vs_conn_connection_establish("
+ "struct l7vs_iomux *iom, struct l7vs_conn *conn, struct l7vs_service *srv, struct l7vs_dest *dest)"
+ "return_value: 0");
+ }
+ /*------ DEBUG LOG END ------*/
+ return 0;
+ }
+
+ if (!conn) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_PROGRAM,40, "error / conn is null");
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,136,
+ "out_function: static int l7vs_conn_connection_establish("
+ "struct l7vs_iomux *iom, struct l7vs_conn *conn, struct l7vs_service *srv, struct l7vs_dest *dest)"
+ "return_value: 0");
+ }
+ /*------ DEBUG LOG END ------*/
+ return 0;
+ }
+
+ if (!srv) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_PROGRAM,41, "error / srv is null");
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,137,
+ "out_function: static int l7vs_conn_connection_establish("
+ "struct l7vs_iomux *iom, struct l7vs_conn *conn, struct l7vs_service *srv, struct l7vs_dest *dest)"
+ "return_value: 0");
+ }
+ /*------ DEBUG LOG END ------*/
+ return 0;
+ }
+
+ if (!dest) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_PROGRAM,42, "error / dest is null");
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,138,
+ "out_function: static int l7vs_conn_connection_establish("
+ "struct l7vs_iomux *iom, struct l7vs_conn *conn, struct l7vs_service *srv, struct l7vs_dest *dest)"
+ "return_value: 0");
+ }
+ /*------ DEBUG LOG END ------*/
+ return 0;
+ }
+
+ if (iom->status != iomux_conn_service_selected) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_PROGRAM,43, "error / invalid status(%d)", iom->status);
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,139,
+ "out_function: static int l7vs_conn_connection_establish("
+ "struct l7vs_iomux *iom, struct l7vs_conn *conn, struct l7vs_service *srv, struct l7vs_dest *dest)"
+ "return_value: 0");
+ }
+ /*------ DEBUG LOG END ------*/
+ return 0;
+ }
+
+ // connect to real server
+ if (!l7vs_conn_connect_rs(conn, dest)) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_NETWORK,23, "error / connect rs failed");
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,140,
+ "iom->status change: %d->%d",
+ iom->status, iomux_conn_rs_connect_error);
+ }
+ /*------ DEBUG LOG END ------*/
+ iom->status = iomux_conn_rs_connect_error;
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,141,
+ "out_function: static int l7vs_conn_connection_establish("
+ "struct l7vs_iomux *iom, struct l7vs_conn *conn, struct l7vs_service *srv, struct l7vs_dest *dest)"
+ "return_value: 0");
+ }
+ /*------ DEBUG LOG END ------*/
+ return 0;
+ }
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,142,
+ "iom->status change: %d->%d",
+ iom->status, iomux_conn_rs_connected);
+ }
+ /*------ DEBUG LOG END ------*/
+ iom->status = iomux_conn_rs_connected;
+
+ // set pointer for cross reference
+ conn->srv = srv;
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ char service_str[DEBUG_STR_LEN] = {0};
+ l7vs_service_c_str(service_str, conn->srv);
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,143,
+ "pointer_assign: conn->srv=%s",
+ service_str);
+ }
+ /*------ DEBUG LOG END ------*/
+ l7vs_service_register_conn(srv, conn);
+
+ // service establish
+ ret = l7vs_service_establish(conn->srv, conn);
+ if (0 > ret) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_NETWORK,24, "error / service establish failed");
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,144,
+ "iom->status change: %d->%d",
+ iom->status, iomux_conn_rs_connect_error);
+ }
+ /*------ DEBUG LOG END ------*/
+ iom->status = iomux_conn_rs_connect_error;
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,145,
+ "out_function: static int l7vs_conn_connection_establish("
+ "struct l7vs_iomux *iom, struct l7vs_conn *conn, struct l7vs_service *srv, struct l7vs_dest *dest)"
+ "return_value: 0");
+ }
+ /*------ DEBUG LOG END ------*/
+ return 0;
+ }
+
+ // iom status set
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,146,
+ "iom->status change: %d->%d",
+ iom->status, iomux_conn_block);
+ }
+ /*------ DEBUG LOG END ------*/
+ iom->status = iomux_conn_block;
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,147,
+ "conn->riom->status change: %d->%d",
+ conn->riom->status, iomux_conn_sending);
+ }
+ /*------ DEBUG LOG END ------*/
+ conn->riom->status = iomux_conn_sending;
+
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,148,
+ "out_function: static int l7vs_conn_connection_establish("
+ "struct l7vs_iomux *iom, struct l7vs_conn *conn, struct l7vs_service *srv, struct l7vs_dest *dest)"
+ "return_value: 1");
+ }
+ /*------ DEBUG LOG END ------*/
+ return 1;
+}
+
+/*!
+ * block status:
+ * when block status, arrived data turn next epoll reaction
+ * and changes state to busy, expect the another iom is already busy
+ *
+ * @param[in] iom connection_iomux
+ * @param[in] another_iom another side's iomux
+ * @return status
+ * @retval 0 failed
+ * @retval 1 succeed
+ */
+static int
+l7vs_conn_block(struct l7vs_iomux *iom, struct l7vs_iomux *another_iom)
+{
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ char iom_str[DEBUG_STR_LEN] = {0};
+ char a_iom_str[DEBUG_STR_LEN] = {0};
+ l7vs_iomux_c_str(iom_str, iom);
+ l7vs_iomux_c_str(a_iom_str, another_iom);
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,149,
+ "in_function: static int l7vs_conn_block(struct l7vs_iomux *iom, struct l7vs_iomux *another_iom) "
+ "iom=%s: "
+ "another_iom=%s",
+ iom_str, a_iom_str);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ if (!iom) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_PROGRAM,44, "error / iom is null");
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,150,
+ "out_function: static int l7vs_conn_block(struct l7vs_iomux *iom, struct l7vs_iomux *another_iom) "
+ "return_value: 0");
+ }
+ /*------ DEBUG LOG END ------*/
+ return 0;
+ }
+
+ if (!another_iom) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_PROGRAM,45, "error / another_iom is null");
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,151,
+ "out_function: static int l7vs_conn_block(struct l7vs_iomux *iom, struct l7vs_iomux *another_iom) "
+ "return_value: 0");
+ }
+ /*------ DEBUG LOG END ------*/
+ return 0;
+ }
+
+ if (iomux_conn_block != iom->status) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_PROGRAM,46, "error / invalid status(%d)", iom->status);
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,152,
+ "out_function: static int l7vs_conn_block(struct l7vs_iomux *iom, struct l7vs_iomux *another_iom) "
+ "return_value: 0");
+ }
+ /*------ DEBUG LOG END ------*/
+ return 0;
+ }
+
+ // epoll re-registraion for read
+ l7vs_iomux_mod(iom, iom_read);
+
+ // when another iom status is busy, do not change my status
+ if (iomux_conn_busy != another_iom->status &&
+ iomux_conn_sending_busy != another_iom->status &&
+ iomux_conn_sent_busy != another_iom->status) {
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,153,
+ "iom->status change: %d->%d",
+ iom->status, iomux_conn_busy);
+ }
+ /*------ DEBUG LOG END ------*/
+ iom->status = iomux_conn_busy;
+ }
+
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,154,
+ "out_function: static int l7vs_conn_block(struct l7vs_iomux *iom, struct l7vs_iomux *another_iom) "
+ "return_value: 1");
+ }
+ /*------ DEBUG LOG END ------*/
+ return 1;
+}
+
+/*!
+ * busy status:
+ * when busy status, arrived data turn next epoll reaction and status keep busy
+ *
+ * @param[in] iom connection_iomux
+ * @return status
+ * @retval 0 failed
+ * @retval 1 succeed
+ */
+static int
+l7vs_conn_busy(struct l7vs_iomux *iom)
+{
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ char iom_str[DEBUG_STR_LEN] = {0};
+ l7vs_iomux_c_str(iom_str, iom);
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,155,
+ "in_function: static int l7vs_conn_busy(struct l7vs_iomux *iom) "
+ "iom=%s",
+ iom_str);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ if (!iom) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_PROGRAM,47, "error / iom is null");
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,156,
+ "out_function: static int l7vs_conn_busy(struct l7vs_iomux *iom) "
+ "return_value: 0");
+ }
+ /*------ DEBUG LOG END ------*/
+ return 0;
+ }
+
+ if (iomux_conn_busy != iom->status) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_PROGRAM,48, "error / invalid status(%d)", iom->status);
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,157,
+ "out_function: static int l7vs_conn_busy(struct l7vs_iomux *iom) "
+ "return_value: 0");
+ }
+ /*------ DEBUG LOG END ------*/
+ return 0;
+ }
+
+ //epoll re-registration for read
+ // l7vs_iomux_mod(iom, iom_read);
+
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,158,
+ "out_function: static int l7vs_conn_busy(struct l7vs_iomux *iom) "
+ "return_value: 1");
+ }
+ /*------ DEBUG LOG END ------*/
+ return 1;
+}
+
+/*!
+ * sending status:
+ *
+ * @param[in] iom connection_iomux
+ * @param[in] another_iom another side's iomux
+ * @return status
+ * @retval 0 failed
+ * @retval 1 succeed
+ */
+static int
+l7vs_conn_sending(struct l7vs_iomux *iom, struct l7vs_iomux *another_iom)
+{
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ char iom_str[DEBUG_STR_LEN] = {0};
+ char a_iom_str[DEBUG_STR_LEN] = {0};
+ l7vs_iomux_c_str(iom_str, iom);
+ l7vs_iomux_c_str(a_iom_str, another_iom);
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,159,
+ "in_function: static int l7vs_conn_sending(struct l7vs_iomux *iom, struct l7vs_iomux *another_iom) "
+ "iom=%s: "
+ "another_iom=%s",
+ iom_str, a_iom_str);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ if (!iom) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_PROGRAM,49, "error / iom is null");
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,160,
+ "out_function: static int l7vs_conn_sending(struct l7vs_iomux *iom, struct l7vs_iomux *another_iom) "
+ "return_value: 0");
+ }
+ /*------ DEBUG LOG END ------*/
+ return 0;
+ }
+
+ if (!another_iom) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_PROGRAM,50, "error / another_iom is null");
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,161,
+ "out_function: static int l7vs_conn_sending(struct l7vs_iomux *iom, struct l7vs_iomux *another_iom) "
+ "return_value: 0");
+ }
+ /*------ DEBUG LOG END ------*/
+ return 0;
+ }
+
+ if (iomux_conn_sending != iom->status && iomux_conn_sending_busy != iom->status) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_PROGRAM,51, "error / invalid status(%d)", iom->status);
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,162,
+ "out_function: static int l7vs_conn_sending(struct l7vs_iomux *iom, struct l7vs_iomux *another_iom) "
+ "return_value: 0");
+ }
+ /*------ DEBUG LOG END ------*/
+ return 0;
+ }
+
+ // send to handling iom
+ if (!l7vs_conn_send(iom, iom->fd)) {
+ iom->status = iomux_conn_send_error;
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_NETWORK,25, "error / send failed");
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,163,
+ "out_function: static int l7vs_conn_sending(struct l7vs_iomux *iom, struct l7vs_iomux *another_iom) "
+ "return_value: 0");
+ }
+ /*------ DEBUG LOG END ------*/
+ return 0;
+ }
+ if (iomux_conn_sent == iom->status || iomux_conn_sent_busy == iom->status) {
+ // when all data was sent, select the next state
+ if (!l7vs_conn_sent_next_state(another_iom, iom)) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_NETWORK,26, "error / send next state failed");
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,164,
+ "out_function: static int l7vs_conn_sending(struct l7vs_iomux *iom, struct l7vs_iomux *another_iom) "
+ "return_value: 0");
+ }
+ /*------ DEBUG LOG END ------*/
+ return 0;
+ }
+ if (iomux_conn_receiving != iom->status && iomux_conn_block != iom->status) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_PROGRAM,52, "error / invalid status(%d)", iom->status);
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,165,
+ "out_function: static int l7vs_conn_sending(struct l7vs_iomux *iom, struct l7vs_iomux *another_iom) "
+ "return_value: 0");
+ }
+ /*------ DEBUG LOG END ------*/
+ return 0;
+ }
+ }
+ else if (iomux_conn_sending == iom->status || iomux_conn_sending_busy == iom->status) {
+ // data still remain
+ // epoll re-registration for write
+ l7vs_iomux_mod(iom, iom_write);
+ }
+ else {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_PROGRAM,53, "error / invalid status(%d)", iom->status);
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,166,
+ "out_function: static int l7vs_conn_sending(struct l7vs_iomux *iom, struct l7vs_iomux *another_iom) "
+ "return_value: 0");
+ }
+ /*------ DEBUG LOG END ------*/
+ return 0;
+ }
+
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,167,
+ "out_function: static int l7vs_conn_sending(struct l7vs_iomux *iom, struct l7vs_iomux *another_iom) "
+ "return_value: 1");
+ }
+ /*------ DEBUG LOG END ------*/
+ return 1;
+}
+
+/*!
+ * decide sent next state
+ *
+ * @param[in,out] src_iom source connection_iomux
+ * @param[in,out] dest_iom destionation connection_iomux
+ * @return status
+ * @retval 0 failed
+ * @retval 1 succeed
+ */
+static int
+l7vs_conn_sent_next_state(struct l7vs_iomux *src_iom, struct l7vs_iomux *dest_iom)
+{
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ char s_iom_str[DEBUG_STR_LEN] = {0};
+ char d_iom_str[DEBUG_STR_LEN] = {0};
+ l7vs_iomux_c_str(s_iom_str, src_iom);
+ l7vs_iomux_c_str(d_iom_str, dest_iom);
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,168,
+ "in_function: static int l7vs_conn_sent_next_state(struct l7vs_iomux *src_iom, struct l7vs_iomux *dest_iom) "
+ "src_iom=%s: "
+ "dest_iom=%s",
+ s_iom_str, d_iom_str);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ if (!src_iom) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_PROGRAM,54, "error / src_iom is null");
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,169,
+ "out_function: static int l7vs_conn_sent_next_state(struct l7vs_iomux *src_iom, struct l7vs_iomux *dest_iom) "
+ "return_value: 0");
+ }
+ /*------ DEBUG LOG END ------*/
+ return 0;
+ }
+ if (!dest_iom) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_PROGRAM,55, "error / dest_iom is null");
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,170,
+ "out_function: static int l7vs_conn_sent_next_state(struct l7vs_iomux *src_iom, struct l7vs_iomux *dest_iom) "
+ "return_value: 0");
+ }
+ /*------ DEBUG LOG END ------*/
+ return 0;
+ }
+
+ // when writing, the dest_status will be "sent" or "sent_busy"
+ if (iomux_conn_sent != dest_iom->status && iomux_conn_sent_busy != dest_iom->status) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_PROGRAM,56, "error / invalid dest status(%d)", dest_iom->status);
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,171,
+ "out_function: static int l7vs_conn_sent_next_state(struct l7vs_iomux *src_iom, struct l7vs_iomux *dest_iom) "
+ "return_value: 0");
+ }
+ /*------ DEBUG LOG END ------*/
+ return 0;
+ }
+ // and the src_status will be "block" or "busy"
+ if (iomux_conn_block != src_iom->status && iomux_conn_busy != src_iom->status) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_PROGRAM,57, "error / invalid src status(%d)", src_iom->status);
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,172,
+ "out_function: static int l7vs_conn_sent_next_state(struct l7vs_iomux *src_iom, struct l7vs_iomux *dest_iom) "
+ "return_value: 0");
+ }
+ /*------ DEBUG LOG END ------*/
+ return 0;
+ }
+
+ // decide the next state
+ if (iomux_conn_sent_busy == dest_iom->status) {
+ // when receiving from source, request come to the destination, then destination has priority
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,173,
+ "src_iom->status change: %d->%d",
+ src_iom->status, iomux_conn_block);
+ }
+ /*------ DEBUG LOG END ------*/
+ src_iom->status = iomux_conn_block;
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,174,
+ "dest_iom->status change: %d->%d",
+ dest_iom->status, iomux_conn_receiving);
+ }
+ /*------ DEBUG LOG END ------*/
+ dest_iom->status = iomux_conn_receiving;
+ }
+ else if (iomux_conn_busy == src_iom->status) {
+ // when sending to destination, request come to the source, then source has priority
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,175,
+ "src_iom->status change: %d->%d",
+ src_iom->status, iomux_conn_receiving);
+ }
+ /*------ DEBUG LOG END ------*/
+ src_iom->status = iomux_conn_receiving;
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,176,
+ "dest_iom->status change: %d->%d",
+ dest_iom->status, iomux_conn_block);
+ }
+ /*------ DEBUG LOG END ------*/
+ dest_iom->status = iomux_conn_block;
+ }
+ else {
+ // request come to neither source nor destnation, ready to read both
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,177,
+ "src_iom->status change: %d->%d",
+ src_iom->status, iomux_conn_receiving);
+ }
+ /*------ DEBUG LOG END ------*/
+ src_iom->status = iomux_conn_receiving;
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,178,
+ "dest_iom->status change: %d->%d",
+ dest_iom->status, iomux_conn_receiving);
+ }
+ /*------ DEBUG LOG END ------*/
+ dest_iom->status = iomux_conn_receiving;
+ }
+ l7vs_iomux_mod(src_iom, iom_read);
+ l7vs_iomux_mod(dest_iom, iom_read);
+
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,179,
+ "out_function: static int l7vs_conn_sent_next_state(struct l7vs_iomux *src_iom, struct l7vs_iomux *dest_iom) "
+ "return_value: 1");
+ }
+ /*------ DEBUG LOG END ------*/
+ return 1;
+}
+
+/*!
+ * realserver connection callback
+ *
+ * @param[in] iom connection iomux
+ * @return status
+ * @retval 0 failed
+ * @retval 1 succeed
+ */
+static int
+l7vs_conn_rs_callback(struct l7vs_iomux *iom)
+{
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ char iom_str[DEBUG_STR_LEN] = {0};
+ l7vs_iomux_c_str(iom_str, iom);
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,180,
+ "in_function: static int l7vs_conn_rs_callback(struct l7vs_iomux *iom) "
+ "iom=%s",
+ iom_str);
+ }
+ /*------ DEBUG LOG END ------*/
+ struct l7vs_conn* conn = NULL;
+
+ if (!iom) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_PROGRAM,58, "error / iom is null");
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,181,
+ "out_function: static int l7vs_conn_rs_callback(struct l7vs_iomux *iom) "
+ "return_value: 0");
+ }
+ /*------ DEBUG LOG END ------*/
+ return 0;
+ }
+
+ conn = (struct l7vs_conn *)iom->data;
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ char conn_str[DEBUG_STR_LEN] = {0};
+ l7vs_conn_c_str(conn_str, conn);
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,182,
+ "pointer_assign: conn=%s",
+ conn_str);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ // invalid status check
+ if (iomux_conn_receiving != iom->status &&
+ iomux_conn_block != iom->status &&
+ iomux_conn_busy != iom->status &&
+ iomux_conn_sending != iom->status &&
+ iomux_conn_sending_busy != iom->status) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_PROGRAM,59, "error / invalid status(%d)", iom->status);
+ l7vs_conn_destroy(conn);
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,183,
+ "out_function: static int l7vs_conn_rs_callback(struct l7vs_iomux *iom) "
+ "return_value: 0");
+ }
+ /*------ DEBUG LOG END ------*/
+ return 0;
+ }
+
+ // switch by current status
+ switch (iom->status) {
+ case iomux_conn_receiving:
+ if (!l7vs_conn_realserver_receiving(iom)) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_NETWORK,27, "error / rs_callback/realserver receiving failed");
+ l7vs_conn_destroy(conn);
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,184,
+ "out_function: static int l7vs_conn_rs_callback(struct l7vs_iomux *iom) "
+ "return_value: 0");
+ }
+ /*------ DEBUG LOG END ------*/
+ return 0;
+ }
+ if (iomux_conn_disconnected == iom->status) {
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,185, "realserver connection disconnected");
+ }
+ l7vs_conn_destroy(conn);
+ }
+ break;
+ case iomux_conn_block:
+ if (!l7vs_conn_block(iom, conn->ciom)) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_NETWORK,28, "error / rs_callback/block failed");
+ l7vs_conn_destroy(conn);
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,186,
+ "out_function: static int l7vs_conn_rs_callback(struct l7vs_iomux *iom) "
+ "return_value: 0");
+ }
+ /*------ DEBUG LOG END ------*/
+ return 0;
+ }
+ break;
+ case iomux_conn_busy:
+ if (!l7vs_conn_busy(iom)) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_NETWORK,29, "error / rs_callback/busy failed");
+ l7vs_conn_destroy(conn);
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,187,
+ "out_function: static int l7vs_conn_rs_callback(struct l7vs_iomux *iom) "
+ "return_value: 0");
+ }
+ /*------ DEBUG LOG END ------*/
+ return 0;
+ }
+ break;
+ case iomux_conn_sending:
+ if (!l7vs_conn_sending(iom, conn->ciom)) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_NETWORK,30, "error / rs_callback/sending failed");
+ l7vs_conn_destroy(conn);
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,188,
+ "out_function: static int l7vs_conn_rs_callback(struct l7vs_iomux *iom) "
+ "return_value: 0");
+ }
+ /*------ DEBUG LOG END ------*/
+ return 0;
+ }
+ break;
+ case iomux_conn_sending_busy:
+ if (!l7vs_conn_sending(iom, conn->ciom)) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_NETWORK,31, "error / rs_callback/sending_busy failed");
+ l7vs_conn_destroy(conn);
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,189,
+ "out_function: static int l7vs_conn_rs_callback(struct l7vs_iomux *iom) "
+ "return_value: 0");
+ }
+ /*------ DEBUG LOG END ------*/
+ return 0;
+ }
+ break;
+ default:
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_PROGRAM,60, "error / invalid status(%d)", iom->status);
+ l7vs_conn_destroy(conn);
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,190,
+ "out_function: static int l7vs_conn_rs_callback(struct l7vs_iomux *iom) "
+ "return_value: 0");
+ }
+ /*------ DEBUG LOG END ------*/
+ return 0;
+ }
+
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,191,
+ "out_function: static int l7vs_conn_rs_callback(struct l7vs_iomux *iom) "
+ "return_value: 1");
+ }
+ /*------ DEBUG LOG END ------*/
+ return 1;
+}
+
+/*!
+ * realserver receiving
+ *
+ * @param[in] iom connection iomux
+ * @return status
+ * @retval 0 failed
+ * @retval 1 succeed
+ */
+static int
+l7vs_conn_realserver_receiving(struct l7vs_iomux *iom)
+{
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ char iom_str[DEBUG_STR_LEN] = {0};
+ l7vs_iomux_c_str(iom_str, iom);
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,192,
+ "in_function: static int l7vs_conn_realserver_receiving(struct l7vs_iomux *iom) "
+ "iom=%s",
+ iom_str);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ struct l7vs_conn *conn = NULL;
+
+ if (!iom) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_PROGRAM,61, "error / iom is null");
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,193,
+ "out_function: static int l7vs_conn_realserver_receiving(struct l7vs_iomux *iom) "
+ "return_value: 0");
+ }
+ /*------ DEBUG LOG END ------*/
+ return 0;
+ }
+
+ if (iomux_conn_receiving != iom->status) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_PROGRAM,62, "error / invalid status(%d)", iom->status);
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,194,
+ "out_function: static int l7vs_conn_realserver_receiving(struct l7vs_iomux *iom) "
+ "return_value: 0");
+ }
+ /*------ DEBUG LOG END ------*/
+ return 0;
+ }
+
+ conn = (struct l7vs_conn *)iom->data;
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ char conn_str[DEBUG_STR_LEN] = {0};
+ l7vs_conn_c_str(conn_str, conn);
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,195,
+ "pointer_assign: conn=%s",
+ conn_str);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ // when the client is not set in read-blocked
+ if (iomux_conn_block != conn->ciom->status && iomux_conn_busy != conn->ciom->status) {
+ // set the real server in read-blocked
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,196,
+ "conn->ciom->status change: %d->%d",
+ conn->ciom->status, iomux_conn_block);
+ }
+ /*------ DEBUG LOG END ------*/
+ conn->ciom->status = iomux_conn_block;
+ }
+
+ // receive realserver data
+ if (!l7vs_conn_recv(iom, iom->fd)) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_NETWORK,32, "error / recv failed");
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,197,
+ "out_function: static int l7vs_conn_realserver_receiving(struct l7vs_iomux *iom) "
+ "return_value: 0");
+ }
+ /*------ DEBUG LOG END ------*/
+ return 0;
+ }
+ switch (iom->status) {
+ case iomux_conn_receiving:
+ // data still remain, epoll re-registration for read
+ l7vs_iomux_mod(iom, iom_read);
+ break;
+ case iomux_conn_received:
+ // all data is received, append the session infomation
+ if (!l7vs_conn_realserver_modify_data(iom)) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_NETWORK,33, "error / realserver modify data failed");
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,198,
+ "out_function: static int l7vs_conn_realserver_receiving(struct l7vs_iomux *iom) "
+ "return_value: 0");
+ }
+ /*------ DEBUG LOG END ------*/
+ return 0;
+ }
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,199,
+ "iom->status change: %d->%d",
+ iom->status, iomux_conn_block);
+ }
+ /*------ DEBUG LOG END ------*/
+ iom->status = iomux_conn_block;
+ if (iomux_conn_busy == conn->ciom->status) {
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,200,
+ "conn->ciom->status change: %d->%d",
+ conn->ciom->status, iomux_conn_sending_busy);
+ }
+ /*------ DEBUG LOG END ------*/
+ conn->ciom->status = iomux_conn_sending_busy;
+ } else {
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,201,
+ "conn->ciom->status change: %d->%d",
+ conn->ciom->status, iomux_conn_sending);
+ }
+ /*------ DEBUG LOG END ------*/
+ conn->ciom->status = iomux_conn_sending;
+ }
+ //epoll re-registration for write
+ l7vs_iomux_mod(conn->ciom, iom_write);
+ case iomux_conn_disconnected:
+ // client connection was disconnected
+ break;
+ default:
+ //invalid status
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_PROGRAM,63, "error / invalid status(%d)", iom->status);
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,202,
+ "out_function: static int l7vs_conn_realserver_receiving(struct l7vs_iomux *iom) "
+ "return_value: 0");
+ }
+ /*------ DEBUG LOG END ------*/
+ return 0;
+ }
+
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,203,
+ "out_function: static int l7vs_conn_realserver_receiving(struct l7vs_iomux *iom) "
+ "return_value: 1");
+ }
+ /*------ DEBUG LOG END ------*/
+ return 1;
+}
+
+/*!
+ * realserver modify data
+ *
+ * @param[in] iom connection iomux
+ * @return status
+ * @retval 0 failed
+ * @retval 1 succeed
+ */
+static int
+l7vs_conn_realserver_modify_data(struct l7vs_iomux *iom)
+{
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ char iom_str[DEBUG_STR_LEN] = {0};
+ l7vs_iomux_c_str(iom_str, iom);
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,204,
+ "in_function: static int l7vs_conn_realserver_modify_data(struct l7vs_iomux *iom) "
+ "iom=%s",
+ iom_str);
+ }
+ /*------ DEBUG LOG END ------*/
+ struct l7vs_conn *conn = NULL;
+ char *newbuf = NULL;
+ int (*relayf)(struct l7vs_service *, struct l7vs_conn *, char *, size_t *) = NULL;
+ int ret = 0;
+ size_t len_ret = 0;
+
+ if (!iom) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_PROGRAM,64, "error / iom is null");
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,205,
+ "out_function: static int l7vs_conn_realserver_modify_data(struct l7vs_iomux *iom) "
+ "return_value: 0");
+ }
+ /*------ DEBUG LOG END ------*/
+ return 0;
+ }
+
+ if (iomux_conn_received != iom->status) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_PROGRAM,65, "error / invalid status(%d)", iom->status);
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,206,
+ "out_function: static int l7vs_conn_realserver_modify_data(struct l7vs_iomux *iom) "
+ "return_value: 0");
+ }
+ /*------ DEBUG LOG END ------*/
+ return 0;
+ }
+
+ conn = (struct l7vs_conn *)iom->data;
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ char conn_str[DEBUG_STR_LEN] = {0};
+ l7vs_conn_c_str(conn_str, conn);
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,207,
+ "pointer_assign: conn=%s",
+ conn_str);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ //set the function pointer that modify the real server data
+ if (conn->srv) {
+ relayf = conn->srv->pm->analyze_rsdata;
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,208,
+ "pointer_assign: relayf=%p",
+ relayf);
+ }
+ /*------ DEBUG LOG END ------*/
+ }
+
+ if (relayf) {
+ len_ret = conn->cldata_len;
+ newbuf = (char *)realloc(conn->cldata, (conn->cldata_len + L7VS_PROTOMOD_MAX_ADD_BUFSIZE + 1));
+ if (!newbuf) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_SYSTEM_MEMORY,10, "error / realloc failed");
+ iom->status = iomux_conn_buffer_realloc_error;
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,209,
+ "out_function: static int l7vs_conn_realserver_modify_data(struct l7vs_iomux *iom) "
+ "return_value: 0");
+ }
+ /*------ DEBUG LOG END ------*/
+ return 0;
+ }
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,210,
+ "realloc: newbuf=%p: size=%zu",
+ newbuf, (conn->cldata_len + L7VS_PROTOMOD_MAX_ADD_BUFSIZE + 1));
+ }
+ /*------ DEBUG LOG END ------*/
+ conn->cldata = newbuf;
+
+ ret = (*relayf)(conn->srv, conn, conn->cldata, &len_ret);
+ if (0 != ret) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_NETWORK,34, "error / analyze rsdata failed");
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,211,
+ "iom->status change: %d->%d",
+ iom->status, iomux_conn_rsdata_modify_error);
+ }
+ /*------ DEBUG LOG END ------*/
+ iom->status = iomux_conn_rsdata_modify_error;
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,212,
+ "out_function: static int l7vs_conn_realserver_modify_data(struct l7vs_iomux *iom) "
+ "return_value: 0");
+ }
+ /*------ DEBUG LOG END ------*/
+ return 0;
+ }
+ if (L7VS_PROTOMOD_MAX_ADD_BUFSIZE < len_ret - conn->cldata_len) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_NETWORK,35, "error / bufsize too long modified by protomod");
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,213,
+ "iom->status change: %d->%d",
+ iom->status, iomux_conn_rsdata_modify_error);
+ }
+ /*------ DEBUG LOG END ------*/
+ iom->status = iomux_conn_rsdata_modify_error;
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,214,
+ "out_function: static int l7vs_conn_realserver_modify_data(struct l7vs_iomux *iom) "
+ "return_value: 0");
+ }
+ /*------ DEBUG LOG END ------*/
+ return 0;
+ }
+ else {
+ conn->cldata_len = len_ret;
+ }
+ }
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ char modify_data[DEBUG_STR_LEN] = {0};
+ l7vs_conn_dump_data(modify_data, conn->cldata, conn->cldata_len);
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,215,
+ "modify data: %s",
+ modify_data);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,216,
+ "iom->status change: %d->%d",
+ iom->status, iomux_conn_rsdata_modified);
+ }
+ /*------ DEBUG LOG END ------*/
+ iom->status = iomux_conn_rsdata_modified;
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,217,
+ "out_function: static int l7vs_conn_realserver_modify_data(struct l7vs_iomux *iom) "
+ "return_value: 1");
+ }
+ /*------ DEBUG LOG END ------*/
+ return 1;
+}
+
+/*!
+ * receive data
+ *
+ * @param[in] iom connection_iomux
+ * @param[in] source_fd the filedescriptor to be read
+ * @return status
+ * @retval 0 failed
+ * @retval 1 succeed
+ */
+static int
+l7vs_conn_recv(struct l7vs_iomux *iom, int source_fd)
+{
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ char iom_str[DEBUG_STR_LEN] = {0};
+ l7vs_iomux_c_str(iom_str, iom);
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,218,
+ "in_function: static int l7vs_conn_recv(struct l7vs_iomux *iom, int source_fd) "
+ "iom=%s: "
+ "source_fd=%d",
+ iom_str, source_fd);
+ }
+ /*------ DEBUG LOG END ------*/
+ int ret = 0;
+ struct l7vs_conn *conn = NULL;
+ char read_buf[l7vs_conn_read_bufsize];
+// char *newbuf = NULL;
+
+ if (!iom) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_PROGRAM,66, "error / iom is null");
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,219,
+ "out_function: static int l7vs_conn_recv(struct l7vs_iomux *iom, int source_fd) "
+ "return_value: 0");
+ }
+ /*------ DEBUG LOG END ------*/
+ return 0;
+ }
+
+ if (0 > source_fd || INT_MAX == source_fd) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_PROGRAM,67, "error / source fd is not specified");
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,220,
+ "out_function: static int l7vs_conn_recv(struct l7vs_iomux *iom, int source_fd) "
+ "return_value: 0");
+ }
+ /*------ DEBUG LOG END ------*/
+ return 0;
+ }
+
+ if (iomux_conn_receiving != iom->status) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_PROGRAM,68, "error / invalid status(%d)", iom->status);
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,221,
+ "out_function: static int l7vs_conn_recv(struct l7vs_iomux *iom, int source_fd) "
+ "return_value: 0");
+ }
+ /*------ DEBUG LOG END ------*/
+ return 0;
+ }
+
+ conn = (struct l7vs_conn *)iom->data;
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ char conn_str[DEBUG_STR_LEN] = {0};
+ l7vs_conn_c_str(conn_str, conn);
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,222,
+ "pointer_assign: conn=%s",
+ conn_str);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ //QoS Control to server
+ if( (source_fd == conn->ciom->fd) && !l7vs_conn_QoS_control( conn, QOS_UP ) ){
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,223,
+ "iom->status change: %d->%d",
+ iom->status, iomux_conn_receiving);
+ }
+ /*------ DEBUG LOG END ------*/
+ iom->status = iomux_conn_receiving;
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,224,
+ "out_function: static int l7vs_conn_recv(struct l7vs_iomux *iom, int source_fd) "
+ "return_value: 1");
+ }
+ /*------ DEBUG LOG END ------*/
+ return 1;
+ }
+ //QoS Control to client
+ if( (source_fd == conn->riom->fd) && !l7vs_conn_QoS_control( conn, QOS_DOWN ) ){
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,223,
+ "iom->status change: %d->%d",
+ iom->status, iomux_conn_receiving);
+ }
+ /*------ DEBUG LOG END ------*/
+ iom->status = iomux_conn_receiving;
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,224,
+ "out_function: static int l7vs_conn_recv(struct l7vs_iomux *iom, int source_fd) "
+ "return_value: 1");
+ }
+ /*------ DEBUG LOG END ------*/
+ return 1;
+ }
+ // read the data
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,225,
+ "recv param: source_fd=%d: len=%d: flags=%d",
+ source_fd, (l7vs_conn_read_bufsize - 1), 0);
+ }
+ /*------ DEBUG LOG END ------*/
+ ret = recv(source_fd, read_buf, (l7vs_conn_read_bufsize - 1), 0);
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,226,
+ "recv result: ret=%d",
+ ret);
+ }
+ /*------ DEBUG LOG END ------*/
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ char recv_data[DEBUG_STR_LEN] = {0};
+ l7vs_conn_dump_data(recv_data, read_buf, ret);
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,227,
+ "recv data: %s",
+ recv_data);
+ }
+ /*------ DEBUG LOG END ------*/
+ switch (ret) {
+ case -1:
+ if (EAGAIN != errno) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_SYSTEM_SOCKET,12, "error / recv error(%s)", strerror(errno));
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,228,
+ "iom->status change: %d->%d",
+ iom->status, iomux_conn_receive_error);
+ }
+ /*------ DEBUG LOG END ------*/
+ iom->status = iomux_conn_receive_error;
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,229,
+ "out_function: static int l7vs_conn_recv(struct l7vs_iomux *iom, int source_fd) "
+ "return_value: 0");
+ }
+ /*------ DEBUG LOG END ------*/
+ return 0;
+ }
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,230,
+ "out_function: static int l7vs_conn_recv(struct l7vs_iomux *iom, int source_fd) "
+ "return_value: 1");
+ }
+ /*------ DEBUG LOG END ------*/
+ return 1;
+ case 0:
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,231, "peer disconnected");
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,232,
+ "iom->status change: %d->%d",
+ iom->status, iomux_conn_disconnected);
+ }
+ /*------ DEBUG LOG END ------*/
+ iom->status = iomux_conn_disconnected;
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,233,
+ "out_function: static int l7vs_conn_recv(struct l7vs_iomux *iom, int source_fd) "
+ "return_value: 1");
+ }
+ /*------ DEBUG LOG END ------*/
+ return 1;
+// case L7VS_CONN_READ_BUFSIZE - 1:
+// // if the buffer is insufficient, realloc the buffer
+// conn->cldata_bufsize += L7VS_CONN_READ_BUFSIZE - 1;
+// newbuf = (char *)realloc(conn->cldata,
+// conn->cldata_bufsize);
+// if (!newbuf) {
+// LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_SYSTEM_MEMORY,11, "error / realloc failed");
+// iom->status = iomux_conn_buffer_realloc_error;
+// /*-------- DEBUG LOG --------*/
+// if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+// LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,234,
+// "out_function: static int l7vs_conn_recv(struct l7vs_iomux *iom, int source_fd) "
+// "return_value: 0");
+// }
+// /*------ DEBUG LOG END ------*/
+// return 0;
+// }
+// /*-------- DEBUG LOG --------*/
+// if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+// LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,235,
+// "realloc: newbuf=%p: size=%zu",
+// newbuf, conn->cldata_bufsize);
+// }
+// /*------ DEBUG LOG END ------*/
+// conn->cldata = newbuf;
+//
+// // check the next data, and decide the status
+// if (!l7vs_conn_preread(iom, source_fd)) {
+// LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_NETWORK,36, "error / preread failed");
+// /*-------- DEBUG LOG --------*/
+// if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+// LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,236,
+// "iom->status change: %d->%d",
+// iom->status, iomux_conn_receive_error);
+// }
+// /*------ DEBUG LOG END ------*/
+// iom->status = iomux_conn_receive_error;
+// /*-------- DEBUG LOG --------*/
+// if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+// LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,237,
+// "out_function: static int l7vs_conn_recv(struct l7vs_iomux *iom, int source_fd) "
+// "return_value: 0");
+// }
+// /*------ DEBUG LOG END ------*/
+// return 0;
+// }
+// if (iomux_conn_disconnected == iom->status) {
+// /*-------- DEBUG LOG --------*/
+// if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+// LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,238,
+// "out_function: static int l7vs_conn_recv(struct l7vs_iomux *iom, int source_fd) "
+// "return_value: 1");
+// }
+// /*------ DEBUG LOG END ------*/
+// return 1;
+// }
+// break;
+ default:
+ // reading data is finished
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,239,
+ "iom->status change: %d->%d",
+ iom->status, iomux_conn_received);
+ }
+ /*------ DEBUG LOG END ------*/
+ iom->status = iomux_conn_received;
+ break;
+ }
+
+ // register reveive information for QoS to server
+ if( source_fd == conn->ciom->fd ){
+ l7vs_conn_QoS_recvsize_register( conn, ret, QOS_UP );
+ }
+ // register reveive information for QoS to client
+ if( source_fd == conn->riom->fd ){
+ l7vs_conn_QoS_recvsize_register( conn, ret, QOS_DOWN );
+ }
+ // copy to conn_buffer
+ memcpy(conn->cldata + conn->cldata_len, read_buf, ret);
+ conn->cldata_len += ret;
+ conn->cldata[conn->cldata_len] = '\0';
+
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,240,
+ "out_function: static int l7vs_conn_recv(struct l7vs_iomux *iom, int source_fd) "
+ "return_value: 1");
+ }
+ /*------ DEBUG LOG END ------*/
+ return 1;
+}
+
+/*!
+ * pre-read whether next data exists
+ *
+ * @param[in] iom connection iomux
+ * @param[in] source_fd source file description
+ * @return status
+ * @retval 0 failed
+ * @retval 1 succeed
+ */
+static int
+l7vs_conn_preread(struct l7vs_iomux *iom, int source_fd)
+{
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ char iom_str[DEBUG_STR_LEN] = {0};
+ l7vs_iomux_c_str(iom_str, iom);
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,241,
+ "in_function: static int l7vs_conn_preread(struct l7vs_iomux *iom, int source_fd) "
+ "iom=%s: "
+ "source_fd=%d",
+ iom_str, source_fd);
+ }
+ /*------ DEBUG LOG END ------*/
+ int preread_ret = 0;
+ char preread_buf[1] = {0};
+
+ if (!iom) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_PROGRAM,69, "error / iom is null");
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,242,
+ "out_function: static int l7vs_conn_preread(struct l7vs_iomux *iom, int source_fd) "
+ "return_value: 0");
+ }
+ /*------ DEBUG LOG END ------*/
+ return 0;
+ }
+
+ if (-1 == source_fd) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_PROGRAM,70, "error / source fd is not specified");
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,243,
+ "out_function: static int l7vs_conn_preread(struct l7vs_iomux *iom, int source_fd) "
+ "return_value: 0");
+ }
+ /*------ DEBUG LOG END ------*/
+ return 0;
+ }
+
+ if (iomux_conn_receiving != iom->status) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_PROGRAM,71, "error / invalid status(%d)", iom->status);
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,244,
+ "out_function: static int l7vs_conn_preread(struct l7vs_iomux *iom, int source_fd) "
+ "return_value: 0");
+ }
+ /*------ DEBUG LOG END ------*/
+ return 0;
+ }
+
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,245,
+ "recv param: source_fd=%d: len=1: flags=MSG_PEEK",
+ source_fd);
+ }
+ /*------ DEBUG LOG END ------*/
+ preread_ret = recv(source_fd, preread_buf, 1, MSG_PEEK);
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,246,
+ "recv result: preread_ret=%d",
+ preread_ret);
+ }
+ /*------ DEBUG LOG END ------*/
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ char recv_data[DEBUG_STR_LEN] = {0};
+ l7vs_conn_dump_data(recv_data, preread_buf, preread_ret);
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,247,
+ "recv data: %s",
+ recv_data);
+ }
+ /*------ DEBUG LOG END ------*/
+ switch (preread_ret) {
+ case -1:
+ if (EAGAIN != errno) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_SYSTEM_SOCKET,13, "error / recv error(%s)", strerror(errno));
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,248,
+ "iom->status change: %d->%d",
+ iom->status, iomux_conn_receive_error);
+ }
+ /*------ DEBUG LOG END ------*/
+ iom->status = iomux_conn_receive_error;
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,249,
+ "out_function: static int l7vs_conn_preread(struct l7vs_iomux *iom, int source_fd) "
+ "return_value: 0");
+ }
+ /*------ DEBUG LOG END ------*/
+ return 0;
+ }
+ // finished reading all data
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,250,
+ "iom->status change: %d->%d",
+ iom->status, iomux_conn_received);
+ }
+ /*------ DEBUG LOG END ------*/
+ iom->status = iomux_conn_received;
+ break;
+ case 0:
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,251, "peer disconnected");
+ }
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,252,
+ "iom->status change: %d->%d",
+ iom->status, iomux_conn_disconnected);
+ }
+ /*------ DEBUG LOG END ------*/
+ iom->status = iomux_conn_disconnected;
+ break;
+ case 1:
+ // the data that should be read remains
+ // status does not change
+ break;
+ default:
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_NETWORK,37, "error / preread error");
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,253,
+ "out_function: static int l7vs_conn_preread(struct l7vs_iomux *iom, int source_fd) "
+ "return_value: 0");
+ }
+ /*------ DEBUG LOG END ------*/
+ return 0;
+ }
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,254,
+ "out_function: static int l7vs_conn_preread(struct l7vs_iomux *iom, int source_fd) "
+ "return_value: 1");
+ }
+ /*------ DEBUG LOG END ------*/
+ return 1;
+}
+
+/*!
+ * send data
+ *
+ * @param[in] iom connection_iomux
+ * @param[in] dest_fd the filedescriptor to be write
+ * @return status
+ * @retval 0 failed
+ * @retval 1 succeed
+ */
+static int
+l7vs_conn_send(struct l7vs_iomux *iom, int dest_fd)
+{
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ char iom_str[DEBUG_STR_LEN] = {0};
+ l7vs_iomux_c_str(iom_str, iom);
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,255,
+ "in_function: static int l7vs_conn_send(struct l7vs_iomux *iom, int dest_fd) "
+ "iom=%s: "
+ "dest_fd=%d",
+ iom_str, dest_fd);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ int ret = 0;
+ struct l7vs_conn *conn = NULL;
+ char *newbuf = NULL;
+ size_t sent_len = 0;
+
+ if (!iom) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_PROGRAM,72, "error / iom is null");
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,256,
+ "out_function: static int l7vs_conn_send(struct l7vs_iomux *iom, int dest_fd) "
+ "return_value: 0");
+ }
+ /*------ DEBUG LOG END ------*/
+ return 0;
+ }
+
+ if (-1 == dest_fd) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_PROGRAM,73, "error / dest fd is not specified");
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,257,
+ "out_function: static int l7vs_conn_send(struct l7vs_iomux *iom, int dest_fd) "
+ "return_value: 0");
+ }
+ /*------ DEBUG LOG END ------*/
+ return 0;
+ }
+
+ if (iomux_conn_sending != iom->status &&
+ iomux_conn_sending_busy != iom->status) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_PROGRAM,74, "error / invalid status(%d)", iom->status);
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,258,
+ "out_function: static int l7vs_conn_send(struct l7vs_iomux *iom, int dest_fd) "
+ "return_value: 0");
+ }
+ /*------ DEBUG LOG END ------*/
+ return 0;
+ }
+
+ conn = (struct l7vs_conn *)iom->data;
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ char conn_str[DEBUG_STR_LEN] = {0};
+ l7vs_conn_c_str(conn_str, conn);
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,259,
+ "pointer_assign: conn=%s",
+ conn_str);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ char send_data[DEBUG_STR_LEN] = {0};
+ l7vs_conn_dump_data(send_data, conn->cldata, conn->cldata_len);
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,260,
+ "send data: %s",
+ send_data);
+ }
+ /*------ DEBUG LOG END ------*/
+ // write the data
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,261,
+ "send param: dest_fd=%d: len=%zu: flags=MSG_NOSIGNAL",
+ dest_fd, conn->cldata_len);
+ }
+ /*------ DEBUG LOG END ------*/
+ ret = send(dest_fd, conn->cldata, conn->cldata_len, MSG_NOSIGNAL);
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,262,
+ "send result: ret=%d",
+ ret);
+ }
+ /*------ DEBUG LOG END ------*/
+ if (0 > ret) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_SYSTEM_SOCKET,14, "error / send error(%s)", strerror(errno));
+ iom->status = iomux_conn_send_error;
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,263,
+ "out_function: static int l7vs_conn_send(struct l7vs_iomux *iom, int dest_fd) "
+ "return_value: 0");
+ }
+ /*------ DEBUG LOG END ------*/
+ return 0;
+ }
+ sent_len = ret;
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,264, "sent %zu bytes", sent_len);
+ }
+
+ // decide the status
+ if (conn->cldata_len == sent_len) {
+ // finished sending all data
+ if (iomux_conn_sending == iom->status) {
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,265,
+ "iom->status change: %d->%d",
+ iom->status, iomux_conn_sent);
+ }
+ /*------ DEBUG LOG END ------*/
+ iom->status = iomux_conn_sent;
+ } else {
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,266,
+ "iom->status change: %d->%d",
+ iom->status, iomux_conn_sent_busy);
+ }
+ /*------ DEBUG LOG END ------*/
+ iom->status = iomux_conn_sent_busy;
+ }
+ //cldata memory realloc
+ conn->cldata_len = 0;
+ conn->cldata_bufsize = l7vs_conn_read_bufsize;
+ newbuf = (char *)malloc(conn->cldata_bufsize);
+ if (!newbuf) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_SYSTEM_MEMORY,12, "error / malloc failed");
+ iom->status = iomux_conn_send_error;
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,267,
+ "out_function: static int l7vs_conn_send(struct l7vs_iomux *iom, int dest_fd) "
+ "return_value: 0");
+ }
+ /*------ DEBUG LOG END ------*/
+ return 0;
+ }
+ free(conn->cldata);
+ conn->cldata = newbuf;
+ memset(conn->cldata, 0, l7vs_conn_read_bufsize);
+ }
+ else {
+ // shift data for next sending
+ newbuf = (char *)malloc((conn->cldata_len - sent_len) + 1);
+ if (!newbuf) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_SYSTEM_MEMORY,13, "error / malloc failed");
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,268,
+ "iom->status change: %d->%d",
+ iom->status, iomux_conn_send_error);
+ }
+ /*------ DEBUG LOG END ------*/
+ iom->status = iomux_conn_send_error;
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,269,
+ "out_function: static int l7vs_conn_send(struct l7vs_iomux *iom, int dest_fd) "
+ "return_value: 0");
+ }
+ /*------ DEBUG LOG END ------*/
+ return 0;
+ }
+ memcpy(newbuf, (conn->cldata + sent_len), conn->cldata_len - sent_len);
+ free(conn->cldata);
+ conn->cldata = newbuf;
+ conn->cldata_len -= sent_len;
+ conn->cldata[conn->cldata_len] = '\0';
+
+ // the data that should be sent remains, status does not change
+ }
+
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,270,
+ "out_function: static int l7vs_conn_send(struct l7vs_iomux *iom, int dest_fd) "
+ "return_value: 1");
+ }
+ /*------ DEBUG LOG END ------*/
+ return 1;
+
+}
+
+/*!
+ * connect to real server
+ *
+ * @param[in] conn connection
+ * @param[in] dest destination
+ * @return status
+ * @retval 0 failed
+ * @retval 1 succeed
+ */
+int
+l7vs_conn_connect_rs(struct l7vs_conn *conn, struct l7vs_dest *dest)
+{
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ char conn_str[DEBUG_STR_LEN] = {0};
+ char dest_str[DEBUG_STR_LEN] = {0};
+ l7vs_conn_c_str(conn_str, conn);
+ l7vs_dest_c_str(dest_str, dest);
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,271,
+ "in_function: int l7vs_conn_connect_rs(struct l7vs_conn *conn, struct l7vs_dest *dest) "
+ "conn=%s: "
+ "dest=%s",
+ conn_str, dest_str);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ int s;
+ int stype;
+ int flags;
+ int ret;
+ enum iomaction action;
+
+ if (!conn) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_PROGRAM,75, "error / conn is null");
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,272,
+ "out_function: int l7vs_conn_connect_rs(struct l7vs_conn *conn, struct l7vs_dest *dest) "
+ "return_value: 0");
+ }
+ /*------ DEBUG LOG END ------*/
+ return 0;
+ }
+ if (!dest) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_PROGRAM,76, "error / dest is null");
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,273,
+ "out_function: int l7vs_conn_connect_rs(struct l7vs_conn *conn, struct l7vs_dest *dest) "
+ "return_value: 0");
+ }
+ /*------ DEBUG LOG END ------*/
+ return 0;
+ }
+
+ switch (conn->proto) {
+ case IPPROTO_TCP:
+ stype = SOCK_STREAM;
+ break;
+ case IPPROTO_UDP:
+ stype = SOCK_DGRAM;
+ break;
+ default:
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_SYSTEM_SOCKET,15, "error / unknown socket type");
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,274,
+ "out_function: int l7vs_conn_connect_rs(struct l7vs_conn *conn, struct l7vs_dest *dest) "
+ "return_value: 0");
+ }
+ /*------ DEBUG LOG END ------*/
+ return 0;
+ }
+
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,275,
+ "socket param: family=PF_INET: type=%d: protocol=%d",
+ stype, conn->proto);
+ }
+ /*------ DEBUG LOG END ------*/
+ s = socket(PF_INET, stype, conn->proto);
+ if (0 > s) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_SYSTEM_SOCKET,16, "error / socket error(%s)", strerror(errno));
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,276,
+ "out_function: int l7vs_conn_connect_rs(struct l7vs_conn *conn, struct l7vs_dest *dest) "
+ "return_value: 0");
+ }
+ /*------ DEBUG LOG END ------*/
+ return 0;
+ }
+
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,277,
+ "fnctl param: s=%d: cmd=F_GETFL: flags=0",
+ s);
+ }
+ /*------ DEBUG LOG END ------*/
+ flags = fcntl(s, F_GETFL, 0);
+ if (0 > flags) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_SYSTEM_SOCKET,17, "error / fcntl(s=%d,F_GETFL) error(%s)", s,strerror(errno));
+ close(s);
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,278,
+ "out_function: int l7vs_conn_connect_rs(struct l7vs_conn *conn, struct l7vs_dest *dest) "
+ "return_value: 0");
+ }
+ /*------ DEBUG LOG END ------*/
+ return 0;
+ }
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,279,
+ "fnctl result: flags=%d",
+ flags);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,280,
+ "fnctl param: s=%d: cmd=F_SETFL: flags=%d",
+ s, (flags | O_NONBLOCK));
+ }
+ /*------ DEBUG LOG END ------*/
+ flags = fcntl(s, F_SETFL, flags | O_NONBLOCK);
+ if (0 > flags) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_SYSTEM_SOCKET,18, "error / fcntl(s=%d,F_SETFL) error(%s)", s,strerror(errno));
+ close(s);
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,281,
+ "out_function: int l7vs_conn_connect_rs(struct l7vs_conn *conn, struct l7vs_dest *dest) "
+ "return_value: 0");
+ }
+ /*------ DEBUG LOG END ------*/
+ return 0;
+ }
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,282,
+ "fnctl result: flags=%d",
+ flags);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ if (conn->cmss > 0) {
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,283,
+ "setsockopt param: s=%d: level=IPROTO_TCP: optname=TCP_MAXSEG: optval=%d: "
+ "len=%zu",
+ s, conn->cmss, sizeof(int));
+ }
+ /*------ DEBUG LOG END ------*/
+ ret = setsockopt(s, IPPROTO_TCP, TCP_MAXSEG, &conn->cmss,
+ sizeof(int));
+ if (ret < 0) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_SYSTEM_SOCKET,19, "error / setsockopt(TCP_MAXSEG) error(%s)", strerror(errno));
+ }
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,284,
+ "setsockopt result: ret=%d: len=%zu",
+ ret, sizeof(int));
+ }
+ /*------ DEBUG LOG END ------*/
+ }
+
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ char addr_str[DEBUG_STR_LEN] = {0};
+ l7vs_conn_sockaddr_in_c_str(addr_str, &dest->addr);
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,285,
+ "connect param: s=%d: dest->addr=%s: len=%zu",
+ s, addr_str, sizeof(struct sockaddr_in));
+ }
+ /*------ DEBUG LOG END ------*/
+ ret = connect(s, (struct sockaddr *)&dest->addr,
+ sizeof(struct sockaddr_in));
+ if (0 > ret) {
+ if (errno != EINPROGRESS) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_SYSTEM_SOCKET,20, "error / connect error(%s)", strerror(errno));
+ close(s);
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,286,
+ "out_function: int l7vs_conn_connect_rs(struct l7vs_conn *conn, struct l7vs_dest *dest) "
+ "return_value: 0");
+ }
+ /*------ DEBUG LOG END ------*/
+ return 0;
+ }
+ }
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,287,
+ "connect result: ret=%d",
+ ret);
+ }
+ /*------ DEBUG LOG END ------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,288, "dest %p nactive %d->%d",
+ dest, dest->nactive,
+ dest->nactive + 1);
+ }
+
+ action = iom_write;
+ dest->nactive++;
+ conn->dest = dest;
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ char dest_str[DEBUG_STR_LEN] = {0};
+ l7vs_dest_c_str(dest_str, conn->dest);
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,289,
+ "pointer_assign: conn->dest=%s",
+ dest_str);
+ }
+ /*------ DEBUG LOG END ------*/
+ conn->riom->fd = s;
+ conn->riom->callback = l7vs_conn_rs_callback;
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,290,
+ "pointer_assign: conn->riom->callback=%p",
+ conn->riom->callback);
+ }
+ /*------ DEBUG LOG END ------*/
+ conn->riom->data = conn;
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ char conn_str[DEBUG_STR_LEN] = {0};
+ l7vs_conn_c_str(conn_str, conn);
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,291,
+ "pointer_assign: conn->riom->data=%s",
+ conn_str);
+ }
+ /*------ DEBUG LOG END ------*/
+ l7vs_iomux_add(conn->riom, action);
+
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,292,
+ "out_function: int l7vs_conn_connect_rs(struct l7vs_conn *conn, struct l7vs_dest *dest) "
+ "return_value: 1");
+ }
+
+ if ( dest ){
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,341,
+ "RealServer Connecting Count : nactive is %d",
+ dest->nactive);
+ }
+ /*-------- DEBUG LOG --------*/
+
+ /*-------- INFO LOG (Access Log) --------*/
+ if (LOG_LV_INFO >= logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ char addr_str_tmp[ADDR_STR_LEN] = {0};
+ memcpy(addr_str_tmp, inet_ntoa(conn->caddr.sin_addr), ADDR_STR_LEN);
+ LOGGER_PUT_LOG_INFO(LOG_CAT_L7VSD_NETWORK,342,
+ "[[AccessLog] (SRC)%s:%d -> (DST)%s:%d ]",
+ addr_str_tmp,
+ ntohs(conn->caddr.sin_port),
+ inet_ntoa(conn->dest->addr.sin_addr),
+ ntohs(conn->dest->addr.sin_port));
+ }
+ /*------ INFO LOG END (Access Log) ------*/
+ }
+
+ /*------ DEBUG LOG END ------*/
+ return 1;
+}
+
+/*!
+ * close client socket
+ *
+ * @param[in] conn connection
+ * @return void
+ */
+void
+l7vs_conn_close_csock(struct l7vs_conn *conn)
+{
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ char conn_str[DEBUG_STR_LEN] = {0};
+ l7vs_conn_c_str(conn_str, conn);
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,293,
+ "in_function: void l7vs_conn_close_csock(struct l7vs_conn *conn) "
+ "conn=%s",
+ conn_str);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ if (!conn) {
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,294,
+ "out_function: void l7vs_conn_close_csock(struct l7vs_conn *conn) "
+ "return_value: void");
+ }
+ /*------ DEBUG LOG END ------*/
+ return;
+ }
+ if (!conn->ciom) {
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,295,
+ "out_function: void l7vs_conn_close_csock(struct l7vs_conn *conn) "
+ "return_value: void");
+ }
+ /*------ DEBUG LOG END ------*/
+ return;
+ }
+ if (-1 == conn->ciom->fd) {
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,296,
+ "out_function: void l7vs_conn_close_csock(struct l7vs_conn *conn) "
+ "return_value: void");
+ }
+ /*------ DEBUG LOG END ------*/
+ return;
+ }
+
+ l7vs_iomux_remove(conn->ciom);
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,297,
+ "close: conn->ciom->fd=%d",
+ conn->ciom->fd);
+ }
+ /*------ DEBUG LOG END ------*/
+ close(conn->ciom->fd);
+ conn->ciom->fd = -1;
+
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,298,
+ "out_function: void l7vs_conn_close_csock(struct l7vs_conn *conn) "
+ "return_value: void");
+ }
+ /*------ DEBUG LOG END ------*/
+}
+
+/*!
+ * close real server socket
+ *
+ * @param[in] conn connection
+ * @return void
+ */
+void
+l7vs_conn_close_rsock(struct l7vs_conn *conn)
+{
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ char conn_str[DEBUG_STR_LEN] = {0};
+ l7vs_conn_c_str(conn_str, conn);
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,299,
+ "in_function: void l7vs_conn_close_rsock(struct l7vs_conn *conn) "
+ "conn=%s",
+ conn_str);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ if (!conn) {
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,300,
+ "out_function: void l7vs_conn_close_rsock(struct l7vs_conn *conn) "
+ "return_value: void");
+ }
+ /*------ DEBUG LOG END ------*/
+ return;
+ }
+ if (!conn->riom) {
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,301,
+ "out_function: void l7vs_conn_close_rsock(struct l7vs_conn *conn) "
+ "return_value: void");
+ }
+ /*------ DEBUG LOG END ------*/
+ return;
+ }
+ if (-1 == conn->riom->fd) {
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,302,
+ "out_function: void l7vs_conn_close_rsock(struct l7vs_conn *conn) "
+ "return_value: void");
+ }
+ /*------ DEBUG LOG END ------*/
+ return;
+ }
+
+ if (conn->dest) {
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,303, "dest %p nactive %d->%d",
+ conn->dest, conn->dest->nactive,
+ conn->dest->nactive - 1);
+ }
+ conn->dest->nactive--;
+ conn->dest->ninact++;
+ if(conn->dest->ninact == INT_MAX) {
+ conn->dest->ninact = 0;
+ }
+
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,343,
+ "RealServer Connected Count : ninact is %d",
+ conn->dest->ninact);
+ }
+ /*------ DEBUG LOG END ------*/
+ }
+
+ l7vs_iomux_remove(conn->riom);
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,304,
+ "close: conn->riom->fd=%d",
+ conn->riom->fd);
+ }
+ /*------ DEBUG LOG END ------*/
+ close(conn->riom->fd);
+ conn->riom->fd = -1;
+
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,305,
+ "out_function: void l7vs_conn_close_rsock(struct l7vs_conn *conn) "
+ "return_value: void");
+ }
+ /*------ DEBUG LOG END ------*/
+}
+
+/*!
+ * confirmation of whether conn is closed
+ *
+ * @param[in] conn connection
+ * @return closed or not
+ * @retval 0 not closed
+ * @retval 1 closed
+ */
+int
+l7vs_conn_closed(struct l7vs_conn *conn)
+{
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ char conn_str[DEBUG_STR_LEN] = {0};
+ l7vs_conn_c_str(conn_str, conn);
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,306,
+ "in_function: int l7vs_conn_closed(struct l7vs_conn *conn) "
+ "conn=%s",
+ conn_str);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ if (!conn) {
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,307,
+ "out_function: int l7vs_conn_closed(struct l7vs_conn *conn) "
+ "return_value: 1");
+ }
+ /*------ DEBUG LOG END ------*/
+ return 1;
+ }
+ if ((conn->ciom && -1 != conn->ciom->fd) || (conn->riom && -1 != conn->riom->fd)) {
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,308,
+ "out_function: int l7vs_conn_closed(struct l7vs_conn *conn) "
+ "return_value: 0");
+ }
+ /*------ DEBUG LOG END ------*/
+ return 0;
+ } else {
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,309,
+ "out_function: int l7vs_conn_closed(struct l7vs_conn *conn) "
+ "return_value: 1");
+ }
+ /*------ DEBUG LOG END ------*/
+ return 1;
+ }
+}
+
+/*!
+ * Change connection to specified destination (to real-server or sorry-server).
+ *
+ * @param[in] *conn connection pointer
+ * @param[in] *dest destination pointer
+ * @return int change connection result 0=NG, 1=OK
+ */
+static int l7vs_conn_change_connect_rs(struct l7vs_conn *conn, struct l7vs_dest *dest)
+{
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ char conn_str[DEBUG_STR_LEN] = {0};
+ char dest_str[DEBUG_STR_LEN] = {0};
+ l7vs_conn_c_str(conn_str, conn);
+ l7vs_dest_c_str(dest_str, dest);
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,310,
+ "in_function: static int l7vs_conn_change_connect_rs(struct l7vs_conn *conn, struct l7vs_dest *dest) "
+ "conn=%s: "
+ "dest=%s",
+ conn_str, dest_str);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ int ret;
+
+ if (!conn) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_PROGRAM,77, "error / conn is null");
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,311,
+ "out_function: static int l7vs_conn_change_connect_rs(struct l7vs_conn *conn, struct l7vs_dest *dest) "
+ "return_value: 0");
+ }
+ /*------ DEBUG LOG END ------*/
+ return 0;
+ }
+ if (!dest) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_PROGRAM,78, "error / dest is null");
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,312,
+ "out_function: static int l7vs_conn_change_connect_rs(struct l7vs_conn *conn, struct l7vs_dest *dest) "
+ "return_value: 0");
+ }
+ /*------ DEBUG LOG END ------*/
+ return 0;
+ }
+ // save old destination
+ conn->old_dest = conn->dest;
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ char old_dest_str[DEBUG_STR_LEN] = {0};
+ l7vs_dest_c_str(old_dest_str, conn->old_dest);
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,313,
+ "pointer_assign: conn->old_dest=%s",
+ old_dest_str);
+ }
+ /*------ DEBUG LOG END ------*/
+ // close real-server connection
+ l7vs_conn_close_rsock(conn);
+ // connect to new destination
+ ret = l7vs_conn_connect_rs(conn, dest);
+
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,314,
+ "out_function: static int l7vs_conn_change_connect_rs(struct l7vs_conn *conn, struct l7vs_dest *dest) "
+ "return_value: %d",
+ ret);
+ }
+ /*------ DEBUG LOG END ------*/
+ return ret;
+}
+
+/*!
+ * Judges from the data size received last time and recieve-interval
+ *
+ * @param[in] *conn connection pointer
+ * @param[in] direction traffic direction
+ * @return int permitte for recv function call 0=NG(not permitted), 1=OK(permitted)
+ */
+static int
+l7vs_conn_QoS_control( struct l7vs_conn *conn, int direction )
+{
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ char conn_str[DEBUG_STR_LEN] = {0};
+ l7vs_conn_c_str(conn_str, conn);
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,315,
+ "in_function: static int l7vs_conn_QoS_control( struct l7vs_conn *conn, int direction ) "
+ "conn=%s, direction=%d",
+ conn_str, direction);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ if (!conn) {
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,316,
+ "out_function: static int l7vs_conn_QoS_control( struct l7vs_conn *conn, int direction ) "
+ "return_value: 1");
+ }
+ /*------ DEBUG LOG END ------*/
+ return 1;
+ }
+ if (!conn->srv) {
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,317,
+ "out_function: static int l7vs_conn_QoS_control( struct l7vs_conn *conn, int direction ) "
+ "return_value: 1");
+ }
+ /*------ DEBUG LOG END ------*/
+ return 1;
+ }
+
+ struct timeval CurrTime;
+ gettimeofday( &CurrTime, NULL );
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ char time_str[DEBUG_STR_LEN] = {0};
+ snprintf(time_str, DEBUG_STR_LEN,
+ "timeval="
+ "{tv_sec=%ld: "
+ "tv_usec=%ld}"
+ , CurrTime.tv_sec
+ , CurrTime.tv_usec);
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,339,
+ "gettimeofday result: CurrTime=%s",
+ time_str);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ unsigned long long cur_recvtime = (CurrTime.tv_sec * 1000000ULL + CurrTime.tv_usec) / throughput_interval;
+ l7vs_service_update_throughput(conn->srv, cur_recvtime);
+
+ switch (direction) {
+ case QOS_UP:
+ //QoS Control check : to server
+ conn->srv->throughput_to_server = conn->srv->cur_recvsize_from_client * 1000000ULL / throughput_interval;
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,323, "QoS threshold to server:%lld ", conn->srv->qos_threshold_up);
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,324, "(current throughput:%lld)", conn->srv->throughput_to_server);
+ }
+ if( (conn->srv->qos_threshold_up) && (conn->srv->throughput_to_server + l7vs_conn_read_bufsize > conn->srv->qos_threshold_up) ){
+ if (conn->srv->qos_up_flag == 0) {
+ LOGGER_PUT_LOG_INFO(LOG_CAT_L7VSD_NETWORK_QOS,1, "Start QoS traffic control to server.");
+ conn->srv->qos_up_flag = 1;
+ }
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,326,
+ "out_function: static int l7vs_conn_QoS_control( struct l7vs_conn *conn, int direction ) "
+ "return_value: 0");
+ }
+ /*------ DEBUG LOG END ------*/
+ return 0;
+ }
+ if (conn->srv->qos_up_flag == 1) {
+ LOGGER_PUT_LOG_INFO(LOG_CAT_L7VSD_NETWORK_QOS,2, "Stop QoS traffic control to server.");
+ conn->srv->qos_up_flag = 0;
+ }
+ break;
+ case QOS_DOWN:
+ //QoS Control check : to client
+ conn->srv->throughput_to_client = conn->srv->cur_recvsize_from_server * 1000000ULL / throughput_interval;
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,323, "QoS threshold to client:%lld ", conn->srv->qos_threshold_down);
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,324, "(current throughput:%lld)", conn->srv->throughput_to_client);
+ }
+ if( (conn->srv->qos_threshold_down) && (conn->srv->throughput_to_client + l7vs_conn_read_bufsize > conn->srv->qos_threshold_down) ){
+ if (conn->srv->qos_down_flag == 0) {
+ LOGGER_PUT_LOG_INFO(LOG_CAT_L7VSD_NETWORK_QOS,3, "Start QoS traffic control to client.");
+ conn->srv->qos_down_flag = 1;
+ }
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,326,
+ "out_function: static int l7vs_conn_QoS_control( struct l7vs_conn *conn, int direction ) "
+ "return_value: 0");
+ }
+ /*------ DEBUG LOG END ------*/
+ return 0;
+ }
+ if (conn->srv->qos_down_flag == 1) {
+ LOGGER_PUT_LOG_INFO(LOG_CAT_L7VSD_NETWORK_QOS,4, "Stop QoS traffic control to client.");
+ conn->srv->qos_down_flag = 0;
+ }
+ break;
+ default:
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,317,
+ "out_function: static int l7vs_conn_QoS_control( struct l7vs_conn *conn, int direction ) "
+ "return_value: 1");
+ }
+ /*------ DEBUG LOG END ------*/
+ return 1;
+ }
+
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,335,
+ "out_function: static int l7vs_conn_QoS_control( struct l7vs_conn *conn ) "
+ "return_value: 1");
+ }
+ /*------ DEBUG LOG END ------*/
+ return 1;
+}
+
+/*!
+ * Regsiter recive time and recieved data size
+ *
+ * @param[in] *conn connection pointer
+ * @param[in] in_recvsize recieved size
+ * @param[in] direction traffic direction
+ * @return void
+ */
+static void
+l7vs_conn_QoS_recvsize_register( struct l7vs_conn *conn, const size_t in_recvsize, int direction )
+{
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ char conn_str[DEBUG_STR_LEN] = {0};
+ l7vs_conn_c_str(conn_str, conn);
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,336,
+ "in_function: static void l7vs_conn_QoS_recvsize_register( struct l7vs_conn *conn, const size_t in_recvsize ) "
+ "conn=%s: "
+ "in_recvsize=%zu",
+ conn_str, in_recvsize);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ if (!conn) {
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,337,
+ "out_function: static void l7vs_conn_QoS_recvsize_register( struct l7vs_conn *conn, const size_t in_recvsize ) "
+ "return_value: void");
+ }
+ /*------ DEBUG LOG END ------*/
+ return;
+ }
+ if (!conn->srv) {
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,338,
+ "out_function: static void l7vs_conn_QoS_recvsize_register( struct l7vs_conn *conn, const size_t in_recvsize ) "
+ "return_value: void");
+ }
+ /*------ DEBUG LOG END ------*/
+ return;
+ }
+ struct timeval CurrTime;
+ gettimeofday( &CurrTime, NULL );
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ char time_str[DEBUG_STR_LEN] = {0};
+ snprintf(time_str, DEBUG_STR_LEN,
+ "timeval="
+ "{tv_sec=%ld: "
+ "tv_usec=%ld}"
+ , CurrTime.tv_sec
+ , CurrTime.tv_usec);
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,339,
+ "gettimeofday result: CurrTime=%s",
+ time_str);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ int throughput_interval = BPS_DEFAULT_INTERVAL;
+ if ( parameter_is_int_exist( PARAM_COMP_L7VSD, "calc_throughput_interval" ) ) {
+ throughput_interval = parameter_get_int_value( PARAM_COMP_L7VSD, "calc_throughput_interval" );
+ }
+ unsigned long long cur_recvtime = (CurrTime.tv_sec * 1000000ULL + CurrTime.tv_usec) / throughput_interval;
+ l7vs_service_update_throughput(conn->srv, cur_recvtime);
+
+ switch (direction) {
+ case QOS_UP:
+ conn->srv->cur_recvsize_from_client += in_recvsize;
+ break;
+ case QOS_DOWN:
+ conn->srv->cur_recvsize_from_server += in_recvsize;
+ break;
+ default:
+ break;
+ }
+
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK,340,
+ "out_function: static void l7vs_conn_QoS_recvsize_register( struct l7vs_conn *conn, const size_t in_recvsize ) "
+ "return_value: void");
+ }
+ /*------ DEBUG LOG END ------*/
+}
+
--- /dev/null
+/*
+ * @file dest.c
+ * @brief the realserver information management component
+ * @brief it operates realserver infomation struct
+ *
+ * L7VSD: Linux Virtual Server for Layer7 Load Balancing
+ * Copyright (C) 2005 NTT COMWARE Corporation.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ **********************************************************************/
+
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <netinet/tcp.h>
+#include <arpa/inet.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include "logger_wrapper.h"
+#include "l7vs_dest.h"
+
+/*!
+ * create struct dest
+ * @param[in] *addr sockaddr_in
+ * @param[in] weight source int
+ * @return struct l7vs_dest *
+ */
+struct l7vs_dest *
+l7vs_dest_create(struct sockaddr_in *addr, int weight)
+{
+ char dest_str[DEBUG_STR_LEN] = {0};
+ struct l7vs_dest *dest;
+ char addr_str[DEBUG_STR_LEN] = {0};
+
+
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_REAL_SERVER)) {
+ l7vs_dest_sockaddr_in_c_str(addr_str,addr);
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REAL_SERVER,9,
+ "in_function: struct l7vs_dest * l7vs_dest_create(struct sockaddr_in *addr, int weight)"
+ "addr = %s"
+ "weight = %d",
+ addr_str,weight);
+ }
+
+ dest = (struct l7vs_dest *)malloc(sizeof(*dest));
+ if (dest == NULL) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_SYSTEM_MEMORY,7,"dest create : Could not allocate memory");
+ return dest;
+ }
+
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_SYSTEM_MEMORY)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_SYSTEM_MEMORY,1,
+ "in_function l7vs_dest_create:allocate memory"
+ " : size=%ld , pointer=%p",
+ sizeof(*dest),dest);
+ }
+
+ dest->addr = *addr;
+ dest->weight = weight;
+ dest->nactive = dest->ninact = 0;
+
+ l7vs_dest_c_str(dest_str, dest);
+ LOGGER_PUT_LOG_INFO(LOG_CAT_L7VSD_REAL_SERVER,3,"RealServer Information: %s",dest_str);
+
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_REAL_SERVER)) {
+ l7vs_dest_c_str(dest_str, dest);
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REAL_SERVER,10,
+ "pointer_assign: dest=%s",
+ dest_str);
+ }
+
+
+#if 0
+ mss = l7vs_dest_get_mss(addr);
+ if (mss < 0) {
+ free(dest);
+ return NULL;
+ }
+ dest->mss = mss;
+#endif
+
+
+ return dest;
+}
+
+/*!
+ * destroy struct dest
+ * @param[in] *dest l7vs_dest
+ * @return void
+ */
+void
+l7vs_dest_destroy(struct l7vs_dest *dest)
+{
+ char dest_str[DEBUG_STR_LEN] = {0};
+
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_REAL_SERVER)) {
+ l7vs_dest_c_str(dest_str, dest);
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REAL_SERVER,11,
+ "in_function: void l7vs_dest_create(struct l7vs_dest *dest)"
+ "dest = %s",
+ dest_str);
+ }
+
+ l7vs_dest_c_str(dest_str, dest);
+ LOGGER_PUT_LOG_INFO(LOG_CAT_L7VSD_REAL_SERVER,4,"RealServer Information: %s",dest_str);
+
+ free(dest);
+ dest = NULL;
+}
+
+/*!
+ * create struct l7vs_dest_arg
+ * @param[in] *dest l7vs_dest
+ * @param[in] *darg l7vs_dest_arg
+ * @return void
+ */
+void
+l7vs_dest_to_arg(struct l7vs_dest *dest, struct l7vs_dest_arg *darg)
+{
+ if(darg != NULL && dest != NULL)
+ {
+ darg->addr = dest->addr;
+ darg->weight = dest->weight;
+ darg->nactive = dest->nactive;
+ darg->ninact = dest->ninact;
+ }
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_REAL_SERVER)) {
+ char dest_str[DEBUG_STR_LEN] = {0};
+ char darg_str[DEBUG_STR_LEN] = {0};
+ l7vs_dest_c_str(dest_str, dest);
+ l7vs_darg_c_str(darg_str, darg);
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REAL_SERVER,12,
+ "in_function: void l7vs_dest_to_arg(struct l7vs_dest *dest, struct l7vs_dest_arg *darg)"
+ "dest=%s: "
+ "darg=%s",
+ dest_str,darg_str);
+ }
+}
+
--- /dev/null
+/*!
+ * @file iomux.c
+ * @brief It is a code in which sets of iomux are managed.
+ * @brief An actual set is operated only by this code.
+ * @brief Moreover, epoll is operated by this code.
+ * @brief L7VSD: Linux Virtual Server for Layer7 Load Balancing
+ *
+ * Copyright (C) 2005 NTT COMWARE Corporation.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ **********************************************************************/
+
+#include <sys/types.h>
+#include <sys/time.h>
+#include <sys/epoll.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <assert.h>
+#include <time.h>
+#include <sys/time.h>
+#include <glib.h>
+#include "parameter_wrapper.h"
+#include "logger_wrapper.h"
+#include "l7vs.h"
+#include "l7vs_conn.h"
+#include "l7vs_iomuxlist.h"
+
+/*
+#ifndef MAXEVENTS
+#define MAXEVENTS 1024 //! epoll max event size
+#endif
+*/
+static int maxevents = 1024;
+static struct l7vs_iomux* iomux_array = NULL; //! iomux array
+static struct epoll_event* event_array = NULL; //! event list
+
+static GHashTable* iomux_hash = NULL; //! fd hashtable
+static GList* iomux_avail_list = NULL; //! iomux available list
+static unsigned int iomux_avail_list_length; //! number of iomux available list
+static int eventpoll = -1; //! epoll fd
+
+//inner functions
+static gboolean removeall( gpointer, gpointer, gpointer );
+
+/*!
+ * initialize iomux_hash
+ *
+ * @param[in] void
+ * @return status
+ * @retval 0 failed
+ * @retval 1 succeed
+ */
+int
+l7vs_iomux_init()
+{
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_EVENT)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_EVENT,1,
+ "in_function: int l7vs_iomux_init() ");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ int ret = parameter_is_int_exist( PARAM_COMP_IOMUX, "max_events" );
+ if (ret) {
+ int event = parameter_get_int_value( PARAM_COMP_IOMUX, "max_events" );
+ if (event > 0)
+ maxevents = event;
+ else {
+ LOGGER_PUT_LOG_WARN(LOG_CAT_L7VSD_EVENT,1,
+ "l7vsd uses default max_events = %d ,because your value is invalid ",maxevents);
+ }
+ }
+ else {
+ LOGGER_PUT_LOG_WARN(LOG_CAT_L7VSD_EVENT,2,
+ "max_events is not specified. l7vsd uses default max_events = %d ",maxevents);
+ }
+
+ iomux_avail_list_length = maxevents;
+ if (iomux_avail_list == NULL) {
+ iomux_array = (struct l7vs_iomux*) calloc(sizeof(struct l7vs_iomux), maxevents);
+ }
+ if (!iomux_array) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_EVENT,26, "error / calloc failed");
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_EVENT)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_EVENT,59,
+ "in_function: int l7vs_iomux_init() "
+ "return_value: -1");
+ }
+ /*------ DEBUG LOG END ------*/
+ return -1;
+ }
+
+ if (iomux_avail_list == NULL) {
+ event_array = (struct epoll_event*) calloc(sizeof(struct epoll_event), maxevents);
+ }
+ if (!event_array) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_EVENT,27, "error / calloc failed");
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_EVENT)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_EVENT,60,
+ "in_function: int l7vs_iomux_init() "
+ "return_value: -1");
+ }
+ /*------ DEBUG LOG END ------*/
+ return -1;
+ }
+
+ int i = 0;
+ struct l7vs_iomux temp_iom = {-1, NULL, iomux_create, NULL};
+
+ if (-1 != eventpoll) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_EVENT,4, "error / epoll already exist");
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_EVENT)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_EVENT,2,
+ "in_function: int l7vs_iomux_init() "
+ "return_value: -1");
+ }
+ /*------ DEBUG LOG END ------*/
+ return -1;
+ }
+
+ //create epoll
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_EVENT)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_EVENT,3,
+ "epoll_create : size=%d",
+ maxevents);
+ }
+ /*------ DEBUG LOG END ------*/
+ eventpoll = epoll_create(maxevents);
+ if (0 > eventpoll) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_EVENT,5, "error / epoll create error");
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_EVENT)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_EVENT,4,
+ "in_function: int l7vs_iomux_init() "
+ "return_value: %d", eventpoll);
+ }
+ /*------ DEBUG LOG END ------*/
+ return eventpoll;
+ }
+
+ //new hashtable
+ if (!iomux_hash) {
+ iomux_hash = g_hash_table_new(&g_int_hash, &g_int_equal);
+ }
+
+ //init iomux_array and avail_list
+ if (!iomux_avail_list) {
+ for (i = 0; i < maxevents; ++i) {
+ memcpy(iomux_array + i, &temp_iom, sizeof(struct l7vs_iomux));
+ iomux_avail_list = g_list_append(iomux_avail_list, &iomux_array[i]);
+ }
+ }
+
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_EVENT)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_EVENT,5,
+ "in_function: int l7vs_iomux_init() "
+ "return_value: 1");
+ }
+ /*------ DEBUG LOG END ------*/
+ return 1;
+}
+
+/*!
+ * finalize iomux_hash
+ *
+ * @param[in] void
+ * @return void
+ */
+void
+l7vs_iomux_fini()
+{
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_EVENT)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_EVENT,6,
+ "in_function: void l7vs_iomux_fini() ");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ if (-1 == eventpoll) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_EVENT,6, "error / epoll is not initialized");
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_EVENT)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_EVENT,7,
+ "out_function: void l7vs_iomux_fini() "
+ "return_value: void");
+ }
+ /*------ DEBUG LOG END ------*/
+ return;
+ }
+
+ //all fd close and remove
+ l7vs_iomux_removeall();
+
+ //g_hashtable destroy
+ if (iomux_hash) {
+ g_hash_table_destroy(iomux_hash);
+ iomux_hash = NULL;
+ }
+
+ //g_list free
+ if (iomux_avail_list) {
+ g_list_free(iomux_avail_list);
+ iomux_avail_list = NULL;
+ }
+
+ //epoll close
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_EVENT)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_EVENT,8,
+ "close: eventpoll=%d",
+ eventpoll);
+ }
+ /*------ DEBUG LOG END ------*/
+ close(eventpoll);
+ eventpoll = -1;
+
+ if (iomux_array) {
+ free(iomux_array);
+ iomux_array = NULL;
+ }
+
+ if (event_array) {
+ free(event_array);
+ event_array = NULL;
+ }
+
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_EVENT)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_EVENT,9,
+ "out_function: void l7vs_iomux_fini() "
+ "return_value: void");
+ }
+ /*------ DEBUG LOG END ------*/
+}
+
+/*!
+ * get available iom from avail_list
+ *
+ * @param[in] void
+ * @return available iom
+ */
+struct l7vs_iomux*
+l7vs_iomux_get_from_avail_list()
+{
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_EVENT)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_EVENT,10,
+ "in_function: struct l7vs_iomux* l7vs_iomux_get_from_avail_list() ");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ if (0 == iomux_avail_list_length) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_EVENT,7, "warning / no iomux available");
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_EVENT)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_EVENT,11,
+ "out_function: struct l7vs_iomux* l7vs_iomux_get_from_avail_list() "
+ "return_value: iom=NULL");
+ }
+ /*------ DEBUG LOG END ------*/
+ return NULL;
+ }
+
+ struct l7vs_iomux *iom = (struct l7vs_iomux *)(g_list_first(iomux_avail_list))->data;
+ iomux_avail_list = g_list_remove(iomux_avail_list, (gpointer)iom);
+ --iomux_avail_list_length;
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_EVENT)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_EVENT,12,
+ "iomux_avail_list_length: %d",
+ iomux_avail_list_length);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_EVENT)) {
+ char ret_iomux_str[DEBUG_STR_LEN] = {0};
+ l7vs_iomux_c_str(ret_iomux_str, iom);
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_EVENT,13,
+ "out_function: struct l7vs_iomux* l7vs_iomux_get_from_avail_list() "
+ "return_value: iom=%s",
+ ret_iomux_str);
+ }
+ /*------ DEBUG LOG END ------*/
+ return iom;
+}
+
+/*!
+ * put disuse iom to avail_list
+ *
+ * @param[in] iom return iom
+ * @return void
+ */
+void
+l7vs_iomux_put_to_avail_list(struct l7vs_iomux *iom)
+{
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_EVENT)) {
+ char iomux_str[DEBUG_STR_LEN] = {0};
+ l7vs_iomux_c_str(iomux_str, iom);
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_EVENT,14,
+ "in_function: void l7vs_iomux_put_to_avail_list(struct l7vs_iomux *iom) "
+ "iom=%s",
+ iomux_str);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ if (!iom) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_EVENT,8, "error / iom is null");
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_EVENT)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_EVENT,15,
+ "out_function: void l7vs_iomux_put_to_avail_list(struct l7vs_iomux *iom) "
+ "return_value: void");
+ }
+ /*------ DEBUG LOG END ------*/
+ return;
+ }
+
+ iom->fd = -1;
+ iom->callback = NULL;
+ iom->status = iomux_create;
+ iom->data = NULL;
+
+ iomux_avail_list = g_list_append(iomux_avail_list, (gpointer)iom);
+ ++iomux_avail_list_length;
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_EVENT)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_EVENT,16,
+ "iomux_avail_list_length: %d",
+ iomux_avail_list_length);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_EVENT)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_EVENT,17,
+ "out_function: void l7vs_iomux_put_to_avail_list(struct l7vs_iomux *iom) "
+ "return_value: void");
+ }
+ /*------ DEBUG LOG END ------*/
+}
+
+/*!
+ * iomux is added to hashtbale
+ *
+ * @param[in] *iom iompointer
+ * @param[in] action iom epoll action
+ * @return void
+ */
+void
+l7vs_iomux_add(struct l7vs_iomux* iom, enum iomaction action)
+{
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_EVENT)) {
+ char iomux_str[DEBUG_STR_LEN] = {0};
+ l7vs_iomux_c_str(iomux_str, iom);
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_EVENT,18,
+ "in_function: void l7vs_iomux_add(struct l7vs_iomux* iom, enum iomaction action) "
+ "iom=%s: "
+ "iomaction=%d",
+ iomux_str, action);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ int ret = 0;
+ struct epoll_event event;
+
+ if (!iom) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_EVENT,9, "error / iom is null");
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_EVENT)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_EVENT,19,
+ "out_function: void l7vs_iomux_add(struct l7vs_iomux* iom, enum iomaction action) "
+ "return_value: void");
+ }
+ /*------ DEBUG LOG END ------*/
+ return;
+ }
+ if (-1 == iom->fd) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_EVENT,10, "error / fd is not specified");
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_EVENT)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_EVENT,20,
+ "out_function: void l7vs_iomux_add(struct l7vs_iomux* iom, enum iomaction action) "
+ "return_value: void");
+ }
+ /*------ DEBUG LOG END ------*/
+ return;
+ }
+
+ event.data.ptr = iom;
+ switch( action ){
+ case iom_read:
+ event.events = EPOLLET | EPOLLIN | EPOLLHUP;
+ break;
+ case iom_write:
+ event.events = EPOLLET | EPOLLOUT | EPOLLHUP;
+ break;
+ default:
+ //error !
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_EVENT,11, "error / invalid action");
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_EVENT)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_EVENT,21,
+ "out_function: void l7vs_iomux_add(struct l7vs_iomux* iom, enum iomaction action) "
+ "return_value: void");
+ }
+ /*------ DEBUG LOG END ------*/
+ return;
+ }
+
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_EVENT)) {
+ char iomux_str[DEBUG_STR_LEN] = {0};
+ l7vs_iomux_c_str(iomux_str, iom);
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_EVENT,22,
+ "epoll_ctl : epfd=%d: op=EPOLL_CTL_ADD: fd=%d: event.events=%d: event.data=%s",
+ eventpoll, iom->fd, event.events, iomux_str);
+ }
+ /*------ DEBUG LOG END ------*/
+ ret = epoll_ctl( eventpoll, EPOLL_CTL_ADD, iom->fd, &event );
+ g_hash_table_insert(iomux_hash, &(iom->fd), iom );
+
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_EVENT)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_EVENT,23,
+ "out_function: void l7vs_iomux_add(struct l7vs_iomux* iom, enum iomaction action) "
+ "return_value: void");
+ }
+ /*------ DEBUG LOG END ------*/
+}
+
+/*!
+ * iomux is remove from hashtable
+ *
+ * @param[in] *iom iompointer
+ * @return void
+ */
+void
+l7vs_iomux_remove(struct l7vs_iomux* iom)
+{
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_EVENT)) {
+ char iomux_str[DEBUG_STR_LEN] = {0};
+ l7vs_iomux_c_str(iomux_str, iom);
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_EVENT,24,
+ "in_function: void l7vs_iomux_remove(struct l7vs_iomux* iom) "
+ "iom=%s",
+ iomux_str);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ int ret = 0;
+
+ if (!iom) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_EVENT,12, "error / iom is null");
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_EVENT)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_EVENT,25,
+ "out_function: void l7vs_iomux_remove(struct l7vs_iomux* iom) "
+ "return_value: void");
+ }
+ /*------ DEBUG LOG END ------*/
+ return;
+ }
+ if (-1 == iom->fd) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_EVENT,13, "error / fd is not specified");
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_EVENT)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_EVENT,26,
+ "out_function: void l7vs_iomux_remove(struct l7vs_iomux* iom) "
+ "return_value: void");
+ }
+ /*------ DEBUG LOG END ------*/
+ return;
+ }
+
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_EVENT)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_EVENT,27,
+ "epoll_ctl : epfd=%d: op=EPOLL_CTL_DEL: fd=%d",
+ eventpoll, iom->fd);
+ }
+ /*------ DEBUG LOG END ------*/
+ ret = epoll_ctl(eventpoll, EPOLL_CTL_DEL, iom->fd, NULL);
+ g_hash_table_remove(iomux_hash, &(iom->fd));
+
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_EVENT)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_EVENT,28,
+ "out_function: void l7vs_iomux_remove(struct l7vs_iomux* iom) "
+ "return_value: void");
+ }
+ /*------ DEBUG LOG END ------*/
+}
+
+/*!
+ * iomux modify epoll events
+ *
+ * @param[in] *iom iom pointer
+ * @param[in] action iom action mode
+ * @return void
+ */
+void
+l7vs_iomux_mod(struct l7vs_iomux* iom, enum iomaction action)
+{
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_EVENT)) {
+ char iomux_str[DEBUG_STR_LEN] = {0};
+ l7vs_iomux_c_str(iomux_str, iom);
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_EVENT,29,
+ "in_function: void l7vs_iomux_mod(struct l7vs_iomux* iom, enum iomaction action) "
+ "iom=%s: "
+ "iomaction=%d",
+ iomux_str, action);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ int ret = 0;
+ struct epoll_event event;
+
+ if (!iom) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_EVENT,14, "error / iom is null");
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_EVENT)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_EVENT,30,
+ "out_function: void l7vs_iomux_mod(struct l7vs_iomux* iom, enum iomaction action) "
+ "return_value: void");
+ }
+ /*------ DEBUG LOG END ------*/
+ return;
+ }
+ if (-1 == iom->fd) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_EVENT,15, "error / fd is not specified");
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_EVENT)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_EVENT,31,
+ "out_function: void l7vs_iomux_mod(struct l7vs_iomux* iom, enum iomaction action) "
+ "return_value: void");
+ }
+ /*------ DEBUG LOG END ------*/
+ return;
+ }
+
+ event.data.ptr = iom;
+ switch (action) {
+ case iom_read:
+ event.events = EPOLLET | EPOLLIN | EPOLLHUP;
+ break;
+ case iom_write:
+ event.events = EPOLLET | EPOLLOUT | EPOLLHUP;
+ break;
+ case iom_hup:
+ event.events = EPOLLET | EPOLLHUP;
+ break;
+ default:
+ //error !
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_EVENT,16, "error / invalid action");
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_EVENT)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_EVENT,32,
+ "out_function: void l7vs_iomux_mod(struct l7vs_iomux* iom, enum iomaction action) "
+ "return_value: void");
+ }
+ /*------ DEBUG LOG END ------*/
+ return;
+ }
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_EVENT)) {
+ char iomux_str[DEBUG_STR_LEN] = {0};
+ l7vs_iomux_c_str(iomux_str, iom);
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_EVENT,33,
+ "epoll_ctl : epfd=%d: op=EPOLL_CTL_MOD: fd=%d: event.events=%d: event.data=%s",
+ eventpoll, iom->fd, event.events, iomux_str);
+ }
+ /*------ DEBUG LOG END ------*/
+ ret = epoll_ctl(eventpoll, EPOLL_CTL_MOD, iom->fd, &event);
+
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_EVENT)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_EVENT,34,
+ "out_function: void l7vs_iomux_mod(struct l7vs_iomux* iom, enum iomaction action) "
+ "return_value: void");
+ }
+ /*------ DEBUG LOG END ------*/
+}
+
+/*!
+ * close all filedescriptor
+ *
+ * removeall() function is called l7vs_iomux_delall()
+ * GHashTable is don't all contenior;
+ * but function callback set all contenor;
+ */
+static gboolean
+removeall(gpointer key, gpointer value, gpointer userdata)
+{
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_EVENT)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_EVENT,35,
+ "in_function: static gboolean removeall(gpointer key, gpointer value, gpointer userdata) "
+ "key=%p: "
+ "value=%p: "
+ "userdata=%p",
+ key, value, userdata);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ struct l7vs_iomux *iom = (struct l7vs_iomux *)value;
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_EVENT)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_EVENT,36,
+ "epoll_ctl : epfd=%d: op=EPOLL_CTL_DEL: fd=%d",
+ eventpoll, iom->fd);
+ }
+ /*------ DEBUG LOG END ------*/
+ epoll_ctl(eventpoll, EPOLL_CTL_DEL, iom->fd, NULL);
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_EVENT)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_EVENT,37,
+ "out_function: static gboolean removeall(gpointer key, gpointer value, gpointer userdata) "
+ "return_value: TRUE");
+ }
+ /*------ DEBUG LOG END ------*/
+ return TRUE;
+}
+
+/*!
+ * all contnior delete hash_table
+ *
+ * @return void*
+ */
+void
+l7vs_iomux_removeall()
+{
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_EVENT)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_EVENT,38,
+ "in_function: void l7vs_iomux_removeall()");
+ }
+ /*------ DEBUG LOG END ------*/
+ g_hash_table_foreach_remove(iomux_hash, removeall, NULL);
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_EVENT)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_EVENT,39,
+ "out_function: void l7vs_iomux_removeall() "
+ "return_value: TRUE");
+ }
+ /*------ DEBUG LOG END ------*/
+}
+
+/*!
+ * polling function for epoll.
+ *
+ * @param[in] *timo waittime;
+ * @return error
+ */
+int
+l7vs_iomux_poll(struct timeval *timo, int blocking)
+{
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_EVENT)) {
+ if (!timo) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_EVENT,40,
+ "in_function: int l7vs_iomux_poll(struct timeval *timo, int blocking) "
+ "timo=NULL, blocking = %d", blocking);
+ }
+ else {
+ char time_str[DEBUG_STR_LEN] = {0};
+ snprintf(time_str, DEBUG_STR_LEN,
+ "timeval="
+ "{tv_sec=%ld: "
+ "tv_usec=%ld}"
+ , timo->tv_sec
+ , timo->tv_usec);
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_EVENT,41,
+ "in_function: int l7vs_iomux_poll(struct timeval *timo) "
+ "timo=%s, blocking=%d",
+ time_str, blocking);
+ }
+ }
+ /*------ DEBUG LOG END ------*/
+
+ int fdnum;
+ int i;
+ int ret;
+ struct l7vs_iomux *iom;
+ struct l7vs_conn *conn;
+
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_EVENT)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_EVENT,42,
+ "epoll_wait param: epfd=%d: maxevents=%d: timeout=0",
+ eventpoll, maxevents);
+ }
+ /*------ DEBUG LOG END ------*/
+ fdnum = epoll_wait(eventpoll, event_array, maxevents, blocking);
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_EVENT)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_EVENT,43,
+ "epoll_wait result: fdnum=%d",
+ fdnum);
+ }
+ /*------ DEBUG LOG END ------*/
+ for (i = 0; i < fdnum; ++i) {
+ if (event_array[i].data.ptr) {
+ iom = (struct l7vs_iomux *)event_array[i].data.ptr;
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_EVENT)) {
+ char iomux_str[DEBUG_STR_LEN] = {0};
+ l7vs_iomux_c_str(iomux_str, iom);
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_EVENT,44,
+ "event_array[%d].data.ptr: %s",
+ i, iomux_str);
+ }
+ /*------ DEBUG LOG END ------*/
+ if (iom->status != iomux_create) {
+ if (event_array[i].events & (EPOLLHUP | EPOLLERR)) {
+ // disconnect when sending
+ conn = (struct l7vs_conn *)iom->data;
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_EVENT)) {
+ char conn_str[DEBUG_STR_LEN] = {0};
+ l7vs_conn_c_str(conn_str, conn);
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_EVENT,45,
+ "pointer_assign: conn=%s",
+ conn_str);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ // destroy conn
+ l7vs_conn_destroy(conn);
+
+ } else if (event_array[i].events & (EPOLLIN | EPOLLOUT)) {
+ if (iom->status != iomux_disabled) {
+ if (iom->callback) {
+ // if there is mismatch between status and events,
+ // read event will regist after, (when send was finished)
+ // therefore, through callback
+ if (!(event_array[i].events & EPOLLIN &&
+ (iomux_conn_sending == iom->status ||
+ iomux_conn_sending_busy == iom->status))) {
+ // execute callback
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_EVENT)) {
+ char ex_iomux_str[DEBUG_STR_LEN] = {0};
+ l7vs_iomux_c_str(ex_iomux_str, iom);
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_EVENT,46,
+ "iom->callback: %p: iom=%s",
+ iom->callback, ex_iomux_str);
+ }
+ /*------ DEBUG LOG END ------*/
+ ret = iom->callback(iom);
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_EVENT)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_EVENT,47,
+ "iom->callback result: ret=%d",
+ ret);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ }
+ } else {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_EVENT,17, "error / callback not bind");
+ }
+ }
+ } else {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_EVENT,18, "error / unkown event:%x", event_array[i].events);
+ }
+ } else {
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_EVENT)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_EVENT,48, "debug / invalid status:iomux_create");
+ }
+ }
+ } else {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_EVENT,19, "error / epolldata.data.ptr is null");
+ }
+ }
+
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_EVENT)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_EVENT,49,
+ "out_function: int l7vs_iomux_poll(struct timeval *timo) "
+ "return_value: 1");
+ }
+ /*------ DEBUG LOG END ------*/
+ return 1;
+
+}
--- /dev/null
+#!/usr/bin/perl
+######################################################################
+# l7cookie
+# Calculate cookie value for UltraMonkey-L7 cpassive module.
+#
+# 2009 (C) NTT COMWARE
+#
+# License: GNU General Public License (GPL)
+#
+# 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
+######################################################################
+
+use strict;
+use warnings;
+use Getopt::Long;
+use Sys::Hostname;
+use Socket;
+
+$| = 1;
+
+# default value
+my ($ip_def) = inet_ntoa((gethostbyname(hostname))[4]);
+my $port_def = 80;
+my $cookie_def = 'CookieName';
+
+# option value
+my $ip;
+my $port;
+my $cookie;
+my $help;
+my $encoded;
+
+# get options
+my $opt = GetOptions(
+ "cookie=s" => \$cookie,
+ "ip=s" => \$ip,
+ "port=s" => \$port,
+ "help" => \$help,
+ "decode=s" => \$encoded,
+);
+
+# help
+usage() if $help || !$opt;
+
+# decode cookie value
+decode($encoded) if (defined $encoded && $encoded =~ /^\d{15}$/);
+
+# get IP address
+if (!defined $ip) {
+ print "Input IP address [$ip_def]: ";
+ $ip = <>;
+ $ip =~ s/\s//g;
+ # set default IP address
+ $ip = $ip_def if $ip eq q{};
+}
+
+# IP address validation
+if ($ip =~ /^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/ &&
+ $1 < 256 && $2 < 256 && $3 < 256 && $4 < 256) {
+ $ip = $1 + (($2 + (($3 + ($4 << 8)) << 8)) << 8);
+} else {
+ usage("Bad IP address.($ip)");
+}
+
+# get port number
+if (!defined $port) {
+ print "Input port number [$port_def]: ";
+ $port = <>;
+ $port =~ s/\s//g;
+ # set default port number
+ $port = $port_def if $port eq q{};
+}
+
+# Port number validation
+if ($port =~ /^\d+$/ && $port < 65536) {
+ # same as htons(3)
+ $port = unpack('n*', pack('S*', $port));
+} else {
+ usage("Bad port number.($port)");
+}
+
+# get cookie name
+if (!defined $cookie) {
+ print "Input cookie name [$cookie_def]: ";
+ $cookie = <>;
+ $cookie =~ s/\s//g;
+ # set default cookie name
+ $cookie = $cookie_def if $cookie eq q{};
+}
+
+# show Set-Cookie header field
+print "\n";
+printf "Set-Cookie: %s=%010s%05s\n", $cookie, $ip, $port;
+
+#--------------------------------------------------------------------
+# usage
+sub usage {
+ my $msg = shift;
+ if ($msg) {
+ print $msg, "\n\n";
+ }
+ print <<"__USAGE__";
+Usage: $0 [-i ip_address] [-p port] [-c cookie_name]
+
+-i, --ip Set IP address of real server.
+-p, --port Set port number of real server.
+-c, --cookie Set cookie name of UltraMonkey-L7.
+-h, --help Show this usage.
+__USAGE__
+
+ exit;
+}
+
+#--------------------------------------------------------------------
+# decode cookie value
+sub decode {
+ my $encoded = shift;
+ my $_ip = substr($encoded, 0, 10);
+ my $_port = substr($encoded, 10, 5);
+ print "IP address : ", inet_ntoa(scalar reverse pack('H*', sprintf('%08X', $_ip))), "\n";
+ print "Port number: ", unpack('S*', pack('n*', $_port)), "\n";
+ exit;
+}
--- /dev/null
+/*
+ * @file l7vsadm.c
+ * @brief the main module of l7vsadm wrapper
+ *
+ * L7VSADM: Virtual Server Administration Program for L7vsd
+ * Copyright (C) 2005 NTT COMWARE Corporation.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ **********************************************************************/
+
+#include "logger_wrapper.h"
+#include "parameter_wrapper.h"
+
+extern void l7vsadm_main(int, char *[]);
+
+using namespace l7vs;
+
+Logger Logger::instance;
+Parameter Parameter::instance;
+
+int
+main(int argc, char *argv[])
+{
+ l7vsadm_main(argc, argv);
+}
--- /dev/null
+/*
+ * @file l7vsadm_main.c
+ * @brief the main module of l7vsadm
+ * @brief it interrupts command line option
+ * @brief and communucate with l7vsd
+ *
+ * L7VSADM: Virtual Server Administration Program for L7vsd
+ * Copyright (C) 2005 NTT COMWARE Corporation.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ **********************************************************************/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+#include <signal.h>
+#include <sys/un.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <sys/file.h>
+#include <errno.h>
+
+#include "l7vs.h"
+#include "l7vs_config.h"
+#include "l7vs_replication.h"
+#include "l7vs_module.h"
+#include "l7vs_service.h"
+#include "l7vs_dest.h"
+#include "l7vs_conn.h"
+
+#include "l7vsadm.h"
+
+//! Prototype of functions.
+static int parse_command(int argc, char *argv[]);
+
+static int parse_option_list(int argc, char *argv[]);
+static int parse_option_vs(int argc, char *argv[]);
+static int parse_option_rs(int argc, char *argv[]);
+static int parse_option_replication(int argc, char *argv[]);
+static int parse_option_log(int argc, char *argv[]);
+static int parse_option_snmp(int argc, char *argv[]);
+static int parse_option_parameter(int argc, char *argv[]);
+static int parse_option_help(int argc, char *argv[]);
+
+static int parse_endpoint(struct sockaddr_in *addr, const char *endpoint_str);
+static int parse_digit(const char *digit_str);
+static long long parse_qos(const char *qos_str);
+static int parse_option_protomod(int argc, char *argv[], int m_idx_begin, int m_idx_end);
+
+static int operate_list(void);
+static int operate_add_vs(void);
+static int operate_edit_vs(void);
+static int operate_del_vs(void);
+static int operate_flush_vs(void);
+static int operate_add_rs(void);
+static int operate_edit_rs(void);
+static int operate_del_rs(void);
+static int operate_replication(void);
+static int operate_log(void);
+static int operate_snmp(void);
+static int operate_parameter(void);
+static int operate_help(void);
+
+static int list_replication_info(void);
+static int list_log_info(void);
+static int list_snmp_info(void);
+
+static int get_vs(void *vs_buffer, int vs_bufsize);
+static int get_rs(struct l7vs_dest_arg *darg_buffer, int rs_num, struct l7vs_service_arg *sarg);
+static int list_vs(struct l7vs_service_arg *sarg);
+static int list_rs(struct l7vs_dest_arg *darg);
+
+static char *get_endpoint_name(struct sockaddr_storage *addr);
+
+static int create_socket(void);
+static void destroy_socket(void);
+static int communicate_to_l7vsd(struct l7vsadm_iov_data *iov_data);
+static int send_request(struct iovec *req_iov, int req_cnt);
+static int recv_response(struct iovec *rsp_iov, int rsp_cnt);
+
+static void usage(FILE *fp);
+
+static void set_parameter(void);
+static char *config_strerror(int rsp_code);
+static void sig_exit_handler(int sig);
+static int set_signal(void);
+
+//! L7vsadm option data that has been parsed.
+static struct l7vsadm_option_data l7vsadm_option_data;
+static char tmp_endpoint_name[NI_MAXHOST + NI_MAXSERV + 2];
+
+//! Table for command argument check.
+static struct l7vsadm_command_list l7vsadm_command_table[] = {
+ {CMD_LIST, "-l", "--list", parse_option_list, operate_list},
+ {CMD_LIST_VERBOSE, "-V", "--verbose", parse_option_list, operate_list},
+ {CMD_LIST_KEY, "-K", "--key", parse_option_list, operate_list},
+ {CMD_ADD_VS, "-A", "--add-service", parse_option_vs, operate_add_vs},
+ {CMD_DEL_VS, "-D", "--delete-service", parse_option_vs, operate_del_vs},
+ {CMD_EDIT_VS, "-E", "--edit-service", parse_option_vs, operate_edit_vs},
+ {CMD_FLUSH_VS, "-C", "--flush", parse_option_vs, operate_flush_vs},
+ {CMD_ADD_RS, "-a", "--add-server", parse_option_rs, operate_add_rs},
+ {CMD_DEL_RS, "-d", "--delete-server", parse_option_rs, operate_del_rs},
+ {CMD_EDIT_RS, "-e", "--edit-server", parse_option_rs, operate_edit_rs},
+ {CMD_REPLICATION, "-R", "--replication", parse_option_replication, operate_replication},
+ {CMD_LOG, "-L", "--log", parse_option_log, operate_log},
+ {CMD_SNMP, "-S", "--snmp", parse_option_snmp, operate_snmp},
+ {CMD_PARAMETER, "-P", "--parameter", parse_option_parameter, operate_parameter},
+ {CMD_HELP, "-h", "--help", parse_option_help, operate_help},
+ {CMD_NONE, NULL, NULL, NULL, NULL}
+};
+
+//! Table for List command argument check.(optional argument)
+static struct l7vsadm_option_list l7vsadm_option_table_list[] = {
+ {OPT_NUMERIC, "-n", "--numeric", 0},
+ {OPT_NONE, NULL, NULL, 0}
+};
+
+//! Table for VirtualService command argument check.(optional argument)
+static struct l7vsadm_option_list l7vsadm_option_table_vs[] = {
+ {OPT_SCHEDULER, "-s", "--scheduler", 0},
+ {OPT_UPPER, "-u", "--upper", 0},
+ {OPT_BYPASS, "-b", "--bypass", 0},
+ {OPT_FLAG, "-f", "--flag", 0},
+ {OPT_QOS_UP, "-Q", "--qos-up", 0},
+ {OPT_QOS_DOWN, "-q", "--qos-down", 0},
+ {OPT_NONE, NULL, NULL, 0}
+};
+
+//! Table for RealServer command argument check.(optional argument)
+static struct l7vsadm_option_list l7vsadm_option_table_rs[] = {
+ {OPT_WEIGHT, "-w", "--weight", 0},
+ {OPT_NONE, NULL, NULL, 0}
+};
+
+//! Table for Replication command argument check.
+static struct l7vsadm_option_list l7vsadm_option_table_replication[] = {
+ {OPT_SWITCH, "-s", "--switch", 0},
+ {OPT_FORCE, "-f", "--force", 0},
+ {OPT_DUMP, "-d", "--dump", 0},
+ {OPT_NONE, NULL, NULL, 0}
+};
+
+//! Table for Logger command argument check.
+static struct l7vsadm_option_list l7vsadm_option_table_log[] = {
+ {OPT_CATEGORY, "-c", "--category", 0},
+ {OPT_LEVEL, "-l", "--level", 0},
+ {OPT_NONE, NULL, NULL, 0}
+};
+
+//! Table for SNMPAgent command argument check.
+static struct l7vsadm_option_list l7vsadm_option_table_snmp[] = {
+ {OPT_CATEGORY, "-c", "--category", 0},
+ {OPT_LEVEL, "-l", "--level", 0},
+ {OPT_NONE, NULL, NULL, 0}
+};
+
+//! Table for Parameter command argument check.
+static struct l7vsadm_option_list l7vsadm_option_table_parameter[] = {
+ {OPT_RELOAD, "-r", "--reload", 0},
+ {OPT_NONE, NULL, NULL, 0}
+};
+
+//! Table for L7vsd Log-Category string check.
+static struct l7vsadm_category_name_list l7vsd_category_name_table[] = {
+ {LOG_CAT_L7VSD_NETWORK, "l7vsd_network", "nw"},
+ {LOG_CAT_L7VSD_NETWORK_BANDWIDTH, "l7vsd_network.bandwidth", "nw.bw"},
+ {LOG_CAT_L7VSD_NETWORK_NUM_CONNECTION, "l7vsd_network.num_connection", "nw.conn"},
+ {LOG_CAT_L7VSD_NETWORK_QOS, "l7vsd_network.qos", "nw.qos"},
+ {LOG_CAT_L7VSD_VIRTUAL_SERVICE, "l7vsd_virtual_service", "vs"},
+ {LOG_CAT_L7VSD_REAL_SERVER, "l7vsd_real_server", "rs"},
+ {LOG_CAT_L7VSD_SORRY_SERVER, "l7vsd_sorry_server", "sorry"},
+ {LOG_CAT_L7VSD_REAL_SERVER_BALANCING, "l7vsd_real_server.balancing", "rs.bal"},
+ {LOG_CAT_L7VSD_REPLICATION, "l7vsd_replication", "rep"},
+ {LOG_CAT_L7VSD_START_STOP, "l7vsd_start_stop", "stastp"},
+ {LOG_CAT_L7VSD_SYSTEM, "l7vsd_system", "sys"},
+ {LOG_CAT_L7VSD_SYSTEM_MEMORY, "l7vsd_system.memory", "sys.mem"},
+ {LOG_CAT_L7VSD_SYSTEM_SOCKET, "l7vsd_system.socket", "sys.sock"},
+ {LOG_CAT_L7VSD_SYSTEM_SIGNAL, "l7vsd_system.signal", "sys.sig"},
+ {LOG_CAT_L7VSD_ENVIRONMENT, "l7vsd_environment", "env"},
+ {LOG_CAT_L7VSD_ENVIRONMENT_PARAMETER, "l7vsd_environment.parameter", "env.para"},
+ {LOG_CAT_L7VSD_LOGGER, "l7vsd_logger", "logger"},
+ {LOG_CAT_L7VSD_PARAMETER, "l7vsd_parameter", "para"},
+ {LOG_CAT_L7VSD_EVENT, "l7vsd_event", "event"},
+ {LOG_CAT_L7VSD_SCHEDULE, "l7vsd_schedule", "sched"},
+ {LOG_CAT_L7VSD_PROGRAM, "l7vsd_program", "prog"},
+ {LOG_CAT_L7VSD_PROTOCOL, "l7vsd_protocol", "prot"},
+ {LOG_CAT_L7VSD_MODULE, "l7vsd_module", "mod"},
+ {(enum LOG_CATEGORY_TAG)0, NULL, NULL}
+};
+
+//! Table for SNMPAgent Log-Category string check.
+static struct l7vsadm_category_name_list snmp_category_name_table[] = {
+ {LOG_CAT_SNMPAGENT_START_STOP, "snmpagent_start_stop", "snmp_stastp"},
+ {LOG_CAT_SNMPAGENT_MANAGER_RECEIVE, "snmpagent_manager_receive", "snmp_mngrcv"},
+ {LOG_CAT_SNMPAGENT_MANAGER_SEND, "snmpagent_manager_send", "snmp_mngsnd"},
+ {LOG_CAT_SNMPAGENT_L7VSD_RECEIVE, "snmpagent_l7vsd_receive", "snmp_vsdrcv"},
+ {LOG_CAT_SNMPAGENT_L7VSD_SEND, "snmpagent_l7vsd_send", "snmp_vsdsnd"},
+ {LOG_CAT_SNMPAGENT_LOGGER, "snmpagent_logger", "snmp_logger"},
+ {LOG_CAT_SNMPAGENT_PARAMETER, "snmpagent_parameter", "snmp_para"},
+ {(enum LOG_CATEGORY_TAG)0, NULL, NULL}
+};
+
+//! Table for Log-Level string check.
+static struct l7vsadm_level_name_list level_name_table[] = {
+ {LOG_LV_DEBUG, "debug"},
+ {LOG_LV_INFO, "info"},
+ {LOG_LV_WARN, "warn"},
+ {LOG_LV_ERROR, "error"},
+ {LOG_LV_FATAL, "fatal"},
+ {LOG_LV_NONE, NULL}
+};
+
+//! Interval of l7vsadm command conflict check.
+static int command_wait_interval = L7VSADM_DEFAULT_WAIT_INTERVAL;
+//! Number of times of l7vsadm command conflict check.
+static int command_wait_count = L7VSADM_DEFAULT_WAIT_COUNT;
+
+//! Interval of connected check to l7vsd.
+static int connect_wait_interval = L7VSADM_DEFAULT_WAIT_INTERVAL;
+//! Number of times of connected check to l7vsd.
+static int connect_wait_count = L7VSADM_DEFAULT_WAIT_COUNT;
+
+//! Log-Level of Parse-Category.
+static int log_level_parse;
+//! Log-Level of Operate-Category.
+static int log_level_operate;
+//! Log-Level of Communicate-Category.
+static int log_level_communicate;
+//! Log-Level of Config_Result-Category.
+static int log_level_config_result;
+//! Log-Level of Common-Category.
+static int log_level_common;
+
+//! Received signal count.
+static int signal_flg = 0;
+//! Received signal number.
+static int received_sig = 0;
+
+//! Local socket name.
+static char local_sockname[sizeof(L7VS_CONFIG_SOCK_PATH) + sizeof(L7VSADM_NAME) + 10];
+//! Local socket file discripter.
+static int local_sock_fd = -1;
+
+/*!
+ * Parse command option.
+ * Check 1st argment
+ * @param[in] argc number of argument
+ * @param[in] *argv[] array of argument string
+ * @retval 0 parse result OK
+ * @retval -1 parse result NG
+ */
+static int
+parse_command(int argc, char *argv[])
+{
+ struct l7vsadm_command_list *list;
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_parse == LOG_LV_DEBUG) {
+ char arg_str[DEBUG_STR_LEN] = {0};
+ argc_argv_c_str(arg_str, argc, argv);
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_PARSE,1,
+ "in_function : static int parse_command(int argc, char *argv[]) : "
+ "argc = %d, %s",
+ argc,
+ arg_str);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ // Argument check.
+ if (argc < 2) {
+ LOGGER_PUT_LOG_WARN(LOG_CAT_L7VSADM_PARSE,1, "Argument argc is illegal.");
+ fprintf(stderr, "PARSE ERROR : Argument argc is illegal.\n");
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_parse == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_PARSE,2,
+ "out_function : static int parse_command(int argc, char *argv[]) : "
+ "return = -1");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return -1;
+ }
+
+ // Search command option on l7vsadm_command_table.
+ l7vsadm_option_data.command_code = CMD_NONE;
+ for (list = l7vsadm_command_table; list->command_name != NULL; list++) {
+ if (strcmp(argv[1], list->command_name) == 0 ||
+ strcmp(argv[1], list->command_name_long) == 0) {
+ l7vsadm_option_data.command_code = list->command_code;
+ l7vsadm_option_data.parse_func = list->parse_func;
+ l7vsadm_option_data.operate_func = list->operate_func;
+ break;
+ }
+ }
+ if (l7vsadm_option_data.command_code == CMD_NONE) {
+ LOGGER_PUT_LOG_WARN(LOG_CAT_L7VSADM_PARSE,2,
+ "No such command option %s.", argv[1]);
+ fprintf(stderr, "PARSE ERROR : "
+ "No such command option %s.\n", argv[1]);
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_parse == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_PARSE,3,
+ "out_function : static int parse_command(int argc, char *argv[]) : "
+ "return = -1");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return -1;
+ }
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_parse == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_PARSE,4,
+ "out_function : static int parse_command(int argc, char *argv[]) : "
+ "return = 0 : result l7vsadm_option_data.command_code = %d",
+ l7vsadm_option_data.command_code);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return 0;
+}
+
+/*!
+ * Parse list command option.
+ * Check 2nd argument and later of list command
+ * @param[in] argc number of argument
+ * @param[in] *argv[] array of argument string
+ * @return int parse result OK=0, NG=-1
+ */
+static int
+parse_option_list(int argc, char *argv[])
+{
+ struct l7vsadm_option_list *list;
+ int idx;
+ int match_option_f;
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_parse == LOG_LV_DEBUG) {
+ char arg_str[DEBUG_STR_LEN] = {0};
+ argc_argv_c_str(arg_str, argc, argv);
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_PARSE,5,
+ "in_function : static int parse_option_list(int argc, char *argv[]) : "
+ "argc = %d, %s",
+ argc,
+ arg_str);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ // Argument check.
+ if (argc > 3) {
+ LOGGER_PUT_LOG_WARN(LOG_CAT_L7VSADM_PARSE,3,
+ "Argument argc is illegal for %s command.", argv[1]);
+ fprintf(stderr, "PARSE ERROR : "
+ "Argument argc is illegal for %s command.\n", argv[1]);
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_parse == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_PARSE,6,
+ "out_function : static int "
+ "parse_option_list(int argc, char *argv[]) : "
+ "return = -1");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return -1;
+ }
+ idx = 2;
+ while (idx < argc) {
+ match_option_f = 0;
+ // Search optional option on l7vsadm_option_table_list.
+ for (list = l7vsadm_option_table_list; list->option_name != NULL; list++) {
+ if (strcmp(argv[idx], list->option_name) == 0 ||
+ strcmp(argv[idx], list->option_name_long) == 0) {
+ match_option_f = 1;
+ // Set each option value.
+ switch (list->option_code) {
+ case OPT_NUMERIC:
+ l7vsadm_option_data.isnumeric = 1;
+ break;
+ default:
+ break;
+ }
+ }
+ }
+ if (!match_option_f) {
+ LOGGER_PUT_LOG_WARN(LOG_CAT_L7VSADM_PARSE,4,
+ "Invalid option for %s command.", argv[1]);
+ fprintf(stderr, "PARSE ERROR : "
+ "Invalid option for %s command.\n", argv[1]);
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_parse == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_PARSE,7,
+ "out_function : static int "
+ "parse_option_list(int argc, char *argv[]) : "
+ "return = -1");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return -1;
+ }
+ idx++;
+ }
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_parse == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_PARSE,8,
+ "out_function : static int parse_option_list(int argc, char *argv[]) : "
+ "return = 0 : result l7vsadm_option_data.isnumeric = %d",
+ l7vsadm_option_data.isnumeric);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return 0;
+}
+
+/*!
+ * Parse virtual service command option.
+ * Check 2nd argument and later of vs command
+ * @param[in] argc number of argument
+ * @param[in] *argv[] array of argument string
+ * @return int parse result OK=0, NG=-1
+ */
+static int
+parse_option_vs(int argc, char *argv[])
+{
+ struct l7vsadm_option_list *list;
+ int idx;
+ int ret;
+ long long ret_ll;
+ int m_idx_begin,m_idx_end;
+ int break_f;
+ int match_option_f;
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_parse == LOG_LV_DEBUG) {
+ char arg_str[DEBUG_STR_LEN] = {0};
+ argc_argv_c_str(arg_str, argc, argv);
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_PARSE,9,
+ "in_function : static int parse_option_vs(int argc, char *argv[]) : "
+ "argc = %d, %s",
+ argc,
+ arg_str);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ // Argument check for flush_vs command.
+ if (l7vsadm_option_data.command_code == CMD_FLUSH_VS) {
+ if (argc != 2) {
+ LOGGER_PUT_LOG_WARN(LOG_CAT_L7VSADM_PARSE,5,
+ "Argument argc is illegal for -C command.");
+ fprintf(stderr, "PARSE ERROR : "
+ "Argument argc is illegal for -C command.\n");
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_parse == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_PARSE,10,
+ "out_function : static int "
+ "parse_option_vs(int argc, char *argv[]) : "
+ "return = -1");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return -1;
+ }
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_parse == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_PARSE,11,
+ "out_function : static int "
+ "parse_option_vs(int argc, char *argv[]) : "
+ "return = 0 : result -C");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return 0;
+ }
+
+ // Argument check for add_vs/edit_vs/delete_vs command.
+ if (argc < 6) {
+ LOGGER_PUT_LOG_WARN(LOG_CAT_L7VSADM_PARSE,6,
+ "Argument argc is illegal for (%s) command.", argv[1]);
+ fprintf(stderr, "PARSE ERROR : "
+ "Argument argc is illegal for (%s) command.\n", argv[1]);
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_parse == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_PARSE,12,
+ "out_function : static int "
+ "parse_option_vs(int argc, char *argv[]) : "
+ "return = -1");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return -1;
+ }
+ idx = 2;
+ if (strcmp(argv[idx], "-t") == 0 || strcmp(argv[idx], "--tcp-service") == 0) {
+ idx++;
+ ret = parse_endpoint(&l7vsadm_option_data.vs_addr,
+ argv[idx]);
+ if (ret < 0) {
+ LOGGER_PUT_LOG_WARN(LOG_CAT_L7VSADM_PARSE,7,
+ "Parse VirtualService endpoint error.");
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_parse == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_PARSE,13,
+ "out_function : static int "
+ "parse_option_vs(int argc, char *argv[]) : "
+ "return = -1");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return -1;
+ }
+ idx++;
+ } else {
+ LOGGER_PUT_LOG_WARN(LOG_CAT_L7VSADM_PARSE,8,
+ "Invalid option %s. Need -t option for %s command.",
+ argv[idx],
+ argv[1]);
+ fprintf(stderr, "PARSE ERROR : "
+ "Invalid option %s. Need -t option for %s command.\n",
+ argv[idx],
+ argv[1]);
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_parse == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_PARSE,14,
+ "out_function : static int "
+ "parse_option_vs(int argc, char *argv[]) : "
+ "return = -1");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return -1;
+ }
+
+ if (strcmp(argv[idx], "-m") == 0 || strcmp(argv[idx], "--proto-module") == 0) {
+ idx++;
+ if (strlen(argv[idx]) >= L7VS_MODNAME_LEN - 1) {
+ LOGGER_PUT_LOG_WARN(LOG_CAT_L7VSADM_PARSE,9,
+ "ProtocolModule name too long. (max %d)", L7VS_MODNAME_LEN);
+ fprintf(stderr, "PARSE ERROR : "
+ "ProtocolModule name too long. (max %d)\n", L7VS_MODNAME_LEN);
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_parse == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_PARSE,15,
+ "out_function : static int "
+ "parse_option_vs(int argc, char *argv[]) : "
+ "return = -1");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return -1;
+ }
+ strncpy(l7vsadm_option_data.protomod_name, argv[idx], strlen(argv[idx]));
+ idx++;
+ } else {
+ LOGGER_PUT_LOG_WARN(LOG_CAT_L7VSADM_PARSE,10,
+ "Invalid option %s. Need -m option for %s command.",
+ argv[idx],
+ argv[1]);
+ fprintf(stderr, "PARSE ERROR : "
+ "Invalid option %s. Need -m option for %s command.\n",
+ argv[idx],
+ argv[1]);
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_parse == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_PARSE,16,
+ "out_function : static int "
+ "parse_option_vs(int argc, char *argv[]) : "
+ "return = -1");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return -1;
+ }
+
+ // Search begin and end of ProtocolModule option.
+ m_idx_begin = idx;
+ break_f = 0;
+ while (idx < argc) {
+ // End of ProtocolModule option is next valid option or end of argument.
+ for (list = l7vsadm_option_table_vs; list->option_name != NULL; list++) {
+ if (strcmp(argv[idx], list->option_name) == 0 ||
+ strcmp(argv[idx], list->option_name_long) == 0) {
+ break_f = 1;
+ break;
+ }
+ }
+ if (break_f) {
+ break;
+ }
+ idx++;
+ }
+ m_idx_end = idx;
+ ret = parse_option_protomod(argc, argv, m_idx_begin, m_idx_end);
+ if (ret < 0) {
+ LOGGER_PUT_LOG_WARN(LOG_CAT_L7VSADM_PARSE,11,
+ "Parse ProtocolModule option error.");
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_parse == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_PARSE,17,
+ "out_function : static int "
+ "parse_option_vs(int argc, char *argv[]) : "
+ "return = -1");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return -1;
+ }
+
+ // Argument check for delete_vs command.
+ if (l7vsadm_option_data.command_code == CMD_DEL_VS) {
+ if (idx < argc) {
+ LOGGER_PUT_LOG_WARN(LOG_CAT_L7VSADM_PARSE,12,
+ "Argument argc is illegal for -D command.");
+ fprintf(stderr, "PARSE ERROR : "
+ "Argument argc is illegal for -D command.\n");
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_parse == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_PARSE,18,
+ "out_function : static int "
+ "parse_option_vs(int argc, char *argv[]) : "
+ "return = -1");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return -1;
+ }
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_parse == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_PARSE,19,
+ "out_function : static int "
+ "parse_option_vs(int argc, char *argv[]) : "
+ "return = 0 : result -D");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return 0;
+ }
+
+ // Set default ScheduleModule "rr".
+ strncpy(l7vsadm_option_data.schedmod_name,
+ L7VSADM_DEFAULT_SCHEDULER,
+ strlen(L7VSADM_DEFAULT_SCHEDULER));
+
+ while (idx < argc) {
+ match_option_f = 0;
+ // Search optional option on l7vsadm_option_table_vs.
+ for (list = l7vsadm_option_table_vs; list->option_name != NULL; list++) {
+ if (strcmp(argv[idx], list->option_name) == 0 ||
+ strcmp(argv[idx], list->option_name_long) == 0) {
+ match_option_f = 1;
+ if (list->check_flag) {
+ LOGGER_PUT_LOG_WARN(LOG_CAT_L7VSADM_PARSE,13,
+ "Option %s is conflict.",
+ argv[idx]);
+ fprintf(stderr, "PARSE ERROR : "
+ "Option %s is conflict.\n",
+ argv[idx]);
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_parse == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_PARSE,20,
+ "out_function : static int "
+ "parse_option_vs(int argc, char *argv[]) : "
+ "return = -1");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return -1;
+ }
+ list->check_flag = 1;
+ // Check and Set each option value.
+ switch (list->option_code) {
+ case OPT_SCHEDULER:
+ idx++;
+ if (idx >= argc) {
+ LOGGER_PUT_LOG_WARN(LOG_CAT_L7VSADM_PARSE,14,
+ "Need option value for -s option.");
+ fprintf(stderr, "PARSE ERROR : "
+ "Need option value for -s option.\n");
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_parse == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_PARSE,21,
+ "out_function : static int "
+ "parse_option_vs(int argc, char *argv[]) : "
+ "return = -1");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return -1;
+ }
+ if (strlen(argv[idx]) >= L7VS_MODNAME_LEN - 1) {
+ LOGGER_PUT_LOG_WARN(LOG_CAT_L7VSADM_PARSE,15,
+ "ScheduleModule name too long. (max %d)",
+ L7VS_MODNAME_LEN);
+ fprintf(stderr, "PARSE ERROR : "
+ "ScheduleModule name too long. (max %d)\n",
+ L7VS_MODNAME_LEN);
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_parse == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_PARSE,22,
+ "out_function : static int "
+ "parse_option_vs(int argc, char *argv[]) : "
+ "return = -1");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return -1;
+ }
+ strncpy(l7vsadm_option_data.schedmod_name,
+ argv[idx],
+ strlen(argv[idx]));
+ break;
+ case OPT_UPPER:
+ idx++;
+ if (idx >= argc) {
+ LOGGER_PUT_LOG_WARN(LOG_CAT_L7VSADM_PARSE,16,
+ "Need option value for -u option.");
+ fprintf(stderr, "PARSE ERROR : "
+ "Need option value for -u option.\n");
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_parse == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_PARSE,23,
+ "out_function : static int "
+ "parse_option_vs(int argc, char *argv[]) : "
+ "return = -1");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return -1;
+ }
+ ret = parse_digit(argv[idx]);
+ if (ret < 0) {
+ LOGGER_PUT_LOG_WARN(LOG_CAT_L7VSADM_PARSE,17,
+ "-u option value is only digit.");
+ return -1;
+ }
+ sscanf(argv[idx], "%d", &l7vsadm_option_data.max_connection);
+ if (l7vsadm_option_data.max_connection < 0 ||
+ l7vsadm_option_data.max_connection > 100000) {
+ LOGGER_PUT_LOG_WARN(LOG_CAT_L7VSADM_PARSE,18,
+ "Invalid option value for -u option.");
+ fprintf(stderr, "PARSE ERROR : "
+ "Invalid option value for -u option.\n");
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_parse == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_PARSE,24,
+ "out_function : static int "
+ "parse_option_vs(int argc, char *argv[]) : "
+ "return = -1");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return -1;
+ }
+ break;
+ case OPT_BYPASS:
+ idx++;
+ if (idx >= argc) {
+ LOGGER_PUT_LOG_WARN(LOG_CAT_L7VSADM_PARSE,19,
+ "Need option value for -b option.");
+ fprintf(stderr, "PARSE ERROR : "
+ "Need option value for -b option.\n");
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_parse == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_PARSE,25,
+ "out_function : static int "
+ "parse_option_vs(int argc, char *argv[]) : "
+ "return = -1");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return -1;
+ }
+ // When specify the initialization of the sorry endpoint.
+ if (strncmp(L7VSADM_INIT_ENDPOINT_STR, argv[idx],
+ strlen(L7VSADM_INIT_ENDPOINT_STR)) == 0) {
+ // Sorry endpoint is 0 clear data.
+ break;
+ }
+ ret = parse_endpoint(
+ (struct sockaddr_in *)(&l7vsadm_option_data.sorry_addr),
+ argv[idx]);
+ if (ret < 0) {
+ LOGGER_PUT_LOG_WARN(LOG_CAT_L7VSADM_PARSE,20,
+ "Parse SorryServer endpoint error.");
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_parse == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_PARSE,26,
+ "out_function : static int "
+ "parse_option_vs(int argc, char *argv[]) : "
+ "return = -1");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return -1;
+ }
+ break;
+ case OPT_FLAG:
+ idx++;
+ if (idx >= argc) {
+ LOGGER_PUT_LOG_WARN(LOG_CAT_L7VSADM_PARSE,21,
+ "Need option value for -f option.");
+ fprintf(stderr, "PARSE ERROR : "
+ "Need option value for -f option.\n");
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_parse == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_PARSE,27,
+ "out_function : static int "
+ "parse_option_vs(int argc, char *argv[]) : "
+ "return = -1");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return -1;
+ }
+ ret = parse_digit(argv[idx]);
+ if (ret < 0) {
+ LOGGER_PUT_LOG_WARN(LOG_CAT_L7VSADM_PARSE,22,
+ "-f option value is only digit.");
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_parse == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_PARSE,28,
+ "out_function : static int "
+ "parse_option_vs(int argc, char *argv[]) : "
+ "return = -1");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return -1;
+ }
+ sscanf(argv[idx], "%d", &l7vsadm_option_data.sorry_flag);
+ if (l7vsadm_option_data.sorry_flag < 0 ||
+ l7vsadm_option_data.sorry_flag > 1) {
+ LOGGER_PUT_LOG_WARN(LOG_CAT_L7VSADM_PARSE,23,
+ "Invalid option value for -f option.");
+ fprintf(stderr, "PARSE ERROR : "
+ "Invalid option value for -f option.\n");
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_parse == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_PARSE,29,
+ "out_function : static int "
+ "parse_option_vs(int argc, char *argv[]) : "
+ "return = -1");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return -1;
+ }
+ break;
+ case OPT_QOS_UP:
+ idx++;
+ if (idx >= argc) {
+ LOGGER_PUT_LOG_WARN(LOG_CAT_L7VSADM_PARSE,24,
+ "Need option value for -Q option.");
+ fprintf(stderr, "PARSE ERROR : "
+ "Need option value for -Q option.\n");
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_parse == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_PARSE,30,
+ "out_function : static int "
+ "parse_option_vs(int argc, char *argv[]) : "
+ "return = -1");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return -1;
+ }
+ ret_ll = parse_qos(argv[idx]);
+ if (ret_ll < 0) {
+ LOGGER_PUT_LOG_WARN(LOG_CAT_L7VSADM_PARSE,25,
+ "Parse QoS-up value error.");
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_parse == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_PARSE,31,
+ "out_function : static int "
+ "parse_option_vs(int argc, char *argv[]) : "
+ "return = -1");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return -1;
+ }
+ l7vsadm_option_data.qos_threshold_up = (unsigned long long)ret_ll;
+ break;
+ case OPT_QOS_DOWN:
+ idx++;
+ if (idx >= argc) {
+ LOGGER_PUT_LOG_WARN(LOG_CAT_L7VSADM_PARSE,26,
+ "Need option value for -q option.");
+ fprintf(stderr, "PARSE ERROR : "
+ "Need option value for -q option.\n");
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_parse == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_PARSE,32,
+ "out_function : static int "
+ "parse_option_vs(int argc, char *argv[]) : "
+ "return = -1");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return -1;
+ }
+ ret_ll = parse_qos(argv[idx]);
+ if (ret_ll < 0) {
+ LOGGER_PUT_LOG_WARN(LOG_CAT_L7VSADM_PARSE,27,
+ "Parse QoS-down value error.");
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_parse == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_PARSE,33,
+ "out_function : static int "
+ "parse_option_vs(int argc, char *argv[]) : "
+ "return = -1");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return -1;
+ }
+ l7vsadm_option_data.qos_threshold_down = (unsigned long long)ret_ll;
+ break;
+ default:
+ break;
+ }
+ break;
+ }
+ }
+ if (!match_option_f) {
+ LOGGER_PUT_LOG_WARN(LOG_CAT_L7VSADM_PARSE,28,
+ "Invalid option for %s command.", argv[1]);
+ fprintf(stderr, "PARSE ERROR : "
+ "Invalid option for %s command.\n", argv[1]);
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_parse == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_PARSE,34,
+ "out_function : static int "
+ "parse_option_vs(int argc, char *argv[]) : "
+ "return = -1");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return -1;
+ }
+ idx++;
+ }
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_parse == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_PARSE,35,
+ "out_function : static int "
+ "parse_option_vs(int argc, char *argv[]) : "
+ "return = 0 : result -A or -E");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return 0;
+}
+
+/*!
+ * Parse real server command option.
+ * Check 2nd argument and later of rs command
+ * @param[in] argc number of argument
+ * @param[in] *argv[] array of argument string
+ * @return int parse result OK=0, NG=-1
+ */
+static int
+parse_option_rs(int argc, char *argv[])
+{
+ struct l7vsadm_option_list *list;
+ int idx;
+ int ret;
+ int m_idx_begin,m_idx_end;
+ int break_f;
+ int match_option_f;
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_parse == LOG_LV_DEBUG) {
+ char arg_str[DEBUG_STR_LEN] = {0};
+ argc_argv_c_str(arg_str, argc, argv);
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_PARSE,36,
+ "in_function : static int parse_option_rs(int argc, char *argv[]) : "
+ "argc = %d, %s",
+ argc,
+ arg_str);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ // Argument check for add_rs/edit_rs/delete_rs command.
+ if (argc < 8) {
+ LOGGER_PUT_LOG_WARN(LOG_CAT_L7VSADM_PARSE,29,
+ "Argument argc is illegal for %s command.", argv[1]);
+ fprintf(stderr, "PARSE ERROR : "
+ "Argument argc is illegal for %s command.\n", argv[1]);
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_parse == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_PARSE,37,
+ "out_function : static int "
+ "parse_option_rs(int argc, char *argv[]) : "
+ "return = -1");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return -1;
+ }
+ idx = 2;
+ if (strcmp(argv[idx], "-t") == 0 || strcmp(argv[idx], "--tcp-service") == 0) {
+ idx++;
+ ret = parse_endpoint(&l7vsadm_option_data.vs_addr,
+ argv[idx]);
+ if (ret < 0) {
+ LOGGER_PUT_LOG_WARN(LOG_CAT_L7VSADM_PARSE,30,
+ "Parse VirtualService endpoint error.");
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_parse == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_PARSE,38,
+ "out_function : static int "
+ "parse_option_rs(int argc, char *argv[]) : "
+ "return = -1");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return -1;
+ }
+ idx++;
+ } else {
+ LOGGER_PUT_LOG_WARN(LOG_CAT_L7VSADM_PARSE,31,
+ "Invalid option %s. Need -t option for %s command.",
+ argv[idx],
+ argv[1]);
+ fprintf(stderr, "PARSE ERROR : "
+ "Invalid option %s. Need -t option for %s command.\n",
+ argv[idx],
+ argv[1]);
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_parse == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_PARSE,39,
+ "out_function : static int "
+ "parse_option_rs(int argc, char *argv[]) : "
+ "return = -1");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return -1;
+ }
+
+ if (strcmp(argv[idx], "-m") == 0 || strcmp(argv[idx], "--proto-module") == 0) {
+ idx++;
+ if (strlen(argv[idx]) >= L7VS_MODNAME_LEN - 1) {
+ LOGGER_PUT_LOG_WARN(LOG_CAT_L7VSADM_PARSE,32,
+ "ProtocolModule name too long. (max %d)", L7VS_MODNAME_LEN);
+ fprintf(stderr, "PARSE ERROR : "
+ "ProtocolModule name too long. (max %d)\n", L7VS_MODNAME_LEN);
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_parse == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_PARSE,40,
+ "out_function : static int "
+ "parse_option_rs(int argc, char *argv[]) : "
+ "return = -1");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return -1;
+ }
+ strncpy(l7vsadm_option_data.protomod_name, argv[idx], strlen(argv[idx]));
+ idx++;
+ } else {
+ LOGGER_PUT_LOG_WARN(LOG_CAT_L7VSADM_PARSE,33,
+ "Invalid option %s. Need -m option for %s command.",
+ argv[idx],
+ argv[1]);
+ fprintf(stderr, "PARSE ERROR : "
+ "Invalid option %s. Need -m option for %s command.\n",
+ argv[idx],
+ argv[1]);
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_parse == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_PARSE,41,
+ "out_function : static int "
+ "parse_option_rs(int argc, char *argv[]) : "
+ "return = -1");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return -1;
+ }
+
+ // Search begin and end of ProtocolModule option.
+ m_idx_begin = idx;
+ break_f = 0;
+ while (idx < argc) {
+ // End of ProtocolModule option is -r option.
+ if (strcmp(argv[idx], "-r") == 0 || strcmp(argv[idx], "--real-server") == 0) {
+ break_f = 1;
+ break;
+ }
+ idx++;
+ }
+ if (!break_f) {
+ LOGGER_PUT_LOG_WARN(LOG_CAT_L7VSADM_PARSE,34,
+ "Invalid option %s. Need -r option for %s command.",
+ argv[idx],
+ argv[1]);
+ fprintf(stderr, "PARSE ERROR : "
+ "Invalid option %s. Need -r option for %s command.\n",
+ argv[idx],
+ argv[1]);
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_parse == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_PARSE,42,
+ "out_function : static int "
+ "parse_option_rs(int argc, char *argv[]) : "
+ "return = -1");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return -1;
+ }
+ m_idx_end = idx;
+ ret = parse_option_protomod(argc, argv, m_idx_begin, m_idx_end);
+ if (ret < 0) {
+ LOGGER_PUT_LOG_WARN(LOG_CAT_L7VSADM_PARSE,35,
+ "Parse ProtocolModule option error.");
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_parse == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_PARSE,43,
+ "out_function : static int "
+ "parse_option_rs(int argc, char *argv[]) : "
+ "return = -1");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return -1;
+ }
+
+ idx++;
+ ret = parse_endpoint(&l7vsadm_option_data.rs_addr, argv[idx]);
+ if (ret < 0) {
+ LOGGER_PUT_LOG_WARN(LOG_CAT_L7VSADM_PARSE,36,
+ "Parse RealServer endpoint error.");
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_parse == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_PARSE,44,
+ "out_function : static int "
+ "parse_option_rs(int argc, char *argv[]) : "
+ "return = -1");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return -1;
+ }
+ idx++;
+
+ // Argument check for delete_rs command.
+ if (l7vsadm_option_data.command_code == CMD_DEL_RS) {
+ if (idx < argc) {
+ LOGGER_PUT_LOG_WARN(LOG_CAT_L7VSADM_PARSE,37,
+ "Argument argc is illegal for -d command.");
+ fprintf(stderr, "PARSE ERROR : "
+ "Argument argc is illegal for -d command.\n");
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_parse == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_PARSE,45,
+ "out_function : static int "
+ "parse_option_rs(int argc, char *argv[]) : "
+ "return = -1");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return -1;
+ }
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_parse == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_PARSE,46,
+ "out_function : static int "
+ "parse_option_rs(int argc, char *argv[]) : "
+ "return = 0 : result -d");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return 0;
+ }
+
+ // Set default RealServer weight = 1.
+ l7vsadm_option_data.weight = 1;
+
+ while (idx < argc) {
+ match_option_f = 0;
+ // Search optional option on l7vsadm_option_table_rs.
+ for (list = l7vsadm_option_table_rs; list->option_name != NULL; list++) {
+ if (strcmp(argv[idx], list->option_name) == 0 ||
+ strcmp(argv[idx], list->option_name_long) == 0) {
+ match_option_f = 1;
+ if (list->check_flag) {
+ LOGGER_PUT_LOG_WARN(LOG_CAT_L7VSADM_PARSE,38,
+ "Option %s is conflict.",
+ argv[idx]);
+ fprintf(stderr, "PARSE ERROR : "
+ "Option %s is conflict.\n",
+ argv[idx]);
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_parse == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_PARSE,47,
+ "out_function : static int "
+ "parse_option_rs(int argc, char *argv[]) : "
+ "return = -1");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return -1;
+ }
+ list->check_flag = 1;
+ // Check and Set each option value.
+ switch (list->option_code) {
+ case OPT_WEIGHT:
+ idx++;
+ if (idx >= argc) {
+ LOGGER_PUT_LOG_WARN(LOG_CAT_L7VSADM_PARSE,39,
+ "Need option value for -w option.");
+ fprintf(stderr, "PARSE ERROR : "
+ "Need option value for -w option.\n");
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_parse == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_PARSE,48,
+ "out_function : static int "
+ "parse_option_rs(int argc, char *argv[]) : "
+ "return = -1");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return -1;
+ }
+ ret = parse_digit(argv[idx]);
+ if (ret < 0) {
+ LOGGER_PUT_LOG_WARN(LOG_CAT_L7VSADM_PARSE,40,
+ "-w option value is only digit.");
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_parse == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_PARSE,49,
+ "out_function : static int "
+ "parse_option_rs(int argc, char *argv[]) : "
+ "return = -1");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return -1;
+ }
+ sscanf(argv[idx], "%d", &l7vsadm_option_data.weight);
+ if (l7vsadm_option_data.weight < 0 ||
+ l7vsadm_option_data.weight > 100) {
+ LOGGER_PUT_LOG_WARN(LOG_CAT_L7VSADM_PARSE,41,
+ "Invalid option value for -w option.");
+ fprintf(stderr, "PARSE ERROR : "
+ "Invalid option value for -w option.\n");
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_parse == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_PARSE,50,
+ "out_function : static int "
+ "parse_option_rs(int argc, char *argv[]) : "
+ "return = -1");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return -1;
+ }
+ break;
+ default:
+ break;
+ }
+ break;
+ }
+ }
+ if (!match_option_f) {
+ LOGGER_PUT_LOG_WARN(LOG_CAT_L7VSADM_PARSE,42,
+ "Invalid option for %s command.", argv[1]);
+ fprintf(stderr, "PARSE ERROR : "
+ "Invalid option for %s command.\n", argv[1]);
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_parse == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_PARSE,51,
+ "out_function : static int "
+ "parse_option_rs(int argc, char *argv[]) : "
+ "return = -1");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return -1;
+ }
+ idx++;
+ }
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_parse == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_PARSE,52,
+ "out_function : static int "
+ "parse_option_rs(int argc, char *argv[]) : "
+ "return = 0 : result -a or -e");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return 0;
+}
+
+/*!
+ * Parse replication command option.
+ * Check 2nd argument and later of replication command
+ * @param[in] argc number of argument
+ * @param[in] *argv[] array of argument string
+ * @return int parse result OK=0, NG=-1
+ */
+static int
+parse_option_replication(int argc, char *argv[])
+{
+ struct l7vsadm_option_list *list;
+ int idx;
+ int match_option_f;
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_parse == LOG_LV_DEBUG) {
+ char arg_str[DEBUG_STR_LEN] = {0};
+ argc_argv_c_str(arg_str, argc, argv);
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_PARSE,53,
+ "in_function : static int parse_option_replication(int argc, char *argv[]) : "
+ "argc = %d, %s",
+ argc,
+ arg_str);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ // Argument check for replication command.
+ if (argc < 3 || argc > 4) {
+ LOGGER_PUT_LOG_WARN(LOG_CAT_L7VSADM_PARSE,43,
+ "Argument argc is illegal for -R command.");
+ fprintf(stderr, "PARSE ERROR : "
+ "Argument argc is illegal for -R command.\n");
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_parse == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_PARSE,54,
+ "out_function : static int "
+ "parse_option_replication(int argc, char *argv[]) : "
+ "return = -1");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return -1;
+ }
+ idx = 2;
+ match_option_f = 0;
+ // Search option on l7vsadm_option_table_replication.
+ for (list = l7vsadm_option_table_replication; list->option_name != NULL; list++) {
+ if (strcmp(argv[idx], list->option_name) == 0 ||
+ strcmp(argv[idx], list->option_name_long) == 0) {
+ match_option_f = 1;
+ if (list->check_flag) {
+ LOGGER_PUT_LOG_WARN(LOG_CAT_L7VSADM_PARSE,44,
+ "Option %s is conflict.",
+ argv[idx]);
+ fprintf(stderr, "PARSE ERROR : "
+ "Option %s is conflict.\n",
+ argv[idx]);
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_parse == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_PARSE,55,
+ "out_function : static int "
+ "parse_option_replication(int argc, char *argv[]) : "
+ "return = -1");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return -1;
+ }
+ list->check_flag = 1;
+ // Check and Set each option value.
+ switch (list->option_code) {
+ case OPT_SWITCH:
+ idx++;
+ if (idx >= argc) {
+ LOGGER_PUT_LOG_WARN(LOG_CAT_L7VSADM_PARSE,45,
+ "Need option value for -s option.");
+ fprintf(stderr, "PARSE ERROR : "
+ "Need option value for -s option.\n");
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_parse == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_PARSE,56,
+ "out_function : static int "
+ "parse_option_replication(int argc, char *argv[]) : "
+ "return = -1");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return -1;
+ }
+ l7vsadm_option_data.control_code = list->option_code;
+ if (strcmp(argv[idx], "start") == 0) {
+ l7vsadm_option_data.replication_start_flag = 1;
+ } else if (strcmp(argv[idx], "stop") == 0) {
+ l7vsadm_option_data.replication_start_flag = 0;
+ } else {
+ LOGGER_PUT_LOG_WARN(LOG_CAT_L7VSADM_PARSE,46,
+ "Invalid option value for -s option.");
+ fprintf(stderr, "PARSE ERROR : "
+ "Invalid option value for -s option.\n");
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_parse == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_PARSE,57,
+ "out_function : static int "
+ "parse_option_replication(int argc, char *argv[]) : "
+ "return = -1");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return -1;
+ }
+ break;
+ case OPT_FORCE:
+ if (idx + 1 < argc) {
+ LOGGER_PUT_LOG_WARN(LOG_CAT_L7VSADM_PARSE,47,
+ "-f option is no argument option.");
+ fprintf(stderr, "PARSE ERROR : "
+ "-f option is no argument option.\n");
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_parse == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_PARSE,58,
+ "out_function : static int "
+ "parse_option_replication(int argc, char *argv[]) : "
+ "return = -1");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return -1;
+ }
+ l7vsadm_option_data.control_code = list->option_code;
+ break;
+ case OPT_DUMP:
+ if (idx + 1 < argc) {
+ LOGGER_PUT_LOG_WARN(LOG_CAT_L7VSADM_PARSE,48,
+ "-d option is no argument option.");
+ fprintf(stderr, "PARSE ERROR : "
+ "-d option is no argument option.\n");
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_parse == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_PARSE,59,
+ "out_function : static int "
+ "parse_option_replication(int argc, char *argv[]) : "
+ "return = -1");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return -1;
+ }
+ l7vsadm_option_data.control_code = list->option_code;
+ break;
+ default:
+ break;
+ }
+ break;
+ }
+ }
+ if (!match_option_f) {
+ LOGGER_PUT_LOG_WARN(LOG_CAT_L7VSADM_PARSE,49,
+ "Invalid option for -R command.");
+ fprintf(stderr, "PARSE ERROR : "
+ "Invalid option for -R command.\n");
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_parse == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_PARSE,60,
+ "out_function : static int "
+ "parse_option_replication(int argc, char *argv[]) : "
+ "return = -1");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return -1;
+ }
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_parse == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_PARSE,61,
+ "out_function : static int "
+ "parse_option_replication(int argc, char *argv[]) : "
+ "return = 0 : result "
+ "l7vsadm_option_data.control_code = %d "
+ "l7vsadm_option_data.replication_start_flag = %d",
+ l7vsadm_option_data.control_code,
+ l7vsadm_option_data.replication_start_flag);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return 0;
+}
+
+/*!
+ * Parse logger command option.
+ * Check 2nd argument and later of logger command
+ * @param[in] argc number of argument
+ * @param[in] *argv[] array of argument string
+ * @return int parse result OK=0, NG=-1
+ */
+static int
+parse_option_log(int argc, char *argv[])
+{
+ struct l7vsadm_option_list *op_list;
+ struct l7vsadm_category_name_list *cat_list;
+ struct l7vsadm_level_name_list *lv_list;
+ int idx;
+ int match_option_f;
+ int match_value_f;
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_parse == LOG_LV_DEBUG) {
+ char arg_str[DEBUG_STR_LEN] = {0};
+ argc_argv_c_str(arg_str, argc, argv);
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_PARSE,62,
+ "in_function : static int parse_option_log(int argc, char *argv[]) : "
+ "argc = %d, %s",
+ argc,
+ arg_str);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ // Argument check for logger command.
+ if (argc != 6) {
+ LOGGER_PUT_LOG_WARN(LOG_CAT_L7VSADM_PARSE,50,
+ "Argument argc is illegal for -L command.");
+ fprintf(stderr, "PARSE ERROR : "
+ "Argument argc is illegal for -L command.\n");
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_parse == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_PARSE,63,
+ "out_function : static int "
+ "parse_option_log(int argc, char *argv[]) : "
+ "return = -1");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return -1;
+ }
+ idx = 2;
+ while (idx < argc) {
+ match_option_f = 0;
+ // Search option on l7vsadm_option_table_log.
+ for (op_list = l7vsadm_option_table_log; op_list->option_name != NULL; op_list++) {
+ if (strcmp(argv[idx], op_list->option_name) == 0 ||
+ strcmp(argv[idx], op_list->option_name_long) == 0) {
+ match_option_f = 1;
+ if (op_list->check_flag) {
+ LOGGER_PUT_LOG_WARN(LOG_CAT_L7VSADM_PARSE,51,
+ "Option %s is conflict.",
+ argv[idx]);
+ fprintf(stderr, "PARSE ERROR : "
+ "Option %s is conflict.\n",
+ argv[idx]);
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_parse == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_PARSE,64,
+ "out_function : static int "
+ "parse_option_log(int argc, char *argv[]) : "
+ "return = -1");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return -1;
+ }
+ op_list->check_flag = 1;
+ // Check and Set each option value.
+ switch (op_list->option_code) {
+ case OPT_CATEGORY:
+ idx++;
+ if (idx >= argc) {
+ LOGGER_PUT_LOG_WARN(LOG_CAT_L7VSADM_PARSE,52,
+ "Need option value for -c option.");
+ fprintf(stderr, "PARSE ERROR : "
+ "Need option value for -c option.\n");
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_parse == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_PARSE,65,
+ "out_function : static int "
+ "parse_option_log(int argc, char *argv[]) : "
+ "return = -1");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return -1;
+ }
+ // Check option value "all".
+ if (strcmp(argv[idx], "all") == 0) {
+ l7vsadm_option_data.category_all_flag = 1;
+ break;
+ }
+ match_value_f = 0;
+ // Search category name on l7vsd_category_name_table
+ // and Convert category name to category code.
+ for (cat_list = l7vsd_category_name_table;
+ cat_list->category_name != NULL;
+ cat_list++) {
+ if (strcmp(argv[idx],
+ cat_list->category_name) == 0 ||
+ strcmp(argv[idx],
+ cat_list->category_name_short) == 0) {
+ l7vsadm_option_data.log_category =
+ cat_list->category_code;
+ match_value_f = 1;
+ break;
+ }
+ }
+ if (!match_value_f) {
+ LOGGER_PUT_LOG_WARN(LOG_CAT_L7VSADM_PARSE,53,
+ "No such Log-Category %s.", argv[idx]);
+ fprintf(stderr, "PARSE ERROR : "
+ "No such Log-Category %s.\n", argv[idx]);
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_parse == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_PARSE,66,
+ "out_function : static int "
+ "parse_option_log(int argc, char *argv[]) : "
+ "return = -1");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return -1;
+ }
+ break;
+ case OPT_LEVEL:
+ idx++;
+ if (idx >= argc) {
+ LOGGER_PUT_LOG_WARN(LOG_CAT_L7VSADM_PARSE,54,
+ "Need option value for -l option.");
+ fprintf(stderr, "PARSE ERROR : "
+ "Need option value for -l option.\n");
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_parse == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_PARSE,67,
+ "out_function : static int "
+ "parse_option_log(int argc, char *argv[]) : "
+ "return = -1");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return -1;
+ }
+ match_value_f = 0;
+ // Search level name on level_name_table
+ // and Convert level name to level code.
+ for (lv_list = level_name_table;
+ lv_list->level_name != NULL;
+ lv_list++) {
+ if (strcmp(argv[idx], lv_list->level_name) == 0) {
+ l7vsadm_option_data.log_level =
+ lv_list->level_code;
+ match_value_f = 1;
+ break;
+ }
+ }
+ if (!match_value_f) {
+ LOGGER_PUT_LOG_WARN(LOG_CAT_L7VSADM_PARSE,55,
+ "No such Log-Level %s.", argv[idx]);
+ fprintf(stderr, "PARSE ERROR : "
+ "No such Log-Level %s.\n", argv[idx]);
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_parse == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_PARSE,68,
+ "out_function : static int "
+ "parse_option_log(int argc, char *argv[]) : "
+ "return = -1");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return -1;
+ }
+ break;
+ default:
+ break;
+ }
+ break;
+ }
+ }
+ if (!match_option_f) {
+ LOGGER_PUT_LOG_WARN(LOG_CAT_L7VSADM_PARSE,56,
+ "Invalid option for -L command.");
+ fprintf(stderr, "PARSE ERROR : "
+ "Invalid option for -L command.\n");
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_parse == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_PARSE,69,
+ "out_function : static int "
+ "parse_option_log(int argc, char *argv[]) : "
+ "return = -1");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return -1;
+ }
+ idx++;
+ }
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_parse == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_PARSE,70,
+ "out_function : static int "
+ "parse_option_log(int argc, char *argv[]) : "
+ "return = 0 : result "
+ "l7vsadm_option_data.category_all_flag = %d "
+ "l7vsadm_option_data.log_category = %d "
+ "l7vsadm_option_data.log_level = %d",
+ l7vsadm_option_data.category_all_flag,
+ l7vsadm_option_data.log_category,
+ l7vsadm_option_data.log_level);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return 0;
+}
+
+/*!
+ * Parse SNMPAgent command option.
+ * Check 2nd argument and later of SNMPAgent command
+ * @param[in] argc number of argument
+ * @param[in] *argv[] array of argument string
+ * @return int parse result OK=0, NG=-1
+ */
+static int
+parse_option_snmp(int argc, char *argv[])
+{
+ struct l7vsadm_option_list *op_list;
+ struct l7vsadm_category_name_list *cat_list;
+ struct l7vsadm_level_name_list *lv_list;
+ int idx;
+ int match_option_f;
+ int match_value_f;
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_parse == LOG_LV_DEBUG) {
+ char arg_str[DEBUG_STR_LEN] = {0};
+ argc_argv_c_str(arg_str, argc, argv);
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_PARSE,71,
+ "in_function : static int parse_option_snmp(int argc, char *argv[]) : "
+ "argc = %d, %s",
+ argc,
+ arg_str);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ // Argument check for SNMPAgent command.
+ if (argc != 6) {
+ LOGGER_PUT_LOG_WARN(LOG_CAT_L7VSADM_PARSE,57,
+ "Argument argc is illegal for -S command.");
+ fprintf(stderr, "PARSE ERROR : "
+ "Argument argc is illegal for -S command.\n");
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_parse == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_PARSE,72,
+ "out_function : static int "
+ "parse_option_snmp(int argc, char *argv[]) : "
+ "return = -1");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return -1;
+ }
+ idx = 2;
+ while (idx < argc) {
+ match_option_f = 0;
+ // Search option on l7vsadm_option_table_snmp.
+ for (op_list = l7vsadm_option_table_snmp;
+ op_list->option_name != NULL;
+ op_list++) {
+ if (strcmp(argv[idx], op_list->option_name) == 0 ||
+ strcmp(argv[idx], op_list->option_name_long) == 0) {
+ match_option_f = 1;
+ if (op_list->check_flag) {
+ LOGGER_PUT_LOG_WARN(LOG_CAT_L7VSADM_PARSE,58,
+ "Option %s is conflict.",
+ argv[idx]);
+ fprintf(stderr, "PARSE ERROR : "
+ "Option %s is conflict.\n",
+ argv[idx]);
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_parse == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_PARSE,73,
+ "out_function : static int "
+ "parse_option_snmp(int argc, char *argv[]) : "
+ "return = -1");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return -1;
+ }
+ op_list->check_flag = 1;
+ // Check and Set each option value.
+ switch (op_list->option_code) {
+ case OPT_CATEGORY:
+ idx++;
+ if (idx >= argc) {
+ LOGGER_PUT_LOG_WARN(LOG_CAT_L7VSADM_PARSE,59,
+ "Need option value for -c option.");
+ fprintf(stderr, "PARSE ERROR : "
+ "Need option value for -c option.\n");
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_parse == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_PARSE,74,
+ "out_function : static int "
+ "parse_option_snmp(int argc, char *argv[]) : "
+ "return = -1");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return -1;
+ }
+ // Check option value "all".
+ if (strcmp(argv[idx], "all") == 0) {
+ l7vsadm_option_data.category_all_flag = 1;
+ break;
+ }
+ match_value_f = 0;
+ // Search category name on snmp_category_name_table
+ // and Convert category name to category code.
+ for (cat_list = snmp_category_name_table;
+ cat_list->category_name != NULL;
+ cat_list++) {
+ if (strcmp(argv[idx],
+ cat_list->category_name) == 0 ||
+ strcmp(argv[idx],
+ cat_list->category_name_short) == 0) {
+ l7vsadm_option_data.log_category =
+ cat_list->category_code;
+ match_value_f = 1;
+ break;
+ }
+ }
+ if (!match_value_f) {
+ LOGGER_PUT_LOG_WARN(LOG_CAT_L7VSADM_PARSE,60,
+ "No such Log-Category %s.", argv[idx]);
+ fprintf(stderr, "PARSE ERROR : "
+ "No such Log-Category %s.\n", argv[idx]);
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_parse == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_PARSE,75,
+ "out_function : static int "
+ "parse_option_snmp(int argc, char *argv[]) : "
+ "return = -1");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return -1;
+ }
+ break;
+ case OPT_LEVEL:
+ idx++;
+ if (idx >= argc) {
+ LOGGER_PUT_LOG_WARN(LOG_CAT_L7VSADM_PARSE,61,
+ "Need option value for -l option.");
+ fprintf(stderr, "PARSE ERROR : "
+ "Need option value for -l option.\n");
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_parse == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_PARSE,76,
+ "out_function : static int "
+ "parse_option_snmp(int argc, char *argv[]) : "
+ "return = -1");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return -1;
+ }
+ match_value_f = 0;
+ // Search level name on level_name_table
+ // and Convert level name to level code.
+ for (lv_list = level_name_table;
+ lv_list->level_name != NULL;
+ lv_list++) {
+ if (strcmp(argv[idx],
+ lv_list->level_name) == 0) {
+ l7vsadm_option_data.log_level =
+ lv_list->level_code;
+ match_value_f = 1;
+ break;
+ }
+ }
+ if (!match_value_f) {
+ LOGGER_PUT_LOG_WARN(LOG_CAT_L7VSADM_PARSE,62,
+ "No such Log-Level %s.", argv[idx]);
+ fprintf(stderr, "PARSE ERROR : "
+ "No such Log-Level %s.\n", argv[idx]);
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_parse == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_PARSE,77,
+ "out_function : static int "
+ "parse_option_snmp(int argc, char *argv[]) : "
+ "return = -1");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return -1;
+ }
+ break;
+ default:
+ break;
+ }
+ break;
+ }
+ }
+ if (!match_option_f) {
+ LOGGER_PUT_LOG_WARN(LOG_CAT_L7VSADM_PARSE,63,
+ "Invalid option for -S command.");
+ fprintf(stderr, "PARSE ERROR : "
+ "Invalid option for -S command.\n");
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_parse == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_PARSE,78,
+ "out_function : static int "
+ "parse_option_snmp(int argc, char *argv[]) : "
+ "return = -1");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return -1;
+ }
+ idx++;
+ }
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_parse == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_PARSE,79,
+ "out_function : static int "
+ "parse_option_snmp(int argc, char *argv[]) : "
+ "return = 0 : result "
+ "l7vsadm_option_data.category_all_flag = %d "
+ "l7vsadm_option_data.log_category = %d "
+ "l7vsadm_option_data.log_level = %d",
+ l7vsadm_option_data.category_all_flag,
+ l7vsadm_option_data.log_category,
+ l7vsadm_option_data.log_level);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return 0;
+}
+
+/*!
+ * Parse parameter command option.
+ * Check 2nd argument and later of parameter command
+ * @param[in] argc number of argument
+ * @param[in] *argv[] array of argument string
+ * @return int parse result OK=0, NG=-1
+ */
+static int
+parse_option_parameter(int argc, char *argv[])
+{
+ struct l7vsadm_option_list *op_list;
+ static struct l7vsadm_component_name_list component_name_table[] = {
+ {PARAM_COMP_ALL, "all"},
+ {PARAM_COMP_L7VSD, "l7vsd"},
+ {PARAM_COMP_IOMUX, "iomux"},
+ {PARAM_COMP_LSOCK, "lsock"},
+ {PARAM_COMP_CONN, "conn"},
+ {PARAM_COMP_DEST, "dest"},
+ {PARAM_COMP_SERVICE, "service"},
+ {PARAM_COMP_MODULE, "module"},
+ {PARAM_COMP_REPLICATION, "replication"},
+ {PARAM_COMP_LOGGER, "logger"},
+ {PARAM_COMP_L7VSADM, "l7vsadm"},
+ {PARAM_COMP_SNMPAGENT, "snmpagent"},
+ {(enum PARAMETER_COMPONENT_TAG)0, NULL}
+ };
+ struct l7vsadm_component_name_list *cmp_list;
+ int idx;
+ int match_option_f;
+ int match_value_f;
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_parse == LOG_LV_DEBUG) {
+ char arg_str[DEBUG_STR_LEN] = {0};
+ argc_argv_c_str(arg_str, argc, argv);
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_PARSE,80,
+ "in_function : static int parse_option_parameter(int argc, char *argv[]) : "
+ "argc = %d, %s",
+ argc,
+ arg_str);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ // Argument check for parameter command.
+ if (argc != 4) {
+ LOGGER_PUT_LOG_WARN(LOG_CAT_L7VSADM_PARSE,64,
+ "Argument argc is illegal for -P command.");
+ fprintf(stderr, "PARSE ERROR : "
+ "Argument argc is illegal for -P command.\n");
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_parse == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_PARSE,81,
+ "out_function : static int "
+ "parse_option_parameter(int argc, char *argv[]) : "
+ "return = -1");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return -1;
+ }
+ idx = 2;
+ while (idx < argc) {
+ match_option_f = 0;
+ // Search option on l7vsadm_option_table_snmp.
+ for (op_list = l7vsadm_option_table_parameter;
+ op_list->option_name != NULL;
+ op_list++) {
+ if (strcmp(argv[idx], op_list->option_name) == 0 ||
+ strcmp(argv[idx], op_list->option_name_long) == 0) {
+ match_option_f = 1;
+ if (op_list->check_flag) {
+ LOGGER_PUT_LOG_WARN(LOG_CAT_L7VSADM_PARSE,65,
+ "Option %s is conflict.",
+ argv[idx]);
+ fprintf(stderr, "PARSE ERROR : "
+ "Option %s is conflict.\n",
+ argv[idx]);
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_parse == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_PARSE,82,
+ "out_function : static int "
+ "parse_option_parameter(int argc, char *argv[]) : "
+ "return = -1");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return -1;
+ }
+ op_list->check_flag = 1;
+ // Check and Set each option value.
+ switch (op_list->option_code) {
+ case OPT_RELOAD:
+ idx++;
+ if (idx >= argc) {
+ LOGGER_PUT_LOG_WARN(LOG_CAT_L7VSADM_PARSE,66,
+ "Need option value for -r option.");
+ fprintf(stderr, "PARSE ERROR : "
+ "Need option value for -r option.\n");
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_parse == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_PARSE,83,
+ "out_function : static int "
+ "parse_option_parameter("
+ "int argc, char *argv[]) : "
+ "return = -1");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return -1;
+ }
+ match_value_f = 0;
+ // Search component name on component_name_table
+ // and Convert component name to component code.
+ for (cmp_list = component_name_table;
+ cmp_list->component_name != NULL;
+ cmp_list++) {
+ if (strcmp(argv[idx],
+ cmp_list->component_name) == 0) {
+ l7vsadm_option_data.reload_param =
+ cmp_list->component_code;
+ match_value_f = 1;
+ break;
+ }
+ }
+ if (!match_value_f) {
+ LOGGER_PUT_LOG_WARN(LOG_CAT_L7VSADM_PARSE,67,
+ "No such Component %s.", argv[idx]);
+ fprintf(stderr, "PARSE ERROR : "
+ "No such Component %s.\n", argv[idx]);
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_parse == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_PARSE,84,
+ "out_function : static int "
+ "parse_option_parameter("
+ "int argc, char *argv[]) : "
+ "return = -1");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return -1;
+ }
+
+ break;
+ default:
+ break;
+ }
+ break;
+ }
+ }
+ if (!match_option_f) {
+ LOGGER_PUT_LOG_WARN(LOG_CAT_L7VSADM_PARSE,68,
+ "Invalid option for -P command.");
+ fprintf(stderr, "PARSE ERROR : "
+ "Invalid option for -P command.\n");
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_parse == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_PARSE,85,
+ "out_function : static int "
+ "parse_option_parameter(int argc, char *argv[]) : "
+ "return = -1");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return -1;
+ }
+ idx++;
+ }
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_parse == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_PARSE,86,
+ "out_function : static int "
+ "parse_option_parameter(int argc, char *argv[]) : "
+ "return = 0 : result "
+ "l7vsadm_option_data.reload_param = %d",
+ l7vsadm_option_data.reload_param);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return 0;
+}
+
+/*!
+ * Parse help command option.
+ * Check 2nd argument and later of help command
+ * @param[in] argc number of argument
+ * @param[in] *argv[] array of argument string
+ * @return int parse result OK=0, NG=-1
+ */
+static int
+parse_option_help(int argc, char *argv[])
+{
+ /*-------- DEBUG LOG --------*/
+ if (log_level_parse == LOG_LV_DEBUG) {
+ char arg_str[DEBUG_STR_LEN] = {0};
+ argc_argv_c_str(arg_str, argc, argv);
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_PARSE,87,
+ "in_function : static int parse_option_help(int argc, char *argv[]) : "
+ "argc = %d, %s",
+ argc,
+ arg_str);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ // Argument check for help command.
+ if (argc != 2) {
+ LOGGER_PUT_LOG_WARN(LOG_CAT_L7VSADM_PARSE,69,
+ "Argument argc is illegal for -h command.");
+ fprintf(stderr, "PARSE ERROR : "
+ "Argument argc is illegal for -h command.\n");
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_parse == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_PARSE,88,
+ "out_function : static int "
+ "parse_option_help(int argc, char *argv[]) : "
+ "return = -1");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return -1;
+ }
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_parse == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_PARSE,89,
+ "out_function : static int "
+ "parse_option_help(int argc, char *argv[]) : "
+ "return = 0");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return 0;
+}
+
+/*!
+ * Parse endpoint option.
+ * Check endpoint(IP-Address:port) data
+ * @param[out] *addr socket address struct
+ * @param[in] *endpoint_str endpoint data string
+ * @return int parse result OK=0, NG=-1
+ */
+static int
+parse_endpoint(struct sockaddr_in *addr, const char *endpoint_str)
+{
+ struct addrinfo *res, hints;
+ struct sockaddr_in *sin;
+ char s[NI_MAXHOST + NI_MAXSERV], *t;
+ int ret;
+
+ // Argment check.
+ if (endpoint_str == NULL) {
+ LOGGER_PUT_LOG_WARN(LOG_CAT_L7VSADM_PARSE,70,
+ "Argument endpoint_str is NULL.");
+ fprintf(stderr, "PARSE ERROR : "
+ "Argument endpoint_str is NULL.\n");
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_parse == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_PARSE,90,
+ "out_function : static int parse_endpoint"
+ "(struct sockaddr_in *addr, const char *endpoint_str) : "
+ "return = -1");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return -1;
+ }
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_parse == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_PARSE,91,
+ "in_function : static int parse_endpoint"
+ "(struct sockaddr_in *addr, const char *endpoint_str) : "
+ "addr = \"\" endpoint_str = %s",
+ endpoint_str);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ // Separate host and port string.
+ strncpy(s, endpoint_str, strlen(endpoint_str));
+ s[strlen(endpoint_str)] = '\0';
+ t = strrchr(s, ':');
+ if (t == NULL) {
+ LOGGER_PUT_LOG_WARN(LOG_CAT_L7VSADM_PARSE,71,
+ "Endpoint string is illegal. (':' not found)");
+ fprintf(stderr, "PARSE ERROR : "
+ "Endpoint string is illegal. (':' not found)\n");
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_parse == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_PARSE,92,
+ "out_function : static int parse_endpoint"
+ "(struct sockaddr_in *addr, const char *endpoint_str) : "
+ "return = -1");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return -1;
+ }
+ *t++ = '\0';
+
+ memset(&hints, 0, sizeof(hints));
+ hints.ai_family = PF_INET; /* inet only. no support for inet6 (yet) */
+ hints.ai_socktype = SOCK_STREAM;
+ ret = getaddrinfo(s, t, &hints, &res);
+ if (ret != 0) {
+ LOGGER_PUT_LOG_WARN(LOG_CAT_L7VSADM_PARSE,72,
+ "getaddrinfo() error. %s:%s: %s", s, t, gai_strerror(ret));
+ fprintf(stderr, "PARSE ERROR : "
+ "getaddrinfo() error. %s:%s: %s\n", s, t, gai_strerror(ret));
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_parse == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_PARSE,93,
+ "out_function : static int parse_endpoint"
+ "(struct sockaddr_in *addr, const char *endpoint_str) : "
+ "return = -1");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return -1;
+ }
+
+ /*
+ * We always use the first entry, because we can't distinguish
+ * which entry you want to specify if we have multiple entries.
+ */
+ sin = (struct sockaddr_in *)res->ai_addr;
+ if (sin->sin_addr.s_addr == htonl(INADDR_ANY)) {
+ LOGGER_PUT_LOG_WARN(LOG_CAT_L7VSADM_PARSE,73,
+ "You can't specify INADDR_ANY for endpoint.");
+ fprintf(stderr, "PARSE ERROR : "
+ "You can't specify INADDR_ANY for endpoint.\n");
+ freeaddrinfo(res);
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_parse == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_PARSE,94,
+ "out_function : static int parse_endpoint"
+ "(struct sockaddr_in *addr, const char *endpoint_str) : "
+ "return = -1");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return -1;
+ }
+
+ if (sin->sin_port == htons(0)) {
+ LOGGER_PUT_LOG_WARN(LOG_CAT_L7VSADM_PARSE,74,
+ "You can't specify port number 0.");
+ fprintf(stderr, "PARSE ERROR : "
+ "You can't specify port number 0.\n");
+ freeaddrinfo(res);
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_parse == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_PARSE,95,
+ "out_function : static int parse_endpoint"
+ "(struct sockaddr_in *addr, const char *endpoint_str) : "
+ "return = -1");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return -1;
+ }
+
+ *addr = *sin;
+ freeaddrinfo(res);
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_parse == LOG_LV_DEBUG) {
+ char ep_str[DEBUG_STR_LEN] = {0};
+ endpoint_c_str(ep_str, (void *)addr);
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_PARSE,96,
+ "out_function : static int parse_endpoint"
+ "(struct sockaddr_in *addr, const char *endpoint_str) : "
+ "return = 0 : result "
+ "addr = (%s)",
+ ep_str);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return 0;
+}
+
+/*!
+ * Parse digit option.
+ * Check digit data
+ * @param[in] *digit_str digit data string
+ * @return int parse result OK=0, NG=-1
+ */
+static int
+parse_digit(const char *digit_str)
+{
+ int i;
+
+ // Argment check.
+ if (digit_str == NULL) {
+ LOGGER_PUT_LOG_WARN(LOG_CAT_L7VSADM_PARSE,75,
+ "Argument digit_str is NULL.");
+ fprintf(stderr, "PARSE ERROR : "
+ "Argument digit_str is NULL.\n");
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_parse == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_PARSE,97,
+ "out_function : static int parse_digit"
+ "(const char *digit_str) : "
+ "return = -1");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return -1;
+ }
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_parse == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_PARSE,98,
+ "in_function : static int parse_digit(const char *digit_str) : "
+ "digit_str = %s",
+ digit_str);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ for (i = 0; i < (int)strlen(digit_str); i++) {
+ // Digit check.
+ if (isdigit(digit_str[i]) == 0) {
+ LOGGER_PUT_LOG_WARN(LOG_CAT_L7VSADM_PARSE,76,
+ "Non digit character is included.");
+ fprintf(stderr, "PARSE ERROR : "
+ "Non digit character is included.\n");
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_parse == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_PARSE,99,
+ "out_function : static int parse_digit"
+ "(const char *digit_str) : "
+ "return = -1");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return -1;
+ }
+ }
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_parse == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_PARSE,100,
+ "out_function : static int parse_digit"
+ "(const char *digit_str) : "
+ "return = 0");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return 0;
+}
+
+/*!
+ * Parse qos option.
+ * Check qos data (xxx,xxxK,xxxM,xxxG)
+ * @param[in] *qos_str qos data string
+ * @return long long qos value, parse result NG=-1
+ */
+static long long
+parse_qos(const char *qos_str)
+{
+ int i;
+ int unit_f = 0;
+ char numstr[4];
+ long long qos_value = 0;
+ long long multiply_value = 0;
+
+ // Argment check.
+ if (qos_str == NULL) {
+ LOGGER_PUT_LOG_WARN(LOG_CAT_L7VSADM_PARSE,77,
+ "Argument qos_str is NULL.");
+ fprintf(stderr, "PARSE ERROR : "
+ "Argument qos_str is NULL.\n");
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_parse == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_PARSE,101,
+ "out_function : static long long parse_qos"
+ "(const char *qos_str) : "
+ "return = -1");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return -1;
+ }
+ if ((int)strlen(qos_str) > 4) {
+ LOGGER_PUT_LOG_WARN(LOG_CAT_L7VSADM_PARSE,78,
+ "Argument qos_str is too long.");
+ fprintf(stderr, "PARSE ERROR : "
+ "Argument qos_str is too long.\n");
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_parse == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_PARSE,102,
+ "out_function : static long long parse_qos"
+ "(const char *qos_str) : "
+ "return = -1");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return -1;
+ }
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_parse == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_PARSE,103,
+ "in_function : static long long parse_qos"
+ "(const char *qos_str) : "
+ "qos_str = %s",
+ qos_str);
+ }
+ /*------ DEBUG LOG END ------*/
+
+
+ for (i = 0; i < (int)strlen(qos_str); i++) {
+ // Check QoS data format. (xxx or xxx + one alphabet)
+ if (isdigit(qos_str[i]) == 0) {
+ if ((int)strlen(qos_str) > 1 &&
+ i == (int)strlen(qos_str) -1 &&
+ isalpha(qos_str[i]) != 0) {
+ // xxx + one alphabet (len > 1)
+ unit_f = 1;
+ } else {
+ LOGGER_PUT_LOG_WARN(LOG_CAT_L7VSADM_PARSE,79,
+ "Wrong QoS value format.");
+ fprintf(stderr, "PARSE ERROR : "
+ "Wrong QoS value format.\n");
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_parse == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_PARSE,104,
+ "out_function : static long long parse_qos"
+ "(const char *qos_str) : "
+ "return = -1");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return -1;
+ }
+ }
+ }
+ if (unit_f) {
+ // Format xxxK,xxxM,xxxG,xxxk,xxxm,xxxg
+ strncpy(numstr, qos_str, strlen(qos_str) - 1);
+ numstr[strlen(qos_str) - 1] = '\0';
+ sscanf(numstr, "%lld", &qos_value);
+ if (qos_value < 0LL || qos_value > 999LL) {
+ LOGGER_PUT_LOG_WARN(LOG_CAT_L7VSADM_PARSE,80,
+ "Invalid QoS value.");
+ fprintf(stderr, "PARSE ERROR : "
+ "Invalid QoS value.\n");
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_parse == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_PARSE,105,
+ "out_function : static long long parse_qos"
+ "(const char *qos_str) : "
+ "return = -1");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return -1;
+ }
+ if (qos_str[strlen(qos_str) - 1] == 'K' ||
+ qos_str[strlen(qos_str) - 1] == 'k') {
+ multiply_value = 1000LL;
+ } else if (qos_str[strlen(qos_str) - 1] == 'M' ||
+ qos_str[strlen(qos_str) - 1] == 'm') {
+ multiply_value = 1000LL * 1000LL;
+ } else if (qos_str[strlen(qos_str) - 1] == 'G' ||
+ qos_str[strlen(qos_str) - 1] == 'g') {
+ multiply_value = 1000LL * 1000LL * 1000LL;
+ } else {
+ LOGGER_PUT_LOG_WARN(LOG_CAT_L7VSADM_PARSE,81,
+ "Invalid QoS value unit character.");
+ fprintf(stderr, "PARSE ERROR : "
+ "Invalid QoS value character.\n");
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_parse == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_PARSE,106,
+ "out_function : static long long parse_qos"
+ "(const char *qos_str) : "
+ "return = -1");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return -1;
+ }
+ // Convert from bps to byte/s.
+ //qos_value = qos_value * multiply_value / 8LL;
+ qos_value = qos_value * multiply_value;
+ } else {
+ // Format xxx only.
+ sscanf(qos_str, "%lld", &qos_value);
+ if (qos_value < 0LL || qos_value > 999LL) {
+ LOGGER_PUT_LOG_WARN(LOG_CAT_L7VSADM_PARSE,82,
+ "Invalid QoS value.");
+ fprintf(stderr, "PARSE ERROR : "
+ "Invalid QoS value.\n");
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_parse == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_PARSE,107,
+ "out_function : static long long parse_qos"
+ "(const char *qos_str) : "
+ "return = -1");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return -1;
+ }
+ // Convert from bps to byte/s.
+// qos_value = qos_value / 8LL;
+ }
+
+ // compare l7vs_conn_read_bufsize <= qos_value by bps
+ if (qos_value != 0) {
+ int l7vs_conn_read_bufsize_bps = 20480 * 8; //! conn read buffer size
+ int ret = parameter_is_int_exist( PARAM_COMP_CONN, "read_bufsize" );
+ if (ret) {
+ int bufsize = parameter_get_int_value( PARAM_COMP_CONN, "read_bufsize" );
+ if (bufsize >= L7VS_CONN_READ_BUFSIZE_MIN && bufsize <= L7VS_CONN_READ_BUFSIZE_MAX)
+ l7vs_conn_read_bufsize_bps = bufsize * 8;
+ else if (bufsize > L7VS_CONN_READ_BUFSIZE_MAX) {
+ l7vs_conn_read_bufsize_bps = L7VS_CONN_READ_BUFSIZE_MAX * 8;
+ }
+ else {
+ l7vs_conn_read_bufsize_bps = L7VS_CONN_READ_BUFSIZE_MIN * 8;
+ }
+ }
+ if (l7vs_conn_read_bufsize_bps > qos_value) {
+ LOGGER_PUT_LOG_WARN(LOG_CAT_L7VSADM_PARSE,86,
+ "Invalid QoS value. qos >= read_bufsize is must");
+ fprintf(stderr, "PARSE ERROR : "
+ "Invalid QoS value. qos >= read_bufsize is must\n");
+
+ return -1;
+ }
+ }
+
+ // Convert from bps to byte/s.
+ qos_value = qos_value / 8LL;
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_parse == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_PARSE,108,
+ "out_function : static long long parse_qos"
+ "(const char *qos_str) : "
+ "return = %lld",
+ qos_value);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return qos_value;
+}
+
+/*!
+ * Parse protocol module option.
+ * Check protocol module option data
+ * @param[in] argc number of argument
+ * @param[in] *argv[] array of argument string
+ * @param[in] m_idx_begin start of module option
+ * @param[in] m_idx_end end of module option
+ * @return int parse result OK=0, NG=-1
+ */
+static int
+parse_option_protomod(int argc, char *argv[], int m_idx_begin, int m_idx_end)
+{
+ struct l7vs_service_arg_multi sarg;
+ void *protomod_service_arg;
+ int ret;
+ int i;
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_parse == LOG_LV_DEBUG) {
+ char arg_str[DEBUG_STR_LEN] = {0};
+ argc_argv_c_str(arg_str, argc, argv);
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_PARSE,109,
+ "in_function : static int parse_option_protomod"
+ "(int argc, char *argv[], int m_idx_begin, int m_idx_end) : "
+ "argc = %d, %s, m_idx_begin = %d, m_idx_end = %d",
+ argc,
+ arg_str,
+ m_idx_begin,
+ m_idx_end);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ // Check signal.
+ if (signal_flg > 0) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSADM_COMMON,1,
+ "Signal (%d) Received.", received_sig);
+ fprintf(stderr, "COMMON ERROR : "
+ "Signal (%d) Received.\n", received_sig);
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_parse == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_PARSE,110,
+ "out_function : static int parse_option_protomod"
+ "(int argc, char *argv[], int m_idx_begin, int m_idx_end) : "
+ "return = -1");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return -1;
+ }
+
+ // Clear sarg.
+ memset(&sarg, 0, sizeof(l7vs_service_arg_multi));
+
+ // Create GArray.
+ l7vsadm_option_data.protomod_options = g_array_new(FALSE, TRUE, sizeof(char*));
+ if (l7vsadm_option_data.protomod_options == NULL) {
+ LOGGER_PUT_LOG_FATAL(LOG_CAT_L7VSADM_COMMON,1,
+ " GArray create error. (Could not allocate memory)");
+ fprintf(stderr, "COMMON ERROR : "
+ " GArray create error. (Could not allocate memory)\n");
+ ret = -1;
+ goto END;
+ }
+
+ /* Add argv[0] first because getopt_long() skip argv[0]... */
+ if (g_array_append_val(l7vsadm_option_data.protomod_options, argv[0]) == NULL) {
+ LOGGER_PUT_LOG_FATAL(LOG_CAT_L7VSADM_COMMON,2,
+ "Add to GArray error. (Could not allocate memory)");
+ fprintf(stderr, "COMMON ERROR : "
+ "Add to GArray error. (Could not allocate memory)\n");
+ ret = -1;
+ goto END;
+ }
+ // Add Protocol Module option to GArray. (from m_idx_begin to m_idx_end)
+ for (i = m_idx_begin; i < m_idx_end; i++) {
+ if (g_array_append_val(l7vsadm_option_data.protomod_options, argv[i]) == NULL) {
+ LOGGER_PUT_LOG_FATAL(LOG_CAT_L7VSADM_COMMON,3,
+ "Add to GArray error. (Could not allocate memory)");
+ fprintf(stderr, "COMMON ERROR : "
+ "Add to GArray error. (Could not allocate memory)\n");
+ ret = -1;
+ goto END;
+ }
+ }
+
+ // Protocol Module Initialize.
+ ret = l7vs_module_init(NULL);
+ if (ret < 0) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSADM_PARSE,1,
+ "Protocol Module Initialize error.");
+ fprintf(stderr, "PARSE ERROR : "
+ "Protocol Module Initialize error.\n");
+ goto END;
+ }
+
+ // Protocol Module Load.
+ l7vsadm_option_data.protomod =
+ (struct l7vs_protomod *)l7vs_protomod_get(l7vsadm_option_data.protomod_name);
+ if (l7vsadm_option_data.protomod == NULL) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSADM_PARSE,2,
+ "Protocol Module Load error.");
+ fprintf(stderr, "PARSE ERROR : "
+ "Protocol Module Load error.\n");
+ ret = -1;
+ goto END;
+ }
+
+ // Check Protocol Module function pointer
+ if (l7vsadm_option_data.protomod->create_sa == NULL) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSADM_PARSE,3,
+ "create_sa() function pointer is NULL.");
+ fprintf(stderr, "PARSE ERROR : "
+ "create_sa() function pointer is NULL.\n");
+ ret = -1;
+ goto END;
+ }
+ if (l7vsadm_option_data.protomod->destroy_sa == NULL) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSADM_PARSE,4,
+ "destroy_sa() function pointer is NULL.");
+ fprintf(stderr, "PARSE ERROR : "
+ "destroy_sa() function pointer is NULL.\n");
+ ret = -1;
+ goto END;
+ }
+ if (l7vsadm_option_data.protomod->parse == NULL) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSADM_PARSE,5,
+ "parse() function pointer is NULL.");
+ fprintf(stderr, "PARSE ERROR : "
+ "parse() function pointer is NULL.\n");
+ ret = -1;
+ goto END;
+ }
+
+ // Create Protocol Module service_arg
+ protomod_service_arg = l7vsadm_option_data.protomod->create_sa(&sarg.srv_arg);
+ if (protomod_service_arg == NULL) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSADM_PARSE,6,
+ "Create Protocol Module service_arg error.");
+ fprintf(stderr, "PARSE ERROR : "
+ "Create Protocol Module service_arg error.\n");
+ ret = -1;
+ goto END;
+ }
+ // Copy protomod_service_arg to sarg.protomod_arg
+ memcpy(&sarg.protomod_arg, protomod_service_arg, sizeof(sarg.protomod_arg));
+
+ // Destroy protomod_service_arg. (because copy end)
+ l7vsadm_option_data.protomod->destroy_sa(&protomod_service_arg);
+
+ // Parse Protocol Module option. (parse result saved sarg.protomod_arg)
+ ret = l7vsadm_option_data.protomod->parse(sarg.protomod_arg,
+ l7vsadm_option_data.protomod_options->len,
+ (char **)l7vsadm_option_data.protomod_options->data);
+ if (ret < 0) {
+ LOGGER_PUT_LOG_WARN(LOG_CAT_L7VSADM_PARSE,83,
+ "Parse %s Protocol Module option error.",
+ l7vsadm_option_data.protomod_name);
+ fprintf(stderr, "PARSE ERROR : "
+ "Parse %s Protocol Module option error.\n",
+ l7vsadm_option_data.protomod_name);
+ goto END;
+ }
+
+ // Copy sarg.protomod_arg to l7vsadm_option_data. (for operate)
+ memcpy(&l7vsadm_option_data.protomod_sarg,
+ &sarg,
+ sizeof(struct l7vs_service_arg_multi));
+
+ ret = 0;
+
+END:
+ if (l7vsadm_option_data.protomod_options != NULL) {
+ g_array_free(l7vsadm_option_data.protomod_options, TRUE);
+ }
+
+ if (l7vsadm_option_data.protomod != NULL) {
+ l7vs_protomod_put(l7vsadm_option_data.protomod);
+ }
+
+ l7vs_module_fini();
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_parse == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_PARSE,111,
+ "out_function : static int parse_option_protomod"
+ "(int argc, char *argv[], int m_idx_begin, int m_idx_end) : "
+ "return = %d",
+ ret);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return ret;
+}
+
+/*!
+ * Operate List command.
+ * @return int result OK=0, NG=<0
+ */
+static int
+operate_list(void)
+{
+ struct l7vs_service_arg *sarg;
+ void *vs_buffer = NULL;
+ int vs_bufsize = L7VSADM_DEFAULT_LIST_VS_BUFSIZE;
+ int vs_num;
+ int ret_num;
+ int vs_offset;
+ int i;
+ int ret;
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_operate == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_OPERATE,1,
+ "in_function : static int operate_list(void) : ");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ ret = create_socket();
+ if (ret < 0) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSADM_OPERATE,1,
+ "Create socket error.");
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_operate == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_OPERATE,2,
+ "out_function : static int operate_list"
+ "(void) : "
+ "return = -1");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return -1;
+ }
+
+ // Print Version.
+ printf("Layer-7 Virtual Server version %s\n", L7VS_VERSION_STRING);
+
+ if (l7vsadm_option_data.command_code == CMD_LIST_VERBOSE) {
+ // Logger info.
+ ret = list_log_info();
+ if (ret < 0) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSADM_OPERATE,2,
+ "List logger info error.");
+ goto END;
+ }
+
+ // Replication info.
+ ret = list_replication_info();
+ if (ret < 0) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSADM_OPERATE,3,
+ "List replication info error.");
+ goto END;
+ }
+
+ // SNMPAgent info.
+ ret = list_snmp_info();
+ if (ret < 0) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSADM_OPERATE,4,
+ "List SNMPAgent info error.");
+ goto END;
+ }
+ }
+
+ // Display VS header.
+ if (l7vsadm_option_data.command_code == CMD_LIST_VERBOSE) {
+ printf("Prot LocalAddress:Port ProtoMod Scheduler Reschedule "
+ "Protomod_opt_string\n");
+ printf(" SorryAddress:Port Sorry_cc Sorry_flag\n");
+ printf(" QoS-up Throughput-up\n");
+ printf(" QoS-down Throughput-down\n");
+ } else if (l7vsadm_option_data.command_code == CMD_LIST_KEY) {
+ printf("Prot LocalAddress:Port ProtoMod Scheduler Reschedule "
+ "Protomod_key_string\n");
+ } else {
+ printf("Prot LocalAddress:Port ProtoMod Scheduler\n");
+ }
+ printf(" -> RemoteAddress:Port Forward Weight ActiveConn InactConn\n");
+
+RETRY:
+ // Alloc VirtualService list memory.
+ vs_buffer = malloc(vs_bufsize);
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_common == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_COMMON,1,
+ "malloc vs_buffer : "
+ "allocate address = %p "
+ "allocate size = %d",
+ vs_buffer,
+ vs_bufsize);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ if (vs_buffer == NULL) {
+ LOGGER_PUT_LOG_FATAL(LOG_CAT_L7VSADM_COMMON,4,
+ "Could not allocate vs_buffer memory.");
+ fprintf(stderr, "COMMON ERROR : "
+ "Could not allocate vs_buffer memory.\n");
+ ret = -1;
+ goto END;
+ }
+ // Get all VirtualService list.
+ ret_num = get_vs(vs_buffer, vs_bufsize);
+ // If return L7VSADM_RECV_TOO_LARGE (-2) when extend vs_buffer size and retry.
+ if (ret_num < 0) {
+ free(vs_buffer);
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_common == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_COMMON,2,
+ "free vs_buffer : "
+ "free address = %p",
+ vs_buffer);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ vs_buffer = NULL;
+ if (ret_num == L7VSADM_RECV_TOO_LARGE) {
+ vs_bufsize += L7VSADM_DEFAULT_LIST_VS_BUFSIZE;
+ LOGGER_PUT_LOG_WARN(LOG_CAT_L7VSADM_OPERATE,1,
+ "Receive VirtualService data too large. retrying.");
+ goto RETRY;
+ }
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSADM_OPERATE,5,
+ "Get VirtualService data error.");
+ fprintf(stderr, "OPERATE ERROR : "
+ "Get VirtualService data error.\n");
+ ret = -1;
+ goto END;
+ }
+ vs_num = ret_num;
+ // List all VirtualService.
+ sarg = (struct l7vs_service_arg *)vs_buffer;
+ vs_offset = 0;
+ for (i = 0; i < vs_num; i++) {
+ ret = list_vs(sarg);
+ if (ret < 0) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSADM_OPERATE,6,
+ "List VirtualService data error.");
+ fprintf(stderr, "OPERATE ERROR : "
+ "List VirtualService data error.\n");
+ goto END;
+ }
+ vs_offset += sarg->len;
+ if (vs_offset >= vs_bufsize) {
+ // Message size did not match.
+ // Version mismatch between l7vsd and l7vsadm?
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSADM_OPERATE,7,
+ "VirtualService message size did not match.");
+ fprintf(stderr, "OPERATE ERROR : "
+ "VirtualService message size did not match.\n");
+ ret = -1;
+ goto END;
+ }
+ sarg = (struct l7vs_service_arg *)((char *)vs_buffer + vs_offset);
+ }
+ ret = 0;
+
+END:
+ if (vs_buffer != NULL) {
+ free(vs_buffer);
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_common == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_COMMON,3,
+ "free vs_buffer : "
+ "free address = %p",
+ vs_buffer);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ }
+
+ destroy_socket();
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_operate == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_OPERATE,3,
+ "out_function : static int operate_list"
+ "(void) : "
+ "return = %d",
+ ret);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return ret;
+}
+
+/*!
+ * Operate Add-VirtualService command.
+ * @return int result OK=0, NG=<0
+ */
+static int
+operate_add_vs(void)
+{
+ struct l7vs_config_req_operate_vs req;
+ struct l7vs_config_rsp_operate_vs rsp;
+ struct l7vsadm_iov_data iov_data;
+ int ret;
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_operate == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_OPERATE,4,
+ "in_function : static int operate_add_vs(void) : ");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ ret = create_socket();
+ if (ret < 0) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSADM_OPERATE,8,
+ "Create socket error.");
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_operate == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_OPERATE,5,
+ "out_function : static int operate_add_vs"
+ "(void) : "
+ "return = -1");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return -1;
+ }
+
+ memset(&req, 0, sizeof(struct l7vs_config_req_operate_vs));
+ memset(&rsp, 0, sizeof(struct l7vs_config_rsp_operate_vs));
+ memset(&iov_data, 0, sizeof(struct l7vsadm_iov_data));
+
+ req.cmd = L7VS_CONFIG_ADD_VS;
+
+ l7vsadm_option_data.protomod_sarg.srv_arg.addr = l7vsadm_option_data.vs_addr;
+ l7vsadm_option_data.protomod_sarg.srv_arg.proto = IPPROTO_TCP;
+ l7vsadm_option_data.protomod_sarg.srv_arg.backlog = L7VSADM_DEFAULT_BACKLOG;
+
+ strncpy(l7vsadm_option_data.protomod_sarg.srv_arg.schedmod,
+ l7vsadm_option_data.schedmod_name,
+ strlen(l7vsadm_option_data.schedmod_name));
+
+ // set sorry data
+ l7vsadm_option_data.protomod_sarg.srv_arg.sorry_cc = l7vsadm_option_data.max_connection;
+ l7vsadm_option_data.protomod_sarg.srv_arg.sorry_addr = l7vsadm_option_data.sorry_addr;
+ l7vsadm_option_data.protomod_sarg.srv_arg.sorry_flag = l7vsadm_option_data.sorry_flag;
+
+ // QoS Threshold data
+ l7vsadm_option_data.protomod_sarg.srv_arg.qos_threshold_up = l7vsadm_option_data.qos_threshold_up;
+ l7vsadm_option_data.protomod_sarg.srv_arg.qos_threshold_down = l7vsadm_option_data.qos_threshold_down;
+
+ // Set data for request
+ iov_data.req_iov[0].iov_base = &req;
+ iov_data.req_iov[0].iov_len = sizeof(req);
+ iov_data.req_iov[1].iov_base = &l7vsadm_option_data.protomod_sarg;
+ iov_data.req_iov[1].iov_len = sizeof(struct l7vs_service_arg_multi);
+ iov_data.req_cnt = 2;
+
+ // Set data for response
+ iov_data.rsp_iov[0].iov_base = &rsp;
+ iov_data.rsp_iov[0].iov_len = sizeof(rsp);
+ iov_data.rsp_cnt = 1;
+
+ ret = communicate_to_l7vsd(&iov_data);
+ if (ret < 0) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSADM_OPERATE,9,
+ "Communicate to l7vsd error.");
+ goto END;
+ }
+
+ if (rsp.code != 0) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSADM_CONFIG_RESULT,1,
+ "%s.", config_strerror(rsp.code));
+ fprintf(stderr, "CONFIG ERROR : "
+ "%s.\n", config_strerror(rsp.code));
+ ret = -1;
+ goto END;
+ }
+ ret = 0;
+
+END:
+ destroy_socket();
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_operate == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_OPERATE,6,
+ "out_function : static int operate_add_vs"
+ "(void) : "
+ "return = %d",
+ ret);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return ret;
+}
+
+/*!
+ * Operate Edit-VirtualService command.
+ * @return int result OK=0, NG=<0
+ */
+static int
+operate_edit_vs(void)
+{
+ struct l7vs_config_req_operate_vs req;
+ struct l7vs_config_rsp_operate_vs rsp;
+ struct l7vsadm_iov_data iov_data;
+ int ret;
+ struct l7vsadm_option_list *list;
+ int specified_f = 0;
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_operate == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_OPERATE,7,
+ "in_function : static int operate_edit_vs(void) : ");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ ret = create_socket();
+ if (ret < 0) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSADM_OPERATE,10,
+ "Create socket error.");
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_operate == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_OPERATE,8,
+ "out_function : static int operate_edit_vs"
+ "(void) : "
+ "return = -1");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return -1;
+ }
+
+ memset(&req, 0, sizeof(struct l7vs_config_req_operate_vs));
+ memset(&rsp, 0, sizeof(struct l7vs_config_rsp_operate_vs));
+ memset(&iov_data, 0, sizeof(struct l7vsadm_iov_data));
+
+ req.cmd = L7VS_CONFIG_EDIT_VS;
+
+ l7vsadm_option_data.protomod_sarg.srv_arg.addr = l7vsadm_option_data.vs_addr;
+ l7vsadm_option_data.protomod_sarg.srv_arg.proto = IPPROTO_TCP;
+ l7vsadm_option_data.protomod_sarg.srv_arg.backlog = L7VSADM_DEFAULT_BACKLOG;
+
+ // Check Specified option for edit. Set -1 or NULL or etc. to omitted option.
+ for (list = l7vsadm_option_table_vs; list->option_name != NULL; list++) {
+ switch (list->option_code) {
+ case OPT_SCHEDULER:
+ if (list->check_flag) {
+ // Option specified.
+ strncpy(l7vsadm_option_data.protomod_sarg.srv_arg.schedmod,
+ l7vsadm_option_data.schedmod_name,
+ strlen(l7vsadm_option_data.schedmod_name));
+ } else {
+ // Option omitted. Set all "0x00".
+ memset(&l7vsadm_option_data.protomod_sarg.srv_arg.schedmod, 0,
+ sizeof(l7vsadm_option_data.protomod_sarg.srv_arg.schedmod));
+ }
+ break;
+ case OPT_UPPER:
+ if (list->check_flag) {
+ // Option specified.
+ l7vsadm_option_data.protomod_sarg.srv_arg.sorry_cc =
+ l7vsadm_option_data.max_connection;
+ } else {
+ // Option omitted.
+ l7vsadm_option_data.protomod_sarg.srv_arg.sorry_cc = -1;
+ }
+ break;
+ case OPT_BYPASS:
+ if (list->check_flag) {
+ // Option specified.
+ l7vsadm_option_data.protomod_sarg.srv_arg.sorry_addr =
+ l7vsadm_option_data.sorry_addr;
+ } else {
+ // Option omitted. Set all "0xff".
+ memset(&l7vsadm_option_data.protomod_sarg.srv_arg.sorry_addr, 0xff,
+ sizeof(struct sockaddr_storage));
+ }
+ break;
+ case OPT_FLAG:
+ if (list->check_flag) {
+ // Option specified.
+ l7vsadm_option_data.protomod_sarg.srv_arg.sorry_flag =
+ l7vsadm_option_data.sorry_flag;
+ } else {
+ // Option omitted. Set -1.
+ l7vsadm_option_data.protomod_sarg.srv_arg.sorry_flag = -1;
+ }
+ break;
+ case OPT_QOS_UP:
+ if (list->check_flag) {
+ // Option specified.
+ l7vsadm_option_data.protomod_sarg.srv_arg.qos_threshold_up =
+ l7vsadm_option_data.qos_threshold_up;
+ } else {
+ // Option omitted. Set ULLONG_MAX.
+ l7vsadm_option_data.protomod_sarg.srv_arg.qos_threshold_up = ULLONG_MAX;
+ }
+ break;
+ case OPT_QOS_DOWN:
+ if (list->check_flag) {
+ // Option specified.
+ l7vsadm_option_data.protomod_sarg.srv_arg.qos_threshold_down =
+ l7vsadm_option_data.qos_threshold_down;
+ } else {
+ // Option omitted. Set ULLONG_MAX.
+ l7vsadm_option_data.protomod_sarg.srv_arg.qos_threshold_down = ULLONG_MAX;
+ }
+ break;
+ default:
+ break;
+ }
+ specified_f += list->check_flag;
+ }
+
+ // All option omitted.
+ if (specified_f == 0) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSADM_OPERATE,11,
+ "All option omitted for edit vs command.");
+ fprintf(stderr, "OPERATE ERROR : "
+ "All option omitted for edit vs command.\n");
+ ret = -1;
+ goto END;
+ }
+
+ // Set data for request
+ iov_data.req_iov[0].iov_base = &req;
+ iov_data.req_iov[0].iov_len = sizeof(req);
+ iov_data.req_iov[1].iov_base = &l7vsadm_option_data.protomod_sarg;
+ iov_data.req_iov[1].iov_len = sizeof(struct l7vs_service_arg_multi);
+ iov_data.req_cnt = 2;
+
+ // Set data for response
+ iov_data.rsp_iov[0].iov_base = &rsp;
+ iov_data.rsp_iov[0].iov_len = sizeof(rsp);
+ iov_data.rsp_cnt = 1;
+
+ ret = communicate_to_l7vsd(&iov_data);
+ if (ret < 0) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSADM_OPERATE,12,
+ "Communicate to l7vsd error.");
+ goto END;
+ }
+
+ if (rsp.code != 0) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSADM_CONFIG_RESULT,2,
+ "%s.", config_strerror(rsp.code));
+ fprintf(stderr, "CONFIG ERROR : "
+ "%s.\n", config_strerror(rsp.code));
+ ret = -1;
+ goto END;
+ }
+ ret = 0;
+
+END:
+ destroy_socket();
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_operate == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_OPERATE,9,
+ "out_function : static int operate_edit_vs"
+ "(void) : "
+ "return = %d",
+ ret);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return ret;
+}
+
+/*!
+ * Operate Delete-VirtualService command.
+ * @return int result OK=0, NG=<0
+ */
+static int
+operate_del_vs(void)
+{
+ struct l7vs_config_req_operate_vs req;
+ struct l7vs_config_rsp_operate_vs rsp;
+ struct l7vsadm_iov_data iov_data;
+ int ret;
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_operate == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_OPERATE,10,
+ "in_function : static int operate_del_vs(void) : ");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ ret = create_socket();
+ if (ret < 0) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSADM_OPERATE,13,
+ "Create socket error.");
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_operate == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_OPERATE,11,
+ "out_function : static int operate_del_vs"
+ "(void) : "
+ "return = -1");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return -1;
+ }
+
+ memset(&req, 0, sizeof(struct l7vs_config_req_operate_vs));
+ memset(&rsp, 0, sizeof(struct l7vs_config_rsp_operate_vs));
+ memset(&iov_data, 0, sizeof(struct l7vsadm_iov_data));
+
+ req.cmd = L7VS_CONFIG_DEL_VS;
+
+ l7vsadm_option_data.protomod_sarg.srv_arg.addr = l7vsadm_option_data.vs_addr;
+ l7vsadm_option_data.protomod_sarg.srv_arg.proto = IPPROTO_TCP;
+ l7vsadm_option_data.protomod_sarg.srv_arg.backlog = L7VSADM_DEFAULT_BACKLOG;
+
+ // Set data for request
+ iov_data.req_iov[0].iov_base = &req;
+ iov_data.req_iov[0].iov_len = sizeof(req);
+ iov_data.req_iov[1].iov_base = &l7vsadm_option_data.protomod_sarg;
+ iov_data.req_iov[1].iov_len = sizeof(struct l7vs_service_arg_multi);
+ iov_data.req_cnt = 2;
+
+ // Set data for response
+ iov_data.rsp_iov[0].iov_base = &rsp;
+ iov_data.rsp_iov[0].iov_len = sizeof(rsp);
+ iov_data.rsp_cnt = 1;
+
+ ret = communicate_to_l7vsd(&iov_data);
+ if (ret < 0) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSADM_OPERATE,14,
+ "Communicate to l7vsd error.");
+ goto END;
+ }
+
+ if (rsp.code != 0) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSADM_CONFIG_RESULT,3,
+ "%s.", config_strerror(rsp.code));
+ fprintf(stderr, "CONFIG ERROR : "
+ "%s.\n", config_strerror(rsp.code));
+ ret = -1;
+ goto END;
+ }
+ ret = 0;
+
+END:
+ destroy_socket();
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_operate == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_OPERATE,12,
+ "out_function : static int operate_del_vs"
+ "(void) : "
+ "return = %d",
+ ret);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return ret;
+}
+
+/*!
+ * Operate Flush-VirtualService command.
+ * @return int result OK=0, NG=<0
+ */
+static int
+operate_flush_vs(void)
+{
+ struct l7vs_config_req_flush_vs req;
+ struct l7vs_config_rsp_flush_vs rsp;
+ struct l7vsadm_iov_data iov_data;
+ int ret;
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_operate == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_OPERATE,13,
+ "in_function : static int operate_flush_vs(void) : ");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ ret = create_socket();
+ if (ret < 0) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSADM_OPERATE,15,
+ "Create socket error.");
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_operate == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_OPERATE,14,
+ "out_function : static int operate_flush_vs"
+ "(void) : "
+ "return = -1");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return -1;
+ }
+
+ memset(&req, 0, sizeof(struct l7vs_config_req_flush_vs));
+ memset(&rsp, 0, sizeof(struct l7vs_config_rsp_flush_vs));
+ memset(&iov_data, 0, sizeof(struct l7vsadm_iov_data));
+
+ req.cmd = L7VS_CONFIG_FLUSH_VS;
+
+ // Set data for request
+ iov_data.req_iov[0].iov_base = &req;
+ iov_data.req_iov[0].iov_len = sizeof(req);
+ iov_data.req_cnt = 1;
+
+ // Set data for response
+ iov_data.rsp_iov[0].iov_base = &rsp;
+ iov_data.rsp_iov[0].iov_len = sizeof(rsp);
+ iov_data.rsp_cnt = 1;
+
+ ret = communicate_to_l7vsd(&iov_data);
+ if (ret < 0) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSADM_OPERATE,16,
+ "Communicate to l7vsd error.");
+ goto END;
+ }
+
+ if (rsp.code != 0) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSADM_CONFIG_RESULT,4,
+ "%s.", config_strerror(rsp.code));
+ fprintf(stderr, "CONFIG ERROR : "
+ "%s.\n", config_strerror(rsp.code));
+ ret = -1;
+ goto END;
+ }
+ ret = 0;
+
+END:
+ destroy_socket();
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_operate == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_OPERATE,15,
+ "out_function : static int operate_flush_vs"
+ "(void) : "
+ "return = %d",
+ ret);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return ret;
+}
+
+/*!
+ * Operate Add-RealServer command.
+ * @return int result OK=0, NG=<0
+ */
+static int
+operate_add_rs(void)
+{
+ struct l7vs_config_req_operate_rs req;
+ struct l7vs_config_rsp_operate_rs rsp;
+ struct l7vsadm_iov_data iov_data;
+ int ret;
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_operate == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_OPERATE,16,
+ "in_function : static int operate_add_rs(void) : ");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ ret = create_socket();
+ if (ret < 0) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSADM_OPERATE,17,
+ "Create socket error.");
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_operate == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_OPERATE,17,
+ "out_function : static int operate_add_rs"
+ "(void) : "
+ "return = -1");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return -1;
+ }
+
+ memset(&req, 0, sizeof(struct l7vs_config_req_operate_rs));
+ memset(&rsp, 0, sizeof(struct l7vs_config_rsp_operate_rs));
+ memset(&iov_data, 0, sizeof(struct l7vsadm_iov_data));
+
+ req.cmd = L7VS_CONFIG_ADD_RS;
+
+ l7vsadm_option_data.protomod_sarg.srv_arg.addr = l7vsadm_option_data.vs_addr;
+ l7vsadm_option_data.protomod_sarg.srv_arg.proto = IPPROTO_TCP;
+
+ req.darg.addr = l7vsadm_option_data.rs_addr;
+ req.darg.weight = l7vsadm_option_data.weight;
+
+ // Set data for request
+ iov_data.req_iov[0].iov_base = &req;
+ iov_data.req_iov[0].iov_len = sizeof(req);
+ iov_data.req_iov[1].iov_base = &l7vsadm_option_data.protomod_sarg;
+ iov_data.req_iov[1].iov_len = sizeof(struct l7vs_service_arg_multi);
+ iov_data.req_cnt = 2;
+
+ // Set data for response
+ iov_data.rsp_iov[0].iov_base = &rsp;
+ iov_data.rsp_iov[0].iov_len = sizeof(rsp);
+ iov_data.rsp_cnt = 1;
+
+ ret = communicate_to_l7vsd(&iov_data);
+ if (ret < 0) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSADM_OPERATE,18,
+ "Communicate to l7vsd error.");
+ goto END;
+ }
+
+ if (rsp.code != 0) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSADM_CONFIG_RESULT,5,
+ "%s.", config_strerror(rsp.code));
+ fprintf(stderr, "CONFIG ERROR : "
+ "%s.\n", config_strerror(rsp.code));
+ ret = -1;
+ goto END;
+ }
+ ret = 0;
+
+END:
+ destroy_socket();
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_operate == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_OPERATE,18,
+ "out_function : static int operate_add_rs"
+ "(void) : "
+ "return = %d",
+ ret);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return ret;
+}
+
+/*!
+ * Operate Edit-RealServer command.
+ * @return int result OK=0, NG=<0
+ */
+static int
+operate_edit_rs(void)
+{
+ struct l7vs_config_req_operate_rs req;
+ struct l7vs_config_rsp_operate_rs rsp;
+ struct l7vsadm_iov_data iov_data;
+ int ret;
+ struct l7vsadm_option_list *list;
+ int specified_f = 0;
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_operate == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_OPERATE,19,
+ "in_function : static int operate_edit_rs(void) : ");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ ret = create_socket();
+ if (ret < 0) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSADM_OPERATE,19,
+ "Create socket error.");
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_operate == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_OPERATE,20,
+ "out_function : static int operate_edit_rs"
+ "(void) : "
+ "return = -1");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return -1;
+ }
+
+ memset(&req, 0, sizeof(struct l7vs_config_req_operate_rs));
+ memset(&rsp, 0, sizeof(struct l7vs_config_rsp_operate_rs));
+ memset(&iov_data, 0, sizeof(struct l7vsadm_iov_data));
+
+ req.cmd = L7VS_CONFIG_EDIT_RS;
+
+ l7vsadm_option_data.protomod_sarg.srv_arg.addr = l7vsadm_option_data.vs_addr;
+ l7vsadm_option_data.protomod_sarg.srv_arg.proto = IPPROTO_TCP;
+
+ req.darg.addr = l7vsadm_option_data.rs_addr;
+
+ // Check Specified option for edit. Set -1 or NULL or etc. to omitted option.
+ for (list = l7vsadm_option_table_rs; list->option_name != NULL; list++) {
+ switch (list->option_code) {
+ case OPT_WEIGHT:
+ if (list->check_flag) {
+ // Option specified.
+ req.darg.weight = l7vsadm_option_data.weight;
+ } else {
+ // Option omitted. Set -1.
+ req.darg.weight = -1;
+ }
+ break;
+ default:
+ break;
+ }
+ specified_f += list->check_flag;
+ }
+
+ // All option omitted.
+ if (specified_f == 0) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSADM_OPERATE,20,
+ "All option omitted for edit rs command.");
+ fprintf(stderr, "OPERATE ERROR : "
+ "All option omitted for edit rs command.\n");
+ ret = -1;
+ goto END;
+ }
+
+ // Set data for request
+ iov_data.req_iov[0].iov_base = &req;
+ iov_data.req_iov[0].iov_len = sizeof(req);
+ iov_data.req_iov[1].iov_base = &l7vsadm_option_data.protomod_sarg;
+ iov_data.req_iov[1].iov_len = sizeof(struct l7vs_service_arg_multi);
+ iov_data.req_cnt = 2;
+
+ // Set data for response
+ iov_data.rsp_iov[0].iov_base = &rsp;
+ iov_data.rsp_iov[0].iov_len = sizeof(rsp);
+ iov_data.rsp_cnt = 1;
+
+ ret = communicate_to_l7vsd(&iov_data);
+ if (ret < 0) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSADM_OPERATE,21,
+ "Communicate to l7vsd error.");
+ goto END;
+ }
+
+ if (rsp.code != 0) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSADM_CONFIG_RESULT,6,
+ "%s.", config_strerror(rsp.code));
+ fprintf(stderr, "CONFIG ERROR : "
+ "%s.\n", config_strerror(rsp.code));
+ ret = -1;
+ goto END;
+ }
+ ret = 0;
+
+END:
+ destroy_socket();
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_operate == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_OPERATE,21,
+ "out_function : static int operate_edit_rs"
+ "(void) : "
+ "return = %d",
+ ret);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return ret;
+}
+
+/*!
+ * Operate Delete-RealServer command.
+ * @return int result OK=0, NG=<0
+ */
+static int
+operate_del_rs(void)
+{
+ struct l7vs_config_req_operate_rs req;
+ struct l7vs_config_rsp_operate_rs rsp;
+ struct l7vsadm_iov_data iov_data;
+ int ret;
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_operate == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_OPERATE,22,
+ "in_function : static int operate_del_rs(void) : ");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ ret = create_socket();
+ if (ret < 0) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSADM_OPERATE,22,
+ "Create socket error.");
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_operate == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_OPERATE,23,
+ "out_function : static int operate_del_rs"
+ "(void) : "
+ "return = -1");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return -1;
+ }
+
+ memset(&req, 0, sizeof(struct l7vs_config_req_operate_rs));
+ memset(&rsp, 0, sizeof(struct l7vs_config_rsp_operate_rs));
+ memset(&iov_data, 0, sizeof(struct l7vsadm_iov_data));
+
+ req.cmd = L7VS_CONFIG_DEL_RS;
+
+ l7vsadm_option_data.protomod_sarg.srv_arg.addr = l7vsadm_option_data.vs_addr;
+ l7vsadm_option_data.protomod_sarg.srv_arg.proto = IPPROTO_TCP;
+
+ req.darg.addr = l7vsadm_option_data.rs_addr;
+
+ // Set data for request
+ iov_data.req_iov[0].iov_base = &req;
+ iov_data.req_iov[0].iov_len = sizeof(req);
+ iov_data.req_iov[1].iov_base = &l7vsadm_option_data.protomod_sarg;
+ iov_data.req_iov[1].iov_len = sizeof(struct l7vs_service_arg_multi);
+ iov_data.req_cnt = 2;
+
+ // Set data for response
+ iov_data.rsp_iov[0].iov_base = &rsp;
+ iov_data.rsp_iov[0].iov_len = sizeof(rsp);
+ iov_data.rsp_cnt = 1;
+
+ ret = communicate_to_l7vsd(&iov_data);
+ if (ret < 0) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSADM_OPERATE,23,
+ "Communicate to l7vsd error.");
+ goto END;
+ }
+
+ if (rsp.code != 0) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSADM_CONFIG_RESULT,7,
+ "%s.", config_strerror(rsp.code));
+ fprintf(stderr, "CONFIG ERROR : "
+ "%s.\n", config_strerror(rsp.code));
+ ret = -1;
+ goto END;
+ }
+ ret = 0;
+
+END:
+ destroy_socket();
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_operate == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_OPERATE,24,
+ "out_function : static int operate_del_rs"
+ "(void) : "
+ "return = %d",
+ ret);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return ret;
+}
+
+/*!
+ * Operate Replication command.
+ * @return int result OK=0, NG=<0
+ */
+static int
+operate_replication(void)
+{
+ struct l7vs_config_msg_replication req;
+ struct l7vs_config_msg_replication rsp;
+ struct l7vsadm_iov_data iov_data;
+ int ret;
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_operate == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_OPERATE,25,
+ "in_function : static int operate_replication(void) : ");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ ret = create_socket();
+ if (ret < 0) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSADM_OPERATE,24,
+ "Create socket error.");
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_operate == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_OPERATE,26,
+ "out_function : static int operate_replication"
+ "(void) : "
+ "return = -1");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return -1;
+ }
+
+ memset(&req, 0, sizeof(struct l7vs_config_msg_replication));
+ memset(&rsp, 0, sizeof(struct l7vs_config_msg_replication));
+ memset(&iov_data, 0, sizeof(struct l7vsadm_iov_data));
+
+ req.cmd = L7VS_CONFIG_REPLICATION;
+
+ switch (l7vsadm_option_data.control_code) {
+ case OPT_SWITCH:
+ if (l7vsadm_option_data.replication_start_flag == 1) {
+ req.kind = L7VS_CONFIG_REPLICATION_START;
+ } else {
+ req.kind = L7VS_CONFIG_REPLICATION_STOP;
+ }
+ break;
+ case OPT_FORCE:
+ req.kind = L7VS_CONFIG_REPLICATION_COMPULSORILY;
+ break;
+ case OPT_DUMP:
+ req.kind = L7VS_CONFIG_REPLICATION_DUMP;
+ break;
+ default:
+ break;
+ }
+
+ // Set data for request
+ iov_data.req_iov[0].iov_base = &req;
+ iov_data.req_iov[0].iov_len = sizeof(req);
+ iov_data.req_cnt = 1;
+
+ // Set data for response
+ iov_data.rsp_iov[0].iov_base = &rsp;
+ iov_data.rsp_iov[0].iov_len = sizeof(rsp);
+ iov_data.rsp_cnt = 1;
+
+ ret = communicate_to_l7vsd(&iov_data);
+ if (ret < 0) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSADM_OPERATE,25,
+ "Communicate to l7vsd error.");
+ goto END;
+ }
+
+ if (rsp.code != 0) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSADM_CONFIG_RESULT,8,
+ "%s.", config_strerror(rsp.code));
+ fprintf(stderr, "CONFIG ERROR : "
+ "%s.\n", config_strerror(rsp.code));
+ ret = -1;
+ goto END;
+ }
+ ret = 0;
+
+END:
+ destroy_socket();
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_operate == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_OPERATE,27,
+ "out_function : static int operate_replication"
+ "(void) : "
+ "return = %d",
+ ret);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return ret;
+}
+
+/*!
+ * Operate Logger command.
+ * @return int result OK=0, NG=<0
+ */
+static int
+operate_log(void)
+{
+ struct l7vs_config_msg_log req;
+ struct l7vs_config_msg_log rsp;
+ struct l7vsadm_iov_data iov_data;
+ int ret;
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_operate == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_OPERATE,28,
+ "in_function : static int operate_log(void) : ");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ ret = create_socket();
+ if (ret < 0) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSADM_OPERATE,26,
+ "Create socket error.");
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_operate == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_OPERATE,29,
+ "out_function : static int operate_log"
+ "(void) : "
+ "return = -1");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return -1;
+ }
+
+ memset(&req, 0, sizeof(struct l7vs_config_msg_log));
+ memset(&rsp, 0, sizeof(struct l7vs_config_msg_log));
+ memset(&iov_data, 0, sizeof(struct l7vsadm_iov_data));
+
+ if (l7vsadm_option_data.category_all_flag == 1) {
+ req.cmd = L7VS_CONFIG_SET_LOG_LEVEL_ALL;
+ } else {
+ req.cmd = L7VS_CONFIG_SET_LOG_LEVEL;
+ }
+ req.kind = l7vsadm_option_data.log_category;
+ req.vsd_log_level = l7vsadm_option_data.log_level;
+
+ // Set data for request
+ iov_data.req_iov[0].iov_base = &req;
+ iov_data.req_iov[0].iov_len = sizeof(req);
+ iov_data.req_cnt = 1;
+
+ // Set data for response
+ iov_data.rsp_iov[0].iov_base = &rsp;
+ iov_data.rsp_iov[0].iov_len = sizeof(rsp);
+ iov_data.rsp_cnt = 1;
+
+ ret = communicate_to_l7vsd(&iov_data);
+ if (ret < 0) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSADM_OPERATE,27,
+ "Communicate to l7vsd error.");
+ goto END;
+ }
+
+ if (rsp.code != 0) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSADM_CONFIG_RESULT,9,
+ "%s.", config_strerror(rsp.code));
+ fprintf(stderr, "CONFIG ERROR : "
+ "%s.\n", config_strerror(rsp.code));
+ ret = -1;
+ goto END;
+ }
+ ret = 0;
+
+END:
+ destroy_socket();
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_operate == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_OPERATE,30,
+ "out_function : static int operate_log"
+ "(void) : "
+ "return = %d",
+ ret);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return ret;
+}
+
+/*!
+ * Operate SNMPAgent command.
+ * @return int result OK=0, NG=<0
+ */
+static int
+operate_snmp(void)
+{
+ struct l7vs_config_msg_snmp req;
+ struct l7vs_config_msg_snmp rsp;
+ struct l7vsadm_iov_data iov_data;
+ int ret;
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_operate == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_OPERATE,31,
+ "in_function : static int operate_snmp(void) : ");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ ret = create_socket();
+ if (ret < 0) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSADM_OPERATE,28,
+ "Create socket error.");
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_operate == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_OPERATE,32,
+ "out_function : static int operate_snmp"
+ "(void) : "
+ "return = -1");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return -1;
+ }
+
+ memset(&req, 0, sizeof(struct l7vs_config_msg_snmp));
+ memset(&rsp, 0, sizeof(struct l7vs_config_msg_snmp));
+ memset(&iov_data, 0, sizeof(struct l7vsadm_iov_data));
+
+ if (l7vsadm_option_data.category_all_flag == 1) {
+ req.cmd = L7VS_CONFIG_SET_SNMP_LOG_LEVEL_ALL;
+ } else {
+ req.cmd = L7VS_CONFIG_SET_SNMP_LOG_LEVEL;
+ }
+ req.kind = l7vsadm_option_data.log_category;
+ req.snmp_log_level = l7vsadm_option_data.log_level;
+
+ // Set data for request
+ iov_data.req_iov[0].iov_base = &req;
+ iov_data.req_iov[0].iov_len = sizeof(req);
+ iov_data.req_cnt = 1;
+
+ // Set data for response
+ iov_data.rsp_iov[0].iov_base = &rsp;
+ iov_data.rsp_iov[0].iov_len = sizeof(rsp);
+ iov_data.rsp_cnt = 1;
+
+ ret = communicate_to_l7vsd(&iov_data);
+ if (ret < 0) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSADM_OPERATE,29,
+ "Communicate to l7vsd error.");
+ goto END;
+ }
+
+ if (rsp.code != 0) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSADM_CONFIG_RESULT,10,
+ "%s.", config_strerror(rsp.code));
+ fprintf(stderr, "CONFIG ERROR : "
+ "%s.\n", config_strerror(rsp.code));
+ ret = -1;
+ goto END;
+ }
+ ret = 0;
+
+END:
+ destroy_socket();
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_operate == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_OPERATE,33,
+ "out_function : static int operate_snmp"
+ "(void) : "
+ "return = %d",
+ ret);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return ret;
+}
+
+/*!
+ * Operate Parameter command.
+ * @return int result OK=0, NG=<0
+ */
+static int
+operate_parameter(void)
+{
+ struct l7vs_config_msg_parameter req;
+ struct l7vs_config_msg_parameter rsp;
+ struct l7vsadm_iov_data iov_data;
+ int ret;
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_operate == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_OPERATE,34,
+ "in_function : static int operate_parameter(void) : ");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ ret = create_socket();
+ if (ret < 0) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSADM_OPERATE,30,
+ "Create socket error.");
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_operate == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_OPERATE,35,
+ "out_function : static int operate_parameter"
+ "(void) : "
+ "return = -1");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return -1;
+ }
+
+ memset(&req, 0, sizeof(struct l7vs_config_msg_parameter));
+ memset(&rsp, 0, sizeof(struct l7vs_config_msg_parameter));
+ memset(&iov_data, 0, sizeof(struct l7vsadm_iov_data));
+
+ req.cmd = L7VS_CONFIG_PARAMETER;
+ req.category = l7vsadm_option_data.reload_param;
+
+ // Set data for request
+ iov_data.req_iov[0].iov_base = &req;
+ iov_data.req_iov[0].iov_len = sizeof(req);
+ iov_data.req_cnt = 1;
+
+ // Set data for response
+ iov_data.rsp_iov[0].iov_base = &rsp;
+ iov_data.rsp_iov[0].iov_len = sizeof(rsp);
+ iov_data.rsp_cnt = 1;
+
+ ret = communicate_to_l7vsd(&iov_data);
+ if (ret < 0) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSADM_OPERATE,31,
+ "Communicate to l7vsd error.");
+ goto END;
+ }
+
+ if (rsp.code != 0) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSADM_CONFIG_RESULT,11,
+ "%s.", config_strerror(rsp.code));
+ fprintf(stderr, "CONFIG ERROR : "
+ "%s.\n", config_strerror(rsp.code));
+ ret = -1;
+ goto END;
+ }
+ ret = 0;
+
+END:
+ destroy_socket();
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_operate == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_OPERATE,36,
+ "out_function : static int operate_parameter"
+ "(void) : "
+ "return = %d",
+ ret);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return ret;
+}
+
+/*!
+ * Operate help command.
+ * @return int result OK=0
+ */
+static int
+operate_help(void)
+{
+ /*-------- DEBUG LOG --------*/
+ if (log_level_operate == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_OPERATE,37,
+ "in_function : static int operate_help(void) : ");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ usage(stdout);
+
+ fprintf(stdout,
+ "Commands:\n"
+ " --add-service -A add virtual service with options\n"
+ " --edit-service -E edit virtual service with options\n"
+ " --delete-service -D delete virtual service with options\n"
+ " --flush -C flush virtual service\n"
+ " --add-server -a add real server with options\n"
+ " --edit-server -e edit real server with options\n"
+ " --delete-server -d delete real server with options\n"
+ " --replication -R control replication-function\n"
+ " --log -L control logger-function\n"
+ " --snmp -S control SNMP Agent-function\n"
+ " --parameter -P control parameter-function\n"
+ " --list -l list the table\n"
+ " --verbose -V list the table in verbose format\n"
+ " --key -K list the table in key setting format\n"
+ " --help -h show usage\n"
+ "\n");
+
+ fprintf(stdout,
+ "Options:\n"
+ " --tcp-service -t service-address service-address is host:port\n"
+ " --proto-module -m proto-module protocol module name and module argment\n"
+ " [module-args]\n"
+ " --scheduler -s scheduler one of rr,lc,wrr\n"
+ " --upper -u connection-count maximum number of connections\n"
+ " --bypass -b sorry-server sorry server address is host:port\n"
+ " --flag -f sorry-flag sorry status set to virtual service\n"
+ " --qos-up -Q QoSval-up QoS Threshold(bps) set to real server direction\n"
+ " --qos-down -q QoSval-down QoS Threshold(bps) set to client direction\n"
+ " --real-server -r server-address server-address is host:port\n"
+ " --weight -w weight scheduling weight set to real server\n"
+ " --switch -s replication-switch start or stop replication\n"
+ " --force -f force replication start\n"
+ " --dump -d dump replication memory\n"
+ " --category -c log-category set log category for l7vsd or SNMP Agent\n"
+ " --level -l log-level set log level for l7vsd or SNMP Agent\n"
+ " --reload -r reload-parameter reload specified config parameter\n"
+ " --numeric -n list the table in numeric\n"
+ "\n");
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_operate == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_OPERATE,38,
+ "out_function : static int operate_help"
+ "(void) : "
+ "return = 0");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return 0;
+}
+
+/*!
+ * List Replication information.
+ * @return int list result OK=0, NG=-1
+ */
+static int
+list_replication_info(void)
+{
+ struct l7vs_config_msg_replication req;
+ struct l7vs_config_msg_replication rsp;
+ struct l7vsadm_iov_data iov_data;
+ int ret;
+ char *mode = NULL;
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_operate == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_OPERATE,39,
+ "in_function : static int list_replication_info(void) : ");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ memset(&req, 0, sizeof(struct l7vs_config_msg_replication));
+ memset(&rsp, 0, sizeof(struct l7vs_config_msg_replication));
+ memset(&iov_data, 0, sizeof(struct l7vsadm_iov_data));
+
+ req.cmd = L7VS_CONFIG_GET_REPLICATION_INFO;
+
+ // Set data for request
+ iov_data.req_iov[0].iov_base = &req;
+ iov_data.req_iov[0].iov_len = sizeof(req);
+ iov_data.req_cnt = 1;
+
+ // Set data for response
+ iov_data.rsp_iov[0].iov_base = &rsp;
+ iov_data.rsp_iov[0].iov_len = sizeof(rsp);
+ iov_data.rsp_cnt = 1;
+
+ ret = communicate_to_l7vsd(&iov_data);
+ if (ret < 0) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSADM_OPERATE,32,
+ "Communicate to l7vsd error.");
+ goto END;
+ }
+
+ if (rsp.code != 0) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSADM_CONFIG_RESULT,12,
+ "%s.", config_strerror(rsp.code));
+ fprintf(stderr, "CONFIG ERROR : "
+ "%s.\n", config_strerror(rsp.code));
+ ret = -1;
+ goto END;
+ }
+
+ // Convert Replication mode to string.
+ switch (rsp.replication_mode) {
+ case REPLICATION_OUT:
+ mode = "OUT";
+ break;
+ case REPLICATION_SINGLE:
+ mode = "SINGLE";
+ break;
+ case REPLICATION_MASTER:
+ mode = "MASTER";
+ break;
+ case REPLICATION_SLAVE:
+ mode = "SLAVE";
+ break;
+ case REPLICATION_MASTER_STOP:
+ mode = "MASTER_STOP";
+ break;
+ case REPLICATION_SLAVE_STOP:
+ mode = "SLAVE_STOP";
+ break;
+ default:
+ break;
+ }
+
+ // Print Replication info.
+ printf("Replication Mode:\n");
+ if (mode != NULL) {
+ printf("%s\n", mode);
+ } else {
+ // Mode is NULL.
+ LOGGER_PUT_LOG_WARN(LOG_CAT_L7VSADM_OPERATE,2,
+ "Invalid Replication Mode.");
+ }
+ printf("\n");
+
+ ret = 0;
+
+END:
+ /*-------- DEBUG LOG --------*/
+ if (log_level_operate == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_OPERATE,40,
+ "out_function : static int list_replication_info"
+ "(void) : "
+ "return = %d",
+ ret);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return ret;
+}
+
+/*!
+ * List Logger information.
+ * @return int list result OK=0, NG=-1
+ */
+static int
+list_log_info(void)
+{
+ struct l7vs_config_msg_log req;
+ struct l7vs_config_msg_log rsp;
+ struct l7vsadm_iov_data iov_data;
+ int ret;
+ struct l7vsadm_category_name_list *cat_list;
+ struct l7vsadm_level_name_list *lv_list;
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_operate == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_OPERATE,41,
+ "in_function : static int list_log_info(void) : ");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ // Print Logger info header.
+ printf("L7vsd Log Level:\n");
+ printf("Category Level\n");
+
+ // Get and List all category log level.
+ for (cat_list = l7vsd_category_name_table;
+ cat_list->category_name != NULL;
+ cat_list++) {
+ memset(&req, 0, sizeof(struct l7vs_config_msg_log));
+ memset(&rsp, 0, sizeof(struct l7vs_config_msg_log));
+ memset(&iov_data, 0, sizeof(struct l7vsadm_iov_data));
+
+ req.cmd = L7VS_CONFIG_GET_LOG_INFO;
+ req.kind = cat_list->category_code;
+
+ // Set data for request
+ iov_data.req_iov[0].iov_base = &req;
+ iov_data.req_iov[0].iov_len = sizeof(req);
+ iov_data.req_cnt = 1;
+
+ // Set data for response
+ iov_data.rsp_iov[0].iov_base = &rsp;
+ iov_data.rsp_iov[0].iov_len = sizeof(rsp);
+ iov_data.rsp_cnt = 1;
+
+ ret = communicate_to_l7vsd(&iov_data);
+ if (ret < 0) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSADM_OPERATE,33,
+ "Communicate to l7vsd error.");
+ goto END;
+ }
+
+ if (rsp.code != 0) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSADM_CONFIG_RESULT,13,
+ "%s.", config_strerror(rsp.code));
+ fprintf(stderr, "CONFIG ERROR : "
+ "%s.\n", config_strerror(rsp.code));
+ ret = -1;
+ goto END;
+ }
+
+ // Convert log level to string.
+ for (lv_list = level_name_table;
+ lv_list->level_name != NULL;
+ lv_list++) {
+ if (rsp.vsd_log_level == lv_list->level_code) {
+ printf("%-30s %s\n",
+ cat_list->category_name,
+ lv_list->level_name);
+ break;
+ }
+ }
+ }
+ printf("\n");
+
+ ret = 0;
+
+END:
+ /*-------- DEBUG LOG --------*/
+ if (log_level_operate == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_OPERATE,42,
+ "out_function : static int list_log_info"
+ "(void) : "
+ "return = %d",
+ ret);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return ret;
+}
+
+/*!
+ * List SNMPAgent information.
+ * @return int list result OK=0, NG=-1
+ */
+static int
+list_snmp_info(void)
+{
+ struct l7vs_config_msg_snmp req;
+ struct l7vs_config_msg_snmp rsp;
+ struct l7vsadm_iov_data iov_data;
+ int ret;
+ struct l7vsadm_category_name_list *cat_list;
+ struct l7vsadm_level_name_list *lv_list;
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_operate == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_OPERATE,43,
+ "in_function : static int list_snmp_info(void) : ");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ memset(&req, 0, sizeof(struct l7vs_config_msg_snmp));
+ memset(&rsp, 0, sizeof(struct l7vs_config_msg_snmp));
+ memset(&iov_data, 0, sizeof(struct l7vsadm_iov_data));
+
+ req.cmd = L7VS_CONFIG_GET_SNMP_CONNECT_STATUS;
+
+ // Set data for request
+ iov_data.req_iov[0].iov_base = &req;
+ iov_data.req_iov[0].iov_len = sizeof(req);
+ iov_data.req_cnt = 1;
+
+ // Set data for response
+ iov_data.rsp_iov[0].iov_base = &rsp;
+ iov_data.rsp_iov[0].iov_len = sizeof(rsp);
+ iov_data.rsp_cnt = 1;
+
+ ret = communicate_to_l7vsd(&iov_data);
+ if (ret < 0) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSADM_OPERATE,34,
+ "Communicate to l7vsd error.");
+ goto END;
+ }
+
+ if (rsp.code != 0) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSADM_CONFIG_RESULT,14,
+ "%s.", config_strerror(rsp.code));
+ fprintf(stderr, "CONFIG ERROR : "
+ "%s.\n", config_strerror(rsp.code));
+ ret = -1;
+ goto END;
+ }
+
+ // Print SNMP connection status header.
+ printf("SNMPAgent Connection Status:\n");
+ // Print SNMP connection status.
+ if (rsp.connection_status == 1) {
+ printf("connecting\n");
+ } else {
+ printf("non-connecting\n");
+ }
+ printf("\n");
+
+ // Print SNMPAgent Log header.
+ printf("SNMPAgent Log Level:\n");
+ printf("Category Level\n");
+
+ // Get and List all category SNMPAgent log level.
+ for (cat_list = snmp_category_name_table;
+ cat_list->category_name != NULL;
+ cat_list++) {
+ memset(&req, 0, sizeof(struct l7vs_config_msg_snmp));
+ memset(&rsp, 0, sizeof(struct l7vs_config_msg_snmp));
+ memset(&iov_data, 0, sizeof(struct l7vsadm_iov_data));
+
+ req.cmd = L7VS_CONFIG_GET_SNMP_LOG_INFO;
+ req.kind = cat_list->category_code;
+
+ // Set data for request
+ iov_data.req_iov[0].iov_base = &req;
+ iov_data.req_iov[0].iov_len = sizeof(req);
+ iov_data.req_cnt = 1;
+
+ // Set data for response
+ iov_data.rsp_iov[0].iov_base = &rsp;
+ iov_data.rsp_iov[0].iov_len = sizeof(rsp);
+ iov_data.rsp_cnt = 1;
+
+ ret = communicate_to_l7vsd(&iov_data);
+ if (ret < 0) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSADM_OPERATE,35,
+ "Communicate to l7vsd error.");
+ goto END;
+ }
+
+ if (rsp.code != 0) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSADM_CONFIG_RESULT,15,
+ "%s.", config_strerror(rsp.code));
+ fprintf(stderr, "CONFIG ERROR : "
+ "%s.\n", config_strerror(rsp.code));
+ ret = -1;
+ goto END;
+ }
+
+ // Convert log level to string.
+ for (lv_list = level_name_table;
+ lv_list->level_name != NULL;
+ lv_list++) {
+ if (rsp.snmp_log_level == lv_list->level_code) {
+ printf("%-30s %s\n",
+ cat_list->category_name,
+ lv_list->level_name);
+ break;
+ }
+ }
+ }
+ printf("\n");
+
+ ret = 0;
+
+END:
+ /*-------- DEBUG LOG --------*/
+ if (log_level_operate == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_OPERATE,44,
+ "out_function : static int list_snmp_info"
+ "(void) : "
+ "return = %d",
+ ret);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return ret;
+}
+
+/*!
+ * Get list of VirtualService information.
+ * @param[in,out] *vs_buffer VirtualService list buffer pointer
+ * @param[in] vs_bufsize size of vs_buffer
+ * @return int number of VirtualService, NG<0
+ */
+static int
+get_vs(void *vs_buffer, int vs_bufsize)
+{
+ struct l7vs_config_req_list_vs req;
+ struct l7vs_config_rsp_list_vs rsp;
+ struct l7vsadm_iov_data iov_data;
+ int ret;
+
+ // Argment check.
+ if (vs_buffer == NULL) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSADM_OPERATE,36,
+ "Argument vs_buffer is NULL.");
+ fprintf(stderr, "OPERATE ERROR : "
+ "Argument vs_buffer is NULL.\n");
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_operate == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_OPERATE,45,
+ "out_function : static int get_vs"
+ "(void *vs_buffer, int vs_bufsize) : "
+ "return = -1");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return -1;
+ }
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_operate == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_OPERATE,46,
+ "in_function : static int get_vs"
+ "(void *vs_buffer, int vs_bufsize) : "
+ "vs_buffer = %p, vs_bufsize = %d",
+ vs_buffer,
+ vs_bufsize);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ memset(&req, 0, sizeof(struct l7vs_config_req_list_vs));
+ memset(&rsp, 0, sizeof(struct l7vs_config_rsp_list_vs));
+ memset(&iov_data, 0, sizeof(struct l7vsadm_iov_data));
+
+ req.cmd = L7VS_CONFIG_LIST_VS;
+
+ // Set data for request
+ iov_data.req_iov[0].iov_base = &req;
+ iov_data.req_iov[0].iov_len = sizeof(req);
+ iov_data.req_cnt = 1;
+
+ // Set data for response
+ iov_data.rsp_iov[0].iov_base = &rsp;
+ iov_data.rsp_iov[0].iov_len = sizeof(rsp);
+ iov_data.rsp_iov[1].iov_base = vs_buffer;
+ iov_data.rsp_iov[1].iov_len = vs_bufsize;
+ iov_data.rsp_cnt = 2;
+
+ ret = communicate_to_l7vsd(&iov_data);
+ if (ret < 0) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSADM_OPERATE,37,
+ "Communicate to l7vsd error.");
+ goto END;
+ }
+
+ if (rsp.code != 0) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSADM_CONFIG_RESULT,16,
+ "%s.", config_strerror(rsp.code));
+ fprintf(stderr, "CONFIG ERROR : "
+ "%s.\n", config_strerror(rsp.code));
+ ret = -1;
+ goto END;
+ }
+ ret = rsp.num;
+
+END:
+ /*-------- DEBUG LOG --------*/
+ if (log_level_operate == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_OPERATE,47,
+ "out_function : static int get_vs"
+ "(void *vs_buffer, int vs_bufsize) : "
+ "return = %d",
+ ret);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return ret;
+}
+
+/*!
+ * Get list of RealServer information in the VirtualService.
+ * @param[in,out] *darg_buffer l7vs_dest_arg list pointer
+ * @param[in] rs_num number of l7vs_dest_arg
+ * @param[in] *sarg l7vs_service_arg pointer
+ * @return int number of RealServer, NG<0
+ */
+static int
+get_rs(struct l7vs_dest_arg *darg_buffer, int rs_num, struct l7vs_service_arg *sarg)
+{
+ struct l7vs_config_req_list_rs req;
+ struct l7vs_config_rsp_list_rs rsp;
+ struct l7vsadm_iov_data iov_data;
+ int ret;
+
+ // Argment check.
+ if (darg_buffer == NULL) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSADM_OPERATE,38,
+ "Argument darg_buffer is NULL.");
+ fprintf(stderr, "OPERATE ERROR : "
+ "Argument darg_buffer is NULL.\n");
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_operate == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_OPERATE,48,
+ "out_function : static int get_rs"
+ "(struct l7vs_dest_arg *darg_buffer, "
+ "int rs_num, struct l7vs_service_arg *sarg) : "
+ "return = -1");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return -1;
+ }
+ if (sarg == NULL) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSADM_OPERATE,39,
+ "Argument sarg is NULL.");
+ fprintf(stderr, "OPERATE ERROR : "
+ "Argument sarg is NULL.\n");
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_operate == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_OPERATE,49,
+ "out_function : static int get_rs"
+ "(struct l7vs_dest_arg *darg_buffer, "
+ "int rs_num, struct l7vs_service_arg *sarg) : "
+ "return = -1");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return -1;
+ }
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_operate == LOG_LV_DEBUG) {
+ char sarg_str[DEBUG_STR_LEN] = {0};
+ l7vs_service_arg_c_str(sarg_str, sarg);
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_OPERATE,50,
+ "in_function : static int get_rs"
+ "(struct l7vs_dest_arg *darg_buffer, "
+ "int rs_num, "
+ "struct l7vs_service_arg *sarg) : "
+ "darg_buffer = %p, "
+ "rs_num = %d, "
+ "sarg = (%s)",
+ darg_buffer,
+ rs_num,
+ sarg_str);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ memset(&req, 0, sizeof(struct l7vs_config_req_list_rs));
+ memset(&rsp, 0, sizeof(struct l7vs_config_rsp_list_rs));
+ memset(&iov_data, 0, sizeof(struct l7vsadm_iov_data));
+
+ req.cmd = L7VS_CONFIG_LIST_RS;
+
+ // Set data for request
+ iov_data.req_iov[0].iov_base = &req;
+ iov_data.req_iov[0].iov_len = sizeof(req);
+ iov_data.req_iov[1].iov_base = sarg;
+ iov_data.req_iov[1].iov_len = sizeof(struct l7vs_service_arg_multi);
+ iov_data.req_cnt = 2;
+
+ // Set data for response
+ iov_data.rsp_iov[0].iov_base = &rsp;
+ iov_data.rsp_iov[0].iov_len = sizeof(rsp);
+ iov_data.rsp_iov[1].iov_base = darg_buffer;
+ iov_data.rsp_iov[1].iov_len = rs_num * sizeof(struct l7vs_dest_arg);
+ iov_data.rsp_cnt = 2;
+
+ ret = communicate_to_l7vsd(&iov_data);
+ if (ret < 0) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSADM_OPERATE,40,
+ "Communicate to l7vsd error.");
+ goto END;
+ }
+
+ if (rsp.code != 0) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSADM_CONFIG_RESULT,17,
+ "%s.", config_strerror(rsp.code));
+ fprintf(stderr, "CONFIG ERROR : "
+ "%s.\n", config_strerror(rsp.code));
+ ret = -1;
+ goto END;
+ }
+ ret = rsp.num;
+
+END:
+ /*-------- DEBUG LOG --------*/
+ if (log_level_operate == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_OPERATE,51,
+ "out_function : static int get_rs"
+ "(struct l7vs_dest_arg *darg_buffer, "
+ "int rs_num, struct l7vs_service_arg *sarg) : "
+ "return = %d",
+ ret);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return ret;
+}
+
+/*!
+ * List one of VirtualService information.
+ * @param[in] *sarg l7vs_service_arg pointer
+ * @return int list result OK=0, NG=-1
+ */
+static int
+list_vs(struct l7vs_service_arg *sarg)
+{
+ struct sockaddr_in vs_addr_0;
+ struct sockaddr_in sorry_addr_in_0;
+ struct l7vs_dest_arg *darg_buffer;
+ char *endpoint_name;
+ int rs_num = L7VSADM_DEFAULT_LIST_RS_RSNUM;
+ int ret_num;
+ int ret;
+ int i;
+
+ // Argment check.
+ if (sarg == NULL) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSADM_OPERATE,41,
+ "Argument sarg is NULL.");
+ fprintf(stderr, "OPERATE ERROR : "
+ "Argument sarg is NULL.\n");
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_operate == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_OPERATE,52,
+ "out_function : static int list_vs"
+ "(struct l7vs_service_arg *sarg) : "
+ "return = -1");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return -1;
+ }
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_operate == LOG_LV_DEBUG) {
+ char sarg_str[DEBUG_STR_LEN] = {0};
+ l7vs_service_arg_c_str(sarg_str, sarg);
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_OPERATE,53,
+ "in_function : static int list_vs"
+ "(struct l7vs_service_arg *sarg) : "
+ "sarg = (%s)",
+ sarg_str);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ // Check VirtualService address.(Compare vs_addr_0)
+ memset(&vs_addr_0, 0, sizeof(struct sockaddr_in));
+ if (memcmp(&sarg->addr, &vs_addr_0, sizeof(struct sockaddr_in)) == 0) {
+ // sarg->addr not set.
+ endpoint_name = NULL;
+ } else {
+ endpoint_name =
+ get_endpoint_name((struct sockaddr_storage *)(&sarg->addr));
+ }
+ if (endpoint_name == NULL) {
+ LOGGER_PUT_LOG_WARN(LOG_CAT_L7VSADM_OPERATE,3,
+ "Invalid VirtualService address for list_vs.");
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_operate == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_OPERATE,54,
+ "out_function : static int list_vs"
+ "(struct l7vs_service_arg *sarg) : "
+ "return = 0");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return 0;
+ }
+
+ // If it ie verbose, display more details else simple details.
+ if (l7vsadm_option_data.command_code == CMD_LIST_VERBOSE) {
+ printf("TCP %s %s %s %d %s\n",
+ endpoint_name,
+ sarg->protomod,
+ sarg->schedmod,
+ sarg->reschedule,
+ sarg->protomod_opt_string);
+ } else if (l7vsadm_option_data.command_code == CMD_LIST_KEY) {
+ printf("TCP %s %s %s %d %s\n",
+ endpoint_name,
+ sarg->protomod,
+ sarg->schedmod,
+ sarg->reschedule,
+ sarg->protomod_key_string);
+ } else {
+ printf("TCP %s %s %s\n",
+ endpoint_name,
+ sarg->protomod,
+ sarg->schedmod);
+ }
+
+ // Print sorry and QoS information when L7VSADM_OP_VERBOSE.
+ if (l7vsadm_option_data.command_code == CMD_LIST_VERBOSE) {
+ // Check sorry address.(Compare sorry_addr_0)
+ memset(&sorry_addr_in_0, 0, sizeof(struct sockaddr_in));
+ if (memcmp(&sarg->sorry_addr,
+ &sorry_addr_in_0,
+ sizeof(struct sockaddr_in)) == 0) {
+ // sarg->sorry_addr not set.
+ endpoint_name = NULL;
+ } else {
+ endpoint_name =
+ get_endpoint_name((struct sockaddr_storage *)(&sarg->sorry_addr));
+ }
+ // If endpoint_name is NULL then string is "none".
+ if (endpoint_name == NULL) {
+ endpoint_name = "none";
+ }
+ printf(" %s %d %d\n",
+ endpoint_name,
+ sarg->sorry_cc,
+ sarg->sorry_flag);
+ // QoS value and throughput convert from byte/s to bps.
+ printf(" %lld %lld\n",
+ sarg->qos_threshold_up * 8,
+ sarg->throughput_to_server * 8);
+ printf(" %lld %lld\n",
+ sarg->qos_threshold_down * 8,
+ sarg->throughput_to_client * 8);
+ }
+
+RETRY:
+ // Alloc RealServer list memory.
+ darg_buffer = (struct l7vs_dest_arg *)malloc(rs_num * sizeof(struct l7vs_dest_arg));
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_common == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_COMMON,4,
+ "malloc darg_buffer : "
+ "allocate address = %p "
+ "allocate size = %d",
+ darg_buffer,
+ int(rs_num * sizeof(struct l7vs_dest_arg)));
+ }
+ /*------ DEBUG LOG END ------*/
+
+ if (darg_buffer == NULL) {
+ LOGGER_PUT_LOG_FATAL(LOG_CAT_L7VSADM_COMMON,5,
+ "Could not allocate darg_buffer memory.");
+ fprintf(stderr, "COMMON ERROR : "
+ "Could not allocate darg_buffer memory.\n");
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_operate == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_OPERATE,55,
+ "out_function : static int list_vs"
+ "(struct l7vs_service_arg *sarg) : "
+ "return = -1");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return -1;
+ }
+ // Get all RealServer list on VirtualService.
+ ret_num = get_rs(darg_buffer, rs_num, sarg);
+ // If return L7VSADM_RECV_TOO_LARGE (-2) when extend darg_buffer size and retry.
+ if (ret_num < 0) {
+ free(darg_buffer);
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_common == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_COMMON,5,
+ "free darg_buffer : "
+ "free address = %p",
+ darg_buffer);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ if (ret_num == L7VSADM_RECV_TOO_LARGE) {
+ rs_num += L7VSADM_DEFAULT_LIST_RS_RSNUM;
+ LOGGER_PUT_LOG_WARN(LOG_CAT_L7VSADM_OPERATE,4,
+ "Receive RealServer data too large. retrying.");
+ goto RETRY;
+ }
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSADM_OPERATE,42,
+ "Get RealServer data error.");
+ fprintf(stderr, "OPERATE ERROR : "
+ "Get RealServer data error.\n");
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_operate == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_OPERATE,56,
+ "out_function : static int list_vs"
+ "(struct l7vs_service_arg *sarg) : "
+ "return = -1");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return -1;
+ }
+ // List all RealServer.
+ for (i = 0; i < ret_num; i++) {
+ ret = list_rs(&darg_buffer[i]);
+ if (ret < 0) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSADM_OPERATE,43,
+ "List RealServer data error.");
+ fprintf(stderr, "OPERATE ERROR : "
+ "List RealServer data error.\n");
+ free(darg_buffer);
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_common == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_COMMON,6,
+ "free darg_buffer : "
+ "free address = %p",
+ darg_buffer);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_operate == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_OPERATE,57,
+ "out_function : static int list_vs"
+ "(struct l7vs_service_arg *sarg) : "
+ "return = -1");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return -1;
+ }
+ }
+
+ free(darg_buffer);
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_common == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_COMMON,7,
+ "free darg_buffer : "
+ "free address = %p",
+ darg_buffer);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_operate == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_OPERATE,58,
+ "out_function : static int list_vs"
+ "(struct l7vs_service_arg *sarg) : "
+ "return = 0");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return 0;
+}
+
+/*!
+ * List one of RealServer information.
+ * @param[in] *darg l7vs_dest_arg pointer
+ * @return int list result OK=0, NG=-1
+ */
+static int
+list_rs(struct l7vs_dest_arg *darg)
+{
+ struct sockaddr_in rs_addr_0;
+ char *endpoint_name;
+
+ // Argment check.
+ if (darg == NULL) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSADM_OPERATE,44,
+ "Argument darg is NULL.");
+ fprintf(stderr, "OPERATE ERROR : "
+ "Argument darg is NULL.\n");
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_operate == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_OPERATE,59,
+ "out_function : static int list_rs"
+ "(struct l7vs_dest_arg *darg) : "
+ "return = -1");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return -1;
+ }
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_operate == LOG_LV_DEBUG) {
+ char darg_str[DEBUG_STR_LEN] = {0};
+ l7vs_darg_c_str(darg_str, darg);
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_OPERATE,60,
+ "in_function : static int list_rs"
+ "(struct l7vs_dest_arg *darg) : "
+ "darg = (%s)",
+ darg_str);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ // Check RealServer address.(Compare rs_addr_0)
+ memset(&rs_addr_0, 0, sizeof(struct sockaddr_in));
+ if (memcmp(&darg->addr, &rs_addr_0, sizeof(struct sockaddr_in)) == 0) {
+ // darg.addr not set.
+ endpoint_name = NULL;
+ } else {
+ endpoint_name =
+ get_endpoint_name((struct sockaddr_storage *)(&darg->addr));
+ }
+ if (endpoint_name == NULL) {
+ LOGGER_PUT_LOG_WARN(LOG_CAT_L7VSADM_OPERATE,5,
+ "Invalid RealServer address for list_rs.");
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_operate == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_OPERATE,61,
+ "out_function : static int list_rs"
+ "(struct l7vs_dest_arg *darg) : "
+ "return = 0");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return 0;
+ }
+
+ // Display RealServer.
+ printf(" -> %-28s %-7s %-6d %-10d %-10d\n",
+ endpoint_name, "Masq", darg->weight, darg->nactive, darg->ninact);
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_operate == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_OPERATE,62,
+ "out_function : static int list_rs"
+ "(struct l7vs_dest_arg *darg) : "
+ "return = 0");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return 0;
+}
+
+/*!
+ * Get endpoint name string.
+ * Translate form address to endpoint string(hostname:portname)
+ * @param[in] *addr endpoint data
+ * @return char * endpoint string, NG=NULL
+ */
+static char *
+get_endpoint_name(struct sockaddr_storage *addr)
+{
+ char hostname[NI_MAXHOST], portname[NI_MAXSERV];
+ int flags;
+ int ret;
+
+ // Argment check.
+ if (addr == NULL) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSADM_OPERATE,45,
+ "Argument addr is NULL.");
+ fprintf(stderr, "OPERATE ERROR : "
+ "Argument addr is NULL.\n");
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_operate == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_OPERATE,63,
+ "out_function : static char *get_endpoint_name"
+ "(struct sockaddr_storage *addr) : "
+ "return = NULL");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return NULL;
+ }
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_operate == LOG_LV_DEBUG) {
+ char ep_str[DEBUG_STR_LEN] = {0};
+ endpoint_c_str(ep_str, (void *)addr);
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_OPERATE,64,
+ "in_function : static char *get_endpoint_name"
+ "(struct sockaddr_storage *addr) : "
+ "addr = (%s)",
+ ep_str);
+ }
+ /*------ DEBUG LOG END ------*/
+
+
+ if (l7vsadm_option_data.isnumeric != 0 &&
+ l7vsadm_option_data.isnumeric != 1) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSADM_OPERATE,46,
+ "Invalid isnumeric value.");
+ fprintf(stderr, "OPERATE ERROR : "
+ "Invalid isnumeric value.\n");
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_operate == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_OPERATE,65,
+ "out_function : static char *get_endpoint_name"
+ "(struct sockaddr_storage *addr) : "
+ "return = NULL");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return NULL;
+ }
+
+ flags = 0;
+ if (l7vsadm_option_data.isnumeric) {
+ flags = NI_NUMERICHOST | NI_NUMERICSERV;
+ }
+
+ ret = getnameinfo((struct sockaddr *)addr, sizeof(*addr),
+ hostname, sizeof(hostname),
+ portname, sizeof(portname), flags);
+ if (ret == EAI_AGAIN) {
+ flags = flags | NI_NUMERICHOST;
+ ret = getnameinfo((struct sockaddr *)addr, sizeof(*addr),
+ hostname, sizeof(hostname),
+ portname, sizeof(portname), flags);
+ if (ret != 0) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSADM_COMMON,2,
+ "getnameinfo() error: %s.", gai_strerror(ret));
+ fprintf(stderr, "COMMON ERROR : "
+ "getnameinfo() error: %s.\n", gai_strerror(ret));
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_operate == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_OPERATE,66,
+ "out_function : static char *get_endpoint_name"
+ "(struct sockaddr_storage *addr) : "
+ "return = NULL");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return NULL;
+ }
+ } else if (ret != 0) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSADM_COMMON,3,
+ "getnameinfo() error: %s.", gai_strerror(ret));
+ fprintf(stderr, "COMMON ERROR : "
+ "getnameinfo() error: %s.\n", gai_strerror(ret));
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_operate == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_OPERATE,67,
+ "out_function : static char *get_endpoint_name"
+ "(struct sockaddr_storage *addr) : "
+ "return = NULL");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return NULL;
+ }
+ memset(tmp_endpoint_name,0x00,sizeof(tmp_endpoint_name));
+ sprintf(tmp_endpoint_name, "%s:%s", hostname, portname);
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_operate == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_OPERATE,68,
+ "out_function : static char *get_endpoint_name"
+ "(struct sockaddr_storage *addr) : "
+ "return = %s",
+ tmp_endpoint_name);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return tmp_endpoint_name;
+}
+
+/*!
+ * Create socket file for communicate.
+ * @return int create result OK=0, NG=-1
+ */
+static int
+create_socket(void)
+{
+ struct sockaddr_un addr;
+ char sockname[sizeof(L7VS_CONFIG_SOCK_PATH) + sizeof(L7VSADM_NAME) + 10];
+ int opt;
+ int ret;
+ int sock_fd;
+ int retry_count = 0;
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_operate == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_OPERATE,69,
+ "in_function : static int create_socket(void) : ");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ sprintf(sockname, "%s/%s-%d", L7VS_CONFIG_SOCK_PATH, L7VSADM_NAME, getpid());
+
+ unlink(sockname);
+ if (sizeof(sockname) > sizeof(addr.sun_path)) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSADM_OPERATE,47,
+ "Internal error. socket name too long.");
+ fprintf(stderr, "OPERATE ERROR : "
+ "Internal error. socket name too long.\n");
+ ret = -1;
+ goto END;
+ }
+
+ memset(&addr, 0, sizeof(addr));
+ memcpy(addr.sun_path, sockname, sizeof(sockname));
+ addr.sun_family = AF_LOCAL;
+
+ sock_fd = socket(PF_LOCAL, SOCK_DGRAM, 0);
+ if (sock_fd < 0) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSADM_COMMON,4,
+ "socket() error: %s.", strerror(errno));
+ fprintf(stderr, "COMMON ERROR : "
+ "socket() error: %s.\n", strerror(errno));
+ ret = sock_fd;
+ goto END;
+ }
+
+ opt = 1;
+ ret = setsockopt(sock_fd, SOL_SOCKET, SO_PASSCRED, &opt, sizeof(opt));
+ if (ret < 0) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSADM_COMMON,5,
+ "setsockopt() SO_PASSCRED error: %s.", strerror(errno));
+ fprintf(stderr, "COMMON ERROR : "
+ "setsockopt() SO_PASSCRED error: %s.\n", strerror(errno));
+ goto END;
+ }
+
+ ret = bind(sock_fd, (struct sockaddr *)&addr, SUN_LEN(&addr));
+ if (ret < 0) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSADM_COMMON,6,
+ "bind() on %s error: %s.", sockname, strerror(errno));
+ fprintf(stderr, "COMMON ERROR : "
+ "bind() on %s error: %s.\n", sockname, strerror(errno));
+ goto END;
+ }
+
+ strcpy(local_sockname, sockname);
+
+ memset(&addr, 0, sizeof(addr));
+ addr.sun_family = AF_LOCAL;
+ strcpy(addr.sun_path, L7VS_CONFIG_SOCKNAME);
+
+ while (1) {
+ // Check signal.
+ if (signal_flg > 0) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSADM_COMMON,7,
+ "Signal (%d) Received.", received_sig);
+ fprintf(stderr, "COMMON ERROR : "
+ "Signal (%d) Received.\n", received_sig);
+ ret = -1;
+ goto END;
+ }
+
+ // Try connect to config socket.
+ ret = connect(sock_fd, (struct sockaddr *)&addr, SUN_LEN(&addr));
+ if (ret == 0) {
+ // Connect OK.
+ break;
+ }
+ retry_count++;
+ if (retry_count > connect_wait_count) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSADM_COMMON,8,
+ "connect() to daemon timeout: %s.", strerror(errno));
+ fprintf(stderr, "COMMON ERROR : "
+ "connect() to daemon timeout: %s.\n", strerror(errno));
+ goto END;
+ }
+ // Connect retrying.
+ LOGGER_PUT_LOG_WARN(LOG_CAT_L7VSADM_COMMON,1,
+ "connect() to daemon error (retry %d): %s.",
+ retry_count, strerror(errno));
+ sleep(connect_wait_interval);
+ }
+
+ // Save socket file discripter.
+ local_sock_fd = sock_fd;
+ ret = 0;
+
+END:
+ if (ret < 0) {
+ if (sock_fd != -1) {
+ close(sock_fd);
+ }
+ }
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_operate == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_OPERATE,70,
+ "out_function : static int create_socket"
+ "(void) : "
+ "return = %d",
+ ret);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return ret;
+}
+
+/*!
+ * Destroy socket file for communicate.
+ */
+static void
+destroy_socket(void)
+{
+ /*-------- DEBUG LOG --------*/
+ if (log_level_operate == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_OPERATE,71,
+ "in_function : static void destroy_socket(void) : ");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ unlink(local_sockname);
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_operate == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_OPERATE,72,
+ "out_function : static void destroy_socket(void) : ");
+ }
+ /*------ DEBUG LOG END ------*/
+}
+
+/*!
+ * Communicate to l7vsd daemon.
+ * Send request and receive response between l7vsd daemon
+ * @param[in,out] *iov_data io-vector data pointer
+ * @return int communicate result OK=byte, NG=-1
+ */
+static int
+communicate_to_l7vsd(struct l7vsadm_iov_data *iov_data)
+{
+ int ret;
+
+ // Argment check.
+ if (iov_data == NULL) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSADM_COMMUNICATE,1,
+ "Argument iov_data is NULL.");
+ fprintf(stderr, "COMMUNICATE ERROR : "
+ "Argument iov_data is NULL.\n");
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_communicate == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_COMMUNICATE,1,
+ "out_function : static int communicate_to_l7vsd"
+ "(struct l7vsadm_iov_data *iov_data) : "
+ "return = -1");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return -1;
+ }
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_communicate == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_COMMUNICATE,2,
+ "in_function : static int communicate_to_l7vsd"
+ "(struct l7vsadm_iov_data *iov_data) : "
+ "iov_data = %p",
+ iov_data);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ // Check signal.
+ if (signal_flg > 0) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSADM_COMMON,9,
+ "Signal (%d) Received.", received_sig);
+ fprintf(stderr, "COMMON ERROR : "
+ "Signal (%d) Received.\n", received_sig);
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_communicate == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_COMMUNICATE,3,
+ "out_function : static int communicate_to_l7vsd"
+ "(struct l7vsadm_iov_data *iov_data) : "
+ "return = -1");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return -1;
+ }
+
+ ret = send_request(iov_data->req_iov, iov_data->req_cnt);
+ if (ret < 0) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSADM_COMMUNICATE,2,
+ "Send Request error.");
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_communicate == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_COMMUNICATE,4,
+ "out_function : static int communicate_to_l7vsd"
+ "(struct l7vsadm_iov_data *iov_data) : "
+ "return = %d",
+ ret);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return ret;
+ }
+
+ LOGGER_PUT_LOG_INFO(LOG_CAT_L7VSADM_COMMUNICATE,1,
+ "Send Request success.");
+
+ // Check signal.
+ if (signal_flg > 0) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSADM_COMMON,10,
+ "Signal (%d) Received.", received_sig);
+ fprintf(stderr, "COMMON ERROR : "
+ "Signal (%d) Received.\n", received_sig);
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_communicate == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_COMMUNICATE,5,
+ "out_function : static int communicate_to_l7vsd"
+ "(struct l7vsadm_iov_data *iov_data) : "
+ "return = -1");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return -1;
+ }
+
+ ret = recv_response(iov_data->rsp_iov, iov_data->rsp_cnt);
+ if (ret < 0) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSADM_COMMUNICATE,3,
+ "Receive Response error.");
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_communicate == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_COMMUNICATE,6,
+ "out_function : static int communicate_to_l7vsd"
+ "(struct l7vsadm_iov_data *iov_data) : "
+ "return = %d",
+ ret);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return ret;
+ }
+
+ LOGGER_PUT_LOG_INFO(LOG_CAT_L7VSADM_COMMUNICATE,2,
+ "Receive Response success.");
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_communicate == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_COMMUNICATE,7,
+ "out_function : static int communicate_to_l7vsd"
+ "(struct l7vsadm_iov_data *iov_data) : "
+ "return = %d",
+ ret);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return ret;
+}
+
+/*!
+ * Send config request message.
+ * @param[in] *req_iov request io-vector pointer
+ * @param[in] req_cnt request io-vector count
+ * @return int send result OK=byte, NG<0
+ */
+static int
+send_request(struct iovec *req_iov, int req_cnt)
+{
+ int ret;
+
+ // Argment check.
+ if (req_iov == NULL) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSADM_COMMUNICATE,4,
+ "Argument req_iov is NULL.");
+ fprintf(stderr, "COMMUNICATE ERROR : "
+ "Argument req_iov is NULL.\n");
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_communicate == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_COMMUNICATE,8,
+ "out_function : static int send_request"
+ "(struct iovec *req_iov, int req_cnt) : "
+ "return = -1");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return -1;
+ }
+ if (req_cnt < 1) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSADM_COMMUNICATE,5,
+ "Invalid req_cnt argument.");
+ fprintf(stderr, "COMMUNICATE ERROR : "
+ "Invalid req_cnt argument.\n");
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_communicate == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_COMMUNICATE,9,
+ "out_function : static int send_request"
+ "(struct iovec *req_iov, int req_cnt) : "
+ "return = -1");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return -1;
+ }
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_communicate == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_COMMUNICATE,10,
+ "in_function : static int send_request"
+ "(struct iovec *req_iov, int req_cnt) : "
+ "req_iov = %p "
+ "req_cnt = %d",
+ req_iov,
+ req_cnt);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ if (req_cnt == 1) {
+ if (req_iov->iov_base == NULL) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSADM_COMMUNICATE,6,
+ "iov_base is NULL.");
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_communicate == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_COMMUNICATE,11,
+ "out_function : static int send_request"
+ "(struct iovec *req_iov, int req_cnt) : "
+ "return = -1");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return -1;
+ }
+ ret = send(local_sock_fd,
+ req_iov->iov_base,
+ req_iov->iov_len,
+ 0);
+ if (ret < 0) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSADM_COMMUNICATE,7,
+ "send() to daemon error: %s.", strerror(errno));
+ fprintf(stderr, "COMMUNICATE ERROR : "
+ "send() to daemon error: %s.\n", strerror(errno));
+ }
+ } else {
+ ret = writev(local_sock_fd, req_iov, req_cnt);
+ if (ret < 0) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSADM_COMMUNICATE,8,
+ "writev() to daemon error: %s.", strerror(errno));
+ fprintf(stderr, "COMMUNICATE ERROR : "
+ "writev() to daemon error: %s.\n", strerror(errno));
+ }
+ }
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_communicate == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_COMMUNICATE,12,
+ "out_function : static int send_request"
+ "(struct iovec *req_iov, int req_cnt) : "
+ "return = %d",
+ ret);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return ret;
+}
+
+/*!
+ * Receive config response message.
+ * @param[in,out] *rsp_iov response io-vector pointer
+ * @param[in] rsp_cnt response io-vector count
+ * @return int receive result OK=byte, NG<0
+ */
+static int
+recv_response(struct iovec *rsp_iov, int rsp_cnt)
+{
+ struct msghdr msg;
+ struct ucred *cred;
+ struct cmsghdr *cmsg;
+ unsigned char cbuf[CMSG_LEN(sizeof(struct ucred))];
+ int ret;
+
+ // Argment check.
+ if (rsp_iov == NULL) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSADM_COMMUNICATE,9,
+ "Argument rsp_iov is NULL.");
+ fprintf(stderr, "COMMUNICATE ERROR : "
+ "Argument rsp_iov is NULL.\n");
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_communicate == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_COMMUNICATE,13,
+ "out_function : static int recv_response"
+ "(struct iovec *rsp_iov, int rsp_cnt) : "
+ "return = -1");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return -1;
+ }
+ if (rsp_cnt < 1) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSADM_COMMUNICATE,10,
+ "Invalid rsp_cnt argument.");
+ fprintf(stderr, "COMMUNICATE ERROR : "
+ "Invalid rsp_cnt argument.\n");
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_communicate == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_COMMUNICATE,14,
+ "out_function : static int recv_response"
+ "(struct iovec *rsp_iov, int rsp_cnt) : "
+ "return = -1");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return -1;
+ }
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_communicate == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_COMMUNICATE,15,
+ "in_function : static int recv_response"
+ "(struct iovec *rsp_iov, int rsp_cnt) : "
+ "rsp_iov = %p "
+ "rsp_cnt = %d",
+ rsp_iov,
+ rsp_cnt);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ memset(&msg, 0, sizeof(msg));
+ msg.msg_control = cbuf;
+ msg.msg_controllen = sizeof(cbuf);
+ msg.msg_iov = rsp_iov;
+ msg.msg_iovlen = (size_t)rsp_cnt;
+ cmsg = (struct cmsghdr *)cbuf;
+
+ ret = recvmsg(local_sock_fd, &msg, 0);
+ if (ret < 0) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSADM_COMMUNICATE,11,
+ "recvmsg() to daemon error: %s.", strerror(errno));
+ fprintf(stderr, "COMMUNICATE ERROR : "
+ "recvmsg() to daemon error: %s.\n", strerror(errno));
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_communicate == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_COMMUNICATE,16,
+ "out_function : static int recv_response"
+ "(struct iovec *rsp_iov, int rsp_cnt) : "
+ "return = L7VSADM_RECV_FAILED(-1)");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return L7VSADM_RECV_FAILED;
+ }
+
+ if (msg.msg_flags & MSG_CTRUNC) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSADM_COMMUNICATE,12,
+ "Invalid response from l7vsd.");
+ fprintf(stderr, "COMMUNICATE ERROR : "
+ "Invalid response from l7vsd.\n");
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_communicate == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_COMMUNICATE,17,
+ "out_function : static int recv_response"
+ "(struct iovec *rsp_iov, int rsp_cnt) : "
+ "return = L7VSADM_RECV_FAILED(-1)");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return L7VSADM_RECV_FAILED;
+ }
+
+ if (msg.msg_flags & MSG_TRUNC) {
+ LOGGER_PUT_LOG_WARN(LOG_CAT_L7VSADM_COMMUNICATE,1,
+ "Too large response from l7vsd.");
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_communicate == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_COMMUNICATE,18,
+ "out_function : static int recv_response"
+ "(struct iovec *rsp_iov, int rsp_cnt) : "
+ "return = L7VSADM_RECV_TOO_LARGE(-2)");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return L7VSADM_RECV_TOO_LARGE;
+ }
+
+ if (! (cmsg->cmsg_level == SOL_SOCKET &&
+ cmsg->cmsg_type == SCM_CREDENTIALS)) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSADM_COMMUNICATE,13,
+ "Could not receive a remote credential.");
+ fprintf(stderr, "COMMUNICATE ERROR : "
+ "Could not receive a remote credential.\n");
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_communicate == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_COMMUNICATE,19,
+ "out_function : static int recv_response"
+ "(struct iovec *rsp_iov, int rsp_cnt) : "
+ "return = L7VSADM_RECV_FAILED(-1)");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return L7VSADM_RECV_FAILED;
+ }
+
+ cred = (struct ucred *)CMSG_DATA(cmsg);
+ if (cred->uid != 0) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSADM_COMMUNICATE,14,
+ "Response from unprivileged user.");
+ fprintf(stderr, "COMMUNICATE ERROR : "
+ "Response from unprivileged user.\n");
+ return L7VSADM_RECV_FAILED;
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_communicate == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_COMMUNICATE,20,
+ "out_function : static int recv_response"
+ "(struct iovec *rsp_iov, int rsp_cnt) : "
+ "return = L7VSADM_RECV_FAILED(-1)");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ }
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_communicate == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_COMMUNICATE,21,
+ "out_function : static int recv_response"
+ "(struct iovec *rsp_iov, int rsp_cnt) : "
+ "return = %d",
+ ret);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return ret;
+}
+
+/*!
+ * Print l7vsadm command usage.
+ * @param[in] *fp outoput file pointer
+ */
+static void
+usage(FILE *fp)
+{
+ // Argment check.
+ if (!fp) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSADM_OPERATE,48,
+ "Argument fp is NULL.");
+ fprintf(stderr, "OPERATE ERROR : "
+ "Argument fp is NULL.\n");
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_operate == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_OPERATE,73,
+ "out_function : static void usage(FILE *fp) : ");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return;
+ }
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_operate == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_OPERATE,74,
+ "in_function : static void usage(FILE *fp) : "
+ "fp = %p",
+ fp);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ fprintf(fp,
+ "Usage: \n"
+ " l7vsadm -A|E -t service-address -m proto-module [module-args]\n"
+ " [-s scheduler] [-u connection-count] [-b sorry-server]\n"
+ " [-f sorry-flag] [-Q QoSval-up] [-q QoSval-down]\n"
+ " l7vsadm -D -t service-address -m proto-module [module-args]\n"
+ " l7vsadm -C\n"
+ " l7vsadm -a|e -t service-address -m proto-module [module-args]\n"
+ " -r server-address [-w weight]\n"
+ " l7vsadm -d -t service-address -m proto-module [module-args]\n"
+ " -r server-address\n"
+ " l7vsadm -R -s replication-switch\n"
+ " l7vsadm -R -f\n"
+ " l7vsadm -R -d\n"
+ " l7vsadm -L -c log-category -l log-level\n"
+ " l7vsadm -S -c log-category -l log-level\n"
+ " l7vsadm -P -r reload-parameter\n"
+ " l7vsadm -l [-n]\n"
+ " l7vsadm -V [-n]\n"
+ " l7vsadm -K [-n]\n"
+ " l7vsadm -h\n"
+ "\n");
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_operate == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_OPERATE,75,
+ "out_function : static void usage(FILE *fp) : ");
+ }
+ /*------ DEBUG LOG END ------*/
+
+}
+
+/*!
+ * Set l7vsadm parameter data.
+ * Get l7vsadm parameter data and set to global data
+ */
+static void
+set_parameter(void)
+{
+ static struct l7vsadm_parameter_list l7vsadm_parameter_table[] = {
+ {PARA_CMD_INTERVAL, "cmd_interval"},
+ {PARA_CMD_COUNT, "cmd_count"},
+ {PARA_CON_INTERVAL, "con_interval"},
+ {PARA_CON_COUNT, "con_count"},
+ {PARA_NONE, NULL}
+ };
+ struct l7vsadm_parameter_list *list;
+ int parameter_value = 0;
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_common == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_COMMON,8,
+ "in_function : static void set_parameter(void) : ");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ // Get and Set l7vsadm all parameter value.
+ for (list = l7vsadm_parameter_table; list->parameter_name != NULL; list++) {
+ parameter_value = 0;
+ if (parameter_is_int_exist(L7VSADM_COMPONENT, list->parameter_name)) {
+ parameter_value =
+ parameter_get_int_value(L7VSADM_COMPONENT, list->parameter_name);
+ } else {
+ // When parameter not exist, use default parameter value.
+ LOGGER_PUT_LOG_WARN(LOG_CAT_L7VSADM_COMMON,2,
+ "Get %s parameter error. Use default value.",
+ list->parameter_name);
+ continue;
+ }
+ switch (list->parameter_code) {
+ case PARA_CMD_INTERVAL:
+ command_wait_interval = parameter_value;
+ if (command_wait_interval < 0 ||
+ command_wait_interval > L7VSADM_MAX_WAIT) {
+ // When illegal parameter value, use default parameter value.
+ command_wait_interval = L7VSADM_DEFAULT_WAIT_INTERVAL;
+ LOGGER_PUT_LOG_WARN(LOG_CAT_L7VSADM_COMMON,3,
+ "Illegal %s parameter value. Use default value.",
+ list->parameter_name);
+ }
+ break;
+ case PARA_CMD_COUNT:
+ command_wait_count = parameter_value;
+ if (command_wait_count < 0 ||
+ command_wait_count > L7VSADM_MAX_WAIT) {
+ // When illegal parameter value, use default parameter value.
+ command_wait_count = L7VSADM_DEFAULT_WAIT_COUNT;
+ LOGGER_PUT_LOG_WARN(LOG_CAT_L7VSADM_COMMON,4,
+ "Illegal %s parameter value. Use default value.",
+ list->parameter_name);
+ }
+ break;
+ case PARA_CON_INTERVAL:
+ connect_wait_interval = parameter_value;
+ if (connect_wait_interval < 0 ||
+ connect_wait_interval > L7VSADM_MAX_WAIT) {
+ // When illegal parameter value, use default parameter value.
+ connect_wait_interval = L7VSADM_DEFAULT_WAIT_INTERVAL;
+ LOGGER_PUT_LOG_WARN(LOG_CAT_L7VSADM_COMMON,5,
+ "Illegal %s parameter value. Use default value.",
+ list->parameter_name);
+ }
+ break;
+ case PARA_CON_COUNT:
+ connect_wait_count = parameter_value;
+ if (connect_wait_count < 0 ||
+ connect_wait_count > L7VSADM_MAX_WAIT) {
+ // When illegal parameter value, use default parameter value.
+ connect_wait_count = L7VSADM_DEFAULT_WAIT_COUNT;
+ LOGGER_PUT_LOG_WARN(LOG_CAT_L7VSADM_COMMON,6,
+ "Illegal %s parameter value. Use default value.",
+ list->parameter_name);
+ }
+ break;
+ case PARA_NONE:
+ default:
+ break;
+ }
+ }
+
+ if ((command_wait_interval * command_wait_count) > L7VSADM_MAX_WAIT) {
+ // When wait value too long, use default parameter value.
+ command_wait_interval = L7VSADM_DEFAULT_WAIT_INTERVAL;
+ command_wait_count = L7VSADM_DEFAULT_WAIT_COUNT;
+ LOGGER_PUT_LOG_WARN(LOG_CAT_L7VSADM_COMMON,7,
+ "Command wait value too long. Use default value.");
+ }
+ if ((connect_wait_interval * connect_wait_count) > L7VSADM_MAX_WAIT) {
+ // When wait value too long, use default parameter value.
+ connect_wait_interval = L7VSADM_DEFAULT_WAIT_INTERVAL;
+ connect_wait_count = L7VSADM_DEFAULT_WAIT_COUNT;
+ LOGGER_PUT_LOG_WARN(LOG_CAT_L7VSADM_COMMON,8,
+ "Connect wait value too long. Use default value.");
+ }
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_common == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_COMMON,9,
+ "out_function : static void set_parameter(void) : "
+ "result "
+ "command_wait_interval = %d "
+ "command_wait_count = %d "
+ "connect_wait_interval = %d "
+ "connect_wait_count = %d",
+ command_wait_interval,
+ command_wait_count,
+ connect_wait_interval,
+ connect_wait_count);
+ }
+ /*------ DEBUG LOG END ------*/
+}
+
+/*!
+ * Create config error string.
+ * Translate from esponse code to error string
+ * @param[in] rsp_code response code
+ * @param[in] *argv[] array of argument string
+ * @return char * error string
+ */
+static char *
+config_strerror(int rsp_code)
+{
+ /*-------- DEBUG LOG --------*/
+ if (log_level_common == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_COMMON,10,
+ "in_function : static char *config_strerror(int rsp_code) : "
+ "rsp_code = %d",
+ rsp_code);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ switch (rsp_code) {
+ case L7VS_CONFIG_NOERR:
+ /*-------- DEBUG LOG --------*/
+ if (log_level_common == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_COMMON,11,
+ "out_function : static char *config_strerror(int rsp_code) : "
+ "return = No error");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return "No error";
+ case L7VS_CONFIG_ERR_INVALID_COMMAND:
+ /*-------- DEBUG LOG --------*/
+ if (log_level_common == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_COMMON,12,
+ "out_function : static char *config_strerror(int rsp_code) : "
+ "return = Invalid command");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return "Invalid command";
+ case L7VS_CONFIG_ERR_NOMEM:
+ /*-------- DEBUG LOG --------*/
+ if (log_level_common == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_COMMON,13,
+ "out_function : static char *config_strerror(int rsp_code) : "
+ "return = Could not allocate memory");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return "Could not allocate memory";
+ case L7VS_CONFIG_ERR_VS_EXISTS:
+ /*-------- DEBUG LOG --------*/
+ if (log_level_common == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_COMMON,14,
+ "out_function : static char *config_strerror(int rsp_code) : "
+ "return = Virtual service already exists");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return "Virtual service already exists";
+ case L7VS_CONFIG_ERR_RS_EXISTS:
+ /*-------- DEBUG LOG --------*/
+ if (log_level_common == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_COMMON,15,
+ "out_function : static char *config_strerror(int rsp_code) : "
+ "return = Real server already exists");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return "Real server already exists";
+ case L7VS_CONFIG_ERR_NOVS:
+ /*-------- DEBUG LOG --------*/
+ if (log_level_common == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_COMMON,16,
+ "out_function : static char *config_strerror(int rsp_code) : "
+ "return = No such virtual service");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return "No such virtual service";
+ case L7VS_CONFIG_ERR_NORS:
+ /*-------- DEBUG LOG --------*/
+ if (log_level_common == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_COMMON,17,
+ "out_function : static char *config_strerror(int rsp_code) : "
+ "return = No such real server");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return "No such real server";
+ case L7VS_CONFIG_ERR_NOSCHED:
+ /*-------- DEBUG LOG --------*/
+ if (log_level_common == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_COMMON,18,
+ "out_function : static char *config_strerror(int rsp_code) : "
+ "return = No such scheduler");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return "No such scheduler";
+ case L7VS_CONFIG_ERR_NOSOCK:
+ /*-------- DEBUG LOG --------*/
+ if (log_level_common == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_COMMON,19,
+ "out_function : static char *config_strerror(int rsp_code) : "
+ "return = Could not create a service socket");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return "Could not create a service socket";
+ case L7VS_CONFIG_ERR_QOSSET:
+ /*-------- DEBUG LOG --------*/
+ if (log_level_common == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_COMMON,20,
+ "out_function : static char *config_strerror(int rsp_code) : "
+ "return = QoS threshold setting failure");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return "QoS threshold setting failure";
+ case L7VS_CONFIG_ERR_SORRYSET:
+ /*-------- DEBUG LOG --------*/
+ if (log_level_common == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_COMMON,21,
+ "out_function : static char *config_strerror(int rsp_code) : "
+ "return = Sorry-Server modification failure");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return "Sorry-Server modification failure";
+ case L7VS_CONFIG_ERR_SENDMSG:
+ /*-------- DEBUG LOG --------*/
+ if (log_level_common == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_COMMON,22,
+ "out_function : static char *config_strerror(int rsp_code) : "
+ "return = Could not send response to l7vsadm");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return "Could not send response to l7vsadm";
+ case L7VS_CONFIG_ERR_MAXVS_EXISTS:
+ /*------ DEBUG LOG -------*/
+ if (log_level_common == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_COMMON,23,
+ "out_function : static char *config_strerror(int rep_code) : "
+ "return = l7vsd is created max virtual service" );
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return "Could not create virtual service to l7vsd because max limit it.";
+ default:
+ /*-------- DEBUG LOG --------*/
+ if (log_level_common == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_COMMON,24,
+ "out_function : static char *config_strerror(int rsp_code) : "
+ "return = Unknown error");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return "Unknown error";
+ break;
+ }
+}
+
+/*!
+ * Signal handling function.
+ * @param[in] sig signal number
+ */
+static void
+sig_exit_handler(int sig)
+{
+ received_sig = sig;
+ ++signal_flg;
+}
+
+/*!
+ * Set signal handler.
+ * @param[in] argc number of argument
+ * @param[in] *argv[] array of argument string
+ * @return int set result OK=0, NG=-1
+ */
+static int
+set_signal(void)
+{
+ static struct l7vsadm_sig_list sigs[] = {
+ {SIGHUP, sig_exit_handler},
+ {SIGINT, sig_exit_handler},
+ {SIGQUIT, sig_exit_handler},
+ {SIGPIPE, sig_exit_handler},
+ {SIGTERM, sig_exit_handler},
+ {SIGUSR1, sig_exit_handler},
+ {SIGUSR2, sig_exit_handler},
+ {0, NULL}
+ };
+ struct l7vsadm_sig_list *s;
+ struct sigaction act, oact;
+ int ret;
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_common == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_COMMON,25,
+ "in_function : static int set_signal(void) : ");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ memset(&act, 0x00, sizeof(struct sigaction));
+ memset(&oact, 0x00, sizeof(struct sigaction));
+
+ for (s = sigs; s->sig != 0; s++) {
+ ret = sigaction(s->sig, NULL, &oact);
+ if (ret < 0) {
+ LOGGER_PUT_LOG_FATAL(LOG_CAT_L7VSADM_COMMON,6,
+ "sigaction() error: %s.", strerror(errno));
+ fprintf(stderr, "COMMON ERROR : "
+ "sigaction() error: %s.\n", strerror(errno));
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_common == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_COMMON,26,
+ "out_function : static int set_signal(void) : "
+ "return = %d",
+ ret);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return ret;
+ }
+
+ act = oact;
+ act.sa_handler = s->sig_func;
+ ret = sigaction(s->sig, &act, NULL);
+ if (ret < 0) {
+ LOGGER_PUT_LOG_FATAL(LOG_CAT_L7VSADM_COMMON,7,
+ "sigaction() error: %s.", strerror(errno));
+ fprintf(stderr, "COMMON ERROR : "
+ "sigaction() error: %s.\n", strerror(errno));
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_common == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_COMMON,27,
+ "out_function : static int set_signal(void) : "
+ "return = %d",
+ ret);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return ret;
+ }
+ }
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_common == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_COMMON,28,
+ "out_function : static int set_signal(void) : "
+ "return = 0");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return 0;
+}
+
+/*!
+ * L7vsadm command main function.
+ * Parse argument and execute command
+ * @param[in] argc number of argument
+ * @param[in] *argv[] array of argument string
+ */
+void
+l7vsadm_main(int argc, char *argv[])
+{
+ char l7vsadm_file_path[256];
+ int l7vsadm_fd = -1;
+ int l7vsadm_lock = -1;
+ int retry_count = 0;
+ int ret;
+ int error_f = 0;
+
+ // Get and Set l7vsadm all log level value.
+ log_level_parse = logger_get_log_level(LOG_CAT_L7VSADM_PARSE);
+ log_level_operate = logger_get_log_level(LOG_CAT_L7VSADM_OPERATE);
+ log_level_communicate = logger_get_log_level(LOG_CAT_L7VSADM_COMMUNICATE);
+ log_level_config_result = logger_get_log_level(LOG_CAT_L7VSADM_CONFIG_RESULT);
+ log_level_common = logger_get_log_level(LOG_CAT_L7VSADM_COMMON);
+
+ // L7vsadm command start.
+ char arg_str[DEBUG_STR_LEN] = {0};
+ argc_argv_c_str(arg_str, argc, argv);
+ LOGGER_PUT_LOG_INFO(LOG_CAT_L7VSADM_COMMON,1,
+ "l7vsadm command start. : "
+ "argc = %d, %s",
+ argc,
+ arg_str);
+
+ // Set signal handler.
+ ret = set_signal();
+ if (ret < 0) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSADM_COMMON,11,
+ "Set signal handler error.");
+ error_f = 1;
+ goto END;
+ }
+
+ // l7vsadm_option_data initialize.
+ memset(&l7vsadm_option_data, 0, sizeof(struct l7vsadm_option_data));
+
+ // Check signal.
+ if (signal_flg > 0) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSADM_COMMON,12,
+ "Signal (%d) Received.", received_sig);
+ fprintf(stderr, "COMMON ERROR : "
+ "Signal (%d) Received.\n", received_sig);
+ error_f = 1;
+ goto END;
+ }
+
+ // Set l7vsadm parameter.
+ set_parameter();
+
+ // Get l7vsadm execute file path from /proc/(pid)/exe (symbolic link)
+ memset(l7vsadm_file_path, 0, sizeof(l7vsadm_file_path));
+ readlink("/proc/self/exe", l7vsadm_file_path, sizeof(l7vsadm_file_path));
+
+ // L7vsadm command conflict check. (Try l7vsadm execute file lock)
+ l7vsadm_fd = open(l7vsadm_file_path, O_RDONLY);
+ if (l7vsadm_fd == -1) {
+ LOGGER_PUT_LOG_FATAL(LOG_CAT_L7VSADM_COMMON,8,
+ "L7vsadm execute file open error. file:%s", l7vsadm_file_path);
+ fprintf(stderr, "COMMON ERROR : "
+ "L7vsadm execute file open error. file:%s\n", l7vsadm_file_path);
+ error_f = 1;
+ goto END;
+ }
+ while (1) {
+ // Check signal.
+ if (signal_flg > 0) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSADM_COMMON,13,
+ "Signal (%d) Received.", received_sig);
+ fprintf(stderr, "COMMON ERROR : "
+ "Signal (%d) Received.\n", received_sig);
+ error_f = 1;
+ goto END;
+ }
+
+ // Try lock l7vsadm file.
+ l7vsadm_lock = flock(l7vsadm_fd, LOCK_EX | LOCK_NB);
+ if (l7vsadm_lock == 0) {
+ // l7vsadm file lock OK.
+ break;
+ }
+ retry_count++;
+ if (retry_count > command_wait_count) {
+ // L7vsadm file lock error. (l7vsadm is executing)
+ LOGGER_PUT_LOG_FATAL(LOG_CAT_L7VSADM_COMMON,9,
+ "L7vsadm file lock timeout. (l7vsadm is already executing)");
+ fprintf(stderr, "COMMON ERROR : "
+ "L7vsadm file lock timeout. (l7vsadm is already executing)\n");
+ error_f = 1;
+ goto END;
+ }
+ // Lock retrying.
+ LOGGER_PUT_LOG_WARN(LOG_CAT_L7VSADM_COMMON,9,
+ "L7vsadm file lock error. (l7vsadm is already executing) (retry %d)",
+ retry_count);
+ sleep(command_wait_interval);
+ }
+
+ if (argc > 1) {
+ // Check signal.
+ if (signal_flg > 0) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSADM_COMMON,14,
+ "Signal (%d) Received.", received_sig);
+ fprintf(stderr, "COMMON ERROR : "
+ "Signal (%d) Received.\n", received_sig);
+ error_f = 1;
+ goto END;
+ }
+
+ // Parse command option. (1st argument)
+ ret = parse_command(argc, argv);
+ if (ret < 0) {
+ // Command option parse NG.
+ LOGGER_PUT_LOG_WARN(LOG_CAT_L7VSADM_PARSE,84,
+ "Command option parse error.");
+ usage(stderr);
+ error_f = 1;
+ goto END;
+ }
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_parse == LOG_LV_DEBUG) {
+ char parse_str[DEBUG_STR_LEN] = {0};
+ l7vsadm_option_data_c_str(parse_str);
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_PARSE,112,
+ "function : void l7vsadm_main(int argc, char *argv[]) : "
+ "parse_command result (%s)",
+ parse_str);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ // Check signal.
+ if (signal_flg > 0) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSADM_COMMON,15,
+ "Signal (%d) Received.", received_sig);
+ fprintf(stderr, "COMMON ERROR : "
+ "Signal (%d) Received.\n", received_sig);
+ error_f = 1;
+ goto END;
+ }
+
+ // Check parse function pointer.
+ if (l7vsadm_option_data.parse_func == NULL) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSADM_PARSE,7,
+ "Parse function pointer is NULL.");
+ error_f = 1;
+ goto END;
+ }
+
+ // Parse xxx command option. (2nd argument and later)
+ ret = l7vsadm_option_data.parse_func(argc, argv);
+ if (ret < 0) {
+ // xxx command option parse NG.
+ LOGGER_PUT_LOG_WARN(LOG_CAT_L7VSADM_PARSE,85,
+ "(%s) command option parse error.", argv[1]);
+ usage(stderr);
+ error_f = 1;
+ goto END;
+ }
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_parse == LOG_LV_DEBUG) {
+ char parse_str[DEBUG_STR_LEN] = {0};
+ l7vsadm_option_data_c_str(parse_str);
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_PARSE,113,
+ "function : void l7vsadm_main(int argc, char *argv[]) : "
+ "parse_option result (%s)",
+ parse_str);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ } else {
+ // No argument. Set default command (-l).
+ l7vsadm_option_data.command_code = CMD_LIST;
+ l7vsadm_option_data.operate_func = operate_list;
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_parse == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_PARSE,114,
+ "function : void l7vsadm_main(int argc, char *argv[]) : "
+ "no option");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ }
+
+ // Check signal.
+ if (signal_flg > 0) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSADM_COMMON,16,
+ "Signal (%d) Received.", received_sig);
+ fprintf(stderr, "COMMON ERROR : "
+ "Signal (%d) Received.\n", received_sig);
+ error_f = 1;
+ goto END;
+ }
+
+
+ // Check operate function pointer.
+ if (l7vsadm_option_data.operate_func == NULL) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSADM_OPERATE,49,
+ "Operate function pointer is NULL.");
+ error_f = 1;
+ goto END;
+ }
+
+ // Operate l7vsadm command.
+ ret = l7vsadm_option_data.operate_func();
+ if (ret < 0) {
+ // xxx command operate NG.
+ if (argc > 1) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSADM_OPERATE,50,
+ "(%s) command operate error.", argv[1]);
+ } else {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSADM_OPERATE,51,
+ "(-l) command operate error.");
+ }
+ error_f = 1;
+ goto END;
+ }
+
+END:
+ if (l7vsadm_lock != -1) {
+ // L7vsadm fd unlock.
+ flock(l7vsadm_fd, LOCK_UN);
+ }
+
+ if (l7vsadm_fd != -1) {
+ // L7vsadm fd close.
+ close(l7vsadm_fd);
+ }
+
+ // Error check.
+ if (error_f == 1) {
+ // Abnormal end.
+ if (argc > 1) {
+ LOGGER_PUT_LOG_INFO(LOG_CAT_L7VSADM_COMMON,2,
+ "L7vsadm command (%s) is failure.", argv[1]);
+ } else {
+ LOGGER_PUT_LOG_INFO(LOG_CAT_L7VSADM_COMMON,3,
+ "L7vsadm command (-l) is failure.");
+ }
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_common == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_COMMON,29,
+ "out_function : void l7vsadm_main(int argc, char *argv[]) : "
+ "exit = %d",
+ EXIT_FAILURE);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ fflush(stdout);
+ fsync(1);
+ _exit(EXIT_FAILURE);
+ } else {
+ // Normal end.
+ if (argc > 1) {
+ LOGGER_PUT_LOG_INFO(LOG_CAT_L7VSADM_COMMON,4,
+ "L7vsadm command (%s) is successful.", argv[1]);
+ } else {
+ LOGGER_PUT_LOG_INFO(LOG_CAT_L7VSADM_COMMON,5,
+ "L7vsadm command (-l) is successful.");
+ }
+
+ /*-------- DEBUG LOG --------*/
+ if (log_level_common == LOG_LV_DEBUG) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSADM_COMMON,30,
+ "out_function : void l7vsadm_main(int argc, char *argv[]) : "
+ "exit = %d",
+ EXIT_SUCCESS);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ fflush(stdout);
+ fsync(1);
+ _exit(EXIT_SUCCESS);
+ }
+}
+
+/*!
+ * Serialize endpoint for debug log.
+ * @param[out] *ep_str endpoint string
+ * @param[in] *addr endpoint structure
+ */
+void
+endpoint_c_str(char* ep_str, void *addr)
+{
+ struct sockaddr_in *p;
+
+ p = (struct sockaddr_in *)addr;
+ if (p == NULL) {
+ sprintf(ep_str, "NULL");
+ } else {
+ sprintf(ep_str, "sin_family = %d", p->sin_family);
+ sprintf(ep_str, "%s sin_port = %d", ep_str, p->sin_port);
+ if (memcmp(&p->sin_addr, "", 1) == 0) {
+ sprintf(ep_str, "%s sin_addr = (NULL)", ep_str);
+ } else {
+ sprintf(ep_str, "%s sin_addr = (s_addr = %d)", ep_str, p->sin_addr.s_addr);
+ }
+ if (p->sin_zero == NULL) {
+ sprintf(ep_str, "%s sin_zero = NULL", ep_str);
+ } else {
+ sprintf(ep_str, "%s sin_zero = %s", ep_str, p->sin_zero);
+ }
+ }
+}
+
+/*!
+ * Serialize argc *argv[] for debug log.
+ * @param[out] *arg_str serialized string
+ * @param[in] argc argument count
+ * @param[in] *argv[] argument string array
+ */
+void
+argc_argv_c_str(char* arg_str, int argc, char *argv[])
+{
+ int i;
+
+ for (i = 0; i < argc; i++) {
+ if (argv == NULL) {
+ if (strlen(arg_str) + 20 > DEBUG_STR_LEN) {
+ break;
+ }
+ sprintf(arg_str, "%s argv[%d] = NULL", arg_str, i);
+ } else {
+ if (strlen(arg_str) + strlen(argv[i]) + 16 > DEBUG_STR_LEN) {
+ break;
+ }
+ sprintf(arg_str, "%s argv[%d] = %s", arg_str, i, argv[i]);
+ }
+ }
+}
+
+/*!
+ * Serialize l7vsadm_option_data (global data) for debug log.
+ * @param[out] *parse_str serialized string
+ */
+void
+l7vsadm_option_data_c_str(char* parse_str)
+{
+ sprintf(parse_str, "command_code = %d",
+ l7vsadm_option_data.command_code);
+ sprintf(parse_str, "%s parse_func = %p", parse_str,
+ l7vsadm_option_data.parse_func);
+ sprintf(parse_str, "%s operate_func = %p", parse_str,
+ l7vsadm_option_data.operate_func);
+ if (memcmp(&l7vsadm_option_data.vs_addr, "", 1) == 0) {
+ sprintf(parse_str, "%s vs_addr = NULL", parse_str);
+ } else {
+ sprintf(parse_str, "%s vs_addr = %s", parse_str,
+ get_endpoint_name((struct sockaddr_storage *)(&l7vsadm_option_data.vs_addr)));
+ }
+ if (memcmp(&l7vsadm_option_data.rs_addr, "", 1) == 0) {
+ sprintf(parse_str, "%s rs_addr = NULL", parse_str);
+ } else {
+ sprintf(parse_str, "%s rs_addr = %s", parse_str,
+ get_endpoint_name((struct sockaddr_storage *)(&l7vsadm_option_data.rs_addr)));
+ }
+ if (memcmp(&l7vsadm_option_data.protomod_name, "", 1) == 0) {
+ sprintf(parse_str, "%s protomod_name = NULL", parse_str);
+ } else {
+ sprintf(parse_str, "%s protomod_name = %s", parse_str,
+ l7vsadm_option_data.protomod_name);
+ }
+ if (memcmp(&l7vsadm_option_data.schedmod_name, "", 1) == 0) {
+ sprintf(parse_str, "%s schedmod_name = NULL", parse_str);
+ } else {
+ sprintf(parse_str, "%s schedmod_name = %s", parse_str,
+ l7vsadm_option_data.schedmod_name);
+ }
+ sprintf(parse_str, "%s protomod = %p", parse_str,
+ l7vsadm_option_data.protomod);
+ sprintf(parse_str, "%s persist = %d", parse_str,
+ l7vsadm_option_data.persist);
+ sprintf(parse_str, "%s backlog = %d", parse_str,
+ l7vsadm_option_data.backlog);
+ sprintf(parse_str, "%s weight = %d", parse_str,
+ l7vsadm_option_data.weight);
+ sprintf(parse_str, "%s isnumeric = %d", parse_str,
+ l7vsadm_option_data.isnumeric);
+ if (l7vsadm_option_data.protomod_options == NULL) {
+ sprintf(parse_str, "%s protomod_options = %p", parse_str,
+ l7vsadm_option_data.protomod_options);
+ } else {
+ char arg_str[DEBUG_STR_LEN] = {0};
+ argc_argv_c_str(arg_str,
+ l7vsadm_option_data.protomod_options->len,
+ (char **)l7vsadm_option_data.protomod_options->data);
+ sprintf(parse_str, "%s protomod_options = %s", parse_str,
+ arg_str);
+ }
+ sprintf(parse_str, "%s protomod_sarg = %p", parse_str,
+ &l7vsadm_option_data.protomod_sarg);
+ sprintf(parse_str, "%s max_connection = %d", parse_str,
+ l7vsadm_option_data.max_connection);
+ if (memcmp(&l7vsadm_option_data.sorry_addr, "", 1) == 0) {
+ sprintf(parse_str, "%s sorry_addr = NULL", parse_str);
+ } else {
+ sprintf(parse_str, "%s sorry_addr = %s", parse_str,
+ get_endpoint_name(&l7vsadm_option_data.sorry_addr));
+ }
+ sprintf(parse_str, "%s sorry_flag = %d", parse_str,
+ l7vsadm_option_data.sorry_flag);
+ sprintf(parse_str, "%s QoS_to_server = %lld", parse_str,
+ l7vsadm_option_data.qos_threshold_up);
+ sprintf(parse_str, "%s QoS_to_client = %lld", parse_str,
+ l7vsadm_option_data.qos_threshold_down);
+ sprintf(parse_str, "%s control_code = %d", parse_str,
+ l7vsadm_option_data.control_code);
+ sprintf(parse_str, "%s log_category = %d", parse_str,
+ l7vsadm_option_data.log_category);
+ sprintf(parse_str, "%s log_level = %d", parse_str,
+ l7vsadm_option_data.log_level);
+ sprintf(parse_str, "%s category_all_flag = %d", parse_str,
+ l7vsadm_option_data.category_all_flag);
+ sprintf(parse_str, "%s replication_start_flag = %d", parse_str,
+ l7vsadm_option_data.replication_start_flag);
+ sprintf(parse_str, "%s reload_param = %d", parse_str,
+ l7vsadm_option_data.reload_param);
+ return;
+}
--- /dev/null
+/*
+ * @file l7vsd.c
+ * @brief l7vsd main module.
+ *
+ * L7VSD: Linux Virtual Server for Layer7 Load Balancing
+ * Copyright (C) 2008 NTT COMWARE Corporation.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ **********************************************************************/
+
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE /* for getopt_long() */
+#endif /* _GNU_SOURCE */
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <sys/socket.h>
+#include <signal.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <getopt.h>
+#include <glib.h>
+#include <errno.h>
+#include "logger_wrapper.h"
+#include "parameter_wrapper.h"
+#include "l7vs.h"
+#include "l7vs_module.h"
+#include "l7vs_config.h"
+#include "l7vs_iomuxlist.h"
+#include "l7vs_config.h"
+#include "l7vs_lsock.h"
+
+static void sig_exit_handler(int sig);
+static int set_sighandler(int sig, void (*handler)(int));
+static int set_sighandlers(void);
+static void usage(FILE *fp, char *ident);
+
+static int exit_requested = 0;
+static int received_sig = 0;
+
+l7vs::Logger l7vs::Logger::instance;
+l7vs::Parameter l7vs::Parameter::instance;
+
+/*!
+ * exit signal handler
+ *
+ * @param[in] sig signal
+ * @return void
+ */
+static void
+sig_exit_handler(int sig)
+{
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_PROGRAM)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_PROGRAM,1,
+ "in_function: static void sig_exit_handler(int sig) "
+ "sig=%d",
+ sig);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ received_sig = sig;
+ exit_requested++;
+
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_PROGRAM)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_PROGRAM,2,
+ "out_function: static void sig_exit_handler(int sig) "
+ "return_value: void");
+ }
+ /*------ DEBUG LOG END ------*/
+}
+
+/*!
+ * setup signal handler
+ *
+ * @param[in] sig signal
+ * @param[in] handler signal handler
+ * @retval 0 succeed
+ * @retval -1 failed
+ */
+static int
+set_sighandler(int sig, void (*handler)(int))
+{
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_PROGRAM)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_PROGRAM,3,
+ "in_function: static int set_sighandler(int sig, void (*handler)(int)) "
+ "sig=%d: "
+ "handler=%p",
+ sig, handler);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ struct sigaction act;
+ int ret;
+
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_PROGRAM)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_PROGRAM,4,
+ "sigaction : sig=%d: act=NULL",
+ sig);
+ }
+ /*------ DEBUG LOG END ------*/
+ ret = sigaction(sig, NULL, &act);
+ if (ret < 0) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_SYSTEM_SIGNAL,1, "sigaction on signal %d failed", sig);
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_PROGRAM)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_PROGRAM,5,
+ "out_function: static int set_sighandler(int sig, void (*handler)(int)) "
+ "return_value: %d",
+ ret);
+ }
+ /*------ DEBUG LOG END ------*/
+ return ret;
+ }
+ act.sa_flags &= ~SA_RESETHAND;
+ act.sa_handler = handler;
+
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_PROGRAM)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_PROGRAM,6,
+ "sigaction : sig=%d: act.sa_flags=%d, act.sa_handler=%p",
+ sig, act.sa_flags, act.sa_handler);
+ }
+ /*------ DEBUG LOG END ------*/
+ ret = sigaction(sig, &act, NULL);
+ if (ret < 0) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_SYSTEM_SIGNAL,2, "sigaction on signal %d failed", sig);
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_PROGRAM)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_PROGRAM,7,
+ "out_function: static int set_sighandler(int sig, void (*handler)(int)) "
+ "return_value: %d",
+ ret);
+ }
+ /*------ DEBUG LOG END ------*/
+ return ret;
+ }
+
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_PROGRAM)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_PROGRAM,8,
+ "out_function: static int set_sighandler(int sig, void (*handler)(int)) "
+ "return_value: 0");
+ }
+ /*------ DEBUG LOG END ------*/
+ return 0;
+}
+
+/*!
+ * setup all signal handlers
+ *
+ * @param[in] void
+ * @retval 0 succeed
+ * @retval -1 failed
+ */
+static int
+set_sighandlers(void)
+{
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_PROGRAM)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_PROGRAM,9,
+ "in_function: static int set_sighandlers(void) ");
+ }
+ /*------ DEBUG LOG END ------*/
+ int ret;
+
+#define SET_SIGHANDLER(sig, handler) \
+ do { \
+ ret = set_sighandler((sig), (handler)); \
+ if (ret < 0) { \
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_PROGRAM)) { \
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_PROGRAM,10, \
+ "out_function: static int set_sighandlers(void) " \
+ "return_value: %d", \
+ ret); \
+ } \
+ return ret; \
+ } \
+ } while (0)
+
+ SET_SIGHANDLER(SIGHUP, sig_exit_handler);
+ SET_SIGHANDLER(SIGINT, sig_exit_handler);
+ SET_SIGHANDLER(SIGQUIT, sig_exit_handler);
+ SET_SIGHANDLER(SIGTERM, sig_exit_handler);
+ SET_SIGHANDLER(SIGUSR1, SIG_IGN);
+ SET_SIGHANDLER(SIGUSR2, SIG_IGN);
+ SET_SIGHANDLER(SIGALRM, SIG_IGN);
+ SET_SIGHANDLER(SIGCHLD, SIG_IGN);
+
+#undef SET_SIGHANDLER
+
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_PROGRAM)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_PROGRAM,11,
+ "out_function: static int set_sighandlers(void) "
+ "return_value: 0");
+ }
+ /*------ DEBUG LOG END ------*/
+ return 0;
+}
+
+/*!
+ * show usage
+ *
+ * @param[in] fp filepointer
+ * @param[in] ident program identifier
+ * @return void
+ */
+static void
+usage(FILE *fp, char *ident)
+{
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_PROGRAM)) {
+ if (!fp) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_PROGRAM,12,
+ "in_function: static void usage(FILE *fp, char *ident) "
+ "fp=NULL, ident=%s",
+ ident);
+ }
+ else {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_PROGRAM,13,
+ "in_function: static void usage(FILE *fp, char *ident) "
+ "fp->_fileno=%d, ident=%s",
+ fp->_fileno, ident);
+ }
+ }
+ /*------ DEBUG LOG END ------*/
+
+ if (!fp) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_PROGRAM,1, "fp is NULL.");
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_PROGRAM)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_PROGRAM,14,
+ "out_function: static void usage(FILE *fp, char *ident) "
+ "return_value: void");
+ }
+ /*------ DEBUG LOG END ------*/
+ return;
+ }
+ if (!ident) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_PROGRAM,2, "ident is NULL.");
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_PROGRAM)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_PROGRAM,15,
+ "out_function: static void usage(FILE *fp, char *ident) "
+ "return_value: void");
+ }
+ /*------ DEBUG LOG END ------*/
+ return;
+ }
+ fprintf(fp,
+ "Usage: %s [-d] [-h]\n"
+ " -d --debug run in debug mode (in foreground)\n"
+ " -h --help print this help messages and exit\n"
+ " -b --blocking blocking mode enable( default non-blocking )\n",
+ ident);
+
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_PROGRAM)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_PROGRAM,16,
+ "out_function: static void usage(FILE *fp, char *ident) "
+ "return_value: void");
+ }
+ /*------ DEBUG LOG END ------*/
+}
+
+/*!
+ * entry point
+ *
+ * @param[in] argc number of arguments
+ * @param[in] argv arguments
+ * @return int exit status
+ */
+int
+//l7vsd_main(int argc, char *argv[])
+main(int argc, char *argv[])
+{
+ //parameter set function register
+ parameter_register_function_pointer( PARAM_COMP_SNMPAGENT, l7vs_snmpbridge_reload_config );
+ parameter_register_function_pointer( PARAM_COMP_REPLICATION, l7vs_replication_reset );
+
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_PROGRAM)) {
+ char argv_str[DEBUG_STR_LEN] = {0};
+ size_t pos = 0;
+ for (int i = 0; i < argc; ++i) {
+ if (DEBUG_STR_LEN <= pos + strlen(argv[i]) + 1) {
+ break;
+ }
+ strcpy(argv_str + pos, argv[i]);
+ pos += strlen(argv[i]);
+ *(argv_str + pos) = ' ';
+ ++pos;
+ }
+ *(argv_str + pos) = '\0';
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_PROGRAM,17,
+ "in_function: int main(int argc, char *argv[]) "
+ "argc=%d, argv=%s",
+ argc, argv_str);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ int c;
+ int ret;
+ int debug = 0;
+ int blocking = 0;
+
+ static struct option options[] = {
+ {"debug", no_argument, NULL, 'd'},
+ {"help", no_argument, NULL, 'h'},
+ {"blocking", no_argument, NULL, 'b'},
+ {NULL, 0, NULL, 0 }
+ };
+
+ while ((c = getopt_long(argc, argv, "dhb", options, NULL)) != -1) {
+ switch (c) {
+ case 'd':
+ debug = 1;
+ break;
+ case 'b':
+ blocking = -1;
+ break;
+ case '?':
+ default:
+ fprintf(stderr, "%s: unknown option: %s\n",
+ argv[0], argv[optind - 1]);
+ usage(stderr, argv[0]);
+ fflush(stdout);
+ fsync(1);
+ _exit(1);
+ break;
+ case 'h':
+ usage(stdout, argv[0]);
+ fflush(stdout);
+ fsync(1);
+ _exit(0);
+ break;
+ }
+ }
+
+ if (!debug) {
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_PROGRAM)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_PROGRAM,18,
+ "deamon : nochdir=0: noclose=0");
+ }
+ /*------ DEBUG LOG END ------*/
+ ret = daemon(0, 0);
+ if (ret < 0) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_PROGRAM,3, "daemon() failed: %s", strerror(errno));
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_PROGRAM)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_PROGRAM,19,
+ "out_function: int main(int argc, char *argv[]) "
+ "return_value: 1");
+ }
+ /*------ DEBUG LOG END ------*/
+ fflush(stdout);
+ fsync(1);
+ _exit(1);
+ }
+ }
+
+ LOGGER_PUT_LOG_INFO(LOG_CAT_L7VSD_START_STOP,1, "Starting.");
+
+ set_sighandlers();
+
+ sprintf(l7vs_module_path, L7VS_MODULE_PATH);
+ ret = l7vs_iomux_init();
+ if (ret < 0) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_PROGRAM,5, "iomux_init failed. Exitting.");
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_PROGRAM)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_PROGRAM,20,
+ "out_function: int main(int argc, char *argv[]) "
+ "return_value: 1");
+ }
+ /*------ DEBUG LOG END ------*/
+ fflush(stdout);
+ fsync(1);
+ _exit(1);
+ }
+
+ //snmpbridge initialize
+ LOGGER_PUT_LOG_INFO(LOG_CAT_L7VSD_PROGRAM,1, "snmpbridge initialize start.");
+ ret = l7vs_snmpbridge_initialize();
+ if( ret < 0 ){
+ //debug log output
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_PROGRAM,4, "snmpbridge initialize failure.");
+ }
+ LOGGER_PUT_LOG_INFO(LOG_CAT_L7VSD_PROGRAM,2, "snmpbridge initialize success.");
+
+ ret = l7vs_config_init();
+ if (ret < 0) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_PROGRAM,6, "config_init failed. Exiting.");
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_PROGRAM)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_PROGRAM,21,
+ "out_function: int main(int argc, char *argv[]) "
+ "return_value: 1");
+ }
+ /*------ DEBUG LOG END ------*/
+ fflush(stdout);
+ fsync(1);
+ _exit(1);
+ }
+
+ l7vs_module_init(NULL);
+ l7vs_lsock_init();
+ l7vs_replication_init();
+ l7vs_conn_init();
+ while (!exit_requested) {
+ ret = l7vs_iomux_poll(NULL, blocking);
+ if (ret < 0) {
+ if (errno == EINTR) {
+ /* stop_requested will be checked... */
+ continue;
+ }
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_EVENT,1, "poll: %s", strerror(errno));
+ break;
+ }
+ }
+
+ if (received_sig) {
+ LOGGER_PUT_LOG_INFO(LOG_CAT_L7VSD_SYSTEM_SIGNAL,1, "signal %d received.", received_sig);
+ }
+
+ l7vs_replication_fini();
+ l7vs_lsock_fini();
+ l7vs_module_fini();
+ l7vs_config_fini();
+ l7vs_iomux_fini();
+
+ LOGGER_PUT_LOG_INFO(LOG_CAT_L7VSD_START_STOP,2, "Exiting.");
+
+ /*-------- DEBUG LOG --------*/
+ if (LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_PROGRAM)) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_PROGRAM,22,
+ "out_function: int main(int argc, char *argv[]) "
+ "return_value: 0");
+ }
+ /*------ DEBUG LOG END ------*/
+ fflush(stdout);
+ fsync(1);
+ _exit(0);
+ return 0; /* this instruction never called ;-) */
+}
--- /dev/null
+/*!
+ * @file lsock.c
+ * @bref listen socket control.
+ *
+ * L7VSD: Linux Virtual Server for Layer7 Load Balancing
+ * Copyright (C) 2005 NTT COMWARE Corporation.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ **********************************************************************/
+
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <netinet/tcp.h>
+#include <arpa/inet.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <assert.h>
+#include <glib.h>
+#include <errno.h>
+#include "logger_wrapper.h"
+#include "l7vs.h"
+#include "l7vs_iomuxlist.h"
+#include "l7vs_lsock.h"
+#include "l7vs_module.h"
+#include "l7vs_conn.h"
+#include "l7vs_service.h"
+#include "l7vs_sched.h"
+
+/* static functions */
+static int l7vs_lsock_accept(struct l7vs_lsock *lsock);
+static void l7vs_lsock_table_add(struct l7vs_lsock *lsock);
+static void l7vs_lsock_table_remove(struct l7vs_lsock *lsock);
+static gint l7vs_lsock_addr_cmp(gconstpointer a, gconstpointer b);
+static int l7vs_lsock_callback(struct l7vs_iomux *iom );
+
+//! l7vs_lsock list
+static GList *l7vs_lsock_list;
+
+/*!
+ * inner function of fini.
+ * all element free.
+ * @param[in] void
+ * @return void
+ */
+void freeAllList( gpointer data, gpointer userdata ){
+ struct l7vs_lsock* lsock = (struct l7vs_lsock*)data;
+
+ if(logger_get_log_level(LOG_CAT_L7VSD_SYSTEM_MEMORY) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_SYSTEM_MEMORY,2,
+ "lsock in_fuction freeAllList : lsock=%p",
+ lsock);
+ }
+
+ free( lsock );
+}
+
+/*!
+ * initialize functions
+ * @param[in] void
+ * @return everydays zero.
+ */
+int
+l7vs_lsock_init(void)
+{
+ if(l7vs_lsock_list == NULL )
+ {
+ if(logger_get_log_level(LOG_CAT_L7VSD_SYSTEM_MEMORY) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_SYSTEM_MEMORY,3,
+ "lsock in_fuction int l7vs_lsock_init(void) : l7vs_lsock_list == NULL return 0");
+ }
+ return 0;
+ }
+ g_list_foreach( l7vs_lsock_list, freeAllList, NULL );
+ g_list_free( l7vs_lsock_list );
+ l7vs_lsock_list = NULL;
+
+ if(logger_get_log_level(LOG_CAT_L7VSD_SYSTEM_MEMORY) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_SYSTEM_MEMORY,4,
+ "lsock in_fuction int l7vs_lsock_init(void) : l7vs_lsock_list == NULL return 0");
+ }
+ return 0;
+}
+
+/*!
+ * finalize function.
+ * free list element memory.
+ * drop list memory.
+ * @param[in] void
+ * @return void
+ */
+void
+l7vs_lsock_fini(void)
+{
+ if(logger_get_log_level(LOG_CAT_L7VSD_SYSTEM_MEMORY) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_SYSTEM_MEMORY,5,
+ "lsock in_fuction int l7vs_lsock_fini(void) : free l7vs_lsock_list = %p",
+ l7vs_lsock_list);
+ }
+
+ g_list_foreach( l7vs_lsock_list, freeAllList, NULL );
+ g_list_free( l7vs_lsock_list );
+ l7vs_lsock_list = NULL;
+}
+/*!
+ * look up socket
+ * if target soket have link list then return having socket.
+ * else create new socket to return.
+ * @param[in] sin socket address struct( if ipv6 may be change this struct )
+ * @param[in] proto TCS/UDP select.
+ * @param[in] backlog
+ */
+struct l7vs_lsock *
+l7vs_lsock_get(struct sockaddr_in *sin, uint8_t proto, int backlog)
+{
+ struct l7vs_lsock *lsock;
+ int stype;
+ int ret;
+ int on = 1;
+
+ if(logger_get_log_level(LOG_CAT_L7VSD_SYSTEM_SOCKET) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_SYSTEM_SOCKET,20,
+ "in_fuction: struct l7vs_lsock * l7vs_lsock_get(struct sockaddr_in *sin, uint8_t proto, int backlog)"
+ "*sin =%p :proto = %d :backlog = %d :",
+ sin,proto,backlog);
+ }
+
+ if(sin == NULL )
+ {
+ return NULL;
+ }
+
+ lsock = l7vs_lsock_table_lookup(sin, proto);
+ if (lsock != NULL) {
+ lsock->refcnt++;
+ if(logger_get_log_level(LOG_CAT_L7VSD_SYSTEM_SOCKET) == LOG_LV_DEBUG){
+ char lsock_str[DEBUG_STR_LEN] = {0};
+ l7vs_lsock_c_str(lsock_str, lsock);
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_SYSTEM_SOCKET,21,
+ "table look up: lsock=%s",
+ lsock_str);
+ }
+ return lsock;
+ }
+
+ switch (proto) {
+ case IPPROTO_TCP:
+ stype = SOCK_STREAM;
+ break;
+ case IPPROTO_UDP:
+ stype = SOCK_DGRAM;
+ break;
+ default:
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_SYSTEM_SOCKET,21, "Protocol number should be"
+ " TCP or UDP (%d)",
+ proto);
+ return NULL;
+ }
+
+ lsock = (struct l7vs_lsock *)calloc(1, sizeof(*lsock));
+ if (lsock == NULL) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_SYSTEM_MEMORY,14, "Could not allocate lsock");
+ return lsock;
+ }
+ if(logger_get_log_level(LOG_CAT_L7VSD_SYSTEM_MEMORY) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_SYSTEM_MEMORY,6,
+ "in function l7vs_lsock_get: allocate memory"
+ " : size=%zu ,pointer=%p",
+ sizeof(*lsock),lsock);
+ }
+
+ lsock->iom = l7vs_iomux_get_from_avail_list();
+ if (!lsock->iom) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_ENVIRONMENT,24, "can not get lsock_iomux");
+ return NULL;
+ }
+
+ if(logger_get_log_level(LOG_CAT_L7VSD_SYSTEM_SOCKET) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_SYSTEM_SOCKET,22, "creating lsock %p", lsock);
+ }
+ lsock->proto = proto;
+ lsock->iom->fd = socket(PF_INET, stype, proto); //create a socket to get connection request from the client
+ if (lsock->iom->fd < 0) {
+ if (proto == IPPROTO_TCP) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_SYSTEM_SOCKET,22,
+ "socket: Protocol is IPPROTO_TCP,SockType is SOCK_STREAM (%s)", strerror(errno));
+ }
+ else {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_SYSTEM_SOCKET,26,
+ "socket: Protocol is IPPROTO_UDP,SockType is SOCK_DGRAM (%s)", strerror(errno));
+ }
+
+ if(logger_get_log_level(LOG_CAT_L7VSD_SYSTEM_MEMORY) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_SYSTEM_MEMORY,7,
+ "in function l7vs_lsock_get: free memory"
+ " : size=%zu ,pointer=%p",
+ sizeof(*lsock),lsock);
+ }
+ free(lsock);
+ return NULL;
+ }
+
+ setsockopt(lsock->iom->fd, SOL_SOCKET, SO_REUSEADDR, (char*) &on, sizeof(int));
+ ret = bind(lsock->iom->fd, (struct sockaddr *)sin, sizeof(*sin)); //binding the socket for incoming client request
+ if (ret < 0) {
+ char addr_str[DEBUG_STR_LEN]={0};
+
+ l7vs_lsock_sockaddr_in_c_str(addr_str, (struct sockaddr_in *)sin);
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_SYSTEM_SOCKET,23, "Could not bind socket: %s (%s)",
+ addr_str,strerror(errno));
+ close(lsock->iom->fd);
+ if(logger_get_log_level(LOG_CAT_L7VSD_SYSTEM_MEMORY) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_SYSTEM_MEMORY,8,
+ "in function l7vs_lsock_get: free memory"
+ " : size=%zu ,pointer=%p",
+ sizeof(*lsock),lsock);
+ }
+ free(lsock);
+ return NULL;
+ }
+ lsock->addr = *sin;
+
+ ret = listen(lsock->iom->fd, backlog); //listening for client requests
+ if (ret < 0) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_SYSTEM_SOCKET,24, "Could not listen: %s (file descriptor :%d , backlog: %d)",
+ strerror(errno),lsock->iom->fd, backlog);
+ close(lsock->iom->fd);
+ if(logger_get_log_level(LOG_CAT_L7VSD_SYSTEM_MEMORY) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_SYSTEM_MEMORY,9,
+ "in function l7vs_lsock_get: free memory"
+ " : size=%zu ,pointer=%p",
+ sizeof(*lsock),lsock);
+ }
+ free(lsock);
+ return NULL;
+ }
+
+ lsock->refcnt = 1;
+ lsock->fast_schedule = 1;
+
+ lsock->iom->callback = l7vs_lsock_callback;
+ lsock->iom->data = lsock;
+ lsock->iom->status = iomux_lsock_connect_waiting;
+ l7vs_lsock_table_add(lsock); //Add socket in the list. It may be used for maintaining session (Am not sure)
+// l7vs_iomux_add(&lsock->iom, L7VS_IOMUX_READ);
+
+ if(logger_get_log_level(LOG_CAT_L7VSD_SYSTEM_SOCKET) == LOG_LV_DEBUG){
+ char lsock_str[DEBUG_STR_LEN] = {0};
+ l7vs_lsock_c_str(lsock_str, lsock);
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_SYSTEM_SOCKET,23,
+ "creat: lsock=%s",
+ lsock_str);
+ }
+ l7vs_iomux_add( lsock->iom, iom_read );
+ return lsock;
+}
+
+/*!
+ * lisning socket remove list and iomuxlist.
+ * @param[in] lsock removing lisning socket
+ * @return void
+ */
+
+void
+l7vs_lsock_put(struct l7vs_lsock *lsock)
+{
+ if(lsock == NULL)
+ {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_SYSTEM_SOCKET,25, "error / lsock is null");
+ return;
+ }
+
+ lsock->iom->status = iomux_lsock_released;
+
+ if(logger_get_log_level(LOG_CAT_L7VSD_SYSTEM_SOCKET) == LOG_LV_DEBUG){
+ char lsock_str[DEBUG_STR_LEN] = {0};
+ l7vs_lsock_c_str(lsock_str, lsock);
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_SYSTEM_SOCKET,24,
+ "lsock removing : lsock=%s",
+ lsock_str);
+ }
+ if (--lsock->refcnt > 0)
+ {
+ lsock->iom->status = iomux_lsock_connect_waiting;
+ if(logger_get_log_level(LOG_CAT_L7VSD_SYSTEM_SOCKET) == LOG_LV_DEBUG){
+ char lsock_str[DEBUG_STR_LEN] = {0};
+ l7vs_lsock_c_str(lsock_str, lsock);
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_SYSTEM_SOCKET,25,
+ "not removing : lsock=%s",
+ lsock_str);
+ }
+ return;
+ }
+
+ if(logger_get_log_level(LOG_CAT_L7VSD_SYSTEM_SOCKET) == LOG_LV_DEBUG){
+ char lsock_str[DEBUG_STR_LEN] = {0};
+ l7vs_lsock_c_str(lsock_str, lsock);
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_SYSTEM_SOCKET,26,
+ "removing : lsock=%s",
+ lsock_str);
+ }
+
+ lsock->iom->status = iomux_lsock_destroyed;
+
+ l7vs_iomux_remove(lsock->iom);
+ l7vs_lsock_table_remove(lsock);
+
+ if(lsock->iom->fd > 0)
+ {
+ close(lsock->iom->fd);
+ }
+ l7vs_iomux_put_to_avail_list(lsock->iom);
+
+ if(logger_get_log_level(LOG_CAT_L7VSD_SYSTEM_MEMORY) == LOG_LV_DEBUG){
+ char lsock_str[DEBUG_STR_LEN] = {0};
+ l7vs_lsock_c_str(lsock_str, lsock);
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_SYSTEM_MEMORY,10,
+ "in function l7vs_lsock_put : free lsock=%p",
+ lsock);
+ }
+ free(lsock);
+}
+
+/*!
+ * lsock_list append new lsock ponter
+ * @param[in] lsock to insert table lsock
+ * @return void
+ */
+static void
+l7vs_lsock_table_add(struct l7vs_lsock *lsock)
+{
+ if(logger_get_log_level(LOG_CAT_L7VSD_SYSTEM_SOCKET) == LOG_LV_DEBUG){
+ char lsock_str[DEBUG_STR_LEN] = {0};
+ l7vs_lsock_c_str(lsock_str, lsock);
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_SYSTEM_SOCKET,27,
+ "in_function l7vs_lsock_table_add : add table lsock=%s",
+ lsock_str);
+ }
+ l7vs_lsock_list = g_list_append(l7vs_lsock_list, (gpointer)lsock);
+ if(logger_get_log_level(LOG_CAT_L7VSD_SYSTEM_SOCKET) == LOG_LV_DEBUG){
+ char lsock_str[DEBUG_STR_LEN] = {0};
+ l7vs_lsock_c_str(lsock_str, lsock);
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_SYSTEM_SOCKET,28,
+ "out_function l7vs_lsock_table_add : add table lsock=%s",
+ lsock_str);
+ }
+}
+
+/*!
+ * lsock_list remove lsock (don't free element)
+ * @param[in] to remove lsock
+ * @return void
+ */
+static void
+l7vs_lsock_table_remove(struct l7vs_lsock *lsock)
+{
+ if(logger_get_log_level(LOG_CAT_L7VSD_SYSTEM_SOCKET) == LOG_LV_DEBUG){
+ char lsock_str[DEBUG_STR_LEN] = {0};
+ l7vs_lsock_c_str(lsock_str, lsock);
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_SYSTEM_SOCKET,29,
+ "in_function l7vs_lsock_table_remove : remove table lsock=%s",
+ lsock_str);
+ }
+ l7vs_lsock_list = g_list_remove(l7vs_lsock_list, (gpointer)lsock);
+ if(logger_get_log_level(LOG_CAT_L7VSD_SYSTEM_SOCKET) == LOG_LV_DEBUG){
+ char lsock_str[DEBUG_STR_LEN] = {0};
+ l7vs_lsock_c_str(lsock_str, lsock);
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_SYSTEM_SOCKET,30,
+ "out_function l7vs_lsock_table_remove : remove table lsock=%s",
+ lsock_str);
+ }
+}
+
+
+/*!
+ * look up table for lsock.
+ * @param[in] *sin socketaddr_in struct pointer (ex. to change then IPv6 target )
+ * @param[in] *proto port no
+ * @return *l7vs_lsock
+ */
+struct l7vs_lsock *
+l7vs_lsock_table_lookup(struct sockaddr_in *sin, uint8_t proto)
+{
+ struct l7vs_lsock tmpl;
+ GList *l;
+
+ if(logger_get_log_level(LOG_CAT_L7VSD_SYSTEM_SOCKET) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_SYSTEM_SOCKET,31,
+ "in_fuction: struct l7vs_lsock * l7vs_lsock_table_lookup(struct sockaddr_in *sin, uint8_t proto)"
+ "*sin =%p :proto = %d ",
+ sin,proto);
+ }
+
+ if(sin == NULL)
+ {
+ return NULL;
+ }
+
+ tmpl.addr = *sin;
+ tmpl.proto = proto;
+
+ l = g_list_find_custom(l7vs_lsock_list, (gpointer)&tmpl,
+ l7vs_lsock_addr_cmp);
+ if (l == NULL)
+ return NULL;
+ if(logger_get_log_level(LOG_CAT_L7VSD_SYSTEM_SOCKET) == LOG_LV_DEBUG){
+ char lsock_str[DEBUG_STR_LEN] = {0};
+ l7vs_lsock_c_str(lsock_str, (struct l7vs_lsock *)l->data);
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_SYSTEM_SOCKET,32,
+ "return : lsock=%s",
+ lsock_str);
+ }
+ return (struct l7vs_lsock *)l->data; //for checking up and finding the socket in the list for a particular client socket(not sure)
+}
+
+/*!
+ * using foreach function from Compare
+ * @param a l7vs_lsock pointer
+ * @param b l7vs_lsock pointer
+ * @return compare pattern
+ */
+static gint
+l7vs_lsock_addr_cmp(gconstpointer a, gconstpointer b)
+{
+ struct l7vs_lsock *la = (struct l7vs_lsock *)a;
+ struct l7vs_lsock *lb = (struct l7vs_lsock *)b;
+
+
+ if(logger_get_log_level(LOG_CAT_L7VSD_SYSTEM_SOCKET) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_SYSTEM_SOCKET,33,
+ "in_fuction: gint l7vs_lsock_addr_cmp(gconstpointer a, gconstpointer b)"
+ "a =%p :b = %p ",
+ a,b);
+ }
+
+ if (la->addr.sin_addr.s_addr != lb->addr.sin_addr.s_addr)
+ return la->addr.sin_addr.s_addr - lb->addr.sin_addr.s_addr;
+ if (la->addr.sin_port != lb->addr.sin_port)
+ return la->addr.sin_port - lb->addr.sin_port;
+ if (la->proto != lb->proto)
+ return la->proto - lb->proto;
+
+ if(logger_get_log_level(LOG_CAT_L7VSD_SYSTEM_SOCKET) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_SYSTEM_SOCKET,34,
+ "out_fuction: gint l7vs_lsock_addr_cmp(gconstpointer a, gconstpointer b)"
+ "return = 0");
+ }
+ return 0;
+}
+
+/*!
+ * select VertualService or SorryServer
+ * @param lsock l7vs_lsock pointer
+ * @param conn l7vs_conn pointer
+ * @param buf char pointer
+ * @param len size_t
+ * @param srv_ret l7vs_service pointer pointer
+ * @param dest_ret l7vs_dest pointer pointer
+ * @param tcps_ret int pointer
+ * @return int ok:1 error:-1
+ */
+int
+l7vs_lsock_select_service(struct l7vs_lsock *lsock,
+ struct l7vs_conn *conn,
+ char *buf,
+ size_t len,
+ struct l7vs_service **srv_ret,
+ struct l7vs_dest **dest_ret,
+ int *tcps_ret)
+{
+ GList *l;
+ struct l7vs_service *srv;
+ struct l7vs_dest *dest;
+ int ret, val;
+ int tcps;
+ struct l7vs_service *srv_tmp = NULL; //! temporary for srv
+ struct l7vs_dest *dest_tmp = NULL; //! temporary for dest
+ int tcps_tmp = 1; //! temporary for tcps
+ size_t len_tmp = 0; //! temporary for len
+ int sorry_save = 0; //! sorry dest save flag
+ struct l7vs_service *srv_tmp2 = NULL; //! temporary for srv when match_cldata NG
+ struct l7vs_dest *dest_tmp2 = NULL; //! temporary for dest when match_cldata NG
+ int tcps_tmp2 = 1; //! temporary for tcps when match_cldata NG
+ size_t len_tmp2 = 0; //! temporary for len when match_cldata NG
+ int sorry_save2 = 0; //! sorry dest save flag when match_cldata NG
+
+ if(logger_get_log_level(LOG_CAT_L7VSD_REAL_SERVER) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REAL_SERVER,13,
+ "in_fuction: int l7vs_lsock_select_service(struct l7vs_lsock *lsock,"
+ "struct l7vs_conn *conn,"
+ "char *buf,"
+ "size_t len,"
+ "struct l7vs_service **srv_ret,"
+ "struct l7vs_dest **dest_ret,"
+ "int *tcps_ret)"
+ "lsock :%p, conn :%p buf : %p,len : %zu,",
+ lsock,conn,buf,len);
+
+ }
+ val = -1;
+ l = lsock->srv_list;
+ while (l != NULL) {
+ srv = (struct l7vs_service *)l->data;
+ dest = NULL;
+ tcps = 1;
+ ret = srv->pm->match_cldata(srv, conn, buf, &len, &dest, &tcps);
+ if (ret == 0) {
+ // check sorry status if ret == 0
+ // sorry_check argument 1 means check connection count
+ if (l7vs_sched_sorry_check(srv, 1)) {
+ if (!sorry_save) {
+ // save sorry dest to xxx_tmp only first time
+ srv_tmp = srv;
+ dest_tmp = dest;
+ tcps_tmp = tcps;
+ len_tmp = len;
+ sorry_save = 1;
+ }
+ } else {
+ // check cldata length if sorry_check != 1 (not sorry status)
+ if (len > conn->cldata_len + L7VS_PROTOMOD_MAX_ADD_BUFSIZE) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_SORRY_SERVER,1, "bufsize too long modified by protomod ");
+ } else {
+ // service and destination is decided
+ *srv_ret = srv;
+ *dest_ret = dest;
+ *tcps_ret = tcps;
+ conn->cldata_len = len;
+ sorry_save = 0;
+ sorry_save2 = 0;
+ val = 1;
+ break;
+ }
+ }
+ }
+ // when match_cldata NG
+ if (!sorry_save2) {
+ // save sorry dest to xxx_tmp2 only first time
+ srv_tmp2 = srv;
+ dest_tmp2 = dest;
+ tcps_tmp2 = tcps;
+ len_tmp2 = len;
+ sorry_save2 = 1;
+ }
+ // get next srv from srv_list
+ l = g_list_next(l);
+ }
+
+ if (sorry_save) {
+ // saved sorry dest is exist
+ // set sorry-server destination
+ //*dest_ret = (struct l7vs_dest *)l7vs_sched_sorry_dest(srv_tmp, NULL, 1);
+ *dest_ret = (struct l7vs_dest *)l7vs_sched_sorry_dest(srv_tmp, NULL, 0);
+ if (!*dest_ret) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_SORRY_SERVER,2, "sorry-server dest is NULL");
+ if(logger_get_log_level(LOG_CAT_L7VSD_REAL_SERVER) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REAL_SERVER,14,
+ "in_fuction: int l7vs_lsock_select_service return -1");
+ }
+ return -1;
+ }
+ *srv_ret = srv_tmp;
+ *tcps_ret = tcps_tmp;
+ conn->cldata_len = len_tmp;
+ conn->sorry_conn_flag = 1;
+ val = 1;
+ } else if (sorry_save2) {
+ // saved sorry dest2 is exist
+ // set sorry-server destination
+ //*dest_ret = (struct l7vs_dest *)l7vs_sched_sorry_dest(srv_tmp2, NULL, 1);
+ *dest_ret = (struct l7vs_dest *)l7vs_sched_sorry_dest(srv_tmp2, NULL, 0);
+ if (!*dest_ret) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_SORRY_SERVER,3, "sorry-server dest is NULL");
+ if(logger_get_log_level(LOG_CAT_L7VSD_REAL_SERVER) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REAL_SERVER,15,
+ "in_fuction: int l7vs_lsock_select_service return -1");
+ }
+ return -1;
+ }
+ *srv_ret = srv_tmp2;
+ *tcps_ret = tcps_tmp2;
+ conn->cldata_len = len_tmp2;
+ conn->sorry_conn_flag = 1;
+ val = 1;
+ }
+ // return val=1 service and destination is decided (to real-server or sorry-server)
+ // return val=-1 service and destination not decided (match_cldata result all NG)
+ if(logger_get_log_level(LOG_CAT_L7VSD_REAL_SERVER) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REAL_SERVER,16,
+ "out_fuction: int l7vs_lsock_select_service return %d",val);
+ }
+ return val;
+}
+
+/*!
+ * table add service list
+ * append list memory.
+ * @param[in] void
+ * @return void
+ */
+void
+l7vs_lsock_add_service(struct l7vs_lsock *lsock,
+ struct l7vs_service *srv)
+{
+ if(logger_get_log_level(LOG_CAT_L7VSD_VIRTUAL_SERVICE) == LOG_LV_DEBUG){
+ char lsock_str[DEBUG_STR_LEN] = {0};
+ l7vs_lsock_c_str(lsock_str, lsock);
+
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_VIRTUAL_SERVICE,94,
+ "in_fuction: void l7vs_lsock_add_service(struct l7vs_lsock *lsock,struct l7vs_service *srv)"
+ "lsock: %s,srv : %p",
+ lsock_str,srv);
+ }
+ lsock->srv_list = g_list_append(lsock->srv_list, srv);
+ if (lsock->fast_schedule) {
+ lsock->fast_schedule = srv->pm->fast_schedule;
+ }
+ if(logger_get_log_level(LOG_CAT_L7VSD_VIRTUAL_SERVICE) == LOG_LV_DEBUG){
+ char lsock_str[DEBUG_STR_LEN] = {0};
+ l7vs_lsock_c_str(lsock_str, lsock);
+
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_VIRTUAL_SERVICE,95,
+ "out_fuction: void l7vs_lsock_add_service(struct l7vs_lsock *lsock,struct l7vs_service *srv)"
+ "lsock: %s,srv : %p",
+ lsock_str,srv);
+ }
+}
+
+/*!
+ * table remove from service list
+ * remove list memory.
+ * @param[in] void
+ * @return void
+ */
+void
+l7vs_lsock_remove_service(struct l7vs_lsock *lsock,
+ struct l7vs_service *srv)
+{
+ GList* slist = NULL;
+ if(logger_get_log_level(LOG_CAT_L7VSD_VIRTUAL_SERVICE) == LOG_LV_DEBUG){
+ char lsock_str[DEBUG_STR_LEN] = {0};
+ l7vs_lsock_c_str(lsock_str, lsock);
+
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_VIRTUAL_SERVICE,96,
+ "in_fuction: void l7vs_lsock_remove_service (struct l7vs_lsock *lsock,struct l7vs_service *srv)"
+ "lsock: %s,srv : %p",
+ lsock_str,srv);
+ }
+ lsock->srv_list = g_list_remove(lsock->srv_list, srv);
+ lsock->fast_schedule = 1;
+ for (slist = g_list_first(lsock->srv_list); slist != NULL; slist = slist->next) {
+ struct l7vs_service* s = (struct l7vs_service*) slist->data;
+ if (s != NULL && s->pm != NULL && s->pm->fast_schedule == 0) {
+ lsock->fast_schedule = 0;
+ break;
+ }
+ }
+ if(logger_get_log_level(LOG_CAT_L7VSD_VIRTUAL_SERVICE) == LOG_LV_DEBUG){
+ char lsock_str[DEBUG_STR_LEN] = {0};
+ l7vs_lsock_c_str(lsock_str, lsock);
+
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_VIRTUAL_SERVICE,97,
+ "out_fuction: void l7vs_lsock_remove_service (struct l7vs_lsock *lsock,struct l7vs_service *srv)"
+ "lsock: %s,srv : %p",
+ lsock_str,srv);
+ }
+}
+
+/*!
+ * socket acception function.
+ * @param[in] socket option
+ * @return success = 0 / false = -1
+ */
+static int
+l7vs_lsock_accept(struct l7vs_lsock *lsock)
+{
+ if(lsock == NULL)
+ {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_EVENT,20, "error / lsock is null");
+ if(logger_get_log_level(LOG_CAT_L7VSD_EVENT) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_EVENT,50,
+ "out_fuction: int l7vs_lsock_accept return -1");
+ }
+ return -1;
+ }
+ if(logger_get_log_level(LOG_CAT_L7VSD_EVENT) == LOG_LV_DEBUG){
+ char lsock_str[DEBUG_STR_LEN] = {0};
+ l7vs_lsock_c_str(lsock_str, lsock);
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_EVENT,51,
+ "in_fuction: int l7vs_lsock_accept (struct l7vs_lsock *lsock)"
+ "lsock: %s",
+ lsock_str);
+ }
+ if (iomux_lsock_accepted != lsock->iom->status)
+ {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_EVENT,21, "error / invalid status(%d)", lsock->iom->status);
+ if(logger_get_log_level(LOG_CAT_L7VSD_EVENT) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_EVENT,52,
+ "out_fuction: int l7vs_lsock_accept return -1");
+ }
+ return -1;
+ }
+
+ if (!l7vs_conn_create(lsock->iom->fd, lsock))
+ {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_EVENT,22, "error / conn create failed");
+ lsock->iom->status = iomux_lsock_conn_create_error;
+ if(logger_get_log_level(LOG_CAT_L7VSD_ENVIRONMENT) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_ENVIRONMENT,8,
+ "out_fuction: int l7vs_lsock_accept return -1");
+ }
+ return -1;
+ }
+
+ lsock->iom->status = iomux_lsock_conn_created;
+ if(logger_get_log_level(LOG_CAT_L7VSD_ENVIRONMENT) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_ENVIRONMENT,9,
+ "out_fuction: int l7vs_lsock_accept return 0");
+ }
+ return 0;
+}
+
+/*!
+ * ListeningSocket call back function.
+ * @param[in] socket option
+ * @return success = 0 / false = -1
+ */
+static int
+l7vs_lsock_callback(struct l7vs_iomux *iom )
+{
+
+ int ret;
+
+ if(iom == NULL)
+ {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_EVENT,23, "error / iom is null");
+ if(logger_get_log_level(LOG_CAT_L7VSD_EVENT) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_EVENT,53,
+ "out_fuction: int l7vs_lsock_callback return -1");
+ }
+ return -1;
+ }
+
+ if(logger_get_log_level(LOG_CAT_L7VSD_EVENT) == LOG_LV_DEBUG){
+ char iomux_str[DEBUG_STR_LEN] = {0};
+ l7vs_iomux_c_str(iomux_str,iom);
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_EVENT,54,
+ "in_fuction: int l7vs_lsock_callback (struct l7vs_iomux *iom)"
+ "iom: %s",
+ iomux_str);
+ }
+
+ if (iomux_lsock_connect_waiting != iom->status)
+ {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_EVENT,24, "error / invalid status(%d)", iom->status);
+ if(logger_get_log_level(LOG_CAT_L7VSD_EVENT) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_EVENT,55,
+ "out_fuction: int l7vs_lsock_callback return -1");
+ }
+ return -1;
+ }
+
+ iom->status = iomux_lsock_accepted;
+ ret = l7vs_lsock_accept((struct l7vs_lsock *)iom->data); //for accepting data from clients
+ if (-1 == ret)
+ {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_EVENT,25, "error / lsock accept failed");
+ iom->status = iomux_lsock_connect_waiting;
+ l7vs_iomux_mod( iom, iom_read );
+ if(logger_get_log_level(LOG_CAT_L7VSD_EVENT) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_EVENT,56,
+ "out_fuction: int l7vs_lsock_callback return -1");
+ }
+ return -1;
+ }
+
+ iom->status = iomux_lsock_connect_waiting;
+ l7vs_iomux_mod( iom, iom_read );
+ if(logger_get_log_level(LOG_CAT_L7VSD_EVENT) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_EVENT,57,
+ "out_fuction: int l7vs_lsock_callback return 0");
+ }
+
+ return 0;
+}
+
--- /dev/null
+/*
+ * @file module.c
+ * @brief the framework module of manage shared object
+ * @brief it enables dynamic loading of shared object
+ *
+ * L7VSD: Linux Virtual Server for Layer7 Load Balancing
+ * Copyright (C) 2005 NTT COMWARE Corporation.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ **********************************************************************/
+
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE
+#endif /* _GNU_SOURCE */
+
+#include <sys/param.h>
+#include <sys/types.h>
+#include <dlfcn.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <glib.h>
+#include "logger_wrapper.h"
+#include "l7vs_module.h"
+#include "l7vs.h"
+
+#define L7VS_MODULE_INITFN "init"
+
+#if defined(LOGGER_PROCESS_VSD)
+const LOG_CATEGORY_TAG loggerCategory = LOG_CAT_L7VSD_MODULE;
+const LOG_CATEGORY_TAG loggerCategorySysMem = LOG_CAT_L7VSD_SYSTEM_MEMORY;
+#else
+const LOG_CATEGORY_TAG loggerCategory = LOG_CAT_L7VSADM_MODULE;
+const LOG_CATEGORY_TAG loggerCategorySysMem = LOG_CAT_L7VSADM_COMMON;
+#endif
+
+char l7vs_module_path[MAXPATHLEN];
+
+/*!
+ * Module initialize function.
+ * @param modpath [in] Module directory path.
+ * @retval 0 Success.
+ * @retval -1 Module directory path string is too long.
+ */
+int
+l7vs_module_init(char *modpath)
+{
+ int return_value = 0;
+
+ /*-------- DEBUG LOG --------*/
+ if( LOG_LV_DEBUG == logger_get_log_level( loggerCategory ) ){
+ LOGGER_PUT_LOG_DEBUG(loggerCategory,1,
+ "in_function: int l7vs_module_init(void* modpath): modpath=\"%s\"", modpath);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ if (modpath == NULL) {
+ strcpy(l7vs_module_path, L7VS_MODULE_PATH);
+ } else {
+ if (strlen(modpath) > sizeof(l7vs_module_path) - 1) {
+ return_value = -1;
+ goto init_out;
+ }
+ strcpy(l7vs_module_path, modpath);
+ }
+
+init_out:
+ /*-------- DEBUG LOG --------*/
+ if( LOG_LV_DEBUG == logger_get_log_level( loggerCategory ) ){
+ LOGGER_PUT_LOG_DEBUG(loggerCategory,2,
+ "out_function: int l7vs_module_init(void* modpath): return_value=%d", return_value);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return return_value;
+}
+
+/*!
+ * Module finalize function.
+ */
+void
+l7vs_module_fini(void)
+{
+ /*-------- DEBUG LOG --------*/
+ if( LOG_LV_DEBUG == logger_get_log_level( loggerCategory ) ){
+ LOGGER_PUT_LOG_DEBUG(loggerCategory,3,
+ "in_function: void l7vs_module_fini(void)");
+ }
+ /*------ DEBUG LOG END ------*/
+
+ /*-------- DEBUG LOG --------*/
+ if( LOG_LV_DEBUG == logger_get_log_level( loggerCategory ) ){
+ LOGGER_PUT_LOG_DEBUG(loggerCategory,4,
+ "out_function: void l7vs_module_fini(void)");
+ }
+ /*------ DEBUG LOG END ------*/
+}
+
+/*!
+ * Module load function.
+ * @param modname [in] Module name.
+ * @param type [in] Module type(protomod or sched).
+ * @retern Loaded module struct.
+ */
+void *
+l7vs_module_load(char *modname, char *type)
+{
+ void* h;
+ void* modhandle;
+ char* modpath;
+ void* (*initf)(void *);
+ void* return_value = NULL;
+
+ /*-------- DEBUG LOG --------*/
+ if( LOG_LV_DEBUG == logger_get_log_level( loggerCategory ) ){
+ LOGGER_PUT_LOG_DEBUG(loggerCategory,5,
+ "in_function: void* l7vs_module_load(char* modname, char* type): modname=\"%s\", type=\"%s\"",
+ modname, type);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ /* check null */
+ if (modname == NULL) {
+ LOGGER_PUT_LOG_ERROR(loggerCategory,1,
+ "Arg(modname) is NULL pointer.");
+ goto load_out;
+ }
+ if (type == NULL) {
+ LOGGER_PUT_LOG_ERROR(loggerCategory,2,
+ "Arg(type) is NULL pointer.");
+ goto load_out;
+ }
+
+ modpath = (char *) malloc(strlen(l7vs_module_path) + strlen(type) + strlen(modname) + 6);
+
+ /*-------- DEBUG LOG --------*/
+ if( LOG_LV_DEBUG == logger_get_log_level( loggerCategorySysMem ) ){
+ LOGGER_PUT_LOG_DEBUG(loggerCategorySysMem,11, "malloc: addr=%p, size=%ld",
+ modpath, (unsigned long int) strlen(l7vs_module_path) + strlen(type) + strlen(modname) + 6);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ if (modpath == NULL) {
+ LOGGER_PUT_LOG_ERROR(loggerCategorySysMem,15,
+ "Could not allocate memory.");
+ goto load_out;
+ }
+ sprintf(modpath, "%s/%s_%s.so", l7vs_module_path, type, modname);
+
+ h = dlopen(modpath, RTLD_LAZY);
+ if (h == NULL) {
+ LOGGER_PUT_LOG_ERROR(loggerCategory,3,
+ "Could not open %s module: %s", modpath, dlerror());
+
+ /*-------- DEBUG LOG --------*/
+ if( LOG_LV_DEBUG == logger_get_log_level( loggerCategorySysMem ) ){
+ LOGGER_PUT_LOG_DEBUG(loggerCategorySysMem,12, "free: %p", modpath);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ free(modpath);
+ modpath = NULL;
+ goto load_out;
+ }
+
+ /*-------- DEBUG LOG --------*/
+ if( LOG_LV_DEBUG == logger_get_log_level( loggerCategorySysMem ) ){
+ LOGGER_PUT_LOG_DEBUG(loggerCategorySysMem,13, "free: %p", modpath);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ free(modpath);
+ modpath = NULL;
+
+ *(void **) (&initf) = dlsym(h, L7VS_MODULE_INITFN);
+ if (initf == NULL) {
+ LOGGER_PUT_LOG_ERROR(loggerCategory,4,
+ "Could not find symbol %s: %s", L7VS_MODULE_INITFN, dlerror());
+ dlclose(h);
+ goto load_out;
+ }
+
+ modhandle = (*initf)(h);
+ if (modhandle == NULL) {
+ LOGGER_PUT_LOG_ERROR(loggerCategory,5,
+ "Module initialization failed.");
+ dlclose(h);
+ goto load_out;
+ }
+
+ return_value = modhandle;
+
+load_out:
+ /*-------- DEBUG LOG --------*/
+ if( LOG_LV_DEBUG == logger_get_log_level( loggerCategory ) ){
+ LOGGER_PUT_LOG_DEBUG(loggerCategory,6,
+ "out_function: void* l7vs_module_load(char* modname, char* type): return_value=%p",
+ return_value);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return return_value;
+}
+
+/*!
+ * Module unload function.
+ * @param handle [in] Module handle.
+ */
+void
+l7vs_module_unload(void *handle)
+{
+ /*-------- DEBUG LOG --------*/
+ if( LOG_LV_DEBUG == logger_get_log_level( loggerCategory ) ){
+ LOGGER_PUT_LOG_DEBUG(loggerCategory,7,
+ "in_function: void l7vs_module_unload(void* handle): handle=%p", handle);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ /* check null */
+ if (handle == NULL) {
+ LOGGER_PUT_LOG_ERROR(loggerCategory,6,
+ "Arg(handle) is NULL pointer.");
+ goto unload_out;
+ }
+ dlclose(handle);
+
+unload_out:
+ /*-------- DEBUG LOG --------*/
+ if( LOG_LV_DEBUG == logger_get_log_level( loggerCategory ) ){
+ LOGGER_PUT_LOG_DEBUG(loggerCategory,8,
+ "out_function: void l7vs_module_unload(void* handle)");
+ }
+ /*------ DEBUG LOG END ------*/
+}
+
+/*!
+ * Register module to list function.
+ * @param modlist [in,out] Registerd module list.
+ * @param mod [in] Loaded module.
+ */
+void
+l7vs_module_register(GList **modlist, void *mod)
+{
+ /*-------- DEBUG LOG --------*/
+ if( LOG_LV_DEBUG == logger_get_log_level( loggerCategory ) ){
+ LOGGER_PUT_LOG_DEBUG(loggerCategory,9,
+ "in_function: void l7vs_module_register(GList** modlist, void* mod): "
+ "modlist=%p, mod=%p", modlist, mod);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ /* check null */
+ if (modlist == NULL) {
+ LOGGER_PUT_LOG_ERROR(loggerCategory,7,
+ "Arg(modlist) is NULL pointer.");
+ goto register_out;
+ }
+ if (mod == NULL) {
+ LOGGER_PUT_LOG_ERROR(loggerCategory,8,
+ "Arg(mod) is NULL pointer.");
+ goto register_out;
+ }
+ *modlist = g_list_append(*modlist, (gpointer)mod);
+
+register_out:
+ /*-------- DEBUG LOG --------*/
+ if( LOG_LV_DEBUG == logger_get_log_level( loggerCategory ) ){
+ LOGGER_PUT_LOG_DEBUG(loggerCategory,10,
+ "out_function: void l7vs_module_register(GList** modlist, void* mod)");
+ }
+ /*------ DEBUG LOG END ------*/
+}
+
+/*!
+ * Remove module from list function.
+ * @param modlist [in,out] Registerd module list.
+ * @param mod [in] Loaded module.
+ */
+void
+l7vs_module_remove(GList **modlist, void *mod)
+{
+ /*-------- DEBUG LOG --------*/
+ if( LOG_LV_DEBUG == logger_get_log_level( loggerCategory ) ){
+ LOGGER_PUT_LOG_DEBUG(loggerCategory,11,
+ "in_function: void l7vs_module_remove(GList** modlist, void* mod): "
+ "modlist=%p, mod=%p", modlist, mod);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ /* check null */
+ if (modlist == NULL) {
+ LOGGER_PUT_LOG_ERROR(loggerCategory,9,
+ "Arg(modlist) is NULL pointer.");
+ goto remove_out;
+ }
+ if (mod == NULL) {
+ LOGGER_PUT_LOG_ERROR(loggerCategory,10,
+ "Arg(mod) is NULL pointer.");
+ goto remove_out;
+ }
+ *modlist = g_list_remove(*modlist, mod);
+
+remove_out:
+ /*-------- DEBUG LOG --------*/
+ if( LOG_LV_DEBUG == logger_get_log_level( loggerCategory ) ){
+ LOGGER_PUT_LOG_DEBUG(loggerCategory,12,
+ "out_function: void l7vs_module_remove(GList** modlist, void* mod)");
+ }
+ /*------ DEBUG LOG END ------*/
+}
+
+/*!
+ * Lookup module from list function.
+ * @param modname [in] Module name.
+ * @param key [in] Lookup keyword.
+ * @param cmp [in] Lookup function.
+ * @retern Found module.
+ */
+void *
+l7vs_module_lookup(GList *modlist, void *key, GCompareFunc cmp)
+{
+ /*-------- DEBUG LOG --------*/
+ if( LOG_LV_DEBUG == logger_get_log_level( loggerCategory ) ){
+ LOGGER_PUT_LOG_DEBUG(loggerCategory,13,
+ "in_function: void* l7vs_module_lookup(GList* modlist, void* key, GCompareFunc cmp): "
+ "modlist=%p, key=%p, cmp=%p", modlist, key, cmp);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ GList* l;
+ void* return_value = NULL;
+
+ /* check null */
+ if (modlist == NULL) {
+ goto lookup_out;
+ }
+ if (key == NULL) {
+ LOGGER_PUT_LOG_ERROR(loggerCategory,12,
+ "Arg(key) is NULL pointer.");
+ goto lookup_out;
+ }
+ if (cmp == NULL) {
+ LOGGER_PUT_LOG_ERROR(loggerCategory,13,
+ "Arg(cmp) is NULL pointer.");
+ goto lookup_out;
+ }
+
+ l = g_list_find_custom(modlist, (gpointer)key, cmp);
+ if (l == NULL) {
+ goto lookup_out;
+ }
+ return_value = (void *)l->data;
+
+lookup_out:
+ /*-------- DEBUG LOG --------*/
+ if( LOG_LV_DEBUG == logger_get_log_level( loggerCategory ) ){
+ LOGGER_PUT_LOG_DEBUG(loggerCategory,14,
+ "out_function: void* l7vs_module_lookup(GList* modlist, void* key, GCompareFunc cmp): "
+ "return_value=%p", return_value);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return return_value;
+}
--- /dev/null
+/*
+ * @file protomod.c
+ * @brief the framework module of protocol module
+ * @brief it proceeds common function of protocol module
+ *
+ * L7VSD: Linux Virtual Server for Layer7 Load Balancing
+ * Copyright (C) 2005 NTT COMWARE Corporation.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ **********************************************************************/
+
+#include <string.h>
+#include <sys/types.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <glib.h>
+#include <map>
+
+#include "l7vs_module.h"
+#include "l7vs_dest.h"
+#include "l7vs_service.h"
+#include "l7vs_sched.h"
+#include "l7vs_conn.h"
+#include "l7vs_replication.h"
+#include "logger_wrapper.h"
+
+#if defined(LOGGER_PROCESS_VSD)
+const LOG_CATEGORY_TAG log_cat_protocol = LOG_CAT_L7VSD_PROTOCOL;
+#else
+const LOG_CATEGORY_TAG log_cat_protocol = LOG_CAT_L7VSADM_PROTOCOL;
+#endif
+
+static struct l7vs_protomod *l7vs_protomod_load(char *modname);
+static void l7vs_protomod_unload(struct l7vs_protomod *pmod);
+static gint l7vs_protomod_cmp(struct l7vs_protomod *pmod, char *name);
+
+static int protomod_initialize(struct l7vs_service *srv, struct l7vs_conn *conn ,char *buf ,size_t len , struct l7vs_dest **dest);
+static int protomod_finalize(struct l7vs_service *srv, struct l7vs_conn *conn ,char *buf , size_t len , struct l7vs_dest **dest, int resched);
+
+static GList *l7vs_protomod_list = NULL;
+
+typedef std::map<LOG_CATEGORY_TAG,LOG_CATEGORY_TAG> log_category_map;
+
+log_category_map module_logcategory_map;
+static enum LOG_LEVEL_TAG protomod_getloglevel( const enum LOG_CATEGORY_TAG );
+static void protomod_log_debug( const enum LOG_CATEGORY_TAG,
+ const unsigned int,
+ char*,
+ int,
+ const char* );
+static void protomod_log_info( const enum LOG_CATEGORY_TAG,
+ const unsigned int,
+ char*,
+ int,
+ const char* );
+static void protomod_log_warn( const enum LOG_CATEGORY_TAG,
+ const unsigned int,
+ char*,
+ int,
+ const char* );
+static void protomod_log_error( const enum LOG_CATEGORY_TAG,
+ const unsigned int,
+ char*,
+ int,
+ const char* );
+static void protomod_log_fatal( const enum LOG_CATEGORY_TAG,
+ const unsigned int,
+ char*,
+ int,
+ const char* );
+
+/*!
+ * Protocol module get function.
+ * @param name [in] Protocol module name.
+ * @return Got protocol module.
+ */
+struct l7vs_protomod *
+l7vs_protomod_get(char *name)
+{
+ struct l7vs_protomod *pmod = NULL;
+
+ /*-------- DEBUG LOG --------*/
+ if( LOG_LV_DEBUG == logger_get_log_level( log_cat_protocol ) ){
+ LOGGER_PUT_LOG_DEBUG(log_cat_protocol,1,
+ "in_function: struct l7vs_protomod* l7vs_protomod_get(char* name): name=\"%s\"", name);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ /* check null */
+ if (name == NULL) {
+ LOGGER_PUT_LOG_ERROR(log_cat_protocol,2,
+ "Arg(name) is NULL pointer.");
+ goto get_out;
+ }
+
+ /* lookup from loaded module list */
+ pmod = l7vs_protomod_lookup(name);
+ if (pmod == NULL) {
+ /* load */
+ pmod = l7vs_protomod_load(name);
+ if (pmod == NULL) {
+ LOGGER_PUT_LOG_ERROR(log_cat_protocol,3,
+ "Protocol module not found (maybe module problem)");
+ goto get_out;
+ }
+ pmod->refcnt = 0;
+ }
+
+ pmod->refcnt++;
+
+get_out:
+ /*-------- DEBUG LOG --------*/
+ if( LOG_LV_DEBUG == logger_get_log_level( log_cat_protocol ) ){
+ LOGGER_PUT_LOG_DEBUG(log_cat_protocol,2,
+ "out_function: struct l7vs_protomod* l7vs_protomod_get(char* name): return_value=%p", pmod);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return pmod;
+}
+
+/*!
+ * Protocol module put function.
+ * @param pmod [in] Protocol module.
+ */
+void
+l7vs_protomod_put(struct l7vs_protomod *pmod)
+{
+ /*-------- DEBUG LOG --------*/
+ if( LOG_LV_DEBUG == logger_get_log_level( log_cat_protocol ) ){
+ LOGGER_PUT_LOG_DEBUG(log_cat_protocol,3,
+ "in_function: void l7vs_protomod_put(struct l7vs_protomod* pmod): pmod=%p", pmod);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ /* check null */
+ if (pmod == NULL) {
+ LOGGER_PUT_LOG_ERROR(log_cat_protocol,4,
+ "Arg(pmod) is NULL pointer.");
+ goto put_out;
+ }
+
+ if (--pmod->refcnt <= 0) {
+ l7vs_module_remove(&l7vs_protomod_list, pmod);
+ l7vs_protomod_unload(pmod);
+ }
+
+put_out:
+ /*-------- DEBUG LOG --------*/
+ if( LOG_LV_DEBUG == logger_get_log_level( log_cat_protocol ) ){
+ LOGGER_PUT_LOG_DEBUG(log_cat_protocol,4,
+ "out_function: void l7vs_protomod_put(struct l7vs_protomod* pmod)");
+ }
+ /*------ DEBUG LOG END ------*/
+
+}
+
+/*!
+ * Protocol module load function.
+ * @param modname [in] Protocol module name.
+ * @retern Loaded protocol module struct.
+ */
+static struct l7vs_protomod *
+l7vs_protomod_load(char *modname)
+{
+ struct l7vs_protomod *pmod = NULL;
+
+#if defined(LOGGER_PROCESS_ADM)
+ if( module_logcategory_map.empty() ){//make category convert table
+ module_logcategory_map[LOG_CAT_L7VSD_PROTOCOL] = LOG_CAT_L7VSADM_PROTOCOL;
+ module_logcategory_map[LOG_CAT_L7VSD_SYSTEM_MEMORY] = LOG_CAT_L7VSADM_COMMON;
+ }
+#else
+ if( module_logcategory_map.empty() ){
+ module_logcategory_map[LOG_CAT_L7VSD_PROTOCOL] =LOG_CAT_L7VSD_PROTOCOL;
+ module_logcategory_map[LOG_CAT_L7VSD_SYSTEM_MEMORY] =LOG_CAT_L7VSD_SYSTEM_MEMORY;
+ }
+#endif
+ /*-------- DEBUG LOG --------*/
+ if( LOG_LV_DEBUG == logger_get_log_level( log_cat_protocol ) ){
+ LOGGER_PUT_LOG_DEBUG( log_cat_protocol,5,
+ "in_function: struct l7vs_protomod* l7vs_protomod_load(char* modname): modname=\"%s\"", modname);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ /* check null */
+ if (modname == NULL) {
+ LOGGER_PUT_LOG_ERROR(log_cat_protocol,5,
+ "Arg(modname) is NULL pointer.");
+ goto load_out;
+ }
+
+ pmod = (struct l7vs_protomod *)l7vs_module_load(modname, "protomod");
+
+ if (pmod == NULL) {
+ LOGGER_PUT_LOG_ERROR(log_cat_protocol,6,
+ "Module load error.");
+ goto load_out;
+ }
+ pmod->initialize = protomod_initialize;
+ pmod->finalize = protomod_finalize;
+
+#if 0
+ pmod->get_log_level = logger_get_log_level;
+ pmod->put_log_debug = logger_put_log_debug;
+ pmod->put_log_info = logger_put_log_info;
+ pmod->put_log_warn = logger_put_log_warn;
+ pmod->put_log_error = logger_put_log_error;
+ pmod->put_log_debug = logger_put_log_debug;
+#endif
+ pmod->get_log_level = protomod_getloglevel;
+ pmod->put_log_debug = protomod_log_debug;
+ pmod->put_log_info = protomod_log_info;
+ pmod->put_log_warn = protomod_log_warn;
+ pmod->put_log_error = protomod_log_error;
+ pmod->put_log_fatal = protomod_log_fatal;
+
+#ifndef LOGGER_PROCESS_ADM
+ pmod->replication_pay_memory = l7vs_replication_pay_memory;
+#endif
+
+ l7vs_module_register(&l7vs_protomod_list, pmod);
+
+load_out:
+ /*-------- DEBUG LOG --------*/
+ if( LOG_LV_DEBUG == logger_get_log_level( log_cat_protocol ) ){
+ LOGGER_PUT_LOG_DEBUG(log_cat_protocol,6,
+ "out_function: struct l7vs_protomod* l7vs_protomod_load(char* modname): return_value=%p", pmod);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return pmod;
+}
+
+/*!
+ * Protocol module unload function.
+ * @param pmod [in] Protocol module.
+ */
+static void
+l7vs_protomod_unload(struct l7vs_protomod *pmod)
+{
+ void *h;
+
+ /*-------- DEBUG LOG --------*/
+ if( LOG_LV_DEBUG == logger_get_log_level( log_cat_protocol ) ){
+ LOGGER_PUT_LOG_DEBUG(log_cat_protocol,7,
+ "in_function: void l7vs_protomod_unload(struct l7vs_protomod* pmod): pmod=%p", pmod);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ /* check null */
+ if (pmod == NULL) {
+ LOGGER_PUT_LOG_ERROR(log_cat_protocol,7,
+ "Arg(pmod) is NULL pointer.");
+ goto unload_out;
+ }
+
+ h = pmod->handle;
+ if (pmod->fini != NULL) {
+ pmod->fini();
+ }
+ l7vs_module_unload(h);
+
+unload_out:
+ /*-------- DEBUG LOG --------*/
+ if( LOG_LV_DEBUG == logger_get_log_level( log_cat_protocol ) ){
+ LOGGER_PUT_LOG_DEBUG(log_cat_protocol,8,
+ "out_function: void l7vs_protomod_unload(struct l7vs_protomod* pmod)");
+ }
+ /*------ DEBUG LOG END ------*/
+}
+
+/*!
+ * Protocol module lookup function.
+ * @param modname [in] Protocol module name.
+ * @retern Found protocol module struct.
+ */
+struct l7vs_protomod *
+l7vs_protomod_lookup(char *modname)
+{
+ struct l7vs_protomod* pmod = NULL;
+
+ /*-------- DEBUG LOG --------*/
+ if( LOG_LV_DEBUG == logger_get_log_level( log_cat_protocol ) ){
+ LOGGER_PUT_LOG_DEBUG(log_cat_protocol,9,
+ "in_function: struct l7vs_protomod* l7vs_protomod_lookup(char* modname): "
+ "modname=\"%s\"", modname);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ /* check null */
+ if (modname == NULL) {
+ LOGGER_PUT_LOG_ERROR(log_cat_protocol,8,
+ "Arg(modname) is NULL pointer.");
+ goto lookup_out;
+ }
+
+ pmod = (struct l7vs_protomod *) l7vs_module_lookup(l7vs_protomod_list, modname,
+ (GCompareFunc) l7vs_protomod_cmp);
+
+lookup_out:
+ /*-------- DEBUG LOG --------*/
+ if( LOG_LV_DEBUG == logger_get_log_level( log_cat_protocol ) ){
+ LOGGER_PUT_LOG_DEBUG(log_cat_protocol,10,
+ "out_function: struct l7vs_protomod* l7vs_protomod_load(char* modname): "
+ "return_value=%p", pmod);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return pmod;
+}
+
+/*!
+ * Protocol module name compare function.
+ * @param pmod [in] Protocol module.
+ * @param name [in] Protocol module name.
+ * @retval 0 Match.
+ * @retval <0, >0 Not match.
+ */
+static gint
+l7vs_protomod_cmp(struct l7vs_protomod *pmod, char *name)
+{
+ gint return_value;
+
+ /*-------- DEBUG LOG --------*/
+ if( LOG_LV_DEBUG == logger_get_log_level( log_cat_protocol ) ){
+ LOGGER_PUT_LOG_DEBUG(log_cat_protocol,11,
+ "in_function: gint l7vs_protomod_cmp(struct l7vs_protomod* pmod, char* name): "
+ "pmod=%p, name=\"%s\"", pmod, name);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ /* check null */
+ if (pmod == NULL) {
+ LOGGER_PUT_LOG_ERROR(log_cat_protocol,9,
+ "Arg(pmod) is NULL pointer.");
+ return_value = -1;
+ goto cmp_out;
+ }
+ if (name == NULL) {
+ LOGGER_PUT_LOG_ERROR(log_cat_protocol,10,
+ "Arg(name) is NULL pointer.");
+ return_value = -1;
+ goto cmp_out;
+ }
+
+ return_value = strcmp(pmod->modname, name);
+
+cmp_out:
+ /*-------- DEBUG LOG --------*/
+ if( LOG_LV_DEBUG == logger_get_log_level( log_cat_protocol ) ){
+ LOGGER_PUT_LOG_DEBUG(log_cat_protocol,12,
+ "out_function: gint l7vs_protomod_cmp(struct l7vs_protomod* pmod, char* name): "
+ "return_value=%d", return_value);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return return_value;
+}
+
+/*!
+ * Protocol module initialize function.
+ * @param srv [in] Virtual service struct.
+ * @param conn [in] Client connection struct.
+ * @param buf [in] Client request payload.
+ * @param len [in] Length of client request payload.
+ * @param dest [out] Destination struct list.
+ * @retval 0 Success.
+ * @retval -1 Error.
+ */
+static int
+protomod_initialize(struct l7vs_service *srv, struct l7vs_conn *conn, char *buf, size_t len, struct l7vs_dest **dest)
+{
+ int return_value = 0;
+
+ /*-------- DEBUG LOG --------*/
+ if( LOG_LV_DEBUG == logger_get_log_level( log_cat_protocol ) ){
+ char srv_str[DEBUG_STR_LEN] = {0};
+ char conn_str[DEBUG_STR_LEN] = {0};
+ char dest_str[DEBUG_STR_LEN] = {0};
+ l7vs_service_c_str(srv_str, srv);
+ l7vs_conn_c_str(conn_str, conn);
+ if (dest == NULL) {
+ strncpy(dest_str, "NULL", DEBUG_STR_LEN);
+ }
+ else {
+ l7vs_dest_c_str(dest_str, *dest);
+ }
+ LOGGER_PUT_LOG_DEBUG(log_cat_protocol,13,
+ "in_function: int protomod_initialize(struct l7vs_service* srv, struct l7vs_conn* conn, "
+ "char* buf, size_t len, struct l7vs_dest** dest): srv=&(%s), conn=&(%s), buf=\"%s\", "
+ "len=%ld, dest=&(&(%s))", srv_str, conn_str, buf, (long int)len, dest_str);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ /* check null */
+ if (dest == NULL) {
+ LOGGER_PUT_LOG_ERROR(log_cat_protocol,11,
+ "Arg(dest) is NULL pointer.");
+ return_value = -1;
+ goto initialize_out;
+ }
+
+ /* clean up destination list */
+ *dest = NULL;
+
+initialize_out:
+ /*-------- DEBUG LOG --------*/
+ if( LOG_LV_DEBUG == logger_get_log_level( log_cat_protocol ) ){
+ LOGGER_PUT_LOG_DEBUG(log_cat_protocol,14,
+ "out_function: int protomod_initialize(struct l7vs_service* srv, struct l7vs_conn* conn, "
+ "char* buf, size_t len, struct l7vs_dest** dest): return_value=%d", return_value);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return return_value;
+}
+
+/*!
+ * Protocol module finalize function.
+ * @param srv [in] Virtual service struct.
+ * @param conn [in] Client connection struct.
+ * @param buf [in] Client request payload.
+ * @param len [in] Length of client request payload.
+ * @param dest [out] Destination struct list.
+ * @retval 0 Success.
+ * @retval -1 Error.
+ */
+static int
+protomod_finalize(struct l7vs_service *srv, struct l7vs_conn *conn, char *buf, size_t len, struct l7vs_dest **dest, int resched)
+{
+ GList *l;
+ struct l7vs_dest *d;
+ GList *active_dest = NULL;
+ int return_value = 0;
+
+ /*-------- DEBUG LOG --------*/
+ if( LOG_LV_DEBUG == logger_get_log_level( log_cat_protocol ) ){
+ char srv_str[DEBUG_STR_LEN] = {0};
+ char conn_str[DEBUG_STR_LEN] = {0};
+ char dest_str[DEBUG_STR_LEN] = {0};
+ l7vs_service_c_str(srv_str, srv);
+ l7vs_conn_c_str(conn_str, conn);
+ if (dest == NULL) {
+ strncpy(dest_str, "NULL", DEBUG_STR_LEN);
+ }
+ else {
+ l7vs_dest_c_str(dest_str, *dest);
+ }
+ LOGGER_PUT_LOG_DEBUG(log_cat_protocol,15,
+ "in_function: int protomod_finalize(struct l7vs_service* srv, struct l7vs_conn* conn, "
+ "char* buf, size_t len, struct l7vs_dest** dest, int resched): srv=&(%s), conn=&(%s), buf=\"%s\", "
+ "len=%ld, dest=&(&(%s)), resched=%d", srv_str, conn_str, buf, (long int)len, dest_str, resched);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ /* check null */
+ if (srv == NULL) {
+ LOGGER_PUT_LOG_ERROR(log_cat_protocol,12,
+ "Arg(srv) is NULL pointer.");
+ return_value = -1;
+ goto finalize_out;
+ }
+ if (dest == NULL) {
+ LOGGER_PUT_LOG_ERROR(log_cat_protocol,13,
+ "Arg(dest) is NULL pointer.");
+ return_value = -1;
+ goto finalize_out;
+ }
+
+ // pick up active real server (weight > 0)
+ for (l = g_list_first(srv->dest_list); l != NULL; l = g_list_next(l)) {
+ d = (struct l7vs_dest*) l->data;
+ if (d->weight > 0) {
+ active_dest = g_list_append(active_dest, l->data);
+ }
+ }
+
+ if((*dest) != NULL ){
+ // check dest whether it exists in active real server list
+ for( l = g_list_first(active_dest); l != NULL; l = g_list_next(l) ){
+ d = (struct l7vs_dest*) l->data;
+ if((d->addr.sin_addr.s_addr == (*dest)->addr.sin_addr.s_addr ) &&
+ (d->addr.sin_port == (*dest)->addr.sin_port) ){
+ *dest = d;
+ goto finalize_out;
+ }
+ }
+
+ // no reschedule
+ if( resched == 0 ){
+ LOGGER_PUT_LOG_INFO(log_cat_protocol,1, "RealServer nonexistence.");
+ return_value = -1;
+ goto finalize_out;
+ }
+
+ // reschedule
+ *dest = srv->scheduler->schedule(srv, conn);
+
+ if( *dest == NULL ){
+ LOGGER_PUT_LOG_INFO(log_cat_protocol,2, "RealServer nonexistence.");
+ return_value = -1;
+ goto finalize_out;
+ }
+ }
+ else{
+ // schedule
+ *dest = srv->scheduler->schedule(srv, conn);
+
+ if( *dest == NULL ){
+ LOGGER_PUT_LOG_INFO(log_cat_protocol,3, "RealServer nonexistence.");
+ return_value = -1;
+ goto finalize_out;
+ }
+ }
+
+finalize_out:
+ g_list_free(active_dest);
+
+ /*-------- DEBUG LOG --------*/
+ if( LOG_LV_DEBUG == logger_get_log_level( log_cat_protocol ) ){
+ LOGGER_PUT_LOG_DEBUG(log_cat_protocol,16,
+ "out_function: int protomod_finalize(struct l7vs_service* srv, struct l7vs_conn* conn, "
+ "char* buf, size_t len, struct l7vs_dest** dest, int resched): return_value=%d", return_value);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return return_value;
+}
+
+
+/**
+ * log getter local function
+ *
+ **/
+static enum LOG_LEVEL_TAG protomod_getloglevel( const enum LOG_CATEGORY_TAG cat ){
+ log_category_map::iterator itr = module_logcategory_map.find( cat );
+ if( itr != module_logcategory_map.end() ){
+ return logger_get_log_level( itr->second );
+ }
+ else{
+ itr = module_logcategory_map.begin();
+ return logger_get_log_level( itr->second );
+ }
+}
+
+static void protomod_log_debug( const enum LOG_CATEGORY_TAG cat,
+ const unsigned int message_id,
+ char* file,
+ int line,
+ const char* message ){
+ log_category_map::iterator itr = module_logcategory_map.find( cat );
+ if( itr == module_logcategory_map.end() )
+ itr = module_logcategory_map.begin();
+ logger_put_log_debug( itr->second, message_id, file, line, message );
+}
+
+static void protomod_log_info( const enum LOG_CATEGORY_TAG cat,
+ const unsigned int message_id,
+ char* file,
+ int line,
+ const char* message ){
+ log_category_map::iterator itr = module_logcategory_map.find( cat );
+ if( itr == module_logcategory_map.end() )
+ itr = module_logcategory_map.begin();
+ logger_put_log_info( itr->second, message_id, file, line, message );
+}
+
+static void protomod_log_warn( const enum LOG_CATEGORY_TAG cat,
+ const unsigned int message_id,
+ char* file,
+ int line,
+ const char* message ){
+ log_category_map::iterator itr = module_logcategory_map.find( cat );
+ if( itr == module_logcategory_map.end() )
+ itr = module_logcategory_map.begin();
+ logger_put_log_warn( itr->second, message_id, file, line, message );
+}
+
+static void protomod_log_error( const enum LOG_CATEGORY_TAG cat,
+ const unsigned int message_id,
+ char* file,
+ int line,
+ const char* message ){
+ log_category_map::iterator itr = module_logcategory_map.find( cat );
+ if( itr == module_logcategory_map.end() )
+ itr = module_logcategory_map.begin();
+ logger_put_log_error( itr->second, message_id, file, line, message );
+}
+
+static void protomod_log_fatal( const enum LOG_CATEGORY_TAG cat,
+ const unsigned int message_id,
+ char* file,
+ int line,
+ const char* message ){
+ log_category_map::iterator itr = module_logcategory_map.find( cat );
+ if( itr == module_logcategory_map.end() )
+ itr = module_logcategory_map.begin();
+ logger_put_log_fatal( itr->second, message_id, file, line, message );
+}
--- /dev/null
+/*! @file
+ * @brief Replication structure program
+ *
+ * @author NTT COMWARE
+ * @date
+ * @version
+ */
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <stdint.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <sys/time.h>
+#include <sys/ioctl.h>
+#include <time.h>
+#include <netdb.h>
+#include <errno.h>
+#include "logger_wrapper.h"
+#include "parameter_wrapper.h"
+#include "l7vs_replication.h"
+#include "l7vs_iom.h"
+#include "l7vs_iomuxlist.h"
+
+#include <net/if.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include <iostream>
+#include <limits.h>
+
+//---------- Initial set value
+
+//! Initial value of Essential information set to SG file.
+
+
+static struct l7vs_replication_info replication_info;
+
+//! Initial value of Replication status
+static struct l7vs_replication_state replication_state = {
+ REPLICATION_OUT,
+ 0,
+ 0,
+ 0,
+ 0,
+ NULL,
+ NULL,
+ 0,
+ NULL
+};
+//! iomux structure
+static struct l7vs_iomux *l7vs_replication_iomux = NULL;
+
+//! recv sock
+struct addressinfo{
+ struct sockaddr_in addr_in;
+ struct sockaddr_in6 addr_in6;
+};
+
+struct addressinfo addr;
+
+//! Internal value structure
+struct replication_internal_val
+{
+ int socket; //!< Opened socket file descriptor
+ struct addrinfo *address_info; //!< Socket property internal_val
+ struct addressinfo addr;
+};
+
+
+static struct replication_internal_val internal_val = {
+ -1,
+ NULL,
+ addr
+};
+
+//! emun States Type string
+static char replication_mode[6][24] = {
+ "REPLICATION_OUT",
+ "REPLICATION_SINGLE",
+ "REPLICATION_MASTER",
+ "REPLICATION_SLAVE",
+ "REPLICATION_MASTER_STOP",
+ "REPLICATION_SLAVE_STOP"
+};
+
+// Initialize network socket
+static int l7vs_replication_send_sock_init();
+// Initialize network socket
+static int l7vs_replication_recv_sock_init();
+// Finalize network socket
+static void l7vs_replication_sock_fini();
+// Set master mode to iomux
+static int l7vs_replication_set_master();
+// Set slave mode to iomux
+static int l7vs_replication_set_slave();
+// Obtain the memory the replication is done
+static void *l7vs_replication_get_replication_address();
+// Release replication memory
+static void l7vs_replication_release_replication_address();
+// The memory the component uses
+static void *l7vs_replication_get_component_address();
+// Release component memory
+static void l7vs_replication_release_components_address();
+// The memory with information on respect switch
+static uint64_t *l7vs_replication_get_surface_info_address();
+// Release memory of information on respect switch
+static void l7vs_replication_release_surface_info_address();
+// get value check
+static int l7vs_replication_check_parameter();
+// make serial
+static unsigned long long l7vs_replication_make_serial();
+// send
+static int l7vs_replication_send_data(struct l7vs_replication_data *replication_data);
+// recve
+static int l7vs_replication_recv_data(struct l7vs_replication_data *replication_data);
+// get ip from nic
+static int getNICAddressInfo( const char* nicname, struct addressinfo* info );
+
+
+//---------- Debug Function declaration
+static void l7vs_replication_data_c_str(char *ret, struct l7vs_replication_data *replication_data);
+static void l7vs_replication_component_c_str(char *ret, struct l7vs_replication_component *component_info, int i);
+static void l7vs_replication_state_c_str(char *ret, struct l7vs_replication_state *replication_state);
+static void l7vs_replication_info_c_str(char *ret, struct l7vs_replication_info *replication_info);
+static void sockaddr_in_c_str(char *ret, struct sockaddr_in *addr_in);
+
+/*! Initialize Replication
+ *
+ * @return 0/-1
+ * @retval 0 Success
+ * @retval -1 Error
+ *
+ */
+
+int l7vs_replication_init()
+{
+ int component_num = 0;
+ int ret = -1;
+ int ip_addr_ret = -1;
+ int service_name_ret = -1;
+ int nic_ret = -1;
+ int interval_ret = -1;
+
+ // Check by continuous initialize.
+ if ( REPLICATION_OUT != replication_state.service_status )
+ {
+ // Initialization has already been done.
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_REPLICATION,1, "Initialization is a failure, because nitialization has already been done. mode : %s",
+ replication_mode[(int)replication_state.service_status]);
+ ret = -1;
+ goto END;
+ }
+
+ memset(&replication_info, 0, sizeof(struct l7vs_replication_info));
+
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,1, "in_function : int l7vs_replication_init(void)");
+ }
+ // Debug log END
+
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG)
+ {
+ char replication_state_str[DEBUG_STR_LEN] = {0};
+ l7vs_replication_state_c_str(replication_state_str,&replication_state);
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,2,
+ "set_l7vs_replication_state_struct : %s",
+ replication_state_str);
+
+ char replication_info_str[DEBUG_STR_LEN] = {0};
+ l7vs_replication_info_c_str(replication_info_str,&replication_info);
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,3,
+ "set_l7vs_replication_info_struct : %s",
+ replication_info_str);
+
+ for ( int i=0; i<replication_info.component_num; i++)
+ {
+ char replication_component_str[DEBUG_STR_LEN] = {0};
+ l7vs_replication_component_c_str(replication_component_str,replication_info.component_info,i);
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,4,
+ "set_l7vs_replication_component_struct : %s",
+ replication_component_str);
+ }
+ }
+ // Debug log END
+
+ // Check the Parameter exists
+ ip_addr_ret = parameter_is_char_exist( PARAM_COMP_REPLICATION,"ip_addr");
+ service_name_ret = parameter_is_char_exist( PARAM_COMP_REPLICATION, "service_name" );
+ nic_ret = parameter_is_char_exist( PARAM_COMP_REPLICATION, "nic");
+ interval_ret = parameter_is_int_exist( PARAM_COMP_REPLICATION, "interval" );
+
+ // SG File not set
+ if ( (0 == ip_addr_ret) && (0 == service_name_ret) && (0 == nic_ret) && (0 == interval_ret))
+ {
+ // Status Set
+ replication_state.service_status = REPLICATION_SINGLE;
+ LOGGER_PUT_LOG_INFO(LOG_CAT_L7VSD_REPLICATION,1, "Required item is not set in l7vs. ");
+ ret = 0;
+ goto END;
+ }
+ // IP Address exists
+ if ( 0 == ip_addr_ret )
+ {
+ // Status Set
+ replication_state.service_status = REPLICATION_SINGLE;
+ LOGGER_PUT_LOG_ERROR( LOG_CAT_L7VSD_REPLICATION,2, "IP Address is not set." );
+ ret = -1;
+ goto END;
+ }
+ // Port exists
+ else if ( 0 == service_name_ret )
+ {
+ // Status Set
+ replication_state.service_status = REPLICATION_SINGLE;
+ LOGGER_PUT_LOG_ERROR( LOG_CAT_L7VSD_REPLICATION,3, "Port is not set." );
+ ret = -1;
+ goto END;
+ }
+ // NIC exists
+ else if ( 0 == nic_ret )
+ {
+ // Status Set
+ replication_state.service_status = REPLICATION_SINGLE;
+ LOGGER_PUT_LOG_ERROR( LOG_CAT_L7VSD_REPLICATION,4, "NIC is not set." );
+ ret = -1;
+ goto END;
+ }
+ // Interval exists
+ else if ( 0 == interval_ret )
+ {
+ // Status Set
+ replication_state.service_status = REPLICATION_SINGLE;
+ LOGGER_PUT_LOG_ERROR( LOG_CAT_L7VSD_REPLICATION,5, "Interval is not set." );
+ ret = -1;
+ goto END;
+ }
+
+ // Get IP Addressa
+ strncpy(replication_info.ip_addr, parameter_get_char_value( PARAM_COMP_REPLICATION, "ip_addr" ),NI_MAXHOST);
+ // Failed in the acquisition of IP
+ if ( strcmp(replication_info.ip_addr,"") == 0)
+ {
+ LOGGER_PUT_LOG_ERROR( LOG_CAT_L7VSD_REPLICATION,6, "Could not get IP Address." );
+ replication_state.service_status = REPLICATION_SINGLE;
+ ret = -1;
+ goto END;
+ }
+
+ // Get service_name (port)
+ strncpy(replication_info.service_name,
+ parameter_get_char_value( PARAM_COMP_REPLICATION,
+ "service_name"), NI_MAXSERV);
+ // Failed in the acquisition of Port
+ if ( strcmp(replication_info.service_name,"") == 0)
+ {
+ LOGGER_PUT_LOG_ERROR( LOG_CAT_L7VSD_REPLICATION,7, "Could not get Port." );
+ replication_state.service_status = REPLICATION_SINGLE;
+ ret = -1;
+ goto END;
+ }
+
+ // Get NIC
+ strncpy(replication_info.nic, parameter_get_char_value( PARAM_COMP_REPLICATION, "nic" ),NIC_LENGTH);
+ // Failed in the acquisition of NIC
+ if ( strcmp(replication_info.nic,"") == 0)
+ {
+ LOGGER_PUT_LOG_ERROR( LOG_CAT_L7VSD_REPLICATION,8, "Could not get NIC." );
+ replication_state.service_status = REPLICATION_SINGLE;
+ ret = -1;
+ goto END;
+ }
+
+ // Get interval
+ replication_info.interval = parameter_get_int_value( PARAM_COMP_REPLICATION, "interval" );
+
+ // Set a starting component block number
+ replication_info.component_num = 0;
+ // Variable that sets ID
+ char key_id[ID_LENGTH];
+ char key_size[CMP_SIZE_LENGTH];
+
+ // Conponent exists
+ // Get Component infomation
+ for ( int i=0; i<CMP_MAX; i++)
+ {
+ memset( &key_id, 0, ID_LENGTH );
+ memset( &key_size, 0, CMP_SIZE_LENGTH);
+
+ sprintf( key_id, "cmponent_id_%02d",i);
+ sprintf( key_size, "cmponent_size_%02d",i);
+
+ // ID and the Size exist
+ if ( 0 == parameter_is_char_exist( PARAM_COMP_REPLICATION, key_id ) &&
+ 0 == parameter_is_int_exist( PARAM_COMP_REPLICATION, key_size ) )
+ {
+ break;
+ }else{
+ // Get Conmponent ID
+ strcpy( replication_info.component_info[i].id,
+ parameter_get_char_value(PARAM_COMP_REPLICATION,
+ key_id));
+ if ( 0 == strcmp(replication_info.component_info[i].id,""))
+ {
+ LOGGER_PUT_LOG_ERROR( LOG_CAT_L7VSD_REPLICATION,9,
+ "Could not get %s.",key_id );
+ replication_state.service_status = REPLICATION_SINGLE;
+ ret = -1;
+ goto END;
+ }
+
+ // Get Block size of Component
+ replication_info.component_info[i].block_size=parameter_get_int_value(PARAM_COMP_REPLICATION,
+ key_size);
+
+ // Count block head number
+ if ( 0 == i)
+ {
+ replication_info.component_info[i].block_head = 0;
+ replication_state.total_block += replication_info.component_info[i].block_size;
+ }else{
+ replication_info.component_info[i].block_head = replication_info.component_info[i-1].block_head
+ + replication_info.component_info[i-1].block_size;
+ replication_state.total_block += replication_info.component_info[i].block_size;
+ }
+ // Number of Component
+ component_num++;
+ }
+ replication_info.component_num = component_num;
+ }
+
+
+ // Check the Parameters value
+ if ( 0 != l7vs_replication_check_parameter() )
+ {
+ // Status Set
+ replication_state.service_status = REPLICATION_SINGLE;
+ LOGGER_PUT_LOG_ERROR( LOG_CAT_L7VSD_REPLICATION,10, "Failed in parameter check." );
+ ret = -1;
+ goto SINGLE_END;
+ }
+
+ // The memory is 0 or less.
+ if ( 0 >= replication_state.total_block)
+ {
+ // Status Set
+ replication_state.service_status = REPLICATION_SINGLE;
+ ret = 0;
+ goto SINGLE_END;
+ }
+
+ // The memory is larger than int.
+ if ( 100000 < replication_state.total_block)
+ {
+ // Status Set
+ replication_state.service_status = REPLICATION_SINGLE;
+ LOGGER_PUT_LOG_ERROR( LOG_CAT_L7VSD_REPLICATION,57, "Set number of blocks exceeds %d.",CMP_BLOCK_MAX );
+ ret = -1;
+ goto SINGLE_END;
+ }
+
+ // Get the Replication memory
+ replication_state.replication_memory = l7vs_replication_get_replication_address();
+ // Confirmation of Replication memory
+ if ( NULL == replication_state.replication_memory )
+ {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_SYSTEM_MEMORY,30, "Replication memory is NULL.");
+ // Status Set
+ replication_state.service_status = REPLICATION_SINGLE;
+ ret = -1;
+ goto SINGLE_END;
+
+ }
+ // Get the Components memory
+ replication_state.component_memory = l7vs_replication_get_component_address();
+ // Confirmation of Components memory
+ if ( NULL == replication_state.component_memory )
+ {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_SYSTEM_MEMORY,31, "Components memory is NULL.");
+ // free memory
+ l7vs_replication_release_replication_address();
+ // Status Set
+ replication_state.service_status = REPLICATION_SINGLE;
+ ret = -1;
+ goto SINGLE_END;
+ }
+
+ // Memory for Switch Sarface Number
+ replication_state.sarface_block_array_ptr = l7vs_replication_get_surface_info_address();
+ if ( NULL == replication_state.sarface_block_array_ptr )
+ {
+ // free memory
+ l7vs_replication_release_replication_address();
+ l7vs_replication_release_components_address();
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_SYSTEM_MEMORY,32, "Surface infomation memory is NULL.");
+ // Status Set
+ replication_state.service_status = REPLICATION_SINGLE;
+ ret = -1;
+ goto SINGLE_END;
+ }
+
+ // Get iomux
+ l7vs_replication_iomux = l7vs_iomux_get_from_avail_list();
+ if ( NULL == l7vs_replication_iomux )
+ {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_SYSTEM,2, "Can not get replication_iomux.");
+ ret = -1;
+ goto SINGLE_END;
+ }
+
+ // Status Set to Slave
+ ret = l7vs_replication_set_slave();
+
+ if (0 == ret)
+ {
+ replication_state.service_status = REPLICATION_SLAVE;
+ goto END;
+ }else{
+ goto SINGLE_END;
+ }
+
+END:
+ LOGGER_PUT_LOG_INFO(LOG_CAT_L7VSD_REPLICATION,2, "Initialized in %s mode.",
+ replication_mode[(int)replication_state.service_status]);
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG)
+ {
+ char replication_state_str[DEBUG_STR_LEN] = {0};
+ l7vs_replication_state_c_str(replication_state_str,&replication_state);
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,5,
+ "set_l7vs_replication_state_struct : %s",
+ replication_state_str);
+
+ char replication_info_str[DEBUG_STR_LEN] = {0};
+ l7vs_replication_info_c_str(replication_info_str,&replication_info);
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,6,
+ "set_l7vs_replication_info_struct : %s",
+ replication_info_str);
+
+ for ( int i=0; i<replication_info.component_num; i++)
+ {
+ char replication_component_str[DEBUG_STR_LEN] = {0};
+ l7vs_replication_component_c_str(replication_component_str,replication_info.component_info,i);
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,7,
+ "set_l7vs_replication_component_struct : %s",
+ replication_component_str);
+ }
+ }
+ // Debug log END
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,8,
+ "out_function : int l7vs_replication_initialize(void)"
+ "return = %d",ret);
+ }
+ // Debug log END
+ return ret;
+
+SINGLE_END:
+ if ( -1 != internal_val.socket)
+ {
+ close(internal_val.socket);
+ internal_val.socket = -1;
+ }
+
+ if ( NULL != internal_val.address_info)
+ {
+ freeaddrinfo(internal_val.address_info);
+ internal_val.address_info = NULL;
+ }
+
+ LOGGER_PUT_LOG_INFO(LOG_CAT_L7VSD_REPLICATION,3, "Initialized in %s mode.",
+ replication_mode[(int)replication_state.service_status]);
+
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG)
+ {
+ char replication_state_str[DEBUG_STR_LEN] = {0};
+ l7vs_replication_state_c_str(replication_state_str,&replication_state);
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,9,
+ "set_l7vs_replication_state_struct : %s",
+ replication_state_str);
+
+ char replication_info_str[DEBUG_STR_LEN] = {0};
+ l7vs_replication_info_c_str(replication_info_str,&replication_info);
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,10,
+ "set_l7vs_replication_info_struct : %s",
+ replication_info_str);
+
+ for ( int i=0; i<replication_info.component_num; i++)
+ {
+ char replication_component_str[DEBUG_STR_LEN] = {0};
+ l7vs_replication_component_c_str(replication_component_str,replication_info.component_info,i);
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,11,
+ "set_l7vs_replication_component_struct : %s",
+ replication_component_str);
+ }
+ }
+
+ // Debug log END
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,12,
+ "out_function : int l7vs_replication_initialize(void)"
+ "return = %d",ret);
+ }
+ // Debug log END
+
+ return ret;
+
+}
+
+/*! Finalize Replication
+ */
+void l7vs_replication_fini()
+{
+
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,13,
+ "in_function : void l7vs_replication_fini(void)");
+ }
+ // Debug log END
+
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG)
+ {
+ char replication_state_str[DEBUG_STR_LEN] = {0};
+ l7vs_replication_state_c_str(replication_state_str,&replication_state);
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,14,
+ "set_l7vs_replication_state_struct : %s",
+ replication_state_str);
+
+ char replication_info_str[DEBUG_STR_LEN] = {0};
+ l7vs_replication_info_c_str(replication_info_str,&replication_info);
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,15,
+ "set_l7vs_replication_info_struct : %s",
+ replication_info_str);
+
+ for ( int i=0; i<replication_info.component_num; i++)
+ {
+ char replication_component_str[DEBUG_STR_LEN] = {0};
+ l7vs_replication_component_c_str(replication_component_str,replication_info.component_info,i);
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,16,
+ "set_l7vs_replication_component_struct : %s",
+ replication_component_str);
+ }
+ }
+ // Debug log END
+ // Socket finalaize
+ l7vs_replication_sock_fini();
+ // Release replication memory
+ l7vs_replication_release_replication_address();
+ // Release component memory
+ l7vs_replication_release_components_address();
+ // Release sarface block memory
+ l7vs_replication_release_surface_info_address();
+
+ // reset of replication_state
+ replication_state.send_time = 0;
+ replication_state.last_send_block = 0;
+ replication_state.last_recv_block = 0;
+ replication_state.total_block = 0;
+ replication_state.sarface_block_no = 0;
+
+ // reset of replication_info
+ memset(&replication_info, 0, sizeof(struct l7vs_replication_info));
+
+ // imoux
+ if ( NULL != l7vs_replication_iomux )
+ {
+ l7vs_iomux_put_to_avail_list(l7vs_replication_iomux);
+ l7vs_replication_iomux = NULL;
+ }
+
+ // status change
+ replication_state.service_status = REPLICATION_OUT;
+
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG)
+ {
+ char replication_state_str[DEBUG_STR_LEN] = {0};
+ l7vs_replication_state_c_str(replication_state_str,&replication_state);
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,17,
+ "set_l7vs_replication_state_struct : %s",
+ replication_state_str);
+
+ char replication_info_str[DEBUG_STR_LEN] = {0};
+ l7vs_replication_info_c_str(replication_info_str,&replication_info);
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,18,
+ "set_l7vs_replication_info_struct : %s",
+ replication_info_str);
+
+ for ( int i=0; i<replication_info.component_num; i++)
+ {
+ char replication_component_str[DEBUG_STR_LEN] = {0};
+ l7vs_replication_component_c_str(replication_component_str,replication_info.component_info,i);
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,19,
+ "set_l7vs_replication_component_struct : %s",
+ replication_component_str);
+ }
+ }
+ // Debug log END
+
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,20, "out_function : l7vs_replication_fini(void)");
+ }
+ // Debug log END
+
+}
+
+/*! Switch Slave to Master
+ */
+extern void l7vs_replication_switch_to_master()
+{
+ int ret = -1;
+
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,21,
+ "extern void l7vs_replication_switch_to_master(void)");
+ }
+ // Debug log END
+
+ switch (replication_state.service_status){
+ case REPLICATION_SLAVE:
+ // Set Mastre Mode
+ ret = l7vs_replication_set_master();
+ if ( 0 != ret )
+ {
+ replication_state.service_status = REPLICATION_SINGLE;
+
+ if ( -1 != internal_val.socket)
+ {
+ close(internal_val.socket);
+ internal_val.socket = -1;
+ }
+ if ( NULL != internal_val.address_info)
+ {
+ freeaddrinfo(internal_val.address_info);
+ internal_val.address_info = NULL;
+ }
+ l7vs_replication_release_replication_address();
+ l7vs_replication_release_components_address();
+ l7vs_replication_release_surface_info_address();
+
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_REPLICATION,54, "Switch to master NG. mode : %s",
+ replication_mode[(int)replication_state.service_status]);
+ // change iomux status
+ l7vs_replication_iomux->status = iomux_replication_error;
+
+ break;
+
+ }else{
+
+ // Copy from component area to replication area.
+ memcpy(replication_state.replication_memory, replication_state.component_memory, replication_state.total_block*DATA_SIZE);
+
+ // Set mode.
+ replication_state.service_status = REPLICATION_MASTER;
+
+ // change iomux status
+ l7vs_replication_iomux->status = iomux_replication_send_wait;
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,22,
+ "l7vs_replication_iomux->status :"
+ "befor : iomux_replication_recv_wait"
+ "after : iomux_replication_send_wait");
+ }
+ // Debug log END
+
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG)
+ {
+ char replication_state_str[DEBUG_STR_LEN] = {0};
+ l7vs_replication_state_c_str(replication_state_str,&replication_state);
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,23,
+ "set_l7vs_replication_state_struct : %s",
+ replication_state_str);
+
+ char replication_info_str[DEBUG_STR_LEN] = {0};
+ l7vs_replication_info_c_str(replication_info_str,&replication_info);
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,24,
+ "set_l7vs_replication_info_struct : %s",
+ replication_info_str);
+
+ for ( int i=0; i<replication_info.component_num; i++)
+ {
+ char replication_component_str[DEBUG_STR_LEN] = {0};
+ l7vs_replication_component_c_str(replication_component_str,replication_info.component_info,i);
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,25,
+ "set_l7vs_replication_component_struct : %s",
+ replication_component_str);
+ }
+ }
+ // Debug log END
+
+ LOGGER_PUT_LOG_INFO(LOG_CAT_L7VSD_REPLICATION,5, "Switch to master OK. mode : %s",
+ replication_mode[(int)replication_state.service_status]);
+ break;
+ }
+ case REPLICATION_SLAVE_STOP:
+ // Set Mastre Mode
+ ret = l7vs_replication_set_master();
+ if ( 0 != ret )
+ {
+ replication_state.service_status = REPLICATION_SINGLE;
+
+ if ( -1 != internal_val.socket)
+ {
+ close(internal_val.socket);
+ internal_val.socket = -1;
+ }
+ if ( NULL != internal_val.address_info)
+ {
+ freeaddrinfo(internal_val.address_info);
+ internal_val.address_info = NULL;
+ }
+ l7vs_replication_release_replication_address();
+ l7vs_replication_release_components_address();
+ l7vs_replication_release_surface_info_address();
+
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_REPLICATION,53, "Switch to master NG. mode : %s",
+ replication_mode[(int)replication_state.service_status]);
+ // change iomux status
+ l7vs_replication_iomux->status = iomux_replication_error;
+
+ break;
+ }else{
+
+ // Copy from component area to replication area.
+ memcpy(replication_state.replication_memory, replication_state.component_memory, replication_state.total_block*DATA_SIZE);
+
+ // Set mode.
+ replication_state.service_status = REPLICATION_MASTER_STOP;
+
+ // change iomux status
+ l7vs_replication_iomux->status = iomux_replication_send_stop;
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,26,
+ "l7vs_replication_iomux->status :"
+ "befor : iomux_replication_recv_stop)"
+ "after : iomux_replication_send_stop");
+ }
+ // Debug log END
+
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG)
+ {
+ char replication_state_str[DEBUG_STR_LEN] = {0};
+ l7vs_replication_state_c_str(replication_state_str,&replication_state);
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,27,
+ "set_l7vs_replication_state_struct : %s",
+ replication_state_str);
+
+ char replication_info_str[DEBUG_STR_LEN] = {0};
+ l7vs_replication_info_c_str(replication_info_str,&replication_info);
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,28,
+ "set_l7vs_replication_info_struct : %s",
+ replication_info_str);
+
+ for ( int i=0; i<replication_info.component_num; i++)
+ {
+ char replication_component_str[DEBUG_STR_LEN] = {0};
+ l7vs_replication_component_c_str(replication_component_str,replication_info.component_info,i);
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,29,
+ "set_l7vs_replication_component_struct : %s",
+ replication_component_str);
+ }
+ }
+ // Debug log END
+
+ LOGGER_PUT_LOG_INFO(LOG_CAT_L7VSD_REPLICATION,7, "Switch to master OK. mode : %s",
+ replication_mode[(int)replication_state.service_status]);
+ break;
+ }
+ case REPLICATION_SINGLE:
+ LOGGER_PUT_LOG_INFO(LOG_CAT_L7VSD_REPLICATION,42,"Starting by %s, doesn't shift to MASTER. ",
+ replication_mode[(int)replication_state.service_status]);
+ break;
+ default:
+ LOGGER_PUT_LOG_WARN(LOG_CAT_L7VSD_REPLICATION,2, "Can not switch to master. mode : %s",
+ replication_mode[(int)replication_state.service_status]);
+ break;
+ }
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,30, "extern void l7vs_replication_switch_to_master(void)");
+ }
+}
+
+/*! Set Master mode
+*/
+static int l7vs_replication_set_master()
+{
+ int sock_ret = -1;
+
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,31, "in_function : static int l7vs_replication_set_master(void)");
+ }
+ // Debug log END
+
+ if ( REPLICATION_SLAVE != replication_state.service_status &&
+ REPLICATION_SLAVE_STOP != replication_state.service_status )
+ {
+ // Status Set
+ LOGGER_PUT_LOG_WARN(LOG_CAT_L7VSD_REPLICATION,3, "Can not set to master. mode : %s",
+ replication_mode[(int)replication_state.service_status]);
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,32,
+ "out_function : static int l7vs_replication_set_master(void)"
+ "return = -1");
+ }
+ // Debug log END
+ return -1;
+ }
+
+ // close socket and delete l7vs_iomux
+ l7vs_replication_sock_fini();
+
+ // make send socket
+ sock_ret = l7vs_replication_send_sock_init();
+ if ( -1 == sock_ret )
+ {
+ // Status Set
+ replication_state.service_status = REPLICATION_SINGLE;
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_REPLICATION,11, "Failed in the initialization of the send socket.");
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,33,
+ "out_function : static int l7vs_replication_set_master(void)"
+ "return = -1");
+ }
+ // Debug log END
+ return -1;
+ }
+
+ // set of send socket : struct l7vs_iomux l7vs_replication_iomux
+ // fd
+ l7vs_replication_iomux->fd = internal_val.socket;
+ // callback
+ l7vs_replication_iomux->callback = l7vs_replication_send_callback;
+ // status
+ l7vs_replication_iomux->status = iomux_replication_out;
+
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,34,
+ "l7vs_replication_iomux->status :"
+ "befor : Any execution mode"
+ "after : iomux_replication_out");
+ }
+ // Debug log END
+
+ // add : struct l7vs_iomux l7vs_replication_iomux
+ l7vs_iomux_add(l7vs_replication_iomux, iom_write);
+
+ LOGGER_PUT_LOG_INFO(LOG_CAT_L7VSD_REPLICATION,8,"Initialization of send socket is success.");
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,35,
+ "out_function : static int l7vs_replication_set_master(void)"
+ "return = 0");
+ }
+ // Debug log END
+
+ return 0;
+
+}
+
+/*! Switch Master to Slave
+ */
+extern void l7vs_replication_switch_to_slave()
+{
+ int ret = -1;
+
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,36,
+ "in_function : extern void l7vs_replication_switch_to_slave(void)");
+ }
+ // Debug log END
+
+ switch (replication_state.service_status){
+ case REPLICATION_MASTER:
+ // Set Mastre Mode
+ ret = l7vs_replication_set_slave();
+ if ( 0 != ret )
+ {
+ replication_state.service_status = REPLICATION_SINGLE;
+
+ if ( -1 != internal_val.socket)
+ {
+ close(internal_val.socket);
+ internal_val.socket = -1;
+ }
+ if ( NULL != internal_val.address_info)
+ {
+ freeaddrinfo(internal_val.address_info);
+ internal_val.address_info = NULL;
+ }
+ l7vs_replication_release_replication_address();
+ l7vs_replication_release_components_address();
+ l7vs_replication_release_surface_info_address();
+
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_REPLICATION,55, "Switch to slave NG. mode : %s",
+ replication_mode[(int)replication_state.service_status]);
+ // change iomux status
+ l7vs_replication_iomux->status = iomux_replication_error;
+
+ break;
+ }else{
+
+ // initialize to replication area.
+ memset(replication_state.replication_memory, 0, replication_state.total_block*DATA_SIZE);
+
+ // Set mode.
+ replication_state.service_status = REPLICATION_SLAVE;
+
+ // change iomux status
+ l7vs_replication_iomux->status = iomux_replication_recv_wait;
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,37,
+ "l7vs_replication_iomux->status :"
+ "befor : iomux_replication_send_wait"
+ "after : iomux_replication_recv_wait");
+ }
+ // Debug log END
+
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG)
+ {
+ char replication_state_str[DEBUG_STR_LEN] = {0};
+ l7vs_replication_state_c_str(replication_state_str,&replication_state);
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,38,
+ "set_l7vs_replication_state_struct : %s",
+ replication_state_str);
+
+ char replication_info_str[DEBUG_STR_LEN] = {0};
+ l7vs_replication_info_c_str(replication_info_str,&replication_info);
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,39,
+ "set_l7vs_replication_info_struct : %s",
+ replication_info_str);
+
+ for ( int i=0; i<replication_info.component_num; i++)
+ {
+ char replication_component_str[DEBUG_STR_LEN] = {0};
+ l7vs_replication_component_c_str(replication_component_str,replication_info.component_info,i);
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,40,
+ "set_l7vs_replication_component_struct : %s",
+ replication_component_str);
+ }
+ }
+ // Debug log END
+
+ LOGGER_PUT_LOG_INFO(LOG_CAT_L7VSD_REPLICATION,10, "Switch to slave OK. mode : %s",
+ replication_mode[(int)replication_state.service_status]);
+ break;
+ }
+ case REPLICATION_MASTER_STOP:
+ // Set Mastre Mode
+ ret = l7vs_replication_set_slave();
+ if ( 0 != ret )
+ {
+ replication_state.service_status = REPLICATION_SINGLE;
+
+ if ( -1 != internal_val.socket)
+ {
+ close(internal_val.socket);
+ internal_val.socket = -1;
+ }
+ if ( NULL != internal_val.address_info)
+ {
+ freeaddrinfo(internal_val.address_info);
+ internal_val.address_info = NULL;
+ }
+ l7vs_replication_release_replication_address();
+ l7vs_replication_release_components_address();
+ l7vs_replication_release_surface_info_address();
+
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_REPLICATION,56, "Switch to slave NG. mode : %s",
+ replication_mode[(int)replication_state.service_status]);
+ // change iomux status
+ l7vs_replication_iomux->status = iomux_replication_error;
+
+ break;
+ }else{
+
+ // initialize to replication area.
+ memset(replication_state.replication_memory, 0, replication_state.total_block*DATA_SIZE);
+
+ // Set mode.
+ replication_state.service_status = REPLICATION_SLAVE_STOP;
+
+ // change iomux status
+ l7vs_replication_iomux->status = iomux_replication_recv_stop;
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,41,
+ "l7vs_replication_iomux->status :"
+ "befor : iomux_replication_send_stop"
+ "after : iomux_replication_recv_stop");
+ }
+ // Debug log END
+
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG)
+ {
+ char replication_state_str[DEBUG_STR_LEN] = {0};
+ l7vs_replication_state_c_str(replication_state_str,&replication_state);
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,42,
+ "set_l7vs_replication_state_struct : %s",
+ replication_state_str);
+
+ char replication_info_str[DEBUG_STR_LEN] = {0};
+ l7vs_replication_info_c_str(replication_info_str,&replication_info);
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,43,
+ "set_l7vs_replication_info_struct : %s",
+ replication_info_str);
+
+ for ( int i=0; i<replication_info.component_num; i++)
+ {
+ char replication_component_str[DEBUG_STR_LEN] = {0};
+ l7vs_replication_component_c_str(replication_component_str,replication_info.component_info,i);
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,44,
+ "set_l7vs_replication_component_struct : %s",
+ replication_component_str);
+ }
+ }
+ // Debug log END
+
+ LOGGER_PUT_LOG_INFO(LOG_CAT_L7VSD_REPLICATION,12, "Switch to slave OK. mode : %s",
+ replication_mode[(int)replication_state.service_status]);
+ break;
+ }
+ case REPLICATION_SINGLE:
+ LOGGER_PUT_LOG_INFO(LOG_CAT_L7VSD_REPLICATION,13, "Starting by %s , doesn't shift to SLAVE .",
+ replication_mode[(int)replication_state.service_status]);
+ break;
+ default:
+ LOGGER_PUT_LOG_WARN(LOG_CAT_L7VSD_REPLICATION,4, "Can not switch to slave. mode : %s",
+ replication_mode[(int)replication_state.service_status]);
+ break;
+ }
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,45, "out_function : extern void l7vs_replication_switch_to_slave(void)");
+ }
+ // Debug log END
+}
+
+/*! Set Slave mode
+*/
+static int l7vs_replication_set_slave()
+{
+ int sock_ret = -1;
+
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,46, "int_function : static int l7vs_replication_set_slave(void)");
+ }
+ // Debug log END
+
+
+ if ( REPLICATION_MASTER != replication_state.service_status &&
+ REPLICATION_MASTER_STOP != replication_state.service_status &&
+ REPLICATION_OUT != replication_state.service_status )
+ {
+ // Status Set
+ LOGGER_PUT_LOG_WARN(LOG_CAT_L7VSD_REPLICATION,5, "Can not set to slave. mode : %s",
+ replication_mode[(int)replication_state.service_status]);
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,47,
+ "out_function : static int l7vs_replication_set_slave(void)"
+ "return = -1");
+ }
+ // Debug log END
+
+ return -1;
+ }
+
+ // close socket and delete l7vs_iomux
+ l7vs_replication_sock_fini();
+ // make send socket
+ sock_ret = l7vs_replication_recv_sock_init();
+ if ( -1 == sock_ret )
+ {
+ // Status Set
+ replication_state.service_status = REPLICATION_SINGLE;
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_REPLICATION,12, "Failed in the initialization of the recv socket.");
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,48,
+ "out_function : static int l7vs_replication_set_slave(void)"
+ "return = -1");
+ }
+ // Debug log END
+ return -1;
+ }
+
+ // set of send socket : struct l7vs_iomux l7vs_replication_iomux
+ // fd
+ l7vs_replication_iomux->fd = internal_val.socket;
+ // callback
+ l7vs_replication_iomux->callback = l7vs_replication_recv_callback;
+ // status
+ l7vs_replication_iomux->status = iomux_replication_out;
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,49,
+ "l7vs_replication_iomux->status : iomux_replication_out");
+ }
+ // Debug log END
+ // add : struct l7vs_iomux l7vs_replication_iomux
+ l7vs_iomux_add(l7vs_replication_iomux, iom_read);
+
+ LOGGER_PUT_LOG_INFO(LOG_CAT_L7VSD_REPLICATION,14,"Initialization of receive socket is success.");
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,50,
+ "out_function : static int l7vs_replication_set_slave(void)"
+ "return = 0");
+ }
+ // Debug log END
+ return 0;
+
+}
+
+/*! Pay replication memory
+ *
+ * @param component_id is the one to identify the component.
+ * @param size of component use blocks
+ *
+ * @return Replication memory address
+ * @retval nonnull Replication memory address
+ * @retval NULL Error
+ */
+extern void *l7vs_replication_pay_memory( char* component_id, unsigned int* size )
+{
+ char demand_id[ID_LENGTH];
+ void *ret = NULL;
+ int cmp_ret = -1;
+
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,51,
+ "extern void *l7vs_replication_pay_memory( char* component_id, unsigned int* size)"
+ "component_id = %p"
+ "size = %p",
+ component_id,
+ size);
+ }
+ // Debug log END
+
+
+ // argument is illegal
+ if ( NULL == component_id || NULL == size)
+ {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_REPLICATION,13, "Argument illegal. Component id or component size is NULL. ");
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,52,
+ "out_function : extern void *l7vs_replication_pay_memory( char* component_id, unsigned int* size)"
+ "return = NULL");
+ }
+ // Debug log END
+ return NULL;
+ }
+ *size = 0;
+ // Check replication mode.
+ if ( REPLICATION_OUT == replication_state.service_status ||
+ REPLICATION_SINGLE == replication_state.service_status)
+ {
+ // Check mode that can use the replication.
+ LOGGER_PUT_LOG_INFO(LOG_CAT_L7VSD_REPLICATION,15,
+ "Improper mode for Replication. mode : %s",
+ replication_mode[(int)replication_state.service_status]);
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,53,
+ "out_function : extern void *l7vs_replication_pay_memory( char* component_id, unsigned int* size)"
+ "return = NULL");
+ }
+ // Debug log END
+ return NULL;
+ }
+
+ if ( NULL == replication_state.component_memory )
+ {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_SYSTEM_MEMORY,33,
+ "You can't get memory. Component memory is NULL. ");
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,54,
+ "out_function : extern void *l7vs_replication_pay_memory( char* component_id, unsigned int* size)"
+ "return = NULL");
+ }
+ // Debug log END
+ return NULL;
+ }
+
+ // memory initialize
+ memset( demand_id, 0, ID_LENGTH );
+
+ // get Demand ID
+ strncpy( demand_id, component_id, ID_LENGTH );
+
+ // search Component ID
+ for ( int i = 0; i < replication_info.component_num; i++ )
+ {
+ // Demand ID is compared with Component ID
+ cmp_ret = strncmp(demand_id, replication_info.component_info[i].id, ID_LENGTH);
+ if ( 0 == cmp_ret )
+ {
+
+ // size check
+ if ( 0 == replication_info.component_info[i].block_size )
+ {
+ LOGGER_PUT_LOG_WARN(LOG_CAT_L7VSD_REPLICATION,16, "Component block size is 0.");
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,191,
+ "out_function : extern void *l7vs_replication_pay_memory( char* component_id, unsigned int* size)"
+ "return = NULL");
+ }
+ // Debug log END
+ return NULL;
+ }
+
+ // block_head check
+ if ( replication_info.component_info[i].block_head < 0 ||
+ replication_info.component_info[i].block_head > replication_state.total_block)
+ {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_REPLICATION,14,
+ "Too many component block. Max is %d . ",replication_state.total_block);
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,55,
+ "out_function : extern void *l7vs_replication_pay_memory( char* component_id, unsigned int* size)"
+ "return = NULL");
+ }
+ // Debug log END
+ return NULL;
+ }
+ // Pay memory address
+ ret = (char *)replication_state.component_memory
+ + replication_info.component_info[i].block_head * DATA_SIZE;
+ // Nnumber of blocks of ID was returned.
+ *size = replication_info.component_info[i].block_size;
+
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,56,
+ "size data : %u",replication_info.component_info[i].block_size);
+ }
+ // Debug log END
+
+ // LOG INFO
+ LOGGER_PUT_LOG_INFO(LOG_CAT_L7VSD_REPLICATION,16,
+ "Component Info ID : \"%s\". Block size : %d . Head Block No : %d/ Pay memory : %p ",
+ replication_info.component_info[i].id,
+ replication_info.component_info[i].block_size,
+ replication_info.component_info[i].block_head,
+ (char *)ret);
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,57,
+ "out_function : extern void *l7vs_replication_pay_memory( char* component_id, unsigned int* size)"
+ "return = %p",
+ ret);
+ }
+ // Debug log END
+ return ret;
+ }
+ }
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_REPLICATION,15,
+ "Unknown component ID. Component ID : %s",demand_id);
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,58,
+ "out_function : extern void *l7vs_replication_pay_memory( char* component_id, unsigned int* size)"
+ "return = NULL");
+ }
+ // Debug log END
+ return NULL;
+}
+
+
+
+/*! Replication Callback
+ *
+ * @param sturuct l7vs_iomux *iom
+ *
+ * @return 0/1
+ *
+ */
+extern int l7vs_replication_send_callback( struct l7vs_iomux *iom )
+{
+ struct l7vs_replication_data replication_data;
+ int send_ret = -1;
+
+ // Debug log
+// if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG){
+// LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,59,
+// "in_function : extern int l7vs_replication_send_callback( struct l7vs_iomux *iom )"
+// "iomux = %p",iom);
+// }
+ // Debug log END
+
+ // change to iom_write
+ l7vs_iomux_mod(iom, iom_write);
+
+ // Check by continuous initialize.
+ if ( REPLICATION_MASTER != replication_state.service_status &&
+ REPLICATION_MASTER_STOP != replication_state.service_status )
+ {
+ // Initialization has already been done.
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_REPLICATION,16,
+ "Can not send_callback. Mode is difficult. mode : %s",
+ replication_mode[(int)replication_state.service_status]);
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,60,
+ "out_function : extern int l7vs_replication_send_callback( struct l7vs_iomux *iom )"
+ "return = -1" );
+ }
+ // Debug log END
+ return -1;
+ }else if ( REPLICATION_MASTER_STOP == replication_state.service_status ) {
+ // Debug log
+// if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG){
+// LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,61,
+// "Can not send Replication data, because mode is MASTER_STOP..");
+// LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,62,
+// "out_function : extern int l7vs_replication_send_callback( struct l7vs_iomux *iom )"
+// "return = 0" );
+// }
+ // Debug log END
+
+ return 0;
+ }
+
+ // iomux is NULL
+ if ( (void *)NULL ==iom )
+ {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_SYSTEM_MEMORY,34, "Send Argument(struct iomux) is NULL." );
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,63,
+ "out_function : extern int l7vs_replication_send_callback( struct l7vs_iomux *iom )"
+ "return = -1" );
+ }
+ // Debug log END
+ return -1;
+ }
+
+ // Replication memory is NULL
+ if ( NULL == replication_state.replication_memory )
+ {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_SYSTEM_MEMORY,35, "Replication memory is NULL." );
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,64,
+ "out_function : extern int l7vs_replication_send_callback( struct l7vs_iomux *iom )"
+ "return = -1" );
+ }
+ // Debug log END
+ return -1;
+ }
+
+ // Component memory is NULL
+ if ( NULL == replication_state.component_memory )
+ {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_SYSTEM_MEMORY,36, "Component memory is NULL." );
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,65,
+ "out_function : extern int l7vs_replication_send_callback( struct l7vs_iomux *iom )"
+ "return = -1" );
+ }
+ // Debug log END
+ return -1;
+ }
+
+ //
+ if ( 0 != l7vs_replication_checkinterval() )
+ {
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_INFO(LOG_CAT_L7VSD_SYSTEM_MEMORY,1, "Send data wait ...." );
+ }
+ // Debug log END
+
+ return 0;
+ }
+
+ // Temporary preservation sturuct initialize
+ memset( &replication_data, 0, sizeof(struct l7vs_replication_data) );
+ send_ret = l7vs_replication_send_data(&replication_data);
+
+ // change iomux status
+ l7vs_replication_iomux->status = iomux_replication_send_wait;
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,66,
+ "l7vs_replication_iomux->status :"
+ "befor : iomux_replication_sending"
+ "after : iomux_replication_send_wait");
+ }
+
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG){
+ char replication_data_str[DEBUG_STR_LEN] = {0};
+ l7vs_replication_data_c_str(replication_data_str,&replication_data);
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,67,
+ "replication_data_struct : %s",
+ replication_data_str);
+ }
+ // Debug log END
+
+ if ( 0 != send_ret )
+ {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_SYSTEM,3,
+ "Send data is Failed." );
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,68,
+ "out_function : extern int l7vs_replication_send_callback( struct l7vs_iomux *iom )"
+ "return = -1" );
+ }
+ // Debug log END
+ return -1;
+ }
+
+ // set last send block number
+ if ( replication_state.last_send_block < replication_state.total_block-1 )
+ {
+ replication_state.last_send_block += 1;
+ }else if(replication_state.last_send_block == replication_state.total_block-1){
+ replication_state.last_send_block = 0;
+ }else{
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_REPLICATION,17,
+ "Last send block number is illegal.");
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,69,
+ "out_function : extern int l7vs_replication_send_callback( struct l7vs_iomux *iom )"
+ "return = -1" );
+ }
+ // Debug log END
+ return -1;
+ }
+
+ // sarface block number is change
+ if(replication_state.total_block == replication_state.last_send_block + 1 )
+ {
+ // Synchronization is executed.
+ memcpy(replication_state.replication_memory,
+ replication_state.component_memory,
+ replication_state.total_block*DATA_SIZE );
+
+ // serial initialize
+ replication_state.sarface_block_no = 0;
+
+ // make new serial
+ replication_state.sarface_block_no = (uint64_t)l7vs_replication_make_serial();
+ if ( 0 == replication_state.sarface_block_no )
+ {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_REPLICATION,18,
+ "Could not get serial number .");
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,70,
+ "out_function : extern int l7vs_replication_send_callback( struct l7vs_iomux *iom )"
+ "return = -1" );
+ }
+ // Debug log END
+ return -1;
+ }
+// if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG){
+// LOGGER_PUT_LOG_INFO(LOG_CAT_L7VSD_REPLICATION, 0,
+// "Copy Success from component memory to replication memory." );
+// }
+ }
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,71,
+ "out_function : extern int l7vs_replication_send_callback( struct l7vs_iomux *iom )"
+ "return = 0" );
+ }
+ // Debug log END
+
+ return 0;
+}
+
+/*! Replication Callback
+ *
+ * @param sturuct l7vs_iomux *iom
+ *
+ * @return 0/1
+ *
+ */
+extern int l7vs_replication_recv_callback( struct l7vs_iomux *iom )
+{
+ struct l7vs_replication_data replication_data;
+ int recv_ret = -1;
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,72,
+ "in_function : extern int l7vs_replication_recv_callback( struct l7vs_iomux *iom )"
+ "iom = %p",iom);
+ }
+ // Debug log END
+
+ // change to iom_read
+ l7vs_iomux_mod(iom, iom_read);
+
+ // Check by continuous initialize.
+ if ( REPLICATION_SLAVE != replication_state.service_status &&
+ REPLICATION_SLAVE_STOP != replication_state.service_status )
+ {
+ // Initialization has already been done.
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_REPLICATION,19,
+ "Can not recv_callback. Mode is difficult. mode : %s",
+ replication_mode[(int)replication_state.service_status]);
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,73,
+ "out_function : extern int l7vs_replication_recv_callback( struct l7vs_iomux *iom )"
+ "return = -1");
+ }
+ // Debug log END
+ return -1;
+ }else if ( REPLICATION_SLAVE_STOP == replication_state.service_status ) {
+ LOGGER_PUT_LOG_INFO(LOG_CAT_L7VSD_REPLICATION,17,
+ "Can not receive Replication data, because mode is SLAVE_STOP.");
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,74,
+ "out_function : extern int l7vs_replication_recv_callback( struct l7vs_iomux *iom )"
+ "return = 0");
+ }
+ // Debug log END
+ return 0;
+ }
+
+ // iomux is NULL
+ if ( (void *)NULL ==iom )
+ {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_SYSTEM_MEMORY,37, "Recv Argument(struct iomux) is NULL." );
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,75,
+ "out_function : extern int l7vs_replication_recv_callback( struct l7vs_iomux *iom )"
+ "return = -1");
+ }
+ // Debug log END
+ return -1;
+ }
+
+ // Replication memory is NULL
+ if ( NULL == replication_state.replication_memory )
+ {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_SYSTEM_MEMORY,38, "Replication memory is NULL." );
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,76,
+ "out_function : extern int l7vs_replication_recv_callback( struct l7vs_iomux *iom )"
+ "return = -1");
+ }
+ // Debug log END
+ return -1;
+ }
+
+ // Component memory is NULL
+ if ( NULL == replication_state.component_memory )
+ {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_SYSTEM_MEMORY,39, "Component memory is NULL." );
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,77,
+ "out_function : extern int l7vs_replication_recv_callback( struct l7vs_iomux *iom )"
+ "return = -1");
+ }
+ // Debug log END
+ return -1;
+ }
+
+ // Sarface block array memory is NULL
+ if ( NULL == replication_state.sarface_block_array_ptr)
+ {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_REPLICATION,20, "sarface block array pointer is NULL.");
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,78,
+ "out_function : extern int l7vs_replication_recv_callback( struct l7vs_iomux *iom )"
+ "return = -1");
+ }
+ // Debug log END
+ return -1;
+ }
+
+ // Temporary preservation sturuct initialize
+ memset( &replication_data, 0, sizeof(struct l7vs_replication_data) );
+ recv_ret = l7vs_replication_recv_data(&replication_data);
+
+ // change iomux status
+ l7vs_replication_iomux->status = iomux_replication_recv_wait;
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,79,
+ "l7vs_replication_iomux->status :"
+ "befor : iomux_replication_receving"
+ "after : iomux_replication_recv_wait");
+ }
+ // Debug log END
+
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG){
+ char replication_data_str[DEBUG_STR_LEN] = {0};
+ l7vs_replication_data_c_str(replication_data_str,&replication_data);
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,80,
+ "replication_data_struct : %s",
+ replication_data_str);
+ }
+ // Debug log END
+
+ if ( 0 != recv_ret )
+ {
+ LOGGER_PUT_LOG_WARN(LOG_CAT_L7VSD_SYSTEM,3,
+ "Failed in the reception processing of data because of illegal receive data." );
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,81,
+ "out_function : extern int l7vs_replication_recv_callback( struct l7vs_iomux *iom )"
+ "return = -1");
+ }
+ // Debug log END
+ return -1;
+ }
+
+ // set sarface block
+ replication_state.sarface_block_array_ptr[replication_data.block_num] = replication_data.serial;
+
+ // set last send block number
+ if ( replication_state.last_recv_block < replication_state.total_block-1 )
+ {
+ replication_state.last_recv_block += 1;
+ }else if(replication_state.last_recv_block == replication_state.total_block-1){
+ replication_state.last_recv_block = 0;
+ }else{
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_REPLICATION,21,
+ "Last send block number is illegal.");
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,83,
+ "out_function : extern int l7vs_replication_recv_callback( struct l7vs_iomux *iom )"
+ "return = -1");
+ }
+ // Debug log END
+ return -1;
+ }
+
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,84,
+ "out_function : extern int l7vs_replication_recv_callback( struct l7vs_iomux *iom )"
+ "return = 0");
+ }
+ // Debug log END
+ return 0;
+
+
+}
+
+/*! Replication Dump
+ *
+ */
+extern void l7vs_replication_dump_memory()
+{
+ int size;
+ char *p;
+ char *head;
+ int h = 0;
+ int i = 0;
+
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,85, "in_function : extern void l7vs_replication_dump_memory(void)");
+ }
+ // Debug log END
+
+ if ( ( REPLICATION_SINGLE == replication_state.service_status ) ||
+ ( REPLICATION_OUT == replication_state.service_status ) )
+ {
+ LOGGER_PUT_LOG_WARN(LOG_CAT_L7VSD_REPLICATION,6,
+ "Replication memory dump failure. mode : %s",
+ replication_mode[(int)replication_state.service_status]);
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,86, "out_function : extern void l7vs_replication_dump_memory(void)");
+ }
+ // Debug log END
+ return;
+ }
+
+ // Replication memory is NULL.
+ if ( NULL == replication_state.replication_memory)
+ {
+ LOGGER_PUT_LOG_WARN(LOG_CAT_L7VSD_SYSTEM,1,
+ "Replication memory is NULL.");
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,87, "out_function : extern void l7vs_replication_dump_memory(void)");
+ }
+ // Debug log END
+ return;
+ }
+
+ // Dump size
+ size = 480 * replication_state.total_block;
+
+ if ( 0 == size )
+ {
+ LOGGER_PUT_LOG_WARN(LOG_CAT_L7VSD_REPLICATION,7,
+ "Can not get Replication memory");
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,88, "out_function : extern void l7vs_replication_dump_memory(void)");
+ }
+ // Debug log END
+ return;
+
+ }
+
+ // Memory Dump
+ p = (char *)replication_state.replication_memory;
+
+ // Output mode
+ LOGGER_PUT_LOG_INFO(LOG_CAT_L7VSD_REPLICATION,18,"Replication Dump Start ----------------------------");
+ LOGGER_PUT_LOG_INFO(LOG_CAT_L7VSD_REPLICATION,19,"Mode is [ %s ].",
+ replication_mode[(int)replication_state.service_status]);
+ LOGGER_PUT_LOG_INFO(LOG_CAT_L7VSD_REPLICATION,20,"Total Block is [ %u ]",
+ replication_state.total_block);
+
+ // Converts into the binary, and writes it to the file.
+ for ( h = 0; h < size / DATA_SIZE ; h++ )
+ {
+ LOGGER_PUT_LOG_INFO(LOG_CAT_L7VSD_REPLICATION,21,"Block Number [ %d ]",h);
+
+ for ( i = 0; i < DATA_SIZE / LOG_DATA_WIDTH ; i++ )
+ {
+ head = p + h*DATA_SIZE + i*LOG_DATA_WIDTH;
+ LOGGER_PUT_LOG_INFO(LOG_CAT_L7VSD_REPLICATION,22,
+ "%02hhX %02hhX %02hhX %02hhX %02hhX %02hhX %02hhX %02hhX "
+ "%02hhX %02hhX %02hhX %02hhX %02hhX %02hhX %02hhX %02hhX"
+ , *head, *(head+1), *(head+2), *(head+3)
+ , *(head+4), *(head+5), *(head+6), *(head+7)
+ , *(head+8), *(head+9), *(head+10), *(head+11)
+ , *(head+12), *(head+13), *(head+14), *(head+15));
+
+ }
+ }
+ LOGGER_PUT_LOG_INFO(LOG_CAT_L7VSD_REPLICATION,23,"Replication Dump End ------------------------------");
+
+
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG){
+
+ char *q;
+ char *head_debug;
+ int j=0;
+ int k=0;
+
+ // Component Memory Dump
+ q = (char *)replication_state.component_memory;
+
+ // Output mode
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,89,"Component Dump Satrt ----------------------------");
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,90,"Mode is [ %s ].",
+ replication_mode[(int)replication_state.service_status]);
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,91,"Total Block is [ %u ]",
+ replication_state.total_block);
+
+ // Converts into the binary, and writes it to the file.
+ for ( j = 0; j < size / DATA_SIZE ; j++ )
+ {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,92,"Block Number [ %d ]",j);
+
+ for ( k = 0; k < DATA_SIZE / LOG_DATA_WIDTH ; k++ )
+ {
+ head_debug = q + j*DATA_SIZE + k*LOG_DATA_WIDTH;
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,93,
+ "%02hhX %02hhX %02hhX %02hhX %02hhX %02hhX %02hhX %02hhX "
+ "%02hhX %02hhX %02hhX %02hhX %02hhX %02hhX %02hhX %02hhX"
+ , *head_debug, *(head_debug+1), *(head_debug+2), *(head_debug+3)
+ , *(head_debug+4), *(head_debug+5), *(head_debug+6), *(head_debug+7)
+ , *(head_debug+8), *(head_debug+9), *(head_debug+10), *(head_debug+11)
+ , *(head_debug+12), *(head_debug+13), *(head_debug+14), *(head_debug+15));
+
+ }
+ }
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,94,"Component Dump End ------------------------------");
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,95, "out_function : extern void l7vs_replication_dump_memory(void)");
+ }
+ // Debug log END
+ return;
+}
+
+
+/*! Chenge Status isActive
+ */
+extern void l7vs_replication_start()
+{
+
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,96, "in_function : extern void l7vs_replication_start(void)");
+ }
+ // Debug log END
+
+ switch (replication_state.service_status){
+ case REPLICATION_MASTER_STOP:
+ replication_state.service_status = REPLICATION_MASTER;
+ LOGGER_PUT_LOG_INFO(LOG_CAT_L7VSD_REPLICATION,24, "Replication start. mode : %s",
+ replication_mode[(int)replication_state.service_status]);
+ break;
+ case REPLICATION_SLAVE_STOP:
+ replication_state.service_status = REPLICATION_SLAVE;
+ LOGGER_PUT_LOG_INFO(LOG_CAT_L7VSD_REPLICATION,25, "Replication start. mode : %s",
+ replication_mode[(int)replication_state.service_status]);
+ break;
+ case REPLICATION_MASTER:
+ LOGGER_PUT_LOG_WARN(LOG_CAT_L7VSD_REPLICATION,8, "Could not MASTER start, because already start. mode : %s",
+ replication_mode[(int)replication_state.service_status]);
+ break;
+ case REPLICATION_SLAVE:
+ LOGGER_PUT_LOG_WARN(LOG_CAT_L7VSD_REPLICATION,9, "Could not SALVE start, because already start. mode : %s",
+ replication_mode[(int)replication_state.service_status]);
+ break;
+ default:
+ LOGGER_PUT_LOG_WARN(LOG_CAT_L7VSD_REPLICATION,10, "Could not start, because mode is %s.",
+ replication_mode[(int)replication_state.service_status]);
+ break;
+ }
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,97, "out_function : extern void l7vs_replication_start(void)");
+ }
+ // Debug log END
+
+}
+
+/*! Chenge Status isStop
+ */
+extern void l7vs_replication_stop()
+{
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,98, "in_function : extern void l7vs_replication_start(void)");
+ }
+ // Debug log END
+ switch (replication_state.service_status){
+ case REPLICATION_MASTER:
+ replication_state.service_status = REPLICATION_MASTER_STOP;
+ LOGGER_PUT_LOG_INFO(LOG_CAT_L7VSD_REPLICATION,26, "Replication stop. mode : %s",
+ replication_mode[(int)replication_state.service_status]);
+ break;
+ case REPLICATION_SLAVE:
+ replication_state.service_status = REPLICATION_SLAVE_STOP;
+ LOGGER_PUT_LOG_INFO(LOG_CAT_L7VSD_REPLICATION,27, "Replication stop. mode : %s",
+ replication_mode[(int)replication_state.service_status]);
+ break;
+ case REPLICATION_MASTER_STOP:
+ LOGGER_PUT_LOG_WARN(LOG_CAT_L7VSD_REPLICATION,11, "Could not MASTER stop, because already stop. mode : %s",
+ replication_mode[(int)replication_state.service_status]);
+ break;
+ case REPLICATION_SLAVE_STOP:
+ LOGGER_PUT_LOG_WARN(LOG_CAT_L7VSD_REPLICATION,12, "Could not SLAVE stop, because already stop. mode : %s",
+ replication_mode[(int)replication_state.service_status]);
+ break;
+ default:
+ LOGGER_PUT_LOG_WARN(LOG_CAT_L7VSD_REPLICATION,17, "Could not stop, because mode is %s",
+ replication_mode[(int)replication_state.service_status]);
+ break;
+
+ }
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,99, "out_function : extern void l7vs_replication_start(void)");
+ }
+ // Debug log END
+}
+
+/*! Compulsion reproduction execution
+ */
+extern void l7vs_replication_compulsorily()
+{
+ struct l7vs_replication_data replication_data;
+ int send_ret = -1;
+ int interval_ret = -1;
+ int ms_time = 0;
+ struct timespec time;
+
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,100, "in_function : extern void l7vs_replication_compulsorily(void)");
+ }
+ // Debug log END
+
+ // Check by continuous initialize.
+ if ( REPLICATION_MASTER != replication_state.service_status &&
+ REPLICATION_MASTER_STOP != replication_state.service_status )
+ {
+ // Initialization has already been done.
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_REPLICATION,23,
+ "Could not compulsion replication. Mode is different. mode : %s",
+ replication_mode[(int)replication_state.service_status]);
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,101, "out_function : extern void l7vs_replication_compulsorily(void)");
+ }
+ // Debug log END
+ return;
+ }else if ( REPLICATION_MASTER_STOP == replication_state.service_status ) {
+ LOGGER_PUT_LOG_INFO(LOG_CAT_L7VSD_REPLICATION,28,
+ "Can not replication compulsorily, because mode is %s .",
+ replication_mode[(int)replication_state.service_status]);
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,102, "out_function : extern void l7vs_replication_compulsorily(void)");
+ }
+ // Debug log END
+ return;
+ }
+
+ // Replication memory is NULL
+ if ( NULL == replication_state.replication_memory )
+ {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_SYSTEM_MEMORY,40, "Replication memory is NULL." );
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,103, "out_function : extern void l7vs_replication_compulsorily(void)");
+ }
+ // Debug log END
+ return;
+ }
+
+ // Component memory is NULL
+ if ( NULL == replication_state.component_memory )
+ {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_SYSTEM_MEMORY,41, "Component memory is NULL." );
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,104, "out_function : extern void l7vs_replication_compulsorily(void)");
+ }
+ // Debug log END
+ return;
+ }
+
+ // set send interval
+ time.tv_sec = 0;
+ time.tv_nsec = 0;
+ interval_ret = parameter_is_int_exist( PARAM_COMP_REPLICATION, "compulsorily_interval" );
+
+ if ( 0 == interval_ret )
+ {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_REPLICATION, 51, "Could not get interval value for replication compulsorily.");
+ return;
+ }
+
+ ms_time = parameter_get_int_value( PARAM_COMP_REPLICATION, "compulsorily_interval" );
+
+ if ( ms_time < MIN_COMPULSORILRY_INTERVAL || MAX_COMPULSORILRY_INTERVAL < ms_time )
+ {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_REPLICATION, 52, "Invalid compulsorily interval.");
+ return;
+ }
+
+ time.tv_nsec = (long)( ms_time * 1000000 );
+
+ // set last send block is c maximum block
+ replication_state.last_send_block = replication_state.total_block-1;
+
+ for(unsigned int i = 0; i < replication_state.total_block; i++)
+ {
+ // set compulsorily interval.
+ nanosleep( &time, NULL);
+
+ // Temporary preservation sturuct initialize
+ memset( &replication_data, 0, sizeof(struct l7vs_replication_data) );
+ send_ret = l7vs_replication_send_data(&replication_data);
+
+ // change iomux status
+ l7vs_replication_iomux->status = iomux_replication_send_wait;
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,105,
+ "l7vs_replication_iomux->status :"
+ "befor : iomux_replication_sending"
+ "after : iomux_replication_send_wait");
+ }
+ // Debug log END
+
+ if ( 0 != send_ret )
+ {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_SYSTEM,5,
+ "Send data is Failed." );
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,106, "out_function : extern void l7vs_replication_compulsorily(void)");
+ }
+ // Debug log END
+ return;
+ }
+
+ // set last send block number
+ if ( replication_state.last_send_block < replication_state.total_block-1 )
+ {
+ replication_state.last_send_block += 1;
+ LOGGER_PUT_LOG_INFO(LOG_CAT_L7VSD_REPLICATION,29,
+ "Data sending succeeded. Send block number : %u Version : %llu"
+ ,replication_state.last_send_block
+ ,(unsigned long long)replication_state.sarface_block_no );
+ }else if(replication_state.last_send_block == replication_state.total_block-1){
+ replication_state.last_send_block = 0;
+ LOGGER_PUT_LOG_INFO(LOG_CAT_L7VSD_REPLICATION,30,
+ "Data sending succeeded. Send block number : %u Version : %llu"
+ ,replication_state.last_send_block
+ ,(unsigned long long)replication_state.sarface_block_no );
+ }else{
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_REPLICATION,24,
+ "Last send block number is illegal.");
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,107, "out_function : extern void l7vs_replication_compulsorily(void)");
+ }
+ // Debug log END
+ return;
+ }
+
+ // sarface block number is change
+ if(replication_state.total_block == replication_state.last_send_block + 1 )
+ {
+ // Synchronization is executed.
+ memcpy(replication_state.replication_memory,
+ replication_state.component_memory,
+ replication_state.total_block*DATA_SIZE );
+
+ // serial initialize
+ replication_state.sarface_block_no = 0;
+
+ // make new serial
+ replication_state.sarface_block_no = (uint64_t)l7vs_replication_make_serial();
+ if ( 0 == replication_state.sarface_block_no )
+ {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_REPLICATION,25,
+ "Could not get serial number.");
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,108, "out_function : extern void l7vs_replication_compulsorily(void)");
+ }
+ // Debug log END
+ return;
+ }
+ if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,109,
+ "Copy Success from component memory to replication memory." );
+ }
+ }
+ }
+ LOGGER_PUT_LOG_INFO(LOG_CAT_L7VSD_REPLICATION,31, "Replication compulsorily is success." );
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,110, "out_function : extern void l7vs_replication_compulsorily(void)");
+ }
+ // Debug log END
+ return;
+
+}
+
+/*! Interval Re-setting
+ */
+extern void l7vs_replication_reset()
+{
+ int ret;
+ unsigned short value = 0;
+
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,111, "in_function : extern void l7vs_replication_reset(void)");
+ }
+ // Debug log END
+
+ // Check Parameter exists
+ ret = parameter_is_int_exist(PARAM_COMP_REPLICATION,"interval");
+ if ( 0 == ret )
+ {
+ LOGGER_PUT_LOG_WARN(LOG_CAT_L7VSD_REPLICATION,13, "Not chage re-setting value.");
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,112, "out_function : extern void l7vs_replication_reset(void)");
+ }
+ // Debug log END
+ return;
+ }
+
+ // Get interval
+ value = parameter_get_int_value( PARAM_COMP_REPLICATION, "interval" );
+
+ // Check interval
+ if ( value < MIN_INTERVAL || MAX_INTERVAL < value ){
+ LOGGER_PUT_LOG_WARN(LOG_CAT_L7VSD_REPLICATION,14, "Invalid Interval value. value : %d",(int)value);
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,113, "out_function : extern void l7vs_replication_reset(void)");
+ }
+ // Debug log END
+ return;
+ }
+ //set interval
+ replication_info.interval = value;
+}
+
+/*! Get Status
+ *
+ * @return REPLICATION_MODE_TAG enumration
+ *
+ */
+extern enum REPLICATION_MODE_TAG l7vs_replication_get_status()
+{
+
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,114, "function : extern enum REPLICATION_MODE_TAG l7vs_replication_get_status(void)");
+ }
+ // Debug log END
+ return replication_state.service_status;
+};
+
+
+/*! Send Interval Check
+ *
+ * @return 0/-1
+ * @retval 0 Send data
+ * @retval -1 Not send data
+ */
+extern int l7vs_replication_checkinterval()
+{
+ struct timeval tv;
+ struct timezone tz;
+ unsigned long long sending_time = 0;
+ unsigned long long last_send_time = 0;
+ unsigned long long diff_time = 0;
+
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,115, "in_function : extern int l7vs_replication_checkinterval(void)");
+ }
+ // Debug log END
+
+ // last time
+ last_send_time = replication_state.send_time;
+
+ // now time
+ gettimeofday(&tv,&tz);
+ sending_time = (unsigned long long)(tv.tv_sec*1000000+tv.tv_usec);
+
+
+ // Last send time is 0.
+ if ( 0 == last_send_time )
+ {
+ replication_state.send_time = sending_time;
+ LOGGER_PUT_LOG_INFO(LOG_CAT_L7VSD_REPLICATION,32,
+ " Last send time is 0. ");
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,116,
+ "out_function : extern int l7vs_replication_checkinterval(void)"
+ "return = 0");
+ }
+ // Debug log END
+ return 0;
+ }
+ //Last send time is illegal.
+ if ( last_send_time > sending_time)
+ {
+ replication_state.send_time = sending_time;
+ LOGGER_PUT_LOG_ERROR (LOG_CAT_L7VSD_REPLICATION,26,
+ " Last send time illegal. ");
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,117,
+ "out_function : extern int l7vs_replication_checkinterval(void)"
+ "return = -1");
+ }
+ // Debug log END
+ return -1;
+ }
+ // interval
+ diff_time = sending_time - last_send_time;
+ // exit
+
+ if ( diff_time >= replication_info.interval)
+ {
+ replication_state.send_time = sending_time;
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,118," Send time is arrived ");
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,119,
+ "out_function : extern int l7vs_replication_checkinterval(void)"
+ "return = 0");
+ }
+ // Debug log END
+ return 0;
+ }else{
+
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,120," Send time is not arrived. ");
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,121,
+ "out_function : extern int l7vs_replication_checkinterval(void)"
+ "return = -1");
+ }
+ // Debug log END
+ return -1;
+ }
+}
+
+/*! Parameter Check
+ *
+ * @return 0/-1
+ * @retval 0 Success
+ * @retval -1 Error
+ */
+static int l7vs_replication_check_parameter()
+{
+ int ret = -1;
+ int info_ret = -1;
+ int cmp_ret = -1;
+ struct addrinfo hints;
+ size_t sum=0;
+
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,122,
+ "in_function : static int l7vs_replication_check_parameter(void)");
+ }
+ // Debug log END
+
+ // initialize structure
+ memset(&hints, 0, sizeof(struct addrinfo));
+
+
+ // set address hints
+ hints.ai_family = AF_UNSPEC; // permit any protocol (IPv4, IPv6, etc.)
+ hints.ai_socktype = SOCK_DGRAM; // UDP
+ // IP NULL check
+ if ( 0 == strcmp(replication_info.ip_addr, "") )
+ {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_REPLICATION,27,"IP is unsetting.");
+ ret = -1;
+ goto END;
+ }
+ // Port NULL check
+ if ( 0 == strcmp(replication_info.service_name,"") )
+ {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_REPLICATION,28,"Port is unsetting.");
+ ret = -1;
+ goto END;
+ }
+ // Whether IP and the port are effective is confirmed.
+ info_ret = getaddrinfo(replication_info.ip_addr,replication_info.service_name,&hints,&internal_val.address_info);
+ if ( 0 != info_ret )
+ {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_SYSTEM_SOCKET,27, "Failed to get IP or Service Name.(%d)",ret);
+ ret = -1;
+ goto END;
+ }
+ struct sockaddr_in *sin;
+ sin = (sockaddr_in *)internal_val.address_info->ai_addr;
+
+ // Port check
+ if ( sin->sin_port == htons(0))
+ {
+ LOGGER_PUT_LOG_WARN(LOG_CAT_L7VSD_REPLICATION,15, "You can't specify port number 0.")
+ ret = -1;
+ goto END;
+ }
+ // NIC check
+ if ( 0 == strcmp( replication_info.nic, "") )
+ {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_REPLICATION,29,"NIC is unsetting.");
+ ret = -1;
+ goto END;
+ }
+ // Interval check
+ if ((MIN_INTERVAL>replication_info.interval) || (MAX_INTERVAL<replication_info.interval))
+ {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_REPLICATION,30,"Invalid Interval value");
+ ret = -1;
+ goto END;
+ }
+ // Components ID check
+ // Components Size check
+ if (0 == replication_info.component_num)
+ {
+ LOGGER_PUT_LOG_INFO(LOG_CAT_L7VSD_REPLICATION,33,"Can not get component, because component is 0.");
+ ret = 0;
+ goto END;
+ }
+ for ( int i=0; i < replication_info.component_num; i++ )
+ {
+ sum += replication_info.component_info[i].block_size ;
+ for ( int j=i+1; j<replication_info.component_num; j++)
+ {
+ cmp_ret = strcmp(replication_info.component_info[j].id,replication_info.component_info[i].id);
+ if (0 == cmp_ret)
+ {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_REPLICATION,31,
+ "Too many component block. Max is %d . ",replication_state.total_block);
+ ret = -1;
+ goto END;
+ }
+ }
+ }
+ if ( sum > CMP_BLOCK_MAX )
+ {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_REPLICATION,32,"Total component size is too large.");
+ ret = -1;
+ goto END;
+ }
+ ret = 0;
+END:
+ if ( NULL != internal_val.address_info )
+ {
+ freeaddrinfo(internal_val.address_info);
+ internal_val.address_info = NULL;
+ }
+
+ if ( 0 == ret )
+ {
+ LOGGER_PUT_LOG_INFO(LOG_CAT_L7VSD_REPLICATION,34,"Parameter Check OK.");
+ }else{
+ LOGGER_PUT_LOG_INFO(LOG_CAT_L7VSD_REPLICATION,35,"Parameter Check NG.");
+ }
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,123,
+ "out_function : static int l7vs_replication_check_parameter(void)"
+ "return = %d",ret);
+ }
+ // Debug log END
+ return ret;
+};
+
+
+/*! Get Replication Memory
+ *
+ * @param total_block The entire block that the component uses.
+ *
+ * @return memory Replication memory
+ * @retval memory memory get Success
+ * @retval NULL Error
+ *
+ */
+static void *l7vs_replication_get_replication_address()
+{
+ unsigned int total_block = replication_state.total_block;
+ void *memory = NULL;
+
+
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,124,
+ "in_function : static void *l7vs_replication_get_replication_address(void)");
+ }
+ // Debug log END
+
+ // Check by continuous initialize.
+ if ( REPLICATION_OUT != replication_state.service_status )
+ {
+ // Initialization has already been done.
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_REPLICATION,33, "Already got replication memory.");
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,125,
+ "out_function : static void *l7vs_replication_get_replication_address(void)"
+ "return = NULL");
+ }
+ // Debug log END
+ return NULL;
+ }
+
+ // Check Total Block
+ if ( 0 == total_block || total_block > CMP_BLOCK_MAX)
+ {
+ // Check Total Block
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_REPLICATION,34, "Invalid total component blocks.");
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,126,
+ "out_function : static void *l7vs_replication_get_replication_address(void)"
+ "return = NULL");
+ }
+ // Debug log END
+ return NULL;
+ }
+ // Get replication memory
+ memory = malloc( total_block*DATA_SIZE );
+
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_SYSTEM_MEMORY) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_SYSTEM_MEMORY,40, "malloc : memory=%p: size=%d",memory,total_block*DATA_SIZE);
+ }
+ // Debug log END
+
+ // malloc Error
+ if ( (void *)NULL == memory )
+ {
+ LOGGER_PUT_LOG_FATAL(LOG_CAT_L7VSD_SYSTEM_MEMORY,1,"Replication memory is Malloc Error.");
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,127,
+ "out_function : static void *l7vs_replication_get_replication_address(void)"
+ "return = NULL");
+ }
+ // Debug log END
+ return NULL;
+ }
+ memset(memory,0,total_block*DATA_SIZE);
+
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,128,
+ "out_function : static void *l7vs_replication_get_replication_address(void)"
+ "return = %p",memory);
+ }
+ // Debug log END
+ return memory;
+}
+
+
+/*! Get Component Memory
+ *
+ * @return memory Component memory
+ * @retval memory memory get Success
+ * @retval NULL Error
+ *
+ */
+static void *l7vs_replication_get_component_address()
+{
+ unsigned int total_block ;
+ void *memory = NULL ;
+
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,129, "in_function : static void *l7vs_replication_get_component_address(void)");
+ }
+ // Debug log END
+
+ total_block = replication_state.total_block;
+ // Check by continuous initialize.
+ if ( REPLICATION_OUT != replication_state.service_status )
+ {
+ // Initialization has already been done.
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_REPLICATION,35, "Already got component memory.");
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,130,
+ "out_function : static void *l7vs_replication_get_component_address(void)"
+ "return = NULL");
+ }
+ // Debug log END
+ return NULL;
+ }
+ // Check Total Block
+ if ( 0 == total_block || total_block > CMP_BLOCK_MAX)
+ {
+ // Check Total Block
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_REPLICATION,36, "Invalid total component blocks.");
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,131,
+ "out_function : static void *l7vs_replication_get_component_address(void)"
+ "return = NULL");
+ }
+ // Debug log END
+ return NULL;
+ }
+ // Get component memory
+ memory = malloc( total_block*DATA_SIZE );
+
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_SYSTEM_MEMORY) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_SYSTEM_MEMORY,41, "malloc : memory=%p: size=%d",memory,total_block*DATA_SIZE);
+ }
+ // Debug log END
+
+ // malloc Error
+ if ( (void *)NULL == memory )
+ {
+ LOGGER_PUT_LOG_FATAL(LOG_CAT_L7VSD_SYSTEM_MEMORY,2,"Component memory is Malloc Error.");
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,132,
+ "out_function : static void *l7vs_replication_get_component_address(void)"
+ "return = NULL");
+ }
+ // Debug log END
+ return NULL;
+ }
+ memset(memory,0,total_block*DATA_SIZE);
+
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,133,
+ "out_function : static void *l7vs_replication_get_component_address(void)"
+ "return = %p",memory);
+ }
+ // Debug log END
+ return memory;
+}
+
+
+/*! Get Sarface Number Memory
+ *
+ * @return memory Component memory
+ * @retval memory memory get Success
+ * @retval NULL Error
+ *
+ */
+static uint64_t *l7vs_replication_get_surface_info_address()
+{
+ unsigned int total_block;
+ uint64_t *memory = NULL;
+
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,134,
+ "in_function : static uint64_t *l7vs_replication_get_surface_info_address(void)");
+ }
+ // Debug log END
+ total_block = replication_state.total_block;
+ // Check by continuous initialize.
+ if ( REPLICATION_OUT != replication_state.service_status )
+ {
+ // Initialization has already been done.
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_REPLICATION,37, "Already got surface info memory.");
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,135,
+ "out_function : static uint64_t *l7vs_replication_get_surface_info_address(void)"
+ "return = NULL");
+ }
+ // Debug log END
+ return NULL;
+ }
+ // Check Total Block
+ if ( 0 == total_block || total_block > CMP_BLOCK_MAX)
+ {
+ // Check Total Block
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_REPLICATION,38, "Invalid total component blocks.");
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,136,
+ "out_function : static uint64_t *l7vs_replication_get_surface_info_address(void)"
+ "return = NULL");
+ }
+ // Debug log END
+ return NULL;
+ }
+ // Get memory
+ memory = (uint64_t*)malloc( total_block*sizeof(uint64_t) );
+
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_SYSTEM_MEMORY) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_SYSTEM_MEMORY,42, "malloc : memory=%p: size=%lu",memory,total_block*sizeof(uint64_t));
+ }
+ // Debug log END
+
+ // malloc Error
+ if ( (uint64_t *)NULL == memory )
+ {
+ LOGGER_PUT_LOG_FATAL(LOG_CAT_L7VSD_SYSTEM_MEMORY,3,"Surface info address is Malloc Error.");
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,137,
+ "out_function : static uint64_t *l7vs_replication_get_surface_info_address(void)"
+ "return = NULL");
+ }
+ // Debug log END
+ return NULL;
+ }
+ memset(memory,0,total_block*sizeof(uint64_t));
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,138,
+ "out_function : static uint64_t *l7vs_replication_get_surface_info_address(void)"
+ "return = %p",memory);
+ }
+ // Debug log END
+ return memory;
+}
+
+/*! Initialize send network socket
+ *
+ * @param *fd file descriptor
+ *
+ * @return 0/-1
+ * @retval 0 Success
+ * @retval -1 Error
+ */
+static int l7vs_replication_send_sock_init( )
+{
+ int info_ret;
+ int sockopt_ret;
+ int errsv;
+ int ret = -1;
+ struct addrinfo hints;
+
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,139,
+ "in_function : static int l7vs_replication_send_sock_init(void)");
+ }
+ // Debug log END
+
+ // Check by continuous initialize.
+ if ( REPLICATION_SINGLE == replication_state.service_status ||
+ REPLICATION_MASTER == replication_state.service_status ||
+ REPLICATION_MASTER_STOP == replication_state.service_status )
+ {
+ // Initialization has already been done.
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_REPLICATION,39,
+ "send-socket initialization has already been done. mode : %s",
+ replication_mode[(int)replication_state.service_status]);
+ ret = -1;
+ goto END;
+ }
+ // initialize structure
+ memset(&hints, 0, sizeof(struct addrinfo));
+
+ // set address hints
+ hints.ai_family = AF_UNSPEC; // permit any protocol (IPv4, IPv6, etc.)
+ hints.ai_socktype = SOCK_DGRAM; // UDP
+ hints.ai_flags = AI_ALL;
+
+ //------ Make send socket -------//
+ // Whether IP and the port are effective is confirmed.
+ info_ret = getaddrinfo(replication_info.ip_addr,
+ replication_info.service_name,
+ &hints,
+ &internal_val.address_info);
+ if ( 0 != info_ret )
+ {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_REPLICATION,40, "Failed to get IP or Port.");
+ ret = -1;
+ goto END;
+ }
+
+ internal_val.socket = socket( internal_val.address_info->ai_family,
+ internal_val.address_info->ai_socktype,
+ internal_val.address_info->ai_protocol );
+ // if cannot make a socket
+ if ( internal_val.socket < 3 )
+ {
+ errsv = errno;
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_SYSTEM_SOCKET,28,
+ "Make send socket error : %s ai_family:%d ai_socktype:%d ai_protocol:%d",
+ strerror(errsv),internal_val.address_info->ai_family,
+ internal_val.address_info->ai_socktype,
+ internal_val.address_info->ai_protocol);
+ ret = -1;
+ goto END;
+ }
+ // set a NIC
+ sockopt_ret = setsockopt(internal_val.socket, SOL_SOCKET, SO_BINDTODEVICE,
+ replication_info.nic, strlen(replication_info.nic) + 1);
+ if ( -1 == sockopt_ret )
+ {
+ // get error no
+ errsv = errno;
+ // cannot set a NIC. Close a Socket.
+ close(internal_val.socket);
+ internal_val.socket = -1;
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_SYSTEM_SOCKET,29,
+ "Fails in the option operation of send socket : %s File descriptor : %d NIC : %s",
+ strerror(errsv),internal_val.socket,replication_info.nic);
+ ret = -1;
+ goto END;
+ }
+ LOGGER_PUT_LOG_INFO(LOG_CAT_L7VSD_SYSTEM_SOCKET,1,"send-socket is make success.");
+ ret = 0;
+END:
+
+ if ( 0 == ret )
+ {
+ LOGGER_PUT_LOG_INFO(LOG_CAT_L7VSD_REPLICATION,36,"send-soket initialization is succeess.");
+ }else{
+ if ( -1 != internal_val.socket )
+ {
+ close(internal_val.socket);
+ internal_val.socket = -1;
+ }
+ LOGGER_PUT_LOG_INFO(LOG_CAT_L7VSD_REPLICATION,37,"send-soket initialization is failure.");
+ }
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,140,
+ "out_function : static int l7vs_replication_send_sock_init(void)"
+ "ret = %d",ret);
+ }
+ // Debug log END
+ return ret;
+}
+
+
+/*! Initialize recv network socket
+ *
+ * @param *fd file descriptor
+ *
+ * @return 0/-1
+ * @retval 0 Success
+ * @retval -1 Error
+ */
+static int l7vs_replication_recv_sock_init( )
+{
+ int getip_ret;
+ int bind_ret;
+ int errsv;
+ int ret = -1;
+ struct servent *servent_info;
+
+
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,141,
+ "in_function : static int l7vs_replication_recv_sock_init(void)");
+ }
+ // Debug log END
+
+ // Check by continuous initialize.
+ if ( REPLICATION_SINGLE == replication_state.service_status ||
+ REPLICATION_SLAVE == replication_state.service_status ||
+ REPLICATION_SLAVE_STOP == replication_state.service_status )
+ {
+ // Initialization has already been done.
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_REPLICATION,41,
+ "recv-socket initialization has already been done. mode : %s",
+ replication_mode[(int)replication_state.service_status]);
+ ret = -1;
+ goto END;
+ }
+
+ // get Name for NetworkDeviceName ( IPv4 or IPv6 )
+ // address info structs initialize
+ memset( &internal_val.addr, 0, sizeof(struct addressinfo) );
+
+ // get ip address from nic
+ getip_ret = getNICAddressInfo(replication_info.nic, &addr);
+ if ( 0 == getip_ret )
+ {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_SYSTEM_SOCKET,31,"You can not get IP address from nic.");
+ ret = -1;
+ goto END;
+ }
+
+
+ servent_info = getservbyname(replication_info.service_name,"udp");
+ if( !servent_info )
+ {
+ internal_val.addr.addr_in.sin_port = htons( atoi(replication_info.service_name ) );
+ }
+ else{
+ internal_val.addr.addr_in.sin_port = servent_info->s_port ;
+ }
+
+ if ( 0 == internal_val.addr.addr_in.sin_port )
+ {
+ LOGGER_PUT_LOG_ERROR( LOG_CAT_L7VSD_SYSTEM_SOCKET,32,"You can not get port address from %s.",replication_info.service_name );
+ ret = -1;
+ goto END;
+ }
+
+
+ //make recv socket
+ internal_val.socket = socket( PF_INET,
+ SOCK_DGRAM,
+ IPPROTO_UDP );
+
+ // if cannot make a socket
+ if ( internal_val.socket < 3 )
+ {
+ errsv = errno;
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_SYSTEM_SOCKET,32,
+ "Make recv socket error : %s ai_family:%d ai_socktype:%d ai_protocol:%d",
+ strerror(errsv),
+ PF_INET,
+ SOCK_DGRAM,
+ IPPROTO_UDP);
+ ret = -1;
+ goto END;
+ }
+
+ bind_ret = bind(internal_val.socket,(sockaddr *)&internal_val.addr.addr_in, sizeof(internal_val.addr.addr_in));
+
+ // get error no
+ errsv = errno;
+ // Error
+ if ( bind_ret != 0 )
+ {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_SYSTEM_SOCKET,33,
+ "Bind error : %s File descriptor : %d ai_addrlen : %d",
+ strerror(errsv),
+ internal_val.socket,
+ (int)sizeof(struct sockaddr));
+ //! Close a Socket.
+ ret = -1;
+ goto END;
+ }
+ LOGGER_PUT_LOG_INFO(LOG_CAT_L7VSD_SYSTEM_SOCKET,2,"recv-socket is make success.");
+ ret = 0;
+END:
+
+ if ( 0 == ret )
+ {
+ LOGGER_PUT_LOG_INFO(LOG_CAT_L7VSD_REPLICATION,38,"recv-socket initialization is succeess.");
+ }else{
+ if ( -1 != internal_val.socket )
+ {
+ close(internal_val.socket);
+ internal_val.socket = -1;
+ }
+ LOGGER_PUT_LOG_INFO(LOG_CAT_L7VSD_REPLICATION,39,"recv-socket initialization is failure..");
+ }
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,142,
+ "out_function : static int l7vs_replication_recv_sock_init(void)"
+ "ret = %d",ret);
+ }
+ // Debug log END
+ return ret;
+}
+
+/*! Finalize network socket
+ */
+static void l7vs_replication_sock_fini()
+{
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,143,
+ "in_function : static void l7vs_replication_sock_fini(void)");
+ }
+ // Debug log END
+
+ // close a send socket.
+ if ( -1 != internal_val.socket )
+ {
+ close(internal_val.socket);
+ internal_val.socket = -1;
+ }
+ // free address info
+ if ( NULL != internal_val.address_info)
+ {
+ freeaddrinfo(internal_val.address_info);
+ internal_val.address_info = NULL;
+ }
+
+ LOGGER_PUT_LOG_INFO(LOG_CAT_L7VSD_REPLICATION,40, "Socket(send-socket,recv-socket) is finalize.");
+
+ if ( NULL != l7vs_replication_iomux)
+ {
+ // replication fini
+ l7vs_replication_iomux->status = iomux_replication_destroy;
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,144,
+ "l7vs_replication_iomux->status : iomux_replication_destroy");
+ }
+ // Debug log END
+
+ // delete l7vs_iomux
+ if ( -1 != l7vs_replication_iomux->fd ) {
+ l7vs_iomux_remove(l7vs_replication_iomux);
+ l7vs_replication_iomux->fd = -1;
+ }
+ }
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,145,
+ "out_function : static void l7vs_replication_sock_fini(void)");
+ }
+ // Debug log END
+ return;
+}
+
+/*! Make serial number
+ *
+ * @return Serial number
+ * @retval nonzero Serial number
+ * @retval 0 Error
+ */
+static unsigned long long l7vs_replication_make_serial()
+{
+ unsigned long long int serial_num;
+ struct timespec current_time;
+
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,146,
+ "in_function : static void l7vs_replication_sock_fini(void)");
+ }
+ // Debug log END
+
+ // get time by clock_gettime
+ if ( clock_gettime(CLOCK_REALTIME, ¤t_time) == -1 )
+ {
+ // failre.
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_SYSTEM,6, "You failed to get of time.");
+ serial_num = 0;
+ } else {
+ // make a serial succeeds.
+ serial_num = (unsigned long long int) current_time.tv_sec * 1000000 +
+ (unsigned long long int) current_time.tv_nsec / 1000;
+ }
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,147,
+ "in_function : static void l7vs_replication_sock_fini(void)"
+ "return = %llu",serial_num);
+ }
+ // Debug log END
+
+ return serial_num;
+}
+
+/*! Send transfer data to standby server
+ *
+ * @param data Points to input data from external program. This will be send to standby server.
+ *
+ * @return 0/-1
+ * @retval 0 Success
+ * @retval -1 Error
+ */
+static int l7vs_replication_send_data(struct l7vs_replication_data *replication_data)
+{
+ char *send_memory;
+ int send_byte;
+ int errsv;
+ struct l7vs_replication_data send_data;
+
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,148,
+ "in_function : static int l7vs_replication_send_data(struct l7vs_replication_data *replication_data)"
+ "replication_data = %p",replication_data);
+ }
+ // Debug log END
+
+
+ // Check Argument is NULL.
+ if ( NULL == replication_data )
+ {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_REPLICATION,42, "Argument is NULL.");
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,149,
+ "out_function : static int l7vs_replication_send_data(struct l7vs_replication_data *replication_data)"
+ "return = -1");
+ }
+ // Debug log END
+ return -1;
+ }
+
+ // mode check
+ if ( REPLICATION_MASTER != replication_state.service_status)
+ {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_REPLICATION,43, "Can not send replication data. Mode is difficult. mode : %s",
+ replication_mode[(int)replication_state.service_status]);
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,150,
+ "out_function : static int l7vs_replication_send_data(struct l7vs_replication_data *replication_data)"
+ "return = -1");
+ }
+ // Debug log END
+ return -1;
+ }
+ // Check to replication memory is not NULL
+ if ( NULL == replication_state.replication_memory )
+ {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_SYSTEM_MEMORY,42, "Replication memory is NULL.");
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,151,
+ "out_function : static int l7vs_replication_send_data(struct l7vs_replication_data *replication_data)"
+ "return = -1");
+ }
+ // Debug log END
+ return -1;
+ }
+
+ // Check to iomux memory is not NULL
+ if ( NULL == l7vs_replication_iomux)
+ {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_SYSTEM_MEMORY,43, "Initialize is not yet. Iomux is NULL.");
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,152,
+ "out_function : static int l7vs_replication_send_data(struct l7vs_replication_data *replication_data)"
+ "return = -1");
+ }
+ // Debug log END
+ return -1;
+ }
+
+ // internal_val.address_info is NULL
+ if ( NULL == internal_val.address_info)
+ {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_SYSTEM_MEMORY,44, "Initialize is not yet. address info is NULL.");
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,153,
+ "out_function : static int l7vs_replication_send_data(struct l7vs_replication_data *replication_data)"
+ "return = -1");
+ }
+ // Debug log END
+ return -1;
+ }
+
+
+ // make replication data struct
+ //initialize
+ memset(replication_data, 0, sizeof(struct l7vs_replication_data));
+ // Set replication id
+ replication_data->id = REPLICATION_ID;
+ // set block_num (replication_state.last_send_block + 1) and Range check of memory
+ if ( replication_state.last_send_block < replication_state.total_block -1)
+ {
+ replication_data->block_num = replication_state.last_send_block + 1;
+ } else if ( replication_state.last_send_block == replication_state.total_block -1){
+ replication_data->block_num = 0;
+ }else{
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_REPLICATION,44, "Recv block number is too large.");
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,154,
+ "out_function : static int l7vs_replication_send_data(struct l7vs_replication_data *replication_data)"
+ "return = -1");
+ }
+ // Debug log END
+ return -1;
+ }
+
+ // set serial
+ replication_data->serial = replication_state.sarface_block_no;
+ if ( 0 == replication_data->serial && 0 == replication_data->block_num)
+ {
+ LOGGER_PUT_LOG_INFO(LOG_CAT_L7VSD_REPLICATION,41, "Serial number is 0, first send processing. ");
+ }
+
+ // set data size (sizeof(replication_data))
+ replication_data->size = sizeof(struct l7vs_replication_data);
+
+ if ( replication_data->size > SEND_DATA_SIZE)
+ {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_REPLICATION,45, "Recv block data size is too large.");
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,155,
+ "out_function : static int l7vs_replication_send_data(struct l7vs_replication_data *replication_data)"
+ "return = -1");
+ }
+ // Debug log END
+ return -1;
+ }
+
+ // change iomux status
+ l7vs_replication_iomux->status = iomux_replication_sending;
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,156,
+ "l7vs_replication_iomux->status :"
+ "befor : iomux_replication_send_wait"
+ "after : iomux_replication_sending");
+ }
+ // Debug log END
+
+ // set send data
+ memset(&send_data,0,sizeof(struct l7vs_replication_data));
+ // change to network byteorder
+ send_data.id = htons(replication_data->id);
+ send_data.serial = replication_data->serial;
+ send_data.block_num = htonl(replication_data->block_num);
+ send_data.size = (uint64_t)replication_data->size;
+
+ // set replication data (1 block)
+ send_memory = (char *)replication_state.replication_memory + DATA_SIZE*replication_data->block_num;
+ memcpy( &send_data.data, send_memory, DATA_SIZE );
+
+ // send to data
+ send_byte = sendto(internal_val.socket, &send_data, (int)replication_data->size, 0,
+ internal_val.address_info->ai_addr, internal_val.address_info->ai_addrlen);
+ errsv = errno;
+
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG){
+ char replication_data_str[DEBUG_STR_LEN] = {0};
+ l7vs_replication_data_c_str(replication_data_str,replication_data);
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,157,
+ "replication_data_struct : %s",
+ replication_data_str);
+ }
+
+ // Debug log END
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG)
+ {
+ char *head;
+ int h=0;
+
+ for ( h = 0; h < (DATA_SIZE / LOG_DATA_WIDTH) ; h++ )
+ {
+ head = (char *)&send_data.data + h*LOG_DATA_WIDTH;
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,158,
+ "%02hhX %02hhX %02hhX %02hhX %02hhX %02hhX %02hhX %02hhX "
+ "%02hhX %02hhX %02hhX %02hhX %02hhX %02hhX %02hhX %02hhX"
+ , *head, *(head+1), *(head+2), *(head+3)
+ , *(head+4), *(head+5), *(head+6), *(head+7)
+ , *(head+8), *(head+9), *(head+10), *(head+11)
+ , *(head+12), *(head+13), *(head+14), *(head+15));
+ }
+ }
+ // Debug log END
+ if (-1 == send_byte)
+ {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_SYSTEM,7,
+ "Data send error : %s fd : %d size : %d ai_addr : %p addrlen : %d",
+ strerror(errsv),
+ internal_val.socket,
+ (int)replication_data->size,
+ internal_val.address_info->ai_addr,
+ internal_val.address_info->ai_addrlen);
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,159,
+ "out_function : static int l7vs_replication_send_data(struct l7vs_replication_data *replication_data)"
+ "return = -1");
+ }
+ // Debug log END
+ return -1;
+ }
+ if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,160,"Sent data is success. %d", send_byte);
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,161,
+ "out_function : static int l7vs_replication_send_data(struct l7vs_replication_data *replication_data)"
+ "return = 0");
+ }
+ // Debug log END
+ return 0;
+}
+/*! Receive transfer data from active server
+ *
+ * @param recv_data Points to output data from external program.
+ *
+ * @return 0/-1
+ * @retval 0 Success
+ * @retval -1 Error
+ */
+static int l7vs_replication_recv_data(struct l7vs_replication_data *replication_data)
+{
+ char *recv_memory;
+ int recv_byte;
+ int errsv = 0;
+ socklen_t fromlen;
+ struct l7vs_replication_data recv_data;
+
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG){
+ if ( NULL == replication_data )
+ {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,162,
+ "in_function : static int l7vs_replication_recv_data(struct l7vs_replication_data *replication_data)"
+ "replication_data = NULL");
+
+ }else{
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,163,
+ "in_function : static int l7vs_replication_recv_data(struct l7vs_replication_data *replication_data)"
+ "replication_data = %p",replication_data);
+ }
+ }
+ // Debug log END
+
+ // Check Argument is NULL.
+ if ( NULL == replication_data )
+ {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_REPLICATION,46, "Argument is NULL.");
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,164,
+ "out_function : static int l7vs_replication_recv_data(struct l7vs_replication_data *replication_data)"
+ "return = -1");
+ }
+ // Debug log END
+ return -1;
+ }
+
+ // mode check
+ if ( REPLICATION_SLAVE != replication_state.service_status)
+ {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_REPLICATION,47, "Can not receive replication data. Mode is difficult. mode : %s",
+ replication_mode[(int)replication_state.service_status]);
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,165,
+ "out_function : static int l7vs_replication_recv_data(struct l7vs_replication_data *replication_data)"
+ "return = -1");
+ }
+ // Debug log END
+ return -1;
+ }
+
+ // Check to replication memory is not NULL
+ if ( NULL == replication_state.replication_memory )
+ {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_SYSTEM_MEMORY,45, "Replication memory is NULL.");
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,166,
+ "out_function : static int l7vs_replication_recv_data(struct l7vs_replication_data *replication_data)"
+ "return = -1");
+ }
+ // Debug log END
+ return -1;
+ }
+
+ // Check to iomux memory is not NULL
+ if ( NULL == l7vs_replication_iomux)
+ {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_SYSTEM_MEMORY,46, "Initialize is not yet. Iomux is NULL.");
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,167,
+ "out_function : static int l7vs_replication_recv_data(struct l7vs_replication_data *replication_data)"
+ "return = -1");
+ }
+ // Debug log END
+ return -1;
+ }
+
+ fromlen = sizeof(struct sockaddr);
+
+ // change iomux status
+ l7vs_replication_iomux->status = iomux_replication_receving;
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,168,
+ "l7vs_replication_iomux->status :"
+ "before : iomux_replication_recv_wait :"
+ "after : iomux_replication_receving");
+ }
+ // Debug log END
+
+ //initialize
+ memset(&recv_data, 0, sizeof(struct l7vs_replication_data));
+ memset(replication_data, 0, sizeof(struct l7vs_replication_data));
+
+ // recv data
+ recv_byte = recvfrom( internal_val.socket, &recv_data,
+ sizeof(struct l7vs_replication_data),
+ MSG_DONTWAIT,
+ (sockaddr *)&internal_val.addr.addr_in,
+ &fromlen );
+ errsv = errno;
+
+ // change to host byteorder
+ replication_data->id = ntohs(recv_data.id);
+ replication_data->serial = recv_data.serial;
+ replication_data->block_num = ntohl(recv_data.block_num);
+ replication_data->size = (uint64_t) recv_data.size;
+
+ memcpy(&replication_data->data, &recv_data.data, DATA_SIZE);
+
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG)
+ {
+ char *head;
+ int h;
+
+ for ( h = 0; h < (DATA_SIZE / LOG_DATA_WIDTH) ; h++ )
+ {
+ head = (char *)&recv_data.data + h*LOG_DATA_WIDTH;
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,169,
+ "%02hhX %02hhX %02hhX %02hhX %02hhX %02hhX %02hhX %02hhX "
+ "%02hhX %02hhX %02hhX %02hhX %02hhX %02hhX %02hhX %02hhX"
+ , *head, *(head+1), *(head+2), *(head+3)
+ , *(head+4), *(head+5), *(head+6), *(head+7)
+ , *(head+8), *(head+9), *(head+10), *(head+11)
+ , *(head+12), *(head+13), *(head+14), *(head+15));
+ }
+ }
+ // Debug log END
+ if (-1 == recv_byte)
+ {
+ LOGGER_PUT_LOG_WARN(LOG_CAT_L7VSD_SYSTEM,2,
+ "Reception processing is error : %s fd : %d data : %p size : %d ai_addr : %p addrlen : %d",
+ strerror(errsv),
+ internal_val.socket,
+ (void *)&recv_data,
+ (int)recv_data.size,
+ &internal_val.addr.addr_in,
+ fromlen);
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,170,
+ "out_function : static int l7vs_replication_recv_data(struct l7vs_replication_data *replication_data)"
+ "return = -1");
+ }
+ // Debug log END
+ return -1;
+ }
+ if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,171,"Recv data is success. %u", recv_byte);
+ }
+ // Check replication ID
+ if (replication_data->id != REPLICATION_ID)
+ {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_REPLICATION,48, "Get invalid data.");
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,172,
+ "out_function : static int l7vs_replication_recv_data(struct l7vs_replication_data *replication_data)"
+ "return = -1");
+ }
+ // Debug log END
+ return -1;
+ }
+
+ // block number is over
+
+ if (replication_data->block_num > replication_state.total_block)
+ {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_REPLICATION,49, "Recv block number is too large.");
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,173,
+ "out_function : static int l7vs_replication_recv_data(struct l7vs_replication_data *replication_data)"
+ "return = -1");
+ }
+ // Debug log END
+ return -1;
+ }
+
+ // Comparison of serial numbers
+ if ( replication_data->serial < replication_state.sarface_block_array_ptr[replication_data->block_num])
+ {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_REPLICATION,50, "Recv replication data is too old.");
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,174,
+ "out_function : static int l7vs_replication_recv_data(struct l7vs_replication_data *replication_data)"
+ "return = -1");
+ }
+ // Debug log END
+ return -1;
+ }else{
+ // Substitution of version
+ replication_state.sarface_block_array_ptr[replication_data->block_num] = replication_data->serial;
+ }
+
+ // set recv data
+ recv_memory = (char *)replication_state.replication_memory + DATA_SIZE*replication_data->block_num;
+
+ // received data.
+ memcpy(recv_memory, &replication_data->data, DATA_SIZE);
+
+ // set sarface block
+ replication_state.sarface_block_array_ptr[replication_data->block_num] = replication_data->serial;
+
+ // Sarface numbers are compared.
+ for ( unsigned int i = 0; i < replication_state.total_block-1; i++ )
+ {
+ if ( replication_state.sarface_block_array_ptr[i] != replication_state.sarface_block_array_ptr[i+1])
+ {
+ break;
+ }
+ if ( i == replication_state.total_block-2)
+ {
+ // Synchronization is executed.
+ memcpy(replication_state.component_memory,
+ replication_state.replication_memory,
+ replication_state.total_block*DATA_SIZE );
+ if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,82, "Copy Success from replication memory to component memory.");
+ }
+ }
+ }
+
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,175,
+ "out_function : static int l7vs_replication_recv_data(struct l7vs_replication_data *replication_data)"
+ "return = 0");
+ }
+ // Debug log END
+ return 0;
+}
+
+/*! Release Replication Memory
+ */
+static void l7vs_replication_release_replication_address()
+{
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,176,
+ "in_function : static void l7vs_replication_release_replication_address(void)");
+ }
+ // Debug log END
+
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_SYSTEM_MEMORY) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_SYSTEM_MEMORY,43,
+ "free : replication_state.replication_memory=%p",
+ replication_state.replication_memory);
+ }
+ // Debug log END
+ if (NULL != replication_state.replication_memory )
+ {
+ free(replication_state.replication_memory);
+ }
+ replication_state.replication_memory=NULL;
+
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,177,
+ "out_function : static void l7vs_replication_release_replication_address(void)");
+ }
+ // Debug log END
+}
+
+/*!
+ * Release Components Memory
+ */
+static void l7vs_replication_release_components_address()
+{
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,178,
+ "in_function : static void l7vs_replication_release_components_address(void)");
+ }
+ // Debug log END
+
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_SYSTEM_MEMORY) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_SYSTEM_MEMORY,44,
+ "free : replication_state.component_memory=%p",
+ replication_state.component_memory);
+ }
+ // Debug log END
+ if ( NULL != replication_state.component_memory)
+ {
+ free(replication_state.component_memory);
+ }
+ replication_state.component_memory=NULL;
+
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,179,
+ "out_function : static void l7vs_replication_release_components_address(void)");
+ }
+ // Debug log END
+}
+
+/*! Release Sarface Memory
+ */
+static void l7vs_replication_release_surface_info_address()
+{
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,180,
+ "in_function : static void l7vs_replication_release_surface_info_address(void)");
+ }
+
+ // Debug log END
+
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_SYSTEM_MEMORY) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_SYSTEM_MEMORY,45,
+ "free : replication_state.sarface_block_array_ptr=%p",
+ replication_state.sarface_block_array_ptr);
+ }
+ // Debug log END
+ if ( NULL != replication_state.sarface_block_array_ptr )
+ {
+ free(replication_state.sarface_block_array_ptr);
+ }
+ replication_state.sarface_block_array_ptr=NULL;
+
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,181,
+ "out_function : static void l7vs_replication_release_surface_info_address(void)");
+ }
+ // Debug log END
+
+}
+
+/*
+ * get Name for NetworkDeviceName
+ * @param[IN] const char* NetworkDeviceName
+ * @param[OUT] struct addressinfo* address info struct
+ * @return 0 is fail / not 0 is success.
+ */
+static int getNICAddressInfo( const char* nicname, struct addressinfo* info )
+{
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,182,
+ "in_function : static int getNICAddressInfo( const char* nicname, struct addressinfo* info )"
+ "nicname = %p"
+ "info = %p",
+ nicname,
+ info);
+ }
+ // Debug log END
+
+ //NIC NAME Check
+ if( !nicname || !info )
+ {
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,183,
+ "out_function : static int getNICAddressInfo( const char* nicname, struct addressinfo* info )"
+ "return = 0");
+ }
+ // Debug log END
+ return 0;
+ }
+
+ //Networkdevice struct define
+ struct ifreq ifr;
+ memset( &ifr, 0, sizeof( struct ifreq ) );
+
+ //create socket
+ int fd = socket( AF_INET, SOCK_DGRAM, 0 );
+ if( fd < 0 )
+ {
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,184,
+ "out_function : static int getNICAddressInfo( const char* nicname, struct addressinfo* info )"
+ "return = 0");
+ }
+ // Debug log END
+ return 0;
+ }
+
+ //get networkdevice struct for IPv4
+ strncpy( ifr.ifr_name, nicname, IFNAMSIZ-1 );
+ ifr.ifr_addr.sa_family = AF_INET;
+
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_SYSTEM) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_SYSTEM,1,
+ "Use ioctl() :"
+ "in_function : static int getNICAddressInfo( const char* nicname, struct addressinfo* info )"
+ "nicname = %p"
+ "info = %p",
+ nicname,
+ info);
+ }
+ // Debug log END
+
+ if( ioctl( fd, SIOCGIFADDR, &ifr ) < 0 )
+ {
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,185,
+ "out_function : static int getNICAddressInfo( const char* nicname, struct addressinfo* info )"
+ "return = 0");
+ }
+ // Debug log END
+ return 0;
+ }
+ memcpy( &(info->addr_in), &(ifr.ifr_addr), sizeof( struct sockaddr_in ) );
+
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG){
+ char sockaddr_in_str[DEBUG_STR_LEN] = {0};
+ sockaddr_in_c_str(sockaddr_in_str,&(info->addr_in));
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,186,
+ "sockaddr_in_struct : %s",
+ sockaddr_in_str);
+ }
+ // Debug log END
+
+
+ //get networkdevice struct for IPv6
+ memset( &ifr, 0, sizeof( struct ifreq ) );
+ strncpy( ifr.ifr_name, nicname, IFNAMSIZ-1 );
+ ifr.ifr_addr.sa_family = AF_INET6;
+ if( ioctl( fd, SIOCGIFADDR, &ifr ) < 0 )
+ {
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,187,
+ "out_function : static int getNICAddressInfo( const char* nicname, struct addressinfo* info )"
+ "return = 0");
+ }
+ // Debug log END
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG){
+ char sockaddr_in_str[DEBUG_STR_LEN] = {0};
+ sockaddr_in_c_str(sockaddr_in_str,&(info->addr_in));
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,188,
+ "sockaddr_in_struct : %s",
+ sockaddr_in_str);
+ }
+ // Debug log END
+ return 0;
+ }
+ memcpy( &(info->addr_in6 ), &(ifr.ifr_addr), sizeof( struct sockaddr_in6 ) );
+
+ close( fd );
+
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,189,
+ "out_function : static int getNICAddressInfo( const char* nicname, struct addressinfo* info )"
+ "return = 1");
+ }
+ // Debug log END
+ // Debug log
+ if (logger_get_log_level(LOG_CAT_L7VSD_REPLICATION) == LOG_LV_DEBUG){
+ char sockaddr_in_str[DEBUG_STR_LEN] = {0};
+ sockaddr_in_c_str(sockaddr_in_str,&(info->addr_in));
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_REPLICATION,190,
+ "sockaddr_in_struct : %s",
+ sockaddr_in_str);
+ }
+ // Debug log END
+ return 1;
+}
+
+
+/*!
+ * Extract struct l7vs_protomod to strings for debug log.
+ * @param string
+ * @return l7vs_replication_data
+ */
+
+static void l7vs_replication_data_c_str(char *ret, struct l7vs_replication_data *replication_data)
+{
+ if ( !replication_data ){
+ snprintf(ret, DEBUG_STR_LEN, "(nil)");
+ return;
+ }
+ snprintf( ret, DEBUG_STR_LEN,
+ "replication_data = %p:"
+ "id = %u:"
+ "serial = %llu:"
+ "block_num = %u:"
+ "size = %llu:"
+ "data = %s:",
+ replication_data,
+ replication_data->id,
+ replication_data->serial,
+ replication_data->block_num,
+ (long long int)replication_data->size,
+ replication_data->data);
+ printf("%s",ret);
+ return;
+}
+
+static void l7vs_replication_component_c_str(char *ret, struct l7vs_replication_component *component_info, int i)
+{
+ if ( !component_info )
+ {
+ snprintf(ret, DEBUG_STR_LEN, "(nil)");
+ return;
+ }
+ snprintf( ret, DEBUG_STR_LEN,
+ "replication_component = %p:"
+ "id[%d] = %s:"
+ "block_head[%d] = %u:"
+ "block_size[%d] = %u:",
+ component_info,
+ i,component_info[i].id,
+ i,component_info[i].block_head,
+ i,component_info[i].block_size);
+ return;
+}
+
+static void l7vs_replication_state_c_str(char *ret, struct l7vs_replication_state *replication_state)
+{
+ if ( !replication_state )
+ {
+ snprintf(ret, DEBUG_STR_LEN, "(nil)");
+ return;
+ }
+
+ snprintf( ret, DEBUG_STR_LEN,
+ "replication_state = %p:"
+ "service_status = %s:"
+ "send_time = %llu:"
+ "last_send_block = %u:"
+ "last_recv_block = %u:"
+ "total_block = %d:"
+ "replication_memory = %p:"
+ "component_memory = %p:"
+ "sarface_block_no = %llu:"
+ "sarface_block_array_ptr = %p:",
+ replication_state,
+ replication_mode[(int)replication_state->service_status],
+ replication_state->send_time,
+ replication_state->last_send_block,
+ replication_state->last_recv_block,
+ replication_state->total_block,
+ replication_state->replication_memory,
+ replication_state->component_memory,
+ (long long int)replication_state->sarface_block_no,
+ replication_state->sarface_block_array_ptr);
+ return;
+}
+
+static void l7vs_replication_info_c_str(char *ret, struct l7vs_replication_info *replication_info)
+{
+ if ( !replication_info )
+ {
+ snprintf(ret, DEBUG_STR_LEN, "(nil)");
+ return;
+ }
+
+ snprintf( ret, DEBUG_STR_LEN,
+ "replication_info = %p:"
+ "ip_addr = %s:"
+ "service_name = %s:"
+ "nic = %s:"
+ "interval = %u:"
+ "component_num = %d:"
+ "component_info = %p:",
+ replication_info,
+ replication_info->ip_addr,
+ replication_info->service_name,
+ replication_info->nic,
+ replication_info->interval,
+ replication_info->component_num,
+ replication_info->component_info);
+}
+
+static void sockaddr_in_c_str(char *ret, struct sockaddr_in *addr_in)
+{
+ struct sockaddr_in p;
+
+ memset(&p,0,sizeof(struct sockaddr_in));
+
+ if ( !addr_in )
+ {
+ snprintf(ret, DEBUG_STR_LEN, "(nil)");
+ return;
+ }
+
+ memcpy(&p,addr_in,sizeof(struct sockaddr_in));
+ snprintf( ret, DEBUG_STR_LEN,
+ "addr_in = %p:"
+ "sin_family = %d:"
+ "sin_port = %u:"
+ "in_addr.sin_addr = %llu:"
+ "sin_zero = %s:",
+ addr_in,
+ addr_in->sin_family,
+ addr_in->sin_port,
+ (long long int)p.sin_addr.s_addr,
+ addr_in->sin_zero);
+ return;
+
+}
+
--- /dev/null
+/*
+ * @file sched.c
+ * @brief the framework module of scheduer
+ * @brief it proceeds common function of scheduler
+ *
+ * L7VSD: Linux Virtual Server for Layer7 Load Balancing
+ * Copyright (C) 2005 NTT COMWARE Corporation.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ **********************************************************************/
+
+#include <string.h>
+#include <sys/types.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <glib.h>
+
+#include "l7vs_sched.h"
+#include "l7vs_service.h"
+#include "l7vs_module.h"
+#include "l7vs_dest.h"
+#include "logger_wrapper.h"
+
+static struct l7vs_scheduler *l7vs_sched_load(char *name);
+static void l7vs_sched_unload(struct l7vs_scheduler *sched);
+static struct l7vs_scheduler *l7vs_sched_lookup(char *name);
+static gint l7vs_sched_cmp(struct l7vs_scheduler *sched, char *name);
+
+static GList *l7vs_sched_list = NULL;
+
+/*!
+ * Get scheduler module.
+ * @param[in] *name scheduler module name
+ * @return struct l7vs_scheduler* OK=scheduler pointer, NG=NULL
+ */
+struct l7vs_scheduler *
+l7vs_sched_get(char *name)
+{
+ struct l7vs_scheduler *sched = NULL;
+
+ /*-------- DEBUG LOG --------*/
+ if( LOG_LV_DEBUG == logger_get_log_level( LOG_CAT_L7VSD_SCHEDULE ) ){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_SCHEDULE,3,
+ "in_function: struct l7vs_scheduler* l7vs_sched_get(char* name): name=\"%s\"", name);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ // argment check
+ if (name == NULL) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_SCHEDULE,2,
+ "Scheduler module name is NULL");
+ goto get_out;
+ }
+ sched = l7vs_sched_lookup(name);
+ if (sched == NULL) {
+ sched = l7vs_sched_load(name);
+ if (sched == NULL) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_SCHEDULE,3,
+ "Scheduler module not found maybe module problem)");
+ goto get_out;
+ }
+ sched->refcnt = 0;
+ }
+
+ sched->refcnt++;
+
+get_out:
+ /*-------- DEBUG LOG --------*/
+ if( LOG_LV_DEBUG == logger_get_log_level( LOG_CAT_L7VSD_SCHEDULE ) ){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_SCHEDULE,4,
+ "out_function: struct l7vs_scheduler* l7vs_sched_get(char* name): return_value=%p", sched);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return sched;
+}
+
+/*!
+ * Put scheduler module.
+ * @param[in] *sched scheduler pointer
+ * @return void
+ */
+void
+l7vs_sched_put(struct l7vs_scheduler *sched)
+{
+ /*-------- DEBUG LOG --------*/
+ if( LOG_LV_DEBUG == logger_get_log_level( LOG_CAT_L7VSD_SCHEDULE ) ){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_SCHEDULE,5,
+ "in_function: void l7vs_sched_put(struct l7vs_scheduler* sched): sched=%p", sched);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ // argument check
+ if (sched == NULL) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_SCHEDULE,4,
+ "Arg(sched) is NULL pointer.");
+ goto put_out;
+ }
+
+ if (--sched->refcnt <= 0) {
+ l7vs_module_remove(&l7vs_sched_list, sched);
+ l7vs_sched_unload(sched);
+ }
+
+put_out:
+ /*-------- DEBUG LOG --------*/
+ if( LOG_LV_DEBUG == logger_get_log_level( LOG_CAT_L7VSD_SCHEDULE ) ){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_SCHEDULE,6,
+ "out_function: void l7vs_sched_put(struct l7vs_scheduler* sched)");
+ }
+ /*------ DEBUG LOG END ------*/
+
+}
+
+/*!
+ * Bind scheduler module to service.
+ * @param[in] *sched scheduler pointer
+ * @param[in] *svc service pointer
+ * @return void
+ */
+void
+l7vs_sched_bind(struct l7vs_scheduler *sched,
+ struct l7vs_service *svc)
+{
+ /*-------- DEBUG LOG --------*/
+ if( LOG_LV_DEBUG == logger_get_log_level( LOG_CAT_L7VSD_SCHEDULE ) ){
+ char srv_str[DEBUG_STR_LEN] = {0};
+ l7vs_service_c_str(srv_str, svc);
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_SCHEDULE,7,
+ "in_function: void l7vs_sched_bind(struct l7vs_scheduler* sched, struct l7vs_service* svc): sched=%p, svc=&(%s)", sched, srv_str);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ // argument check
+ if (sched && svc) {
+ svc->scheduler = sched;
+ if (sched->bind != NULL) {
+ sched->bind(svc);
+ }
+ }
+
+ /*-------- DEBUG LOG --------*/
+ if( LOG_LV_DEBUG == logger_get_log_level( LOG_CAT_L7VSD_SCHEDULE ) ){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_SCHEDULE,8,
+ "out_function: void l7vs_sched_bind(struct l7vs_scheduler* sched, struct l7vs_service* svc)");
+ }
+ /*------ DEBUG LOG END ------*/
+}
+
+/*!
+ * Unbind scheduler module form service.
+ * @param[in] *sched scheduler pointer
+ * @param[in] *svc service pointer
+ * @return void
+ */
+void
+l7vs_sched_unbind(struct l7vs_scheduler *sched,
+ struct l7vs_service *svc)
+{
+ /*-------- DEBUG LOG --------*/
+ if( LOG_LV_DEBUG == logger_get_log_level( LOG_CAT_L7VSD_SCHEDULE ) ){
+ char srv_str[DEBUG_STR_LEN] = {0};
+ l7vs_service_c_str(srv_str, svc);
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_SCHEDULE,9,
+ "in_function: void l7vs_sched_unbind(struct l7vs_scheduler* sched, struct l7vs_service* svc): sched=%p, svc=&(%s)", sched, srv_str);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ // argument check
+ if (sched && svc) {
+ svc->scheduler = NULL;
+ if (sched->unbind != NULL) {
+ sched->unbind(svc);
+ }
+ }
+
+ /*-------- DEBUG LOG --------*/
+ if( LOG_LV_DEBUG == logger_get_log_level( LOG_CAT_L7VSD_SCHEDULE ) ){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_SCHEDULE,10,
+ "out_function: void l7vs_sched_unbind(struct l7vs_scheduler* sched, struct l7vs_service* svc)");
+ }
+ /*------ DEBUG LOG END ------*/
+}
+
+/*!
+ * Load scheduler module.
+ * @param[in] *name scheduler module name
+ * @return struct l7vs_scheduler* OK=scheduler pointer, NG=NULL
+ */
+static struct l7vs_scheduler *
+l7vs_sched_load(char *name)
+{
+ struct l7vs_scheduler *sched = NULL;
+
+ /*-------- DEBUG LOG --------*/
+ if( LOG_LV_DEBUG == logger_get_log_level( LOG_CAT_L7VSD_SCHEDULE ) ){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_SCHEDULE,11,
+ "in_function: struct l7vs_scheduler* l7vs_sched_load(char* name): name=\"%s\"", name);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ // argment check
+ if (name == NULL) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_SCHEDULE,5,
+ "Scheduler module name is NULL");
+ goto load_out;
+ }
+ sched = (struct l7vs_scheduler *)l7vs_module_load(name, "sched");
+ if (sched == NULL) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_SCHEDULE,6,
+ "Module load error.");
+ goto load_out;
+ }
+ sched->get_log_level = logger_get_log_level;
+ sched->put_log_debug = logger_put_log_debug;
+ sched->put_log_info = logger_put_log_info;
+ sched->put_log_warn = logger_put_log_warn;
+ sched->put_log_error = logger_put_log_error;
+ sched->put_log_debug = logger_put_log_debug;
+
+ l7vs_module_register(&l7vs_sched_list, sched);
+
+load_out:
+ /*-------- DEBUG LOG --------*/
+ if( LOG_LV_DEBUG == logger_get_log_level( LOG_CAT_L7VSD_SCHEDULE ) ){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_SCHEDULE,12,
+ "out_function: struct l7vs_scheduler* l7vs_sched_load(char* name): return_value=%p", sched);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return sched;
+}
+
+/*!
+ * Unload scheduler module.
+ * @param[in] *sched scheduler pointer
+ * @return void
+ */
+static void
+l7vs_sched_unload(struct l7vs_scheduler *sched)
+{
+ void *h;
+
+ /*-------- DEBUG LOG --------*/
+ if( LOG_LV_DEBUG == logger_get_log_level( LOG_CAT_L7VSD_SCHEDULE ) ){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_SCHEDULE,13,
+ "in_function: void l7vs_sched_unload(struct l7vs_scheduler* sched): sched=%p", sched);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ // argument check
+ if (sched == NULL) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_SCHEDULE,7,
+ "Arg(sched) is NULL pointer.");
+ goto unload_out;
+ }
+
+ h = sched->handle;
+ if (sched->fini) {
+ sched->fini();
+ }
+ l7vs_module_unload(h);
+
+unload_out:
+ /*-------- DEBUG LOG --------*/
+ if( LOG_LV_DEBUG == logger_get_log_level( LOG_CAT_L7VSD_SCHEDULE ) ){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_SCHEDULE,14,
+ "out_function: void l7vs_sched_unload(struct l7vs_scheduler* sched)");
+ }
+ /*------ DEBUG LOG END ------*/
+}
+
+/*!
+ * Lookup scheduler module in sched_list.
+ * @param[in] *name scheduler module name
+ * @return struct l7vs_scheduler* found=scheduler pointer, not found=NULL
+ */
+static struct l7vs_scheduler *
+l7vs_sched_lookup(char *name)
+{
+ struct l7vs_scheduler* sched = NULL;
+
+ /*-------- DEBUG LOG --------*/
+ if( LOG_LV_DEBUG == logger_get_log_level( LOG_CAT_L7VSD_SCHEDULE ) ){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_SCHEDULE,15,
+ "in_function: struct l7vs_scheduler* l7vs_sched_lookup(char* name): "
+ "name=\"%s\"", name);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ // argment check
+ if (name == NULL) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_SCHEDULE,8,
+ "Scheduler module name is NULL");
+ goto lookup_out;
+ }
+
+ sched = (struct l7vs_scheduler *) l7vs_module_lookup(l7vs_sched_list, name,
+ (GCompareFunc) l7vs_sched_cmp);
+
+lookup_out:
+ /*-------- DEBUG LOG --------*/
+ if( LOG_LV_DEBUG == logger_get_log_level( LOG_CAT_L7VSD_SCHEDULE ) ){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_SCHEDULE,16,
+ "out_function: struct l7vs_scheduler* l7vs_sched_load(char* name): "
+ "return_value=%p", sched);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return sched;
+}
+
+/*!
+ * Compare scheduler module name.
+ * @param[in] *sched scheduler pointer
+ * @param[in] *name scheduler module name
+ * @return gint compare result match=0, not match=-1 or other
+ */
+static gint
+l7vs_sched_cmp(struct l7vs_scheduler *sched, char *name)
+{
+ gint return_value;
+
+ /*-------- DEBUG LOG --------*/
+ if( LOG_LV_DEBUG == logger_get_log_level( LOG_CAT_L7VSD_SCHEDULE ) ){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_SCHEDULE,17,
+ "in_function: gint l7vs_sched_cmp(struct l7vs_scheduler* sched, char* name): "
+ "sched=%p, name=\"%s\"", sched, name);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ // argument check
+ if (sched == NULL) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_SCHEDULE,9,
+ "Arg(sched) is NULL pointer.");
+ return_value = -1;
+ goto cmp_out;
+ }
+ if (name == NULL) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_SCHEDULE,10,
+ "Arg(name) is NULL pointer.");
+ return_value = -1;
+ goto cmp_out;
+ }
+
+ return_value = strcmp(sched->modname, name);
+
+cmp_out:
+ /*-------- DEBUG LOG --------*/
+ if( LOG_LV_DEBUG == logger_get_log_level( LOG_CAT_L7VSD_SCHEDULE ) ){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_SCHEDULE,18,
+ "out_function: gint l7vs_sched_cmp(struct l7vs_scheduler* sched, char* name): "
+ "return_value=%d", return_value);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return return_value;
+}
+
+/*!
+ * Sorry status of the specified service is checked.
+ * @param[in] *srv service pointer
+ * @param[in] cc_check_flag connection count check flag
+ * @return int check result 0=not sorry or check NG , 1=sorry
+ */
+int
+l7vs_sched_sorry_check(struct l7vs_service *srv, int cc_check_flag)
+{
+ GList *l;
+ struct l7vs_dest *d;
+ int dest_cc = 0;
+ int return_value = 0;
+
+ /*-------- DEBUG LOG --------*/
+ if( LOG_LV_DEBUG == logger_get_log_level( LOG_CAT_L7VSD_SCHEDULE ) ){
+ char srv_str[DEBUG_STR_LEN] = {0};
+ l7vs_service_c_str(srv_str, srv);
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_SCHEDULE,19,
+ "in_function: int l7vs_sched_sorry_check(struct l7vs_service* srv, int cc_check_flag): "
+ "svc=&(%s), cc_check_flag=%d", srv_str, cc_check_flag);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ // argument check
+ if (!srv) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_SCHEDULE,11,
+ "Argument srv is NULL pointer");
+ goto sorry_check_out;
+ }
+ if (cc_check_flag != 0 && cc_check_flag != 1) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_SCHEDULE,12,
+ "Invalid cc_check_flag value");
+ goto sorry_check_out;
+ }
+
+ // check sorry-flag of service
+ if (srv->sorry_flag) {
+ return_value = 1;
+ goto sorry_check_out;
+ }
+
+ // check valid destination of service
+ if (!srv->dest_list) {
+ return_value = 1;
+ goto sorry_check_out;
+ }
+
+ // not continuous check if cc_check_flag==0
+ if (!cc_check_flag) {
+ goto sorry_check_out;
+ }
+
+ // srv->sorry_cc not set then not sorry
+ if (srv->sorry_cc == 0) {
+ goto sorry_check_out;
+ }
+ // check connection count in all real servers of service
+ for (l = g_list_first(srv->dest_list); l != NULL; l = g_list_next(l)) {
+ d = (struct l7vs_dest *)l->data;
+ if (d) {
+ dest_cc += d->nactive;
+ if (dest_cc + 1 > srv->sorry_cc) {
+ return_value = 1;
+ goto sorry_check_out;
+ }
+ }
+ }
+
+sorry_check_out:
+ /*-------- DEBUG LOG --------*/
+ if( LOG_LV_DEBUG == logger_get_log_level( LOG_CAT_L7VSD_SCHEDULE ) ){
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_SCHEDULE,20,
+ "out_function: int l7vs_sched_sorry_check(struct l7vs_service* srv, int cc_check_flag): "
+ "return_value=%d", return_value);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ return return_value;
+}
+
+/*!
+ * Get sorry-server destination or old real-server destination.
+ * @param[in] *srv service pointer
+ * @param[in] *conn connection pointer
+ * @param[in] reverse specification which get sorry-server or old real-server
+ * @return l7vs_dest* sorry-server or old real-server destination
+ */
+struct l7vs_dest *
+l7vs_sched_sorry_dest(struct l7vs_service *srv, struct l7vs_conn *conn, int reverse)
+{
+ struct l7vs_dest* dest = NULL;
+
+ /*-------- DEBUG LOG --------*/
+ if( LOG_LV_DEBUG == logger_get_log_level( LOG_CAT_L7VSD_SCHEDULE ) ){
+ char srv_str[DEBUG_STR_LEN] = {0};
+ char conn_str[DEBUG_STR_LEN] = {0};
+ l7vs_service_c_str(srv_str, srv);
+ l7vs_conn_c_str(conn_str, conn);
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_SCHEDULE,21,
+ "in_function: struct l7vs_dest* l7vs_sched_sorry_dest(struct l7vs_service* srv, "
+ "struct l7vs_conn* conn, int reverse): srv=&(%s), conn=&(%s), reverse=%d",
+ srv_str, conn_str, reverse);
+ }
+ /*------ DEBUG LOG END ------*/
+
+ // argument check
+ if (reverse != 0 && reverse != 1) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_SCHEDULE,13,"Invalid reverse value");
+ goto sorry_dest_out;
+ }
+ if (!reverse) {
+ // argument check
+ if (!srv) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_SCHEDULE,14,"Argument srv is NULL pointer");
+ goto sorry_dest_out;
+ }
+ // return sorry-server destination
+ dest = srv->sorry_dest;
+ } else {
+ // argument check
+ if (!conn) {
+ LOGGER_PUT_LOG_ERROR(LOG_CAT_L7VSD_SCHEDULE,15,"Argument srv is NULL pointer");
+ goto sorry_dest_out;
+ }
+ // return old real-server destination
+ dest = conn->old_dest;
+ }
+
+sorry_dest_out:
+
+ if( dest ){
+ char dest_str[DEBUG_STR_LEN] = {0};
+ l7vs_dest_c_str(dest_str, dest);
+ LOGGER_PUT_LOG_INFO(LOG_CAT_L7VSD_SORRY_SERVER,1, "SorryServer Information : %s",dest_str);
+ }
+
+ /*-------- DEBUG LOG --------*/
+ if( LOG_LV_DEBUG == logger_get_log_level( LOG_CAT_L7VSD_SCHEDULE ) ){
+ char dest_str[DEBUG_STR_LEN] = {0};
+ l7vs_dest_c_str(dest_str, dest);
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_SCHEDULE,22,
+ "out_function: struct l7vs_dest* l7vs_sched_sorry_dest(struct l7vs_service* srv, "
+ "struct l7vs_conn* conn, int reverse): return_value=&(%s)", dest_str);
+ }
+ /*------ DEBUG LOG END ------*/
+
+
+ return dest;
+}
+
--- /dev/null
+/*
+ * @file service.c
+ * @brief The function of l7vsd is managed.
+ * @brief Two or more service takes charge of the
+ * @brief function respectively.
+ *
+ * L7VSD: Linux Virtual Server for Layer7 Load Balancing
+ * Copyright (C) 2005 NTT COMWARE Corporation.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ **********************************************************************/
+#ifndef __STDC_LIMIT_MACROS
+#define __STDC_LIMIT_MACROS
+#endif
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <glib.h>
+#include <sys/time.h>
+#include "logger_wrapper.h"
+#include "l7vs_config.h"
+#include "l7vs_service.h"
+#include "l7vs_module.h"
+#include "l7vs_conn.h"
+#include "l7vs_dest.h"
+#include "l7vs_iomuxlist.h"
+#include "l7vs_lsock.h"
+#include "l7vs_sched.h"
+
+#define SERVICE_REPLICATION_MAX_NUM 32
+
+//! service list pointer
+static GList * l7vs_service_list;
+
+//! service handle
+uint32_t service_handle_base = 0;
+
+//! remove_conn list pointer
+static GList * removeconn_list;
+
+//! replication component id
+#define REP_COMP_SV "virtualservice"
+
+//! replication size
+static unsigned int rep_size_num;
+
+//! Replication data backup
+static l7vs_service_repdata * rep_mirror;
+
+//static functions
+static void l7vs_service_put_service_arg(struct l7vs_service_arg_multi *);
+
+// throughput interval
+static int throughput_interval = 0;
+
+/*!
+ * make replication data from l7vs_service structure
+ * @param[in] num unsigned int/number of array(l7vs_service_repdata)
+ * @param[out] **rep_data l7vs_service_repdata struct double-pointer
+ * @return int number currently created / -1 failure
+ */
+static int
+make_replication_data( unsigned int num, struct l7vs_service_repdata* rep_data )
+{
+ unsigned int loopcnt;
+ unsigned int listcnt;
+ struct l7vs_service* sv;
+ struct l7vs_service_arg_multi* svmulti;
+
+ //argument check
+ if( 1 > num )return -1;
+ if( NULL == rep_data )return -1;
+
+ //DEBUG output
+ if( LOG_LV_DEBUG == logger_get_log_level( LOG_CAT_L7VSD_VIRTUAL_SERVICE ) ){
+ char debugstr[DEBUG_STR_LEN];
+ memset( debugstr, 0, DEBUG_STR_LEN );
+ sprintf( debugstr, "function make_replication_data( unsigned int num, struct l7vs_service_repdata* rep_data )");
+ sprintf( debugstr, "%s num = %d", debugstr, num );
+ LOGGER_PUT_LOG_DEBUG( LOG_CAT_L7VSD_VIRTUAL_SERVICE,5, debugstr );
+ }
+
+ loopcnt = num;
+ listcnt = g_list_length( l7vs_service_list );
+ if( 0 == listcnt )return -1;
+
+ if( loopcnt > listcnt )loopcnt = listcnt;
+ for( unsigned int i = 0; i < loopcnt; ++i ){
+ sv = (struct l7vs_service*)g_list_nth_data( l7vs_service_list, i );
+ if( NULL == sv ){
+ loopcnt = i-1;
+ break;
+ }
+ svmulti = l7vs_service_get_service_arg( sv );
+ if( NULL == svmulti )return -1;
+ rep_data[i].addr = svmulti->srv_arg.addr;
+ rep_data[i].proto = svmulti->srv_arg.proto;
+ memcpy( rep_data[i].protomod, svmulti->srv_arg.protomod, L7VS_MODNAME_LEN );
+ memcpy( rep_data[i].protomod_arg, svmulti->protomod_arg, L7VS_PROTOMOD_MAX_SERVICE_ARG );
+ //Sorry server information
+ rep_data[i].sorry_cc = svmulti->srv_arg.sorry_cc;
+ rep_data[i].sorry_addr = svmulti->srv_arg.sorry_addr;
+ rep_data[i].sorry_flag = svmulti->srv_arg.sorry_flag;
+ //QoS information
+ rep_data[i].qos_threshold_up = svmulti->srv_arg.qos_threshold_up;
+ rep_data[i].qos_threshold_down = svmulti->srv_arg.qos_threshold_down;
+
+ l7vs_service_put_service_arg( svmulti );
+ //DEBUG output
+ if( LOG_LV_DEBUG == logger_get_log_level( LOG_CAT_L7VSD_VIRTUAL_SERVICE ) ){
+ char debugstr[DEBUG_STR_LEN];
+ memset( debugstr, 0, DEBUG_STR_LEN );
+ sprintf( debugstr, "rep_data[%d] dump", i);
+ l7vs_service_repdata_c_str( debugstr, &rep_data[i] );
+ LOGGER_PUT_LOG_DEBUG( LOG_CAT_L7VSD_VIRTUAL_SERVICE,6, debugstr );
+ }
+ }
+
+ //DEBUG output
+ if( LOG_LV_DEBUG == logger_get_log_level( LOG_CAT_L7VSD_VIRTUAL_SERVICE ) ){
+ char debugstr[DEBUG_STR_LEN];
+ memset( debugstr, 0, DEBUG_STR_LEN );
+ sprintf( debugstr, "function make_replication_data( unsigned int num, struct l7vs_service_repdata* rep_data )");
+ sprintf( debugstr, "%s return(list num) = %d", debugstr, loopcnt );
+ LOGGER_PUT_LOG_DEBUG( LOG_CAT_L7VSD_VIRTUAL_SERVICE,7, debugstr );
+ }
+ return loopcnt;
+}
+
+/*!
+ *
+ */
+void
+set_replication_data( unsigned int num, struct l7vs_service_repdata* rep_data, l7vs_service * srv )
+{
+ struct l7vs_lsock * lsock;
+ struct l7vs_protomod * pmod;
+ struct l7vs_service * s;
+ int ret = 0;
+
+ //argument check
+ if( 0 == num )return;
+ if( NULL == rep_data )return;
+
+ for( unsigned int i = 0; i < num; ++i ){
+ //lsock lookup
+ lsock = l7vs_lsock_table_lookup( &rep_data[i].addr, rep_data[i].proto );
+ if( (NULL == lsock) || (lsock != srv->lsock) )continue;
+ //protomod lookup
+ pmod = l7vs_protomod_lookup( rep_data[i].protomod );
+ if( (NULL == pmod) || (pmod != srv->pm) )continue;
+ //
+ s = (struct l7vs_service *) calloc(1, sizeof(struct l7vs_service));
+ if (s == NULL) {
+ LOGGER_PUT_LOG_ERROR( LOG_CAT_L7VSD_PROGRAM, 81, "l7vs_service memory allocate error" );
+ return;
+ }
+ //DEBUG output
+ if( LOG_LV_DEBUG == logger_get_log_level( LOG_CAT_L7VSD_VIRTUAL_SERVICE ) ){
+ char debugstr[DEBUG_STR_LEN];
+ memset( debugstr, 0, DEBUG_STR_LEN );
+ sprintf( debugstr, "memory allocated : address = %p , size = %zu", s, sizeof(struct l7vs_service) );
+ LOGGER_PUT_LOG_DEBUG( LOG_CAT_L7VSD_VIRTUAL_SERVICE, 94, debugstr );
+ }
+ s->handle = TEMP_SERVICEHANDLE;
+ ret = pmod->create( rep_data[i].protomod_arg, s->handle );
+ if( (0 != ret) || (0 != pmod->compare(s->handle, srv->handle)) ){
+ pmod->destroy(s->handle);
+ free(s);
+ continue;
+ }
+ pmod->destroy(s->handle);
+ free(s);
+ srv->sorry_cc = rep_data[i].sorry_cc;
+ //if sorry is "NULL". Make a sorry_data.
+ if( NULL == srv->sorry_dest ){
+ srv->sorry_dest = l7vs_dest_create( (struct sockaddr_in*)&rep_data[i].sorry_addr, 1 );
+ }else{
+ memcpy( (void*)&srv->sorry_dest->addr, (void*)&rep_data[i].sorry_addr, sizeof(struct sockaddr_in) );
+ srv->sorry_dest->weight = 1;
+ srv->sorry_flag = rep_data[i].sorry_flag;
+ srv->qos_threshold_up = rep_data[i].qos_threshold_up;
+ srv->qos_threshold_down = rep_data[i].qos_threshold_down;
+ }
+ break;
+ }
+}
+
+/*!
+ * l7vs_servcie_get_service_arg
+ * service arg pointer lookup.
+ * @param[in] srv l7vs_service pointer.
+ * @return l7vs_service_arg_multi pointer
+ */
+struct l7vs_service_arg_multi *
+l7vs_service_get_service_arg(struct l7vs_service *srv)
+{
+ struct l7vs_service_arg_multi *sa;
+ int ret = 0;
+
+ if( NULL == srv ){
+ LOGGER_PUT_LOG_ERROR( LOG_CAT_L7VSD_PROGRAM,7, "argument srv is NULL");
+ return NULL;
+ }
+ if( NULL == srv->pm || NULL == srv->lsock || NULL == srv->scheduler ){
+ LOGGER_PUT_LOG_ERROR( LOG_CAT_L7VSD_PROGRAM,8, "Invalid argument" );
+ return NULL;
+ }
+
+ //DEBUG output
+ if( LOG_LV_DEBUG == logger_get_log_level( LOG_CAT_L7VSD_VIRTUAL_SERVICE ) ){
+ char debugstr[DEBUG_STR_LEN];
+ memset( debugstr, 0, DEBUG_STR_LEN );
+ sprintf( debugstr, "function l7vs_service_get_service_arg(struct l7vs_service *srv)");
+ LOGGER_PUT_LOG_DEBUG( LOG_CAT_L7VSD_VIRTUAL_SERVICE,8, debugstr );
+ memset( debugstr, 0, DEBUG_STR_LEN );
+ sprintf( debugstr, "srv dump" );
+ l7vs_service_c_str( debugstr, srv );
+ LOGGER_PUT_LOG_DEBUG( LOG_CAT_L7VSD_VIRTUAL_SERVICE,9, debugstr );
+ }
+
+ sa = (struct l7vs_service_arg_multi *) calloc(1, sizeof(struct l7vs_service_arg_multi));
+ if (sa == NULL) {
+ LOGGER_PUT_LOG_ERROR( LOG_CAT_L7VSD_SYSTEM_MEMORY,1, "Could not allocate memory" );
+ return NULL;
+ }
+ //DEBUG output
+ if( LOG_LV_DEBUG == logger_get_log_level( LOG_CAT_L7VSD_VIRTUAL_SERVICE ) ){
+ char debugstr[DEBUG_STR_LEN];
+ memset( debugstr, 0, DEBUG_STR_LEN );
+ sprintf( debugstr, "memory allocated : address = %p , size = %zu", sa, sizeof(struct l7vs_service_arg_multi) );
+ LOGGER_PUT_LOG_DEBUG( LOG_CAT_L7VSD_VIRTUAL_SERVICE,10, debugstr );
+ }
+
+ ret = srv->pm->service_arg(sa, srv->handle);
+ if (ret == -1) {
+ //DEBUG output
+ if( LOG_LV_DEBUG == logger_get_log_level( LOG_CAT_L7VSD_VIRTUAL_SERVICE ) ){
+ char debugstr[DEBUG_STR_LEN];
+ memset( debugstr, 0, DEBUG_STR_LEN );
+ sprintf( debugstr, "memory free : address = %p", sa );
+ LOGGER_PUT_LOG_DEBUG( LOG_CAT_L7VSD_VIRTUAL_SERVICE,11, debugstr );
+ }
+ free( sa );
+ LOGGER_PUT_LOG_ERROR( LOG_CAT_L7VSD_PROTOCOL,1, "service not found" );
+ return NULL;
+ }
+
+ sa->srv_arg.len = sizeof(struct l7vs_service_arg_multi);
+ sa->srv_arg.addr = srv->lsock->addr;
+ sa->srv_arg.proto = srv->lsock->proto;
+ sa->srv_arg.persist = 0 /* XXX not yet */;
+ sa->srv_arg.backlog = 5 /* XXX not yet */;
+ strcpy(sa->srv_arg.protomod, srv->pm->modname);
+ strcpy(sa->srv_arg.schedmod, srv->scheduler->modname);
+
+ sa->srv_arg.sorry_cc = srv->sorry_cc;
+ sa->srv_arg.sorry_flag = srv->sorry_flag;
+ memcpy( &sa->srv_arg.sorry_addr, &srv->sorry_dest->addr, sizeof(struct sockaddr_in) );
+
+ sa->srv_arg.qos_threshold_up = srv->qos_threshold_up;
+ sa->srv_arg.qos_threshold_down = srv->qos_threshold_down;
+
+
+ struct timeval CurrTime;
+ gettimeofday( &CurrTime, NULL );
+ if (throughput_interval == 0) {
+ if ( parameter_is_int_exist( PARAM_COMP_L7VSD, "calc_throughput_interval" ) ) {
+ throughput_interval = parameter_get_int_value( PARAM_COMP_L7VSD, "calc_throughput_interval" );
+ }
+ if (throughput_interval == 0) {
+ throughput_interval = BPS_DEFAULT_INTERVAL;
+ }
+ }
+ unsigned long long cur_recvtime = (CurrTime.tv_sec * 1000000ULL + CurrTime.tv_usec) / throughput_interval;
+ l7vs_service_update_throughput(srv, cur_recvtime);
+ srv->throughput_to_server = srv->pre_recvsize_from_client * 1000000ULL / throughput_interval;
+ srv->throughput_to_client = srv->pre_recvsize_from_server * 1000000ULL / throughput_interval;
+
+
+ if (srv->qos_threshold_up != 0) {
+ srv->throughput_to_server >= srv->qos_threshold_up
+ ? sa->srv_arg.throughput_to_server = srv->qos_threshold_up
+ : sa->srv_arg.throughput_to_server = srv->throughput_to_server;
+ } else {
+ sa->srv_arg.throughput_to_server = srv->throughput_to_server;
+ }
+
+ if (srv->qos_threshold_down != 0) {
+ srv->throughput_to_client >= srv->qos_threshold_down
+ ? sa->srv_arg.throughput_to_client = srv->qos_threshold_down
+ : sa->srv_arg.throughput_to_client = srv->throughput_to_client;
+ } else {
+ sa->srv_arg.throughput_to_client = srv->throughput_to_client;
+ }
+
+ //DEBUG output
+ if( LOG_LV_DEBUG == logger_get_log_level( LOG_CAT_L7VSD_VIRTUAL_SERVICE ) ){
+ char debugstr[DEBUG_STR_LEN];
+ memset( debugstr, 0, DEBUG_STR_LEN );
+ sprintf( debugstr, "return value : l7vs_service_arg_multi dump" );
+ l7vs_service_arg_multi_c_str( debugstr, sa );
+ LOGGER_PUT_LOG_DEBUG( LOG_CAT_L7VSD_VIRTUAL_SERVICE,12, debugstr );
+ }
+ return sa;
+}
+
+/*!
+ * service_arg destroy function.
+ * @param[in] sa l7vs_service_arg pointer
+ */
+static void
+l7vs_service_put_service_arg(struct l7vs_service_arg_multi *sa)
+{
+ //DEBUG output
+ if( LOG_LV_DEBUG == logger_get_log_level( LOG_CAT_L7VSD_VIRTUAL_SERVICE ) ){
+ char debugstr[DEBUG_STR_LEN];
+ memset( debugstr, 0, DEBUG_STR_LEN );
+ sprintf( debugstr, "function l7vs_service_put_service_arg(struct l7vs_service_arg_multi *sa)");
+ sprintf( debugstr, "%s , sa free : address = %p", debugstr, sa );
+ LOGGER_PUT_LOG_DEBUG( LOG_CAT_L7VSD_VIRTUAL_SERVICE,13, debugstr );
+ }
+ free(sa);
+}
+
+
+/*!
+ * Target real servers of sets of real servers in service are retrieved.
+ * @param[in] *srv service pointer
+ * @param[in] *sin IP and port
+ * @return l7vs_dest* real server struct pointer
+ */
+struct l7vs_dest *
+l7vs_service_lookup_dest(struct l7vs_service *srv,
+ struct sockaddr_in *sin)
+{
+ GList *l;
+ struct l7vs_dest *d, *found;
+
+ if( NULL == srv ){
+ LOGGER_PUT_LOG_ERROR( LOG_CAT_L7VSD_PROGRAM,9, "lookup dest : argument \"srv\" is NULL" );
+ return NULL;
+ }
+ if( NULL == sin ){
+ LOGGER_PUT_LOG_ERROR( LOG_CAT_L7VSD_PROGRAM,10, "lookup dest : argument \"sin\" is NULL" );
+ return NULL;
+ }
+
+ //DEBUG output
+ if( LOG_LV_DEBUG == logger_get_log_level( LOG_CAT_L7VSD_VIRTUAL_SERVICE ) ){
+ char debugstr[DEBUG_STR_LEN];
+ memset( debugstr, 0, DEBUG_STR_LEN );
+ sprintf( debugstr, "function l7vs_service_lookup_dest(struct l7vs_service *srv, struct sockaddr_in *sin)" );
+ LOGGER_PUT_LOG_DEBUG( LOG_CAT_L7VSD_VIRTUAL_SERVICE,14, debugstr );
+ memset( debugstr, 0, DEBUG_STR_LEN );
+ sprintf( debugstr, "srv dump" );
+ l7vs_service_c_str( debugstr, srv );
+ LOGGER_PUT_LOG_DEBUG( LOG_CAT_L7VSD_VIRTUAL_SERVICE,15, debugstr );
+ memset( debugstr, 0, DEBUG_STR_LEN );
+ sprintf( debugstr, "sin dump " );
+ switch( sin->sin_family ){
+ case AF_UNIX:
+ sprintf( debugstr, "%s socket family = AF_UNIX(PF_UNIX)", debugstr );
+ break;
+ case AF_INET:
+ sprintf( debugstr, "%s socket family = AF_INET(PF_INET)", debugstr );
+ break;
+ default:
+ sprintf( debugstr, "%s socket family = %d", debugstr, sin->sin_family );
+ }
+ sprintf( debugstr, "%s port no = %d", debugstr, ntohs( sin->sin_port ) );
+ sprintf( debugstr, "%s address = %s", debugstr, inet_ntoa( sin->sin_addr ) );
+ LOGGER_PUT_LOG_DEBUG( LOG_CAT_L7VSD_VIRTUAL_SERVICE,16, debugstr );
+ }
+
+ found = NULL;
+ for (l = g_list_first(srv->dest_list); l != NULL; l = g_list_next(l)) {
+ d = (struct l7vs_dest *)l->data;
+ if ((d->addr.sin_addr.s_addr == sin->sin_addr.s_addr) && (d->addr.sin_port == sin->sin_port)) {
+ found = d;
+ break;
+ }
+ }
+
+ //DEBUG output
+ if( LOG_LV_DEBUG == logger_get_log_level( LOG_CAT_L7VSD_VIRTUAL_SERVICE ) ){
+ char debugstr[DEBUG_STR_LEN];
+ memset( debugstr, 0, DEBUG_STR_LEN );
+ sprintf( debugstr, "return value = %p", found );
+ LOGGER_PUT_LOG_DEBUG( LOG_CAT_L7VSD_VIRTUAL_SERVICE,17, debugstr );
+ }
+
+ return found;
+}
+
+/*!
+ *
+ * @param[out] **sas l7vs_service_arg pointer list
+ * @param[out] *num pointer list count
+ * @return pointer list count
+
+ */
+int
+l7vs_service_list_service_arg(struct l7vs_service_arg_multi **sas, int *num)
+{
+ GList *l;
+ struct l7vs_service *srv;
+ struct l7vs_service_arg_multi *r, *s;
+ struct l7vs_service_arg_multi **sa;
+ int i, n, len;
+
+ if( NULL == sas ){
+ LOGGER_PUT_LOG_ERROR( LOG_CAT_L7VSD_PROGRAM,11, "list service_arg : argument \"sas\" is NULL" );
+ return -1;
+ }
+ if( NULL == num ){
+ LOGGER_PUT_LOG_ERROR( LOG_CAT_L7VSD_PROGRAM,12, "list service_arg : argument \"num\" is NULL" );
+ return -1;
+ }
+
+ //DEBUG output
+ if( LOG_LV_DEBUG == logger_get_log_level( LOG_CAT_L7VSD_VIRTUAL_SERVICE ) ){
+ char debugstr[DEBUG_STR_LEN];
+ memset( debugstr, 0, DEBUG_STR_LEN );
+ sprintf( debugstr, "function l7vs_service_list_service_arg(struct l7vs_service_arg_multi **sas, int *num)" );
+ LOGGER_PUT_LOG_DEBUG( LOG_CAT_L7VSD_VIRTUAL_SERVICE,18, debugstr );
+ }
+
+ n = g_list_length(l7vs_service_list);
+ if (n == 0) {
+ *sas = NULL;
+ *num = 0;
+ return 0;
+ }
+
+ sa = (struct l7vs_service_arg_multi **)calloc(n, sizeof(*sa));
+ if (sa == NULL) {
+ LOGGER_PUT_LOG_ERROR( LOG_CAT_L7VSD_SYSTEM_MEMORY,2, "list service_arg : Could not allocate memory" );
+ return -1;
+ }
+ //DEBUG output
+ if( LOG_LV_DEBUG == logger_get_log_level( LOG_CAT_L7VSD_VIRTUAL_SERVICE ) ){
+ char debugstr[DEBUG_STR_LEN];
+ memset( debugstr, 0, DEBUG_STR_LEN );
+ sprintf( debugstr, "memory allocated : address = %p , size = %zu", sa, sizeof(struct l7vs_service_arg_multi) );
+ LOGGER_PUT_LOG_DEBUG( LOG_CAT_L7VSD_VIRTUAL_SERVICE,19, debugstr );
+ }
+
+ len = 0;
+ l = g_list_first(l7vs_service_list);
+ for (i = 0; i < n; i++) {
+ srv = (struct l7vs_service *)l->data;
+ sa[i] = l7vs_service_get_service_arg(srv);
+ if (sa[i] == NULL) {
+ for (i-- ; i >= 0; i--) {
+ l7vs_service_put_service_arg(sa[i]);
+ }
+ //DEBUG output
+ if( LOG_LV_DEBUG == logger_get_log_level( LOG_CAT_L7VSD_VIRTUAL_SERVICE ) ){
+ char debugstr[DEBUG_STR_LEN];
+ memset( debugstr, 0, DEBUG_STR_LEN );
+ sprintf( debugstr, "memory free : address = %p", sa );
+ LOGGER_PUT_LOG_DEBUG( LOG_CAT_L7VSD_VIRTUAL_SERVICE,20, debugstr );
+ }
+ free(sa);
+ return -1;
+ }
+ len += sa[i]->srv_arg.len;
+ l = g_list_next(l);
+ }
+
+ r = (struct l7vs_service_arg_multi *)malloc(len);
+ if (r == NULL) {
+ LOGGER_PUT_LOG_ERROR( LOG_CAT_L7VSD_SYSTEM_MEMORY,3, "list service_arg : Could not allocate memory" );
+ return -1;
+ }
+ //DEBUG output
+ if( LOG_LV_DEBUG == logger_get_log_level( LOG_CAT_L7VSD_VIRTUAL_SERVICE ) ){
+ char debugstr[DEBUG_STR_LEN];
+ memset( debugstr, 0, DEBUG_STR_LEN );
+ sprintf( debugstr, "memory allocated : address = %p , size = %d", r, len );
+ LOGGER_PUT_LOG_DEBUG( LOG_CAT_L7VSD_VIRTUAL_SERVICE,21, debugstr );
+ }
+
+ s = r;
+ for (i = 0; i < n; i++) {
+ memcpy(s, sa[i], sa[i]->srv_arg.len);
+ s = (struct l7vs_service_arg_multi *)((uint8_t *)s + sa[i]->srv_arg.len);
+ l7vs_service_put_service_arg(sa[i]);
+ }
+ //DEBUG output
+ if( LOG_LV_DEBUG == logger_get_log_level( LOG_CAT_L7VSD_VIRTUAL_SERVICE ) ){
+ char debugstr[DEBUG_STR_LEN];
+ memset( debugstr, 0, DEBUG_STR_LEN );
+ sprintf( debugstr, "memory free : address = %p", sa );
+ LOGGER_PUT_LOG_DEBUG( LOG_CAT_L7VSD_VIRTUAL_SERVICE,22, debugstr );
+ }
+ free(sa);
+ *sas = r;
+ *num = n;
+
+ //DEBUG output
+ if( LOG_LV_DEBUG == logger_get_log_level( LOG_CAT_L7VSD_VIRTUAL_SERVICE ) ){
+ char debugstr[DEBUG_STR_LEN];
+ memset( debugstr, 0, DEBUG_STR_LEN );
+ sprintf( debugstr, "function l7vs_service_list_service_arg(struct l7vs_service_arg_multi **sas, int *num)" );
+ sprintf( debugstr, "%s return : len = %d , sas = %p , num = %d", debugstr, len, sas, *num );
+ LOGGER_PUT_LOG_DEBUG( LOG_CAT_L7VSD_VIRTUAL_SERVICE,23, debugstr );
+ }
+
+ return len;
+}
+
+/*!
+ * get l7vs_dest_arg lists
+ * @param[in] *srv service pointer
+ * @param[out] **das l7vs_dest_arg pointer list
+ * @return pointer list count
+ */
+int
+l7vs_service_list_dest_arg(struct l7vs_service *srv,
+ struct l7vs_dest_arg **das)
+{
+ GList *l;
+ struct l7vs_dest *d;
+ struct l7vs_dest_arg *darg;
+ int i, num;
+
+ if( NULL == srv ){
+ LOGGER_PUT_LOG_ERROR( LOG_CAT_L7VSD_PROGRAM,13, "list dest_arg : argument \"srv\" is NULL" );
+ return -1;
+ }
+ if( NULL == das ){
+ LOGGER_PUT_LOG_ERROR( LOG_CAT_L7VSD_PROGRAM,14, "list dest_arg : argument \"das\" is NULL" );
+ return -1;
+ }
+
+ //DEBUG output
+ if( LOG_LV_DEBUG == logger_get_log_level( LOG_CAT_L7VSD_VIRTUAL_SERVICE ) ){
+ char debugstr[DEBUG_STR_LEN];
+ memset( debugstr, 0, DEBUG_STR_LEN );
+ sprintf( debugstr, "function l7vs_service_list_dest_arg(struct l7vs_service *srv, struct l7vs_dest_arg **das)" );
+ LOGGER_PUT_LOG_DEBUG( LOG_CAT_L7VSD_VIRTUAL_SERVICE,24, debugstr );
+ memset( debugstr, 0, DEBUG_STR_LEN );
+ sprintf( debugstr, "srv dump" );
+ l7vs_service_c_str( debugstr, srv );
+ LOGGER_PUT_LOG_DEBUG( LOG_CAT_L7VSD_VIRTUAL_SERVICE,25, debugstr );
+ }
+
+ num = g_list_length(srv->dest_list);
+ if (num == 0) {
+ *das = NULL;
+ return num;
+ }
+
+ darg = (struct l7vs_dest_arg *)malloc(num * sizeof(*darg));
+ if (darg == NULL) {
+ LOGGER_PUT_LOG_ERROR( LOG_CAT_L7VSD_SYSTEM_MEMORY,4, "Could not allocate memory" );
+ return -1;
+ }
+ //DEBUG output
+ if( LOG_LV_DEBUG == logger_get_log_level( LOG_CAT_L7VSD_VIRTUAL_SERVICE ) ){
+ char debugstr[DEBUG_STR_LEN];
+ memset( debugstr, 0, DEBUG_STR_LEN );
+ sprintf( debugstr, "memory allocated : address = %p , size = %zu", darg, ( num * sizeof(*darg) ) );
+ LOGGER_PUT_LOG_DEBUG( LOG_CAT_L7VSD_VIRTUAL_SERVICE,26, debugstr );
+ }
+
+ i = 0;
+ for (l = g_list_first(srv->dest_list); l != NULL; l = g_list_next(l)) {
+ d = (struct l7vs_dest *)l->data;
+ l7vs_dest_to_arg(d, &darg[i]);
+ i++;
+ }
+
+ *das = darg;
+ //DEBUG output
+ if( LOG_LV_DEBUG == logger_get_log_level( LOG_CAT_L7VSD_VIRTUAL_SERVICE ) ){
+ char debugstr[DEBUG_STR_LEN];
+ memset( debugstr, 0, DEBUG_STR_LEN );
+ sprintf( debugstr, "function l7vs_service_list_dest_arg(struct l7vs_service *srv, struct l7vs_dest_arg **das)" );
+ sprintf( debugstr, "%s return : num = %d , **darg = %p", debugstr, num, das );
+ LOGGER_PUT_LOG_DEBUG( LOG_CAT_L7VSD_VIRTUAL_SERVICE,27, debugstr );
+ }
+
+ return num;
+}
+
+/*!
+ * create service instance. and set service value.
+ * @param[in] *arg l7vs_service_arg pointer
+ * @param[out] *err error code
+ * @return l7vs_service pointer
+ */
+struct l7vs_service *
+l7vs_service_create(struct l7vs_service_arg_multi *arg, int *err)
+{
+ struct l7vs_protomod *pmod;
+ struct l7vs_scheduler *sched;
+ struct l7vs_service *srv, *sref;
+ struct l7vs_lsock *lsock;
+ struct l7vs_dest *sorry_dest; //! sorry-server destination
+// struct l7vs_service_repdata * service_replicationdata;
+
+ int ret = 0;
+ GList *l;
+
+ if( NULL == arg ){
+ LOGGER_PUT_LOG_ERROR( LOG_CAT_L7VSD_PROGRAM,15, "Could not create service : argument \"arg\" is NULL" );
+ return NULL;
+ }
+ if( NULL == err ){
+ LOGGER_PUT_LOG_ERROR( LOG_CAT_L7VSD_PROGRAM,16, "Could not create service : argument \"err\" is NULL" );
+ return NULL;
+ }
+
+ //DEBUG output
+ if( LOG_LV_DEBUG == logger_get_log_level( LOG_CAT_L7VSD_VIRTUAL_SERVICE ) ){
+ char debugstr[DEBUG_STR_LEN];
+ memset( debugstr, 0, DEBUG_STR_LEN );
+ sprintf( debugstr, "function l7vs_service_create(struct l7vs_service_arg_multi *arg, int *err)" );
+ LOGGER_PUT_LOG_DEBUG( LOG_CAT_L7VSD_VIRTUAL_SERVICE,28, debugstr );
+ memset( debugstr, 0, DEBUG_STR_LEN );
+ l7vs_service_arg_multi_c_str( debugstr, arg );
+ LOGGER_PUT_LOG_DEBUG( LOG_CAT_L7VSD_VIRTUAL_SERVICE,29, debugstr );
+ }
+
+ *err = 0;
+
+ /* max service guard */
+ if( g_list_length( l7vs_service_list ) >= MAX_SERVICES ){
+ LOGGER_PUT_LOG_INFO( LOG_CAT_L7VSD_VIRTUAL_SERVICE,4, "l7vsd max service is %d, new virtual service can't create.", MAX_SERVICES );
+ *err = L7VS_CONFIG_ERR_MAXVS_EXISTS;
+ if( LOG_LV_DEBUG == logger_get_log_level( LOG_CAT_L7VSD_VIRTUAL_SERVICE )) {
+ LOGGER_PUT_LOG_DEBUG( LOG_CAT_L7VSD_VIRTUAL_SERVICE,30, "function l7vs_service_create( struct l7vs_service_arg_multi* arg, int *err ) return : NULL (failure virtual service max limit" );
+ }
+ return NULL;
+ }
+
+ lsock = l7vs_lsock_get(&arg->srv_arg.addr, arg->srv_arg.proto, arg->srv_arg.backlog);
+ if (lsock == NULL) {
+ LOGGER_PUT_LOG_ERROR( LOG_CAT_L7VSD_VIRTUAL_SERVICE,1, "Could not create listen socket" );
+ *err = L7VS_CONFIG_ERR_NOSOCK;
+ //debug output
+ if( LOG_LV_DEBUG == logger_get_log_level( LOG_CAT_L7VSD_VIRTUAL_SERVICE ) ){
+ char debugstr[DEBUG_STR_LEN];
+ memset( debugstr, 0, DEBUG_STR_LEN );
+ sprintf( debugstr, "function l7vs_service_create(struct l7vs_service_arg_multi *arg, int *err) return : NULL (failure l7vs_lsock_get)" );
+ LOGGER_PUT_LOG_DEBUG( LOG_CAT_L7VSD_VIRTUAL_SERVICE,31, debugstr );
+ }
+ return NULL;
+ }
+
+ pmod = l7vs_protomod_get(arg->srv_arg.protomod);
+ if (pmod == NULL) {
+ l7vs_lsock_put(lsock);
+ *err = L7VS_CONFIG_ERR_NOMEM;
+ //debug output
+ if( LOG_LV_DEBUG == logger_get_log_level( LOG_CAT_L7VSD_VIRTUAL_SERVICE ) ){
+ char debugstr[DEBUG_STR_LEN];
+ memset( debugstr, 0, DEBUG_STR_LEN );
+ sprintf( debugstr, "function l7vs_service_create(struct l7vs_service_arg_multi *arg, int *err) return : NULL (failure l7vs_protomod_get)" );
+ LOGGER_PUT_LOG_DEBUG( LOG_CAT_L7VSD_VIRTUAL_SERVICE,32, debugstr );
+ }
+ return NULL;
+ }
+
+ sched = l7vs_sched_get(arg->srv_arg.schedmod);
+ if (sched == NULL) {
+ l7vs_protomod_put(pmod);
+ l7vs_lsock_put(lsock);
+ *err = L7VS_CONFIG_ERR_NOSCHED;
+ //debug output
+ if( LOG_LV_DEBUG == logger_get_log_level( LOG_CAT_L7VSD_VIRTUAL_SERVICE ) ){
+ char debugstr[DEBUG_STR_LEN];
+ memset( debugstr, 0, DEBUG_STR_LEN );
+ sprintf( debugstr, "function l7vs_service_create(struct l7vs_service_arg_multi *arg, int *err) return : NULL (failure l7vs_sched_get)" );
+ LOGGER_PUT_LOG_DEBUG( LOG_CAT_L7VSD_VIRTUAL_SERVICE,33, debugstr );
+ }
+ return NULL;
+ }
+
+ // create new destination for sorry-server (weight not set)
+ // FIXME ignore IPv6 address???
+ sorry_dest = (struct l7vs_dest *)l7vs_dest_create((struct sockaddr_in *)&arg->srv_arg.sorry_addr, 0);
+ if (sorry_dest == NULL) {
+ l7vs_sched_put(sched);
+ l7vs_protomod_put(pmod);
+ l7vs_lsock_put(lsock);
+ *err = L7VS_CONFIG_ERR_NOMEM;
+ //debug output
+ if( LOG_LV_DEBUG == logger_get_log_level( LOG_CAT_L7VSD_VIRTUAL_SERVICE ) ){
+ char debugstr[DEBUG_STR_LEN];
+ memset( debugstr, 0, DEBUG_STR_LEN );
+ sprintf( debugstr, "function l7vs_service_create(struct l7vs_service_arg_multi *arg, int *err) return : NULL (failure l7vs_dest_create)" );
+ LOGGER_PUT_LOG_DEBUG( LOG_CAT_L7VSD_VIRTUAL_SERVICE,34, debugstr );
+ }
+ return NULL;
+ }
+
+ srv = (struct l7vs_service *) calloc(1, sizeof(struct l7vs_service));
+ if (srv == NULL) {
+ l7vs_dest_destroy(sorry_dest);
+ l7vs_sched_put(sched);
+ l7vs_protomod_put(pmod);
+ l7vs_lsock_put(lsock);
+ *err = L7VS_CONFIG_ERR_NOMEM;
+ LOGGER_PUT_LOG_ERROR( LOG_CAT_L7VSD_SYSTEM_MEMORY,5, "l7vs_service memory allocate error" );
+ return NULL;
+ }
+ //DEBUG output
+ if( LOG_LV_DEBUG == logger_get_log_level( LOG_CAT_L7VSD_VIRTUAL_SERVICE ) ){
+ char debugstr[DEBUG_STR_LEN];
+ memset( debugstr, 0, DEBUG_STR_LEN );
+ sprintf( debugstr, "memory allocated : address = %p , size = %zu", srv, sizeof(struct l7vs_service ) );
+ LOGGER_PUT_LOG_DEBUG( LOG_CAT_L7VSD_VIRTUAL_SERVICE,35, debugstr );
+ }
+
+ srv->handle = ++service_handle_base;
+ if( TEMP_SERVICEHANDLE == srv->handle ){
+ srv->handle = ++service_handle_base;
+ }
+ ret = pmod->create(&arg->protomod_arg, srv->handle);
+ if (ret != 0) {
+ //DEBUG output
+ if( LOG_LV_DEBUG == logger_get_log_level( LOG_CAT_L7VSD_VIRTUAL_SERVICE ) ){
+ char debugstr[DEBUG_STR_LEN];
+ memset( debugstr, 0, DEBUG_STR_LEN );
+ sprintf( debugstr, "memory free : address = %p", srv );
+ LOGGER_PUT_LOG_DEBUG( LOG_CAT_L7VSD_VIRTUAL_SERVICE,36, debugstr );
+ }
+ free(srv);
+ l7vs_dest_destroy(sorry_dest);
+ l7vs_sched_put(sched);
+ l7vs_protomod_put(pmod);
+ l7vs_lsock_put(lsock);
+ *err = L7VS_CONFIG_ERR_NOMEM;
+ //debug output
+ if( LOG_LV_DEBUG == logger_get_log_level( LOG_CAT_L7VSD_VIRTUAL_SERVICE ) ){
+ char debugstr[DEBUG_STR_LEN];
+ memset( debugstr, 0, DEBUG_STR_LEN );
+ sprintf( debugstr, "function l7vs_service_create(struct l7vs_service_arg_multi *arg, int *err) return : NULL (failure pmod create)" );
+ LOGGER_PUT_LOG_DEBUG( LOG_CAT_L7VSD_VIRTUAL_SERVICE,37, debugstr );
+ }
+ return NULL;
+ }
+
+ for (l = g_list_first(l7vs_service_list); l != NULL;
+ l = g_list_next(l)) {
+ sref = (struct l7vs_service *)l->data;
+
+ if (lsock != sref->lsock) {
+ continue;
+ }
+
+ if (pmod != sref->pm) {
+ continue;
+ }
+
+ if (pmod->compare(srv->handle, sref->handle) != 0) {
+ continue;
+ }
+
+ LOGGER_PUT_LOG_ERROR( LOG_CAT_L7VSD_VIRTUAL_SERVICE,2, "Virtual service already exists" );
+ l7vs_dest_destroy(sorry_dest);
+ l7vs_sched_put(sched);
+ l7vs_protomod_put(pmod);
+ l7vs_lsock_put(lsock);
+ pmod->destroy(srv->handle);
+ //DEBUG output
+ if( LOG_LV_DEBUG == logger_get_log_level( LOG_CAT_L7VSD_VIRTUAL_SERVICE ) ){
+ char debugstr[DEBUG_STR_LEN];
+ memset( debugstr, 0, DEBUG_STR_LEN );
+ sprintf( debugstr, "memory free : address = %p", srv );
+ LOGGER_PUT_LOG_DEBUG( LOG_CAT_L7VSD_VIRTUAL_SERVICE,38, debugstr );
+ }
+ free(srv);
+ *err = L7VS_CONFIG_ERR_VS_EXISTS;
+ //debug output
+ if( LOG_LV_DEBUG == logger_get_log_level( LOG_CAT_L7VSD_VIRTUAL_SERVICE ) ){
+ char debugstr[DEBUG_STR_LEN];
+ memset( debugstr, 0, DEBUG_STR_LEN );
+ sprintf( debugstr, "function l7vs_service_create(struct l7vs_service_arg_multi *arg, int *err) return : NULL (Duplication service)" );
+ LOGGER_PUT_LOG_DEBUG( LOG_CAT_L7VSD_VIRTUAL_SERVICE,39, debugstr );
+ }
+ return NULL;
+ }
+
+ srv->lsock = lsock;
+ srv->pm = pmod;
+ l7vs_sched_bind(sched, srv);
+
+ // set sorry data
+ srv->sorry_cc = arg->srv_arg.sorry_cc;
+ srv->sorry_dest = sorry_dest;
+ srv->sorry_flag = arg->srv_arg.sorry_flag;
+ // set QoS value
+ srv->qos_threshold_up = arg->srv_arg.qos_threshold_up;
+ srv->qos_threshold_down = arg->srv_arg.qos_threshold_down;
+
+ l7vs_lsock_add_service(lsock, srv);
+ l7vs_service_list = g_list_append(l7vs_service_list, srv);
+
+ // create g_hash_table
+ srv->conn_hash = g_hash_table_new( NULL, NULL );
+
+ // set replicationmode
+ // get the replication area.
+ unsigned int r_size = 0;
+ l7vs_service_repdata * repdata = (l7vs_service_repdata*)l7vs_replication_pay_memory( REP_COMP_SV, &r_size );
+ // if repdata is NULL, Cansel to replication mode
+ if( NULL != repdata ){
+ // if virtuar service number is 1, change mode and copy to the data.
+ if( 1 == g_list_length( l7vs_service_list ) ){
+ l7vs_replication_switch_to_master();
+ // when Syb->Act, Data is saved in a preliminary area of original Service.
+ // The replication data area is calculated.
+ rep_size_num = (r_size * DATA_SIZE) / sizeof(struct l7vs_service_repdata);
+ // get mirror area.
+ rep_mirror = (struct l7vs_service_repdata*)calloc( rep_size_num, sizeof(struct l7vs_service_repdata) );
+ // Copy to the data
+ if( NULL != rep_mirror )memcpy( rep_mirror, repdata, (rep_size_num * sizeof(struct l7vs_service_repdata)) );
+ //DEBUG output
+ if( LOG_LV_DEBUG == logger_get_log_level( LOG_CAT_L7VSD_VIRTUAL_SERVICE ) ){
+ char debugstr[DEBUG_STR_LEN];
+ memset( debugstr, 0, DEBUG_STR_LEN );
+ sprintf( debugstr, "memory allocated : address = %p , size = %d", rep_mirror, (rep_size_num * sizeof(struct l7vs_service_repdata)) );
+ LOGGER_PUT_LOG_DEBUG( LOG_CAT_L7VSD_VIRTUAL_SERVICE, 95, debugstr );
+ }
+ }
+ // if replication data mirror isn't NULL, get a rep_mirror area.
+ if( NULL != rep_mirror )set_replication_data( rep_size_num, rep_mirror, srv );
+ //make replication data
+ make_replication_data( rep_size_num, repdata );
+ }
+
+ //debug output
+ if( LOG_LV_DEBUG == logger_get_log_level( LOG_CAT_L7VSD_VIRTUAL_SERVICE ) ){
+ char debugstr[DEBUG_STR_LEN];
+ memset( debugstr, 0, DEBUG_STR_LEN );
+ sprintf( debugstr, "function l7vs_service_create(struct l7vs_service_arg_multi *arg, int *err)" );
+ l7vs_service_c_str( debugstr, srv );
+ LOGGER_PUT_LOG_DEBUG( LOG_CAT_L7VSD_VIRTUAL_SERVICE,40, debugstr );
+ }
+
+ return srv;
+}
+
+
+/*!
+ * append to conn remove list
+ * @param[in] key not use
+ * @param[in] value connection pointer
+ * @param[in] userdata not use
+ */
+static void rmvlistappend( gpointer key, gpointer value, gpointer userdata ){
+ removeconn_list = g_list_append( removeconn_list, value );
+}
+
+
+/*!
+ * service destroy function
+ * @param[in] *srv service pointer
+ * @return void
+ */
+int
+l7vs_service_destroy(struct l7vs_service *srv)
+{
+ struct l7vs_scheduler *sched;
+ struct l7vs_dest * rmv_dest;
+ struct l7vs_conn * rmvconn;
+// struct l7vs_service_repdata * service_replicationdata;
+
+
+ if( NULL == srv ){
+ LOGGER_PUT_LOG_ERROR( LOG_CAT_L7VSD_PROGRAM,17, "Service Destroy failure: argument is NULL" );
+ return -1;
+ }
+
+ //DEBUG output
+ if( LOG_LV_DEBUG == logger_get_log_level( LOG_CAT_L7VSD_VIRTUAL_SERVICE ) ){
+ char debugstr[DEBUG_STR_LEN];
+ memset( debugstr, 0, DEBUG_STR_LEN );
+ sprintf( debugstr, "function l7vs_service_destroy(struct l7vs_service *srv)" );
+ LOGGER_PUT_LOG_DEBUG( LOG_CAT_L7VSD_VIRTUAL_SERVICE,41, debugstr );
+ memset( debugstr, 0, DEBUG_STR_LEN );
+ sprintf( debugstr, "srv dump" );
+ l7vs_service_c_str( debugstr, srv );
+ LOGGER_PUT_LOG_DEBUG( LOG_CAT_L7VSD_VIRTUAL_SERVICE,42, debugstr );
+ }
+
+ //find service from glist(l7vs_service_list)
+ if( 0 == g_list_length( l7vs_service_list ) ){
+ LOGGER_PUT_LOG_ERROR( LOG_CAT_L7VSD_VIRTUAL_SERVICE,3, "Service Destroy failure: service not created" );
+ return -1;
+ }
+ if( NULL == g_list_find( l7vs_service_list, srv ) ){
+ LOGGER_PUT_LOG_ERROR( LOG_CAT_L7VSD_VIRTUAL_SERVICE,4, "Service Destroy failure: cannot find in list" );
+ return -1;
+ }
+
+ // remove all hash-table members.
+ g_hash_table_foreach( srv->conn_hash, rmvlistappend, NULL );
+
+ for( removeconn_list = g_list_first( removeconn_list );
+ removeconn_list != NULL; ){
+ rmvconn = (struct l7vs_conn*)removeconn_list->data;
+ l7vs_conn_destroy( rmvconn );
+ removeconn_list = g_list_remove( removeconn_list, rmvconn );
+ }
+
+ // destroy g_hash_table
+ g_hash_table_destroy( srv->conn_hash );
+
+ // remove all dest(exclude sorry_dest)
+ for( srv->dest_list = g_list_first( srv->dest_list ); srv->dest_list != NULL; ){
+ rmv_dest = (struct l7vs_dest*)srv->dest_list->data;
+ srv->dest_list = g_list_remove( srv->dest_list, rmv_dest );
+ l7vs_dest_destroy( rmv_dest );
+ }
+
+ sched = srv->scheduler;
+ l7vs_service_list = g_list_remove(l7vs_service_list, srv);
+ l7vs_sched_unbind(sched, srv);
+ l7vs_dest_destroy(srv->sorry_dest);
+ l7vs_sched_put(sched);
+ l7vs_lsock_remove_service(srv->lsock, srv);
+ l7vs_lsock_put(srv->lsock);
+ srv->pm->destroy(srv->handle);
+ l7vs_protomod_put( srv->pm );
+ //DEBUG output
+ if( LOG_LV_DEBUG == logger_get_log_level( LOG_CAT_L7VSD_VIRTUAL_SERVICE ) ){
+ char debugstr[DEBUG_STR_LEN];
+ memset( debugstr, 0, DEBUG_STR_LEN );
+ sprintf( debugstr, "memory free : address = %p", srv );
+ LOGGER_PUT_LOG_DEBUG( LOG_CAT_L7VSD_VIRTUAL_SERVICE,43, debugstr );
+ }
+ free(srv);
+
+ if( 0 == g_list_length( l7vs_service_list ) ){
+ l7vs_replication_switch_to_slave();
+ }
+
+ //make&set replication data
+// service_replicationdata = (struct l7vs_service_repdata*)calloc(SERVICE_REPLICATION_MAX_NUM, sizeof(struct l7vs_service_repdata) );
+// set_replication_data( SERVICE_REPLICATION_MAX_NUM, &service_replicationdata );
+
+ //DEBUG output
+ if( LOG_LV_DEBUG == logger_get_log_level( LOG_CAT_L7VSD_VIRTUAL_SERVICE ) ){
+ char debugstr[DEBUG_STR_LEN];
+ memset( debugstr, 0, DEBUG_STR_LEN );
+ sprintf( debugstr, "function l7vs_service_destroy(struct l7vs_service *srv) return : 0" );
+ LOGGER_PUT_LOG_DEBUG( LOG_CAT_L7VSD_VIRTUAL_SERVICE,44, debugstr );
+ }
+
+ return 0;
+}
+
+/*!
+ * serch from service list.
+ * @param[in] *arg service arg
+ * @return service pointer ( NULL is no lookup )
+ */
+struct l7vs_service *
+l7vs_service_lookup(struct l7vs_service_arg_multi *arg) //checks if the virtual service to be added already exists--Anshu
+{
+ GList *l;
+ struct l7vs_lsock *lsock;
+ struct l7vs_protomod *pmod;
+ struct l7vs_service *s, *sref;
+ int ret = 0;
+
+ if( NULL == arg ){
+ LOGGER_PUT_LOG_ERROR( LOG_CAT_L7VSD_PROGRAM,18, "Service lookup failure: agreement is NULL" );
+ return NULL;
+ }
+
+ //DEBUG output
+ if( LOG_LV_DEBUG == logger_get_log_level( LOG_CAT_L7VSD_VIRTUAL_SERVICE ) ){
+ char debugstr[DEBUG_STR_LEN];
+ memset( debugstr, 0, DEBUG_STR_LEN );
+ sprintf( debugstr, "function l7vs_service_lookup(struct l7vs_service_arg_multi *arg)" );
+ LOGGER_PUT_LOG_DEBUG( LOG_CAT_L7VSD_VIRTUAL_SERVICE,45, debugstr );
+ memset( debugstr, 0, DEBUG_STR_LEN );
+ sprintf( debugstr, "arg dump" );
+ l7vs_service_arg_multi_c_str( debugstr, arg );
+ LOGGER_PUT_LOG_DEBUG( LOG_CAT_L7VSD_VIRTUAL_SERVICE,46, debugstr );
+ }
+
+ lsock = l7vs_lsock_table_lookup(&arg->srv_arg.addr, arg->srv_arg.proto);
+ if (lsock == NULL) {
+ //DEBUG output
+ if( LOG_LV_DEBUG == logger_get_log_level( LOG_CAT_L7VSD_VIRTUAL_SERVICE ) ){
+ char debugstr[DEBUG_STR_LEN];
+ memset( debugstr, 0, DEBUG_STR_LEN );
+ sprintf( debugstr, "l7vs_service_lookup(struct l7vs_service_arg_multi *arg) return : NULL (lsock table not found)" );
+ LOGGER_PUT_LOG_DEBUG( LOG_CAT_L7VSD_VIRTUAL_SERVICE,47, debugstr );
+ }
+ return NULL;
+ }
+
+ pmod = l7vs_protomod_lookup(arg->srv_arg.protomod);
+ if (pmod == NULL) {
+ //DEBUG output
+ if( LOG_LV_DEBUG == logger_get_log_level( LOG_CAT_L7VSD_VIRTUAL_SERVICE ) ){
+ char debugstr[DEBUG_STR_LEN];
+ memset( debugstr, 0, DEBUG_STR_LEN );
+ sprintf( debugstr, "l7vs_service_lookup(struct l7vs_service_arg_multi *arg) return : NULL (protomod not found)" );
+ LOGGER_PUT_LOG_DEBUG( LOG_CAT_L7VSD_VIRTUAL_SERVICE,48, debugstr );
+ }
+ return NULL;
+ }
+
+ s = (struct l7vs_service *) calloc(1, sizeof(struct l7vs_service));
+ if (s == NULL) {
+ LOGGER_PUT_LOG_ERROR( LOG_CAT_L7VSD_SYSTEM_MEMORY,6, "l7vs_service memory allocate error" );
+ return NULL;
+ }
+ //DEBUG output
+ if( LOG_LV_DEBUG == logger_get_log_level( LOG_CAT_L7VSD_VIRTUAL_SERVICE ) ){
+ char debugstr[DEBUG_STR_LEN];
+ memset( debugstr, 0, DEBUG_STR_LEN );
+ sprintf( debugstr, "memory allocated : address = %p , size = %zu", s, sizeof(struct l7vs_service) );
+ LOGGER_PUT_LOG_DEBUG( LOG_CAT_L7VSD_VIRTUAL_SERVICE,49, debugstr );
+ }
+
+ s->handle = TEMP_SERVICEHANDLE;
+ ret = pmod->create(&arg->protomod_arg, s->handle);
+ if (ret != 0) {
+ //DEBUG output
+ if( LOG_LV_DEBUG == logger_get_log_level( LOG_CAT_L7VSD_VIRTUAL_SERVICE ) ){
+ char debugstr[DEBUG_STR_LEN];
+ memset( debugstr, 0, DEBUG_STR_LEN );
+ sprintf( debugstr, "memory free : address = %p", s );
+ LOGGER_PUT_LOG_DEBUG( LOG_CAT_L7VSD_VIRTUAL_SERVICE,50, debugstr );
+ }
+ free(s);
+ //DEBUG output
+ if( LOG_LV_DEBUG == logger_get_log_level( LOG_CAT_L7VSD_VIRTUAL_SERVICE ) ){
+ char debugstr[DEBUG_STR_LEN];
+ memset( debugstr, 0, DEBUG_STR_LEN );
+ sprintf( debugstr, "l7vs_service_lookup(struct l7vs_service_arg_multi *arg) return : NULL" );
+ LOGGER_PUT_LOG_DEBUG( LOG_CAT_L7VSD_VIRTUAL_SERVICE,51, debugstr );
+ }
+ return NULL;
+ }
+
+ for (l = g_list_first(l7vs_service_list);
+ l != NULL; l = g_list_next(l)) {
+ sref = (struct l7vs_service *)l->data;
+ if (lsock != sref->lsock) {
+ continue;
+ }
+
+ if (pmod != sref->pm) {
+ continue;
+ }
+
+ if (pmod->compare(s->handle, sref->handle) != 0) {
+ continue;
+ }
+
+ pmod->destroy(s->handle);
+ //DEBUG output
+ if( LOG_LV_DEBUG == logger_get_log_level( LOG_CAT_L7VSD_VIRTUAL_SERVICE ) ){
+ char debugstr[DEBUG_STR_LEN];
+ memset( debugstr, 0, DEBUG_STR_LEN );
+ sprintf( debugstr, "memory free : address = %p", s );
+ LOGGER_PUT_LOG_DEBUG( LOG_CAT_L7VSD_VIRTUAL_SERVICE,52, debugstr );
+ }
+ free(s);
+ //DEBUG output
+ if( LOG_LV_DEBUG == logger_get_log_level( LOG_CAT_L7VSD_VIRTUAL_SERVICE ) ){
+ char debugstr[DEBUG_STR_LEN];
+ memset( debugstr, 0, DEBUG_STR_LEN );
+ sprintf( debugstr, "function l7vs_service_lookup(struct l7vs_service_arg_multi *arg)" );
+ LOGGER_PUT_LOG_DEBUG( LOG_CAT_L7VSD_VIRTUAL_SERVICE,53, debugstr );
+ memset( debugstr, 0, DEBUG_STR_LEN );
+ sprintf( debugstr, "return l7vs_service dump" );
+ l7vs_service_c_str( debugstr, sref );
+ LOGGER_PUT_LOG_DEBUG( LOG_CAT_L7VSD_VIRTUAL_SERVICE,54, debugstr );
+ }
+
+ return sref;
+ }
+ if (s != NULL) {
+ pmod->destroy(s->handle);
+ //DEBUG output
+ if( LOG_LV_DEBUG == logger_get_log_level( LOG_CAT_L7VSD_VIRTUAL_SERVICE ) ){
+ char debugstr[DEBUG_STR_LEN];
+ memset( debugstr, 0, DEBUG_STR_LEN );
+ sprintf( debugstr, "memory free : address = %p", s );
+ LOGGER_PUT_LOG_DEBUG( LOG_CAT_L7VSD_VIRTUAL_SERVICE,55, debugstr );
+ }
+ free(s);
+ }
+ //DEBUG output
+ if( LOG_LV_DEBUG == logger_get_log_level( LOG_CAT_L7VSD_VIRTUAL_SERVICE ) ){
+ char debugstr[DEBUG_STR_LEN];
+ memset( debugstr, 0, DEBUG_STR_LEN );
+ sprintf( debugstr, "l7vs_service_lookup(struct l7vs_service_arg_multi *arg) return : NULL" );
+ LOGGER_PUT_LOG_DEBUG( LOG_CAT_L7VSD_VIRTUAL_SERVICE,56, debugstr );
+ }
+ return NULL;
+}
+
+/*!
+ * real server add on service
+ * @param[in] *srv service pointer
+ * @param[in] *darg l7vs_dest_arg pointer
+ * @return success = 0 fail = -1
+ */
+int
+l7vs_service_add_dest(struct l7vs_service *srv,
+ struct l7vs_dest_arg *darg)
+{
+ struct l7vs_dest *d;
+
+ if( NULL == srv || NULL == darg ){
+ LOGGER_PUT_LOG_ERROR( LOG_CAT_L7VSD_PROGRAM,19, "Service / add dest : Invalid argument" );
+ return -1;
+ }
+
+ //DEBUG output
+ if( LOG_LV_DEBUG == logger_get_log_level( LOG_CAT_L7VSD_VIRTUAL_SERVICE ) ){
+ char debugstr[DEBUG_STR_LEN];
+ char deststr[DEBUG_STR_LEN];
+ memset( debugstr, 0, DEBUG_STR_LEN );
+ sprintf( debugstr, "function l7vs_service_add_dest(struct l7vs_service *srv, struct l7vs_dest_arg *darg)" );
+ LOGGER_PUT_LOG_DEBUG( LOG_CAT_L7VSD_VIRTUAL_SERVICE,57, debugstr );
+ memset( debugstr, 0, DEBUG_STR_LEN );
+ sprintf( debugstr, "srv dump" );
+ l7vs_service_c_str( debugstr, srv );
+ LOGGER_PUT_LOG_DEBUG( LOG_CAT_L7VSD_VIRTUAL_SERVICE,58, debugstr );
+ memset( debugstr, 0, DEBUG_STR_LEN );
+ memset( deststr, 0, DEBUG_STR_LEN );
+ l7vs_dest_c_str( deststr, (l7vs_dest*)darg );
+ sprintf( debugstr, "dest dump %s", deststr );
+ LOGGER_PUT_LOG_DEBUG( LOG_CAT_L7VSD_VIRTUAL_SERVICE,59, debugstr );
+ }
+
+ d = l7vs_service_lookup_dest(srv, &darg->addr);
+ if (d != NULL) {
+ LOGGER_PUT_LOG_INFO( LOG_CAT_L7VSD_VIRTUAL_SERVICE,5, "Cannot add duplicate real service" );
+ //DEBUG output
+ if( LOG_LV_DEBUG == logger_get_log_level( LOG_CAT_L7VSD_VIRTUAL_SERVICE ) ){
+ char debugstr[DEBUG_STR_LEN];
+ memset( debugstr, 0, DEBUG_STR_LEN );
+ sprintf( debugstr, "function l7vs_service_add_dest(struct l7vs_service *srv, struct l7vs_dest_arg *darg) return : -1" );
+ LOGGER_PUT_LOG_DEBUG( LOG_CAT_L7VSD_VIRTUAL_SERVICE,60, debugstr );
+ }
+ return -1;
+ }
+
+ d = (struct l7vs_dest*) l7vs_dest_create(&darg->addr, darg->weight);
+ if (d == NULL) {
+ LOGGER_PUT_LOG_ERROR( LOG_CAT_L7VSD_REAL_SERVER,1, "Could not allocate memory" );
+ //DEBUG output
+ if( LOG_LV_DEBUG == logger_get_log_level( LOG_CAT_L7VSD_VIRTUAL_SERVICE ) ){
+ char debugstr[DEBUG_STR_LEN];
+ memset( debugstr, 0, DEBUG_STR_LEN );
+ sprintf( debugstr, "function l7vs_service_add_dest(struct l7vs_service *srv, struct l7vs_dest_arg *darg) return : -1" );
+ LOGGER_PUT_LOG_DEBUG( LOG_CAT_L7VSD_VIRTUAL_SERVICE,61, debugstr );
+ }
+ return -1;
+ }
+ else {
+ LOGGER_PUT_LOG_INFO( LOG_CAT_L7VSD_VIRTUAL_SERVICE,6, "ADD_RS: IFRM004: added real server" );
+ }
+
+ srv->dest_list = g_list_append(srv->dest_list, d);
+
+ //DEBUG output
+ if( LOG_LV_DEBUG == logger_get_log_level( LOG_CAT_L7VSD_VIRTUAL_SERVICE ) ){
+ char debugstr[DEBUG_STR_LEN];
+ memset( debugstr, 0, DEBUG_STR_LEN );
+ sprintf( debugstr, "function l7vs_service_add_dest(struct l7vs_service *srv, struct l7vs_dest_arg *darg) return : 0" );
+ LOGGER_PUT_LOG_DEBUG( LOG_CAT_L7VSD_VIRTUAL_SERVICE,62, debugstr );
+ }
+
+ return 0;
+}
+
+/* remove real server pointer function
+ * @param[in] *srv l7vs_service_pointer
+ * @param[in] *darg l7vs_dest pointer
+ * @return success = 0 false = -1
+ */
+int
+l7vs_service_remove_dest(struct l7vs_service *srv,
+ struct l7vs_dest_arg *darg)
+{
+ struct l7vs_dest *d;
+ struct l7vs_conn * tmp_conn;
+
+
+ if( NULL == srv || NULL == darg ){
+ LOGGER_PUT_LOG_ERROR( LOG_CAT_L7VSD_PROGRAM,20, "Service / remove dest : Invalid argument");
+ return -1;
+ }
+
+ //DEBUG output
+ if( LOG_LV_DEBUG == logger_get_log_level( LOG_CAT_L7VSD_VIRTUAL_SERVICE ) ){
+ char debugstr[DEBUG_STR_LEN];
+ char deststr[DEBUG_STR_LEN];
+ memset( debugstr, 0, DEBUG_STR_LEN );
+ sprintf( debugstr, "function l7vs_service_remove_dest(struct l7vs_service *srv, struct l7vs_dest_arg *darg)" );
+ LOGGER_PUT_LOG_DEBUG( LOG_CAT_L7VSD_VIRTUAL_SERVICE,63, debugstr );
+ memset( debugstr, 0, DEBUG_STR_LEN );
+ sprintf( debugstr, "srv dump" );
+ l7vs_service_c_str( debugstr, srv );
+ LOGGER_PUT_LOG_DEBUG( LOG_CAT_L7VSD_VIRTUAL_SERVICE,64, debugstr );
+ memset( debugstr, 0, DEBUG_STR_LEN );
+ memset( deststr, 0, DEBUG_STR_LEN );
+ l7vs_dest_c_str( deststr, (l7vs_dest*)darg );
+ sprintf( debugstr, "dest dump %s", deststr );
+ LOGGER_PUT_LOG_DEBUG( LOG_CAT_L7VSD_VIRTUAL_SERVICE,65, debugstr );
+ }
+
+ d = l7vs_service_lookup_dest(srv, &darg->addr);
+ if (d == NULL) {
+ LOGGER_PUT_LOG_ERROR( LOG_CAT_L7VSD_REAL_SERVER,2, "No such real server" );
+ //DEBUG output
+ if( LOG_LV_DEBUG == logger_get_log_level( LOG_CAT_L7VSD_VIRTUAL_SERVICE ) ){
+ char debugstr[DEBUG_STR_LEN];
+ memset( debugstr, 0, DEBUG_STR_LEN );
+ sprintf( debugstr, "function l7vs_service_remove_dest(struct l7vs_service *srv, struct l7vs_dest_arg *darg) return : -1" );
+ LOGGER_PUT_LOG_DEBUG( LOG_CAT_L7VSD_VIRTUAL_SERVICE,66, debugstr );
+ }
+ return -1;
+ }
+ else {
+ LOGGER_PUT_LOG_INFO( LOG_CAT_L7VSD_VIRTUAL_SERVICE,7, "DEL_RS: IFRM005: removed real server" );
+ }
+
+ g_hash_table_foreach( srv->conn_hash, rmvlistappend, NULL );
+ for( removeconn_list = g_list_first( removeconn_list ); removeconn_list != NULL; ){
+ tmp_conn = (struct l7vs_conn*)removeconn_list->data;
+ if( d == tmp_conn->dest ){
+ l7vs_conn_destroy( tmp_conn );
+ }
+ removeconn_list = g_list_remove( removeconn_list, tmp_conn );
+ }
+
+ srv->dest_list = g_list_remove(srv->dest_list, d);
+ l7vs_dest_destroy(d);
+
+ //DEBUG output
+ if( LOG_LV_DEBUG == logger_get_log_level( LOG_CAT_L7VSD_VIRTUAL_SERVICE ) ){
+ char debugstr[DEBUG_STR_LEN];
+ memset( debugstr, 0, DEBUG_STR_LEN );
+ sprintf( debugstr, "function l7vs_service_remove_dest(struct l7vs_service *srv, struct l7vs_dest_arg *darg) return : 0" );
+ LOGGER_PUT_LOG_DEBUG( LOG_CAT_L7VSD_VIRTUAL_SERVICE,67, debugstr );
+ }
+
+ return 0;
+}
+
+/*!
+ * schedule dest on con.(not use)
+ * @param[in] *srv service pointer
+ * @param[in] *conn l7vs_conn pointer
+ * @return success = 0 false = -1
+ */
+int
+l7vs_service_schedule(struct l7vs_service *srv,
+ struct l7vs_conn *conn)
+{
+ struct l7vs_dest *dest;
+
+ if( NULL == srv || NULL == conn || NULL == srv->scheduler ){
+ LOGGER_PUT_LOG_ERROR( LOG_CAT_L7VSD_PROGRAM,21, "Service / lookup schedule-module : Invalid argument" );
+ return -1;
+ }
+
+ dest = srv->scheduler->schedule(srv, conn);
+ if (dest == NULL) {
+ LOGGER_PUT_LOG_ERROR( LOG_CAT_L7VSD_SCHEDULE,1, "no real server defined" );
+ return -1;
+ }
+
+ return l7vs_conn_connect_rs(conn, dest);
+}
+
+
+/*!
+ * NOP
+ */
+int
+l7vs_service_establish(struct l7vs_service *srv,
+ struct l7vs_conn *conn)
+{
+ return 0;
+}
+
+/*!
+ * connection list append conn in service
+ * @param[in] *srv service pointer
+ * @param[in] *conn l7vs_conn pointer
+ * @return void
+ */
+int
+l7vs_service_register_conn(struct l7vs_service *srv,
+ struct l7vs_conn *conn)
+{
+ if( NULL == srv || NULL == conn ){
+ LOGGER_PUT_LOG_ERROR( LOG_CAT_L7VSD_PROGRAM,22, "register connection : Invalid argument" );
+ return -1;
+ }
+
+ //DEBUG output
+ if( LOG_LV_DEBUG == logger_get_log_level( LOG_CAT_L7VSD_VIRTUAL_SERVICE ) ){
+ char debugstr[DEBUG_STR_LEN];
+ char connstr[DEBUG_STR_LEN];
+ memset( debugstr, 0, DEBUG_STR_LEN );
+ sprintf( debugstr, "function l7vs_service_register_conn(struct l7vs_service *srv, struct l7vs_conn *conn)" );
+ LOGGER_PUT_LOG_DEBUG( LOG_CAT_L7VSD_VIRTUAL_SERVICE,68, debugstr );
+ memset( debugstr, 0, DEBUG_STR_LEN );
+ sprintf( debugstr, "srv dump" );
+ l7vs_service_c_str( debugstr, srv );
+ LOGGER_PUT_LOG_DEBUG( LOG_CAT_L7VSD_VIRTUAL_SERVICE,69, debugstr );
+ memset( debugstr, 0, DEBUG_STR_LEN );
+ memset( connstr, 0, DEBUG_STR_LEN );
+ l7vs_conn_c_str( connstr, conn );
+ sprintf( debugstr, "conn dump %s", connstr );
+ LOGGER_PUT_LOG_DEBUG( LOG_CAT_L7VSD_VIRTUAL_SERVICE,70, debugstr );
+ }
+
+ if( NULL != g_hash_table_lookup( srv->conn_hash, &conn->ciom->fd ) ){
+ LOGGER_PUT_LOG_ERROR( LOG_CAT_L7VSD_VIRTUAL_SERVICE,5, "register connection : conflict connection." );
+ //DEBUG output
+ if( LOG_LV_DEBUG == logger_get_log_level( LOG_CAT_L7VSD_VIRTUAL_SERVICE ) ){
+ char debugstr[DEBUG_STR_LEN];
+ memset( debugstr, 0, DEBUG_STR_LEN );
+ sprintf( debugstr, "function l7vs_service_register_conn(struct l7vs_service *srv, struct l7vs_conn *conn) return : -1" );
+ LOGGER_PUT_LOG_DEBUG( LOG_CAT_L7VSD_VIRTUAL_SERVICE,71, debugstr );
+ }
+ return -1;
+ }
+
+ g_hash_table_insert( srv->conn_hash, &conn->ciom->fd, conn );
+ //DEBUG output
+ if( LOG_LV_DEBUG == logger_get_log_level( LOG_CAT_L7VSD_VIRTUAL_SERVICE ) ){
+ char debugstr[DEBUG_STR_LEN];
+ memset( debugstr, 0, DEBUG_STR_LEN );
+ sprintf( debugstr, "function l7vs_service_register_conn(struct l7vs_service *srv, struct l7vs_conn *conn) return : 0" );
+ LOGGER_PUT_LOG_DEBUG( LOG_CAT_L7VSD_VIRTUAL_SERVICE,72, debugstr );
+ }
+ return 0;
+}
+
+/*!
+ * connection list delete con in service
+ * @param[in] *srv service pointer
+ * @param[in] *conn l7vs_conn pointer
+ * @return void
+ */
+int
+l7vs_service_remove_conn(struct l7vs_service *srv, struct l7vs_conn *conn)
+{
+ if( NULL == srv || NULL == conn ){
+ LOGGER_PUT_LOG_ERROR( LOG_CAT_L7VSD_PROGRAM,23, "remove connection : Invalid argument" );
+ return -1;
+ }
+
+ //DEBUG output
+ if( LOG_LV_DEBUG == logger_get_log_level( LOG_CAT_L7VSD_VIRTUAL_SERVICE ) ){
+ char debugstr[DEBUG_STR_LEN];
+ char connstr[DEBUG_STR_LEN];
+ memset( debugstr, 0, DEBUG_STR_LEN );
+ sprintf( debugstr, "function l7vs_service_remove_conn(struct l7vs_service *srv, struct l7vs_conn *conn)" );
+ LOGGER_PUT_LOG_DEBUG( LOG_CAT_L7VSD_VIRTUAL_SERVICE,73, debugstr );
+ memset( debugstr, 0, DEBUG_STR_LEN );
+ sprintf( debugstr, "srv dump" );
+ l7vs_service_c_str( debugstr, srv );
+ LOGGER_PUT_LOG_DEBUG( LOG_CAT_L7VSD_VIRTUAL_SERVICE,74, debugstr );
+ memset( debugstr, 0, DEBUG_STR_LEN );
+ memset( connstr, 0, DEBUG_STR_LEN );
+ l7vs_conn_c_str( connstr, conn );
+ sprintf( debugstr, "conn dump %s", connstr );
+ LOGGER_PUT_LOG_DEBUG( LOG_CAT_L7VSD_VIRTUAL_SERVICE,75, debugstr );
+ }
+
+ g_hash_table_remove( srv->conn_hash, &conn->ciom->fd );
+ //DEBUG output
+ if( LOG_LV_DEBUG == logger_get_log_level( LOG_CAT_L7VSD_VIRTUAL_SERVICE ) ){
+ char debugstr[DEBUG_STR_LEN];
+ memset( debugstr, 0, DEBUG_STR_LEN );
+ sprintf( debugstr, "function l7vs_service_remove_conn(struct l7vs_service *srv, struct l7vs_conn *conn) return : 0" );
+ LOGGER_PUT_LOG_DEBUG( LOG_CAT_L7VSD_VIRTUAL_SERVICE,76, debugstr );
+ }
+ return 0;
+}
+
+/*!
+ * destroy all member in all service.
+ *
+ */
+void
+l7vs_service_flush_all(void)
+{
+ GList *l;
+ struct l7vs_service *srv;
+
+ //DEBUG output
+ if( LOG_LV_DEBUG == logger_get_log_level( LOG_CAT_L7VSD_VIRTUAL_SERVICE ) ){
+ char debugstr[DEBUG_STR_LEN];
+ memset( debugstr, 0, DEBUG_STR_LEN );
+ sprintf( debugstr, "function l7vs_service_flush_all()" );
+ LOGGER_PUT_LOG_DEBUG( LOG_CAT_L7VSD_VIRTUAL_SERVICE,77, debugstr );
+ }
+
+ while ((l = g_list_first(l7vs_service_list)) != NULL) {
+ srv = (struct l7vs_service *)l->data;
+ l7vs_service_destroy( srv );
+ }
+ //DEBUG output
+ if( LOG_LV_DEBUG == logger_get_log_level( LOG_CAT_L7VSD_VIRTUAL_SERVICE ) ){
+ char debugstr[DEBUG_STR_LEN];
+ memset( debugstr, 0, DEBUG_STR_LEN );
+ sprintf( debugstr, "function l7vs_service_flush_all() return" );
+ LOGGER_PUT_LOG_DEBUG( LOG_CAT_L7VSD_VIRTUAL_SERVICE,78, debugstr );
+ }
+}
+
+/*!
+ * set QoS(TraficControl) Threshold value
+ * @param[in] *srv service pointer
+ * @param[in] *arg l7vs_service_arg_multi pointer
+ * return 0 = success / -1 = failur
+ */
+int
+l7vs_service_set_QoS_Threshold( struct l7vs_service * srv, struct l7vs_service_arg_multi * arg )
+{
+// struct l7vs_service_repdata * service_replicationdata;
+
+ if( NULL == srv ){
+ LOGGER_PUT_LOG_ERROR( LOG_CAT_L7VSD_PROGRAM,24, "Argument srv is NULL" );
+ return -1;
+ }
+ if( NULL == arg ){
+ LOGGER_PUT_LOG_ERROR( LOG_CAT_L7VSD_PROGRAM,25, "Argument arg is NULL" );
+ return -1;
+ }
+
+ //DEBUG output
+ if( LOG_LV_DEBUG == logger_get_log_level( LOG_CAT_L7VSD_VIRTUAL_SERVICE ) ){
+ char debugstr[DEBUG_STR_LEN];
+ memset( debugstr, 0, DEBUG_STR_LEN );
+ sprintf( debugstr, "function l7vs_service_set_QoS_Threshold( struct l7vs_service * srv, struct l7vs_service_arg_multi * arg )" );
+ LOGGER_PUT_LOG_DEBUG( LOG_CAT_L7VSD_VIRTUAL_SERVICE,79, debugstr );
+ memset( debugstr, 0, DEBUG_STR_LEN );
+ sprintf( debugstr, "srv dump" );
+ l7vs_service_c_str( debugstr, srv );
+ LOGGER_PUT_LOG_DEBUG( LOG_CAT_L7VSD_VIRTUAL_SERVICE,80, debugstr );
+ memset( debugstr, 0, DEBUG_STR_LEN );
+ sprintf( debugstr, "arg dump" );
+ l7vs_service_arg_multi_c_str( debugstr, arg );
+ LOGGER_PUT_LOG_DEBUG( LOG_CAT_L7VSD_VIRTUAL_SERVICE,81, debugstr );
+ }
+
+ srv->qos_threshold_up = arg->srv_arg.qos_threshold_up;
+ srv->qos_threshold_down = arg->srv_arg.qos_threshold_down;
+
+ // Get the replication area.
+ unsigned int r_size = 0;
+ l7vs_service_repdata * repdata = (l7vs_service_repdata*)l7vs_replication_pay_memory( REP_COMP_SV, &r_size );
+ // make replication data
+ if( NULL != repdata )make_replication_data( rep_size_num, repdata );
+
+ //DEBUG output
+ if( LOG_LV_DEBUG == logger_get_log_level( LOG_CAT_L7VSD_VIRTUAL_SERVICE ) ){
+ char debugstr[DEBUG_STR_LEN];
+ memset( debugstr, 0, DEBUG_STR_LEN );
+ sprintf( debugstr, "function l7vs_service_set_QoS_Threshold( struct l7vs_service * srv, struct l7vs_service_arg_multi * arg ) return : 0" );
+ LOGGER_PUT_LOG_DEBUG( LOG_CAT_L7VSD_VIRTUAL_SERVICE,82, debugstr );
+ }
+
+ return 0;
+}
+
+/*!
+ * set Sorry-Server values
+ * @param[in] *srv service pointer
+ * @param[in] *arg l7vs_service_arg_multi pointer
+ * return 0 = success / -1 = failure
+ */
+int
+l7vs_service_set_SorryServer_Values( struct l7vs_service * srv, struct l7vs_service_arg_multi * arg )
+{
+ struct sockaddr_in * saddr;
+// struct l7vs_service_repdata * service_replicationdata;
+
+ if( NULL == srv ){
+ LOGGER_PUT_LOG_ERROR( LOG_CAT_L7VSD_PROGRAM,26, "Argument srv is NULL" );
+ return -1;
+ }
+ if( NULL == arg ){
+ LOGGER_PUT_LOG_ERROR( LOG_CAT_L7VSD_PROGRAM,27, "Argument arg is NULL" );
+ return -1;
+ }
+ //DEBUG output
+ if( LOG_LV_DEBUG == logger_get_log_level( LOG_CAT_L7VSD_VIRTUAL_SERVICE ) ){
+ char debugstr[DEBUG_STR_LEN];
+ memset( debugstr, 0, DEBUG_STR_LEN );
+ sprintf( debugstr, "function l7vs_service_set_SorryServer_Values( struct l7vs_service * srv, struct l7vs_service_arg_multi * arg )" );
+ LOGGER_PUT_LOG_DEBUG( LOG_CAT_L7VSD_VIRTUAL_SERVICE,83, debugstr );
+ memset( debugstr, 0, DEBUG_STR_LEN );
+ sprintf( debugstr, "srv dump" );
+ l7vs_service_c_str( debugstr, srv );
+ LOGGER_PUT_LOG_DEBUG( LOG_CAT_L7VSD_VIRTUAL_SERVICE,84, debugstr );
+ memset( debugstr, 0, DEBUG_STR_LEN );
+ sprintf( debugstr, "arg dump" );
+ l7vs_service_arg_multi_c_str( debugstr, arg );
+ LOGGER_PUT_LOG_DEBUG( LOG_CAT_L7VSD_VIRTUAL_SERVICE,85, debugstr );
+ }
+ // set sorry data
+ saddr = (struct sockaddr_in *)&arg->srv_arg.sorry_addr;
+ srv->sorry_dest->addr = *saddr;
+ srv->sorry_cc = arg->srv_arg.sorry_cc;
+ srv->sorry_flag = arg->srv_arg.sorry_flag;
+
+ unsigned int r_size = 0;
+ l7vs_service_repdata *repdata = (l7vs_service_repdata*)l7vs_replication_pay_memory(REP_COMP_SV, &r_size);
+
+ //make replication data
+ if( NULL != repdata)
+ {
+ make_replication_data(rep_size_num, repdata);
+ }
+
+ //DEBUG output
+ if( LOG_LV_DEBUG == logger_get_log_level( LOG_CAT_L7VSD_VIRTUAL_SERVICE ) ){
+ char debugstr[DEBUG_STR_LEN];
+ memset( debugstr, 0, DEBUG_STR_LEN );
+ sprintf( debugstr, "function l7vs_service_set_SorryServer_Values( struct l7vs_service * srv, struct l7vs_service_arg_multi * arg ) return : 0" );
+ LOGGER_PUT_LOG_DEBUG( LOG_CAT_L7VSD_VIRTUAL_SERVICE,86, debugstr );
+ }
+
+ return 0;
+}
+
+/*!
+ * get number of l7vs_service list
+ * @param[in] none
+ * @return unsigned int
+ */
+unsigned int
+l7vs_service_get_VSnum()
+{
+ int retval = g_list_length( l7vs_service_list );
+ //DEBUG output
+ if( LOG_LV_DEBUG == logger_get_log_level( LOG_CAT_L7VSD_VIRTUAL_SERVICE ) ){
+ char debugstr[DEBUG_STR_LEN];
+ memset( debugstr, 0, DEBUG_STR_LEN );
+ sprintf( debugstr, "function l7vs_service_get_VSnum()" );
+ LOGGER_PUT_LOG_DEBUG( LOG_CAT_L7VSD_VIRTUAL_SERVICE,87, debugstr );
+ memset( debugstr, 0, DEBUG_STR_LEN );
+ sprintf( debugstr, "function l7vs_service_get_VSnum() return : num = retval" );
+ LOGGER_PUT_LOG_DEBUG( LOG_CAT_L7VSD_VIRTUAL_SERVICE,88, debugstr );
+ }
+ return retval;
+}
+
+/*!
+ * find and get l7vs_service by number of l7vs_service_list
+ * @param[in] num number of l7vs_service list
+ * return l7vs_service pointer
+ */
+struct l7vs_service *
+l7vs_service_get_VSInfo_byNum( unsigned int num )
+{
+ unsigned int vs_num = g_list_length( l7vs_service_list );
+ if( 0 > num )return NULL;
+ if( 0 == vs_num )return NULL;
+ //DEBUG output
+ if( LOG_LV_DEBUG == logger_get_log_level( LOG_CAT_L7VSD_VIRTUAL_SERVICE ) ){
+ char debugstr[DEBUG_STR_LEN];
+ memset( debugstr, 0, DEBUG_STR_LEN );
+ sprintf( debugstr, "function l7vs_service_get_VSInfo_byNum( unsigned int num )" );
+ sprintf( debugstr, "%s num = %d", debugstr, num );
+ LOGGER_PUT_LOG_DEBUG( LOG_CAT_L7VSD_VIRTUAL_SERVICE,89, debugstr );
+ memset( debugstr, 0, DEBUG_STR_LEN );
+ sprintf( debugstr, "function l7vs_service_get_VSInfo_byNum( unsigned int num ) return" );
+ LOGGER_PUT_LOG_DEBUG( LOG_CAT_L7VSD_VIRTUAL_SERVICE,90, debugstr );
+ }
+ return (struct l7vs_service *)g_list_nth_data( l7vs_service_list, num );
+}
+
+/*!
+ * find and get l7vs_service by service-handle
+ * @param[in] in_handle l7vs_service handle
+ * return l7vs_service pointer
+ */
+struct l7vs_service *
+l7vs_service_get_VSInfo_byHandler( handle_t in_handle )
+{
+ GList * l;
+ //DEBUG output
+ if( LOG_LV_DEBUG == logger_get_log_level( LOG_CAT_L7VSD_VIRTUAL_SERVICE ) ){
+ char debugstr[DEBUG_STR_LEN];
+ memset( debugstr, 0, DEBUG_STR_LEN );
+ sprintf( debugstr, "function l7vs_service_get_VSInfo_byHandler( handle_t in_handle )" );
+ sprintf( debugstr, "%s, in_handle = %d", debugstr, in_handle );
+ LOGGER_PUT_LOG_DEBUG( LOG_CAT_L7VSD_VIRTUAL_SERVICE,91, debugstr );
+ }
+ for ( l = g_list_first(l7vs_service_list); l != NULL; l = g_list_next(l) ){
+ if( ((struct l7vs_service *)l->data)->handle == in_handle ){
+ //DEBUG output
+ if( LOG_LV_DEBUG == logger_get_log_level( LOG_CAT_L7VSD_VIRTUAL_SERVICE ) ){
+ char debugstr[DEBUG_STR_LEN];
+ memset( debugstr, 0, DEBUG_STR_LEN );
+ sprintf( debugstr, "function l7vs_service_get_VSInfo_byHandler( handle_t in_handle ) return" );
+ LOGGER_PUT_LOG_DEBUG( LOG_CAT_L7VSD_VIRTUAL_SERVICE,92, debugstr );
+ }
+ return (struct l7vs_service *)l->data;
+ }
+ }
+ //DEBUG output
+ if( LOG_LV_DEBUG == logger_get_log_level( LOG_CAT_L7VSD_VIRTUAL_SERVICE ) ){
+ char debugstr[DEBUG_STR_LEN];
+ memset( debugstr, 0, DEBUG_STR_LEN );
+ sprintf( debugstr, "function l7vs_service_get_VSInfo_byHandler( handle_t in_handle ) return : NULL" );
+ LOGGER_PUT_LOG_DEBUG( LOG_CAT_L7VSD_VIRTUAL_SERVICE,93, debugstr );
+ }
+ return NULL;
+}
+
+void
+l7vs_service_update_throughput( struct l7vs_service* srv, unsigned long long current_time ) {
+ if ( LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK_BANDWIDTH) ) {
+ char srv_str[DEBUG_STR_LEN];
+ memset( srv_str, 0, DEBUG_STR_LEN );
+ l7vs_service_c_str(srv_str, srv);
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_NETWORK_BANDWIDTH,1,"in_function: void l7vs_service_update_throughput(struct l7vs_service* srv, unsigned long long current_time) srv=%s, current_time=%llu", srv_str, current_time);
+ }
+ if (srv->pre_recvtime_from_client == current_time - 2) {
+ srv->pre_recvtime_from_client = current_time - 1;
+ srv->pre_recvsize_from_client = srv->cur_recvsize_from_client;
+ srv->cur_recvsize_from_client = 0;
+ }
+ else if (srv->pre_recvtime_from_client != current_time - 1) {
+ srv->pre_recvtime_from_client = current_time - 1;
+ srv->pre_recvsize_from_client = 0;
+ srv->cur_recvsize_from_client = 0;
+ }
+ if (srv->pre_recvtime_from_server == current_time - 2) {
+ srv->pre_recvtime_from_server = current_time - 1;
+ srv->pre_recvsize_from_server = srv->cur_recvsize_from_server;
+ srv->cur_recvsize_from_server = 0;
+ }
+ else if (srv->pre_recvtime_from_server != current_time - 1) {
+ srv->pre_recvtime_from_server = current_time - 1;
+ srv->pre_recvsize_from_server = 0;
+ srv->cur_recvsize_from_server = 0;
+ }
+ if ( LOG_LV_DEBUG == logger_get_log_level(LOG_CAT_L7VSD_NETWORK_BANDWIDTH) ) {
+ LOGGER_PUT_LOG_DEBUG(LOG_CAT_L7VSD_VIRTUAL_SERVICE,2,"out_function: void l7vs_service_update_throughput(struct l7vs_service* srv, unsigned long long current_time)");
+ }
+}
--- /dev/null
+
+#include <map>
+#include "l7vs_snmpbridge.h"
+#include "logger_wrapper.h"
+#include "parameter_wrapper.h"
+#include "l7ag_parameter.h"
+
+#define NIC_DEFAULT "eth0"
+#define ADDR_DEFAULT "127.0.0.1"
+#define PORT_DEFAULT 60162
+#define INTERVAL_DEFAULT 1000
+
+#define BRIDGE_STUB
+
+static std::map<LOG_CATEGORY_TAG,std::string> snmp_loglevel_map;
+static std::map<std::string,LOG_LEVEL_TAG> levelstring_map;
+
+struct l7ag_parameter snmpparam;
+
+//内部関数の定義
+#ifndef BRIDGE_STUB
+static int snmpbridge_send_message();
+#endif
+static void load_config();
+static void load_loglevel();
+
+/*!
+ * 初期化処理
+ * @return int
+ */
+int l7vs_snmpbridge_initialize()
+{
+ int retval = 0;
+
+ //loglevelのテーブル作成
+ snmp_loglevel_map.clear();
+ snmp_loglevel_map.insert( std::pair<LOG_CATEGORY_TAG,std::string>( LOG_CAT_SNMPAGENT_START_STOP, "snmpagent_start_stop" ) );
+ snmp_loglevel_map.insert( std::pair<LOG_CATEGORY_TAG,std::string>( LOG_CAT_SNMPAGENT_MANAGER_RECEIVE, "snmpagent_manager_receive" ) );
+ snmp_loglevel_map.insert( std::pair<LOG_CATEGORY_TAG,std::string>( LOG_CAT_SNMPAGENT_MANAGER_SEND, "snmpagent_manager_send" ) );
+ snmp_loglevel_map.insert( std::pair<LOG_CATEGORY_TAG,std::string>( LOG_CAT_SNMPAGENT_L7VSD_RECEIVE, "snmpagent_l7vsd_receive" ) );
+ snmp_loglevel_map.insert( std::pair<LOG_CATEGORY_TAG,std::string>( LOG_CAT_SNMPAGENT_L7VSD_SEND, "snmpagent_l7vsd_send" ) );
+ snmp_loglevel_map.insert( std::pair<LOG_CATEGORY_TAG,std::string>( LOG_CAT_SNMPAGENT_LOGGER, "snmpagent_logger" ) );
+ snmp_loglevel_map.insert( std::pair<LOG_CATEGORY_TAG,std::string>( LOG_CAT_SNMPAGENT_PARAMETER, "snmpagent_parameter" ) );
+
+ levelstring_map.clear();
+ levelstring_map.insert( std::pair<std::string,LOG_LEVEL_TAG>("debug",LOG_LV_DEBUG) );
+ levelstring_map.insert( std::pair<std::string,LOG_LEVEL_TAG>("info",LOG_LV_INFO) );
+ levelstring_map.insert( std::pair<std::string,LOG_LEVEL_TAG>("warn",LOG_LV_WARN) );
+ levelstring_map.insert( std::pair<std::string,LOG_LEVEL_TAG>("error",LOG_LV_ERROR) );
+ levelstring_map.insert( std::pair<std::string,LOG_LEVEL_TAG>("fatal",LOG_LV_FATAL) );
+
+ load_config();
+
+#ifndef BRIDGE_STUB
+ //ListenSocket作成
+
+ //待ち受け開始
+
+ //iom払い出し
+
+ //iom設定
+
+ //iom登録
+#endif
+ return retval;
+}
+
+/*!
+ * 終了処理
+ * @param[in]
+ * @return
+ */
+void l7vs_snmpbridge_finalize()
+{
+ //AgentとのTCP接続をcloseする
+
+ //ListenSocketをcloseする
+
+ //iom返却
+
+}
+
+/*!
+ * TRAP Request send
+ * @param[in] TRAPID_TAG Trap ID
+ * @param[in] *message Trap message
+ * @return int
+ */
+int l7vs_snmpbridge_send_trap( TRAPID_TAG trapid, char* message )
+{
+ int retval = 0;
+
+#ifndef BRIDGE_STUB
+ //送信メッセージ作成
+
+
+ //iomに送信イベント登録
+ retval = snmpbridge_send_message();
+#endif
+
+ return retval;
+}
+
+/*!
+ * パラメータファイル再読込み指示
+ */
+void l7vs_snmpbridge_reload_config()
+{
+#ifndef BRIDGE_STUB
+ //送信メッセージ作成
+
+ //iomに送信イベント登録
+ retval = snmpbridge_send_message();
+#endif
+
+ load_config();
+}
+
+/*!
+ * ログレベル設定指示
+ */
+int l7vs_snmpbridge_change_loglevel( LOG_CATEGORY_TAG snmp_log_category, LOG_LEVEL_TAG loglevel )
+{
+ int retval = 0;
+
+ if( snmpparam.loglevel.end() != snmpparam.loglevel.find( snmp_log_category ) ){
+#ifndef BRIDGE_STUB
+ //送信メッセージ作成
+
+ //iomに送信イベント登録
+ retval = snmpbridge_send_message();
+ if( 0 == retval ){
+#endif
+ snmpparam.loglevel.find( snmp_log_category )->second = loglevel;
+#ifndef BRIDGE_STUB
+ }
+#endif
+ }else{
+ retval = -1;
+ }
+ return retval;
+}
+
+/*!
+ * ログレベル設定指示(カテゴリ全指定)
+ */
+int l7vs_snmpbridge_change_loglevel_allcategory( LOG_LEVEL_TAG loglevel )
+{
+ int retval = 0;
+
+#ifndef BRIDGE_STUB
+ //送信メッセージ作成
+
+ //iomに送信イベント登録
+ retval = snmpbridge_send_message();
+ if( 0 == retval ){
+#endif
+ for( std::map<LOG_CATEGORY_TAG,LOG_LEVEL_TAG>::iterator it = snmpparam.loglevel.begin(); it != snmpparam.loglevel.end(); ++it ){
+ it->second = loglevel;
+ }
+#ifndef BRIDGE_STUB
+ }
+#endif
+
+ return retval;
+}
+
+/*!
+ * MIB収集結果送信
+ */
+int l7vs_snmpbridge_send_mibcollection()
+{
+ int retval = 0;
+
+#ifndef BRIDGE_STUB
+ //送信メッセージ作成
+
+ //iomに送信イベント登録
+ retval = snmpbridge_send_message();
+#endif
+
+ return retval;
+}
+
+/*!
+ * 接続状態取得
+ */
+int l7vs_snmpbridge_get_connectionstate()
+{
+ int retval = 0;
+
+#ifdef BRIDGE_STUB
+ retval = snmpparam.status;
+#else
+#endif
+ return retval;
+}
+
+/*!
+ * ログレベル取得
+ */
+LOG_LEVEL_TAG l7vs_snmpbridge_get_loglevel( LOG_CATEGORY_TAG snmp_log_category )
+{
+ LOG_LEVEL_TAG level = LOG_LV_NONE;
+ if( snmpparam.loglevel.end() != snmpparam.loglevel.find( snmp_log_category ) ){
+ level = snmpparam.loglevel.find( snmp_log_category )->second;
+ }
+ return level;
+}
+
+/*!
+ * コールバック
+ */
+int l7vs_snmpbridge_callback( l7vs_iomux* iom )
+{
+
+ return 0;
+}
+
+/*!
+ *
+ */
+#ifndef BRIDGE_STUB
+static int snmpbridge_send_message()
+{
+
+ return 0;
+}
+#endif
+
+/*!
+ *
+ */
+static void load_config()
+{
+ int retval = 0;
+ //NIC
+ if( parameter_is_char_exist( PARAM_COMP_SNMPAGENT, "nic" ) ){
+ snmpparam.nic = parameter_get_char_value( PARAM_COMP_SNMPAGENT, "nic" );
+ }else{
+ snmpparam.nic = NIC_DEFAULT;
+ }
+ //EndPoint
+ if( parameter_is_char_exist( PARAM_COMP_SNMPAGENT, "ip_addr" ) ){
+ snmpparam.address = parameter_get_char_value( PARAM_COMP_SNMPAGENT, "ip_addr" );
+ }else{
+ snmpparam.address = ADDR_DEFAULT;
+ }
+ if( parameter_is_int_exist( PARAM_COMP_SNMPAGENT, "port" ) ){
+ snmpparam.portno = parameter_get_int_value( PARAM_COMP_SNMPAGENT, "port" );
+ }else{
+ snmpparam.portno = PORT_DEFAULT;
+ }
+
+ //Agentパラメータ読み出し
+ //リクエストインターバル
+ if( parameter_is_int_exist( PARAM_COMP_SNMPAGENT, "interval" ) ){
+ snmpparam.interval = parameter_get_int_value( PARAM_COMP_SNMPAGENT, "interval" );
+ }else{
+ snmpparam.interval = INTERVAL_DEFAULT;
+ }
+ if( parameter_is_int_exist( PARAM_COMP_SNMPAGENT, "status" ) ){
+ snmpparam.status = parameter_get_int_value( PARAM_COMP_SNMPAGENT, "status" );
+ }else{
+ snmpparam.status = 0;
+ }
+ load_loglevel();
+}
+
+static void load_loglevel()
+{
+ //log level 取得
+ snmpparam.loglevel.clear();
+ //
+ if( parameter_is_char_exist( PARAM_COMP_LOGGER, "snmpagent_start_stop" ) ){
+ snmpparam.loglevel.insert( std::pair<LOG_CATEGORY_TAG,LOG_LEVEL_TAG>( LOG_CAT_SNMPAGENT_START_STOP, levelstring_map[parameter_get_char_value( PARAM_COMP_LOGGER, "snmpagent_start_stop" )] ) );
+ }else{
+ snmpparam.loglevel.insert( std::pair<LOG_CATEGORY_TAG,LOG_LEVEL_TAG>( LOG_CAT_SNMPAGENT_START_STOP, LOG_LV_INFO) );
+ }
+ //
+ if( parameter_is_char_exist( PARAM_COMP_LOGGER, "snmpagent_manager_receive" ) ){
+ snmpparam.loglevel.insert( std::pair<LOG_CATEGORY_TAG,LOG_LEVEL_TAG>( LOG_CAT_SNMPAGENT_MANAGER_RECEIVE, levelstring_map[parameter_get_char_value( PARAM_COMP_LOGGER, "snmpagent_manager_receive" )] ) );
+ }else{
+ snmpparam.loglevel.insert( std::pair<LOG_CATEGORY_TAG,LOG_LEVEL_TAG>( LOG_CAT_SNMPAGENT_MANAGER_RECEIVE, LOG_LV_INFO ) );
+ }
+ //
+ if( parameter_is_char_exist( PARAM_COMP_LOGGER, "snmpagent_manager_send" ) ){
+ snmpparam.loglevel.insert( std::pair<LOG_CATEGORY_TAG,LOG_LEVEL_TAG>( LOG_CAT_SNMPAGENT_MANAGER_SEND, levelstring_map[parameter_get_char_value( PARAM_COMP_LOGGER, "snmpagent_manager_send" )] ) );
+ }else{
+ snmpparam.loglevel.insert( std::pair<LOG_CATEGORY_TAG,LOG_LEVEL_TAG>( LOG_CAT_SNMPAGENT_MANAGER_SEND, LOG_LV_INFO ) );
+ }
+ //
+ if( parameter_is_char_exist( PARAM_COMP_LOGGER, "snmpagent_l7vsd_receive" ) ){
+ snmpparam.loglevel.insert( std::pair<LOG_CATEGORY_TAG,LOG_LEVEL_TAG>( LOG_CAT_SNMPAGENT_L7VSD_RECEIVE, levelstring_map[parameter_get_char_value( PARAM_COMP_LOGGER, "snmpagent_l7vsd_receive" )] ) );
+ }else{
+ snmpparam.loglevel.insert( std::pair<LOG_CATEGORY_TAG,LOG_LEVEL_TAG>( LOG_CAT_SNMPAGENT_L7VSD_RECEIVE, LOG_LV_INFO ) );
+ }
+ //
+ if( parameter_is_char_exist( PARAM_COMP_LOGGER, "snmpagent_l7vsd_send" ) ){
+ snmpparam.loglevel.insert( std::pair<LOG_CATEGORY_TAG,LOG_LEVEL_TAG>( LOG_CAT_SNMPAGENT_L7VSD_SEND, levelstring_map[parameter_get_char_value( PARAM_COMP_LOGGER, "snmpagent_l7vsd_send" )] ) );
+ }else{
+ snmpparam.loglevel.insert( std::pair<LOG_CATEGORY_TAG,LOG_LEVEL_TAG>( LOG_CAT_SNMPAGENT_L7VSD_SEND, LOG_LV_INFO ) );
+ }
+ //
+ if( parameter_is_char_exist( PARAM_COMP_LOGGER, "snmpagent_logger" ) ){
+ snmpparam.loglevel.insert( std::pair<LOG_CATEGORY_TAG,LOG_LEVEL_TAG>( LOG_CAT_SNMPAGENT_LOGGER, levelstring_map[parameter_get_char_value( PARAM_COMP_LOGGER, "snmpagent_logger" )] ) );
+ }else{
+ snmpparam.loglevel.insert( std::pair<LOG_CATEGORY_TAG,LOG_LEVEL_TAG>( LOG_CAT_SNMPAGENT_LOGGER, LOG_LV_INFO ) );
+ }
+ //
+ if( parameter_is_char_exist( PARAM_COMP_LOGGER, "snmpagent_parameter" ) ){
+ snmpparam.loglevel.insert( std::pair<LOG_CATEGORY_TAG,LOG_LEVEL_TAG>( LOG_CAT_SNMPAGENT_PARAMETER, levelstring_map[parameter_get_char_value( PARAM_COMP_LOGGER, "snmpagent_parameter" )] ) );
+ }else{
+ snmpparam.loglevel.insert( std::pair<LOG_CATEGORY_TAG,LOG_LEVEL_TAG>( LOG_CAT_SNMPAGENT_PARAMETER, LOG_LV_INFO ) );
+ }
+}
+
--- /dev/null
+%define prefix /usr
+
+#Uncomment these if they are not defined by your rpm macros file
+%define _sysconfdir /etc
+%define _localstatedir /var
+%define _mandir %{_prefix}/share/man
+
+Summary: The Layer-7 Virtual Server
+Name: ultramonkey-l7
+Version: 2.1.2
+Release: 1
+License: LGPL
+Packager: Shinya TAKEBAYASHI
+Group: Network
+Source0: %{name}-%{version}-%{release}.tar.gz
+BuildRoot: /var/tmp/%{name}-%{version}-root
+Docdir: %{prefix}/doc
+Provides: %{name}-%{version}-%{release}
+BuildPrereq: automake autoconf libtool
+AutoReqProv: no
+#Requires:
+
+%description
+Layer-7 load balancer daemon
+
+%prep
+rm -rf ${RPM_BUILD_ROOT}
+%setup
+
+%build
+
+# I am providing my own configure macro replacement. Hopefully this
+# will result in fewer portability problems than using the one supplied
+# by various vendours. I fear that I hope in vein.
+CFLAGS="${CFLAGS:-%optflags}" ; export CFLAGS
+if [ -f confgure.in ]; then
+ aclocal
+ libtoolize --force --copy
+ automake
+ autoconf
+fi
+./configure %{_target_platform} \
+ --prefix=%{_prefix} \
+ --exec-prefix=%{_exec_prefix} \
+ --bindir=%{_bindir} \
+ --sbindir=%{_sbindir} \
+ --sysconfdir=%{_sysconfdir} \
+ --datadir=%{_datadir} \
+ --includedir=%{_includedir} \
+ --libdir=%{_libdir} \
+ --libexecdir=%{_libexecdir} \
+ --localstatedir=%{_localstatedir} \
+ --sharedstatedir=%{_sharedstatedir} \
+ --mandir=%{_mandir} \
+ --infodir=%{_infodir} \
+ --with-l7vs-moddir=%{_libdir}/l7vs
+
+make -j2
+
+%install
+# rm -rf ${RPM_BUILD_ROOT}
+
+# Manually install init script
+#mkdir -p ${RPM_BUILD_ROOT}/etc/init.d/
+#install -c -m 755 \
+# ${RPM_BUILD_DIR}/%{name}-%{version}/etc/init.d/l7vs.rh \
+# ${RPM_BUILD_ROOT}/etc/init.d/l7vs
+
+# Install eveything else
+#make DESTDIR=$RPM_BUILD_ROOT install
+
+mkdir -p $RPM_BUILD_ROOT%{_sbindir}
+mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}
+mkdir -p $RPM_BUILD_ROOT%{_libdir}/l7vs
+mkdir -p $RPM_BUILD_ROOT/var/run/l7vs
+mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/init.d
+mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/l7vs
+mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/ha.d/conf
+mkdir -p $RPM_BUILD_ROOT%{_prefix}/share/man/man8
+
+install -c -m 755 -D src/l7vsd src/l7vsadm $RPM_BUILD_ROOT%{_sbindir}
+cp module/protocol/.libs/libprotomod_sslid.so module/protocol/.libs/protomod_sslid.so
+cp module/protocol/.libs/libprotomod_url.so module/protocol/.libs/protomod_url.so
+cp module/protocol/.libs/libprotomod_pfilter.so module/protocol/.libs/protomod_pfilter.so
+cp module/protocol/.libs/libprotomod_ip.so module/protocol/.libs/protomod_ip.so
+cp module/protocol/.libs/libprotomod_sessionless.so module/protocol/.libs/protomod_sessionless.so
+install -c -m 755 -D module/protocol/.libs/protomod_sslid.so module/protocol/.libs/protomod_url.so module/protocol/.libs/protomod_pfilter.so module/protocol/.libs/protomod_ip.so module/protocol/.libs/protomod_sessionless.so $RPM_BUILD_ROOT%{_libdir}/l7vs
+
+cp module/schedule/.libs/libsched_lc.so module/schedule/.libs/sched_lc.so
+cp module/schedule/.libs/libsched_rr.so module/schedule/.libs/sched_rr.so
+cp module/schedule/.libs/libsched_wrr.so module/schedule/.libs/sched_wrr.so
+install -c -m 755 -D module/schedule/.libs/sched_lc.so module/schedule/.libs/sched_rr.so module/schedule/.libs/sched_wrr.so $RPM_BUILD_ROOT%{_libdir}/l7vs
+
+install -c -m 755 -D init.d/l7vsd $RPM_BUILD_ROOT%{_sysconfdir}/init.d
+install -c -m 644 -D conf/l7vs.cf $RPM_BUILD_ROOT%{_sysconfdir}/l7vs
+install -c -m 644 -D man/l7vsd.8.gz $RPM_BUILD_ROOT%{_mandir}/man8/
+install -c -m 644 -D man/l7vsadm.8.gz $RPM_BUILD_ROOT%{_mandir}/man8/
+install -c -m 644 -D man/l7directord.8.gz $RPM_BUILD_ROOT%{_mandir}/man8/
+
+install -c -m 755 -D l7directord/l7directord $RPM_BUILD_ROOT%{_sbindir}
+install -c -m 755 -D l7directord/init.d/l7directord $RPM_BUILD_ROOT%{_sysconfdir}/init.d
+install -c -m 644 -D l7directord/conf/l7directord.cf.sample $RPM_BUILD_ROOT%{_sysconfdir}/ha.d/conf
+
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+
+%post
+mkdir -p /var/run/l7vs
+ldconfig
+chkconfig --add l7vsd
+
+
+%postun
+if [ $1 = 0 ]; then
+ rm -rf /var/run/l7vs
+fi
+
+
+%preun
+if [ $1 = 0 ]; then
+ chkconfig --del l7vsd
+fi
+
+%files
+%defattr(-, root, root, 0755)
+#%{_localstatedir}/run/%{name}/
+%{_sbindir}
+%{_libdir}/l7vs/*
+%config %{_sysconfdir}/init.d/*
+%config %{_sysconfdir}/l7vs/*
+%config %{_sysconfdir}/ha.d/*
+
+%doc README
+%doc %{_mandir}/man8/*
+
+%changelog