merged with private
authorJaeho Lee <jaeho81.lee@samsung.com>
Fri, 10 Feb 2012 07:10:53 +0000 (16:10 +0900)
committerJaeho Lee <jaeho81.lee@samsung.com>
Fri, 10 Feb 2012 07:10:53 +0000 (16:10 +0900)
14 files changed:
alarm-lib-stub.c
alarm-lib.c
alarm-manager.c
alarm-service.pc.in
alarm_mgr.xml
config.guess
config.sub
debian/control
include/alarm.h
ltmain.sh [changed mode: 0644->0755]
m4/ltsugar.m4
m4/ltversion.m4
test/Makefile [new file with mode: 0644]
test/alarmmgr_unit_ts.c [new file with mode: 0644]

index 3af3c25..b100df8 100755 (executable)
@@ -40,7 +40,6 @@
 #define ALARM_INTERFACE_NAME "appframework.alarm"
 
 
-                        
 bool _send_alarm_create(alarm_context_t context, alarm_info_t *alarm_info,
                        alarm_id_t *alarm_id, const char *dst_service_name, const char *dst_service_name_mod,
                        int *error_code);
@@ -164,7 +163,6 @@ bool _send_alarm_create_appsvc(alarm_context_t context, alarm_info_t *alarm_info
 
 
 
-                        
 bool _send_alarm_create(alarm_context_t context, alarm_info_t *alarm_info,
                        alarm_id_t *alarm_id, const char *dst_service_name, const char *dst_service_name_mod,
                        int *error_code)
@@ -177,6 +175,16 @@ bool _send_alarm_create(alarm_context_t context, alarm_info_t *alarm_info,
        int size;
        int retval;
 
+       /*TODO: Dbus bus name validation is must & will be added to avoid alarm-server crash*/
+       if (g_quark_to_string(context.quark_app_service_name) == NULL
+               && strlen(dst_service_name) == 4
+               && strncmp(dst_service_name, "null",4) == 0 ){
+                       ALARM_MGR_EXCEPTION_PRINT("Invalid arg. Provide valid destination or call alarmmgr_init()\n");
+               if (error_code)
+                       *error_code = ERR_ALARM_INVALID_PARAM;
+               return false;
+       }
+
        size = security_server_get_cookie_size();
        retval = security_server_request_cookie(cookie, size);
 
@@ -230,6 +238,76 @@ bool _send_alarm_create(alarm_context_t context, alarm_info_t *alarm_info,
 
        return true;
 }
+bundle *_send_alarm_get_appsvc_info(alarm_context_t context, alarm_id_t alarm_id, int *error_code)
+{
+       GError *error = NULL;
+       int return_code = 0;
+
+       bundle *b = NULL;
+
+       char cookie[256] = {0,};
+       char *e_cookie = NULL;
+       int size = 0;
+       int retval = 0;
+
+       gchar *b_data = NULL;
+       int len = 0;
+
+       size = security_server_get_cookie_size();
+       retval = security_server_request_cookie(cookie, size);
+
+       if (retval < 0) {
+               ALARM_MGR_EXCEPTION_PRINT(
+                       "security_server_request_cookie failed\n");
+               if (error_code)
+                       *error_code = -1; /*TODO: define error*/
+               return NULL;
+       }
+
+       e_cookie = g_base64_encode((const guchar *)cookie, size);
+
+       if (NULL == e_cookie)
+       {
+               ALARM_MGR_EXCEPTION_PRINT(
+                       "g_base64_encode failed\n");
+               if (error_code)
+                       *error_code = -1; /*TODO: define error*/
+               return NULL;
+       }
+
+
+       if (!com_samsung_alarm_manager_alarm_get_appsvc_info
+           (context.proxy, context.pid, alarm_id, e_cookie, &b_data, &return_code, &error)) {
+               /* dbus-glib error */
+               /*error_code should be set */
+               ALARM_MGR_EXCEPTION_PRINT(
+               "com_samsung_alarm_manager_alarm_delete() failed. "
+                    "alarm_id[%d], return_code[%d]\n", alarm_id, return_code);
+               if (error_code)
+                       *error_code = ERR_ALARM_SYSTEM_FAIL; /*-1 means that system
+                                                               failed internally.*/
+               if (e_cookie)
+                       g_free(e_cookie);
+               if (b_data)
+                       g_free(b_data);
+
+               return NULL;
+       }
+
+       if (return_code != 0){
+               if (error_code)
+                       *error_code = return_code;
+       } else {
+               b = bundle_decode((bundle_raw *)b_data, len);
+       }
+
+       if (e_cookie)
+               g_free(e_cookie);
+       if (b_data)
+               g_free(b_data);
+
+       return b;
+}
 
 bool _send_alarm_delete(alarm_context_t context, alarm_id_t alarm_id,
                        int *error_code)
index 014b4d3..8304eef 100755 (executable)
@@ -528,6 +528,28 @@ static int __alarmmgr_init_appsvc(void)
 
 }
 
+EXPORT_API void *alarmmgr_get_alarm_appsvc_info(alarm_id_t alarm_id, int *return_code){
+
+       int ret = 0;
+
+       ret = __sub_init();
+       if (ret < 0){
+               if (return_code)
+                       *return_code = ret;
+               return NULL;
+       }
+
+       ALARM_MGR_LOG_PRINT("[alarm-lib]:alarmmgr_get_alarm_appsvc_info() is called\n");
+
+       if (alarm_id <= 0) {
+               if (return_code)
+                       *return_code = ERR_ALARM_INVALID_ID;
+               return NULL;
+       }
+
+       return _send_alarm_get_appsvc_info(alarm_context, alarm_id, return_code);
+
+}
 
 
 EXPORT_API int alarmmgr_add_alarm_appsvc_with_localtime(alarm_entry_t *alarm, void *bundle_data, alarm_id_t *alarm_id)
index 70cfe46..0c8df2a 100755 (executable)
@@ -748,12 +748,6 @@ static bool __alarm_create_appsvc(alarm_info_t *alarm_info, alarm_id_t *alarm_id
 
        time(&current_time);
 
-       ALARM_MGR_LOG_PRINT("[alarm-server]:pid=%d, app_unique_name=%s, "
-               "app_bundle_encoded_val=%s,c_due_time=%d", \
-               pid, g_quark_to_string(__alarm_info->quark_app_unique_name), \
-               g_quark_to_string(__alarm_info->quark_bundle), \
-                           alarm_context.c_due_time);
-
        if (alarm_context.c_due_time < current_time) {
                ALARM_MGR_EXCEPTION_PRINT("Caution!! alarm_context.c_due_time "
                "(%d) is less than current time(%d)", alarm_context.c_due_time,
@@ -1419,9 +1413,9 @@ static void __alarm_expired()
                                                else
                                                {
                                                        ALARM_MGR_LOG_PRINT("Successfuly ran app svc\n");
-                                                       bundle_free(b);
                                                }
                                        }
+                                       bundle_free(b);
                                }
 
                }
@@ -2070,6 +2064,81 @@ gboolean alarm_manager_alarm_get_list_of_ids(void *pObject, int pid,
        return true;
 }
 
+gboolean alarm_manager_alarm_get_appsvc_info(void *pObject, int pid, alarm_id_t alarm_id,
+                               char *e_cookie, gchar **b_data, int *return_code)
+{
+       bool found = false;
+
+       GSList *gs_iter = NULL;
+       __alarm_info_t *entry = NULL;
+
+       guchar *cookie = NULL;
+       gsize size;
+       int retval = 0;
+       gid_t call_gid;
+
+       ALARM_MGR_LOG_PRINT("called for  pid(%d) and alarm_id(%d)\n", pid,
+                           alarm_id);
+
+       cookie = g_base64_decode(e_cookie, &size);
+       if (NULL == cookie)
+       {
+               if (return_code)
+                       *return_code = ERR_ALARM_SYSTEM_FAIL;
+               ALARM_MGR_EXCEPTION_PRINT("Unable to decode cookie!!!\n");
+               return true;
+       }
+       call_gid = security_server_get_gid("alarm");
+
+       ALARM_MGR_LOG_PRINT("call_gid : %d\n", call_gid);
+
+       retval = security_server_check_privilege((const char *)cookie, call_gid);
+       if (retval < 0) {
+               if (retval == SECURITY_SERVER_API_ERROR_ACCESS_DENIED) {
+                       ALARM_MGR_EXCEPTION_PRINT(
+                               "%s", "access has been denied\n");
+               }
+               ALARM_MGR_EXCEPTION_PRINT("%s", "Error has occurred\n");
+
+               if (return_code)
+                       *return_code = ERR_ALARM_NO_PERMISSION;
+
+               if (cookie)
+                       g_free(cookie);
+
+               return true;
+       }
+
+       if (return_code)
+               *return_code = 0;
+
+       for (gs_iter = alarm_context.alarms; gs_iter != NULL;
+            gs_iter = g_slist_next(gs_iter)) {
+               entry = gs_iter->data;
+               if (entry->alarm_id == alarm_id) {
+                       found = true;
+                       *b_data = g_strdup(g_quark_to_string(entry->quark_bundle));
+                       break;
+               }
+       }
+
+       if (found) {
+               if ( *b_data && strlen(*b_data) == 4 && strncmp(*b_data,"null",4) == 0){
+                       ALARM_MGR_EXCEPTION_PRINT("Regular alarm,not svc alarm");
+                       if (return_code)
+                               *return_code = ERR_ALARM_INVALID_TYPE;
+               }
+       } else {
+               if (return_code)
+                       *return_code = ERR_ALARM_INVALID_ID;
+       }
+
+       if (cookie)
+               g_free(cookie);
+
+       return true;
+}
+
 gboolean alarm_manager_alarm_get_info(void *pObject, int pid,
                                      alarm_id_t alarm_id, int *start_year,
                                      int *start_month, int *start_day,
@@ -2102,7 +2171,7 @@ gboolean alarm_manager_alarm_get_info(void *pObject, int pid,
        {
                ALARM_MGR_EXCEPTION_PRINT("alarm id(%d) was not found\n",
                                          alarm_id);
-               *return_code = ERR_ALARM_INVALID_PARAM; /*TODO: ERR_ALARM_INVALID_ID?*/
+               *return_code = ERR_ALARM_INVALID_ID;
        } else {
                ALARM_MGR_LOG_PRINT("alarm was found\n");
                *start_year = alarm_info->start.year;
index df25669..549be8a 100644 (file)
@@ -7,6 +7,6 @@ localedir=@localedir@
 Name: alarm-service
 Description: alarm library
 Version: @VERSION@
-Requires: dbus-1 dbus-glib-1 glib-2.0 gobject-2.0 gconf-2.0 dlog
+Requires: dbus-1 dbus-glib-1 glib-2.0 gobject-2.0 dlog
 Libs: -L${libdir} -lalarm
 Cflags: -I${includedir}
index 4d9e08c..03aa308 100644 (file)
          <arg type="i" name="number_of_ids" direction="out" />
          <arg type="i" name="return_code" direction="out" />
     </method>
+       <method name="alarm_get_appsvc_info">
+         <arg type="i" name="pid" direction="in" />
+         <arg type="i" name="alarm_id" direction="in" />
+         <arg type="s" name="cookie" direction="in" />
+         <arg type="s" name="b_data" direction="out" />
+         <arg type="i" name="return_code" direction="out" />
+    </method>
     <method name="alarm_get_info">
          <arg type="i" name="pid" direction="in" />
          <arg type="i" name="alarm_id" direction="in" />
index 45bee13..40eaed4 100644 (file)
@@ -1,9 +1,10 @@
 #! /bin/sh
 # Attempt to guess a canonical system name.
 #   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-#   2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+#   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
+#   2011 Free Software Foundation, Inc.
 
-timestamp='2005-04-22'
+timestamp='2011-05-11'
 
 # 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
@@ -17,23 +18,25 @@ timestamp='2005-04-22'
 #
 # You should have received a copy of the GNU General Public License
 # along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
+# 02110-1301, USA.
 #
 # As a special exception to the GNU General Public License, if you
 # distribute this file as part of a program that contains a
 # 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.
+
+# Originally written by Per Bothner.  Please send patches (context
+# diff format) to <config-patches@gnu.org> and include a 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.
+# You can get the latest version of this script from:
+# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
 
 me=`echo "$0" | sed -e 's,.*/,,'`
 
@@ -53,8 +56,9 @@ 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.
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
+2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free
+Software Foundation, Inc.
 
 This is free software; see the source for copying conditions.  There is NO
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@@ -66,11 +70,11 @@ Try \`$me --help' for more information."
 while test $# -gt 0 ; do
   case $1 in
     --time-stamp | --time* | -t )
-       echo "$timestamp" ; exit ;;
+       echo "$timestamp" ; exit ;;
     --version | -v )
-       echo "$version" ; exit ;;
+       echo "$version" ; exit ;;
     --help | --h* | -h )
-       echo "$usage"; exit ;;
+       echo "$usage"; exit ;;
     -- )     # Stop option processing
        shift; break ;;
     - )        # Use stdin as input.
@@ -104,7 +108,7 @@ 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" ; } ||
+ { tmp=`(umask 077 && mktemp -d "$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 ; } ;
@@ -123,7 +127,7 @@ case $CC_FOR_BUILD,$HOST_CC,$CC in
        ;;
  ,,*)   CC_FOR_BUILD=$CC ;;
  ,*,*)  CC_FOR_BUILD=$HOST_CC ;;
-esac ;'
+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)
@@ -158,6 +162,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
            arm*) machine=arm-unknown ;;
            sh3el) machine=shl-unknown ;;
            sh3eb) machine=sh-unknown ;;
+           sh5el) machine=sh5le-unknown ;;
            *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
        esac
        # The Operating System including object format, if it has switched
@@ -166,7 +171,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 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
+                       | grep -q __ELF__
                then
                    # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
                    # Return netbsd for either.  FIX?
@@ -176,7 +181,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
                fi
                ;;
            *)
-               os=netbsd
+               os=netbsd
                ;;
        esac
        # The OS release
@@ -196,62 +201,30 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
        # contains redundant information, the shorter form:
        # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
        echo "${machine}-${os}${release}"
-       exit 0 ;;
-    amd64:OpenBSD:*:*)
-       echo x86_64-unknown-openbsd${UNAME_RELEASE}
-       exit 0 ;;
-    amiga:OpenBSD:*:*)
-       echo m68k-unknown-openbsd${UNAME_RELEASE}
-       exit 0 ;;
-    cats:OpenBSD:*:*)
-       echo arm-unknown-openbsd${UNAME_RELEASE}
-       exit 0 ;;
-    hp300:OpenBSD:*:*)
-       echo m68k-unknown-openbsd${UNAME_RELEASE}
-       exit 0 ;;
-    luna88k:OpenBSD:*:*)
-       echo m88k-unknown-openbsd${UNAME_RELEASE}
-       exit 0 ;;
-    mac68k:OpenBSD:*:*)
-       echo m68k-unknown-openbsd${UNAME_RELEASE}
-       exit 0 ;;
-    macppc:OpenBSD:*:*)
-       echo powerpc-unknown-openbsd${UNAME_RELEASE}
-       exit 0 ;;
-    mvme68k:OpenBSD:*:*)
-       echo m68k-unknown-openbsd${UNAME_RELEASE}
-       exit 0 ;;
-    mvme88k:OpenBSD:*:*)
-       echo m88k-unknown-openbsd${UNAME_RELEASE}
-       exit 0 ;;
-    mvmeppc:OpenBSD:*:*)
-       echo powerpc-unknown-openbsd${UNAME_RELEASE}
-       exit 0 ;;
-    sgi:OpenBSD:*:*)
-       echo mips64-unknown-openbsd${UNAME_RELEASE}
-       exit 0 ;;
-    sun3:OpenBSD:*:*)
-       echo m68k-unknown-openbsd${UNAME_RELEASE}
-       exit 0 ;;
+       exit ;;
     *:OpenBSD:*:*)
-       echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE}
-       exit 0 ;;
+       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 0 ;;
+       exit ;;
+    *:SolidBSD:*:*)
+       echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE}
+       exit ;;
     macppc:MirBSD:*:*)
-       echo powerppc-unknown-mirbsd${UNAME_RELEASE}
-       exit ;;
+       echo powerpc-unknown-mirbsd${UNAME_RELEASE}
+       exit ;;
     *:MirBSD:*:*)
        echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
-       exit ;;
+       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}'`
+               UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
                ;;
        esac
        # According to Compaq, /usr/sbin/psrinfo has been available on
@@ -297,40 +270,46 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
        # A Xn.n version is an unreleased experimental baselevel.
        # 1.2 uses "1.2" for uname -r.
        echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
-       exit 0 ;;
+       # Reset EXIT trap before exiting to avoid spurious non-zero exit code.
+       exitcode=$?
+       trap '' 0
+       exit $exitcode ;;
     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 ;;
+       exit ;;
     21064:Windows_NT:50:3)
        echo alpha-dec-winnt3.5
-       exit ;;
+       exit ;;
     Amiga*:UNIX_System_V:4.0:*)
        echo m68k-unknown-sysv4
-       exit 0;;
+       exit ;;
     *:[Aa]miga[Oo][Ss]:*:*)
        echo ${UNAME_MACHINE}-unknown-amigaos
-       exit ;;
+       exit ;;
     *:[Mm]orph[Oo][Ss]:*:*)
        echo ${UNAME_MACHINE}-unknown-morphos
-       exit ;;
+       exit ;;
     *:OS/390:*:*)
        echo i370-ibm-openedition
-       exit ;;
+       exit ;;
     *:z/VM:*:*)
        echo s390-ibm-zvmoe
-       exit ;;
+       exit ;;
     *:OS400:*:*)
-        echo powerpc-ibm-os400
-       exit ;;
+       echo powerpc-ibm-os400
+       exit ;;
     arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
        echo arm-acorn-riscix${UNAME_RELEASE}
-       exit 0;;
+       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 0;;
+       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
@@ -338,32 +317,51 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
        else
                echo pyramid-pyramid-bsd
        fi
-       exit ;;
+       exit ;;
     NILE*:*:*:dcosx)
        echo pyramid-pyramid-svr4
-       exit ;;
+       exit ;;
     DRS?6000:unix:4.0:6*)
        echo sparc-icl-nx6
-       exit ;;
+       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 0 ;;
+           sparc) echo sparc-icl-nx7; exit ;;
        esac ;;
+    s390x:SunOS:*:*)
+       echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+       exit ;;
     sun4H:SunOS:5.*:*)
        echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
-       exit ;;
+       exit ;;
     sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
        echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
-       exit 0 ;;
-    i86pc:SunOS:5.*:*)
-       echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
-       exit 0 ;;
+       exit ;;
+    i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*)
+       echo i386-pc-auroraux${UNAME_RELEASE}
+       exit ;;
+    i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
+       eval $set_cc_for_build
+       SUN_ARCH="i386"
+       # If there is a compiler, see if it is configured for 64-bit objects.
+       # Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
+       # This test works for both compilers.
+       if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
+           if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
+               (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
+               grep IS_64BIT_ARCH >/dev/null
+           then
+               SUN_ARCH="x86_64"
+           fi
+       fi
+       echo ${SUN_ARCH}-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 ;;
+       exit ;;
     sun4*:SunOS:*:*)
        case "`/usr/bin/arch -k`" in
            Series*|S4*)
@@ -372,10 +370,10 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
        esac
        # Japanese Language versions have a version number like `4.1.3-JL'.
        echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
-       exit ;;
+       exit ;;
     sun3*:SunOS:*:*)
        echo m68k-sun-sunos${UNAME_RELEASE}
-       exit ;;
+       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
@@ -387,10 +385,10 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
                echo sparc-sun-sunos${UNAME_RELEASE}
                ;;
        esac
-       exit ;;
+       exit ;;
     aushp:SunOS:*:*)
        echo sparc-auspex-sunos${UNAME_RELEASE}
-       exit ;;
+       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
@@ -400,41 +398,41 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
     # MiNT.  But MiNT is downward compatible to TOS, so this should
     # be no problem.
     atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
-        echo m68k-atari-mint${UNAME_RELEASE}
-       exit ;;
+       echo m68k-atari-mint${UNAME_RELEASE}
+       exit ;;
     atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
        echo m68k-atari-mint${UNAME_RELEASE}
-        exit 0 ;;
+       exit ;;
     *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
-        echo m68k-atari-mint${UNAME_RELEASE}
-       exit ;;
+       echo m68k-atari-mint${UNAME_RELEASE}
+       exit ;;
     milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
-        echo m68k-milan-mint${UNAME_RELEASE}
-        exit 0 ;;
+       echo m68k-milan-mint${UNAME_RELEASE}
+       exit ;;
     hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
-        echo m68k-hades-mint${UNAME_RELEASE}
-        exit 0 ;;
+       echo m68k-hades-mint${UNAME_RELEASE}
+       exit ;;
     *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
-        echo m68k-unknown-mint${UNAME_RELEASE}
-        exit 0 ;;
+       echo m68k-unknown-mint${UNAME_RELEASE}
+       exit ;;
     m68k:machten:*:*)
        echo m68k-apple-machten${UNAME_RELEASE}
