Patch for SMS Campaign

Nguyen Dinh Trung <[email protected]>
Newsgroups gmane.comp.mobile.kannel.devel
Message-ID <CABKrxTYZkWYipNs40AGYzqzOTjuDpJmLXa2su+_Qx+wuJXO6Dg@mail.gmail.com>
Hi Alex,

I just create a simple patch to support SMS Campaign for MySQL.

Currently I don't have time to extend the functionality for other DB
Engine, but I think it should be the same.

I tested in my Dev machine and the throughput is correct for now...

Here is the patch.

SQL Database table:
CREATE TABLE `campaign` (
  `id` int(9) NOT NULL AUTO_INCREMENT,
  `speed` int(9) NOT NULL DEFAULT '0',
  `throughput` int(9) NOT NULL DEFAULT '0',
  `status` int(1) NOT NULL DEFAULT '1',
  `priority` int(1) NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`)
)

CREATE TABLE `send_sms` (
  `momt` enum('MO','MT') DEFAULT NULL,
  `sender` varchar(20) DEFAULT NULL,
  `receiver` varchar(20) DEFAULT NULL,
  `udhdata` blob,
  `msgdata` text,
  `time` bigint(20) DEFAULT NULL,
  `smsc_id` varchar(255) DEFAULT NULL,
  `service` varchar(255) DEFAULT NULL,
  `account` varchar(255) DEFAULT NULL,
  `id` bigint(20) DEFAULT NULL,
  `sms_type` bigint(20) DEFAULT NULL,
  `mclass` bigint(20) DEFAULT NULL,
  `mwi` bigint(20) DEFAULT NULL,
  `coding` bigint(20) DEFAULT NULL,
  `compress` bigint(20) DEFAULT NULL,
  `validity` bigint(20) DEFAULT NULL,
  `deferred` bigint(20) DEFAULT NULL,
  `dlr_mask` bigint(20) DEFAULT NULL,
  `dlr_url` varchar(255) DEFAULT NULL,
  `pid` bigint(20) DEFAULT NULL,
  `alt_dcs` bigint(20) DEFAULT NULL,
  `rpi` bigint(20) DEFAULT NULL,
  `charset` varchar(255) DEFAULT NULL,
  `boxc_id` varchar(255) DEFAULT NULL,
  `binfo` varchar(255) DEFAULT NULL,
  `meta_data` text,
  `campaign_id` int(11) DEFAULT NULL
)


 Thank you for your work.


Nguyễn Đình Trung

*Phòng Giải pháp
Công ty TNHH Kinh doanh Dịch vụ thông tin & Chuyển giao Công nghệ - ISTT*

Mobile: 090 616 5799
patch_throughput.diff (application/octet-stream, 80.2 KB)
Index: configure
===================================================================
--- configure	(revision 4974)
+++ configure	(working copy)
@@ -5612,7 +5612,7 @@
       # Canonicalize the path of ld
       ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
       while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
-	ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
+        ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
       done
       test -z "$LD" && LD="$ac_prog"
       ;;
@@ -5646,9 +5646,9 @@
       # Break only if it was the GNU/non-GNU ld that we prefer.
       case `"$acl_cv_path_LD" -v 2>&1 < /dev/null` in
       *GNU* | *'with BFD'*)
-	test "$with_gnu_ld" != no && break ;;
+        test "$with_gnu_ld" != no && break ;;
       *)
-	test "$with_gnu_ld" != yes && break ;;
+        test "$with_gnu_ld" != yes && break ;;
       esac
     fi
   done
@@ -5720,23 +5720,67 @@
 
 
 
-                  acl_libdirstem=lib
-  searchpath=`(LC_ALL=C $CC -print-search-dirs) 2>/dev/null | sed -n -e 's,^libraries: ,,p' | sed -e 's,^=,,'`
-  if test -n "$searchpath"; then
-    acl_save_IFS="${IFS= 	}"; IFS=":"
-    for searchdir in $searchpath; do
-      if test -d "$searchdir"; then
-        case "$searchdir" in
-          */lib64/ | */lib64 ) acl_libdirstem=lib64 ;;
-          *) searchdir=`cd "$searchdir" && pwd`
-             case "$searchdir" in
-               */lib64 ) acl_libdirstem=lib64 ;;
-             esac ;;
+
+  acl_libdirstem=lib
+  acl_libdirstem2=
+  case "$host_os" in
+    solaris*)
+                                    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for 64-bit host" >&5
+$as_echo_n "checking for 64-bit host... " >&6; }
+if ${gl_cv_solaris_64bit+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+#ifdef _LP64
+sixtyfour bits
+#endif
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "sixtyfour bits" >/dev/null 2>&1; then :
+  gl_cv_solaris_64bit=yes
+else
+  gl_cv_solaris_64bit=no
+fi
+rm -f conftest*
+
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_solaris_64bit" >&5
+$as_echo "$gl_cv_solaris_64bit" >&6; }
+      if test $gl_cv_solaris_64bit = yes; then
+        acl_libdirstem=lib/64
+        case "$host_cpu" in
+          sparc*)        acl_libdirstem2=lib/sparcv9 ;;
+          i*86 | x86_64) acl_libdirstem2=lib/amd64 ;;
         esac
       fi
-    done
-    IFS="$acl_save_IFS"
-  fi
+      ;;
+    *)
+      searchpath=`(LC_ALL=C $CC -print-search-dirs) 2>/dev/null | sed -n -e 's,^libraries: ,,p' | sed -e 's,^=,,'`
+      if test -n "$searchpath"; then
+        acl_save_IFS="${IFS= 	}"; IFS=":"
+        for searchdir in $searchpath; do
+          if test -d "$searchdir"; then
+            case "$searchdir" in
+              */lib64/ | */lib64 ) acl_libdirstem=lib64 ;;
+              */../ | */.. )
+                # Better ignore directories of this form. They are misleading.
+                ;;
+              *) searchdir=`cd "$searchdir" && pwd`
+                 case "$searchdir" in
+                   */lib64 ) acl_libdirstem=lib64 ;;
+                 esac ;;
+            esac
+          fi
+        done
+        IFS="$acl_save_IFS"
+      fi
+      ;;
+  esac
+  test -n "$acl_libdirstem2" || acl_libdirstem2="$acl_libdirstem"
 
 
 
@@ -5746,6 +5790,9 @@
 
 
 
+
+
+
     use_additional=yes
 
   acl_save_prefix="$prefix"
@@ -5782,6 +5829,10 @@
       else
         additional_includedir="$withval/include"
         additional_libdir="$withval/$acl_libdirstem"
+        if test "$acl_libdirstem2" != "$acl_libdirstem" \
+           && ! test -d "$withval/$acl_libdirstem"; then
+          additional_libdir="$withval/$acl_libdirstem2"
+        fi
       fi
     fi
 
@@ -5791,6 +5842,7 @@
   LTLIBICONV=
   INCICONV=
   LIBICONV_PREFIX=
+      HAVE_LIBICONV=
   rpathdirs=
   ltrpathdirs=
   names_already_handled=
@@ -5933,7 +5985,9 @@
           if test "X$found_dir" != "X"; then
                         LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }-L$found_dir -l$name"
             if test "X$found_so" != "X"; then
-                                                        if test "$enable_rpath" = no || test "X$found_dir" = "X/usr/$acl_libdirstem"; then
+                                                        if test "$enable_rpath" = no \
+                 || test "X$found_dir" = "X/usr/$acl_libdirstem" \
+                 || test "X$found_dir" = "X/usr/$acl_libdirstem2"; then
                                 LIBICONV="${LIBICONV}${LIBICONV:+ }$found_so"
               else
                                                                                 haveit=
@@ -6000,9 +6054,18 @@
             case "$found_dir" in
               */$acl_libdirstem | */$acl_libdirstem/)
                 basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem/"'*$,,'`
-                LIBICONV_PREFIX="$basedir"
+                if test "$name" = 'iconv'; then
+                  LIBICONV_PREFIX="$basedir"
+                fi
                 additional_includedir="$basedir/include"
                 ;;
+              */$acl_libdirstem2 | */$acl_libdirstem2/)
+                basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem2/"'*$,,'`
+                if test "$name" = 'iconv'; then
+                  LIBICONV_PREFIX="$basedir"
+                fi
+                additional_includedir="$basedir/include"
+                ;;
             esac
             if test "X$additional_includedir" != "X"; then
                                                                                                                 if test "X$additional_includedir" != "X/usr/include"; then
@@ -6049,9 +6112,11 @@
                 case "$dep" in
                   -L*)
                     additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'`
-                                                                                                                                                                if test "X$additional_libdir" != "X/usr/$acl_libdirstem"; then
+                                                                                                                                                                if test "X$additional_libdir" != "X/usr/$acl_libdirstem" \
+                       && test "X$additional_libdir" != "X/usr/$acl_libdirstem2"; then
                       haveit=
-                      if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem"; then
+                      if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem" \
+                         || test "X$additional_libdir" = "X/usr/local/$acl_libdirstem2"; then
                         if test -n "$GCC"; then
                           case $host_os in
                             linux* | gnu* | k*bsd*-gnu) haveit=yes;;
@@ -6183,6 +6248,11 @@
 
 
 
+
+
+
+
+
           am_save_CPPFLAGS="$CPPFLAGS"
 
   for element in $INCICONV; do
@@ -6307,6 +6377,25 @@
           return 1;
       }
   }