-       exit ;;
+       exit ;;
     powerpc:machten:*:*)
        echo powerpc-apple-machten${UNAME_RELEASE}
-       exit ;;
+       exit ;;
     RISC*:Mach:*:*)
        echo mips-dec-mach_bsd4.3
-       exit ;;
+       exit ;;
     RISC*:ULTRIX:*:*)
        echo mips-dec-ultrix${UNAME_RELEASE}
-       exit ;;
+       exit ;;
     VAX*:ULTRIX*:*:*)
        echo vax-dec-ultrix${UNAME_RELEASE}
-       exit ;;
+       exit ;;
     2020:CLIX:*:* | 2430:CLIX:*:*)
        echo clipper-intergraph-clix${UNAME_RELEASE}
-       exit ;;
+       exit ;;
     mips:*:*:UMIPS | mips:*:*:RISCos)
        eval $set_cc_for_build
        sed 's/^        //' << EOF >$dummy.c
@@ -458,35 +456,36 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
          exit (-1);
        }
 EOF
-       $CC_FOR_BUILD -o $dummy $dummy.c \
-         && $dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \
-         && exit 0
+       $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 ;;
+       exit ;;
     Motorola:PowerMAX_OS:*:*)
        echo powerpc-motorola-powermax
-       exit ;;
+       exit ;;
     Motorola:*:4.3:PL8-*)
        echo powerpc-harris-powermax
-       exit ;;
+       exit ;;
     Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
        echo powerpc-harris-powermax
-       exit ;;
+       exit ;;
     Night_Hawk:Power_UNIX:*:*)
        echo powerpc-harris-powerunix
-       exit ;;
+       exit ;;
     m88k:CX/UX:7*:*)
        echo m88k-harris-cxux7
-       exit ;;
+       exit ;;
     m88k:*:4*:R4*)
        echo m88k-motorola-sysv4
-       exit ;;
+       exit ;;
     m88k:*:3*:R3*)
        echo m88k-motorola-sysv3
-       exit ;;
+       exit ;;
     AViiON:dgux:*:*)
-        # DG/UX returns AViiON for all architectures
-        UNAME_PROCESSOR=`/usr/bin/uname -p`
+       # DG/UX returns AViiON for all architectures
+       UNAME_PROCESSOR=`/usr/bin/uname -p`
        if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
        then
            if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
@@ -499,29 +498,29 @@ EOF
        else
            echo i586-dg-dgux${UNAME_RELEASE}
        fi
-       exit ;;
+       exit ;;
     M88*:DolphinOS:*:*)        # DolphinOS (SVR3)
        echo m88k-dolphin-sysv3
-       exit ;;
+       exit ;;
     M88*:*:R3*:*)
        # Delta 88k system running SVR3
        echo m88k-motorola-sysv3
-       exit ;;
+       exit ;;
     XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
        echo m88k-tektronix-sysv3
-       exit ;;
+       exit ;;
     Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
        echo m68k-tektronix-bsd
-       exit ;;
+       exit ;;
     *:IRIX*:*:*)
        echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
-       exit ;;
+       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 0 ;;              # Note that: echo "'`uname -s`'" gives '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 ;;
+       exit ;;
     ia64:AIX:*:*)
        if [ -x /usr/bin/oslevel ] ; then
                IBM_REV=`/usr/bin/oslevel`
@@ -529,7 +528,7 @@ EOF
                IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
        fi
        echo ${UNAME_MACHINE}-ibm-aix${IBM_REV}
-       exit ;;
+       exit ;;
     *:AIX:2:3)
        if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
                eval $set_cc_for_build
@@ -544,15 +543,19 @@ EOF
                        exit(0);
                        }
 EOF
-               $CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0
-               echo rs6000-ibm-aix3.2.5
+               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])
+       exit ;;
+    *:AIX:*:[4567])
        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
@@ -565,28 +568,28 @@ EOF
                IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
        fi
        echo ${IBM_ARCH}-ibm-aix${IBM_REV}
-       exit ;;
+       exit ;;
     *:AIX:*:*)
        echo rs6000-ibm-aix
-       exit ;;
+       exit ;;
     ibmrt:4.4BSD:*|romp-ibm:BSD:*)
        echo romp-ibm-bsd4.4
-       exit ;;
+       exit ;;
     ibmrt:*BSD:*|romp-ibm:BSD:*)            # covers RT/PC BSD and
        echo romp-ibm-bsd${UNAME_RELEASE}   # 4.3 with uname added to
-       exit 0 ;;                           # report: romp-ibm BSD 4.3
+       exit ;;                             # report: romp-ibm BSD 4.3
     *:BOSX:*:*)
        echo rs6000-bull-bosx
-       exit ;;
+       exit ;;
     DPX/2?00:B.O.S.:*:*)
        echo m68k-bull-sysv3
-       exit ;;
+       exit ;;
     9000/[34]??:4.3bsd:1.*:*)
        echo m68k-hp-bsd
-       exit ;;
+       exit ;;
     hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
        echo m68k-hp-bsd4.4
-       exit ;;
+       exit ;;
     9000/[34678]??:HP-UX:*:*)
        HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
        case "${UNAME_MACHINE}" in
@@ -595,52 +598,52 @@ EOF
            9000/[678][0-9][0-9])
                if [ -x /usr/bin/getconf ]; then
                    sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
-                    sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
-                    case "${sc_cpu_version}" in
-                      523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
-                      528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
-                      532)                      # CPU_PA_RISC2_0
-                        case "${sc_kernel_bits}" in
-                          32) HP_ARCH="hppa2.0n" ;;
-                          64) HP_ARCH="hppa2.0w" ;;
+                   sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
+                   case "${sc_cpu_version}" in
+                     523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
+                     528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
+                     532)                      # CPU_PA_RISC2_0
+                       case "${sc_kernel_bits}" in
+                         32) HP_ARCH="hppa2.0n" ;;
+                         64) HP_ARCH="hppa2.0w" ;;
                          '') HP_ARCH="hppa2.0" ;;   # HP-UX 10.20
-                        esac ;;
-                    esac
+                       esac ;;
+                   esac
                fi
                if [ "${HP_ARCH}" = "" ]; then
                    eval $set_cc_for_build
-                   sed 's/^              //' << EOF >$dummy.c
+                   sed 's/^            //' << EOF >$dummy.c
 
-              #define _HPUX_SOURCE
-              #include <stdlib.h>
-              #include <unistd.h>
+               #define _HPUX_SOURCE
+               #include <stdlib.h>
+               #include <unistd.h>
 
-              int main ()
-              {
-              #if defined(_SC_KERNEL_BITS)
-                  long bits = sysconf(_SC_KERNEL_BITS);
-              #endif
-                  long cpu  = sysconf (_SC_CPU_VERSION);
+               int main ()
+               {
+               #if defined(_SC_KERNEL_BITS)
+                   long bits = sysconf(_SC_KERNEL_BITS);
+               #endif
+                   long cpu  = sysconf (_SC_CPU_VERSION);
 
-                  switch (cpu)
-               {
-               case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
-               case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
-               case CPU_PA_RISC2_0:
-              #if defined(_SC_KERNEL_BITS)
-                   switch (bits)
-                       {
-                       case 64: puts ("hppa2.0w"); break;
-                       case 32: puts ("hppa2.0n"); break;
-                       default: puts ("hppa2.0"); break;
-                       } break;
-              #else  /* !defined(_SC_KERNEL_BITS) */
-                   puts ("hppa2.0"); break;
-              #endif
-               default: puts ("hppa1.0"); break;
-               }
-                  exit (0);
-              }
+                   switch (cpu)
+                       {
+                       case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
+                       case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
+                       case CPU_PA_RISC2_0:
+               #if defined(_SC_KERNEL_BITS)
+                           switch (bits)
+                               {
+                               case 64: puts ("hppa2.0w"); break;
+                               case 32: puts ("hppa2.0n"); break;
+                               default: puts ("hppa2.0"); break;
+                               } break;
+               #else  /* !defined(_SC_KERNEL_BITS) */
+                           puts ("hppa2.0"); break;
+               #endif
+                       default: puts ("hppa1.0"); break;
+                       }
+                   exit (0);
+               }
 EOF
                    (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
                    test -z "$HP_ARCH" && HP_ARCH=hppa
@@ -648,9 +651,19 @@ EOF
        esac
        if [ ${HP_ARCH} = "hppa2.0w" ]
        then
-           # avoid double evaluation of $set_cc_for_build
-           test -n "$CC_FOR_BUILD" || eval $set_cc_for_build
-           if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E -) | grep __LP64__ >/dev/null
+           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 -q __LP64__
            then
                HP_ARCH="hppa2.0w"
            else
@@ -658,11 +671,11 @@ EOF
            fi
        fi
        echo ${HP_ARCH}-hp-hpux${HPUX_REV}
-       exit ;;
+       exit ;;
     ia64:HP-UX:*:*)
        HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
        echo ia64-hp-hpux${HPUX_REV}
-       exit ;;
+       exit ;;
     3050*:HI-UX:*:*)
        eval $set_cc_for_build
        sed 's/^        //' << EOF >$dummy.c
@@ -690,219 +703,254 @@ EOF
          exit (0);
        }
 EOF
-       $CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0
+       $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` &&
+               { echo "$SYSTEM_NAME"; exit; }
        echo unknown-hitachi-hiuxwe2
-       exit ;;
+       exit ;;
     9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
        echo hppa1.1-hp-bsd
-       exit ;;
+       exit ;;
     9000/8??:4.3bsd:*:*)
        echo hppa1.0-hp-bsd
-       exit ;;
+       exit ;;
     *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
        echo hppa1.0-hp-mpeix
-       exit ;;
+       exit ;;
     hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
        echo hppa1.1-hp-osf
-       exit ;;
+       exit ;;
     hp8??:OSF1:*:*)
        echo hppa1.0-hp-osf
-       exit ;;
+       exit ;;
     i*86:OSF1:*:*)
        if [ -x /usr/sbin/sysversion ] ; then
            echo ${UNAME_MACHINE}-unknown-osf1mk
        else
            echo ${UNAME_MACHINE}-unknown-osf1
        fi
-       exit ;;
+       exit ;;
     parisc*:Lites*:*:*)
        echo hppa1.1-hp-lites
-       exit ;;
+       exit ;;
     C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
        echo c1-convex-bsd
-        exit 0 ;;
+       exit ;;
     C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
        if getsysinfo -f scalar_acc
        then echo c32-convex-bsd
        else echo c2-convex-bsd
        fi
-        exit 0 ;;
+       exit ;;
     C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
        echo c34-convex-bsd
-        exit 0 ;;
+       exit ;;
     C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
        echo c38-convex-bsd
-        exit 0 ;;
+       exit ;;
     C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
        echo c4-convex-bsd
-        exit 0 ;;
+       exit ;;
     CRAY*Y-MP:*:*:*)
        echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
-       exit ;;
+       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 ;;
+       exit ;;
     CRAY*TS:*:*:*)
        echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
-       exit ;;
+       exit ;;
     CRAY*T3E:*:*:*)
        echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
-       exit ;;
+       exit ;;
     CRAY*SV1:*:*:*)
        echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
-       exit ;;
+       exit ;;
     *:UNICOS/mp:*:*)
        echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
-       exit ;;
+       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 0 ;;
+       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 ;;
+       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 ;;
+       exit ;;
     sparc*:BSD/OS:*:*)
        echo sparc-unknown-bsdi${UNAME_RELEASE}
-       exit ;;
+       exit ;;
     *:BSD/OS:*:*)
        echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
-       exit ;;
+       exit ;;
     *:FreeBSD:*:*)
-       echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
-       exit 0 ;;
+       case ${UNAME_MACHINE} in
+           pc98)
+               echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
+           amd64)
+               echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
+           *)
+               echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
+       esac
+       exit ;;
     i*:CYGWIN*:*)
        echo ${UNAME_MACHINE}-pc-cygwin
-       exit ;;
-    i*:MINGW*:*)
+       exit ;;
+    *:MINGW*:*)
        echo ${UNAME_MACHINE}-pc-mingw32
-       exit 0 ;;
+       exit ;;
+    i*:windows32*:*)
+       # uname -m includes "-pc" on this system.
+       echo ${UNAME_MACHINE}-mingw32
+       exit ;;
     i*:PW*:*)
        echo ${UNAME_MACHINE}-pc-pw32
-       exit 0 ;;
-    x86:Interix*:[34]*)
-       echo i586-pc-interix${UNAME_RELEASE}|sed -e 's/\..*//'
-       exit 0 ;;
+       exit ;;
+    *:Interix*:*)
+       case ${UNAME_MACHINE} in
+           x86)
+               echo i586-pc-interix${UNAME_RELEASE}
+               exit ;;
+           authenticamd | genuineintel | EM64T)
+               echo x86_64-unknown-interix${UNAME_RELEASE}
+               exit ;;
+           IA64)
+               echo ia64-unknown-interix${UNAME_RELEASE}
+               exit ;;
+       esac ;;
     [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
        echo i${UNAME_MACHINE}-pc-mks
-       exit 0 ;;
+       exit ;;
+    8664:Windows_NT:*)
+       echo x86_64-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 ;;
+       exit ;;
     i*:UWIN*:*)
        echo ${UNAME_MACHINE}-pc-uwin
-       exit ;;
-    amd64:CYGWIN*:*:*)
+       exit ;;
+    amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
        echo x86_64-unknown-cygwin
-       exit ;;
+       exit ;;
     p*:CYGWIN*:*)
        echo powerpcle-unknown-cygwin
-       exit ;;
+       exit ;;
     prep*:SunOS:5.*:*)
        echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
-       exit ;;
+       exit ;;
     *:GNU:*:*)
        # the GNU system
        echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
-       exit ;;
+       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 ;;
+       exit ;;
     i*86:Minix:*:*)
        echo ${UNAME_MACHINE}-pc-minix
-       exit 0 ;;
+       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 -q ld.so.1
+       if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
+       echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
+       exit ;;
     arm*:Linux:*:*)
+       eval $set_cc_for_build
+       if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
+           | grep -q __ARM_EABI__
+       then
+           echo ${UNAME_MACHINE}-unknown-linux-gnu
+       else
+           if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
+               | grep -q __ARM_PCS_VFP
+           then
+               echo ${UNAME_MACHINE}-unknown-linux-gnueabi
+           else
+               echo ${UNAME_MACHINE}-unknown-linux-gnueabihf
+           fi
+       fi
+       exit ;;
+    avr32*:Linux:*:*)
        echo ${UNAME_MACHINE}-unknown-linux-gnu
-       exit ;;
+       exit ;;
     cris:Linux:*:*)
        echo cris-axis-linux-gnu
-       exit ;;
+       exit ;;
     crisv32:Linux:*:*)
        echo crisv32-axis-linux-gnu
-       exit ;;
+       exit ;;
     frv:Linux:*:*)
-       echo frv-unknown-linux-gnu
-       exit 0 ;;
+       echo frv-unknown-linux-gnu
+       exit ;;
+    i*86:Linux:*:*)
+       LIBC=gnu
+       eval $set_cc_for_build
+       sed 's/^        //' << EOF >$dummy.c
+       #ifdef __dietlibc__
+       LIBC=dietlibc
+       #endif
+EOF
+       eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'`
+       echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
+       exit ;;
     ia64:Linux:*:*)
        echo ${UNAME_MACHINE}-unknown-linux-gnu
-       exit ;;
+       exit ;;
     m32r*:Linux:*:*)
        echo ${UNAME_MACHINE}-unknown-linux-gnu
-       exit ;;
+       exit ;;
     m68*:Linux:*:*)
        echo ${UNAME_MACHINE}-unknown-linux-gnu
-       exit ;;
-    mips:Linux:*:*)
+       exit ;;
+    mips:Linux:*:* | mips64:Linux:*:*)
        eval $set_cc_for_build
        sed 's/^        //' << EOF >$dummy.c
        #undef CPU
-       #undef mips
-       #undef mipsel
+       #undef ${UNAME_MACHINE}
+       #undef ${UNAME_MACHINE}el
        #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
-       CPU=mipsel
+       CPU=${UNAME_MACHINE}el
        #else
        #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
-       CPU=mips
+       CPU=${UNAME_MACHINE}
        #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 0
+       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 0
-       ;;
-    ppc:Linux:*:*)
-       echo powerpc-unknown-linux-gnu
-       exit 0 ;;
-    ppc64:Linux:*:*)
-       echo powerpc64-unknown-linux-gnu
-       exit 0 ;;
-    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 0 ;;
+    or32:Linux:*:*)
+       echo or32-unknown-linux-gnu
+       exit ;;
+    padre:Linux:*:*)
+       echo sparc-unknown-linux-gnu
+       exit ;;
+    parisc64:Linux:*:* | hppa64:Linux:*:*)
+       echo hppa64-unknown-linux-gnu
+       exit ;;
     parisc:Linux:*:* | hppa:Linux:*:*)
        # Look for CPU level
        case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
@@ -910,115 +958,71 @@ EOF
          PA8*) echo hppa2.0-unknown-linux-gnu ;;
          *)    echo hppa-unknown-linux-gnu ;;
        esac
-       exit 0 ;;
-    parisc64:Linux:*:* | hppa64:Linux:*:*)
-       echo hppa64-unknown-linux-gnu
-       exit 0 ;;
+       exit ;;
+    ppc64:Linux:*:*)
+       echo powerpc64-unknown-linux-gnu
+       exit ;;
+    ppc:Linux:*:*)
+       echo powerpc-unknown-linux-gnu
+       exit ;;
     s390:Linux:*:* | s390x:Linux:*:*)
        echo ${UNAME_MACHINE}-ibm-linux
-       exit ;;
+       exit ;;
     sh64*:Linux:*:*)
-       echo ${UNAME_MACHINE}-unknown-linux-gnu
-       exit ;;
+       echo ${UNAME_MACHINE}-unknown-linux-gnu
+       exit ;;
     sh*:Linux:*:*)
        echo ${UNAME_MACHINE}-unknown-linux-gnu
-       exit ;;
+       exit ;;
     sparc:Linux:*:* | sparc64:Linux:*:*)
        echo ${UNAME_MACHINE}-unknown-linux-gnu
-       exit 0 ;;
+       exit ;;
+    tile*:Linux:*:*)
+       echo ${UNAME_MACHINE}-tilera-linux-gnu
+       exit ;;
+    vax:Linux:*:*)
+       echo ${UNAME_MACHINE}-dec-linux-gnu
+       exit ;;
     x86_64:Linux:*:*)
        echo x86_64-unknown-linux-gnu
-       exit 0 ;;
-    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 0 ;;
-         coff-i386)
-               echo "${UNAME_MACHINE}-pc-linux-gnucoff"
-               exit 0 ;;
-         "")
-               # 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 0 ;;
-       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 0
-       test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0
-       ;;
+       exit ;;
+    xtensa*:Linux:*:*)
+       echo ${UNAME_MACHINE}-unknown-linux-gnu
+       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 ;;
+       exit ;;
     i*86:UNIX_SV:4.2MP:2.*)
-        # Unixware is an offshoot of SVR4, but it has its own version
-        # number series starting with 2...
-        # I am not positive that other SVR4 systems won't match this,
+       # Unixware is an offshoot of SVR4, but it has its own version
+       # number series starting with 2...
+       # I am not positive that other SVR4 systems won't match this,
        # I just have to hope.  -- rms.
-        # Use sysv4.2uw... so that sysv4* matches it.
+       # Use sysv4.2uw... so that sysv4* matches it.
        echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
-       exit ;;
+       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 ;;
+       exit ;;
     i*86:XTS-300:*:STOP)
        echo ${UNAME_MACHINE}-unknown-stop
-       exit ;;
+       exit ;;
     i*86:atheos:*:*)
        echo ${UNAME_MACHINE}-unknown-atheos
-       exit ;;
-       i*86:syllable:*:*)
+       exit ;;
+    i*86:syllable:*:*)
        echo ${UNAME_MACHINE}-pc-syllable
-       exit ;;
-    i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)
+       exit ;;
+    i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*)
        echo i386-unknown-lynxos${UNAME_RELEASE}
-       exit ;;
+       exit ;;
     i*86:*DOS:*:*)
        echo ${UNAME_MACHINE}-pc-msdosdjgpp
-       exit ;;
+       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
@@ -1026,15 +1030,16 @@ EOF
        else
                echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
        fi
-       exit 0 ;;
-    i*86:*:5:[78]*)
+       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 ;;
+       exit ;;
     i*86:*:3.2:*)
        if test -f /usr/options/cb.name; then
                UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
@@ -1052,73 +1057,86 @@ EOF
        else
                echo ${UNAME_MACHINE}-pc-sysv32
        fi
-       exit ;;
+       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 0 ;;
+       # uname -m prints for DJGPP always 'pc', but it prints nothing about
+       # the processor, so we play safe by assuming i586.
+       # Note: whatever this is, it MUST be the same as what config.sub
+       # prints for the "djgpp" host, or else GDB configury will decide that
+       # this is a cross-build.
+       echo i586-pc-msdosdjgpp
+       exit ;;
     Intel:Mach:3*:*)
        echo i386-pc-mach3
-       exit ;;
+       exit ;;
     paragon:*:*:*)
        echo i860-intel-osf1
-       exit ;;
+       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 ;;
+       exit ;;
     mini*:CTIX:SYS*5:*)
        # "miniframe"
        echo m68010-convergent-sysv
-       exit ;;
+       exit ;;
     mc68k:UNIX:SYSTEM5:3.51m)
        echo m68k-convergent-sysv
-       exit ;;
+       exit ;;
     M680?0:D-NIX:5.3:*)
        echo m68k-diab-dnix
-       exit ;;
+       exit ;;
     M68*:*:R3V[5678]*:*)
-       test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;;
+       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 0
+         && { 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 0 ;;
+         && { 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 0 ;;
+       /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+         && { echo i486-ncr-sysv4; exit; } ;;
+    NCR*:*:4.2:* | MPRAS*:*:4.2:*)
+       OS_REL='.3'
+       test -r /etc/.relid \
+           && 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; }
+       /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \
+           && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
     m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
        echo m68k-unknown-lynxos${UNAME_RELEASE}
-       exit ;;
+       exit ;;
     mc68030:UNIX_System_V:4.*:*)
        echo m68k-atari-sysv4
-       exit ;;
+       exit ;;
     TSUNAMI:LynxOS:2.*:*)
        echo sparc-unknown-lynxos${UNAME_RELEASE}
-       exit ;;
+       exit ;;
     rs6000:LynxOS:2.*:*)
        echo rs6000-unknown-lynxos${UNAME_RELEASE}
-       exit ;;
-    PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*)
+       exit ;;
+    PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*)
        echo powerpc-unknown-lynxos${UNAME_RELEASE}
-       exit ;;
+       exit ;;
     SM[BE]S:UNIX_SV:*:*)
        echo mips-dde-sysv${UNAME_RELEASE}
-       exit ;;
+       exit ;;
     RM*:ReliantUNIX-*:*:*)
        echo mips-sni-sysv4
-       exit ;;
+       exit ;;
     RM*:SINIX-*:*:*)
        echo mips-sni-sysv4
-       exit ;;
+       exit ;;
     *:SINIX-*:*:*)
        if uname -p 2>/dev/null >/dev/null ; then
                UNAME_MACHINE=`(uname -p) 2>/dev/null`
@@ -1126,73 +1144,94 @@ EOF
        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 0 ;;
+       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 ;;
+       exit ;;
     *:*:*:FTX*)
        # From seanf@swdc.stratus.com.
        echo i860-stratus-sysv4
-       exit ;;
+       exit ;;
     i*86:VOS:*:*)
        # From Paul.Green@stratus.com.
        echo ${UNAME_MACHINE}-stratus-vos
-       exit ;;
+       exit ;;
     *:VOS:*:*)
        # From Paul.Green@stratus.com.
        echo hppa1.1-stratus-vos
-       exit ;;
+       exit ;;
     mc68*:A/UX:*:*)
        echo m68k-apple-aux${UNAME_RELEASE}
-       exit ;;
+       exit ;;
     news*:NEWS-OS:6*:*)
        echo mips-sony-newsos6
-       exit ;;
+       exit ;;
     R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
        if [ -d /usr/nec ]; then
-               echo mips-nec-sysv${UNAME_RELEASE}
+               echo mips-nec-sysv${UNAME_RELEASE}
        else
-               echo mips-unknown-sysv${UNAME_RELEASE}
+               echo mips-unknown-sysv${UNAME_RELEASE}
        fi
-        exit 0 ;;
+       exit ;;
     BeBox:BeOS:*:*)    # BeOS running on hardware made by Be, PPC only.
        echo powerpc-be-beos
-       exit ;;
+       exit ;;
     BeMac:BeOS:*:*)    # BeOS running on Mac or Mac clone, PPC only.
        echo powerpc-apple-beos
-       exit ;;
+       exit ;;
     BePC:BeOS:*:*)     # BeOS running on Intel PC compatible.
        echo i586-pc-beos
-       exit 0 ;;
+       exit ;;
+    BePC:Haiku:*:*)    # Haiku running on Intel PC compatible.
+       echo i586-pc-haiku
+       exit ;;
     SX-4:SUPER-UX:*:*)
        echo sx4-nec-superux${UNAME_RELEASE}
-       exit ;;
+       exit ;;
     SX-5:SUPER-UX:*:*)
        echo sx5-nec-superux${UNAME_RELEASE}
-       exit ;;
+       exit ;;
     SX-6:SUPER-UX:*:*)
        echo sx6-nec-superux${UNAME_RELEASE}
-       exit 0 ;;
+       exit ;;
+    SX-7:SUPER-UX:*:*)
+       echo sx7-nec-superux${UNAME_RELEASE}
+       exit ;;
+    SX-8:SUPER-UX:*:*)
+       echo sx8-nec-superux${UNAME_RELEASE}
+       exit ;;
+    SX-8R:SUPER-UX:*:*)
+       echo sx8r-nec-superux${UNAME_RELEASE}
+       exit ;;
     Power*:Rhapsody:*:*)
        echo powerpc-apple-rhapsody${UNAME_RELEASE}
-       exit ;;
+       exit ;;
     *:Rhapsody:*:*)
        echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
-       exit ;;
+       exit ;;
     *:Darwin:*:*)
        UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
        case $UNAME_PROCESSOR in
-           *86) UNAME_PROCESSOR=i686 ;;
+           i386)
+               eval $set_cc_for_build
+               if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
+                 if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
+                     (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
+                     grep IS_64BIT_ARCH >/dev/null
+                 then
+                     UNAME_PROCESSOR="x86_64"
+                 fi
+               fi ;;
            unknown) UNAME_PROCESSOR=powerpc ;;
        esac
        echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
-       exit ;;
+       exit ;;
     *:procnto*:*:* | *:QNX:[0123456789]*:*)
        UNAME_PROCESSOR=`uname -p`
        if test "$UNAME_PROCESSOR" = "x86"; then
@@ -1200,25 +1239,28 @@ EOF
                UNAME_MACHINE=pc
        fi
        echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE}
-       exit ;;
+       exit ;;
     *:QNX:*:4*)
        echo i386-pc-qnx
-       exit 0 ;;
+       exit ;;
+    NEO-?:NONSTOP_KERNEL:*:*)
+       echo neo-tandem-nsk${UNAME_RELEASE}
+       exit ;;
     NSE-?:NONSTOP_KERNEL:*:*)
        echo nse-tandem-nsk${UNAME_RELEASE}
-       exit ;;
+       exit ;;
     NSR-?:NONSTOP_KERNEL:*:*)
        echo nsr-tandem-nsk${UNAME_RELEASE}
-       exit ;;
+       exit ;;
     *:NonStop-UX:*:*)
        echo mips-compaq-nonstopux
-       exit ;;
+       exit ;;
     BS2000:POSIX*:*:*)
        echo bs2000-siemens-sysv
-       exit ;;
+       exit ;;
     DS/*:UNIX_System_V:*:*)
        echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}
-       exit ;;
+       exit ;;
     *:Plan9:*:*)
        # "uname -m" is not consistent, so use $cputype instead. 386
        # is converted to i386 for consistency with other x86
@@ -1229,41 +1271,50 @@ EOF
            UNAME_MACHINE="$cputype"
        fi
        echo ${UNAME_MACHINE}-unknown-plan9
-       exit ;;
+       exit ;;
     *:TOPS-10:*:*)
        echo pdp10-unknown-tops10
-       exit ;;
+       exit ;;
     *:TENEX:*:*)
        echo pdp10-unknown-tenex
-       exit ;;
+       exit ;;
     KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
        echo pdp10-dec-tops20
-       exit ;;
+       exit ;;
     XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
        echo pdp10-xkl-tops20
-       exit ;;
+       exit ;;
     *:TOPS-20:*:*)
        echo pdp10-unknown-tops20
-       exit ;;
+       exit ;;
     *:ITS:*:*)
        echo pdp10-unknown-its
-       exit ;;
+       exit ;;
     SEI:*:*:SEIUX)
-        echo mips-sei-seiux${UNAME_RELEASE}
-       exit ;;
+       echo mips-sei-seiux${UNAME_RELEASE}
+       exit ;;
     *:DragonFly:*:*)
        echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
-       exit ;;
+       exit ;;
     *:*VMS:*:*)
-       UNAME_MACHINE=`(uname -p) 2>/dev/null`
+       UNAME_MACHINE=`(uname -p) 2>/dev/null`
        case "${UNAME_MACHINE}" in
-           A*) echo alpha-dec-vms && exit 0 ;;
-           I*) echo ia64-dec-vms && exit 0 ;;
-           V*) echo vax-dec-vms && exit 0 ;;
+           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 0 ;;
+       exit ;;
+    i*86:skyos:*:*)
+       echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//'
+       exit ;;
+    i*86:rdos:*:*)
+       echo ${UNAME_MACHINE}-pc-rdos
+       exit ;;
+    i*86:AROS:*:*)
+       echo ${UNAME_MACHINE}-pc-aros
+       exit ;;
 esac
 
 #echo '(No uname command or uname output not recognized.)' 1>&2
@@ -1286,16 +1337,16 @@ main ()
 #include <sys/param.h>
   printf ("m68k-sony-newsos%s\n",
 #ifdef NEWSOS4
-          "4"
+       "4"
 #else
-         ""
+       ""
 #endif
-         ); exit (0);
+       ); exit (0);
 #endif
 #endif
 
 #if defined (__arm) && defined (__acorn) && defined (__unix)
-  printf ("arm-acorn-riscix"); exit (0);
+  printf ("arm-acorn-riscix\n"); exit (0);
 #endif
 
 #if defined (hp300) && !defined (hpux)
@@ -1384,11 +1435,12 @@ main ()
 }
 EOF
 
-$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && $dummy && exit 0
+$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 0; }
+test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; }
 
 # Convex versions that predate uname can use getsysinfo(1)
 
@@ -1397,22 +1449,22 @@ then
     case `getsysinfo -f cpu_type` in
     c1*)
        echo c1-convex-bsd
-       exit ;;
+       exit ;;
     c2*)
        if getsysinfo -f scalar_acc
        then echo c32-convex-bsd
        else echo c2-convex-bsd
        fi
-       exit ;;
+       exit ;;
     c34*)
        echo c34-convex-bsd
-       exit ;;
+       exit ;;
     c38*)
        echo c38-convex-bsd
-       exit ;;
+       exit ;;
     c4*)
        echo c4-convex-bsd
-       exit ;;
+       exit ;;
     esac
 fi
 
@@ -1423,9 +1475,9 @@ 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
+  http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
 and
-  http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.sub
+  http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
 
 If the version you run ($0) is already up to date, please
 send the following data and any information you think might be
index 87a1ee4..30fdca8 100644 (file)
@@ -1,9 +1,10 @@
 #! /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.
+#   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
+#   2011 Free Software Foundation, Inc.
 
-timestamp='2005-04-22'
+timestamp='2011-03-23'
 
 # This file is (in principle) common to ALL GNU software.
 # The presence of a machine in this file suggests that SOME GNU software
@@ -21,22 +22,26 @@ timestamp='2005-04-22'
 #
 # You should have received a copy of the GNU General Public License
 # along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330,
-# Boston, MA 02111-1307, USA.
-
+# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
+# 02110-1301, USA.
+#
 # As a special exception to the GNU General Public License, if you
 # distribute this file as part of a program that contains a
 # 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.
+# diff and a properly formatted GNU 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.
 
+# You can get the latest version of this script from:
+# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
+
 # 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.
@@ -70,8 +75,9 @@ 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.
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
+2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free
+Software Foundation, Inc.
 
 This is free software; see the source for copying conditions.  There is NO
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@@ -83,11 +89,11 @@ Try \`$me --help' for more information."
 while test $# -gt 0 ; do
   case $1 in
     --time-stamp | --time* | -t )
-       echo "$timestamp" ; exit ;;
+       echo "$timestamp" ; exit ;;
     --version | -v )
-       echo "$version" ; exit ;;
+       echo "$version" ; exit ;;
     --help | --h* | -h )
-       echo "$usage"; exit ;;
+       echo "$usage"; exit ;;
     -- )     # Stop option processing
        shift; break ;;
     - )        # Use stdin as input.
@@ -99,7 +105,7 @@ while test $# -gt 0 ; do
     *local*)
        # First pass through any local machine types.
        echo $1
-       exit 0;;
+       exit ;;
 
     * )
        break ;;
@@ -118,8 +124,11 @@ esac
 # Here we must recognize all the valid KERNEL-OS combinations.
 maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
 case $maybe_os in
-  nto-qnx* | linux-gnu* | linux-dietlibc | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | \
-  kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | storm-chaos* | os2-emx* | rtmk-nova*)
+  nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \
+  linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \
+  knetbsd*-gnu* | netbsd*-gnu* | \
+  kopensolaris*-gnu* | \
+  storm-chaos* | os2-emx* | rtmk-nova*)
     os=-$maybe_os
     basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
     ;;
@@ -145,10 +154,13 @@ case $os in
        -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)
+       -apple | -axis | -knuth | -cray | -microblaze)
                os=
                basic_machine=$1
                ;;
+       -bluegene*)
+               os=-cnk
+               ;;
        -sim | -cisco | -oki | -wec | -winbond)
                os=
                basic_machine=$1
@@ -163,13 +175,17 @@ case $os in
                os=-chorusos
                basic_machine=$1
                ;;
-       -chorusrdb)
-               os=-chorusrdb
+       -chorusrdb)
+               os=-chorusrdb
                basic_machine=$1
-               ;;
+               ;;
        -hiux*)
                os=-hiuxwe2
                ;;
+       -sco6)
+               os=-sco5v6
+               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+               ;;
        -sco5)
                os=-sco3.2v5
                basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
@@ -186,6 +202,10 @@ case $os in
                # Don't forget version if it is 3.2v4 or newer.
                basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
                ;;
+       -sco5v6*)
+               # Don't forget version if it is 3.2v4 or newer.
+               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+               ;;
        -sco*)
                os=-sco3.2v2
                basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
@@ -230,23 +250,28 @@ case $basic_machine in
        | 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 \
+       | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \
        | bfin \
        | c4x | clipper \
        | d10v | d30v | dlx | dsp16xx \
-       | fr30 | frv \
+       | fido | 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 \
+       | lm32 \
+       | m32c | m32r | m32rle | m68000 | m68k | m88k \
+       | maxq | mb | microblaze | mcore | mep | metag \
        | mips | mipsbe | mipseb | mipsel | mipsle \
        | mips16 \
        | mips64 | mips64el \
-       | mips64vr | mips64vrel \
+       | mips64octeon | mips64octeonel \
        | mips64orion | mips64orionel \
+       | mips64r5900 | mips64r5900el \
+       | mips64vr | mips64vrel \
        | mips64vr4100 | mips64vr4100el \
        | mips64vr4300 | mips64vr4300el \
        | mips64vr5000 | mips64vr5000el \
+       | mips64vr5900 | mips64vr5900el \
        | mipsisa32 | mipsisa32el \
        | mipsisa32r2 | mipsisa32r2el \
        | mipsisa64 | mipsisa64el \
@@ -255,31 +280,63 @@ case $basic_machine in
        | mipsisa64sr71k | mipsisa64sr71kel \
        | mipstx39 | mipstx39el \
        | mn10200 | mn10300 \
+       | moxie \
+       | mt \
        | msp430 \
+       | nds32 | nds32le | nds32be \
+       | nios | nios2 \
        | ns16k | ns32k \
-       | openrisc | or32 \
+       | open8 \
+       | or32 \
        | pdp10 | pdp11 | pj | pjl \
-       | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
+       | powerpc | powerpc64 | powerpc64le | powerpcle \
        | pyramid \
-       | sh | sh[1234] | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \
+       | rx \
+       | score \
+       | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
        | sh64 | sh64le \
-       | sparc | sparc64 | sparc64b | sparc86x | sparclet | sparclite \
-       | sparcv8 | sparcv9 | sparcv9b \
-       | strongarm \
-       | tahoe | thumb | tic4x | tic80 | tron \
+       | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
+       | sparcv8 | sparcv9 | sparcv9b | sparcv9v \
+       | spu \
+       | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \
+       | ubicom32 \
        | v850 | v850e \
        | we32k \
-       | x86 | xscale | xscalee[bl] | xstormy16 | xtensa \
-       | z8k)
+       | x86 | xc16x | xstormy16 | xtensa \
+       | z8k | z80)
                basic_machine=$basic_machine-unknown
                ;;
-       m6811 | m68hc11 | m6812 | m68hc12)
+       c54x)
+               basic_machine=tic54x-unknown
+               ;;
+       c55x)
+               basic_machine=tic55x-unknown
+               ;;
+       c6x)
+               basic_machine=tic6x-unknown
+               ;;
+       m6811 | m68hc11 | m6812 | m68hc12 | picochip)
                # Motorola 68HC11/12.
                basic_machine=$basic_machine-unknown
                os=-none
                ;;
        m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k)
                ;;
+       ms1)
+               basic_machine=mt-unknown
+               ;;
+
+       strongarm | thumb | xscale)
+               basic_machine=arm-unknown
+               ;;
+
+       xscaleeb)
+               basic_machine=armeb-unknown
+               ;;
+
+       xscaleel)
+               basic_machine=armel-unknown
+               ;;
 
        # We use `pc' rather than `unknown'
        # because (1) that's what they normally are, and
@@ -299,28 +356,32 @@ case $basic_machine in
        | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
        | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
        | arm-*  | armbe-* | armle-* | armeb-* | armv*-* \
-       | avr-* \
+       | avr-* | avr32-* \
        | bfin-* | bs2000-* \
-       | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \
+       | c[123]* | c30-* | [cjt]90-* | c4x-* \
        | clipper-* | craynv-* | cydra-* \
        | d10v-* | d30v-* | dlx-* \
        | elxsi-* \
-       | f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \
+       | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
        | h8300-* | h8500-* \
        | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
        | i*86-* | i860-* | i960-* | ia64-* \
        | ip2k-* | iq2000-* \
-       | m32r-* | m32rle-* \
+       | lm32-* \
+       | m32c-* | m32r-* | m32rle-* \
        | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
-       | m88110-* | m88k-* | maxq-* | mcore-* \
+       | m88110-* | m88k-* | maxq-* | mcore-* | metag-* | microblaze-* \
        | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
        | mips16-* \
        | mips64-* | mips64el-* \
-       | mips64vr-* | mips64vrel-* \
+       | mips64octeon-* | mips64octeonel-* \
        | mips64orion-* | mips64orionel-* \
+       | mips64r5900-* | mips64r5900el-* \
+       | mips64vr-* | mips64vrel-* \
        | mips64vr4100-* | mips64vr4100el-* \
        | mips64vr4300-* | mips64vr4300el-* \
        | mips64vr5000-* | mips64vr5000el-* \
+       | mips64vr5900-* | mips64vr5900el-* \
        | mipsisa32-* | mipsisa32el-* \
        | mipsisa32r2-* | mipsisa32r2el-* \
        | mipsisa64-* | mipsisa64el-* \
@@ -329,27 +390,37 @@ case $basic_machine in
        | mipsisa64sr71k-* | mipsisa64sr71kel-* \
        | mipstx39-* | mipstx39el-* \
        | mmix-* \
+       | mt-* \
        | msp430-* \
+       | nds32-* | nds32le-* | nds32be-* \
+       | nios-* | nios2-* \
        | none-* | np1-* | ns16k-* | ns32k-* \
+       | open8-* \
        | orion-* \
        | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
-       | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
+       | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \
        | pyramid-* \
-       | romp-* | rs6000-* \
-       | sh-* | sh[1234]-* | sh[23]e-* | sh[34]eb-* | shbe-* \
+       | romp-* | rs6000-* | rx-* \
+       | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
        | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
-       | sparc-* | sparc64-* | sparc64b-* | sparc86x-* | sparclet-* \
+       | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
        | sparclite-* \
-       | sparcv8-* | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \
-       | tahoe-* | thumb-* \
+       | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \
+       | tahoe-* \
        | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
+       | tile-* | tilegx-* \
        | tron-* \
+       | ubicom32-* \
        | v850-* | v850e-* | vax-* \
        | we32k-* \
-       | x86-* | x86_64-* | xps100-* | xscale-* | xscalee[bl]-* \
-       | xstormy16-* | xtensa-* \
+       | x86-* | x86_64-* | xc16x-* | xps100-* \
+       | xstormy16-* | xtensa*-* \
        | ymp-* \
-       | z8k-*)
+       | z8k-* | z80-*)
+               ;;
+       # Recognize the basic CPU types without company name, with glob match.
+       xtensa*)
+               basic_machine=$basic_machine-unknown
                ;;
        # Recognize the various machine names and aliases which stand
        # for a CPU type and a company and sometimes even an OS.
@@ -367,7 +438,7 @@ case $basic_machine in
                basic_machine=a29k-amd
                os=-udi
                ;;
-       abacus)
+       abacus)
                basic_machine=abacus-unknown
                ;;
        adobe68k)
@@ -413,6 +484,10 @@ case $basic_machine in
                basic_machine=m68k-apollo
                os=-bsd
                ;;
+       aros)
+               basic_machine=i386-pc
+               os=-aros
+               ;;
        aux)
                basic_machine=m68k-apple
                os=-aux
@@ -421,10 +496,35 @@ case $basic_machine in
                basic_machine=ns32k-sequent
                os=-dynix
                ;;
+       blackfin)
+               basic_machine=bfin-unknown
+               os=-linux
+               ;;
+       blackfin-*)
+               basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'`
+               os=-linux
+               ;;
+       bluegene*)
+               basic_machine=powerpc-ibm
+               os=-cnk
+               ;;
+       c54x-*)
+               basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'`
+               ;;
+       c55x-*)
+               basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'`
+               ;;
+       c6x-*)
+               basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'`
+               ;;
        c90)
                basic_machine=c90-cray
                os=-unicos
                ;;
+       cegcc)
+               basic_machine=arm-unknown
+               os=-cegcc
+               ;;
        convex-c1)
                basic_machine=c1-convex
                os=-bsd
@@ -453,8 +553,8 @@ case $basic_machine in
                basic_machine=craynv-cray
                os=-unicosmp
                ;;
-       cr16c)
-               basic_machine=cr16c-unknown
+       cr16 | cr16-*)
+               basic_machine=cr16-unknown
                os=-elf
                ;;
        crds | unos)
@@ -492,6 +592,10 @@ case $basic_machine in
                basic_machine=m88k-motorola
                os=-sysv3
                ;;
+       dicos)
+               basic_machine=i686-pc
+               os=-dicos
+               ;;
        djgpp)
                basic_machine=i586-pc
                os=-msdosdjgpp
@@ -646,6 +750,14 @@ case $basic_machine in
                basic_machine=m68k-isi
                os=-sysv
                ;;
+       m68knommu)
+               basic_machine=m68k-unknown
+               os=-linux
+               ;;
+       m68knommu-*)
+               basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'`
+               os=-linux
+               ;;
        m88k-omron*)
                basic_machine=m88k-omron
                ;;
@@ -657,10 +769,17 @@ case $basic_machine in
                basic_machine=ns32k-utek
                os=-sysv
                ;;
+       microblaze)
+               basic_machine=microblaze-xilinx
+               ;;
        mingw32)
                basic_machine=i386-pc
                os=-mingw32
                ;;
+       mingw32ce)
+               basic_machine=arm-unknown
+               os=-mingw32ce
+               ;;
        miniframe)
                basic_machine=m68000-convergent
                ;;
@@ -686,6 +805,9 @@ case $basic_machine in
                basic_machine=i386-pc
                os=-msdos
                ;;
+       ms1-*)
+               basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`
+               ;;
        mvs)
                basic_machine=i370-ibm
                os=-mvs
@@ -754,6 +876,12 @@ case $basic_machine in
        np1)
                basic_machine=np1-gould
                ;;
+       neo-tandem)
+               basic_machine=neo-tandem
+               ;;
+       nse-tandem)
+               basic_machine=nse-tandem
+               ;;
        nsr-tandem)
                basic_machine=nsr-tandem
                ;;
@@ -761,9 +889,8 @@ case $basic_machine in
                basic_machine=hppa1.1-oki
                os=-proelf
                ;;
-       or32 | or32-*)
+       openrisc | openrisc-*)
                basic_machine=or32-unknown
-               os=-coff
                ;;
        os400)
                basic_machine=powerpc-ibm
@@ -785,6 +912,14 @@ case $basic_machine in
                basic_machine=i860-intel
                os=-osf
                ;;
+       parisc)
+               basic_machine=hppa-unknown
+               os=-linux
+               ;;
+       parisc-*)
+               basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'`
+               os=-linux
+               ;;
        pbd)
                basic_machine=sparc-tti
                ;;
@@ -794,6 +929,12 @@ case $basic_machine in
        pc532 | pc532-*)
                basic_machine=ns32k-pc532
                ;;
+       pc98)
+               basic_machine=i386-pc
+               ;;
+       pc98-*)
+               basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'`
+               ;;
        pentium | p5 | k5 | k6 | nexgen | viac3)
                basic_machine=i586-pc
                ;;
@@ -823,9 +964,10 @@ case $basic_machine in
                ;;
        power)  basic_machine=power-ibm
                ;;
-       ppc)    basic_machine=powerpc-unknown
+       ppc | ppcbe)    basic_machine=powerpc-unknown
                ;;
-       ppc-*)  basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
+       ppc-* | ppcbe-*)
+               basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
                ;;
        ppcle | powerpclittle | ppc-le | powerpc-little)
                basic_machine=powerpcle-unknown
@@ -850,6 +992,10 @@ case $basic_machine in
                basic_machine=i586-unknown
                os=-pw32
                ;;
+       rdos)
+               basic_machine=i386-pc
+               os=-rdos
+               ;;
        rom68k)
                basic_machine=m68k-rom68k
                os=-coff
@@ -876,6 +1022,10 @@ case $basic_machine in
        sb1el)
                basic_machine=mipsisa64sb1el-unknown
                ;;
+       sde)
+               basic_machine=mipsisa32-sde
+               os=-elf
+               ;;
        sei)
                basic_machine=mips-sei
                os=-seiux
@@ -887,6 +1037,9 @@ case $basic_machine in
                basic_machine=sh-hitachi
                os=-hms
                ;;
+       sh5el)
+               basic_machine=sh5le-unknown
+               ;;
        sh64)
                basic_machine=sh64-unknown
                ;;
@@ -908,6 +1061,9 @@ case $basic_machine in
                basic_machine=i860-stratus
                os=-sysv4
                ;;
+       strongarm-* | thumb-*)
+               basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'`
+               ;;
        sun2)
                basic_machine=m68000-sun
                ;;
@@ -964,17 +1120,14 @@ case $basic_machine in
                basic_machine=t90-cray
                os=-unicos
                ;;
-       tic54x | c54x*)
-               basic_machine=tic54x-unknown
-               os=-coff
-               ;;
-       tic55x | c55x*)
-               basic_machine=tic55x-unknown
-               os=-coff
+       # This must be matched before tile*.
+       tilegx*)
+               basic_machine=tilegx-unknown
+               os=-linux-gnu
                ;;
-       tic6x | c6x*)
-               basic_machine=tic6x-unknown
-               os=-coff
+       tile*)
+               basic_machine=tile-unknown
+               os=-linux-gnu
                ;;
        tx39)
                basic_machine=mipstx39-unknown
@@ -1043,6 +1196,9 @@ case $basic_machine in
        xps | xps100)
                basic_machine=xps100-honeywell
                ;;
+       xscale-* | xscalee[bl]-*)
+               basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'`
+               ;;
        ymp)
                basic_machine=ymp-cray
                os=-unicos
@@ -1051,6 +1207,10 @@ case $basic_machine in
                basic_machine=z8k-unknown
                os=-sim
                ;;
+       z80-*-coff)
+               basic_machine=z80-unknown
+               os=-sim
+               ;;
        none)
                basic_machine=none-none
                os=-none
@@ -1089,13 +1249,10 @@ case $basic_machine in
        we32k)
                basic_machine=we32k-att
                ;;
-       sh3 | sh4 | sh[34]eb | sh[1234]le | sh[23]ele)
+       sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele)
                basic_machine=sh-unknown
                ;;
-       sh64)
-               basic_machine=sh64-unknown
-               ;;
-       sparc | sparcv8 | sparcv9 | sparcv9b)
+       sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v)
                basic_machine=sparc-sun
                ;;
        cydra)
@@ -1139,9 +1296,12 @@ esac
 if [ x"$os" != x"" ]
 then
 case $os in
-        # First match some system type aliases
-        # that might get confused with valid system types.
+       # First match some system type aliases
+       # that might get confused with valid system types.
        # -solaris* is a basic system type, with this one exception.
+       -auroraux)
+               os=-auroraux
+               ;;
        -solaris1 | -solaris1.*)
                os=`echo $os | sed -e 's|solaris1|sunos4|'`
                ;;
@@ -1162,26 +1322,31 @@ case $os in
        # 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* \
+             | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\
+             | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \
+             | -sym* | -kopensolaris* \
              | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
-             | -aos* \
+             | -aos* | -aros* \
              | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
              | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
-             | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* | -openbsd* \
+             | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
+             | -openbsd* | -solidbsd* \
              | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
              | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
              | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
              | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
-             | -chorusos* | -chorusrdb* \
+             | -chorusos* | -chorusrdb* | -cegcc* \
              | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
-             | -mingw32* | -linux-gnu* | -linux-uclibc* | -uxpv* | -beos* | -mpeix* | -udk* \
+             | -mingw32* | -linux-gnu* | -linux-android* \
+             | -linux-newlib* | -linux-uclibc* \
+             | -uxpv* | -beos* | -mpeix* | -udk* \
              | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
              | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
              | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
              | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
              | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
-             | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly*)
+             | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
+             | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*)
        # Remember, each alternative MUST END IN *, to match a version number.
                ;;
        -qnx*)
@@ -1199,7 +1364,7 @@ case $os in
                os=`echo $os | sed -e 's|nto|nto-qnx|'`
                ;;
        -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
-             | -windows* | -osx | -abug | -netware* | -os9* | -beos* \
+             | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \
              | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*)
                ;;
        -mac*)
@@ -1220,7 +1385,7 @@ case $os in
        -opened*)
                os=-openedition
                ;;
-        -os400*)
+       -os400*)
                os=-os400
                ;;
        -wince*)
@@ -1269,7 +1434,7 @@ case $os in
        -sinix*)
                os=-sysv4
                ;;
-        -tpf*)
+       -tpf*)
                os=-tpf
                ;;
        -triton*)
@@ -1311,6 +1476,11 @@ case $os in
        -zvmoe)
                os=-zvmoe
                ;;
+       -dicos*)
+               os=-dicos
+               ;;
+       -nacl*)
+               ;;
        -none)
                ;;
        *)
@@ -1333,6 +1503,12 @@ else
 # system, and we'll never get to this point.
 
 case $basic_machine in
+       score-*)
+               os=-elf
+               ;;
+       spu-*)
+               os=-elf
+               ;;
        *-acorn)
                os=-riscix1.2
                ;;
@@ -1342,9 +1518,18 @@ case $basic_machine in
        arm*-semi)
                os=-aout
                ;;
-    c4x-* | tic4x-*)
-        os=-coff
-        ;;
+       c4x-* | tic4x-*)
+               os=-coff
+               ;;
+       tic54x-*)
+               os=-coff
+               ;;
+       tic55x-*)
+               os=-coff
+               ;;
+       tic6x-*)
+               os=-coff
+               ;;
        # This must come before the *-dec entry.
        pdp10-*)
                os=-tops20
@@ -1370,6 +1555,9 @@ case $basic_machine in
        m68*-cisco)
                os=-aout
                ;;
+       mep-*)
+               os=-elf
+               ;;
        mips*-cisco)
                os=-elf
                ;;
@@ -1388,10 +1576,13 @@ case $basic_machine in
        *-be)
                os=-beos
                ;;
+       *-haiku)
+               os=-haiku
+               ;;
        *-ibm)
                os=-aix
                ;;
-       *-knuth)
+       *-knuth)
                os=-mmixware
                ;;
        *-wec)
@@ -1496,7 +1687,7 @@ case $basic_machine in
                        -sunos*)
                                vendor=sun
                                ;;
-                       -aix*)
+                       -cnk*|-aix*)
                                vendor=ibm
                                ;;
                        -beos*)
@@ -1559,7 +1750,7 @@ case $basic_machine in
 esac
 
 echo $basic_machine$os
-exit 0
+exit
 
 # Local variables:
 # eval: (add-hook 'write-file-hooks 'time-stamp)
index ba22958..d67d13b 100644 (file)
@@ -1,7 +1,7 @@
 Source: alarm-manager
 Section: devel
 Priority: extra
-Maintainer: SHIVAKUMAR BT<shiva.bt@samsung.com>, Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>, Jaeho Lee <jaeho81.lee@samsung.com>
+Maintainer: SHIVAKUMAR BT<shiva.bt@samsung.com>, Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>, Jaeho Lee <jaeho81.lee@samsung.com>, Venkatesha Sarpangala <sarpangala.v@samsung.com>
 Build-Depends: debhelper (>= 5), libdbus-1-dev, libglib2.0-dev, libdbus-glib-1-dev, libslp-pm-dev, dlog-dev, libheynoti-dev, libaul-1-dev, libbundle-dev, libsecurity-server-client-dev, libslp-db-util-dev, libvconf-dev, libvconf-keys-dev, libslp-tapi-dev, libappsvc-dev
 Standards-Version: 0.2.0
 
index 1ee75db..3e2367f 100644 (file)
@@ -194,6 +194,8 @@ typedef enum {
                ERR_ALARM_NO_SERVICE_NAME,
                                    /**<there is no alarm service 
                                        for this applicaation. */