+  /* Test against Solaris 10 bug: Failures are not distinguishable from
+     successful returns.  */
+  {
+    iconv_t cd_ascii_to_88591 = iconv_open ("ISO8859-1", "646");
+    if (cd_ascii_to_88591 != (iconv_t)(-1))
+      {
+        static const char input[] = "\263";
+        char buf[10];
+        const char *inptr = input;
+        size_t inbytesleft = strlen (input);
+        char *outptr = buf;
+        size_t outbytesleft = sizeof (buf);
+        size_t res = iconv (cd_ascii_to_88591,
+                            (char **) &inptr, &inbytesleft,
+                            &outptr, &outbytesleft);
+        if (res == 0)
+          return 1;
+      }
+  }
 #if 0 /* This bug could be worked around by the caller.  */
   /* Test against HP-UX 11.11 bug: Positive return value instead of 0.  */
   {
@@ -6420,10 +6509,10 @@
 fi
 
     am_cv_proto_iconv=`echo "$am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'`
-    { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${ac_t:-
-         }$am_cv_proto_iconv" >&5
-$as_echo "${ac_t:-
-         }$am_cv_proto_iconv" >&6; }
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result:
+         $am_cv_proto_iconv" >&5
+$as_echo "
+         $am_cv_proto_iconv" >&6; }
 
 cat >>confdefs.h <<_ACEOF
 #define ICONV_CONST $am_cv_proto_iconv_arg1
Index: doc/examples/kannel.conf
===================================================================
--- doc/examples/kannel.conf	(revision 4974)
+++ doc/examples/kannel.conf	(working copy)
@@ -11,9 +11,9 @@
 #status-password = foo
 #admin-deny-ip = ""
 #admin-allow-ip = ""
-#log-file = "/tmp/kannel.log"
-#log-level = 0
-#access-log = "access.log"
+log-file = "/tmp/kannel.log"
+log-level = 0
+access-log = "access.log"
 #http-proxy-host = "127.0.0.1"
 #http-proxy-port = 8080
 #http-proxy-exceptions = "127.0.0.1"
@@ -22,9 +22,9 @@
 #ssl-certkey-file = "mycertandprivkeyfile.pem"
 
 # Smsbox related
-#smsbox-port = 13001
-#box-deny-ip = "*.*.*.*"
-#box-allow-ip = "127.0.0.1"
+smsbox-port=13001
+box-deny-ip = "*.*.*.*"
+box-allow-ip = "127.0.0.1"
 #unified-prefix = "00358,0"
 #white-list = "http://127.0.0.1/white-list.txt"
 #black-list = "http://127.0.0.1/black-list.txt"
@@ -38,9 +38,13 @@
 
 
 # SMSC CONNECTIONS - GLOBAL FIELDS
-#group = smsc
-#smsc = 
-#smsc-id = ID
+group = smsc
+smsc =  smpp
+smsc-id = SMPPSim
+smsc-username = isms
+smsc-password = isms
+host = localhost
+port = 2776
 #denied-smsc-id = "X;Y"
 #allowed-smsc-id = "Z"
 #preferred-smsc-id = "W"
Index: wmlscript/wsgram.c
===================================================================
--- wmlscript/wsgram.c	(revision 4974)
+++ wmlscript/wsgram.c	(working copy)
@@ -1,24 +1,23 @@
-/* A Bison parser, made by GNU Bison 2.3.  */
 
+/* A Bison parser, made by GNU Bison 2.4.1.  */
+
 /* Skeleton implementation for Bison's Yacc-like parsers in C
-
-   Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
+   
+      Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
    Free Software Foundation, Inc.
-
-   This program is free software; you can redistribute it and/or modify
+   
+   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.
-
+   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, write to the Free Software
-   Foundation, Inc., 51 Franklin Street, Fifth Floor,
-   Boston, MA 02110-1301, USA.  */
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 /* As a special exception, you may create a larger work that contains
    part or all of the Bison parser skeleton and distribute that work
@@ -29,7 +28,7 @@
    special exception, which will cause the skeleton and the resulting
    Bison output files to be licensed under the GNU General Public
    License without this special exception.
-
+   
    This special exception was added by the Free Software Foundation in
    version 2.2 of Bison.  */
 
@@ -47,7 +46,7 @@
 #define YYBISON 1
 
 /* Bison version.  */
-#define YYBISON_VERSION "2.3"
+#define YYBISON_VERSION "2.4.1"
 
 /* Skeleton name.  */
 #define YYSKELETON_NAME "yacc.c"
@@ -55,19 +54,82 @@
 /* Pure parsers.  */
 #define YYPURE 1
 
+/* Push parsers.  */
+#define YYPUSH 0
+
+/* Pull parsers.  */
+#define YYPULL 1
+
 /* Using locations.  */
 #define YYLSP_NEEDED 1
 
 /* Substitute the variable and function names.  */
-#define yyparse ws_yy_parse
-#define yylex   ws_yy_lex
-#define yyerror ws_yy_error
-#define yylval  ws_yy_lval
-#define yychar  ws_yy_char
-#define yydebug ws_yy_debug
-#define yynerrs ws_yy_nerrs
-#define yylloc ws_yy_lloc
+#define yyparse         ws_yy_parse
+#define yylex           ws_yy_lex
+#define yyerror         ws_yy_error
+#define yylval          ws_yy_lval
+#define yychar          ws_yy_char
+#define yydebug         ws_yy_debug
+#define yynerrs         ws_yy_nerrs
+#define yylloc          ws_yy_lloc
 
+/* Copy the first part of user declarations.  */
+
+/* Line 189 of yacc.c  */
+#line 1 "wmlscript/wsgram.y"
+
+/*
+ *
+ * wsgram.y
+ *
+ * Author: Markku Rossi <[email protected]>
+ *
+ * Copyright (c) 1999-2000 WAPIT OY LTD.
+ *		 All rights reserved.
+ *
+ * Bison grammar for the WMLScript compiler.
+ *
+ */
+
+#include "wmlscript/wsint.h"
+
+#define YYPARSE_PARAM	pctx
+#define YYLEX_PARAM	pctx
+
+/* The required yyerror() function.  This is actually not used but to
+   report the internal parser errors.  All other errors are reported
+   by using the `wserror.h' functions. */
+extern void yyerror(char *msg);
+
+#if WS_DEBUG
+/* Just for debugging purposes. */
+WsCompilerPtr global_compiler = NULL;
+#endif /* WS_DEBUG */
+
+
+
+/* Line 189 of yacc.c  */
+#line 113 "y.tab.c"
+
+/* Enabling traces.  */
+#ifndef YYDEBUG
+# define YYDEBUG 0
+#endif
+
+/* Enabling verbose error messages.  */
+#ifdef YYERROR_VERBOSE
+# undef YYERROR_VERBOSE
+# define YYERROR_VERBOSE 1
+#else
+# define YYERROR_VERBOSE 0
+#endif
+
+/* Enabling the token table.  */
+#ifndef YYTOKEN_TABLE
+# define YYTOKEN_TABLE 0
+#endif
+
+
 /* Tokens.  */
 #ifndef YYTOKENTYPE
 # define YYTOKENTYPE
@@ -247,61 +309,13 @@
 
 
 
-/* Copy the first part of user declarations.  */
-#line 1 "wmlscript/wsgram.y"
-
-/*
- *
- * wsgram.y
- *
- * Author: Markku Rossi <[email protected]>
- *
- * Copyright (c) 1999-2000 WAPIT OY LTD.
- *		 All rights reserved.
- *
- * Bison grammar for the WMLScript compiler.
- *
- */
-
-#include "wmlscript/wsint.h"
-
-#define YYPARSE_PARAM	pctx
-#define YYLEX_PARAM	pctx
-
-/* The required yyerror() function.  This is actually not used but to
-   report the internal parser errors.  All other errors are reported
-   by using the `wserror.h' functions. */
-extern void yyerror(char *msg);
-
-#if WS_DEBUG
-/* Just for debugging purposes. */
-WsCompilerPtr global_compiler = NULL;
-#endif /* WS_DEBUG */
-
-
-
-/* Enabling traces.  */
-#ifndef YYDEBUG
-# define YYDEBUG 0
-#endif
-
-/* Enabling verbose error messages.  */
-#ifdef YYERROR_VERBOSE
-# undef YYERROR_VERBOSE
-# define YYERROR_VERBOSE 1
-#else
-# define YYERROR_VERBOSE 0
-#endif
-
-/* Enabling the token table.  */
-#ifndef YYTOKEN_TABLE
-# define YYTOKEN_TABLE 0
-#endif
-
 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
 typedef union YYSTYPE
+{
+
+/* Line 214 of yacc.c  */
 #line 34 "wmlscript/wsgram.y"
-{
+
     WsUInt32 integer;
     WsFloat vfloat;
     char *identifier;
@@ -316,13 +330,15 @@
 
     WsStatement *stmt;
     WsExpression *expr;
-}
-/* Line 193 of yacc.c.  */
-#line 322 "y.tab.c"
-	YYSTYPE;
+
+
+
+/* Line 214 of yacc.c  */
+#line 338 "y.tab.c"
+} YYSTYPE;
+# define YYSTYPE_IS_TRIVIAL 1
 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
 # define YYSTYPE_IS_DECLARED 1
-# define YYSTYPE_IS_TRIVIAL 1
 #endif
 
 #if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED
@@ -342,8 +358,8 @@
 /* Copy the second part of user declarations.  */
 
 
-/* Line 216 of yacc.c.  */
-#line 347 "y.tab.c"
+/* Line 264 of yacc.c  */
+#line 363 "y.tab.c"
 
 #ifdef short
 # undef short
@@ -393,7 +409,7 @@
 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
 
 #ifndef YY_
-# if defined YYENABLE_NLS && YYENABLE_NLS
+# if YYENABLE_NLS
 #  if ENABLE_NLS
 #   include <libintl.h> /* INFRINGES ON USER NAME SPACE */
 #   define YY_(msgid) dgettext ("bison-runtime", msgid)
@@ -418,14 +434,14 @@
 #if (defined __STDC__ || defined __C99__FUNC__ \
      || defined __cplusplus || defined _MSC_VER)
 static int
-YYID (int i)
+YYID (int yyi)
 #else
 static int
-YYID (i)
-    int i;
+YYID (yyi)
+    int yyi;
 #endif
 {
-  return i;
+  return yyi;
 }
 #endif
 
@@ -507,9 +523,9 @@
 /* A type that is properly aligned for any stack member.  */
 union yyalloc
 {
-  yytype_int16 yyss;
-  YYSTYPE yyvs;
-    YYLTYPE yyls;
+  yytype_int16 yyss_alloc;
+  YYSTYPE yyvs_alloc;
+  YYLTYPE yyls_alloc;
 };
 
 /* The size of the maximum gap between one aligned stack and the next.  */
@@ -544,12 +560,12 @@
    elements in the stack, and YYPTR gives the new location of the
    stack.  Advance YYPTR to a properly aligned location for the next
    stack.  */
-# define YYSTACK_RELOCATE(Stack)					\
+# define YYSTACK_RELOCATE(Stack_alloc, Stack)				\
     do									\
       {									\
 	YYSIZE_T yynewbytes;						\
-	YYCOPY (&yyptr->Stack, Stack, yysize);				\
-	Stack = &yyptr->Stack;						\
+	YYCOPY (&yyptr->Stack_alloc, Stack, yysize);			\
+	Stack = &yyptr->Stack_alloc;					\
 	yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
 	yyptr += yynewbytes / sizeof (*yyptr);				\
       }									\
@@ -1105,7 +1121,7 @@
    we won't break user code: when these are the locations we know.  */
 
 #ifndef YY_LOCATION_PRINT
-# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
+# if YYLTYPE_IS_TRIVIAL
 #  define YY_LOCATION_PRINT(File, Loc)			\
      fprintf (File, "%d.%d-%d.%d",			\
 	      (Loc).first_line, (Loc).first_column,	\
@@ -1221,17 +1237,20 @@
 #if (defined __STDC__ || defined __C99__FUNC__ \
      || defined __cplusplus || defined _MSC_VER)
 static void
-yy_stack_print (yytype_int16 *bottom, yytype_int16 *top)
+yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
 #else
 static void
-yy_stack_print (bottom, top)
-    yytype_int16 *bottom;
-    yytype_int16 *top;
+yy_stack_print (yybottom, yytop)
+    yytype_int16 *yybottom;
+    yytype_int16 *yytop;
 #endif
 {
   YYFPRINTF (stderr, "Stack now");
-  for (; bottom <= top; ++bottom)
-    YYFPRINTF (stderr, " %d", *bottom);
+  for (; yybottom <= yytop; yybottom++)
+    {
+      int yybot = *yybottom;
+      YYFPRINTF (stderr, " %d", yybot);
+    }
   YYFPRINTF (stderr, "\n");
 }
 
@@ -1266,11 +1285,11 @@
   /* The symbols being reduced.  */
   for (yyi = 0; yyi < yynrhs; yyi++)
     {
-      fprintf (stderr, "   $%d = ", yyi + 1);
+      YYFPRINTF (stderr, "   $%d = ", yyi + 1);
       yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
 		       &(yyvsp[(yyi + 1) - (yynrhs)])
 		       , &(yylsp[(yyi + 1) - (yynrhs)])		       );
-      fprintf (stderr, "\n");
+      YYFPRINTF (stderr, "\n");
     }
 }
 
@@ -1552,10 +1571,8 @@
 	break;
     }
 }
-
 
 /* Prevent warnings from -Wmissing-prototypes.  */
-
 #ifdef YYPARSE_PARAM
 #if defined __STDC__ || defined __cplusplus
 int yyparse (void *YYPARSE_PARAM);
@@ -1574,11 +1591,10 @@
 
 
 
+/*-------------------------.
+| yyparse or yypush_parse.  |
+`-------------------------*/
 
-/*----------.
-| yyparse.  |
-`----------*/
-
 #ifdef YYPARSE_PARAM
 #if (defined __STDC__ || defined __C99__FUNC__ \
      || defined __cplusplus || defined _MSC_VER)