+               ERR_ALARM_INVALID_TYPE,  /*Invalid type*/
+               ERR_ALARM_NO_PERMISSION, /*No permission*/
                ERR_ALARM_SYSTEM_FAIL = -1,
                ALARMMGR_RESULT_SUCCESS = 0,
        } alarm_error_t;
@@ -1230,6 +1232,70 @@ int alarmmgr_enum_alarm_ids(alarm_enum_fn_t fn, void *user_param);
  */
 int alarmmgr_get_info(alarm_id_t alarm_id, alarm_entry_t *alarm);
 
+
+/**
+ * This function retrieves bundle associated with alarm.
+ * Server will remember this entry, and pass the bundle information upon alarm expiry.
+ * Server will call app-svc interface to sent notification to destination application. Destination information
+ * should be available in the input bundle.
+ * @param      [in]            alarm_id                alarm id
+ * @param      [out]           ALARMMGR_RESULT_SUCCESS on success or negative number on failure.
+ *
+ * @return     This function returns bundle on success or NULL on failure.
+ *
+ * @pre None.
+ * @post None.
+ * @see None
+ * @remark  None.
+ *
+ * @par Sample code:
+ * @code
+#include <alarm.h>
+
+ ...
+
+alarm_id_t alarm_id;
+
+register_alarm(){
+       int result;
+       bundle *b=NULL;
+       b=bundle_create();
+
+       if (NULL == b)
+       {
+               printf("Unable to create bundle!!!\n");
+               return;
+       }
+
+       appsvc_set_pkgname(b,"org.tizen.alarm-test");
+       appsvc_set_operation(b,APPSVC_OPERATION_DEFAULT);
+
+       if ((result = alarmmgr_add_alarm_appsvc(ALARM_TYPE_DEFAULT, 10, 0, (void *)b ,&alarm_id)))
+               printf("Unable to add alarm. Alarmmgr alarm no is %d\n", result);
+       else
+               printf("Alarm added successfully. Alarm Id is %d\n", alarm_id);
+}
+int main(int argc,char **argv {
+       register_alarm();
+
+       int return_code = 0;
+       bundle *b = NULL;
+       b = alarmmgr_get_alarm_appsvc_info(alarm_id, &return_code);
+       if (b){
+               const char *pkgname = appsvc_get_pkgname(b);
+               if (pkgname){
+                       printf("Package name is %s\n",pkgname);
+               }
+       }
+
+       return 0;
+
+ }
+ * @endcode
+ * @limo
+ */
+void *alarmmgr_get_alarm_appsvc_info(alarm_id_t alarm_id, int *return_code);
+
 /**
  * @}
  */
old mode 100644 (file)
new mode 100755 (executable)
index c8485ab..d88da2c
--- a/ltmain.sh
+++ b/ltmain.sh
@@ -1,6 +1,6 @@
 # Generated from ltmain.m4sh.
 
-# ltmain.sh (GNU libtool) 2.2.4
+# ltmain.sh (GNU libtool) 2.2.6b
 # Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
 
 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, 2007 2008 Free Software Foundation, Inc.
@@ -65,7 +65,7 @@
 #       compiler:              $LTCC
 #       compiler flags:                $LTCFLAGS
 #       linker:                $LD (gnu? $with_gnu_ld)
-#       $progname:             (GNU libtool) 2.2.4
+#       $progname:             (GNU libtool) 2.2.6b Debian-2.2.6b-2
 #       automake:              $automake_version
 #       autoconf:              $autoconf_version
 #
@@ -73,9 +73,9 @@
 
 PROGRAM=ltmain.sh
 PACKAGE=libtool
-VERSION=2.2.4
+VERSION="2.2.6b Debian-2.2.6b-2"
 TIMESTAMP=""
-package_revision=1.2976
+package_revision=1.3017
 
 # Be Bourne compatible
 if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
@@ -116,15 +116,15 @@ $lt_unset CDPATH
 
 : ${CP="cp -f"}
 : ${ECHO="echo"}
-: ${EGREP="/usr/bin/grep -E"}
-: ${FGREP="/usr/bin/grep -F"}
-: ${GREP="/usr/bin/grep"}
+: ${EGREP="/bin/grep -E"}
+: ${FGREP="/bin/grep -F"}
+: ${GREP="/bin/grep"}
 : ${LN_S="ln -s"}
 : ${MAKE="make"}
 : ${MKDIR="mkdir"}
 : ${MV="mv -f"}
 : ${RM="rm -f"}
-: ${SED="/opt/local/bin/gsed"}
+: ${SED="/bin/sed"}
 : ${SHELL="${CONFIG_SHELL-/bin/sh}"}
 : ${Xsed="$SED -e 1s/^X//"}
 
@@ -805,7 +805,7 @@ func_enable_tag ()
 
 
   case $host in
-    *cygwin* | *mingw* | *pw32*)
+    *cygwin* | *mingw* | *pw32* | *cegcc*)
       # don't eliminate duplications in $postdeps and $predeps
       opt_duplicate_compiler_generated_deps=:
       ;;
@@ -893,8 +893,9 @@ $opt_help || {
 # determined imposters.
 func_lalib_p ()
 {
-    $SED -e 4q "$1" 2>/dev/null \
-      | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1
+    test -f "$1" &&
+      $SED -e 4q "$1" 2>/dev/null \
+        | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1
 }
 
 # func_lalib_unsafe_p file
@@ -907,7 +908,7 @@ func_lalib_p ()
 func_lalib_unsafe_p ()
 {
     lalib_p=no
-    if test -r "$1" && exec 5<&0 <"$1"; then
+    if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then
        for lalib_p_l in 1 2 3 4
        do
            read lalib_p_line
@@ -1275,7 +1276,7 @@ func_mode_compile ()
 
     # On Cygwin there's no "real" PIC flag so we must build both object types
     case $host_os in
-    cygwin* | mingw* | pw32* | os2*)
+    cygwin* | mingw* | pw32* | os2* | cegcc*)
       pic_mode=default
       ;;
     esac
@@ -2046,7 +2047,7 @@ func_mode_install ()
              'exit $?'
          tstripme="$stripme"
          case $host_os in
-         cygwin* | mingw* | pw32*)
+         cygwin* | mingw* | pw32* | cegcc*)
            case $realname in
            *.dll.a)
              tstripme=""
@@ -2152,7 +2153,7 @@ func_mode_install ()
 
        # Do a test to see if this is really a libtool program.
        case $host in
-       *cygwin*|*mingw*)
+       *cygwin* | *mingw*)
            if func_ltwrapper_executable_p "$file"; then
              func_ltwrapper_scriptname "$file"
              wrapper=$func_ltwrapper_scriptname_result
@@ -2358,7 +2359,7 @@ extern \"C\" {
              $RM $export_symbols
              eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
              case $host in
-             *cygwin* | *mingw* )
+             *cygwin* | *mingw* | *cegcc* )
                 eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
                 eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
                ;;
@@ -2370,7 +2371,7 @@ extern \"C\" {
              eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
              eval '$MV "$nlist"T "$nlist"'
              case $host in
-               *cygwin | *mingw* )
+               *cygwin | *mingw* | *cegcc* )
                  eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
                  eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
                  ;;
@@ -2426,7 +2427,7 @@ typedef struct {
 } lt_dlsymlist;
 "
          case $host in
-         *cygwin* | *mingw* )
+         *cygwin* | *mingw* | *cegcc* )
            $ECHO >> "$output_objdir/$my_dlsyms" "\
 /* DATA imports from DLLs on WIN32 con't be const, because
    runtime relocations are performed -- see ld's documentation
@@ -2512,7 +2513,7 @@ static const void *lt_preloaded_setup() {
        # Transform the symbol file into the correct name.
        symfileobj="$output_objdir/${my_outputname}S.$objext"
        case $host in
-       *cygwin* | *mingw* )
+       *cygwin* | *mingw* | *cegcc* )
          if test -f "$output_objdir/$my_outputname.def"; then
            compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
            finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
@@ -2691,25 +2692,16 @@ func_extract_archives ()
 
 
 
-# func_emit_wrapper arg
-#
-# emit a libtool wrapper script on stdout
-# don't directly open a file because we may want to
-# incorporate the script contents within a cygwin/mingw
-# wrapper executable.  Must ONLY be called from within
-# func_mode_link because it depends on a number of variable
-# set therein.
+# func_emit_wrapper_part1 [arg=no]
 #
-# arg is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR
-# variable will take.  If 'yes', then the emitted script
-# will assume that the directory in which it is stored is
-# the '.lib' directory.  This is a cygwin/mingw-specific
-# behavior.
-func_emit_wrapper ()
+# Emit the first part of a libtool wrapper script on stdout.
+# For more information, see the description associated with
+# func_emit_wrapper(), below.
+func_emit_wrapper_part1 ()
 {
-       func_emit_wrapper_arg1=no
+       func_emit_wrapper_part1_arg1=no
        if test -n "$1" ; then
-         func_emit_wrapper_arg1=$1
+         func_emit_wrapper_part1_arg1=$1
        fi
 
        $ECHO "\
@@ -2794,10 +2786,27 @@ else
     file=\`\$ECHO \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
     file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\`
   done
+"
+}
+# end: func_emit_wrapper_part1
+
+# func_emit_wrapper_part2 [arg=no]
+#
+# Emit the second part of a libtool wrapper script on stdout.
+# For more information, see the description associated with
+# func_emit_wrapper(), below.
+func_emit_wrapper_part2 ()
+{
+       func_emit_wrapper_part2_arg1=no
+       if test -n "$1" ; then
+         func_emit_wrapper_part2_arg1=$1
+       fi
+
+       $ECHO "\
 
   # Usually 'no', except on cygwin/mingw when embedded into
   # the cwrapper.
-  WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1
+  WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_part2_arg1
   if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then
     # special case for '.'
     if test \"\$thisdir\" = \".\"; then
@@ -2888,7 +2897,7 @@ else
 "
        case $host in
        # Backslashes separate directories on plain windows
-       *-*-mingw | *-*-os2*)
+       *-*-mingw | *-*-os2* | *-cegcc*)
          $ECHO "\
       exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
 "
@@ -2914,7 +2923,207 @@ else
 fi\
 "
 }
-# end: func_emit_wrapper
+# end: func_emit_wrapper_part2
+
+
+# func_emit_wrapper [arg=no]
+#
+# Emit a libtool wrapper script on stdout.
+# Don't directly open a file because we may want to
+# incorporate the script contents within a cygwin/mingw
+# wrapper executable.  Must ONLY be called from within
+# func_mode_link because it depends on a number of variables
+# set therein.
+#
+# ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR
+# variable will take.  If 'yes', then the emitted script
+# will assume that the directory in which it is stored is
+# the $objdir directory.  This is a cygwin/mingw-specific
+# behavior.
+func_emit_wrapper ()
+{
+       func_emit_wrapper_arg1=no
+       if test -n "$1" ; then
+         func_emit_wrapper_arg1=$1
+       fi
+
+       # split this up so that func_emit_cwrapperexe_src
+       # can call each part independently.
+       func_emit_wrapper_part1 "${func_emit_wrapper_arg1}"
+       func_emit_wrapper_part2 "${func_emit_wrapper_arg1}"
+}
+
+
+# func_to_host_path arg
+#
+# Convert paths to host format when used with build tools.
+# Intended for use with "native" mingw (where libtool itself
+# is running under the msys shell), or in the following cross-
+# build environments:
+#    $build          $host
+#    mingw (msys)    mingw  [e.g. native]
+#    cygwin          mingw
+#    *nix + wine     mingw
+# where wine is equipped with the `winepath' executable.
+# In the native mingw case, the (msys) shell automatically
+# converts paths for any non-msys applications it launches,
+# but that facility isn't available from inside the cwrapper.
+# Similar accommodations are necessary for $host mingw and
+# $build cygwin.  Calling this function does no harm for other
+# $host/$build combinations not listed above.
+#
+# ARG is the path (on $build) that should be converted to
+# the proper representation for $host. The result is stored
+# in $func_to_host_path_result.
+func_to_host_path ()
+{
+  func_to_host_path_result="$1"
+  if test -n "$1" ; then
+    case $host in
+      *mingw* )
+        lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
+        case $build in
+          *mingw* ) # actually, msys
+            # awkward: cmd appends spaces to result
+            lt_sed_strip_trailing_spaces="s/[ ]*\$//"
+            func_to_host_path_tmp1=`( cmd //c echo "$1" |\
+              $SED -e "$lt_sed_strip_trailing_spaces" ) 2>/dev/null || echo ""`
+            func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\
+              $SED -e "$lt_sed_naive_backslashify"`
+            ;;
+          *cygwin* )
+            func_to_host_path_tmp1=`cygpath -w "$1"`
+            func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\
+              $SED -e "$lt_sed_naive_backslashify"`
+            ;;
+          * )
+            # Unfortunately, winepath does not exit with a non-zero
+            # error code, so we are forced to check the contents of
+            # stdout. On the other hand, if the command is not
+            # found, the shell will set an exit code of 127 and print
+            # *an error message* to stdout. So we must check for both
+            # error code of zero AND non-empty stdout, which explains
+            # the odd construction:
+            func_to_host_path_tmp1=`winepath -w "$1" 2>/dev/null`
+            if test "$?" -eq 0 && test -n "${func_to_host_path_tmp1}"; then
+              func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\
+                $SED -e "$lt_sed_naive_backslashify"`
+            else
+              # Allow warning below.
+              func_to_host_path_result=""
+            fi
+            ;;
+        esac
+        if test -z "$func_to_host_path_result" ; then
+          func_error "Could not determine host path corresponding to"
+          func_error "  '$1'"
+          func_error "Continuing, but uninstalled executables may not work."
+          # Fallback:
+          func_to_host_path_result="$1"
+        fi
+        ;;
+    esac
+  fi
+}
+# end: func_to_host_path
+
+# func_to_host_pathlist arg
+#
+# Convert pathlists to host format when used with build tools.
+# See func_to_host_path(), above. This function supports the
+# following $build/$host combinations (but does no harm for
+# combinations not listed here):
+#    $build          $host
+#    mingw (msys)    mingw  [e.g. native]
+#    cygwin          mingw
+#    *nix + wine     mingw
+#
+# Path separators are also converted from $build format to
+# $host format. If ARG begins or ends with a path separator
+# character, it is preserved (but converted to $host format)
+# on output.
+#
+# ARG is a pathlist (on $build) that should be converted to
+# the proper representation on $host. The result is stored
+# in $func_to_host_pathlist_result.
+func_to_host_pathlist ()
+{
+  func_to_host_pathlist_result="$1"
+  if test -n "$1" ; then
+    case $host in
+      *mingw* )
+        lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
+        # Remove leading and trailing path separator characters from
+        # ARG. msys behavior is inconsistent here, cygpath turns them
+        # into '.;' and ';.', and winepath ignores them completely.
+        func_to_host_pathlist_tmp2="$1"
+        # Once set for this call, this variable should not be
+        # reassigned. It is used in tha fallback case.
+        func_to_host_pathlist_tmp1=`echo "$func_to_host_pathlist_tmp2" |\
+          $SED -e 's|^:*||' -e 's|:*$||'`
+        case $build in
+          *mingw* ) # Actually, msys.
+            # Awkward: cmd appends spaces to result.
+            lt_sed_strip_trailing_spaces="s/[ ]*\$//"
+            func_to_host_pathlist_tmp2=`( cmd //c echo "$func_to_host_pathlist_tmp1" |\
+              $SED -e "$lt_sed_strip_trailing_spaces" ) 2>/dev/null || echo ""`
+            func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp2" |\
+              $SED -e "$lt_sed_naive_backslashify"`
+            ;;
+          *cygwin* )
+            func_to_host_pathlist_tmp2=`cygpath -w -p "$func_to_host_pathlist_tmp1"`
+            func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp2" |\
+              $SED -e "$lt_sed_naive_backslashify"`
+            ;;
+          * )
+            # unfortunately, winepath doesn't convert pathlists
+            func_to_host_pathlist_result=""
+            func_to_host_pathlist_oldIFS=$IFS
+            IFS=:
+            for func_to_host_pathlist_f in $func_to_host_pathlist_tmp1 ; do
+              IFS=$func_to_host_pathlist_oldIFS
+              if test -n "$func_to_host_pathlist_f" ; then
+                func_to_host_path "$func_to_host_pathlist_f"
+                if test -n "$func_to_host_path_result" ; then
+                  if test -z "$func_to_host_pathlist_result" ; then
+                    func_to_host_pathlist_result="$func_to_host_path_result"
+                  else
+                    func_to_host_pathlist_result="$func_to_host_pathlist_result;$func_to_host_path_result"
+                  fi
+                fi
+              fi
+              IFS=:
+            done
+            IFS=$func_to_host_pathlist_oldIFS
+            ;;
+        esac
+        if test -z "$func_to_host_pathlist_result" ; then
+          func_error "Could not determine the host path(s) corresponding to"
+          func_error "  '$1'"
+          func_error "Continuing, but uninstalled executables may not work."
+          # Fallback. This may break if $1 contains DOS-style drive
+          # specifications. The fix is not to complicate the expression
+          # below, but for the user to provide a working wine installation
+          # with winepath so that path translation in the cross-to-mingw
+          # case works properly.
+          lt_replace_pathsep_nix_to_dos="s|:|;|g"
+          func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp1" |\
+            $SED -e "$lt_replace_pathsep_nix_to_dos"`
+        fi
+        # Now, add the leading and trailing path separators back
+        case "$1" in
+          :* ) func_to_host_pathlist_result=";$func_to_host_pathlist_result"
+            ;;
+        esac
+        case "$1" in
+          *: ) func_to_host_pathlist_result="$func_to_host_pathlist_result;"
+            ;;
+        esac
+        ;;
+    esac
+  fi
+}
+# end: func_to_host_pathlist
 
 # func_emit_cwrapperexe_src
 # emit the source code for a wrapper executable on stdout
@@ -2951,6 +3160,12 @@ EOF
 # include <stdint.h>
 # ifdef __CYGWIN__
 #  include <io.h>
+#  define HAVE_SETENV
+#  ifdef __STRICT_ANSI__
+char *realpath (const char *, char *);
+int putenv (char *);
+int setenv (const char *, const char *, int);
+#  endif
 # endif
 #endif
 #include <malloc.h>
@@ -3057,29 +3272,105 @@ int make_executable (const char *path);
 int check_executable (const char *path);
 char *strendzap (char *str, const char *pat);
 void lt_fatal (const char *message, ...);
-
-static const char *script_text =
+void lt_setenv (const char *name, const char *value);
+char *lt_extend_str (const char *orig_value, const char *add, int to_end);
+void lt_opt_process_env_set (const char *arg);
+void lt_opt_process_env_prepend (const char *arg);
+void lt_opt_process_env_append (const char *arg);
+int lt_split_name_value (const char *arg, char** name, char** value);
+void lt_update_exe_path (const char *name, const char *value);
+void lt_update_lib_path (const char *name, const char *value);
+
+static const char *script_text_part1 =
 EOF
 
-           func_emit_wrapper yes |
+           func_emit_wrapper_part1 yes |
+               $SED -e 's/\([\\"]\)/\\\1/g' \
+                    -e 's/^/  "/' -e 's/$/\\n"/'
+           echo ";"
+           cat <<EOF
+
+static const char *script_text_part2 =
+EOF
+           func_emit_wrapper_part2 yes |
                $SED -e 's/\([\\"]\)/\\\1/g' \
                     -e 's/^/  "/' -e 's/$/\\n"/'
            echo ";"
 
            cat <<EOF
 const char * MAGIC_EXE = "$magic_exe";
+const char * LIB_PATH_VARNAME = "$shlibpath_var";
+EOF
+
+           if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
+              func_to_host_pathlist "$temp_rpath"
+             cat <<EOF
+const char * LIB_PATH_VALUE   = "$func_to_host_pathlist_result";
+EOF
+           else
+             cat <<"EOF"
+const char * LIB_PATH_VALUE   = "";
+EOF
+           fi
+
+           if test -n "$dllsearchpath"; then
+              func_to_host_pathlist "$dllsearchpath:"
+             cat <<EOF
+const char * EXE_PATH_VARNAME = "PATH";
+const char * EXE_PATH_VALUE   = "$func_to_host_pathlist_result";
+EOF
+           else
+             cat <<"EOF"
+const char * EXE_PATH_VARNAME = "";
+const char * EXE_PATH_VALUE   = "";
+EOF
+           fi
+
+           if test "$fast_install" = yes; then
+             cat <<EOF
+const char * TARGET_PROGRAM_NAME = "lt-$outputname"; /* hopefully, no .exe */
+EOF
+           else
+             cat <<EOF
+const char * TARGET_PROGRAM_NAME = "$outputname"; /* hopefully, no .exe */
+EOF
+           fi
+
+
+           cat <<"EOF"
+
+#define LTWRAPPER_OPTION_PREFIX         "--lt-"
+#define LTWRAPPER_OPTION_PREFIX_LENGTH  5
+
+static const size_t opt_prefix_len         = LTWRAPPER_OPTION_PREFIX_LENGTH;
+static const char *ltwrapper_option_prefix = LTWRAPPER_OPTION_PREFIX;
+
+static const char *dumpscript_opt       = LTWRAPPER_OPTION_PREFIX "dump-script";
+
+static const size_t env_set_opt_len     = LTWRAPPER_OPTION_PREFIX_LENGTH + 7;
+static const char *env_set_opt          = LTWRAPPER_OPTION_PREFIX "env-set";
+  /* argument is putenv-style "foo=bar", value of foo is set to bar */
+
+static const size_t env_prepend_opt_len = LTWRAPPER_OPTION_PREFIX_LENGTH + 11;
+static const char *env_prepend_opt      = LTWRAPPER_OPTION_PREFIX "env-prepend";
+  /* argument is putenv-style "foo=bar", new value of foo is bar${foo} */
+
+static const size_t env_append_opt_len  = LTWRAPPER_OPTION_PREFIX_LENGTH + 10;
+static const char *env_append_opt       = LTWRAPPER_OPTION_PREFIX "env-append";
+  /* argument is putenv-style "foo=bar", new value of foo is ${foo}bar */
 
 int
 main (int argc, char *argv[])
 {
   char **newargz;
+  int  newargc;
   char *tmp_pathspec;
   char *actual_cwrapper_path;
-  char *shwrapper_name;
+  char *actual_cwrapper_name;
+  char *target_name;
+  char *lt_argv_zero;
   intptr_t rval = 127;
-  FILE *shwrapper;
 
-  const char *dumpscript_opt = "--lt-dump-script";
   int i;
 
   program_name = (char *) xstrdup (base_name (argv[0]));
@@ -3099,38 +3390,14 @@ EOF
                ;;
              esac
 
-           cat <<EOF
-         printf ("%s", script_text);
+           cat <<"EOF"
+         printf ("%s", script_text_part1);
+         printf ("%s", script_text_part2);
          return 0;
        }
     }
 
-  newargz = XMALLOC (char *, argc + 2);
-EOF
-
-           if test -n "$TARGETSHELL" ; then
-             # no path translation at all
-             lt_newargv0=$TARGETSHELL
-           else
-             case "$host" in
-               *mingw* )
-                 # awkward: cmd appends spaces to result
-                 lt_sed_strip_trailing_spaces="s/[ ]*\$//"
-                 lt_newargv0=`( cmd //c echo $SHELL | $SED -e "$lt_sed_strip_trailing_spaces" ) 2>/dev/null || echo $SHELL`
-                 case $lt_newargv0 in
-                   *.exe | *.EXE) ;;
-                   *) lt_newargv0=$lt_newargv0.exe ;;
-                 esac
-                 ;;
-               * ) lt_newargv0=$SHELL ;;
-             esac
-           fi
-
-               cat <<EOF
-  newargz[0] = (char *) xstrdup ("$lt_newargv0");
-EOF
-
-           cat <<"EOF"
+  newargz = XMALLOC (char *, argc + 1);
   tmp_pathspec = find_executable (argv[0]);
   if (tmp_pathspec == NULL)
     lt_fatal ("Couldn't find %s", argv[0]);
@@ -3142,39 +3409,60 @@ EOF
                          actual_cwrapper_path));
   XFREE (tmp_pathspec);
 
-  shwrapper_name = (char *) xstrdup (base_name (actual_cwrapper_path));
-  strendzap (actual_cwrapper_path, shwrapper_name);
-
-  /* shwrapper_name transforms */
-  strendzap (shwrapper_name, ".exe");
-  tmp_pathspec = XMALLOC (char, (strlen (shwrapper_name) +
-                                strlen ("_ltshwrapperTMP") + 1));
-  strcpy (tmp_pathspec, shwrapper_name);
-  strcat (tmp_pathspec, "_ltshwrapperTMP");
-  XFREE (shwrapper_name);
-  shwrapper_name = tmp_pathspec;
+  actual_cwrapper_name = xstrdup( base_name (actual_cwrapper_path));
+  strendzap (actual_cwrapper_path, actual_cwrapper_name);
+
+  /* wrapper name transforms */
+  strendzap (actual_cwrapper_name, ".exe");
+  tmp_pathspec = lt_extend_str (actual_cwrapper_name, ".exe", 1);
+  XFREE (actual_cwrapper_name);
+  actual_cwrapper_name = tmp_pathspec;
+  tmp_pathspec = 0;
+
+  /* target_name transforms -- use actual target program name; might have lt- prefix */
+  target_name = xstrdup (base_name (TARGET_PROGRAM_NAME));
+  strendzap (target_name, ".exe");
+  tmp_pathspec = lt_extend_str (target_name, ".exe", 1);
+  XFREE (target_name);
+  target_name = tmp_pathspec;
   tmp_pathspec = 0;
-  LTWRAPPER_DEBUGPRINTF (("(main) libtool shell wrapper name: %s\n",
-                         shwrapper_name));
+
+  LTWRAPPER_DEBUGPRINTF (("(main) libtool target name: %s\n",
+                         target_name));
 EOF
 
            cat <<EOF
-  newargz[1] =
+  newargz[0] =
     XMALLOC (char, (strlen (actual_cwrapper_path) +
-                   strlen ("$objdir") + 1 + strlen (shwrapper_name) + 1));
-  strcpy (newargz[1], actual_cwrapper_path);
-  strcat (newargz[1], "$objdir");
-  strcat (newargz[1], "/");
-  strcat (newargz[1], shwrapper_name);
+                   strlen ("$objdir") + 1 + strlen (actual_cwrapper_name) + 1));
+  strcpy (newargz[0], actual_cwrapper_path);
+  strcat (newargz[0], "$objdir");
+  strcat (newargz[0], "/");
 EOF
 
+           cat <<"EOF"
+  /* stop here, and copy so we don't have to do this twice */
+  tmp_pathspec = xstrdup (newargz[0]);
+
+  /* do NOT want the lt- prefix here, so use actual_cwrapper_name */
+  strcat (newargz[0], actual_cwrapper_name);
+
+  /* DO want the lt- prefix here if it exists, so use target_name */
+  lt_argv_zero = lt_extend_str (tmp_pathspec, target_name, 1);
+  XFREE (tmp_pathspec);
+  tmp_pathspec = NULL;
+EOF
 
            case $host_os in
              mingw*)
            cat <<"EOF"
   {
     char* p;
-    while ((p = strchr (newargz[1], '\\')) != NULL)
+    while ((p = strchr (newargz[0], '\\')) != NULL)
+      {
+       *p = '/';
+      }
+    while ((p = strchr (lt_argv_zero, '\\')) != NULL)
       {
        *p = '/';
       }
@@ -3184,55 +3472,114 @@ EOF
            esac
 
            cat <<"EOF"
-  XFREE (shwrapper_name);
+  XFREE (target_name);
   XFREE (actual_cwrapper_path);
+  XFREE (actual_cwrapper_name);
 
-  /* always write in binary mode */
-  if ((shwrapper = fopen (newargz[1], FOPEN_WB)) == 0)
-    {
-      lt_fatal ("Could not open %s for writing", newargz[1]);
-    }
-  fprintf (shwrapper, "%s", script_text);
-  fclose (shwrapper);
-
-  make_executable (newargz[1]);
+  lt_setenv ("BIN_SH", "xpg4"); /* for Tru64 */
+  lt_setenv ("DUALCASE", "1");  /* for MSK sh */
+  lt_update_lib_path (LIB_PATH_VARNAME, LIB_PATH_VALUE);
+  lt_update_exe_path (EXE_PATH_VARNAME, EXE_PATH_VALUE);
 
+  newargc=0;
   for (i = 1; i < argc; i++)
-    newargz[i + 1] = xstrdup (argv[i]);
-  newargz[argc + 1] = NULL;
+    {
+      if (strncmp (argv[i], env_set_opt, env_set_opt_len) == 0)
+        {
+          if (argv[i][env_set_opt_len] == '=')
+            {
+              const char *p = argv[i] + env_set_opt_len + 1;
+              lt_opt_process_env_set (p);
+            }
+          else if (argv[i][env_set_opt_len] == '\0' && i + 1 < argc)
+            {
+              lt_opt_process_env_set (argv[++i]); /* don't copy */
+            }
+          else
+            lt_fatal ("%s missing required argument", env_set_opt);
+          continue;
+        }
+      if (strncmp (argv[i], env_prepend_opt, env_prepend_opt_len) == 0)
+        {
+          if (argv[i][env_prepend_opt_len] == '=')
+            {
+              const char *p = argv[i] + env_prepend_opt_len + 1;
+              lt_opt_process_env_prepend (p);
+            }
+          else if (argv[i][env_prepend_opt_len] == '\0' && i + 1 < argc)
+            {
+              lt_opt_process_env_prepend (argv[++i]); /* don't copy */
+            }
+          else
+            lt_fatal ("%s missing required argument", env_prepend_opt);
+          continue;
+        }
+      if (strncmp (argv[i], env_append_opt, env_append_opt_len) == 0)
+        {
+          if (argv[i][env_append_opt_len] == '=')
+            {
+              const char *p = argv[i] + env_append_opt_len + 1;
+              lt_opt_process_env_append (p);
+            }
+          else if (argv[i][env_append_opt_len] == '\0' && i + 1 < argc)
+            {
+              lt_opt_process_env_append (argv[++i]); /* don't copy */
+            }
+          else
+            lt_fatal ("%s missing required argument", env_append_opt);
+          continue;
+        }
+      if (strncmp (argv[i], ltwrapper_option_prefix, opt_prefix_len) == 0)
+        {
+          /* however, if there is an option in the LTWRAPPER_OPTION_PREFIX
+             namespace, but it is not one of the ones we know about and
+             have already dealt with, above (inluding dump-script), then
+             report an error. Otherwise, targets might begin to believe
+             they are allowed to use options in the LTWRAPPER_OPTION_PREFIX
+             namespace. The first time any user complains about this, we'll
+             need to make LTWRAPPER_OPTION_PREFIX a configure-time option
+             or a configure.ac-settable value.
+           */
+          lt_fatal ("Unrecognized option in %s namespace: '%s'",
+                    ltwrapper_option_prefix, argv[i]);
+        }
+      /* otherwise ... */
+      newargz[++newargc] = xstrdup (argv[i]);
+    }
+  newargz[++newargc] = NULL;
 
-  for (i = 0; i < argc + 1; i++)
+  LTWRAPPER_DEBUGPRINTF     (("(main) lt_argv_zero : %s\n", (lt_argv_zero ? lt_argv_zero : "<NULL>")));
+  for (i = 0; i < newargc; i++)
     {
-      LTWRAPPER_DEBUGPRINTF (("(main) newargz[%d]   : %s\n", i, newargz[i]));
+      LTWRAPPER_DEBUGPRINTF (("(main) newargz[%d]   : %s\n", i, (newargz[i] ? newargz[i] : "<NULL>")));
     }
 
 EOF
 
            case $host_os in
              mingw*)