@@ -1601,88 +1617,97 @@
 #endif
 #endif
 {
-  /* The look-ahead symbol.  */
+/* The lookahead symbol.  */
 int yychar;
 
-/* The semantic value of the look-ahead symbol.  */
+/* The semantic value of the lookahead symbol.  */
 YYSTYPE yylval;
 
-/* Number of syntax errors so far.  */
-int yynerrs;
-/* Location data for the look-ahead symbol.  */
+/* Location data for the lookahead symbol.  */
 YYLTYPE yylloc;
 
-  int yystate;
-  int yyn;
-  int yyresult;
-  /* Number of tokens to shift before error messages enabled.  */
-  int yyerrstatus;
-  /* Look-ahead token as an internal (translated) token number.  */
-  int yytoken = 0;
-#if YYERROR_VERBOSE
-  /* Buffer for error messages, and its allocated size.  */
-  char yymsgbuf[128];
-  char *yymsg = yymsgbuf;
-  YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
-#endif
+    /* Number of syntax errors so far.  */
+    int yynerrs;
 
-  /* Three stacks and their tools:
-     `yyss': related to states,
-     `yyvs': related to semantic values,
-     `yyls': related to locations.
+    int yystate;
+    /* Number of tokens to shift before error messages enabled.  */
+    int yyerrstatus;
 
-     Refer to the stacks thru separate pointers, to allow yyoverflow
-     to reallocate them elsewhere.  */
+    /* The stacks and their tools:
+       `yyss': related to states.
+       `yyvs': related to semantic values.
+       `yyls': related to locations.
 
-  /* The state stack.  */
-  yytype_int16 yyssa[YYINITDEPTH];
-  yytype_int16 *yyss = yyssa;
-  yytype_int16 *yyssp;
+       Refer to the stacks thru separate pointers, to allow yyoverflow
+       to reallocate them elsewhere.  */
 
-  /* The semantic value stack.  */
-  YYSTYPE yyvsa[YYINITDEPTH];
-  YYSTYPE *yyvs = yyvsa;
-  YYSTYPE *yyvsp;
+    /* The state stack.  */
+    yytype_int16 yyssa[YYINITDEPTH];
+    yytype_int16 *yyss;
+    yytype_int16 *yyssp;
 
-  /* The location stack.  */
-  YYLTYPE yylsa[YYINITDEPTH];
-  YYLTYPE *yyls = yylsa;
-  YYLTYPE *yylsp;
-  /* The locations where the error started and ended.  */
-  YYLTYPE yyerror_range[2];
+    /* The semantic value stack.  */
+    YYSTYPE yyvsa[YYINITDEPTH];
+    YYSTYPE *yyvs;
+    YYSTYPE *yyvsp;
 
-#define YYPOPSTACK(N)   (yyvsp -= (N), yyssp -= (N), yylsp -= (N))
+    /* The location stack.  */
+    YYLTYPE yylsa[YYINITDEPTH];
+    YYLTYPE *yyls;
+    YYLTYPE *yylsp;
 
-  YYSIZE_T yystacksize = YYINITDEPTH;
+    /* The locations where the error started and ended.  */
+    YYLTYPE yyerror_range[2];
 
+    YYSIZE_T yystacksize;
+
+  int yyn;
+  int yyresult;
+  /* Lookahead token as an internal (translated) token number.  */
+  int yytoken;
   /* The variables used to return semantic value and location from the
      action routines.  */
   YYSTYPE yyval;
   YYLTYPE yyloc;
 
+#if YYERROR_VERBOSE
+  /* Buffer for error messages, and its allocated size.  */
+  char yymsgbuf[128];
+  char *yymsg = yymsgbuf;
+  YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
+#endif
+
+#define YYPOPSTACK(N)   (yyvsp -= (N), yyssp -= (N), yylsp -= (N))
+
   /* The number of symbols on the RHS of the reduced rule.
      Keep to zero when no symbol should be popped.  */
   int yylen = 0;
 
+  yytoken = 0;
+  yyss = yyssa;
+  yyvs = yyvsa;
+  yyls = yylsa;
+  yystacksize = YYINITDEPTH;
+
   YYDPRINTF ((stderr, "Starting parse\n"));
 
   yystate = 0;
   yyerrstatus = 0;
   yynerrs = 0;
-  yychar = YYEMPTY;		/* Cause a token to be read.  */
+  yychar = YYEMPTY; /* Cause a token to be read.  */
 
   /* Initialize stack pointers.
      Waste one element of value and location stack
      so that they stay on the same level as the state stack.
      The wasted elements are never initialized.  */
-
   yyssp = yyss;
   yyvsp = yyvs;
   yylsp = yyls;
-#if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
+
+#if YYLTYPE_IS_TRIVIAL
   /* Initialize the default location before parsing starts.  */
   yylloc.first_line   = yylloc.last_line   = 1;
-  yylloc.first_column = yylloc.last_column = 0;
+  yylloc.first_column = yylloc.last_column = 1;
 #endif
 
   goto yysetstate;
@@ -1721,6 +1746,7 @@
 		    &yyvs1, yysize * sizeof (*yyvsp),
 		    &yyls1, yysize * sizeof (*yylsp),
 		    &yystacksize);
+
 	yyls = yyls1;
 	yyss = yyss1;
 	yyvs = yyvs1;
@@ -1742,9 +1768,9 @@
 	  (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
 	if (! yyptr)
 	  goto yyexhaustedlab;
-	YYSTACK_RELOCATE (yyss);
-	YYSTACK_RELOCATE (yyvs);
-	YYSTACK_RELOCATE (yyls);
+	YYSTACK_RELOCATE (yyss_alloc, yyss);
+	YYSTACK_RELOCATE (yyvs_alloc, yyvs);
+	YYSTACK_RELOCATE (yyls_alloc, yyls);
 #  undef YYSTACK_RELOCATE
 	if (yyss1 != yyssa)
 	  YYSTACK_FREE (yyss1);
@@ -1765,6 +1791,9 @@
 
   YYDPRINTF ((stderr, "Entering state %d\n", yystate));
 
+  if (yystate == YYFINAL)
+    YYACCEPT;
+
   goto yybackup;
 
 /*-----------.
@@ -1773,16 +1802,16 @@
 yybackup:
 
   /* Do appropriate processing given the current state.  Read a
-     look-ahead token if we need one and don't already have one.  */
+     lookahead token if we need one and don't already have one.  */
 
-  /* First try to decide what to do without reference to look-ahead token.  */
+  /* First try to decide what to do without reference to lookahead token.  */
   yyn = yypact[yystate];
   if (yyn == YYPACT_NINF)
     goto yydefault;
 
-  /* Not known => get a look-ahead token if don't already have one.  */
+  /* Not known => get a lookahead token if don't already have one.  */
 
-  /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol.  */
+  /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol.  */
   if (yychar == YYEMPTY)
     {
       YYDPRINTF ((stderr, "Reading a token: "));
@@ -1814,20 +1843,16 @@
       goto yyreduce;
     }
 
-  if (yyn == YYFINAL)
-    YYACCEPT;
-
   /* Count tokens shifted since error; after three, turn off error
      status.  */
   if (yyerrstatus)
     yyerrstatus--;
 
-  /* Shift the look-ahead token.  */
+  /* Shift the lookahead token.  */
   YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
 
-  /* Discard the shifted token unless it is eof.  */
-  if (yychar != YYEOF)
-    yychar = YYEMPTY;
+  /* Discard the shifted token.  */
+  yychar = YYEMPTY;
 
   yystate = yyn;
   *++yyvsp = yylval;
@@ -1868,21 +1893,29 @@
   switch (yyn)
     {
         case 4:
+
+/* Line 1455 of yacc.c  */
 #line 125 "wmlscript/wsgram.y"
     { ws_error_syntax(pctx, (yylsp[(1) - (1)]).first_line); }
     break;
 
   case 8:
+
+/* Line 1455 of yacc.c  */
 #line 138 "wmlscript/wsgram.y"
     { ws_error_syntax(pctx, (yylsp[(1) - (1)]).first_line); }
     break;
 
   case 12:
+
+/* Line 1455 of yacc.c  */
 #line 149 "wmlscript/wsgram.y"
     { ws_pragma_use(pctx, (yylsp[(2) - (3)]).first_line, (yyvsp[(2) - (3)].identifier), (yyvsp[(3) - (3)].string)); }
     break;
 
   case 14:
+
+/* Line 1455 of yacc.c  */
 #line 158 "wmlscript/wsgram.y"
     {
 		    WsCompiler *compiler = (WsCompiler *) pctx;
@@ -1896,6 +1929,8 @@
     break;
 
   case 15:
+
+/* Line 1455 of yacc.c  */
 #line 168 "wmlscript/wsgram.y"
     {
 		    WsCompiler *compiler = (WsCompiler *) pctx;
@@ -1910,6 +1945,8 @@
     break;
 
   case 16:
+
+/* Line 1455 of yacc.c  */
 #line 179 "wmlscript/wsgram.y"
     {
 		    WsCompiler *compiler = (WsCompiler *) pctx;
@@ -1933,6 +1970,8 @@
     break;
 
   case 21:
+
+/* Line 1455 of yacc.c  */
 #line 212 "wmlscript/wsgram.y"
     {
 		    WsCompiler *compiler = (WsCompiler *) pctx;
@@ -1951,6 +1990,8 @@
     break;
 
   case 22:
+
+/* Line 1455 of yacc.c  */
 #line 230 "wmlscript/wsgram.y"
     {
 		    WsCompiler *compiler = (WsCompiler *) pctx;
@@ -1971,6 +2012,8 @@
     break;
 
   case 23:
+
+/* Line 1455 of yacc.c  */
 #line 250 "wmlscript/wsgram.y"
     {
 		    WsBool success;
@@ -2006,16 +2049,22 @@
     break;
 
   case 24:
+
+/* Line 1455 of yacc.c  */
 #line 285 "wmlscript/wsgram.y"
     { (yyval.meta_body) = ws_pragma_meta_body(pctx, (yyvsp[(1) - (2)].string), (yyvsp[(2) - (2)].string), NULL); }
     break;
 
   case 25:
+
+/* Line 1455 of yacc.c  */
 #line 287 "wmlscript/wsgram.y"
     { (yyval.meta_body) = ws_pragma_meta_body(pctx, (yyvsp[(1) - (3)].string), (yyvsp[(2) - (3)].string), (yyvsp[(3) - (3)].string)); }
     break;
 
   case 31:
+
+/* Line 1455 of yacc.c  */
 #line 304 "wmlscript/wsgram.y"
     {
 		    char *name = ws_strdup((yyvsp[(3) - (8)].identifier));
@@ -2030,21 +2079,29 @@
     break;
 
   case 32:
+
+/* Line 1455 of yacc.c  */
 #line 317 "wmlscript/wsgram.y"
     { (yyval.boolean) = WS_FALSE; }
     break;
 
   case 33:
+
+/* Line 1455 of yacc.c  */
 #line 318 "wmlscript/wsgram.y"
     { (yyval.boolean) = WS_TRUE;  }
     break;
 
   case 34:
+
+/* Line 1455 of yacc.c  */
 #line 323 "wmlscript/wsgram.y"
     { (yyval.list) = ws_list_new(pctx); }
     break;
 
   case 38:
+
+/* Line 1455 of yacc.c  */
 #line 334 "wmlscript/wsgram.y"
     {
                     char *id;
@@ -2066,6 +2123,8 @@
     break;
 
   case 39:
+
+/* Line 1455 of yacc.c  */
 #line 352 "wmlscript/wsgram.y"
     {
                     char *id;
@@ -2085,6 +2144,8 @@
     break;
 
   case 40:
+
+/* Line 1455 of yacc.c  */
 #line 373 "wmlscript/wsgram.y"
     {
 		    if ((yyvsp[(1) - (1)].list))
@@ -2096,26 +2157,36 @@
     break;
 
   case 42:
+
+/* Line 1455 of yacc.c  */
 #line 382 "wmlscript/wsgram.y"
     { (yyval.stmt) = ws_stmt_empty(pctx, (yylsp[(1) - (1)]).first_line); }
     break;
 
   case 43:
+
+/* Line 1455 of yacc.c  */
 #line 384 "wmlscript/wsgram.y"
     { (yyval.stmt) = ws_stmt_expr(pctx, (yyvsp[(1) - (2)].expr)->line, (yyvsp[(1) - (2)].expr)); }
     break;
 
   case 46:
+
+/* Line 1455 of yacc.c  */
 #line 388 "wmlscript/wsgram.y"
     { (yyval.stmt) = ws_stmt_continue(pctx, (yylsp[(1) - (2)]).first_line); }
     break;
 
   case 47:
+
+/* Line 1455 of yacc.c  */
 #line 390 "wmlscript/wsgram.y"
     { (yyval.stmt) = ws_stmt_break(pctx, (yylsp[(1) - (2)]).first_line); }
     break;
 
   case 49:
+
+/* Line 1455 of yacc.c  */
 #line 395 "wmlscript/wsgram.y"
     {
 		    (yyval.list) = (yyvsp[(2) - (3)].list);
@@ -2127,6 +2198,8 @@
     break;
 
   case 50:
+
+/* Line 1455 of yacc.c  */
 #line 403 "wmlscript/wsgram.y"
     {
 		    ws_error_syntax(pctx, (yylsp[(1) - (1)]).first_line);
@@ -2135,11 +2208,15 @@
     break;
 
   case 51:
+
+/* Line 1455 of yacc.c  */
 #line 411 "wmlscript/wsgram.y"
     { (yyval.list) = ws_list_new(pctx); }
     break;
 
   case 53:
+
+/* Line 1455 of yacc.c  */
 #line 417 "wmlscript/wsgram.y"
     {
 		    (yyval.list) = ws_list_new(pctx);
@@ -2148,21 +2225,29 @@
     break;
 
   case 54:
+
+/* Line 1455 of yacc.c  */
 #line 422 "wmlscript/wsgram.y"
     { ws_list_append(pctx, (yyvsp[(1) - (2)].list), (yyvsp[(2) - (2)].stmt)); }
     break;
 
   case 55:
+
+/* Line 1455 of yacc.c  */
 #line 427 "wmlscript/wsgram.y"
     { (yyval.stmt) = ws_stmt_variable(pctx, (yylsp[(1) - (3)]).first_line, (yyvsp[(2) - (3)].list)); }
     break;
 
   case 56:
+
+/* Line 1455 of yacc.c  */
 #line 429 "wmlscript/wsgram.y"
     { ws_error_syntax(pctx, (yylsp[(2) - (2)]).first_line); }
     break;
 
   case 57:
+
+/* Line 1455 of yacc.c  */
 #line 434 "wmlscript/wsgram.y"
     {
 		    (yyval.list) = ws_list_new(pctx);
@@ -2171,11 +2256,15 @@
     break;
 
   case 58:
+
+/* Line 1455 of yacc.c  */
 #line 439 "wmlscript/wsgram.y"
     { ws_list_append(pctx, (yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].vardec)); }
     break;
 
   case 59:
+
+/* Line 1455 of yacc.c  */
 #line 444 "wmlscript/wsgram.y"
     {
 		    char *id = ws_f_strdup(((WsCompiler *) pctx)->pool_stree,
@@ -2191,246 +2280,344 @@
     break;
 
   case 60:
+
+/* Line 1455 of yacc.c  */
 #line 459 "wmlscript/wsgram.y"
     { (yyval.expr) = NULL; }
     break;
 
   case 61:
+
+/* Line 1455 of yacc.c  */
 #line 461 "wmlscript/wsgram.y"
     { (yyval.expr) = (yyvsp[(2) - (2)].expr); }
     break;
 
   case 62:
+
+/* Line 1455 of yacc.c  */
 #line 466 "wmlscript/wsgram.y"
     { (yyval.stmt) = ws_stmt_if(pctx, (yylsp[(1) - (7)]).first_line, (yyvsp[(3) - (7)].expr), (yyvsp[(5) - (7)].stmt), (yyvsp[(7) - (7)].stmt)); }
     break;
 
   case 63:
+
+/* Line 1455 of yacc.c  */
 #line 468 "wmlscript/wsgram.y"
     { (yyval.stmt) = ws_stmt_if(pctx, (yylsp[(1) - (5)]).first_line, (yyvsp[(3) - (5)].expr), (yyvsp[(5) - (5)].stmt), NULL); }
     break;
 
   case 64:
+
+/* Line 1455 of yacc.c  */
 #line 473 "wmlscript/wsgram.y"
     { (yyval.stmt) = ws_stmt_while(pctx, (yylsp[(1) - (5)]).first_line, (yyvsp[(3) - (5)].expr), (yyvsp[(5) - (5)].stmt)); }
     break;
 
   case 66:
+
+/* Line 1455 of yacc.c  */
 #line 480 "wmlscript/wsgram.y"
     { (yyval.stmt) = ws_stmt_for(pctx, (yylsp[(1) - (9)]).first_line, NULL, (yyvsp[(3) - (9)].expr), (yyvsp[(5) - (9)].expr), (yyvsp[(7) - (9)].expr), (yyvsp[(9) - (9)].stmt)); }
     break;
 
   case 67:
+
+/* Line 1455 of yacc.c  */
 #line 483 "wmlscript/wsgram.y"
     { (yyval.stmt) = ws_stmt_for(pctx, (yylsp[(1) - (10)]).first_line, (yyvsp[(4) - (10)].list), NULL, (yyvsp[(6) - (10)].expr), (yyvsp[(8) - (10)].expr), (yyvsp[(10) - (10)].stmt)); }
     break;
 
   case 68:
+
+/* Line 1455 of yacc.c  */
 #line 488 "wmlscript/wsgram.y"
     { (yyval.stmt) = ws_stmt_return(pctx, (yylsp[(1) - (3)]).first_line, (yyvsp[(2) - (3)].expr)); }
     break;
 
   case 69:
+
+/* Line 1455 of yacc.c  */
 #line 494 "wmlscript/wsgram.y"
     { (yyval.expr) = NULL; }
     break;
 
   case 72:
+
+/* Line 1455 of yacc.c  */
 #line 502 "wmlscript/wsgram.y"
     { (yyval.expr) = ws_expr_comma(pctx, (yylsp[(2) - (3)]).first_line, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); }
     break;
 
   case 74:
+
+/* Line 1455 of yacc.c  */
 #line 508 "wmlscript/wsgram.y"
     { (yyval.expr) = ws_expr_assign(pctx, (yylsp[(1) - (3)]).first_line, (yyvsp[(1) - (3)].identifier), '=', (yyvsp[(3) - (3)].expr)); }
     break;
 
   case 75:
+
+/* Line 1455 of yacc.c  */
 #line 510 "wmlscript/wsgram.y"
     { (yyval.expr) = ws_expr_assign(pctx, (yylsp[(1) - (3)]).first_line, (yyvsp[(1) - (3)].identifier), tMULA, (yyvsp[(3) - (3)].expr)); }
     break;
 
   case 76:
+
+/* Line 1455 of yacc.c  */
 #line 512 "wmlscript/wsgram.y"
     { (yyval.expr) = ws_expr_assign(pctx, (yylsp[(1) - (3)]).first_line, (yyvsp[(1) - (3)].identifier), tDIVA, (yyvsp[(3) - (3)].expr)); }
     break;
 
   case 77:
+
+/* Line 1455 of yacc.c  */
 #line 514 "wmlscript/wsgram.y"
     { (yyval.expr) = ws_expr_assign(pctx, (yylsp[(1) - (3)]).first_line, (yyvsp[(1) - (3)].identifier), tREMA, (yyvsp[(3) - (3)].expr)); }
     break;
 
   case 78:
+
+/* Line 1455 of yacc.c  */
 #line 516 "wmlscript/wsgram.y"
     { (yyval.expr) = ws_expr_assign(pctx, (yylsp[(1) - (3)]).first_line, (yyvsp[(1) - (3)].identifier), tADDA, (yyvsp[(3) - (3)].expr)); }
     break;
 
   case 79:
+
+/* Line 1455 of yacc.c  */
 #line 518 "wmlscript/wsgram.y"
     { (yyval.expr) = ws_expr_assign(pctx, (yylsp[(1) - (3)]).first_line, (yyvsp[(1) - (3)].identifier), tSUBA, (yyvsp[(3) - (3)].expr)); }
     break;
 
   case 80:
+
+/* Line 1455 of yacc.c  */
 #line 520 "wmlscript/wsgram.y"
     { (yyval.expr) = ws_expr_assign(pctx, (yylsp[(1) - (3)]).first_line, (yyvsp[(1) - (3)].identifier), tLSHIFTA, (yyvsp[(3) - (3)].expr)); }
     break;
 
   case 81:
+
+/* Line 1455 of yacc.c  */
 #line 522 "wmlscript/wsgram.y"
     { (yyval.expr) = ws_expr_assign(pctx, (yylsp[(1) - (3)]).first_line, (yyvsp[(1) - (3)].identifier), tRSSHIFTA, (yyvsp[(3) - (3)].expr)); }
     break;
 
   case 82:
+
+/* Line 1455 of yacc.c  */
 #line 524 "wmlscript/wsgram.y"
     { (yyval.expr) = ws_expr_assign(pctx, (yylsp[(1) - (3)]).first_line, (yyvsp[(1) - (3)].identifier), tRSZSHIFTA, (yyvsp[(3) - (3)].expr)); }
     break;
 
   case 83:
+
+/* Line 1455 of yacc.c  */
 #line 526 "wmlscript/wsgram.y"
     { (yyval.expr) = ws_expr_assign(pctx, (yylsp[(1) - (3)]).first_line, (yyvsp[(1) - (3)].identifier), tANDA, (yyvsp[(3) - (3)].expr)); }
     break;
 
   case 84:
+
+/* Line 1455 of yacc.c  */
 #line 528 "wmlscript/wsgram.y"
     { (yyval.expr) = ws_expr_assign(pctx, (yylsp[(1) - (3)]).first_line, (yyvsp[(1) - (3)].identifier), tXORA, (yyvsp[(3) - (3)].expr)); }
     break;
 
   case 85:
+
+/* Line 1455 of yacc.c  */
 #line 530 "wmlscript/wsgram.y"
     { (yyval.expr) = ws_expr_assign(pctx, (yylsp[(1) - (3)]).first_line, (yyvsp[(1) - (3)].identifier), tORA, (yyvsp[(3) - (3)].expr)); }
     break;
 
   case 86:
+
+/* Line 1455 of yacc.c  */
 #line 532 "wmlscript/wsgram.y"
     { (yyval.expr) = ws_expr_assign(pctx, (yylsp[(1) - (3)]).first_line, (yyvsp[(1) - (3)].identifier), tIDIVA, (yyvsp[(3) - (3)].expr)); }
     break;
 
   case 88:
+
+/* Line 1455 of yacc.c  */
 #line 538 "wmlscript/wsgram.y"
     { (yyval.expr) = ws_expr_conditional(pctx, (yylsp[(2) - (5)]).first_line, (yyvsp[(1) - (5)].expr), (yyvsp[(3) - (5)].expr), (yyvsp[(5) - (5)].expr)); }
     break;
 
   case 90:
+
+/* Line 1455 of yacc.c  */
 #line 544 "wmlscript/wsgram.y"
     { (yyval.expr) = ws_expr_logical(pctx, (yylsp[(2) - (3)]).first_line, WS_ASM_SCOR, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); }
     break;
 
   case 92:
+
+/* Line 1455 of yacc.c  */
 #line 550 "wmlscript/wsgram.y"
     { (yyval.expr) = ws_expr_logical(pctx, (yylsp[(2) - (3)]).first_line, WS_ASM_SCAND, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); }
     break;
 
   case 94:
+
+/* Line 1455 of yacc.c  */
 #line 556 "wmlscript/wsgram.y"
     { (yyval.expr) = ws_expr_binary(pctx, (yylsp[(2) - (3)]).first_line, WS_ASM_B_OR, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); }
     break;
 
   case 96:
+
+/* Line 1455 of yacc.c  */
 #line 562 "wmlscript/wsgram.y"
     { (yyval.expr) = ws_expr_binary(pctx, (yylsp[(2) - (3)]).first_line, WS_ASM_B_XOR, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); }
     break;
 
   case 98:
+
+/* Line 1455 of yacc.c  */
 #line 568 "wmlscript/wsgram.y"
     { (yyval.expr) = ws_expr_binary(pctx, (yylsp[(2) - (3)]).first_line, WS_ASM_B_AND, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); }
     break;
 
   case 100:
+
+/* Line 1455 of yacc.c  */
 #line 574 "wmlscript/wsgram.y"
     { (yyval.expr) = ws_expr_binary(pctx, (yylsp[(2) - (3)]).first_line, WS_ASM_EQ, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); }
     break;
 
   case 101:
+
+/* Line 1455 of yacc.c  */
 #line 576 "wmlscript/wsgram.y"
     { (yyval.expr) = ws_expr_binary(pctx, (yylsp[(2) - (3)]).first_line, WS_ASM_NE, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); }
     break;
 
   case 103:
+
+/* Line 1455 of yacc.c  */
 #line 582 "wmlscript/wsgram.y"
     { (yyval.expr) = ws_expr_binary(pctx, (yylsp[(2) - (3)]).first_line, WS_ASM_LT, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); }
     break;
 
   case 104:
+
+/* Line 1455 of yacc.c  */
 #line 584 "wmlscript/wsgram.y"
     { (yyval.expr) = ws_expr_binary(pctx, (yylsp[(2) - (3)]).first_line, WS_ASM_GT, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); }
     break;
 
   case 105:
+
+/* Line 1455 of yacc.c  */
 #line 586 "wmlscript/wsgram.y"
     { (yyval.expr) = ws_expr_binary(pctx, (yylsp[(2) - (3)]).first_line, WS_ASM_LE, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); }
     break;
 
   case 106:
+
+/* Line 1455 of yacc.c  */
 #line 588 "wmlscript/wsgram.y"
     { (yyval.expr) = ws_expr_binary(pctx, (yylsp[(2) - (3)]).first_line, WS_ASM_GE, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); }
     break;
 
   case 108:
+
+/* Line 1455 of yacc.c  */
 #line 594 "wmlscript/wsgram.y"
     { (yyval.expr) = ws_expr_binary(pctx, (yylsp[(2) - (3)]).first_line, WS_ASM_B_LSHIFT, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); }
     break;
 
   case 109:
+
+/* Line 1455 of yacc.c  */
 #line 596 "wmlscript/wsgram.y"
     { (yyval.expr) = ws_expr_binary(pctx, (yylsp[(2) - (3)]).first_line, WS_ASM_B_RSSHIFT, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); }
     break;
 
   case 110:
+
+/* Line 1455 of yacc.c  */
 #line 598 "wmlscript/wsgram.y"
     { (yyval.expr) = ws_expr_binary(pctx, (yylsp[(2) - (3)]).first_line, WS_ASM_B_RSZSHIFT, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); }
     break;
 
   case 112:
+
+/* Line 1455 of yacc.c  */
 #line 604 "wmlscript/wsgram.y"
     { (yyval.expr) = ws_expr_binary(pctx, (yylsp[(2) - (3)]).first_line, WS_ASM_ADD, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); }
     break;
 
   case 113:
+
+/* Line 1455 of yacc.c  */
 #line 606 "wmlscript/wsgram.y"
     { (yyval.expr) = ws_expr_binary(pctx, (yylsp[(2) - (3)]).first_line, WS_ASM_SUB, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); }
     break;
 
   case 115:
+
+/* Line 1455 of yacc.c  */
 #line 612 "wmlscript/wsgram.y"
     { (yyval.expr) = ws_expr_binary(pctx, (yylsp[(2) - (3)]).first_line, WS_ASM_MUL, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); }
     break;
 
   case 116:
+
+/* Line 1455 of yacc.c  */
 #line 614 "wmlscript/wsgram.y"
     { (yyval.expr) = ws_expr_binary(pctx, (yylsp[(2) - (3)]).first_line, WS_ASM_DIV, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); }
     break;
 
   case 117:
+
+/* Line 1455 of yacc.c  */
 #line 616 "wmlscript/wsgram.y"
     { (yyval.expr) = ws_expr_binary(pctx, (yylsp[(2) - (3)]).first_line, WS_ASM_IDIV, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); }
     break;
 
   case 118:
+
+/* Line 1455 of yacc.c  */
 #line 618 "wmlscript/wsgram.y"
     { (yyval.expr) = ws_expr_binary(pctx, (yylsp[(2) - (3)]).first_line, WS_ASM_REM, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); }
     break;
 
   case 120:
+
+/* Line 1455 of yacc.c  */
 #line 624 "wmlscript/wsgram.y"
     { (yyval.expr) = ws_expr_unary(pctx, (yylsp[(1) - (2)]).first_line, WS_ASM_TYPEOF, (yyvsp[(2) - (2)].expr)); }
     break;
 
   case 121:
+
+/* Line 1455 of yacc.c  */
 #line 626 "wmlscript/wsgram.y"
     { (yyval.expr) = ws_expr_unary(pctx, (yylsp[(1) - (2)]).first_line, WS_ASM_ISVALID, (yyvsp[(2) - (2)].expr)); }
     break;
 
   case 122:
+
+/* Line 1455 of yacc.c  */
 #line 628 "wmlscript/wsgram.y"
     { (yyval.expr) = ws_expr_unary_var(pctx, (yylsp[(1) - (2)]).first_line, WS_TRUE, (yyvsp[(2) - (2)].identifier)); }
     break;
 
   case 123:
+
+/* Line 1455 of yacc.c  */
 #line 630 "wmlscript/wsgram.y"
     { (yyval.expr) = ws_expr_unary_var(pctx, (yylsp[(1) - (2)]).first_line, WS_FALSE, (yyvsp[(2) - (2)].identifier)); }
     break;
 
   case 124:
+
+/* Line 1455 of yacc.c  */
 #line 632 "wmlscript/wsgram.y"
     {
                     /* There is no direct way to compile unary `+'.
@@ -2450,31 +2637,43 @@
     break;
 
   case 125:
+
+/* Line 1455 of yacc.c  */
 #line 648 "wmlscript/wsgram.y"
     { (yyval.expr) = ws_expr_unary(pctx, (yylsp[(1) - (2)]).first_line, WS_ASM_UMINUS, (yyvsp[(2) - (2)].expr)); }
     break;
 
   case 126:
+
+/* Line 1455 of yacc.c  */
 #line 650 "wmlscript/wsgram.y"
     { (yyval.expr) = ws_expr_unary(pctx, (yylsp[(1) - (2)]).first_line, WS_ASM_B_NOT, (yyvsp[(2) - (2)].expr)); }
     break;
 
   case 127:
+
+/* Line 1455 of yacc.c  */
 #line 652 "wmlscript/wsgram.y"
     { (yyval.expr) = ws_expr_unary(pctx, (yylsp[(1) - (2)]).first_line, WS_ASM_NOT, (yyvsp[(2) - (2)].expr)); }
     break;
 
   case 129:
+
+/* Line 1455 of yacc.c  */
 #line 658 "wmlscript/wsgram.y"
     { (yyval.expr) = ws_expr_postfix_var(pctx, (yylsp[(1) - (2)]).first_line, WS_TRUE, (yyvsp[(1) - (2)].identifier)); }
     break;
 
   case 130:
+
+/* Line 1455 of yacc.c  */
 #line 660 "wmlscript/wsgram.y"
     { (yyval.expr) = ws_expr_postfix_var(pctx, (yylsp[(1) - (2)]).first_line, WS_FALSE, (yyvsp[(1) - (2)].identifier)); }
     break;
 
   case 132:
+
+/* Line 1455 of yacc.c  */
 #line 666 "wmlscript/wsgram.y"
     {
 		    WsFunctionHash *f = ws_function_hash(pctx, (yyvsp[(1) - (2)].identifier));
@@ -2488,66 +2687,92 @@
     break;
 
   case 133:
+
+/* Line 1455 of yacc.c  */
 #line 676 "wmlscript/wsgram.y"
     { (yyval.expr) = ws_expr_call(pctx, (yylsp[(3) - (4)]).first_line, '#', (yyvsp[(1) - (4)].identifier), (yyvsp[(3) - (4)].identifier), (yyvsp[(4) - (4)].list)); }
     break;
 
   case 134:
+
+/* Line 1455 of yacc.c  */
 #line 678 "wmlscript/wsgram.y"
     { (yyval.expr) = ws_expr_call(pctx, (yylsp[(3) - (4)]).first_line, '.', (yyvsp[(1) - (4)].identifier), (yyvsp[(3) - (4)].identifier), (yyvsp[(4) - (4)].list)); }
     break;
 
   case 135:
+
+/* Line 1455 of yacc.c  */
 #line 683 "wmlscript/wsgram.y"
     { (yyval.expr) = ws_expr_symbol(pctx, (yylsp[(1) - (1)]).first_line, (yyvsp[(1) - (1)].identifier)); }
     break;
 
   case 136:
+
+/* Line 1455 of yacc.c  */
 #line 685 "wmlscript/wsgram.y"
     { (yyval.expr) = ws_expr_const_invalid(pctx, (yylsp[(1) - (1)]).first_line); }
     break;
 
   case 137:
+
+/* Line 1455 of yacc.c  */
 #line 687 "wmlscript/wsgram.y"
     { (yyval.expr) = ws_expr_const_true(pctx, (yylsp[(1) - (1)]).first_line); }
     break;
 
   case 138:
+
+/* Line 1455 of yacc.c  */
 #line 689 "wmlscript/wsgram.y"
     { (yyval.expr) = ws_expr_const_false(pctx, (yylsp[(1) - (1)]).first_line); }
     break;
 
   case 139:
+
+/* Line 1455 of yacc.c  */
 #line 691 "wmlscript/wsgram.y"
     { (yyval.expr) = ws_expr_const_integer(pctx, (yylsp[(1) - (1)]).first_line, (yyvsp[(1) - (1)].integer)); }
     break;
 
   case 140:
+
+/* Line 1455 of yacc.c  */
 #line 693 "wmlscript/wsgram.y"
     { (yyval.expr) = ws_expr_const_float(pctx, (yylsp[(1) - (1)]).first_line, (yyvsp[(1) - (1)].vfloat)); }
     break;
 
   case 141:
+
+/* Line 1455 of yacc.c  */
 #line 695 "wmlscript/wsgram.y"
     { (yyval.expr) = ws_expr_const_string(pctx, (yylsp[(1) - (1)]).first_line, (yyvsp[(1) - (1)].string)); }
     break;
 
   case 142:
+
+/* Line 1455 of yacc.c  */
 #line 697 "wmlscript/wsgram.y"
     { (yyval.expr) = (yyvsp[(2) - (3)].expr); }
     break;
 
   case 143:
+
+/* Line 1455 of yacc.c  */
 #line 702 "wmlscript/wsgram.y"
     { (yyval.list) = ws_list_new(pctx); }
     break;
 
   case 144:
+
+/* Line 1455 of yacc.c  */
 #line 704 "wmlscript/wsgram.y"
     { (yyval.list) = (yyvsp[(2) - (3)].list); }
     break;
 
   case 145:
+
+/* Line 1455 of yacc.c  */
 #line 709 "wmlscript/wsgram.y"
     {
 		    (yyval.list) = ws_list_new(pctx);
@@ -2556,13 +2781,16 @@
     break;
 
   case 146:
+
+/* Line 1455 of yacc.c  */
 #line 714 "wmlscript/wsgram.y"
     { ws_list_append(pctx, (yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].expr)); }
     break;
 
 
-/* Line 1267 of yacc.c.  */
-#line 2566 "y.tab.c"
+
+/* Line 1455 of yacc.c  */
+#line 2794 "y.tab.c"
       default: break;
     }
   YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
@@ -2638,7 +2866,7 @@
 
   if (yyerrstatus == 3)
     {
-      /* If just tried and failed to reuse look-ahead token after an
+      /* If just tried and failed to reuse lookahead token after an
 	 error, discard it.  */
 
       if (yychar <= YYEOF)
@@ -2655,7 +2883,7 @@
 	}
     }
 
-  /* Else will try to reuse look-ahead token after shifting the error
+  /* Else will try to reuse lookahead token after shifting the error
      token.  */
   goto yyerrlab1;
 
@@ -2713,14 +2941,11 @@
       YY_STACK_PRINT (yyss, yyssp);
     }
 
-  if (yyn == YYFINAL)
-    YYACCEPT;
-
   *++yyvsp = yylval;
 
   yyerror_range[1] = yylloc;
   /* Using YYLLOC is tempting, but would change the location of
-     the look-ahead.  YYLOC is available though.  */
+     the lookahead.  YYLOC is available though.  */
   YYLLOC_DEFAULT (yyloc, (yyerror_range - 1), 2);
   *++yylsp = yyloc;
 
@@ -2745,7 +2970,7 @@
   yyresult = 1;
   goto yyreturn;
 
-#ifndef yyoverflow
+#if !defined(yyoverflow) || YYERROR_VERBOSE
 /*-------------------------------------------------.
 | yyexhaustedlab -- memory exhaustion comes here.  |
 `-------------------------------------------------*/
@@ -2756,7 +2981,7 @@
 #endif
 
 yyreturn:
-  if (yychar != YYEOF && yychar != YYEMPTY)
+  if (yychar != YYEMPTY)
      yydestruct ("Cleanup: discarding lookahead",
 		 yytoken, &yylval, &yylloc);
   /* Do not reclaim the symbols of the rule which action triggered
@@ -2782,6 +3007,8 @@
 }
 
 
+
+/* Line 1675 of yacc.c  */
 #line 717 "wmlscript/wsgram.y"
 
 
Index: wmlscript/wsgram.h
===================================================================
--- wmlscript/wsgram.h	(revision 4974)
+++ wmlscript/wsgram.h	(working copy)
@@ -1,24 +1,23 @@
-/* A Bison parser, made by GNU Bison 2.3.  */
 
+/* A Bison parser, made by GNU Bison 2.4.1.  */
+
 /* Skeleton interface for Bison's Yacc-like parsers in C
-
-   Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
+   
+      Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
    Free Software Foundation, Inc.
-
-   This program is free software; you can redistribute it and/or modify
+   
+   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.
-
+   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, write to the Free Software
-   Foundation, Inc., 51 Franklin Street, Fifth Floor,
-   Boston, MA 02110-1301, USA.  */
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 /* As a special exception, you may create a larger work that contains
    part or all of the Bison parser skeleton and distribute that work
@@ -29,10 +28,11 @@
    special exception, which will cause the skeleton and the resulting
    Bison output files to be licensed under the GNU General Public
    License without this special exception.
-
+   
    This special exception was added by the Free Software Foundation in
    version 2.2 of Bison.  */
 
+
 /* Tokens.  */
 #ifndef YYTOKENTYPE
 # define YYTOKENTYPE
@@ -214,8 +214,11 @@
 
 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
 typedef union YYSTYPE
+{
+
+/* Line 1676 of yacc.c  */
 #line 34 "wmlscript/wsgram.y"
-{
+
     WsUInt32 integer;
     WsFloat vfloat;
     char *identifier;
@@ -230,13 +233,15 @@
 
     WsStatement *stmt;
     WsExpression *expr;
-}
-/* Line 1529 of yacc.c.  */
-#line 236 "y.tab.h"
-	YYSTYPE;
+
+
+
+/* Line 1676 of yacc.c  */
+#line 241 "y.tab.h"
+} YYSTYPE;
+# define YYSTYPE_IS_TRIVIAL 1
 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
 # define YYSTYPE_IS_DECLARED 1
-# define YYSTYPE_IS_TRIVIAL 1
 #endif
 
 
@@ -255,3 +260,4 @@
 #endif
 
 
+
Index: aclocal.m4
===================================================================
--- aclocal.m4	(revision 4974)
+++ aclocal.m4	(working copy)
@@ -11,8 +11,8 @@
 # even the implied warranty of MERCHANTABILITY or FITNESS FOR A
 # PARTICULAR PURPOSE.
 
-# iconv.m4 serial AM6 (gettext-0.17)
-dnl Copyright (C) 2000-2002, 2007 Free Software Foundation, Inc.
+# iconv.m4 serial 11 (gettext-0.18.1)
+dnl Copyright (C) 2000-2002, 2007-2010 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
@@ -47,7 +47,7 @@
   am_save_CPPFLAGS="$CPPFLAGS"
   AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCICONV])
 
-  AC_CACHE_CHECK([for iconv], am_cv_func_iconv, [
+  AC_CACHE_CHECK([for iconv], [am_cv_func_iconv], [
     am_cv_func_iconv="no, consider installing GNU libiconv"
     am_cv_lib_iconv=no
     AC_TRY_LINK([#include <stdlib.h>
@@ -55,7 +55,7 @@
       [iconv_t cd = iconv_open("","");
        iconv(cd,NULL,NULL,NULL,NULL);
        iconv_close(cd);],
-      am_cv_func_iconv=yes)
+      [am_cv_func_iconv=yes])
     if test "$am_cv_func_iconv" != yes; then
       am_save_LIBS="$LIBS"
       LIBS="$LIBS $LIBICONV"
@@ -64,14 +64,14 @@
         [iconv_t cd = iconv_open("","");
          iconv(cd,NULL,NULL,NULL,NULL);
          iconv_close(cd);],
-        am_cv_lib_iconv=yes
-        am_cv_func_iconv=yes)
+        [am_cv_lib_iconv=yes]
+        [am_cv_func_iconv=yes])
       LIBS="$am_save_LIBS"
     fi
   ])
   if test "$am_cv_func_iconv" = yes; then
-    AC_CACHE_CHECK([for working iconv], am_cv_func_iconv_works, [
-      dnl This tests against bugs in AIX 5.1 and HP-UX 11.11.
+    AC_CACHE_CHECK([for working iconv], [am_cv_func_iconv_works], [
+      dnl This tests against bugs in AIX 5.1, HP-UX 11.11, Solaris 10.
       am_save_LIBS="$LIBS"
       if test $am_cv_lib_iconv = yes; then
         LIBS="$LIBS $LIBICONV"
@@ -100,6 +100,25 @@
           return 1;
       }
   }
+  /* Test against Solaris 10 bug: Failures are not distinguishable from
+     successful returns.  */
+  {
+    iconv_t cd_ascii_to_88591 = iconv_open ("ISO8859-1", "646");
+    if (cd_ascii_to_88591 != (iconv_t)(-1))
+      {
+        static const char input[] = "\263";
+        char buf[10];
+        const char *inptr = input;
+        size_t inbytesleft = strlen (input);
+        char *outptr = buf;
+        size_t outbytesleft = sizeof (buf);
+        size_t res = iconv (cd_ascii_to_88591,
+                            (char **) &inptr, &inbytesleft,
+                            &outptr, &outbytesleft);
+        if (res == 0)
+          return 1;
+      }
+  }
 #if 0 /* This bug could be worked around by the caller.  */
   /* Test against HP-UX 11.11 bug: Positive return value instead of 0.  */
   {
@@ -147,7 +166,7 @@
     am_func_iconv=no am_cv_lib_iconv=no
   fi
   if test "$am_func_iconv" = yes; then
-    AC_DEFINE(HAVE_ICONV, 1,
+    AC_DEFINE([HAVE_ICONV], [1],
       [Define if you have the iconv() function and it works.])
   fi
   if test "$am_cv_lib_iconv" = yes; then
@@ -160,16 +179,31 @@
     LIBICONV=
     LTLIBICONV=
   fi
-  AC_SUBST(LIBICONV)
-  AC_SUBST(LTLIBICONV)
+  AC_SUBST([LIBICONV])
+  AC_SUBST([LTLIBICONV])
 ])
 
-AC_DEFUN([AM_ICONV],
+dnl Define AM_ICONV using AC_DEFUN_ONCE for Autoconf >= 2.64, in order to
+dnl avoid warnings like
+dnl "warning: AC_REQUIRE: `AM_ICONV' was expanded before it was required".
+dnl This is tricky because of the way 'aclocal' is implemented:
+dnl - It requires defining an auxiliary macro whose name ends in AC_DEFUN.
+dnl   Otherwise aclocal's initial scan pass would miss the macro definition.
+dnl - It requires a line break inside the AC_DEFUN_ONCE and AC_DEFUN expansions.
+dnl   Otherwise aclocal would emit many "Use of uninitialized value $1"
+dnl   warnings.
+m4_define([gl_iconv_AC_DEFUN],
+  m4_version_prereq([2.64],
+    [[AC_DEFUN_ONCE(
+        [$1], [$2])]],
+    [[AC_DEFUN(
+        [$1], [$2])]]))
+gl_iconv_AC_DEFUN([AM_ICONV],
 [
   AM_ICONV_LINK
   if test "$am_cv_func_iconv" = yes; then
     AC_MSG_CHECKING([for iconv declaration])
-    AC_CACHE_VAL(am_cv_proto_iconv, [
+    AC_CACHE_VAL([am_cv_proto_iconv], [
       AC_TRY_COMPILE([
 #include <stdlib.h>
 #include <iconv.h>
@@ -182,18 +216,18 @@
 #else
 size_t iconv();
 #endif
-], [], am_cv_proto_iconv_arg1="", am_cv_proto_iconv_arg1="const")
+], [], [am_cv_proto_iconv_arg1=""], [am_cv_proto_iconv_arg1="const"])
       am_cv_proto_iconv="extern size_t iconv (iconv_t cd, $am_cv_proto_iconv_arg1 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);"])
     am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'`
-    AC_MSG_RESULT([$]{ac_t:-
-         }[$]am_cv_proto_iconv)
-    AC_DEFINE_UNQUOTED(ICONV_CONST, $am_cv_proto_iconv_arg1,
+    AC_MSG_RESULT([
+         $am_cv_proto_iconv])
+    AC_DEFINE_UNQUOTED([ICONV_CONST], [$am_cv_proto_iconv_arg1],
       [Define as const if the declaration of iconv() needs const.])
   fi
 ])
 
-# lib-ld.m4 serial 3 (gettext-0.13)
-dnl Copyright (C) 1996-2003 Free Software Foundation, Inc.
+# lib-ld.m4 serial 4 (gettext-0.18)
+dnl Copyright (C) 1996-2003, 2009-2010 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
@@ -204,7 +238,7 @@
 
 dnl From libtool-1.4. Sets the variable with_gnu_ld to yes or no.
 AC_DEFUN([AC_LIB_PROG_LD_GNU],
-[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], acl_cv_prog_gnu_ld,
+[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], [acl_cv_prog_gnu_ld],
 [# I'd rather use --version here, but apparently some GNU ld's only accept -v.
 case `$LD -v 2>&1 </dev/null` in
 *GNU* | *'with BFD'*)
@@ -217,7 +251,7 @@
 
 dnl From libtool-1.4. Sets the variable LD.
 AC_DEFUN([AC_LIB_PROG_LD],
-[AC_ARG_WITH(gnu-ld,
+[AC_ARG_WITH([gnu-ld],
 [  --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([AC_PROG_CC])dnl
@@ -253,7 +287,7 @@
       # Canonicalize the path of ld
       ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
       while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
-	ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
+        ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
       done
       test -z "$LD" && LD="$ac_prog"
       ;;
@@ -271,7 +305,7 @@
 else
   AC_MSG_CHECKING([for non-GNU ld])
 fi
-AC_CACHE_VAL(acl_cv_path_LD,
+AC_CACHE_VAL([acl_cv_path_LD],
 [if test -z "$LD"; then
   IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
   for ac_dir in $PATH; do
@@ -283,9 +317,9 @@
       # Break only if it was the GNU/non-GNU ld that we prefer.
       case `"$acl_cv_path_LD" -v 2>&1 < /dev/null` in
       *GNU* | *'with BFD'*)
-	test "$with_gnu_ld" != no && break ;;
+        test "$with_gnu_ld" != no && break ;;
       *)
-	test "$with_gnu_ld" != yes && break ;;
+        test "$with_gnu_ld" != yes && break ;;
       esac
     fi
   done
@@ -295,23 +329,23 @@
 fi])
 LD="$acl_cv_path_LD"
 if test -n "$LD"; then
-  AC_MSG_RESULT($LD)
+  AC_MSG_RESULT([$LD])
 else
-  AC_MSG_RESULT(no)
+  AC_MSG_RESULT([no])
 fi
 test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
 AC_LIB_PROG_LD_GNU
 ])
 
-# lib-link.m4 serial 13 (gettext-0.17)
-dnl Copyright (C) 2001-2007 Free Software Foundation, Inc.
+# lib-link.m4 serial 21 (gettext-0.18)
+dnl Copyright (C) 2001-2010 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
 
 dnl From Bruno Haible.
 
-AC_PREREQ(2.54)
+AC_PREREQ([2.54])
 
 dnl AC_LIB_LINKFLAGS(name [, dependencies]) searches for libname and
 dnl the libraries corresponding to explicit and implicit dependencies.
@@ -323,9 +357,9 @@
 [
   AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
   AC_REQUIRE([AC_LIB_RPATH])
-  define([Name],[translit([$1],[./-], [___])])
-  define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
-                               [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
+  pushdef([Name],[translit([$1],[./-], [___])])
+  pushdef([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
+                                [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
   AC_CACHE_CHECK([how to link with lib[]$1], [ac_cv_lib[]Name[]_libs], [
     AC_LIB_LINKFLAGS_BODY([$1], [$2])
     ac_cv_lib[]Name[]_libs="$LIB[]NAME"
@@ -344,16 +378,17 @@
   dnl Also set HAVE_LIB[]NAME so that AC_LIB_HAVE_LINKFLAGS can reuse the
   dnl results of this search when this library appears as a dependency.
   HAVE_LIB[]NAME=yes
-  undefine([Name])
-  undefine([NAME])
+  popdef([NAME])
+  popdef([Name])
 ])
 
-dnl AC_LIB_HAVE_LINKFLAGS(name, dependencies, includes, testcode)
+dnl AC_LIB_HAVE_LINKFLAGS(name, dependencies, includes, testcode, [missing-message])
 dnl searches for libname and the libraries corresponding to explicit and
 dnl implicit dependencies, together with the specified include files and
-dnl the ability to compile and link the specified testcode. If found, it
-dnl sets and AC_SUBSTs HAVE_LIB${NAME}=yes and the LIB${NAME} and
-dnl LTLIB${NAME} variables and augments the CPPFLAGS variable, and
+dnl the ability to compile and link the specified testcode. The missing-message
+dnl defaults to 'no' and may contain additional hints for the user.
+dnl If found, it sets and AC_SUBSTs HAVE_LIB${NAME}=yes and the LIB${NAME}
+dnl and LTLIB${NAME} variables and augments the CPPFLAGS variable, and
 dnl #defines HAVE_LIB${NAME} to 1. Otherwise, it sets and AC_SUBSTs
 dnl HAVE_LIB${NAME}=no and LIB${NAME} and LTLIB${NAME} to empty.
 dnl Sets and AC_SUBSTs the LIB${NAME}_PREFIX variable to nonempty if libname
@@ -362,9 +397,9 @@
 [
   AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
   AC_REQUIRE([AC_LIB_RPATH])
-  define([Name],[translit([$1],[./-], [___])])
-  define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
-                               [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
+  pushdef([Name],[translit([$1],[./-], [___])])
+  pushdef([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
+                                [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
 
   dnl Search for lib[]Name and define LIB[]NAME, LTLIB[]NAME and INC[]NAME
   dnl accordingly.
@@ -378,13 +413,25 @@
 
   AC_CACHE_CHECK([for lib[]$1], [ac_cv_lib[]Name], [
     ac_save_LIBS="$LIBS"
-    LIBS="$LIBS $LIB[]NAME"
-    AC_TRY_LINK([$3], [$4], [ac_cv_lib[]Name=yes], [ac_cv_lib[]Name=no])
+    dnl If $LIB[]NAME contains some -l options, add it to the end of LIBS,
+    dnl because these -l options might require -L options that are present in
+    dnl LIBS. -l options benefit only from the -L options listed before it.
+    dnl Otherwise, add it to the front of LIBS, because it may be a static
+    dnl library that depends on another static library that is present in LIBS.
+    dnl Static libraries benefit only from the static libraries listed after
+    dnl it.
+    case " $LIB[]NAME" in
+      *" -l"*) LIBS="$LIBS $LIB[]NAME" ;;
+      *)       LIBS="$LIB[]NAME $LIBS" ;;
+    esac
+    AC_TRY_LINK([$3], [$4],
+      [ac_cv_lib[]Name=yes],
+      [ac_cv_lib[]Name='m4_if([$5], [], [no], [[$5]])'])
     LIBS="$ac_save_LIBS"
   ])
   if test "$ac_cv_lib[]Name" = yes; then
     HAVE_LIB[]NAME=yes
-    AC_DEFINE([HAVE_LIB]NAME, 1, [Define if you have the $1 library.])
+    AC_DEFINE([HAVE_LIB]NAME, 1, [Define if you have the lib][$1 library.])
     AC_MSG_CHECKING([how to link with lib[]$1])
     AC_MSG_RESULT([$LIB[]NAME])
   else
@@ -400,8 +447,8 @@
   AC_SUBST([LIB]NAME)
   AC_SUBST([LTLIB]NAME)
   AC_SUBST([LIB]NAME[_PREFIX])
-  undefine([Name])
-  undefine([NAME])
+  popdef([NAME])
+  popdef([Name])
 ])
 
 dnl Determine the platform dependent parameters needed to use rpath:
@@ -419,7 +466,7 @@
   AC_REQUIRE([AC_LIB_PROG_LD])            dnl we use $LD, $with_gnu_ld
   AC_REQUIRE([AC_CANONICAL_HOST])         dnl we use $host
   AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT]) dnl we use $ac_aux_dir
-  AC_CACHE_CHECK([for shared library run path origin], acl_cv_rpath, [
+  AC_CACHE_CHECK([for shared library run path origin], [acl_cv_rpath], [
     CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \
     ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh
     . ./conftest.sh
@@ -436,11 +483,32 @@
   acl_hardcode_direct="$acl_cv_hardcode_direct"
   acl_hardcode_minus_L="$acl_cv_hardcode_minus_L"
   dnl Determine whether the user wants rpath handling at all.
-  AC_ARG_ENABLE(rpath,
+  AC_ARG_ENABLE([rpath],
     [  --disable-rpath         do not hardcode runtime library paths],
     :, enable_rpath=yes)
 ])
 
+dnl AC_LIB_FROMPACKAGE(name, package)
+dnl declares that libname comes from the given package. The configure file
+dnl will then not have a --with-libname-prefix option but a
+dnl --with-package-prefix option. Several libraries can come from the same
+dnl package. This declaration must occur before an AC_LIB_LINKFLAGS or similar
+dnl macro call that searches for libname.
+AC_DEFUN([AC_LIB_FROMPACKAGE],
+[
+  pushdef([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
+                                [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
+  define([acl_frompackage_]NAME, [$2])
+  popdef([NAME])
+  pushdef([PACK],[$2])
+  pushdef([PACKUP],[translit(PACK,[abcdefghijklmnopqrstuvwxyz./-],
+                                  [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
+  define([acl_libsinpackage_]PACKUP,
+    m4_ifdef([acl_libsinpackage_]PACKUP, [acl_libsinpackage_]PACKUP[[, ]],)[lib$1])
+  popdef([PACKUP])
+  popdef([PACK])
+])
+
 dnl AC_LIB_LINKFLAGS_BODY(name [, dependencies]) searches for libname and
 dnl the libraries corresponding to explicit and implicit dependencies.
 dnl Sets the LIB${NAME}, LTLIB${NAME} and INC${NAME} variables.
@@ -449,19 +517,23 @@
 AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
 [
   AC_REQUIRE([AC_LIB_PREPARE_MULTILIB])
-  define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
-                               [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
+  pushdef([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
+                                [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
+  pushdef([PACK],[m4_ifdef([acl_frompackage_]NAME, [acl_frompackage_]NAME, lib[$1])])
+  pushdef([PACKUP],[translit(PACK,[abcdefghijklmnopqrstuvwxyz./-],
+                                  [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
+  pushdef([PACKLIBS],[m4_ifdef([acl_frompackage_]NAME, [acl_libsinpackage_]PACKUP, lib[$1])])
   dnl Autoconf >= 2.61 supports dots in --with options.
-  define([N_A_M_E],[m4_if(m4_version_compare(m4_defn([m4_PACKAGE_VERSION]),[2.61]),[-1],[translit([$1],[.],[_])],[$1])])
+  pushdef([P_A_C_K],[m4_if(m4_version_compare(m4_defn([m4_PACKAGE_VERSION]),[2.61]),[-1],[translit(PACK,[.],[_])],PACK)])
   dnl By default, look in $includedir and $libdir.
   use_additional=yes
   AC_LIB_WITH_FINAL_PREFIX([
     eval additional_includedir=\"$includedir\"
     eval additional_libdir=\"$libdir\"
   ])
-  AC_LIB_ARG_WITH([lib]N_A_M_E[-prefix],
-[  --with-lib]N_A_M_E[-prefix[=DIR]  search for lib$1 in DIR/include and DIR/lib
-  --without-lib]N_A_M_E[-prefix     don't search for lib$1 in includedir and libdir],
+  AC_ARG_WITH(P_A_C_K[-prefix],
+[[  --with-]]P_A_C_K[[-prefix[=DIR]  search for ]PACKLIBS[ in DIR/include and DIR/lib
+  --without-]]P_A_C_K[[-prefix     don't search for ]PACKLIBS[ in includedir and libdir]],
 [
     if test "X$withval" = "Xno"; then
       use_additional=no
@@ -474,6 +546,10 @@
       else
         additional_includedir="$withval/include"
         additional_libdir="$withval/$acl_libdirstem"
+        if test "$acl_libdirstem2" != "$acl_libdirstem" \
+           && ! test -d "$withval/$acl_libdirstem"; then
+          additional_libdir="$withval/$acl_libdirstem2"
+        fi
       fi
     fi
 ])
@@ -483,6 +559,9 @@
   LTLIB[]NAME=
   INC[]NAME=
   LIB[]NAME[]_PREFIX=
+  dnl HAVE_LIB${NAME} is an indicator that LIB${NAME}, LTLIB${NAME} have been
+  dnl computed. So it has to be reset here.
+  HAVE_LIB[]NAME=
   rpathdirs=
   ltrpathdirs=
   names_already_handled=
@@ -632,7 +711,9 @@
               dnl Linking with a shared library. We attempt to hardcode its
               dnl directory into the executable's runpath, unless it's the
               dnl standard /usr/lib.
-              if test "$enable_rpath" = no || test "X$found_dir" = "X/usr/$acl_libdirstem"; then
+              if test "$enable_rpath" = no \
+                 || test "X$found_dir" = "X/usr/$acl_libdirstem" \
+                 || test "X$found_dir" = "X/usr/$acl_libdirstem2"; then
                 dnl No hardcoding is needed.
                 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
               else
@@ -720,9 +801,18 @@
             case "$found_dir" in
               */$acl_libdirstem | */$acl_libdirstem/)
                 basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem/"'*$,,'`
-                LIB[]NAME[]_PREFIX="$basedir"
+                if test "$name" = '$1'; then
+                  LIB[]NAME[]_PREFIX="$basedir"
+                fi
                 additional_includedir="$basedir/include"
                 ;;
+              */$acl_libdirstem2 | */$acl_libdirstem2/)
+                basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem2/"'*$,,'`
+                if test "$name" = '$1'; then
+                  LIB[]NAME[]_PREFIX="$basedir"
+                fi
+                additional_includedir="$basedir/include"
+                ;;
             esac
             if test "X$additional_includedir" != "X"; then
               dnl Potentially add $additional_includedir to $INCNAME.
@@ -781,9 +871,11 @@
                     dnl   3. if it's already present in $LDFLAGS or the already
                     dnl      constructed $LIBNAME,
                     dnl   4. if it doesn't exist as a directory.
-                    if test "X$additional_libdir" != "X/usr/$acl_libdirstem"; then
+                    if test "X$additional_libdir" != "X/usr/$acl_libdirstem" \
+                       && test "X$additional_libdir" != "X/usr/$acl_libdirstem2"; then
                       haveit=
-                      if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem"; then
+                      if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem" \
+                         || test "X$additional_libdir" = "X/usr/local/$acl_libdirstem2"; then
                         if test -n "$GCC"; then
                           case $host_os in
                             linux* | gnu* | k*bsd*-gnu) haveit=yes;;
@@ -914,6 +1006,11 @@
       LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-R$found_dir"
     done
   fi
+  popdef([P_A_C_K])
+  popdef([PACKLIBS])
+  popdef([PACKUP])
+  popdef([PACK])
+  popdef([NAME])
 ])
 
 dnl AC_LIB_APPENDTOVAR(VAR, CONTENTS) appends the elements of CONTENTS to VAR,
@@ -959,7 +1056,8 @@
         if test -n "$next"; then
           dir="$next"
           dnl No need to hardcode the standard /usr/lib.
-          if test "X$dir" != "X/usr/$acl_libdirstem"; then
+          if test "X$dir" != "X/usr/$acl_libdirstem" \
+             && test "X$dir" != "X/usr/$acl_libdirstem2"; then
             rpathdirs="$rpathdirs $dir"
           fi
           next=
@@ -968,7 +1066,8 @@
             -L) next=yes ;;
             -L*) dir=`echo "X$opt" | sed -e 's,^X-L,,'`
                  dnl No need to hardcode the standard /usr/lib.
-                 if test "X$dir" != "X/usr/$acl_libdirstem"; then
+                 if test "X$dir" != "X/usr/$acl_libdirstem" \
+                    && test "X$dir" != "X/usr/$acl_libdirstem2"; then
                    rpathdirs="$rpathdirs $dir"
                  fi
                  next= ;;
@@ -1013,8 +1112,8 @@
   AC_SUBST([$1])
 ])
 
-# lib-prefix.m4 serial 5 (gettext-0.15)
-dnl Copyright (C) 2001-2005 Free Software Foundation, Inc.
+# lib-prefix.m4 serial 7 (gettext-0.18)
+dnl Copyright (C) 2001-2005, 2008-2010 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
@@ -1168,35 +1267,74 @@
   prefix="$acl_save_prefix"
 ])
 
-dnl AC_LIB_PREPARE_MULTILIB creates a variable acl_libdirstem, containing
-dnl the basename of the libdir, either "lib" or "lib64".
+dnl AC_LIB_PREPARE_MULTILIB creates
+dnl - a variable acl_libdirstem, containing the basename of the libdir, either
+dnl   "lib" or "lib64" or "lib/64",
+dnl - a variable acl_libdirstem2, as a secondary possible value for
+dnl   acl_libdirstem, either the same as acl_libdirstem or "lib/sparcv9" or
+dnl   "lib/amd64".
 AC_DEFUN([AC_LIB_PREPARE_MULTILIB],
 [
-  dnl There is no formal standard regarding lib and lib64. The current
-  dnl practice is that on a system supporting 32-bit and 64-bit instruction
-  dnl sets or ABIs, 64-bit libraries go under $prefix/lib64 and 32-bit
-  dnl libraries go under $prefix/lib. We determine the compiler's default
-  dnl mode by looking at the compiler's library search path. If at least
-  dnl of its elements ends in /lib64 or points to a directory whose absolute
-  dnl pathname ends in /lib64, we assume a 64-bit ABI. Otherwise we use the
-  dnl default, namely "lib".
+  dnl There is no formal standard regarding lib and lib64.
+  dnl On glibc systems, the current practice is that on a system supporting
+  dnl 32-bit and 64-bit instruction sets or ABIs, 64-bit libraries go under
+  dnl $prefix/lib64 and 32-bit libraries go under $prefix/lib. We determine
+  dnl the compiler's default mode by looking at the compiler's library search
+  dnl path. If at least one of its elements ends in /lib64 or points to a
+  dnl directory whose absolute pathname ends in /lib64, we assume a 64-bit ABI.
+  dnl Otherwise we use the default, namely "lib".
+  dnl On Solaris systems, the current practice is that on a system supporting
+  dnl 32-bit and 64-bit instruction sets or ABIs, 64-bit libraries go under
+  dnl $prefix/lib/64 (which is a symlink to either $prefix/lib/sparcv9 or
+  dnl $prefix/lib/amd64) and 32-bit libraries go under $prefix/lib.
+  AC_REQUIRE([AC_CANONICAL_HOST])
   acl_libdirstem=lib
-  searchpath=`(LC_ALL=C $CC -print-search-dirs) 2>/dev/null | sed -n -e 's,^libraries: ,,p' | sed -e 's,^=,,'`
-  if test -n "$searchpath"; then
-    acl_save_IFS="${IFS= 	}"; IFS=":"
-    for searchdir in $searchpath; do
-      if test -d "$searchdir"; then
-        case "$searchdir" in
-          */lib64/ | */lib64 ) acl_libdirstem=lib64 ;;
-          *) searchdir=`cd "$searchdir" && pwd`
-             case "$searchdir" in
-               */lib64 ) acl_libdirstem=lib64 ;;
-             esac ;;
+  acl_libdirstem2=
+  case "$host_os" in
+    solaris*)
+      dnl See Solaris 10 Software Developer Collection > Solaris 64-bit Developer's Guide > The Development Environment
+      dnl <http://docs.sun.com/app/docs/doc/816-5138/dev-env?l=en&a=view>.
+      dnl "Portable Makefiles should refer to any library directories using the 64 symbolic link."
+      dnl But we want to recognize the sparcv9 or amd64 subdirectory also if the
+      dnl symlink is missing, so we set acl_libdirstem2 too.
+      AC_CACHE_CHECK([for 64-bit host], [gl_cv_solaris_64bit],
+        [AC_EGREP_CPP([sixtyfour bits], [
+#ifdef _LP64
+sixtyfour bits
+#endif
+           ], [gl_cv_solaris_64bit=yes], [gl_cv_solaris_64bit=no])
+        ])
+      if test $gl_cv_solaris_64bit = yes; then
+        acl_libdirstem=lib/64
+        case "$host_cpu" in
+          sparc*)        acl_libdirstem2=lib/sparcv9 ;;
+          i*86 | x86_64) acl_libdirstem2=lib/amd64 ;;
         esac
       fi
-    done
-    IFS="$acl_save_IFS"
-  fi
+      ;;
+    *)
+      searchpath=`(LC_ALL=C $CC -print-search-dirs) 2>/dev/null | sed -n -e 's,^libraries: ,,p' | sed -e 's,^=,,'`
+      if test -n "$searchpath"; then
+        acl_save_IFS="${IFS= 	}"; IFS=":"
+        for searchdir in $searchpath; do
+          if test -d "$searchdir"; then
+            case "$searchdir" in
+              */lib64/ | */lib64 ) acl_libdirstem=lib64 ;;
+              */../ | */.. )
+                # Better ignore directories of this form. They are misleading.
+                ;;
+              *) searchdir=`cd "$searchdir" && pwd`
+                 case "$searchdir" in
+                   */lib64 ) acl_libdirstem=lib64 ;;
+                 esac ;;
+            esac
+          fi
+        done
+        IFS="$acl_save_IFS"
+      fi
+      ;;
+  esac
+  test -n "$acl_libdirstem2" || acl_libdirstem2="$acl_libdirstem"
 ])
 
 m4_include([acinclude.m4])
Index: gw/msg-decl.h
===================================================================
--- gw/msg-decl.h	(revision 4974)
+++ gw/msg-decl.h	(working copy)
@@ -105,6 +105,7 @@
         OCTSTR(charset)
         OCTSTR(boxc_id)
         OCTSTR(binfo)
+        INTEGER(campaign_id)	// Campaign ID field declaration
         INTEGER(msg_left)
         VOID(split_parts)
         INTEGER(priority)
Index: gw/dlr_p.h
===================================================================
--- gw/dlr_p.h	(revision 4974)
+++ gw/dlr_p.h	(working copy)
@@ -83,6 +83,9 @@
    Octstr *service;
    Octstr *url;
    Octstr *boxc_id;
+   // Add support for campaign
+   Octstr *campaign_id;
+
    int mask;
 };
 
@@ -156,6 +159,7 @@
     Octstr *field_mask;
     Octstr *field_status;
     Octstr *field_boxc;
+    Octstr *field_campaign;
 };
 
 struct dlr_db_fields *dlr_db_fields_create(CfgGroup *grp);
Index: gw/dlr_mysql.c
===================================================================
--- gw/dlr_mysql.c	(revision 4974)
+++ gw/dlr_mysql.c	(working copy)
@@ -105,11 +105,12 @@
         return;
     }
 
-    sql = octstr_format("INSERT INTO `%S` (`%S`, `%S`, `%S`, `%S`, `%S`, `%S`, `%S`, `%S`, `%S`) VALUES "
-                        "(?, ?, ?, ?, ?, ?, ?, ?, 0)",
+    sql = octstr_format("INSERT INTO `%S` (`%S`, `%S`, `%S`, `%S`, `%S`, `%S`, `%S`, `%S`, `%S`, `%S`) VALUES "
+                        "(?, ?, ?, ?, ?, ?, ?, ?, ?, 0)",
                         fields->table, fields->field_smsc, fields->field_ts,
                         fields->field_src, fields->field_dst, fields->field_serv,
                         fields->field_url, fields->field_mask, fields->field_boxc,
+                        fields->field_campaign,
                         fields->field_status);
     os_mask = octstr_format("%d", entry->mask);
     gwlist_append(binds, entry->smsc);
@@ -120,6 +121,7 @@
     gwlist_append(binds, entry->url);
     gwlist_append(binds, os_mask);
     gwlist_append(binds, entry->boxc_id);
+    gwlist_append(binds, entry->campaign_id);	// Bind campaign_id to this...
 
 #if defined(DLR_TRACE)
     debug("dlr.mysql", 0, "sql: %s", octstr_get_cstr(sql));
@@ -136,7 +138,7 @@
     dlr_entry_destroy(entry);
 }
 
-static struct dlr_entry* dlr_mysql_get(const Octstr *smsc, const Octstr *ts, const Octstr *dst)
+static struct dlr_entry* dlr_mysql_get(const Octstr *smsc, const Octstr *ts, const Octstr *dst/*, const *campaign*/)
 {
     Octstr *sql, *like;
     DBPoolConn *pconn;
@@ -153,10 +155,11 @@
     else
         like = octstr_imm("");
 
-    sql = octstr_format("SELECT `%S`, `%S`, `%S`, `%S`, `%S`, `%S` FROM `%S` WHERE `%S`=? AND `%S`=? %S LIMIT 1",
+    sql = octstr_format("SELECT `%S`, `%S`, `%S`, `%S`, `%S`, `%S`, `%S` FROM `%S` WHERE `%S`=? AND `%S`=? %S LIMIT 1",
                         fields->field_mask, fields->field_serv,
                         fields->field_url, fields->field_src,
                         fields->field_dst, fields->field_boxc,
+                        fields->field_campaign,
                         fields->table, fields->field_smsc,
                         fields->field_ts, like);
 
@@ -192,6 +195,7 @@
         res->source = octstr_create(LO2CSTR(row, 3));
         res->destination = octstr_create(LO2CSTR(row, 4));
         res->boxc_id = octstr_create(LO2CSTR(row, 5));
+        res->campaign_id = octstr_create(LO2CSTR(row, 6));	// Add campaign_id to Dlr entry
         gwlist_destroy(row, octstr_destroy_item);
         res->smsc = octstr_duplicate(smsc);
     }
Index: gw/dlr.c
===================================================================
--- gw/dlr.c	(revision 4974)
+++ gw/dlr.c	(working copy)
@@ -130,6 +130,7 @@
     ret->service = octstr_duplicate(dlr->service);
     ret->url = octstr_duplicate(dlr->url);
     ret->boxc_id = octstr_duplicate(dlr->boxc_id);
+    ret->campaign_id = octstr_duplicate(dlr->campaign_id);
     ret->mask = dlr->mask;
 
     return ret;
@@ -153,6 +154,7 @@
     O_DELETE(dlr->service);
     O_DELETE(dlr->url);
     O_DELETE(dlr->boxc_id);
+    O_DELETE(dlr->campaign_id);
 
 #undef O_DELETE
 
@@ -358,11 +360,12 @@
     dlr->service = (msg->sms.service ? octstr_duplicate(msg->sms.service) : octstr_create(""));
     dlr->url = (msg->sms.dlr_url ? octstr_duplicate(msg->sms.dlr_url) : octstr_create(""));
     dlr->boxc_id = (msg->sms.boxc_id ? octstr_duplicate(msg->sms.boxc_id) : octstr_create(""));
+    dlr->campaign_id = (msg->sms.campaign_id ? octstr_duplicate(msg->sms.campaign_id) : octstr_create(""));
     dlr->mask = msg->sms.dlr_mask;
 
-    debug("dlr.dlr", 0, "DLR[%s]: Adding DLR smsc=%s, ts=%s, src=%s, dst=%s, mask=%d, boxc=%s",
+    debug("dlr.dlr", 0, "DLR[%s]: Adding DLR smsc=%s, ts=%s, src=%s, dst=%s, mask=%d, boxc=%s, campaign=%s",
           dlr_type(), octstr_get_cstr(dlr->smsc), octstr_get_cstr(dlr->timestamp),
-          octstr_get_cstr(dlr->source), octstr_get_cstr(dlr->destination), dlr->mask, octstr_get_cstr(dlr->boxc_id));
+          octstr_get_cstr(dlr->source), octstr_get_cstr(dlr->destination), dlr->mask, octstr_get_cstr(dlr->boxc_id), octstr_get_cstr(dlr->campaign_id));
 	
     /* call registered function */
     handles->dlr_add(dlr);
@@ -430,6 +433,11 @@
          * route this msg back to originating smsbox
          */
         O_SET(msg->sms.boxc_id, dlr->boxc_id);
+        /*
+         * If a campaign_id is available, then instruct bearerbox to
+         * route this msg back to originating smsbox
+         */
+        O_SET(msg->sms.campaign_id, dlr->campaign_id);
 
         time(&msg->sms.time);
         debug("dlr.dlr", 0, "DLR[%s]: created DLR message for URL <%s>",
@@ -498,6 +506,7 @@
     dlrmsg->sms.dlr_url = octstr_duplicate(msg->sms.dlr_url);
     dlrmsg->sms.msgdata = octstr_duplicate(reply);
     dlrmsg->sms.boxc_id = octstr_duplicate(msg->sms.boxc_id);
+    dlrmsg->sms.campaign_id = octstr_duplicate(msg->sms.campaign_id);
     dlrmsg->sms.foreign_id = octstr_duplicate(msg->sms.foreign_id);
     time(&dlrmsg->sms.time);
 
Index: gw/urltrans.c
===================================================================
--- gw/urltrans.c	(revision 4974)
+++ gw/urltrans.c	(working copy)
@@ -459,6 +459,16 @@
         octstr_destroy(enc);
         break;
 
+    // Add campaign ID as &h in parameters of URL...
+    case 'h':
+            if (request->sms.campaign_id == NULL)
+            break;
+            enc = octstr_duplicate(request->sms.campaign_id);
+            octstr_url_encode(enc);
+            octstr_append(result, enc);
+            octstr_destroy(enc);
+            break;
+
     case 'i':
         if (request->sms.smsc_id == NULL)
         break;
Index: gw/msg.c
===================================================================
--- gw/msg.c	(revision 4974)
+++ gw/msg.c	(working copy)
@@ -128,7 +128,16 @@
 
     return new;
 }
-
+/**
+ * Destroy an SMS Campaign...
+ */
+void campaign_destroy(SmsCampaign *campaign)
+{
+    if (campaign == NULL)
+        return;
+	load_destroy(campaign->load);
+    gw_free(campaign);
+}
 void msg_destroy(Msg *msg)
 {
     if (msg == NULL)
Index: gw/msg.h
===================================================================
--- gw/msg.h	(revision 4974)
+++ gw/msg.h	(working copy)
@@ -67,6 +67,7 @@
 #define MSG_H
 
 #include "gwlib/gwlib.h"
+#include "load.h"
 
 #define MSG_PARAM_UNDEFINED -1
 
@@ -87,6 +88,14 @@
 	#include "msg-decl.h"
 } Msg;
 
+/*khai bao cau truc de chua thong tin ve campaign */
+typedef struct {
+	int id;
+	unsigned long window;
+	double throughput; /* message thoughput per sec. to be delivered to SMSC */
+	Load *load;
+} SmsCampaign;
+
 struct split_parts {
     /* original large message */
     Msg *orig;
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.