-               cat <<EOF
+               cat <<"EOF"
   /* execv doesn't actually work on mingw as expected on unix */
-  rval = _spawnv (_P_WAIT, "$lt_newargv0", (const char * const *) newargz);
+  rval = _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz);
   if (rval == -1)
     {
       /* failed to start process */
-      LTWRAPPER_DEBUGPRINTF (("(main) failed to launch target \"$lt_newargv0\": errno = %d\n", errno));
+      LTWRAPPER_DEBUGPRINTF (("(main) failed to launch target \"%s\": errno = %d\n", lt_argv_zero, errno));
       return 127;
     }
   return rval;
-}
 EOF
                ;;
              *)
-               cat <<EOF
-  execv ("$lt_newargv0", newargz);
+               cat <<"EOF"
+  execv (lt_argv_zero, newargz);
   return rval; /* =127, but avoids unused variable warning */
-}
 EOF
                ;;
            esac
 
            cat <<"EOF"
+}
 
 void *
 xmalloc (size_t num)
@@ -3506,6 +3853,177 @@ lt_fatal (const char *message, ...)
   lt_error_core (EXIT_FAILURE, "FATAL", message, ap);
   va_end (ap);
 }
+
+void
+lt_setenv (const char *name, const char *value)
+{
+  LTWRAPPER_DEBUGPRINTF (("(lt_setenv) setting '%s' to '%s'\n",
+                          (name ? name : "<NULL>"),
+                          (value ? value : "<NULL>")));
+  {
+#ifdef HAVE_SETENV
+    /* always make a copy, for consistency with !HAVE_SETENV */
+    char *str = xstrdup (value);
+    setenv (name, str, 1);
+#else
+    int len = strlen (name) + 1 + strlen (value) + 1;
+    char *str = XMALLOC (char, len);
+    sprintf (str, "%s=%s", name, value);
+    if (putenv (str) != EXIT_SUCCESS)
+      {
+        XFREE (str);
+      }
+#endif
+  }
+}
+
+char *
+lt_extend_str (const char *orig_value, const char *add, int to_end)
+{
+  char *new_value;
+  if (orig_value && *orig_value)
+    {
+      int orig_value_len = strlen (orig_value);
+      int add_len = strlen (add);
+      new_value = XMALLOC (char, add_len + orig_value_len + 1);
+      if (to_end)
+        {
+          strcpy (new_value, orig_value);
+          strcpy (new_value + orig_value_len, add);
+        }
+      else
+        {
+          strcpy (new_value, add);
+          strcpy (new_value + add_len, orig_value);
+        }
+    }
+  else
+    {
+      new_value = xstrdup (add);
+    }
+  return new_value;
+}
+
+int
+lt_split_name_value (const char *arg, char** name, char** value)
+{
+  const char *p;
+  int len;
+  if (!arg || !*arg)
+    return 1;
+
+  p = strchr (arg, (int)'=');
+
+  if (!p)
+    return 1;
+
+  *value = xstrdup (++p);
+
+  len = strlen (arg) - strlen (*value);
+  *name = XMALLOC (char, len);
+  strncpy (*name, arg, len-1);
+  (*name)[len - 1] = '\0';
+
+  return 0;
+}
+
+void
+lt_opt_process_env_set (const char *arg)
+{
+  char *name = NULL;
+  char *value = NULL;
+
+  if (lt_split_name_value (arg, &name, &value) != 0)
+    {
+      XFREE (name);
+      XFREE (value);
+      lt_fatal ("bad argument for %s: '%s'", env_set_opt, arg);
+    }
+
+  lt_setenv (name, value);
+  XFREE (name);
+  XFREE (value);
+}
+
+void
+lt_opt_process_env_prepend (const char *arg)
+{
+  char *name = NULL;
+  char *value = NULL;
+  char *new_value = NULL;
+
+  if (lt_split_name_value (arg, &name, &value) != 0)
+    {
+      XFREE (name);
+      XFREE (value);
+      lt_fatal ("bad argument for %s: '%s'", env_prepend_opt, arg);
+    }
+
+  new_value = lt_extend_str (getenv (name), value, 0);
+  lt_setenv (name, new_value);
+  XFREE (new_value);
+  XFREE (name);
+  XFREE (value);
+}
+
+void
+lt_opt_process_env_append (const char *arg)
+{
+  char *name = NULL;
+  char *value = NULL;
+  char *new_value = NULL;
+
+  if (lt_split_name_value (arg, &name, &value) != 0)
+    {
+      XFREE (name);
+      XFREE (value);
+      lt_fatal ("bad argument for %s: '%s'", env_append_opt, arg);
+    }
+
+  new_value = lt_extend_str (getenv (name), value, 1);
+  lt_setenv (name, new_value);
+  XFREE (new_value);
+  XFREE (name);
+  XFREE (value);
+}
+
+void
+lt_update_exe_path (const char *name, const char *value)
+{
+  LTWRAPPER_DEBUGPRINTF (("(lt_update_exe_path) modifying '%s' by prepending '%s'\n",
+                          (name ? name : "<NULL>"),
+                          (value ? value : "<NULL>")));
+
+  if (name && *name && value && *value)
+    {
+      char *new_value = lt_extend_str (getenv (name), value, 0);
+      /* some systems can't cope with a ':'-terminated path #' */
+      int len = strlen (new_value);
+      while (((len = strlen (new_value)) > 0) && IS_PATH_SEPARATOR (new_value[len-1]))
+        {
+          new_value[len-1] = '\0';
+        }
+      lt_setenv (name, new_value);
+      XFREE (new_value);
+    }
+}
+
+void
+lt_update_lib_path (const char *name, const char *value)
+{
+  LTWRAPPER_DEBUGPRINTF (("(lt_update_lib_path) modifying '%s' by prepending '%s'\n",
+                          (name ? name : "<NULL>"),
+                          (value ? value : "<NULL>")));
+
+  if (name && *name && value && *value)
+    {
+      char *new_value = lt_extend_str (getenv (name), value, 0);
+      lt_setenv (name, new_value);
+      XFREE (new_value);
+    }
+}
+
+
 EOF
 }
 # end: func_emit_cwrapperexe_src
@@ -3515,7 +4033,7 @@ func_mode_link ()
 {
     $opt_debug
     case $host in
-    *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
+    *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
       # 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
@@ -3959,6 +4477,13 @@ func_mode_link ()
       -L*)
        func_stripname '-L' '' "$arg"
        dir=$func_stripname_result
+       if test -z "$dir"; then
+         if test "$#" -gt 0; then
+           func_fatal_error "require no space between \`-L' and \`$1'"
+         else
+           func_fatal_error "need path for \`-L' option"
+         fi
+       fi
        # We need an absolute path.
        case $dir in
        [\\/]* | [A-Za-z]:[\\/]*) ;;
@@ -3977,14 +4502,16 @@ func_mode_link ()
          ;;
        esac
        case $host in
-       *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
+       *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
          testbindir=`$ECHO "X$dir" | $Xsed -e 's*/lib$*/bin*'`
          case :$dllsearchpath: in
          *":$dir:"*) ;;
+         ::) dllsearchpath=$dir;;
          *) dllsearchpath="$dllsearchpath:$dir";;
          esac
          case :$dllsearchpath: in
          *":$testbindir:"*) ;;
+         ::) dllsearchpath=$testbindir;;
          *) dllsearchpath="$dllsearchpath:$testbindir";;
          esac
          ;;
@@ -3995,7 +4522,7 @@ func_mode_link ()
       -l*)
        if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
          case $host in
-         *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos*)
+         *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc*)
            # These systems don't actually have a C or math library (as such)
            continue
            ;;
@@ -4072,7 +4599,7 @@ func_mode_link ()
 
       -no-install)
        case $host in
-       *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin*)
+       *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*)
          # The PATH hackery in wrapper scripts is required on Windows
          # and Darwin in order for the loader to find any dlls it needs.
          func_warning "\`-no-install' is ignored for $host"
@@ -4189,16 +4716,6 @@ func_mode_link ()
        arg=$func_stripname_result
        ;;
 
-      -Wl,--as-needed)
-       deplibs="$deplibs $arg"
-       continue
-       ;;
-
-      -Wl,--as-needed)
-       deplibs="$deplibs $arg"
-       continue
-       ;;
-
       -Wl,*)
        func_stripname '-Wl,' '' "$arg"
        args=$func_stripname_result
@@ -4516,7 +5033,10 @@ func_mode_link ()
        case $pass in
        dlopen) libs="$dlfiles" ;;
        dlpreopen) libs="$dlprefiles" ;;
-       link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
+       link)
+         libs="$deplibs %DEPLIBS%"
+         test "X$link_all_deplibs" != Xno && libs="$libs $dependency_libs"
+         ;;
        esac
       fi
       if test "$linkmode,$pass" = "lib,dlpreopen"; then
@@ -4550,15 +5070,6 @@ func_mode_link ()
        lib=
        found=no
        case $deplib in
-       -Wl,--as-needed)
-         if test "$linkmode,$pass" = "prog,link"; then
-           compile_deplibs="$deplib $compile_deplibs"
-           finalize_deplibs="$deplib $finalize_deplibs"
-         else
-           deplibs="$deplib $deplibs"
-         fi
-         continue
-         ;;
        -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
          if test "$linkmode,$pass" = "prog,link"; then
            compile_deplibs="$deplib $compile_deplibs"
@@ -4836,19 +5347,19 @@ func_mode_link ()
            # 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 $opt_duplicate_deps ; 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
            func_fatal_error "\`$lib' is not a convenience library"
          fi
-         tmp_libs=
-         for deplib in $dependency_libs; do
-           deplibs="$deplib $deplibs"
-           if $opt_duplicate_deps ; then
-             case "$tmp_libs " in
-             *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
-             esac
-           fi
-           tmp_libs="$tmp_libs $deplib"
-         done
          continue
        fi # $pass = conv
 
@@ -5048,7 +5559,7 @@ func_mode_link ()
        if test -n "$library_names" &&
           { test "$use_static_libs" = no || test -z "$old_library"; }; then
          case $host in
-         *cygwin* | *mingw*)
+         *cygwin* | *mingw* | *cegcc*)
              # No point in relinking DLLs because paths are not encoded
              notinst_deplibs="$notinst_deplibs $lib"
              need_relink=no
@@ -5118,7 +5629,7 @@ func_mode_link ()
            elif test -n "$soname_spec"; then
              # bleh windows
              case $host in
-             *cygwin* | mingw*)
+             *cygwin* | mingw* | *cegcc*)
                func_arith $current - $age
                major=$func_arith_result
                versuffix="-$major"
@@ -5385,6 +5896,7 @@ func_mode_link ()
          if test "$link_all_deplibs" != no; then
            # Add the search paths of all dependency libraries
            for deplib in $dependency_libs; do
+             path=
              case $deplib in
              -L*) path="$deplib" ;;
              *.la)
@@ -5698,6 +6210,9 @@ func_mode_link ()
            revision="$number_minor"
            lt_irix_increment=no
            ;;
+         *)
+           func_fatal_configuration "$modename: unknown library version type \`$version_type'"
+           ;;
          esac
          ;;
        no)
@@ -5897,7 +6412,7 @@ func_mode_link ()
        tempremovelist=`$ECHO "$output_objdir/*"`
        for p in $tempremovelist; do
          case $p in
-           *.$objext)
+           *.$objext | *.gcno)
               ;;
            $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
               if test "X$precious_files_regex" != "X"; then
@@ -5968,7 +6483,7 @@ func_mode_link ()
       if test "$build_libtool_libs" = yes; then
        if test -n "$rpath"; then
          case $host in
-         *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*)
+         *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc*)
            # these systems don't actually have a c library (as such)!
            ;;
          *-*-rhapsody* | *-*-darwin1.[012])
@@ -6467,7 +6982,7 @@ EOF
 
        orig_export_symbols=
        case $host_os in
-       cygwin* | mingw*)
+       cygwin* | mingw* | cegcc*)
          if test -n "$export_symbols" && test -z "$export_symbols_regex"; then
            # exporting using user supplied symfile
            if test "x`$SED 1q $export_symbols`" != xEXPORTS; then
@@ -7092,14 +7607,16 @@ EOF
          esac
        fi
        case $host in
-       *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
+       *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
          testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'`
          case :$dllsearchpath: in
          *":$libdir:"*) ;;
+         ::) dllsearchpath=$libdir;;
          *) dllsearchpath="$dllsearchpath:$libdir";;
          esac
          case :$dllsearchpath: in
          *":$testbindir:"*) ;;
+         ::) dllsearchpath=$testbindir;;
          *) dllsearchpath="$dllsearchpath:$testbindir";;
          esac
          ;;
@@ -7169,6 +7686,10 @@ EOF
           wrappers_required=no
         fi
         ;;
+      *cegcc)
+        # Disable wrappers for cegcc, we are cross compiling anyway.
+        wrappers_required=no
+        ;;
       *)
         if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
           wrappers_required=no
@@ -7321,11 +7842,10 @@ EOF
 
            func_emit_cwrapperexe_src > $cwrappersource
 
-           # 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.
+           # The wrapper executable is built using the $host compiler,
+           # because it contains $host paths and files. If cross-
+           # compiling, it, like the target executable, must be
+           # executed on the $host or under an emulation environment.
            $opt_dry_run || {
              $LTCC $LTCFLAGS -o $cwrapper $cwrappersource
              $STRIP $cwrapper
@@ -7610,7 +8130,7 @@ EOF
          # 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 ;;
+           *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
          esac
          $ECHO > $output "\
 # $outputname - a libtool library file
index 0d258e0..9000a05 100644 (file)
@@ -1,13 +1,13 @@
 # ltsugar.m4 -- libtool m4 base layer.                         -*-Autoconf-*-
 #
-#   Copyright (C) 2004, 2005, 2007 Free Software Foundation, Inc.
-#   Written by Gary V. Vaughan, 2004
+# Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc.
+# Written by Gary V. Vaughan, 2004
 #
 # This file is free software; the Free Software Foundation gives
 # unlimited permission to copy and/or distribute it, with or without
 # modifications, as long as this notice is preserved.
 
-# serial 5 ltsugar.m4
+# serial 6 ltsugar.m4
 
 # This is to help aclocal find these macros, as it can't see m4_define.
 AC_DEFUN([LTSUGAR_VERSION], [m4_if([0.1])])
@@ -63,14 +63,14 @@ m4_define([lt_append],
 # Produce a SEP delimited list of all paired combinations of elements of
 # PREFIX-LIST with SUFFIX1 through SUFFIXn.  Each element of the list
 # has the form PREFIXmINFIXSUFFIXn.
+# Needed until we can rely on m4_combine added in Autoconf 2.62.
 m4_define([lt_combine],
-[m4_if([$2], [], [],
-  [m4_if([$4], [], [],
-    [lt_join(m4_quote(m4_default([$1], [[, ]])),
-      lt_unquote(m4_split(m4_normalize(m4_foreach(_Lt_prefix, [$2],
-                  [m4_foreach(_Lt_suffix, lt_car([m4_shiftn(3, $@)]),
-                              [_Lt_prefix[]$3[]_Lt_suffix ])])))))])])dnl
-])
+[m4_if(m4_eval([$# > 3]), [1],
+       [m4_pushdef([_Lt_sep], [m4_define([_Lt_sep], m4_defn([lt_car]))])]]dnl
+[[m4_foreach([_Lt_prefix], [$2],
+            [m4_foreach([_Lt_suffix],
+               ]m4_dquote(m4_dquote(m4_shift(m4_shift(m4_shift($@)))))[,
+       [_Lt_sep([$1])[]m4_defn([_Lt_prefix])[$3]m4_defn([_Lt_suffix])])])])])
 
 
 # lt_if_append_uniq(MACRO-NAME, VARNAME, [SEPARATOR], [UNIQ], [NOT-UNIQ])
index 45cb155..f3c5309 100644 (file)
@@ -9,15 +9,15 @@
 
 # Generated from ltversion.in.
 
-# serial 2976 ltversion.m4
+# serial 3017 ltversion.m4
 # This file is part of GNU Libtool
 
-m4_define([LT_PACKAGE_VERSION], [2.2.4])
-m4_define([LT_PACKAGE_REVISION], [1.2976])
+m4_define([LT_PACKAGE_VERSION], [2.2.6b])
+m4_define([LT_PACKAGE_REVISION], [1.3017])
 
 AC_DEFUN([LTVERSION_VERSION],
-[macro_version='2.2.4'
-macro_revision='1.2976'
+[macro_version='2.2.6b'
+macro_revision='1.3017'
 _LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?])
 _LT_DECL(, macro_revision, 0)
 ])
diff --git a/test/Makefile b/test/Makefile
new file mode 100644 (file)
index 0000000..37d5aee
--- /dev/null
@@ -0,0 +1,18 @@
+CC ?= gcc
+
+TARGETS =  alarmmgr_unit_ts
+
+PKGS = dlog glib-2.0 bundle appsvc alarm-service
+
+LDFLAGS = `pkg-config --libs $(PKGS)`
+
+CFLAGS = -I. `pkg-config --cflags $(PKGS)`
+CFLAGS += -Wall
+
+all: $(TARGETS)
+
+$(TARGETS): %: %.c
+       $(CC) -o $@ $< $(CFLAGS) $(LDFLAGS)
+
+clean:
+       rm -f $(TARGETS)
diff --git a/test/alarmmgr_unit_ts.c b/test/alarmmgr_unit_ts.c
new file mode 100644 (file)
index 0000000..250f002
--- /dev/null
@@ -0,0 +1,1409 @@
+/*
+ *  alarm-manager
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Venkatesha Sarpangala <sarpangala.v@samsung.com>, Jayoun Lee <airjany@samsung.com>,
+ * Sewook Park <sewook7.park@samsung.com>, Jaeho Lee <jaeho81.lee@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <assert.h>
+#include <string.h>
+#include <fcntl.h>
+#include <sys/types.h>
+
+#include <glib.h>
+#include <glib-object.h>
+#include <dlog/dlog.h>
+
+#include <alarm.h>
+#include <bundle.h>
+#include <appsvc.h>
+#include <dlog.h>
+
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+#define LOG_TAG "TEST_LOG"
+
+#define TEST_APP_LOG_PRINT(FMT, ARG...) SLOGD(FMT, ##ARG);
+
+#define AUTO_TEST 0            /*Flag to Enable or Disable auto testing */
+
+#if AUTO_TEST
+
+#define ITER_COUNT 200         /*Stress testing iteration count */
+
+typedef enum {
+       INTERVAL = 1,
+       INTERVAL_APPSVC,
+       CALENDAR,
+       CALENDAR_APPSVC
+} create_subtype;              /*alarm type */
+
+int sub_type = 0;
+
+/*Used to hold multiple alarm id created */
+alarm_id_t alarm_id_arr[ITER_COUNT] = { 0, };
+
+#endif
+
+#define USER_INPUT_YES 1
+#define USER_INPUT_NO 2
+
+#define USER_INPUT_DEFAULT 1
+#define USER_INPUT_VOLATILE 2
+
+GMainLoop *mainloop = NULL;    /*gmain loop */
+
+alarm_id_t alarm_id;           /*Alarm identificaiton no */
+
+guint pgm_exit_time = 2000000; /*gmainloop life in milli second for few scenarios */
+
+bool cleanup_req = false;      /*tells whether test program cleanup required
+                                  or not before program exit */
+
+bool multiple_alarm = false;
+
+/* Local Functions*/
+static int __alarm_callback(alarm_id_t alarm_id, void *user_param);
+
+static int __alarm_callback1(alarm_id_t alarm_id, void *user_param);
+
+static void __create_interval_alarm(void);
+
+static void __create_app_svc_interval_alarm(void);
+
+static void __create_calendar_alarm(void);
+
+static void __create_app_svc_calendar_alarm(void);
+
+static gboolean __timout_handler(gpointer user_data);
+
+static void __test_pgm_clean_up(void);
+
+static int __get_integer_input_data(void);
+
+static void __test_alarm_manager_delete_alarm(void);
+
+static void __test_alarm_manager_create_alarm(void);
+
+static void __test_alarm_manager_get_information(void);
+
+static void __test_alarm_manager_get_appsvc_information(void);
+
+static void __test_alarm_manager_get_alarm_ids(void);
+
+static void __print_api_return_result(int err_no, const char *api_name);
+
+static void __test_alarm_manager_callback(void);
+
+static int __get_alarm_persistance_type(void);
+
+static char *__get_alarm_destination(void);
+
+static int __get_alarm_repeat_mode(void);
+
+static void __print_appsvc_bundle_data(const char *key, const char *val, void *data);
+
+
+/*This function will be executed upon alarm expiry*/
+static int __alarm_callback(alarm_id_t alarm_id_rec, void *user_param)
+{
+       time_t current_time = { 0, };
+       time(&current_time);
+
+       TEST_APP_LOG_PRINT("Alarm[%d] has expired at %s\n", alarm_id_rec,
+                          ctime(&current_time));
+       printf("Alarm[%d] has expired at %s\n", alarm_id_rec,
+              ctime(&current_time));
+
+       return 0;
+
+}
+
+/*This function will be executed upon alarm expiry*/
+static int __alarm_callback1(alarm_id_t alarm_id_rec, void *user_param)
+{
+       time_t current_time = { 0, };
+       time(&current_time);
+       printf("Callback function 2 executed\n");
+
+       TEST_APP_LOG_PRINT("Alarm[%d] has expired at %s\n", alarm_id_rec,
+                          ctime(&current_time));
+       printf("Alarm[%d] has expired at %s\n", alarm_id_rec,
+              ctime(&current_time));
+
+       return 0;
+
+}
+
+/*This function prints the result of Alarm manager API call*/
+static void __print_api_return_result(int err_no, const char *api_name)
+{
+
+       printf("Alarm Manager API \"%s\" retuned with result: ", api_name);
+
+       switch (err_no) {
+       case ERR_ALARM_INVALID_PARAM:{
+                       printf
+                           ("Alarm Manager error: \"ERR_ALARM_INVALID_PARAM\"\n");
+                       break;
+               }
+       case ERR_ALARM_INVALID_ID:{
+                       printf
+                           ("Alarm Manager error: \"ERR_ALARM_INVALID_ID\"\n");
+                       break;
+               }
+       case ERR_ALARM_INVALID_REPEAT:{
+                       printf
+                           ("Alarm Manager error: \"ERR_ALARM_INVALID_REPEAT\"\n");
+                       break;
+               }
+       case ERR_ALARM_INVALID_TIME:{
+                       printf
+                           ("Alarm Manager error: \"ERR_ALARM_INVALID_TIME\"\n");
+                       break;
+               }
+       case ERR_ALARM_INVALID_DATE:{
+                       printf
+                           ("Alarm Manager error: \"ERR_ALARM_INVALID_DATE\"\n");
+                       break;
+               }
+       case ERR_ALARM_NO_SERVICE_NAME:{
+                       printf
+                           ("Alarm Manager error: \"ERR_ALARM_NO_SERVICE_NAME\"\n");
+                       break;
+               }
+       case ERR_ALARM_NO_PERMISSION:{
+                       printf
+                           ("Alarm Manager error: \"ERR_ALARM_NO_PERMISSION\"\n");
+                       break;
+               }
+       case ERR_ALARM_INVALID_TYPE:{
+                       printf
+                           ("Alarm Manager error: \"ERR_ALARM_INVALID_TYPE\"\n");
+                       break;
+               }
+       case ERR_ALARM_SYSTEM_FAIL:{
+                       printf
+                           ("Alarm Manager error: \"ERR_ALARM_SYSTEM_FAIL\"\n");
+                       break;
+               }
+       case ALARMMGR_RESULT_SUCCESS:{
+                       printf
+                           ("Alarm API Success: \"ALARMMGR_RESULT_SUCCESS\"\n");
+                       break;
+               }
+       default:{
+                       printf("Alarm Manager error: Unknow Error \n");
+               }
+       }
+#if AUTO_TEST
+       /*Depending upon the test scenario,
+          these errno are added to assert()! */
+       assert(err_no == ALARMMGR_RESULT_SUCCESS
+              || err_no == ERR_ALARM_INVALID_ID
+              || err_no == ERR_ALARM_INVALID_PARAM);
+#else
+       assert(err_no == ALARMMGR_RESULT_SUCCESS);
+#endif
+
+       return;
+}
+
+
+static void __print_appsvc_bundle_data(const char *key, const char *val, void *data){
+       printf("Key-->[%s], Val-->[%s]\n",key,val);
+       return;
+}
+
+/*This function is to take command line integer input from the user*/
+static int __get_integer_input_data(void)
+{
+       char input_str[32] = { 0, };
+       int data = 0;
+       fflush(stdin);
+
+       if (fgets(input_str, 1024, stdin) == NULL) {
+               printf("Input buffer overflow....\n");
+               return -1;
+       }
+
+       if (sscanf(input_str, "%d", &data) != 1) {
+               printf("Input only integer option....\n");
+               return -1;
+       }
+
+       return data;
+}
+
+/*Function to get alarm persistance type*/
+static int __get_alarm_persistance_type(void)
+{
+       int type = ALARM_TYPE_VOLATILE;
+       int alarm_type = 0;
+       printf("Enter Type\n");
+       printf("1. ALARM_TYPE_DEFAULT \n");
+       printf("2. ALARM_TYPE_VOLATILE\n");
+       printf("Enter Choice between [1-2]....\n");
+       alarm_type = __get_integer_input_data();
+
+       switch (alarm_type) {
+       case USER_INPUT_DEFAULT:
+               {
+                       type = ALARM_TYPE_DEFAULT;
+                       break;
+               }
+       case USER_INPUT_VOLATILE:
+               {
+                       type = ALARM_TYPE_VOLATILE;
+                       break;
+               }
+       default:
+               {
+                       printf("Invalid option....Try Again\n");
+                       exit(-1);
+               }
+
+       }
+       return type;
+}
+
+static char *__get_alarm_destination(void)
+{
+       int alarm_type = 0;
+       char *destination = NULL;
+       printf("[Optional]: Do you want to provide Destination?\n");
+       printf("1. YES\n");
+       printf("2. NO \n");
+       printf("Enter Choice between [1-2]....\n");
+       alarm_type = __get_integer_input_data();
+       switch (alarm_type) {
+       case USER_INPUT_YES:
+               {
+                       fflush(stdin);
+
+                       destination = (char *)malloc(1024);
+                       if (NULL == destination) {
+                               return NULL;
+                       }
+                       printf
+                           ("Enter destination: [Ex:org.tizen.alarm-test "
+                            "or org.tizen.gallery...]\n");
+                       if (fgets(destination, 1024, stdin) == NULL) {
+                               printf("Input buffer overflow....,try again\n");
+                               exit(-1);
+                       }
+
+                       destination[strlen(destination) - 1] = '\0';
+
+                       break;
+               }
+       case USER_INPUT_NO:
+               {
+                       break;
+               }
+       default:
+               {
+                       printf("Invalid option....Try Again\n");
+                       exit(-1);
+               }
+       }
+
+       return destination;
+}
+
+static int __get_alarm_repeat_mode(void)
+{
+       int repeat_mode = 0;
+       printf("Enter Repeat Mode:\n");
+       printf("0. ALARM_REPEAT_MODE_ONCE\n");
+       printf("1. ALARM_REPEAT_MODE_REPEAT\n");
+       printf("2. ALARM_REPEAT_MODE_WEEKLY\n");
+       printf("3. ALARM_REPEAT_MODE_MONTHLY\n");
+       printf("4. ALARM_REPEAT_MODE_ANNUALLY\n");
+       printf("5. ALARM_REPEAT_MODE_MAX\n");
+       printf("Enter Choice between [0-5]....\n");
+       repeat_mode = __get_integer_input_data();
+       if (repeat_mode > 5 || repeat_mode < 0) {
+               printf("Invalid option....Try Again\n");
+               exit(-1);
+       }
+       return repeat_mode;
+}
+
+/*Function to create alarm in the calender input format*/
+static void __create_calendar_alarm(void)
+{
+       char *destination = NULL;
+       time_t current_time;
+       struct tm current_tm;
+       alarm_entry_t *alarm_info = NULL;
+       int result = 0;
+       alarm_date_t test_time;
+       int type = 0;
+       int year, month, day, hour, min, sec;
+       int repeat_mode = 0;
+
+       year = month = day = hour = min = sec = 0;
+
+       time(&current_time);
+       printf("current time: %s\n", ctime(&current_time));
+
+       localtime_r(&current_time, &current_tm);
+       alarm_info = alarmmgr_create_alarm();
+       assert(alarm_info != NULL);
+
+#if AUTO_TEST
+       test_time.year = current_tm.tm_year;
+       test_time.month = current_tm.tm_mon;
+       test_time.day = current_tm.tm_mday;
+
+       test_time.hour = current_tm.tm_hour;
+       test_time.min = current_tm.tm_min + 1;
+       test_time.sec = 5;
+#else
+
+       printf("Enter Year of Alarm Expiry: ");
+       year = __get_integer_input_data();
+
+       printf("Enter month of Alarm Expiry: ");
+       month = __get_integer_input_data();
+
+       printf("Enter day of Alarm Expiry: ");
+       day = __get_integer_input_data();
+
+       printf("Enter hour of Alarm Expiry: ");
+       hour = __get_integer_input_data();
+
+       printf("Enter minute of Alarm Expiry: ");
+       min = __get_integer_input_data();
+
+       printf("Enter second Alarm Expiry: ");
+       sec = __get_integer_input_data();
+
+       test_time.year = year;
+       test_time.month = month;
+       test_time.day = day;
+       test_time.hour = hour;
+       test_time.min = min;
+       test_time.sec = sec;
+       printf
+           ("Note: Test Program will exit After [Year:%d Month:%d Day:%d "
+            "at Hour:%d Min:%d Sec:%d]. Please wait....\n\n",
+            year, month, day, hour, min, sec);
+#endif
+
+       result = alarmmgr_set_time(alarm_info, test_time);
+       __print_api_return_result(result, "alarmmgr_set_time");
+
+#if AUTO_TEST
+       repeat_mode = ALARM_REPEAT_MODE_WEEKLY;
+#else
+       repeat_mode = __get_alarm_repeat_mode();
+#endif
+       result = alarmmgr_set_repeat_mode(alarm_info, repeat_mode,
+                                         ALARM_WDAY_SUNDAY | ALARM_WDAY_MONDAY
+                                         | ALARM_WDAY_TUESDAY |
+                                         ALARM_WDAY_WEDNESDAY |
+                                         ALARM_WDAY_THURSDAY |
+                                         ALARM_WDAY_FRIDAY |
+                                         ALARM_WDAY_SATURDAY);
+       __print_api_return_result(result, "alarmmgr_set_repeat_mode");
+
+#if AUTO_TEST
+       type = (random() % 2) + 1;
+#else
+       type = __get_alarm_persistance_type();
+#endif
+       result = alarmmgr_set_type(alarm_info, type);
+       __print_api_return_result(result, "alarmmgr_set_type");
+
+#if AUTO_TEST
+       result =
+           alarmmgr_add_alarm_with_localtime(alarm_info, destination,
+                                             &alarm_id);
+#else
+       destination = __get_alarm_destination();
+       result =
+           alarmmgr_add_alarm_with_localtime(alarm_info, destination,
+                                             &alarm_id);
+       __print_api_return_result(result, "alarmmgr_add_alarm_with_localtime");
+       printf("Created Alarm with Alarm ID %d\n", alarm_id);
+#endif
+
+       cleanup_req = true;
+
+       pgm_exit_time = 70000;
+       printf
+           ("Note: Test Program will exit After %f seconds..."
+            "Please wait....\n\n", (float)pgm_exit_time / 1000);
+
+       return;
+}
+
+/*Function to create alarm with a delay for first expiry and
+alarm expiry inteval for subsequent alarm*/
+static void __create_interval_alarm(void)
+{
+       time_t current_time = { 0, };
+       int result = 0;
+       int delay = 0;
+       int interval = 0;
+       int type = 0;
+
+       char *destination = NULL;
+
+       time(&current_time);
+#if AUTO_TEST
+       int i = 0;
+       delay = 1;
+#else
+       printf("current time: %s\n", ctime(&current_time));
+       printf("Enter First Delay (in seconds) for alarm: \n");
+       delay = __get_integer_input_data();
+#endif
+
+#if AUTO_TEST
+       interval = 1;
+#else
+       printf("Enter Alarm repeat Interval in seconds (if 0, no repeat): \n");
+       interval = __get_integer_input_data();
+#endif
+
+#if AUTO_TEST
+       type = (random() % 2) + 1;
+#else
+       type = __get_alarm_persistance_type();
+#endif
+
+#if AUTO_TEST
+       multiple_alarm = true;
+       for (i = 0; i < ITER_COUNT; i++) {
+               interval++;
+               delay++;
+               result =
+                   alarmmgr_add_alarm(type, delay, interval,
+                                      destination, &alarm_id_arr[i]);
+               __print_api_return_result(result, "alarmmgr_add_alarm");
+       }
+#else
+       destination = __get_alarm_destination();
+       result =
+           alarmmgr_add_alarm(type, delay, interval, destination, &alarm_id);
+       __print_api_return_result(result, "alarmmgr_add_alarm");
+       printf("Created Alarm with Alarm ID %d\n", alarm_id);
+#endif
+
+       if (interval > 0) {
+               cleanup_req = true;
+       }
+       pgm_exit_time = ((delay + interval) * 1000) + 100;
+       printf
+           ("Note: Test Program will exit After %f seconds..."
+            "Please wait....\n\n", (float)pgm_exit_time / 1000);
+
+       return;
+}
+
+/*Function to create alarm (with app-svc information)
+in the calender input format */
+static void __create_app_svc_calendar_alarm(void)
+{
+       time_t current_time;
+       struct tm current_tm;
+       alarm_entry_t *alarm_info = NULL;
+       int result;
+       alarm_date_t test_time;
+       int type = 0;
+       bundle *b = NULL;
+       int op_type = 0;
+       int repeat_mode = 0;
+
+       char pkgname[1024] = { 0, };
+
+       memset(pkgname, '\0', 1024);
+
+       int year, month, day, hour, min, sec;
+       year = month = day = hour = min = sec = 0;
+
+       time(&current_time);
+       printf("current time: %s\n", ctime(&current_time));
+
+       localtime_r(&current_time, &current_tm);
+       alarm_info = alarmmgr_create_alarm();
+       assert(alarm_info != NULL);
+
+#if AUTO_TEST
+       test_time.year = current_tm.tm_year;
+       test_time.month = current_tm.tm_mon;
+       test_time.day = current_tm.tm_mday;
+
+       test_time.hour = current_tm.tm_hour;
+       test_time.min = current_tm.tm_min + 1;
+       test_time.sec = 5;
+#else
+       printf("Enter Year of Alarm Expiry: ");
+       year = __get_integer_input_data();
+
+       printf("Enter month of Alarm Expiry: ");
+       month = __get_integer_input_data();
+
+       printf("Enter day of Alarm Expiry: ");
+       day = __get_integer_input_data();
+
+       printf("Enter hour of Alarm Expiry: ");
+       hour = __get_integer_input_data();
+
+       printf("Enter minute of Alarm Expiry: ");
+       min = __get_integer_input_data();
+
+       printf("Enter second Alarm Expiry: ");
+       sec = __get_integer_input_data();
+
+       test_time.year = year;
+       test_time.month = month;
+       test_time.day = day;
+       test_time.hour = hour;
+       test_time.min = min;
+       test_time.sec = sec;
+
+       printf
+           ("Note: Test Program will exit After "
+            "[Year:%d Month:%d Day:%d at Hour:%d Min:%d Sec:%d]."
+            " Please wait....\n\n", year, month, day, hour, min, sec);
+#endif
+       result = alarmmgr_set_time(alarm_info, test_time);
+       __print_api_return_result(result, "alarmmgr_set_time");
+
+#if AUTO_TEST
+       repeat_mode = ALARM_REPEAT_MODE_WEEKLY;
+#else
+       repeat_mode = __get_alarm_repeat_mode();
+#endif
+       result = alarmmgr_set_repeat_mode(alarm_info, repeat_mode,
+                                         ALARM_WDAY_SUNDAY | ALARM_WDAY_MONDAY
+                                         | ALARM_WDAY_TUESDAY |
+                                         ALARM_WDAY_WEDNESDAY |
+                                         ALARM_WDAY_THURSDAY |
+                                         ALARM_WDAY_FRIDAY |
+                                         ALARM_WDAY_SATURDAY);
+       __print_api_return_result(result, "alarmmgr_set_repeat_mode");
+
+#if AUTO_TEST
+       type = (random() % 2) + 1;
+#else
+       type = __get_alarm_persistance_type();
+#endif
+       result = alarmmgr_set_type(alarm_info, type);
+       __print_api_return_result(result, "alarmmgr_set_type");
+
+       b = bundle_create();
+
+       assert(b != NULL);
+
+#if AUTO_TEST
+       op_type = 1;
+#else
+       printf("Enter APPSVC Operation\n");
+       printf("1. APPSVC_OPERATION_DEFAULT \n");
+       printf("2. APPSVC_OPERATION_SEARCH\n");
+       printf("3. No operation\n");
+       op_type = __get_integer_input_data();
+#endif
+       switch (op_type) {
+       case 1:{
+                       appsvc_set_operation(b, APPSVC_OPERATION_DEFAULT);
+                       break;
+               }
+       case 2:{
+                       appsvc_set_operation(b, APPSVC_OPERATION_SEARCH);
+                       break;
+               }
+       case 3:
+               {
+                       printf("NO APPSVC OPERATION!!!\n");
+                       break;
+               }
+       default:{
+                       printf("Invalid option....Try Again\n");
+                       exit(-1);
+               }
+
+       }
+
+#if AUTO_TEST
+       sprintf(pkgname, "org.tizen.gallery");
+#else
+       fflush(stdin);
+
+       printf
+           ("Enter Pkgname: [Ex:org.tizen.alarm-test "
+            "or org.tizen.gallery...]\n");
+       if (fgets(pkgname, 1024, stdin) == NULL) {
+               printf("Input buffer overflow....,try again\n");
+               exit(-1);
+       }
+
+       pkgname[strlen(pkgname) - 1] = '\0';
+#endif
+       appsvc_set_pkgname(b, pkgname);
+
+       result =
+           alarmmgr_add_alarm_appsvc_with_localtime(alarm_info, (void *)b,
+                                                    &alarm_id);
+       __print_api_return_result(result,
+                                 "alarmmgr_add_alarm_appsvc_with_localtime");
+
+       printf("Alarm created with alarm id %d\n", alarm_id);
+
+       cleanup_req = true;
+
+       pgm_exit_time = 70000;
+
+       printf
+           ("Note: Test Program will exit After %f "
+            "seconds...Please wait....\n\n", (float)pgm_exit_time / 1000);
+       printf
+           ("Upon Alarm Expiry, %s application will be "
+            "launched (purpose:testing)\n", pkgname);
+
+}
+
+/*Function to create alarm with a delay for first expiry and
+alarm expiry inteval for subsequent alarm (with app-svc information)*/
+static void __create_app_svc_interval_alarm(void)
+{
+       time_t current_time = { 0, };
+       int result = 0;
+       int delay = 0;
+       int interval = 0;
+       int type = 0;
+       bundle *b = NULL;
+       int op_type = 0;
+
+       char pkgname[1024] = { 0, };
+
+       memset(pkgname, '\0', 1024);
+
+       time(&current_time);
+#if AUTO_TEST
+       int i = 0;
+       delay = (random() % 9) + 1;
+       interval = (random() % 9);
+#else
+       printf("current time: %s\n", ctime(&current_time));
+       printf("Enter First Delay (in seconds) for alarm: \n");
+       delay = __get_integer_input_data();
+       printf("Enter Alarm repeat Interval in seconds (if 0, no repeat): \n");
+       interval = __get_integer_input_data();
+#endif
+       if (interval > 0) {
+               cleanup_req = true;
+       }
+       pgm_exit_time = ((delay + interval) * 1000) + 100;
+       printf
+           ("Note: Test Program will exit After %f "
+            "seconds...Please wait....\n\n", (float)pgm_exit_time / 1000);
+
+#if AUTO_TEST
+       type = (random() % 2) + 1;
+#else
+       type = __get_alarm_persistance_type();
+#endif
+
+       b = bundle_create();
+
+       assert(b != NULL);
+
+#if AUTO_TEST
+       op_type = 1;
+#else
+       printf("Enter APPSVC Operation\n");
+       printf("1. APPSVC_OPERATION_DEFAULT \n");
+       printf("2. APPSVC_OPERATION_SEARCH\n");
+       printf("3. No operation\n");
+       op_type = __get_integer_input_data();
+#endif
+
+       switch (op_type) {
+       case 1:{
+                       appsvc_set_operation(b, APPSVC_OPERATION_DEFAULT);
+                       break;
+               }
+       case 2:{
+                       appsvc_set_operation(b, APPSVC_OPERATION_SEARCH);
+                       break;
+               }
+       case 3:
+               {
+                       printf("NO APPSVC OPERATION!!!\n");
+                       break;
+               }
+       default:{
+                       printf("Invalid option....Try Again\n");
+                       exit(-1);
+               }
+
+       }
+
+       fflush(stdin);
+
+#if AUTO_TEST
+       sprintf(pkgname, "org.tizen.gallery");
+#else
+       printf
+           ("Enter Pkgname: [Ex:org.tizen.alarm-test "
+            "or org.tizen.gallery...]\n");
+       if (fgets(pkgname, 1024, stdin) == NULL) {
+               printf("Input buffer overflow...Try Again.\n");
+               exit(-1);
+       }
+       pkgname[strlen(pkgname) - 1] = '\0';
+#endif
+       appsvc_set_pkgname(b, pkgname);
+
+#if AUTO_TEST
+       multiple_alarm = true;
+       for (i = 0; i < ITER_COUNT; i++) {
+               interval++;
+               delay++;
+               result =
+                   alarmmgr_add_alarm_appsvc(type, delay, interval, (void *)b,
+                                             &alarm_id_arr[i]);
+               __print_api_return_result(result, "alarmmgr_add_alarm");
+       }
+#else
+       result =
+           alarmmgr_add_alarm_appsvc(type, delay, interval, (void *)b,
+                                     &alarm_id);
+       __print_api_return_result(result, "alarmmgr_add_alarm_appsvc");
+       printf("Created Alarm with Alarm ID %d\n", alarm_id);
+#endif
+
+       if (interval > 0) {
+               cleanup_req = true;
+       }
+       pgm_exit_time = ((delay + interval) * 1000) + 100;
+       printf
+           ("Note: Test Program will exit After %f seconds..."
+            "Please wait....\n\n", (float)pgm_exit_time / 1000);
+
+       return;
+}
+
+/*This function will be executed before program exit (if required)*/
+static void __test_pgm_clean_up(void)
+{
+       int result = 0;
+       printf("Cleaning up test program\n");
+#if AUTO_TEST
+       int i = 0;
+       if (multiple_alarm == true) {
+               for (i = 0; i < ITER_COUNT; i++) {
+                       result = alarmmgr_remove_alarm(alarm_id_arr[i]);
+                       __print_api_return_result(result,
+                                                 "alarmmgr_remove_alarm");
+               }
+               multiple_alarm = false;
+       } else {
+               result = alarmmgr_remove_alarm(alarm_id);
+               __print_api_return_result(result, "alarmmgr_remove_alarm");
+       }
+#else
+       result = alarmmgr_remove_alarm(alarm_id);
+       __print_api_return_result(result, "alarmmgr_remove_alarm");
+#endif
+       return;
+}
+
+/*Function to exit gmainloop*/
+static gboolean __timout_handler(gpointer user_data)
+{
+       if (mainloop)
+               g_main_loop_quit(mainloop);
+
+       return false;
+}
+
+/*Main alarm create function which provides options
+ for different types of alarm creation*/
+static void __test_alarm_manager_callback(void)
+{
+       printf("Inside Alarm Callback test\n");
+       int result;
+
+       mainloop = g_main_loop_new(NULL, FALSE);
+       assert(mainloop != NULL);
+
+       result = alarmmgr_init("org.tizen.alarm-test");
+       __print_api_return_result(result, "alarmmgr_init");
+
+       result = alarmmgr_set_cb(__alarm_callback, NULL);
+       __print_api_return_result(result, "alarmmgr_set_cb");
+       result = alarmmgr_set_cb(__alarm_callback1, NULL);
+       __print_api_return_result(result, "alarmmgr_set_cb");
+
+       __create_interval_alarm();
+
+       g_timeout_add(pgm_exit_time, __timout_handler, NULL);
+
+       g_main_loop_run(mainloop);
+
+       if (cleanup_req) {
+               __test_pgm_clean_up();
+       }
+
+       return;
+}
+
+/*Main alarm create function which provides options
+ for different types of alarm creation*/
+static void __test_alarm_manager_create_alarm(void)
+{
+       int result = 0;
+       int alarm_type = 0;
+
+#if AUTO_TEST
+       alarm_type = sub_type;
+#else
+       char destination[1024] = { 0, };
+
+       printf("Enter Alarm Type\n");
+       printf("1. Interval with initial delay\n");
+       printf("2. App-svc Interval alarm with initial delay\n");
+       printf("3. Calendar Alarm\n");
+       printf("4. App-svc Calendar Alarm\n");
+       printf("Enter Choice between [1-4]....\n");
+       alarm_type = __get_integer_input_data();
+#endif
+       mainloop = g_main_loop_new(NULL, FALSE);
+       assert(mainloop != NULL);
+
+       switch (alarm_type) {
+       case 1:
+               {
+#if AUTO_TEST
+                       result = alarmmgr_init("org.tizen.1000");
+#else
+                       fflush(stdin);
+                       printf
+                           ("Enter pkgname (used to generate service name)"
+                            "[Ex:org.tizen.alarm-test or "
+                            "org.tizen.1000 etc]\n");
+                       if (fgets(destination, 1024, stdin) == NULL) {
+                               printf("Input buffer overflow....,try again\n");
+                               exit(-1);
+                       }
+
+                       destination[strlen(destination) - 1] = '\0';
+
+                       result = alarmmgr_init(destination);
+#endif
+                       __print_api_return_result(result, "alarmmgr_init");
+
+                       result = alarmmgr_set_cb(__alarm_callback, NULL);
+                       __print_api_return_result(result, "alarmmgr_set_cb");
+
+                       __create_interval_alarm();
+
+                       break;
+               }
+       case 2:
+               {
+                       printf("Inside APPSVC Interval Alarm test\n");
+                       __create_app_svc_interval_alarm();
+                       break;
+               }
+       case 3:
+               {
+                       printf("Inside Calendar Alarm test\n");
+#if AUTO_TEST
+                       result = alarmmgr_init("org.tizen.1000");
+#else
+                       fflush(stdin);
+                       printf
+                           ("Enter pkgname (used to generate service name)"
+                            "[Ex:org.tizen.alarm-test or "
+                            "org.tizen.1000 etc]\n");
+                       if (fgets(destination, 1024, stdin) == NULL) {
+                               printf("Input buffer overflow....,try again\n");
+                               exit(-1);
+                       }
+
+                       destination[strlen(destination) - 1] = '\0';
+
+                       result = alarmmgr_init(destination);
+#endif
+                       __print_api_return_result(result, "alarmmgr_init");
+
+                       result = alarmmgr_set_cb(__alarm_callback, NULL);
+                       __print_api_return_result(result, "alarmmgr_set_cb");
+
+                       __create_calendar_alarm();
+                       break;
+               }
+       case 4:
+               {
+                       printf("Inside APPSVC Calendar Alarm test\n");
+                       __create_app_svc_calendar_alarm();
+                       break;
+               }
+       default:
+               {
+                       printf("Invalid option....Try Again\n");
+                       return;
+               }
+       }
+
+       g_timeout_add(pgm_exit_time, __timout_handler, NULL);
+
+       g_main_loop_run(mainloop);
+
+       if (cleanup_req) {
+               __test_pgm_clean_up();
+       }
+
+       return;
+}
+
+/*Main alarm get information function which provides
+ different options of getting alarm information*/
+static void __test_alarm_manager_get_information(void)
+{
+
+       printf("Inside Get Info Interval Alarm test\n");
+       int option = 0;
+       int result = 0;
+       alarm_entry_t *alarm_info;
+       int type = 0;
+
+       alarm_date_t time = { 0, };
+
+#if AUTO_TEST
+       option = 2;
+#else
+       printf("1. Get Existing Alarm's Information\n");
+       printf("2. Create Alarm & Get Information\n");
+       option = __get_integer_input_data();
+#endif
+       alarm_info = alarmmgr_create_alarm();
+       assert(alarm_info != NULL);
+
+       switch (option) {
+       case 1:
+               {
+                       printf("Enter Alarm Id: \n");
+                       alarm_id = __get_integer_input_data();
+                       result = alarmmgr_get_info(alarm_id, alarm_info);
+                       __print_api_return_result(result, "alarmmgr_get_info");
+                       result = alarmmgr_get_time(alarm_info, &time);
+                       __print_api_return_result(result, "alarmmgr_get_time");
+                       printf("day is %d\n", time.day);
+                       printf("Alarm Get Info Success\n");
+                       break;
+               }
+       case 2:
+               {
+                       result = alarmmgr_init("org.tizen.10000");
+                       __print_api_return_result(result, "alarmmgr_init");
+
+#if AUTO_TEST
+                       type = (random() % 2) + 1;
+#else
+                       type = __get_alarm_persistance_type();
+#endif
+
+                       result =
+                           alarmmgr_add_alarm(type, 2, 0, NULL, &alarm_id);
+                       __print_api_return_result(result, "alarmmgr_add_alarm");
+                       printf("Created Alarm with Alarm ID %d\n", alarm_id);
+
+                       pgm_exit_time = 3000;
+                       g_timeout_add(pgm_exit_time, __timout_handler, NULL);
+
+                       result = alarmmgr_get_info(alarm_id, alarm_info);
+                       __print_api_return_result(result, "alarmmgr_get_info");
+
+                       alarm_date_t time = { 0, };
+                       result = alarmmgr_get_time(alarm_info, &time);
+                       __print_api_return_result(result, "alarmmgr_get_time");
+
+                       printf("day is %d\n", time.day);
+                       printf("Alarm Get Info Success\n");
+
+                       __test_pgm_clean_up();
+
+                       break;
+               }
+       default:
+               {
+                       printf("Invalid option\n");
+                       exit(-1);
+               }
+       }
+       return;
+}
+
+static void __test_alarm_manager_get_appsvc_information(void)
+{
+
+
+       printf("Inside Get Info Interval Alarm test\n");
+       int option = 0;
+       int result = 0;
+       alarm_entry_t *alarm_info;
+       bundle *b = NULL;
+
+#if AUTO_TEST
+       option = 2;
+#else
+       printf("1. Get Existing Alarm's Information\n");
+       printf("2. Create Alarm & Get Information\n");
+       option = __get_integer_input_data();
+#endif
+       alarm_info = alarmmgr_create_alarm();
+       assert(alarm_info != NULL);
+
+       switch (option) {
+       case 1:
+               {
+                       printf("Enter Alarm ID:\n");
+                       alarm_id = __get_integer_input_data();
+
+                       b = alarmmgr_get_alarm_appsvc_info(alarm_id, &result);
+
+                       if (b)
+                               bundle_iterate(b, __print_appsvc_bundle_data, NULL);
+
+                       __print_api_return_result(result, "alarmmgr_get_alarm_appsvc_info");
+
+                       break;
+               }
+       case 2:
+               {
+                       mainloop = g_main_loop_new(NULL, FALSE);
+                       assert(mainloop != NULL);
+
+                       __create_app_svc_interval_alarm();
+
+                       b = alarmmgr_get_alarm_appsvc_info(alarm_id, &result);
+                       __print_api_return_result(result, "alarmmgr_get_alarm_appsvc_info");
+                       if (b)
+                               bundle_iterate(b, __print_appsvc_bundle_data, NULL);
+
+                       g_timeout_add(2000, __timout_handler, NULL);
+
+                       g_main_loop_run(mainloop);
+
+                       if (cleanup_req) {
+                               __test_pgm_clean_up();
+
+                       break;
+               }
+       default:
+               {
+                       printf("Invalid option\n");
+                       exit(-1);
+               }
+       }
+       }
+
+       return;
+}
+
+static int __alarm_id_retrive_callback(alarm_id_t id, void *user_param)
+{
+       int *n = NULL;
+       n = (int *)user_param;
+       if (n == NULL) {
+               printf("Invalid Parameter in test program");
+               return -1;
+       }
+       printf("[%d]Alarm ID is %d\n", *n, id);
+       (*n)++;
+
+       return 0;
+}
+
+static void __test_alarm_manager_get_alarm_ids(void)
+{
+       printf("Inside Get Ids Alarm test\n");
+       int option = 0;
+       int result = 0;
+       int n = 1;
+       int type = 0;
+#if AUTO_TEST
+       option = 2;
+#else
+       printf("1. Get Existing Alarm's ID\n");
+       printf("2. Create Alarm & Get ID\n");
+
+       option = __get_integer_input_data();
+#endif
+       switch (option) {
+       case 1:
+               {
+                       result = alarmmgr_init("org.tizen.1000");
+                       __print_api_return_result(result, "alarmmgr_init");
+                       result =
+                           alarmmgr_enum_alarm_ids(__alarm_id_retrive_callback,
+                                                   (void *)&n);
+                       __print_api_return_result(result,
+                                                 "alarmmgr_enum_alarm_ids");
+                       break;
+               }
+       case 2:
+               {
+                       result = alarmmgr_init("org.tizen.test");
+                       __print_api_return_result(result, "alarmmgr_init");
+
+#if AUTO_TEST
+                       type = (random() % 2) + 1;
+#else
+                       type = __get_alarm_persistance_type();
+#endif
+                       result = alarmmgr_add_alarm(type, 2, 0,
+                                                   NULL, &alarm_id);
+                       printf("Created Alarm with Alarm ID %d\n", alarm_id);
+
+                       __print_api_return_result(result, "alarmmgr_add_alarm");
+
+                       result = alarmmgr_add_alarm(type, 3, 0,
+                                                   NULL, &alarm_id);
+                       __print_api_return_result(result, "alarmmgr_add_alarm");
+                       printf("Created Alarm with Alarm ID %d\n", alarm_id);
+
+                       pgm_exit_time = 5100;
+                       g_timeout_add(pgm_exit_time, __timout_handler, NULL);
+
+                       result =
+                           alarmmgr_enum_alarm_ids(__alarm_id_retrive_callback,
+                                                   (void *)&n);
+                       __print_api_return_result(result,
+                                                 "alarmmgr_enum_alarm_ids");
+
+                       break;
+               }
+       default:
+               {
+                       printf("Invalid option\n");
+                       exit(-1);
+               }
+       }
+       return;
+}
+
+/*Main alarm delete test function which provides options
+ for different types of alarm deletion*/
+static void __test_alarm_manager_delete_alarm(void)
+{
+       int option = 0;
+       int result = 0;
+       int type = 0;
+       printf("Inside Delete Alarm test\n");
+
+#if AUTO_TEST
+       option = 2;
+#else
+       printf("1. Delete Existing Alarm\n");
+       printf("2. Create Alarm & Delete\n");
+
+       option = __get_integer_input_data();
+#endif
+       switch (option) {
+       case 1:
+               {
+                       printf("Enter Alarm Id: \n");
+                       option = __get_integer_input_data();
+
+                       result = alarmmgr_remove_alarm(option);
+                       __print_api_return_result(result,
+                                                 "alarmmgr_remove_alarm");
+                       break;
+               }
+       case 2:
+               {
+                       result = alarmmgr_init("org.tizen.test");
+                       __print_api_return_result(result, "alarmmgr_init");
+
+#if AUTO_TEST
+                       type = (random() % 2) + 1;
+#else
+                       type = __get_alarm_persistance_type();
+#endif
+                       result = alarmmgr_add_alarm(type, 2, 0,
+                                                   NULL, &alarm_id);
+                       __print_api_return_result(result, "alarmmgr_add_alamr");
+                       printf("Created Alarm with Alarm ID %d\n", alarm_id);
+
+                       result = alarmmgr_remove_alarm(alarm_id);
+                       __print_api_return_result(result,
+                                                 "alarmmgr_remove_alarm");
+
+                       break;
+               }
+       default:
+               {
+                       printf("Invalid Option\n");
+                       break;
+               }
+       }
+       return;
+}
+
+/*Entry point of the test program*/
+int main(int argc, char **argv)
+{
+#if AUTO_TEST
+       int i = 0;
+       int k = 0;
+       int iteration = 0;
+
+       int fd = 0;
+
+       /*test result will be written into below file */
+       fd = open("/var/alarm_test.log", O_CREAT | O_RDWR | O_APPEND, 0666);
+       if (fd < 0) {
+               printf("Unable to create log file\n");
+               return -1;
+       }
+       if (argc < 3) {
+               printf("Insufficient arguments\n");
+               printf
+                   ("Example: ./test_alarmmgr.exe {all|create_interval|"
+                    "create_svc_interval|create_calendar|create_svc_calendar|"
+                    "delete|get_id|callback} <iteration>");
+               return -1;
+       }
+
+       close(1);
+       close(2);
+       dup(fd);
+       dup(fd);
+
+       char *test_job = NULL;
+
+       test_job = argv[1];
+       iteration = atoi(argv[2]);
+
+       printf("##################Alarm Test for %s Starts##################\n",
+              test_job);
+       g_type_init();
+
+       for (i = 0; i < iteration; i++) {
+               printf("########ITERATION %d #############\n", i);
+               if (strncmp(test_job, "create_interval", 15) == 0) {
+                       sub_type = INTERVAL;
+                       __test_alarm_manager_create_alarm();
+               } else if (strncmp(test_job, "create_svc_interval", 19) == 0) {
+                       sub_type = INTERVAL_APPSVC;
+                       __test_alarm_manager_create_alarm();
+               } else if (strncmp(test_job, "create_calendar", 15) == 0) {
+                       sub_type = CALENDAR;
+                       __test_alarm_manager_create_alarm();
+               } else if (strncmp(test_job, "create_svc_calendar", 19) == 0) {
+                       sub_type = CALENDAR_APPSVC;
+                       __test_alarm_manager_create_alarm();
+               } else if (strncmp(test_job, "delete", 6) == 0) {
+                       __test_alarm_manager_delete_alarm();
+               } else if (strncmp(test_job, "get_info", 8) == 0) {
+                       __test_alarm_manager_get_information();
+               } else if (strncmp(test_job, "get_id", 6) == 0) {
+                       __test_alarm_manager_get_alarm_ids();
+               } else if (strncmp(test_job, "callback", 8) == 0) {
+                       __test_alarm_manager_callback();
+               } else if (strncmp(test_job, "all", 3) == 0) {
+                       for (k = INTERVAL; k <= CALENDAR_APPSVC; k++) {
+                               sub_type = k;
+                               __test_alarm_manager_create_alarm();
+                       }
+                       __test_alarm_manager_delete_alarm();
+                       __test_alarm_manager_get_information();
+                       __test_alarm_manager_get_alarm_ids();
+                       __test_alarm_manager_get_alarm_ids();
+                       __test_alarm_manager_callback();
+
+               } else {
+                       printf("Invalid Option\n");
+                       return -1;
+               }
+       }
+       printf("##################Alarm Test for %s Ends##################\n\n",
+              test_job);
+       close(fd);
+
+#else
+       /*Compile with disabling AUTO_TEST flag for individual testing */
+       int option = 0;
+
+       g_type_init();
+
+       printf("*********ALARM MANAGER TESTING************\n");
+       printf("1. Test Alarm-Manager: Create Alarm\n");
+       printf("2. Test Alarm-Manager: Delete Alarm\n");
+       printf("3. Test Alarm-Manager: Get Alarm Information\n");
+       printf("4. Test Alarm-Manager: Get Alarm ID\n");
+       printf("5. Test Alarm-Manager: Callback\n");
+       printf("6. Test Alarm-Manager: Get Alarm app-svc(bundle) Information");
+       printf("Enter Choice between [1-5]....\n");
+
+       option = __get_integer_input_data();
+       switch (option) {
+       case 1:
+               {
+                       __test_alarm_manager_create_alarm();
+                       break;
+               }
+       case 2:
+               {
+                       __test_alarm_manager_delete_alarm();
+                       break;
+               }
+       case 3:
+               {
+                       __test_alarm_manager_get_information();
+                       break;
+               }
+       case 4:
+               {
+                       __test_alarm_manager_get_alarm_ids();
+                       break;
+               }
+       case 5:
+               {
+                       __test_alarm_manager_callback();
+                       break;
+               }
+       case 6:
+               {
+                       __test_alarm_manager_get_appsvc_information();
+                       break;
+               }
+       default:
+               {
+                       printf("Invalid Input!!! Retry again\n");
+               }
+
+       }
+       printf("****************************************\n");
+#endif
+       return 0;
+}