2.0 init
authorSeungbae Shin <seungbae.shin@samsung.com>
Tue, 21 Aug 2012 08:59:19 +0000 (17:59 +0900)
committerSeungbae Shin <seungbae.shin@samsung.com>
Tue, 21 Aug 2012 11:51:34 +0000 (20:51 +0900)
Change-Id: I1fccce4dee3e9a772dc8b9b3580296eaad513a77

63 files changed:
Makefile.am
TC/utc/utc_mm_sound_play_dtmf_func.c [deleted file]
common/Makefile.am
common/mm_ipc.c
common/mm_sound_utils.c [new file with mode: 0644]
config.guess [deleted file]
config.sub [deleted file]
configure
configure.ac
debian/changelog [deleted file]
debian/compat [deleted file]
debian/control [deleted file]
debian/copyright [deleted file]
debian/dirs [deleted file]
debian/docs [deleted file]
debian/libmm-sound-0.install.in [deleted file]
debian/libmm-sound-0.postinst [deleted file]
debian/libmm-sound-0.preinst [deleted file]
debian/libmm-sound-dev.install.in [deleted file]
debian/libmm-sound-sdk-dev.install.in [deleted file]
debian/libmm-sound-tool.install.in [deleted file]
debian/rules [deleted file]
include/mm_ipc.h
include/mm_sound.h
include/mm_sound_client.h
include/mm_sound_common.h
include/mm_sound_msg.h
include/mm_sound_private.h
include/mm_sound_utils.h [new file with mode: 0644]
init/mmfwaudio [new file with mode: 0755]
init/soundserver
mm_sound.c
mm_sound_client.c
mm_sound_keysound.c
packaging/libmm-sound.spec
pkgconfig-sdk/Makefile.am [deleted file]
pkgconfig-sdk/mm-keysound.pc.in [deleted file]
pkgconfig-sdk/mm-sound.pc.in [deleted file]
server/Makefile.am
server/include/asm-log.h [new file with mode: 0644]
server/include/mm_sound_mgr_asm.h [new file with mode: 0644]
server/include/mm_sound_mgr_device.h [new file with mode: 0644]
server/include/mm_sound_mgr_headset.h [new file with mode: 0644]
server/include/mm_sound_mgr_ipc.h
server/include/mm_sound_mgr_pulse.h
server/include/mm_sound_mgr_session.h [new file with mode: 0644]
server/mm_sound_mgr_asm.c [new file with mode: 0644]
server/mm_sound_mgr_codec.c
server/mm_sound_mgr_device.c [new file with mode: 0644]
server/mm_sound_mgr_headset.c [new file with mode: 0644]
server/mm_sound_mgr_ipc.c
server/mm_sound_mgr_pulse.c
server/mm_sound_mgr_session.c [new file with mode: 0644]
server/mm_sound_recovery.c
server/mm_sound_server.c
server/mm_sound_thread_pool.c
server/plugin/Makefile.am
server/plugin/headset/Makefile.am [deleted file]
server/plugin/headset/mm_sound_plugin_run_headset.c [deleted file]
server/plugin/keytone/mm_sound_plugin_run_key_tone.c
server/plugin/tone/Makefile.am
server/plugin/wav/mm_sound_plugin_codec_wave.c
testsuite/mm_sound_testsuite_simple.c [changed mode: 0755->0644]

index 7f47ed2..efa0c75 100644 (file)
@@ -1,16 +1,8 @@
-if IS_SDK
-SUBDIRS =      common \
-               pkgconfig-sdk \
-               . \
-               server \
-               testsuite
-else
 SUBDIRS = common \
                pkgconfig \
                . \
                server \
                testsuite
-endif
 
 SUBDIRS += init
                
@@ -53,11 +45,8 @@ libmmfsound_la_LIBADD = $(MMCOMMON_LIBS) \
 libmmfsound_la_LDFLAGS = -version-info 1:0:1
 
 #For logmanager
-if IS_SDK
-else
 libmmfsound_la_CFLAGS += $(MMLOGSVR_CFLAGS) -DMMF_LOG_OWNER=0x020 -DMMF_DEBUG_PREFIX=\"MMF-SOUND\"
 libmmfsound_la_LIBADD += $(MMLOGSVR_LIBS)
-endif
 
 
 
@@ -76,9 +65,5 @@ libmmfkeysound_la_CFLAGS = -I$(srcdir)/include \
                        -D_USE_INTERNAL_SOUND_PATH_
 
 libmmfkeysound_la_LIBADD = $(MMCOMMON_LIBS)
-if IS_SDK
-else
 libmmfkeysound_la_CFLAGS += $(MMLOGSVR_CFLAGS) -DMMF_LOG_OWNER=0x020 -DMMF_DEBUG_PREFIX=\"MMF-SOUND\"
 libmmfkeysound_la_LIBADD += $(MMLOGSVR_LIBS)
-endif
-
diff --git a/TC/utc/utc_mm_sound_play_dtmf_func.c b/TC/utc/utc_mm_sound_play_dtmf_func.c
deleted file mode 100644 (file)
index 1703aa2..0000000
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * libmm-sound
- *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Seungbae Shin <seungbae.shin@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.
- *
- */
-
-/**
-* @ingroup     MMF_SOUND_API
-* @addtogroup  SOUND
-*/
-
-/**
-* @ingroup     SOUND
-* @addtogroup  UTS_MMF_SOUND Unit
-*/
-
-/**
-* @ingroup     UTS_MMF_SOUND Unit
-* @addtogroup  UTS_MMF_SOUND_VOLUME_GET_STEP Uts_Mmf_Sound_Volume_Get_Step
-* @{
-*/
-
-/**
-* @file uts_mm_sound_volume_get_step_func.c
-* @brief This is a suit of unit test cases to test mm_sound_volume_get_step API
-* @author Kwanghui Cho (kwanghui.cho@samsung.com)
-* @version Initial Creation Version 0.1
-* @date 2010.10.05
-*/
-
-
-#include "utc_mm_sound_common.h"
-
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-//-------------------------------------------------------------------------------------------------
-///////////////////////////////////////////////////////////////////////////////////////////////////
-// Declare the global variables and registers and Internal Funntions
-//-------------------------------------------------------------------------------------------------
-#define API_NAME "mm_sound_play_tone"
-struct tet_testlist tet_testlist[] = {
-       {utc_mm_sound_play_tone_func_01, 1},
-       {utc_mm_sound_play_tone_func_02, 2},
-       {NULL, 0}
-};
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-/* Initialize TCM data structures */
-
-/* Start up function for each test purpose */
-void
-startup ()
-{
-}
-
-/* Clean up function for each test purpose */
-void
-cleanup ()
-{
-}
-
-
-void utc_mm_sound_play_tone_func_01()
-{
-       int ret = MM_ERROR_NONE;
-       MMSoundDtmf_t num = MM_SOUND_DTMF_3;
-       sound_time_msec_t msec = 1000;
-
-       ret = mm_sound_play_tone(num, VOLUME_TYPE_SYSTEM, msec);
-
-       dts_check_eq(API_NAME, ret, MM_ERROR_NONE);
-
-       return;
-}
-
-
-void utc_mm_sound_play_tone_func_02()
-{
-       int ret = 0;
-       MMSoundDtmf_t num = 20; //this is invalid parameter
-       sound_time_msec_t msec = 1000;
-
-       ret = mm_sound_play_tone(num, VOLUME_TYPE_SYSTEM, msec);
-
-       dts_check_ne(API_NAME, ret, MM_ERROR_NONE);
-
-       return;
-}
-
-/** @} */
-
-
-
-
index 99767d6..9481f5d 100644 (file)
@@ -2,6 +2,7 @@
 lib_LTLIBRARIES = libmmfsoundcommon.la
 
 libmmfsoundcommon_la_SOURCES = mm_ipc.c \
+                                                       mm_sound_utils.c \
                                                        mm_source.c
 
 #libmmfsoundcommon_la_DEPENDENCIES = $(libdir)/libmmfcommon.la
@@ -18,9 +19,5 @@ libmmfsoundcommon_la_LIBADD = $(MMCOMMON_LIBS) \
 
 
 #For logmanager
-if IS_SDK
-libmmfsoundcommon_la_CFLAGS += -D_I386_SDK_BUILD_
-else
 libmmfsoundcommon_la_CFLAGS += $(MMLOGSVR_CFLAGS) -DMMF_LOG_OWNER=0x020 -DMMF_DEBUG_PREFIX=\"MMF-SOUND\"
 libmmfsoundcommon_la_LIBADD += $(MMLOGSVR_LIBS)
-endif
index 587cf5c..11a39e0 100644 (file)
@@ -52,7 +52,6 @@
 EXPORT_API
 int __mm_sound_lock()
 {
-#if !defined(_I386_SDK_BUILD_)
     sem_t *sem = NULL;
     int ret;
     int err = MM_ERROR_NONE;
@@ -123,15 +122,11 @@ retry_lock:
     }
     sem_close(sem);
     return err;
-#else
-    return MM_ERROR_NONE;
-#endif
 }
 
 EXPORT_API
 int __mm_sound_unlock()
 {
-#if !defined(_I386_SDK_BUILD_)
     sem_t *sem = NULL;
     int ret;
     int err = MM_ERROR_NONE;
@@ -152,8 +147,5 @@ int __mm_sound_unlock()
 
     sem_close(sem);
     return err;
-#else
-    return MM_ERROR_NONE;
-#endif
 }
 
diff --git a/common/mm_sound_utils.c b/common/mm_sound_utils.c
new file mode 100644 (file)
index 0000000..25de33c
--- /dev/null
@@ -0,0 +1,96 @@
+/*
+ * libmm-sound
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Seungbae Shin <seungbae.shin@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 <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <errno.h>
+
+#include <mm_types.h>
+#include <mm_error.h>
+#include <mm_debug.h>
+#include "../include/mm_sound_private.h"
+#include "../include/mm_sound.h"
+#include "../include/mm_sound_utils.h"
+
+static mm_sound_route g_valid_route[] = { MM_SOUND_ROUTE_OUT_SPEAKER, MM_SOUND_ROUTE_OUT_WIRED_ACCESSORY, MM_SOUND_ROUTE_OUT_BLUETOOTH,
+                                                                                       MM_SOUND_ROUTE_IN_MIC, MM_SOUND_ROUTE_IN_WIRED_ACCESSORY, MM_SOUND_ROUTE_IN_MIC_OUT_RECEIVER,
+                                                                                       MM_SOUND_ROUTE_IN_MIC_OUT_SPEAKER, MM_SOUND_ROUTE_IN_MIC_OUT_HEADPHONE,
+                                                                                       MM_SOUND_ROUTE_INOUT_HEADSET, MM_SOUND_ROUTE_INOUT_BLUETOOTH };
+
+EXPORT_API
+int _mm_sound_get_valid_route_list(mm_sound_route **route_list)
+{
+       *route_list = g_valid_route;
+
+       return (int)(sizeof(g_valid_route) / sizeof(mm_sound_route));
+}
+
+EXPORT_API
+bool _mm_sound_is_route_valid(mm_sound_route route)
+{
+       mm_sound_route *route_list = 0;
+       int route_index = 0;
+       int route_list_count = 0;
+
+       route_list_count = _mm_sound_get_valid_route_list(&route_list);
+       for (route_index = 0; route_index < route_list_count; route_index++) {
+               if (route_list[route_index] == route)
+                       return 1;
+       }
+
+       return 0;
+}
+
+EXPORT_API
+void _mm_sound_get_devices_from_route(mm_sound_route route, mm_sound_device_in *device_in, mm_sound_device_out *device_out)
+{
+       if (device_in && device_out) {
+               *device_in = route & 0x00FF;
+               *device_out = route & 0xFF00;
+       }
+}
+
+EXPORT_API
+bool _mm_sound_check_hibernation (const char *path)
+{
+       int fd = -1;
+       if (path == NULL) {
+               debug_error ("Path is null\n");
+               return false;
+       }
+
+       fd = open (path, O_RDONLY | O_CREAT, 0644);
+       if (fd != -1) {
+               debug_log ("Open [%s] success!!\n", path);
+       } else {
+               debug_error ("Can't create [%s] with errno [%d]\n", path, errno);
+               return false;
+       }
+
+       close (fd);
+       return true;
+}
+
+
+
diff --git a/config.guess b/config.guess
deleted file mode 100755 (executable)
index 45bee13..0000000
+++ /dev/null
@@ -1,1465 +0,0 @@
-#! /bin/sh
-# Attempt to guess a canonical system name.
-#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-#   2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
-
-timestamp='2005-04-22'
-
-# This file is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-# General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-# As a special exception to the GNU General Public License, if you
-# distribute this file as part of a program that contains a
-# configuration script generated by Autoconf, you may include it under
-# the same distribution terms that you use for the rest of that program.
-
-# Originally written by Per Bothner <per@bothner.com>.
-# Please send patches to <config-patches@gnu.org>.  Submit a context
-# diff and a properly formatted ChangeLog entry.
-#
-# This script attempts to guess a canonical system name similar to
-# config.sub.  If it succeeds, it prints the system name on stdout, and
-# exits with 0.  Otherwise, it exits with 1.
-#
-# The plan is that this can be called by configure scripts if you
-# don't specify an explicit build system type.
-
-me=`echo "$0" | sed -e 's,.*/,,'`
-
-usage="\
-Usage: $0 [OPTION]
-
-Output the configuration name of the system \`$me' is run on.
-
-Operation modes:
-  -h, --help         print this help, then exit
-  -t, --time-stamp   print date of last modification, then exit
-  -v, --version      print version number, then exit
-
-Report bugs and patches to <config-patches@gnu.org>."
-
-version="\
-GNU config.guess ($timestamp)
-
-Originally written by Per Bothner.
-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
-Free Software Foundation, Inc.
-
-This is free software; see the source for copying conditions.  There is NO
-warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
-
-help="
-Try \`$me --help' for more information."
-
-# Parse command line
-while test $# -gt 0 ; do
-  case $1 in
-    --time-stamp | --time* | -t )
-       echo "$timestamp" ; exit 0 ;;
-    --version | -v )
-       echo "$version" ; exit 0 ;;
-    --help | --h* | -h )
-       echo "$usage"; exit 0 ;;
-    -- )     # Stop option processing
-       shift; break ;;
-    - )        # Use stdin as input.
-       break ;;
-    -* )
-       echo "$me: invalid option $1$help" >&2
-       exit 1 ;;
-    * )
-       break ;;
-  esac
-done
-
-if test $# != 0; then
-  echo "$me: too many arguments$help" >&2
-  exit 1
-fi
-
-trap 'exit 1' 1 2 15
-
-# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
-# compiler to aid in system detection is discouraged as it requires
-# temporary files to be created and, as you can see below, it is a
-# headache to deal with in a portable fashion.
-
-# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
-# use `HOST_CC' if defined, but it is deprecated.
-
-# Portable tmp directory creation inspired by the Autoconf team.
-
-set_cc_for_build='
-trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
-trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
-: ${TMPDIR=/tmp} ;
- { tmp=`(umask 077 && mktemp -d -q "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
- { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
- { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } ||
- { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
-dummy=$tmp/dummy ;
-tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ;
-case $CC_FOR_BUILD,$HOST_CC,$CC in
- ,,)    echo "int x;" > $dummy.c ;
-       for c in cc gcc c89 c99 ; do
-         if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then
-            CC_FOR_BUILD="$c"; break ;
-         fi ;
-       done ;
-       if test x"$CC_FOR_BUILD" = x ; then
-         CC_FOR_BUILD=no_compiler_found ;
-       fi
-       ;;
- ,,*)   CC_FOR_BUILD=$CC ;;
- ,*,*)  CC_FOR_BUILD=$HOST_CC ;;
-esac ;'
-
-# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
-# (ghazi@noc.rutgers.edu 1994-08-24)
-if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
-       PATH=$PATH:/.attbin ; export PATH
-fi
-
-UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
-UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
-UNAME_SYSTEM=`(uname -s) 2>/dev/null`  || UNAME_SYSTEM=unknown
-UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
-
-# Note: order is significant - the case branches are not exclusive.
-
-case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
-    *:NetBSD:*:*)
-       # NetBSD (nbsd) targets should (where applicable) match one or
-       # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*,
-       # *-*-netbsdecoff* and *-*-netbsd*.  For targets that recently
-       # switched to ELF, *-*-netbsd* would select the old
-       # object file format.  This provides both forward
-       # compatibility and a consistent mechanism for selecting the
-       # object file format.
-       #
-       # Note: NetBSD doesn't particularly care about the vendor
-       # portion of the name.  We always set it to "unknown".
-       sysctl="sysctl -n hw.machine_arch"
-       UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \
-           /usr/sbin/$sysctl 2>/dev/null || echo unknown)`
-       case "${UNAME_MACHINE_ARCH}" in
-           armeb) machine=armeb-unknown ;;
-           arm*) machine=arm-unknown ;;
-           sh3el) machine=shl-unknown ;;
-           sh3eb) machine=sh-unknown ;;
-           *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
-       esac
-       # The Operating System including object format, if it has switched
-       # to ELF recently, or will in the future.
-       case "${UNAME_MACHINE_ARCH}" in
-           arm*|i386|m68k|ns32k|sh3*|sparc|vax)
-               eval $set_cc_for_build
-               if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
-                       | grep __ELF__ >/dev/null
-               then
-                   # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
-                   # Return netbsd for either.  FIX?
-                   os=netbsd
-               else
-                   os=netbsdelf
-               fi
-               ;;
-           *)
-               os=netbsd
-               ;;
-       esac
-       # The OS release
-       # Debian GNU/NetBSD machines have a different userland, and
-       # thus, need a distinct triplet. However, they do not need
-       # kernel version information, so it can be replaced with a
-       # suitable tag, in the style of linux-gnu.
-       case "${UNAME_VERSION}" in
-           Debian*)
-               release='-gnu'
-               ;;
-           *)
-               release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
-               ;;
-       esac
-       # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
-       # contains redundant information, the shorter form:
-       # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
-       echo "${machine}-${os}${release}"
-       exit 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 ;;
-    *:OpenBSD:*:*)
-       echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE}
-       exit 0 ;;
-    *:ekkoBSD:*:*)
-       echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
-       exit 0 ;;
-    macppc:MirBSD:*:*)
-       echo powerppc-unknown-mirbsd${UNAME_RELEASE}
-       exit 0 ;;
-    *:MirBSD:*:*)
-       echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
-       exit 0 ;;
-    alpha:OSF1:*:*)
-       case $UNAME_RELEASE in
-       *4.0)
-               UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
-               ;;
-       *5.*)
-               UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
-               ;;
-       esac
-       # According to Compaq, /usr/sbin/psrinfo has been available on
-       # OSF/1 and Tru64 systems produced since 1995.  I hope that
-       # covers most systems running today.  This code pipes the CPU
-       # types through head -n 1, so we only detect the type of CPU 0.
-       ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^  The alpha \(.*\) processor.*$/\1/p' | head -n 1`
-       case "$ALPHA_CPU_TYPE" in
-           "EV4 (21064)")
-               UNAME_MACHINE="alpha" ;;
-           "EV4.5 (21064)")
-               UNAME_MACHINE="alpha" ;;
-           "LCA4 (21066/21068)")
-               UNAME_MACHINE="alpha" ;;
-           "EV5 (21164)")
-               UNAME_MACHINE="alphaev5" ;;
-           "EV5.6 (21164A)")
-               UNAME_MACHINE="alphaev56" ;;
-           "EV5.6 (21164PC)")
-               UNAME_MACHINE="alphapca56" ;;
-           "EV5.7 (21164PC)")
-               UNAME_MACHINE="alphapca57" ;;
-           "EV6 (21264)")
-               UNAME_MACHINE="alphaev6" ;;
-           "EV6.7 (21264A)")
-               UNAME_MACHINE="alphaev67" ;;
-           "EV6.8CB (21264C)")
-               UNAME_MACHINE="alphaev68" ;;
-           "EV6.8AL (21264B)")
-               UNAME_MACHINE="alphaev68" ;;
-           "EV6.8CX (21264D)")
-               UNAME_MACHINE="alphaev68" ;;
-           "EV6.9A (21264/EV69A)")
-               UNAME_MACHINE="alphaev69" ;;
-           "EV7 (21364)")
-               UNAME_MACHINE="alphaev7" ;;
-           "EV7.9 (21364A)")
-               UNAME_MACHINE="alphaev79" ;;
-       esac
-       # A Pn.n version is a patched version.
-       # A Vn.n version is a released version.
-       # A Tn.n version is a released field test version.
-       # A Xn.n version is an unreleased experimental baselevel.
-       # 1.2 uses "1.2" for uname -r.
-       echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
-       exit 0 ;;
-    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 0 ;;
-    21064:Windows_NT:50:3)
-       echo alpha-dec-winnt3.5
-       exit 0 ;;
-    Amiga*:UNIX_System_V:4.0:*)
-       echo m68k-unknown-sysv4
-       exit 0;;
-    *:[Aa]miga[Oo][Ss]:*:*)
-       echo ${UNAME_MACHINE}-unknown-amigaos
-       exit 0 ;;
-    *:[Mm]orph[Oo][Ss]:*:*)
-       echo ${UNAME_MACHINE}-unknown-morphos
-       exit 0 ;;
-    *:OS/390:*:*)
-       echo i370-ibm-openedition
-       exit 0 ;;
-    *:z/VM:*:*)
-       echo s390-ibm-zvmoe
-       exit 0 ;;
-    *:OS400:*:*)
-        echo powerpc-ibm-os400
-       exit 0 ;;
-    arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
-       echo arm-acorn-riscix${UNAME_RELEASE}
-       exit 0;;
-    SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
-       echo hppa1.1-hitachi-hiuxmpp
-       exit 0;;
-    Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
-       # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
-       if test "`(/bin/universe) 2>/dev/null`" = att ; then
-               echo pyramid-pyramid-sysv3
-       else
-               echo pyramid-pyramid-bsd
-       fi
-       exit 0 ;;
-    NILE*:*:*:dcosx)
-       echo pyramid-pyramid-svr4
-       exit 0 ;;
-    DRS?6000:unix:4.0:6*)
-       echo sparc-icl-nx6
-       exit 0 ;;
-    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 ;;
-       esac ;;
-    sun4H:SunOS:5.*:*)
-       echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
-       exit 0 ;;
-    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 ;;
-    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 0 ;;
-    sun4*:SunOS:*:*)
-       case "`/usr/bin/arch -k`" in
-           Series*|S4*)
-               UNAME_RELEASE=`uname -v`
-               ;;
-       esac
-       # Japanese Language versions have a version number like `4.1.3-JL'.
-       echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
-       exit 0 ;;
-    sun3*:SunOS:*:*)
-       echo m68k-sun-sunos${UNAME_RELEASE}
-       exit 0 ;;
-    sun*:*:4.2BSD:*)
-       UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
-       test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
-       case "`/bin/arch`" in
-           sun3)
-               echo m68k-sun-sunos${UNAME_RELEASE}
-               ;;
-           sun4)
-               echo sparc-sun-sunos${UNAME_RELEASE}
-               ;;
-       esac
-       exit 0 ;;
-    aushp:SunOS:*:*)
-       echo sparc-auspex-sunos${UNAME_RELEASE}
-       exit 0 ;;
-    # The situation for MiNT is a little confusing.  The machine name
-    # can be virtually everything (everything which is not
-    # "atarist" or "atariste" at least should have a processor
-    # > m68000).  The system name ranges from "MiNT" over "FreeMiNT"
-    # to the lowercase version "mint" (or "freemint").  Finally
-    # the system name "TOS" denotes a system which is actually not
-    # MiNT.  But MiNT is downward compatible to TOS, so this should
-    # be no problem.
-    atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
-        echo m68k-atari-mint${UNAME_RELEASE}
-       exit 0 ;;
-    atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
-       echo m68k-atari-mint${UNAME_RELEASE}
-        exit 0 ;;
-    *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
-        echo m68k-atari-mint${UNAME_RELEASE}
-       exit 0 ;;
-    milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
-        echo m68k-milan-mint${UNAME_RELEASE}
-        exit 0 ;;
-    hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
-        echo m68k-hades-mint${UNAME_RELEASE}
-        exit 0 ;;
-    *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
-        echo m68k-unknown-mint${UNAME_RELEASE}
-        exit 0 ;;
-    m68k:machten:*:*)
-       echo m68k-apple-machten${UNAME_RELEASE}
-       exit 0 ;;
-    powerpc:machten:*:*)
-       echo powerpc-apple-machten${UNAME_RELEASE}
-       exit 0 ;;
-    RISC*:Mach:*:*)
-       echo mips-dec-mach_bsd4.3
-       exit 0 ;;
-    RISC*:ULTRIX:*:*)
-       echo mips-dec-ultrix${UNAME_RELEASE}
-       exit 0 ;;
-    VAX*:ULTRIX*:*:*)
-       echo vax-dec-ultrix${UNAME_RELEASE}
-       exit 0 ;;
-    2020:CLIX:*:* | 2430:CLIX:*:*)
-       echo clipper-intergraph-clix${UNAME_RELEASE}
-       exit 0 ;;
-    mips:*:*:UMIPS | mips:*:*:RISCos)
-       eval $set_cc_for_build
-       sed 's/^        //' << EOF >$dummy.c
-#ifdef __cplusplus
-#include <stdio.h>  /* for printf() prototype */
-       int main (int argc, char *argv[]) {
-#else
-       int main (argc, argv) int argc; char *argv[]; {
-#endif
-       #if defined (host_mips) && defined (MIPSEB)
-       #if defined (SYSTYPE_SYSV)
-         printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
-       #endif
-       #if defined (SYSTYPE_SVR4)
-         printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
-       #endif
-       #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
-         printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
-       #endif
-       #endif
-         exit (-1);
-       }
-EOF
-       $CC_FOR_BUILD -o $dummy $dummy.c \
-         && $dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \
-         && exit 0
-       echo mips-mips-riscos${UNAME_RELEASE}
-       exit 0 ;;
-    Motorola:PowerMAX_OS:*:*)
-       echo powerpc-motorola-powermax
-       exit 0 ;;
-    Motorola:*:4.3:PL8-*)
-       echo powerpc-harris-powermax
-       exit 0 ;;
-    Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
-       echo powerpc-harris-powermax
-       exit 0 ;;
-    Night_Hawk:Power_UNIX:*:*)
-       echo powerpc-harris-powerunix
-       exit 0 ;;
-    m88k:CX/UX:7*:*)
-       echo m88k-harris-cxux7
-       exit 0 ;;
-    m88k:*:4*:R4*)
-       echo m88k-motorola-sysv4
-       exit 0 ;;
-    m88k:*:3*:R3*)
-       echo m88k-motorola-sysv3
-       exit 0 ;;
-    AViiON:dgux:*:*)
-        # DG/UX returns AViiON for all architectures
-        UNAME_PROCESSOR=`/usr/bin/uname -p`
-       if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
-       then
-           if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
-              [ ${TARGET_BINARY_INTERFACE}x = x ]
-           then
-               echo m88k-dg-dgux${UNAME_RELEASE}
-           else
-               echo m88k-dg-dguxbcs${UNAME_RELEASE}
-           fi
-       else
-           echo i586-dg-dgux${UNAME_RELEASE}
-       fi
-       exit 0 ;;
-    M88*:DolphinOS:*:*)        # DolphinOS (SVR3)
-       echo m88k-dolphin-sysv3
-       exit 0 ;;
-    M88*:*:R3*:*)
-       # Delta 88k system running SVR3
-       echo m88k-motorola-sysv3
-       exit 0 ;;
-    XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
-       echo m88k-tektronix-sysv3
-       exit 0 ;;
-    Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
-       echo m68k-tektronix-bsd
-       exit 0 ;;
-    *:IRIX*:*:*)
-       echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
-       exit 0 ;;
-    ????????: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 '
-    i*86:AIX:*:*)
-       echo i386-ibm-aix
-       exit 0 ;;
-    ia64:AIX:*:*)
-       if [ -x /usr/bin/oslevel ] ; then
-               IBM_REV=`/usr/bin/oslevel`
-       else
-               IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
-       fi
-       echo ${UNAME_MACHINE}-ibm-aix${IBM_REV}
-       exit 0 ;;
-    *:AIX:2:3)
-       if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
-               eval $set_cc_for_build
-               sed 's/^                //' << EOF >$dummy.c
-               #include <sys/systemcfg.h>
-
-               main()
-                       {
-                       if (!__power_pc())
-                               exit(1);
-                       puts("powerpc-ibm-aix3.2.5");
-                       exit(0);
-                       }
-EOF
-               $CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0
-               echo rs6000-ibm-aix3.2.5
-       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 0 ;;
-    *:AIX:*:[45])
-       IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
-       if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
-               IBM_ARCH=rs6000
-       else
-               IBM_ARCH=powerpc
-       fi
-       if [ -x /usr/bin/oslevel ] ; then
-               IBM_REV=`/usr/bin/oslevel`
-       else
-               IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
-       fi
-       echo ${IBM_ARCH}-ibm-aix${IBM_REV}
-       exit 0 ;;
-    *:AIX:*:*)
-       echo rs6000-ibm-aix
-       exit 0 ;;
-    ibmrt:4.4BSD:*|romp-ibm:BSD:*)
-       echo romp-ibm-bsd4.4
-       exit 0 ;;
-    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
-    *:BOSX:*:*)
-       echo rs6000-bull-bosx
-       exit 0 ;;
-    DPX/2?00:B.O.S.:*:*)
-       echo m68k-bull-sysv3
-       exit 0 ;;
-    9000/[34]??:4.3bsd:1.*:*)
-       echo m68k-hp-bsd
-       exit 0 ;;
-    hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
-       echo m68k-hp-bsd4.4
-       exit 0 ;;
-    9000/[34678]??:HP-UX:*:*)
-       HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
-       case "${UNAME_MACHINE}" in
-           9000/31? )            HP_ARCH=m68000 ;;
-           9000/[34]?? )         HP_ARCH=m68k ;;
-           9000/[678][0-9][0-9])
-               if [ -x /usr/bin/getconf ]; then
-                   sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
-                    sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
-                    case "${sc_cpu_version}" in
-                      523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
-                      528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
-                      532)                      # CPU_PA_RISC2_0
-                        case "${sc_kernel_bits}" in
-                          32) HP_ARCH="hppa2.0n" ;;
-                          64) HP_ARCH="hppa2.0w" ;;
-                         '') HP_ARCH="hppa2.0" ;;   # HP-UX 10.20
-                        esac ;;
-                    esac
-               fi
-               if [ "${HP_ARCH}" = "" ]; then
-                   eval $set_cc_for_build
-                   sed 's/^              //' << EOF >$dummy.c
-
-              #define _HPUX_SOURCE
-              #include <stdlib.h>
-              #include <unistd.h>
-
-              int main ()
-              {
-              #if defined(_SC_KERNEL_BITS)
-                  long bits = sysconf(_SC_KERNEL_BITS);
-              #endif
-                  long cpu  = sysconf (_SC_CPU_VERSION);
-
-                  switch (cpu)
-               {
-               case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
-               case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
-               case CPU_PA_RISC2_0:
-              #if defined(_SC_KERNEL_BITS)
-                   switch (bits)
-                       {
-                       case 64: puts ("hppa2.0w"); break;
-                       case 32: puts ("hppa2.0n"); break;
-                       default: puts ("hppa2.0"); break;
-                       } break;
-              #else  /* !defined(_SC_KERNEL_BITS) */
-                   puts ("hppa2.0"); break;
-              #endif
-               default: puts ("hppa1.0"); break;
-               }
-                  exit (0);
-              }
-EOF
-                   (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
-                   test -z "$HP_ARCH" && HP_ARCH=hppa
-               fi ;;
-       esac
-       if [ ${HP_ARCH} = "hppa2.0w" ]
-       then
-           # 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
-           then
-               HP_ARCH="hppa2.0w"
-           else
-               HP_ARCH="hppa64"
-           fi
-       fi
-       echo ${HP_ARCH}-hp-hpux${HPUX_REV}
-       exit 0 ;;
-    ia64:HP-UX:*:*)
-       HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
-       echo ia64-hp-hpux${HPUX_REV}
-       exit 0 ;;
-    3050*:HI-UX:*:*)
-       eval $set_cc_for_build
-       sed 's/^        //' << EOF >$dummy.c
-       #include <unistd.h>
-       int
-       main ()
-       {
-         long cpu = sysconf (_SC_CPU_VERSION);
-         /* The order matters, because CPU_IS_HP_MC68K erroneously returns
-            true for CPU_PA_RISC1_0.  CPU_IS_PA_RISC returns correct
-            results, however.  */
-         if (CPU_IS_PA_RISC (cpu))
-           {
-             switch (cpu)
-               {
-                 case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
-                 case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
-                 case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
-                 default: puts ("hppa-hitachi-hiuxwe2"); break;
-               }
-           }
-         else if (CPU_IS_HP_MC68K (cpu))
-           puts ("m68k-hitachi-hiuxwe2");
-         else puts ("unknown-hitachi-hiuxwe2");
-         exit (0);
-       }
-EOF
-       $CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0
-       echo unknown-hitachi-hiuxwe2
-       exit 0 ;;
-    9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
-       echo hppa1.1-hp-bsd
-       exit 0 ;;
-    9000/8??:4.3bsd:*:*)
-       echo hppa1.0-hp-bsd
-       exit 0 ;;
-    *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
-       echo hppa1.0-hp-mpeix
-       exit 0 ;;
-    hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
-       echo hppa1.1-hp-osf
-       exit 0 ;;
-    hp8??:OSF1:*:*)
-       echo hppa1.0-hp-osf
-       exit 0 ;;
-    i*86:OSF1:*:*)
-       if [ -x /usr/sbin/sysversion ] ; then
-           echo ${UNAME_MACHINE}-unknown-osf1mk
-       else
-           echo ${UNAME_MACHINE}-unknown-osf1
-       fi
-       exit 0 ;;
-    parisc*:Lites*:*:*)
-       echo hppa1.1-hp-lites
-       exit 0 ;;
-    C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
-       echo c1-convex-bsd
-        exit 0 ;;
-    C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
-       if getsysinfo -f scalar_acc
-       then echo c32-convex-bsd
-       else echo c2-convex-bsd
-       fi
-        exit 0 ;;
-    C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
-       echo c34-convex-bsd
-        exit 0 ;;
-    C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
-       echo c38-convex-bsd
-        exit 0 ;;
-    C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
-       echo c4-convex-bsd
-        exit 0 ;;
-    CRAY*Y-MP:*:*:*)
-       echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
-       exit 0 ;;
-    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 0 ;;
-    CRAY*TS:*:*:*)
-       echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
-       exit 0 ;;
-    CRAY*T3E:*:*:*)
-       echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
-       exit 0 ;;
-    CRAY*SV1:*:*:*)
-       echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
-       exit 0 ;;
-    *:UNICOS/mp:*:*)
-       echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
-       exit 0 ;;
-    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 ;;
-    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 0 ;;
-    i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
-       echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
-       exit 0 ;;
-    sparc*:BSD/OS:*:*)
-       echo sparc-unknown-bsdi${UNAME_RELEASE}
-       exit 0 ;;
-    *:BSD/OS:*:*)
-       echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
-       exit 0 ;;
-    *:FreeBSD:*:*)
-       echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
-       exit 0 ;;
-    i*:CYGWIN*:*)
-       echo ${UNAME_MACHINE}-pc-cygwin
-       exit 0 ;;
-    i*:MINGW*:*)
-       echo ${UNAME_MACHINE}-pc-mingw32
-       exit 0 ;;
-    i*:PW*:*)
-       echo ${UNAME_MACHINE}-pc-pw32
-       exit 0 ;;
-    x86:Interix*:[34]*)
-       echo i586-pc-interix${UNAME_RELEASE}|sed -e 's/\..*//'
-       exit 0 ;;
-    [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
-       echo i${UNAME_MACHINE}-pc-mks
-       exit 0 ;;
-    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 0 ;;
-    i*:UWIN*:*)
-       echo ${UNAME_MACHINE}-pc-uwin
-       exit 0 ;;
-    amd64:CYGWIN*:*:*)
-       echo x86_64-unknown-cygwin
-       exit 0 ;;
-    p*:CYGWIN*:*)
-       echo powerpcle-unknown-cygwin
-       exit 0 ;;
-    prep*:SunOS:5.*:*)
-       echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
-       exit 0 ;;
-    *:GNU:*:*)
-       # the GNU system
-       echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
-       exit 0 ;;
-    *: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 0 ;;
-    i*86:Minix:*:*)
-       echo ${UNAME_MACHINE}-pc-minix
-       exit 0 ;;
-    arm*:Linux:*:*)
-       echo ${UNAME_MACHINE}-unknown-linux-gnu
-       exit 0 ;;
-    cris:Linux:*:*)
-       echo cris-axis-linux-gnu
-       exit 0 ;;
-    crisv32:Linux:*:*)
-       echo crisv32-axis-linux-gnu
-       exit 0 ;;
-    frv:Linux:*:*)
-       echo frv-unknown-linux-gnu
-       exit 0 ;;
-    ia64:Linux:*:*)
-       echo ${UNAME_MACHINE}-unknown-linux-gnu
-       exit 0 ;;
-    m32r*:Linux:*:*)
-       echo ${UNAME_MACHINE}-unknown-linux-gnu
-       exit 0 ;;
-    m68*:Linux:*:*)
-       echo ${UNAME_MACHINE}-unknown-linux-gnu
-       exit 0 ;;
-    mips:Linux:*:*)
-       eval $set_cc_for_build
-       sed 's/^        //' << EOF >$dummy.c
-       #undef CPU
-       #undef mips
-       #undef mipsel
-       #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
-       CPU=mipsel
-       #else
-       #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
-       CPU=mips
-       #else
-       CPU=
-       #endif
-       #endif
-EOF
-       eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=`
-       test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0
-       ;;
-    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 ;;
-    parisc:Linux:*:* | hppa:Linux:*:*)
-       # Look for CPU level
-       case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
-         PA7*) echo hppa1.1-unknown-linux-gnu ;;
-         PA8*) echo hppa2.0-unknown-linux-gnu ;;
-         *)    echo hppa-unknown-linux-gnu ;;
-       esac
-       exit 0 ;;
-    parisc64:Linux:*:* | hppa64:Linux:*:*)
-       echo hppa64-unknown-linux-gnu
-       exit 0 ;;
-    s390:Linux:*:* | s390x:Linux:*:*)
-       echo ${UNAME_MACHINE}-ibm-linux
-       exit 0 ;;
-    sh64*:Linux:*:*)
-       echo ${UNAME_MACHINE}-unknown-linux-gnu
-       exit 0 ;;
-    sh*:Linux:*:*)
-       echo ${UNAME_MACHINE}-unknown-linux-gnu
-       exit 0 ;;
-    sparc:Linux:*:* | sparc64:Linux:*:*)
-       echo ${UNAME_MACHINE}-unknown-linux-gnu
-       exit 0 ;;
-    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
-       ;;
-    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 0 ;;
-    i*86:UNIX_SV:4.2MP:2.*)
-        # Unixware is an offshoot of SVR4, but it has its own version
-        # number series starting with 2...
-        # I am not positive that other SVR4 systems won't match this,
-       # I just have to hope.  -- rms.
-        # Use sysv4.2uw... so that sysv4* matches it.
-       echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
-       exit 0 ;;
-    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 0 ;;
-    i*86:XTS-300:*:STOP)
-       echo ${UNAME_MACHINE}-unknown-stop
-       exit 0 ;;
-    i*86:atheos:*:*)
-       echo ${UNAME_MACHINE}-unknown-atheos
-       exit 0 ;;
-       i*86:syllable:*:*)
-       echo ${UNAME_MACHINE}-pc-syllable
-       exit 0 ;;
-    i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)
-       echo i386-unknown-lynxos${UNAME_RELEASE}
-       exit 0 ;;
-    i*86:*DOS:*:*)
-       echo ${UNAME_MACHINE}-pc-msdosdjgpp
-       exit 0 ;;
-    i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
-       UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
-       if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
-               echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL}
-       else
-               echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
-       fi
-       exit 0 ;;
-    i*86:*:5:[78]*)
-       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 0 ;;
-    i*86:*:3.2:*)
-       if test -f /usr/options/cb.name; then
-               UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
-               echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
-       elif /bin/uname -X 2>/dev/null >/dev/null ; then
-               UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
-               (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
-               (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
-                       && UNAME_MACHINE=i586
-               (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
-                       && UNAME_MACHINE=i686
-               (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
-                       && UNAME_MACHINE=i686
-               echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
-       else
-               echo ${UNAME_MACHINE}-pc-sysv32
-       fi
-       exit 0 ;;
-    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 ;;
-    Intel:Mach:3*:*)
-       echo i386-pc-mach3
-       exit 0 ;;
-    paragon:*:*:*)
-       echo i860-intel-osf1
-       exit 0 ;;
-    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 0 ;;
-    mini*:CTIX:SYS*5:*)
-       # "miniframe"
-       echo m68010-convergent-sysv
-       exit 0 ;;
-    mc68k:UNIX:SYSTEM5:3.51m)
-       echo m68k-convergent-sysv
-       exit 0 ;;
-    M680?0:D-NIX:5.3:*)
-       echo m68k-diab-dnix
-       exit 0 ;;
-    M68*:*:R3V[5678]*:*)
-       test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;;
-    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
-       /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
-         && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;;
-    3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
-        /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
-          && echo i486-ncr-sysv4 && exit 0 ;;
-    m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
-       echo m68k-unknown-lynxos${UNAME_RELEASE}
-       exit 0 ;;
-    mc68030:UNIX_System_V:4.*:*)
-       echo m68k-atari-sysv4
-       exit 0 ;;
-    TSUNAMI:LynxOS:2.*:*)
-       echo sparc-unknown-lynxos${UNAME_RELEASE}
-       exit 0 ;;
-    rs6000:LynxOS:2.*:*)
-       echo rs6000-unknown-lynxos${UNAME_RELEASE}
-       exit 0 ;;
-    PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*)
-       echo powerpc-unknown-lynxos${UNAME_RELEASE}
-       exit 0 ;;
-    SM[BE]S:UNIX_SV:*:*)
-       echo mips-dde-sysv${UNAME_RELEASE}
-       exit 0 ;;
-    RM*:ReliantUNIX-*:*:*)
-       echo mips-sni-sysv4
-       exit 0 ;;
-    RM*:SINIX-*:*:*)
-       echo mips-sni-sysv4
-       exit 0 ;;
-    *:SINIX-*:*:*)
-       if uname -p 2>/dev/null >/dev/null ; then
-               UNAME_MACHINE=`(uname -p) 2>/dev/null`
-               echo ${UNAME_MACHINE}-sni-sysv4
-       else
-               echo ns32k-sni-sysv
-       fi
-       exit 0 ;;
-    PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
-                      # says <Richard.M.Bartel@ccMail.Census.GOV>
-        echo i586-unisys-sysv4
-        exit 0 ;;
-    *:UNIX_System_V:4*:FTX*)
-       # From Gerald Hewes <hewes@openmarket.com>.
-       # How about differentiating between stratus architectures? -djm
-       echo hppa1.1-stratus-sysv4
-       exit 0 ;;
-    *:*:*:FTX*)
-       # From seanf@swdc.stratus.com.
-       echo i860-stratus-sysv4
-       exit 0 ;;
-    i*86:VOS:*:*)
-       # From Paul.Green@stratus.com.
-       echo ${UNAME_MACHINE}-stratus-vos
-       exit 0 ;;
-    *:VOS:*:*)
-       # From Paul.Green@stratus.com.
-       echo hppa1.1-stratus-vos
-       exit 0 ;;
-    mc68*:A/UX:*:*)
-       echo m68k-apple-aux${UNAME_RELEASE}
-       exit 0 ;;
-    news*:NEWS-OS:6*:*)
-       echo mips-sony-newsos6
-       exit 0 ;;
-    R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
-       if [ -d /usr/nec ]; then
-               echo mips-nec-sysv${UNAME_RELEASE}
-       else
-               echo mips-unknown-sysv${UNAME_RELEASE}
-       fi
-        exit 0 ;;
-    BeBox:BeOS:*:*)    # BeOS running on hardware made by Be, PPC only.
-       echo powerpc-be-beos
-       exit 0 ;;
-    BeMac:BeOS:*:*)    # BeOS running on Mac or Mac clone, PPC only.
-       echo powerpc-apple-beos
-       exit 0 ;;
-    BePC:BeOS:*:*)     # BeOS running on Intel PC compatible.
-       echo i586-pc-beos
-       exit 0 ;;
-    SX-4:SUPER-UX:*:*)
-       echo sx4-nec-superux${UNAME_RELEASE}
-       exit 0 ;;
-    SX-5:SUPER-UX:*:*)
-       echo sx5-nec-superux${UNAME_RELEASE}
-       exit 0 ;;
-    SX-6:SUPER-UX:*:*)
-       echo sx6-nec-superux${UNAME_RELEASE}
-       exit 0 ;;
-    Power*:Rhapsody:*:*)
-       echo powerpc-apple-rhapsody${UNAME_RELEASE}
-       exit 0 ;;
-    *:Rhapsody:*:*)
-       echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
-       exit 0 ;;
-    *:Darwin:*:*)
-       UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
-       case $UNAME_PROCESSOR in
-           *86) UNAME_PROCESSOR=i686 ;;
-           unknown) UNAME_PROCESSOR=powerpc ;;
-       esac
-       echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
-       exit 0 ;;
-    *:procnto*:*:* | *:QNX:[0123456789]*:*)
-       UNAME_PROCESSOR=`uname -p`
-       if test "$UNAME_PROCESSOR" = "x86"; then
-               UNAME_PROCESSOR=i386
-               UNAME_MACHINE=pc
-       fi
-       echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE}
-       exit 0 ;;
-    *:QNX:*:4*)
-       echo i386-pc-qnx
-       exit 0 ;;
-    NSE-?:NONSTOP_KERNEL:*:*)
-       echo nse-tandem-nsk${UNAME_RELEASE}
-       exit 0 ;;
-    NSR-?:NONSTOP_KERNEL:*:*)
-       echo nsr-tandem-nsk${UNAME_RELEASE}
-       exit 0 ;;
-    *:NonStop-UX:*:*)
-       echo mips-compaq-nonstopux
-       exit 0 ;;
-    BS2000:POSIX*:*:*)
-       echo bs2000-siemens-sysv
-       exit 0 ;;
-    DS/*:UNIX_System_V:*:*)
-       echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}
-       exit 0 ;;
-    *:Plan9:*:*)
-       # "uname -m" is not consistent, so use $cputype instead. 386
-       # is converted to i386 for consistency with other x86
-       # operating systems.
-       if test "$cputype" = "386"; then
-           UNAME_MACHINE=i386
-       else
-           UNAME_MACHINE="$cputype"
-       fi
-       echo ${UNAME_MACHINE}-unknown-plan9
-       exit 0 ;;
-    *:TOPS-10:*:*)
-       echo pdp10-unknown-tops10
-       exit 0 ;;
-    *:TENEX:*:*)
-       echo pdp10-unknown-tenex
-       exit 0 ;;
-    KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
-       echo pdp10-dec-tops20
-       exit 0 ;;
-    XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
-       echo pdp10-xkl-tops20
-       exit 0 ;;
-    *:TOPS-20:*:*)
-       echo pdp10-unknown-tops20
-       exit 0 ;;
-    *:ITS:*:*)
-       echo pdp10-unknown-its
-       exit 0 ;;
-    SEI:*:*:SEIUX)
-        echo mips-sei-seiux${UNAME_RELEASE}
-       exit 0 ;;
-    *:DragonFly:*:*)
-       echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
-       exit 0 ;;
-    *:*VMS:*:*)
-       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 ;;
-       esac ;;
-    *:XENIX:*:SysV)
-       echo i386-pc-xenix
-       exit 0 ;;
-esac
-
-#echo '(No uname command or uname output not recognized.)' 1>&2
-#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
-
-eval $set_cc_for_build
-cat >$dummy.c <<EOF
-#ifdef _SEQUENT_
-# include <sys/types.h>
-# include <sys/utsname.h>
-#endif
-main ()
-{
-#if defined (sony)
-#if defined (MIPSEB)
-  /* BFD wants "bsd" instead of "newsos".  Perhaps BFD should be changed,
-     I don't know....  */
-  printf ("mips-sony-bsd\n"); exit (0);
-#else
-#include <sys/param.h>
-  printf ("m68k-sony-newsos%s\n",
-#ifdef NEWSOS4
-          "4"
-#else
-         ""
-#endif
-         ); exit (0);
-#endif
-#endif
-
-#if defined (__arm) && defined (__acorn) && defined (__unix)
-  printf ("arm-acorn-riscix"); exit (0);
-#endif
-
-#if defined (hp300) && !defined (hpux)
-  printf ("m68k-hp-bsd\n"); exit (0);
-#endif
-
-#if defined (NeXT)
-#if !defined (__ARCHITECTURE__)
-#define __ARCHITECTURE__ "m68k"
-#endif
-  int version;
-  version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
-  if (version < 4)
-    printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
-  else
-    printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
-  exit (0);
-#endif
-
-#if defined (MULTIMAX) || defined (n16)
-#if defined (UMAXV)
-  printf ("ns32k-encore-sysv\n"); exit (0);
-#else
-#if defined (CMU)
-  printf ("ns32k-encore-mach\n"); exit (0);
-#else
-  printf ("ns32k-encore-bsd\n"); exit (0);
-#endif
-#endif
-#endif
-
-#if defined (__386BSD__)
-  printf ("i386-pc-bsd\n"); exit (0);
-#endif
-
-#if defined (sequent)
-#if defined (i386)
-  printf ("i386-sequent-dynix\n"); exit (0);
-#endif
-#if defined (ns32000)
-  printf ("ns32k-sequent-dynix\n"); exit (0);
-#endif
-#endif
-
-#if defined (_SEQUENT_)
-    struct utsname un;
-
-    uname(&un);
-
-    if (strncmp(un.version, "V2", 2) == 0) {
-       printf ("i386-sequent-ptx2\n"); exit (0);
-    }
-    if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
-       printf ("i386-sequent-ptx1\n"); exit (0);
-    }
-    printf ("i386-sequent-ptx\n"); exit (0);
-
-#endif
-
-#if defined (vax)
-# if !defined (ultrix)
-#  include <sys/param.h>
-#  if defined (BSD)
-#   if BSD == 43
-      printf ("vax-dec-bsd4.3\n"); exit (0);
-#   else
-#    if BSD == 199006
-      printf ("vax-dec-bsd4.3reno\n"); exit (0);
-#    else
-      printf ("vax-dec-bsd\n"); exit (0);
-#    endif
-#   endif
-#  else
-    printf ("vax-dec-bsd\n"); exit (0);
-#  endif
-# else
-    printf ("vax-dec-ultrix\n"); exit (0);
-# endif
-#endif
-
-#if defined (alliant) && defined (i860)
-  printf ("i860-alliant-bsd\n"); exit (0);
-#endif
-
-  exit (1);
-}
-EOF
-
-$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && $dummy && exit 0
-
-# Apollos put the system type in the environment.
-
-test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; }
-
-# Convex versions that predate uname can use getsysinfo(1)
-
-if [ -x /usr/convex/getsysinfo ]
-then
-    case `getsysinfo -f cpu_type` in
-    c1*)
-       echo c1-convex-bsd
-       exit 0 ;;
-    c2*)
-       if getsysinfo -f scalar_acc
-       then echo c32-convex-bsd
-       else echo c2-convex-bsd
-       fi
-       exit 0 ;;
-    c34*)
-       echo c34-convex-bsd
-       exit 0 ;;
-    c38*)
-       echo c38-convex-bsd
-       exit 0 ;;
-    c4*)
-       echo c4-convex-bsd
-       exit 0 ;;
-    esac
-fi
-
-cat >&2 <<EOF
-$0: unable to guess system type
-
-This script, last modified $timestamp, has failed to recognize
-the operating system you are using. It is advised that you
-download the most up to date version of the config scripts from
-
-  http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.guess
-and
-  http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.sub
-
-If the version you run ($0) is already up to date, please
-send the following data and any information you think might be
-pertinent to <config-patches@gnu.org> in order to provide the needed
-information to handle your system.
-
-config.guess timestamp = $timestamp
-
-uname -m = `(uname -m) 2>/dev/null || echo unknown`
-uname -r = `(uname -r) 2>/dev/null || echo unknown`
-uname -s = `(uname -s) 2>/dev/null || echo unknown`
-uname -v = `(uname -v) 2>/dev/null || echo unknown`
-
-/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
-/bin/uname -X     = `(/bin/uname -X) 2>/dev/null`
-
-hostinfo               = `(hostinfo) 2>/dev/null`
-/bin/universe          = `(/bin/universe) 2>/dev/null`
-/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null`
-/bin/arch              = `(/bin/arch) 2>/dev/null`
-/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null`
-/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
-
-UNAME_MACHINE = ${UNAME_MACHINE}
-UNAME_RELEASE = ${UNAME_RELEASE}
-UNAME_SYSTEM  = ${UNAME_SYSTEM}
-UNAME_VERSION = ${UNAME_VERSION}
-EOF
-
-exit 1
-
-# Local variables:
-# eval: (add-hook 'write-file-hooks 'time-stamp)
-# time-stamp-start: "timestamp='"
-# time-stamp-format: "%:y-%02m-%02d"
-# time-stamp-end: "'"
-# End:
diff --git a/config.sub b/config.sub
deleted file mode 100755 (executable)
index 87a1ee4..0000000
+++ /dev/null
@@ -1,1569 +0,0 @@
-#! /bin/sh
-# Configuration validation subroutine script.
-#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-#   2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
-
-timestamp='2005-04-22'
-
-# This file is (in principle) common to ALL GNU software.
-# The presence of a machine in this file suggests that SOME GNU software
-# can handle that machine.  It does not imply ALL GNU software can.
-#
-# This file is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330,
-# Boston, MA 02111-1307, USA.
-
-# As a special exception to the GNU General Public License, if you
-# distribute this file as part of a program that contains a
-# configuration script generated by Autoconf, you may include it under
-# the same distribution terms that you use for the rest of that program.
-
-# Please send patches to <config-patches@gnu.org>.  Submit a context
-# diff and a properly formatted ChangeLog entry.
-#
-# Configuration subroutine to validate and canonicalize a configuration type.
-# Supply the specified configuration type as an argument.
-# If it is invalid, we print an error message on stderr and exit with code 1.
-# Otherwise, we print the canonical config type on stdout and succeed.
-
-# This file is supposed to be the same for all GNU packages
-# and recognize all the CPU types, system types and aliases
-# that are meaningful with *any* GNU software.
-# Each package is responsible for reporting which valid configurations
-# it does not support.  The user should be able to distinguish
-# a failure to support a valid configuration from a meaningless
-# configuration.
-
-# The goal of this file is to map all the various variations of a given
-# machine specification into a single specification in the form:
-#      CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
-# or in some cases, the newer four-part form:
-#      CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
-# It is wrong to echo any other type of specification.
-
-me=`echo "$0" | sed -e 's,.*/,,'`
-
-usage="\
-Usage: $0 [OPTION] CPU-MFR-OPSYS
-       $0 [OPTION] ALIAS
-
-Canonicalize a configuration name.
-
-Operation modes:
-  -h, --help         print this help, then exit
-  -t, --time-stamp   print date of last modification, then exit
-  -v, --version      print version number, then exit
-
-Report bugs and patches to <config-patches@gnu.org>."
-
-version="\
-GNU config.sub ($timestamp)
-
-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
-Free Software Foundation, Inc.
-
-This is free software; see the source for copying conditions.  There is NO
-warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
-
-help="
-Try \`$me --help' for more information."
-
-# Parse command line
-while test $# -gt 0 ; do
-  case $1 in
-    --time-stamp | --time* | -t )
-       echo "$timestamp" ; exit 0 ;;
-    --version | -v )
-       echo "$version" ; exit 0 ;;
-    --help | --h* | -h )
-       echo "$usage"; exit 0 ;;
-    -- )     # Stop option processing
-       shift; break ;;
-    - )        # Use stdin as input.
-       break ;;
-    -* )
-       echo "$me: invalid option $1$help"
-       exit 1 ;;
-
-    *local*)
-       # First pass through any local machine types.
-       echo $1
-       exit 0;;
-
-    * )
-       break ;;
-  esac
-done
-
-case $# in
- 0) echo "$me: missing argument$help" >&2
-    exit 1;;
- 1) ;;
- *) echo "$me: too many arguments$help" >&2
-    exit 1;;
-esac
-
-# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any).
-# Here we must recognize all the valid KERNEL-OS combinations.
-maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
-case $maybe_os in
-  nto-qnx* | linux-gnu* | linux-dietlibc | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | \
-  kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | storm-chaos* | os2-emx* | rtmk-nova*)
-    os=-$maybe_os
-    basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
-    ;;
-  *)
-    basic_machine=`echo $1 | sed 's/-[^-]*$//'`
-    if [ $basic_machine != $1 ]
-    then os=`echo $1 | sed 's/.*-/-/'`
-    else os=; fi
-    ;;
-esac
-
-### Let's recognize common machines as not being operating systems so
-### that things like config.sub decstation-3100 work.  We also
-### recognize some manufacturers as not being operating systems, so we
-### can provide default operating systems below.
-case $os in
-       -sun*os*)
-               # Prevent following clause from handling this invalid input.
-               ;;
-       -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \
-       -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \
-       -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \
-       -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
-       -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
-       -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
-       -apple | -axis | -knuth | -cray)
-               os=
-               basic_machine=$1
-               ;;
-       -sim | -cisco | -oki | -wec | -winbond)
-               os=
-               basic_machine=$1
-               ;;
-       -scout)
-               ;;
-       -wrs)
-               os=-vxworks
-               basic_machine=$1
-               ;;
-       -chorusos*)
-               os=-chorusos
-               basic_machine=$1
-               ;;
-       -chorusrdb)
-               os=-chorusrdb
-               basic_machine=$1
-               ;;
-       -hiux*)
-               os=-hiuxwe2
-               ;;
-       -sco5)
-               os=-sco3.2v5
-               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
-               ;;
-       -sco4)
-               os=-sco3.2v4
-               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
-               ;;
-       -sco3.2.[4-9]*)
-               os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
-               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
-               ;;
-       -sco3.2v[4-9]*)
-               # Don't forget version if it is 3.2v4 or newer.
-               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
-               ;;
-       -sco*)
-               os=-sco3.2v2
-               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
-               ;;
-       -udk*)
-               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
-               ;;
-       -isc)
-               os=-isc2.2
-               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
-               ;;
-       -clix*)
-               basic_machine=clipper-intergraph
-               ;;
-       -isc*)
-               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
-               ;;
-       -lynx*)
-               os=-lynxos
-               ;;
-       -ptx*)
-               basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'`
-               ;;
-       -windowsnt*)
-               os=`echo $os | sed -e 's/windowsnt/winnt/'`
-               ;;
-       -psos*)
-               os=-psos
-               ;;
-       -mint | -mint[0-9]*)
-               basic_machine=m68k-atari
-               os=-mint
-               ;;
-esac
-
-# Decode aliases for certain CPU-COMPANY combinations.
-case $basic_machine in
-       # Recognize the basic CPU types without company name.
-       # Some are omitted here because they have special meanings below.
-       1750a | 580 \
-       | a29k \
-       | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
-       | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
-       | am33_2.0 \
-       | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \
-       | bfin \
-       | c4x | clipper \
-       | d10v | d30v | dlx | dsp16xx \
-       | fr30 | frv \
-       | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
-       | i370 | i860 | i960 | ia64 \
-       | ip2k | iq2000 \
-       | m32r | m32rle | m68000 | m68k | m88k | maxq | mcore \
-       | mips | mipsbe | mipseb | mipsel | mipsle \
-       | mips16 \
-       | mips64 | mips64el \
-       | mips64vr | mips64vrel \
-       | mips64orion | mips64orionel \
-       | mips64vr4100 | mips64vr4100el \
-       | mips64vr4300 | mips64vr4300el \
-       | mips64vr5000 | mips64vr5000el \
-       | mipsisa32 | mipsisa32el \
-       | mipsisa32r2 | mipsisa32r2el \
-       | mipsisa64 | mipsisa64el \
-       | mipsisa64r2 | mipsisa64r2el \
-       | mipsisa64sb1 | mipsisa64sb1el \
-       | mipsisa64sr71k | mipsisa64sr71kel \
-       | mipstx39 | mipstx39el \
-       | mn10200 | mn10300 \
-       | msp430 \
-       | ns16k | ns32k \
-       | openrisc | or32 \
-       | pdp10 | pdp11 | pj | pjl \
-       | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
-       | pyramid \
-       | sh | sh[1234] | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \
-       | sh64 | sh64le \
-       | sparc | sparc64 | sparc64b | sparc86x | sparclet | sparclite \
-       | sparcv8 | sparcv9 | sparcv9b \
-       | strongarm \
-       | tahoe | thumb | tic4x | tic80 | tron \
-       | v850 | v850e \
-       | we32k \
-       | x86 | xscale | xscalee[bl] | xstormy16 | xtensa \
-       | z8k)
-               basic_machine=$basic_machine-unknown
-               ;;
-       m6811 | m68hc11 | m6812 | m68hc12)
-               # Motorola 68HC11/12.
-               basic_machine=$basic_machine-unknown
-               os=-none
-               ;;
-       m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k)
-               ;;
-
-       # We use `pc' rather than `unknown'
-       # because (1) that's what they normally are, and
-       # (2) the word "unknown" tends to confuse beginning users.
-       i*86 | x86_64)
-         basic_machine=$basic_machine-pc
-         ;;
-       # Object if more than one company name word.
-       *-*-*)
-               echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
-               exit 1
-               ;;
-       # Recognize the basic CPU types with company name.
-       580-* \
-       | a29k-* \
-       | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
-       | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
-       | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
-       | arm-*  | armbe-* | armle-* | armeb-* | armv*-* \
-       | avr-* \
-       | bfin-* | bs2000-* \
-       | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \
-       | clipper-* | craynv-* | cydra-* \
-       | d10v-* | d30v-* | dlx-* \
-       | elxsi-* \
-       | f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \
-       | h8300-* | h8500-* \
-       | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
-       | i*86-* | i860-* | i960-* | ia64-* \
-       | ip2k-* | iq2000-* \
-       | m32r-* | m32rle-* \
-       | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
-       | m88110-* | m88k-* | maxq-* | mcore-* \
-       | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
-       | mips16-* \
-       | mips64-* | mips64el-* \
-       | mips64vr-* | mips64vrel-* \
-       | mips64orion-* | mips64orionel-* \
-       | mips64vr4100-* | mips64vr4100el-* \
-       | mips64vr4300-* | mips64vr4300el-* \
-       | mips64vr5000-* | mips64vr5000el-* \
-       | mipsisa32-* | mipsisa32el-* \
-       | mipsisa32r2-* | mipsisa32r2el-* \
-       | mipsisa64-* | mipsisa64el-* \
-       | mipsisa64r2-* | mipsisa64r2el-* \
-       | mipsisa64sb1-* | mipsisa64sb1el-* \
-       | mipsisa64sr71k-* | mipsisa64sr71kel-* \
-       | mipstx39-* | mipstx39el-* \
-       | mmix-* \
-       | msp430-* \
-       | none-* | np1-* | ns16k-* | ns32k-* \
-       | orion-* \
-       | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
-       | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
-       | pyramid-* \
-       | romp-* | rs6000-* \
-       | sh-* | sh[1234]-* | sh[23]e-* | sh[34]eb-* | shbe-* \
-       | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
-       | sparc-* | sparc64-* | sparc64b-* | sparc86x-* | sparclet-* \
-       | sparclite-* \
-       | sparcv8-* | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \
-       | tahoe-* | thumb-* \
-       | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
-       | tron-* \
-       | v850-* | v850e-* | vax-* \
-       | we32k-* \
-       | x86-* | x86_64-* | xps100-* | xscale-* | xscalee[bl]-* \
-       | xstormy16-* | xtensa-* \
-       | ymp-* \
-       | z8k-*)
-               ;;
-       # Recognize the various machine names and aliases which stand
-       # for a CPU type and a company and sometimes even an OS.
-       386bsd)
-               basic_machine=i386-unknown
-               os=-bsd
-               ;;
-       3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
-               basic_machine=m68000-att
-               ;;
-       3b*)
-               basic_machine=we32k-att
-               ;;
-       a29khif)
-               basic_machine=a29k-amd
-               os=-udi
-               ;;
-       abacus)
-               basic_machine=abacus-unknown
-               ;;
-       adobe68k)
-               basic_machine=m68010-adobe
-               os=-scout
-               ;;
-       alliant | fx80)
-               basic_machine=fx80-alliant
-               ;;
-       altos | altos3068)
-               basic_machine=m68k-altos
-               ;;
-       am29k)
-               basic_machine=a29k-none
-               os=-bsd
-               ;;
-       amd64)
-               basic_machine=x86_64-pc
-               ;;
-       amd64-*)
-               basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'`
-               ;;
-       amdahl)
-               basic_machine=580-amdahl
-               os=-sysv
-               ;;
-       amiga | amiga-*)
-               basic_machine=m68k-unknown
-               ;;
-       amigaos | amigados)
-               basic_machine=m68k-unknown
-               os=-amigaos
-               ;;
-       amigaunix | amix)
-               basic_machine=m68k-unknown
-               os=-sysv4
-               ;;
-       apollo68)
-               basic_machine=m68k-apollo
-               os=-sysv
-               ;;
-       apollo68bsd)
-               basic_machine=m68k-apollo
-               os=-bsd
-               ;;
-       aux)
-               basic_machine=m68k-apple
-               os=-aux
-               ;;
-       balance)
-               basic_machine=ns32k-sequent
-               os=-dynix
-               ;;
-       c90)
-               basic_machine=c90-cray
-               os=-unicos
-               ;;
-       convex-c1)
-               basic_machine=c1-convex
-               os=-bsd
-               ;;
-       convex-c2)
-               basic_machine=c2-convex
-               os=-bsd
-               ;;
-       convex-c32)
-               basic_machine=c32-convex
-               os=-bsd
-               ;;
-       convex-c34)
-               basic_machine=c34-convex
-               os=-bsd
-               ;;
-       convex-c38)
-               basic_machine=c38-convex
-               os=-bsd
-               ;;
-       cray | j90)
-               basic_machine=j90-cray
-               os=-unicos
-               ;;
-       craynv)
-               basic_machine=craynv-cray
-               os=-unicosmp
-               ;;
-       cr16c)
-               basic_machine=cr16c-unknown
-               os=-elf
-               ;;
-       crds | unos)
-               basic_machine=m68k-crds
-               ;;
-       crisv32 | crisv32-* | etraxfs*)
-               basic_machine=crisv32-axis
-               ;;
-       cris | cris-* | etrax*)
-               basic_machine=cris-axis
-               ;;
-       crx)
-               basic_machine=crx-unknown
-               os=-elf
-               ;;
-       da30 | da30-*)
-               basic_machine=m68k-da30
-               ;;
-       decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn)
-               basic_machine=mips-dec
-               ;;
-       decsystem10* | dec10*)
-               basic_machine=pdp10-dec
-               os=-tops10
-               ;;
-       decsystem20* | dec20*)
-               basic_machine=pdp10-dec
-               os=-tops20
-               ;;
-       delta | 3300 | motorola-3300 | motorola-delta \
-             | 3300-motorola | delta-motorola)
-               basic_machine=m68k-motorola
-               ;;
-       delta88)
-               basic_machine=m88k-motorola
-               os=-sysv3
-               ;;
-       djgpp)
-               basic_machine=i586-pc
-               os=-msdosdjgpp
-               ;;
-       dpx20 | dpx20-*)
-               basic_machine=rs6000-bull
-               os=-bosx
-               ;;
-       dpx2* | dpx2*-bull)
-               basic_machine=m68k-bull
-               os=-sysv3
-               ;;
-       ebmon29k)
-               basic_machine=a29k-amd
-               os=-ebmon
-               ;;
-       elxsi)
-               basic_machine=elxsi-elxsi
-               os=-bsd
-               ;;
-       encore | umax | mmax)
-               basic_machine=ns32k-encore
-               ;;
-       es1800 | OSE68k | ose68k | ose | OSE)
-               basic_machine=m68k-ericsson
-               os=-ose
-               ;;
-       fx2800)
-               basic_machine=i860-alliant
-               ;;
-       genix)
-               basic_machine=ns32k-ns
-               ;;
-       gmicro)
-               basic_machine=tron-gmicro
-               os=-sysv
-               ;;
-       go32)
-               basic_machine=i386-pc
-               os=-go32
-               ;;
-       h3050r* | hiux*)
-               basic_machine=hppa1.1-hitachi
-               os=-hiuxwe2
-               ;;
-       h8300hms)
-               basic_machine=h8300-hitachi
-               os=-hms
-               ;;
-       h8300xray)
-               basic_machine=h8300-hitachi
-               os=-xray
-               ;;
-       h8500hms)
-               basic_machine=h8500-hitachi
-               os=-hms
-               ;;
-       harris)
-               basic_machine=m88k-harris
-               os=-sysv3
-               ;;
-       hp300-*)
-               basic_machine=m68k-hp
-               ;;
-       hp300bsd)
-               basic_machine=m68k-hp
-               os=-bsd
-               ;;
-       hp300hpux)
-               basic_machine=m68k-hp
-               os=-hpux
-               ;;
-       hp3k9[0-9][0-9] | hp9[0-9][0-9])
-               basic_machine=hppa1.0-hp
-               ;;
-       hp9k2[0-9][0-9] | hp9k31[0-9])
-               basic_machine=m68000-hp
-               ;;
-       hp9k3[2-9][0-9])
-               basic_machine=m68k-hp
-               ;;
-       hp9k6[0-9][0-9] | hp6[0-9][0-9])
-               basic_machine=hppa1.0-hp
-               ;;
-       hp9k7[0-79][0-9] | hp7[0-79][0-9])
-               basic_machine=hppa1.1-hp
-               ;;
-       hp9k78[0-9] | hp78[0-9])
-               # FIXME: really hppa2.0-hp
-               basic_machine=hppa1.1-hp
-               ;;
-       hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893)
-               # FIXME: really hppa2.0-hp
-               basic_machine=hppa1.1-hp
-               ;;
-       hp9k8[0-9][13679] | hp8[0-9][13679])
-               basic_machine=hppa1.1-hp
-               ;;
-       hp9k8[0-9][0-9] | hp8[0-9][0-9])
-               basic_machine=hppa1.0-hp
-               ;;
-       hppa-next)
-               os=-nextstep3
-               ;;
-       hppaosf)
-               basic_machine=hppa1.1-hp
-               os=-osf
-               ;;
-       hppro)
-               basic_machine=hppa1.1-hp
-               os=-proelf
-               ;;
-       i370-ibm* | ibm*)
-               basic_machine=i370-ibm
-               ;;
-# I'm not sure what "Sysv32" means.  Should this be sysv3.2?
-       i*86v32)
-               basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
-               os=-sysv32
-               ;;
-       i*86v4*)
-               basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
-               os=-sysv4
-               ;;
-       i*86v)
-               basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
-               os=-sysv
-               ;;
-       i*86sol2)
-               basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
-               os=-solaris2
-               ;;
-       i386mach)
-               basic_machine=i386-mach
-               os=-mach
-               ;;
-       i386-vsta | vsta)
-               basic_machine=i386-unknown
-               os=-vsta
-               ;;
-       iris | iris4d)
-               basic_machine=mips-sgi
-               case $os in
-                   -irix*)
-                       ;;
-                   *)
-                       os=-irix4
-                       ;;
-               esac
-               ;;
-       isi68 | isi)
-               basic_machine=m68k-isi
-               os=-sysv
-               ;;
-       m88k-omron*)
-               basic_machine=m88k-omron
-               ;;
-       magnum | m3230)
-               basic_machine=mips-mips
-               os=-sysv
-               ;;
-       merlin)
-               basic_machine=ns32k-utek
-               os=-sysv
-               ;;
-       mingw32)
-               basic_machine=i386-pc
-               os=-mingw32
-               ;;
-       miniframe)
-               basic_machine=m68000-convergent
-               ;;
-       *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*)
-               basic_machine=m68k-atari
-               os=-mint
-               ;;
-       mips3*-*)
-               basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
-               ;;
-       mips3*)
-               basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
-               ;;
-       monitor)
-               basic_machine=m68k-rom68k
-               os=-coff
-               ;;
-       morphos)
-               basic_machine=powerpc-unknown
-               os=-morphos
-               ;;
-       msdos)
-               basic_machine=i386-pc
-               os=-msdos
-               ;;
-       mvs)
-               basic_machine=i370-ibm
-               os=-mvs
-               ;;
-       ncr3000)
-               basic_machine=i486-ncr
-               os=-sysv4
-               ;;
-       netbsd386)
-               basic_machine=i386-unknown
-               os=-netbsd
-               ;;
-       netwinder)
-               basic_machine=armv4l-rebel
-               os=-linux
-               ;;
-       news | news700 | news800 | news900)
-               basic_machine=m68k-sony
-               os=-newsos
-               ;;
-       news1000)
-               basic_machine=m68030-sony
-               os=-newsos
-               ;;
-       news-3600 | risc-news)
-               basic_machine=mips-sony
-               os=-newsos
-               ;;
-       necv70)
-               basic_machine=v70-nec
-               os=-sysv
-               ;;
-       next | m*-next )
-               basic_machine=m68k-next
-               case $os in
-                   -nextstep* )
-                       ;;
-                   -ns2*)
-                     os=-nextstep2
-                       ;;
-                   *)
-                     os=-nextstep3
-                       ;;
-               esac
-               ;;
-       nh3000)
-               basic_machine=m68k-harris
-               os=-cxux
-               ;;
-       nh[45]000)
-               basic_machine=m88k-harris
-               os=-cxux
-               ;;
-       nindy960)
-               basic_machine=i960-intel
-               os=-nindy
-               ;;
-       mon960)
-               basic_machine=i960-intel
-               os=-mon960
-               ;;
-       nonstopux)
-               basic_machine=mips-compaq
-               os=-nonstopux
-               ;;
-       np1)
-               basic_machine=np1-gould
-               ;;
-       nsr-tandem)
-               basic_machine=nsr-tandem
-               ;;
-       op50n-* | op60c-*)
-               basic_machine=hppa1.1-oki
-               os=-proelf
-               ;;
-       or32 | or32-*)
-               basic_machine=or32-unknown
-               os=-coff
-               ;;
-       os400)
-               basic_machine=powerpc-ibm
-               os=-os400
-               ;;
-       OSE68000 | ose68000)
-               basic_machine=m68000-ericsson
-               os=-ose
-               ;;
-       os68k)
-               basic_machine=m68k-none
-               os=-os68k
-               ;;
-       pa-hitachi)
-               basic_machine=hppa1.1-hitachi
-               os=-hiuxwe2
-               ;;
-       paragon)
-               basic_machine=i860-intel
-               os=-osf
-               ;;
-       pbd)
-               basic_machine=sparc-tti
-               ;;
-       pbb)
-               basic_machine=m68k-tti
-               ;;
-       pc532 | pc532-*)
-               basic_machine=ns32k-pc532
-               ;;
-       pentium | p5 | k5 | k6 | nexgen | viac3)
-               basic_machine=i586-pc
-               ;;
-       pentiumpro | p6 | 6x86 | athlon | athlon_*)
-               basic_machine=i686-pc
-               ;;
-       pentiumii | pentium2 | pentiumiii | pentium3)
-               basic_machine=i686-pc
-               ;;
-       pentium4)
-               basic_machine=i786-pc
-               ;;
-       pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
-               basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
-               ;;
-       pentiumpro-* | p6-* | 6x86-* | athlon-*)
-               basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
-               ;;
-       pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*)
-               basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
-               ;;
-       pentium4-*)
-               basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'`
-               ;;
-       pn)
-               basic_machine=pn-gould
-               ;;
-       power)  basic_machine=power-ibm
-               ;;
-       ppc)    basic_machine=powerpc-unknown
-               ;;
-       ppc-*)  basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
-               ;;
-       ppcle | powerpclittle | ppc-le | powerpc-little)
-               basic_machine=powerpcle-unknown
-               ;;
-       ppcle-* | powerpclittle-*)
-               basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`
-               ;;
-       ppc64)  basic_machine=powerpc64-unknown
-               ;;
-       ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`
-               ;;
-       ppc64le | powerpc64little | ppc64-le | powerpc64-little)
-               basic_machine=powerpc64le-unknown
-               ;;
-       ppc64le-* | powerpc64little-*)
-               basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'`
-               ;;
-       ps2)
-               basic_machine=i386-ibm
-               ;;
-       pw32)
-               basic_machine=i586-unknown
-               os=-pw32
-               ;;
-       rom68k)
-               basic_machine=m68k-rom68k
-               os=-coff
-               ;;
-       rm[46]00)
-               basic_machine=mips-siemens
-               ;;
-       rtpc | rtpc-*)
-               basic_machine=romp-ibm
-               ;;
-       s390 | s390-*)
-               basic_machine=s390-ibm
-               ;;
-       s390x | s390x-*)
-               basic_machine=s390x-ibm
-               ;;
-       sa29200)
-               basic_machine=a29k-amd
-               os=-udi
-               ;;
-       sb1)
-               basic_machine=mipsisa64sb1-unknown
-               ;;
-       sb1el)
-               basic_machine=mipsisa64sb1el-unknown
-               ;;
-       sei)
-               basic_machine=mips-sei
-               os=-seiux
-               ;;
-       sequent)
-               basic_machine=i386-sequent
-               ;;
-       sh)
-               basic_machine=sh-hitachi
-               os=-hms
-               ;;
-       sh64)
-               basic_machine=sh64-unknown
-               ;;
-       sparclite-wrs | simso-wrs)
-               basic_machine=sparclite-wrs
-               os=-vxworks
-               ;;
-       sps7)
-               basic_machine=m68k-bull
-               os=-sysv2
-               ;;
-       spur)
-               basic_machine=spur-unknown
-               ;;
-       st2000)
-               basic_machine=m68k-tandem
-               ;;
-       stratus)
-               basic_machine=i860-stratus
-               os=-sysv4
-               ;;
-       sun2)
-               basic_machine=m68000-sun
-               ;;
-       sun2os3)
-               basic_machine=m68000-sun
-               os=-sunos3
-               ;;
-       sun2os4)
-               basic_machine=m68000-sun
-               os=-sunos4
-               ;;
-       sun3os3)
-               basic_machine=m68k-sun
-               os=-sunos3
-               ;;
-       sun3os4)
-               basic_machine=m68k-sun
-               os=-sunos4
-               ;;
-       sun4os3)
-               basic_machine=sparc-sun
-               os=-sunos3
-               ;;
-       sun4os4)
-               basic_machine=sparc-sun
-               os=-sunos4
-               ;;
-       sun4sol2)
-               basic_machine=sparc-sun
-               os=-solaris2
-               ;;
-       sun3 | sun3-*)
-               basic_machine=m68k-sun
-               ;;
-       sun4)
-               basic_machine=sparc-sun
-               ;;
-       sun386 | sun386i | roadrunner)
-               basic_machine=i386-sun
-               ;;
-       sv1)
-               basic_machine=sv1-cray
-               os=-unicos
-               ;;
-       symmetry)
-               basic_machine=i386-sequent
-               os=-dynix
-               ;;
-       t3e)
-               basic_machine=alphaev5-cray
-               os=-unicos
-               ;;
-       t90)
-               basic_machine=t90-cray
-               os=-unicos
-               ;;
-       tic54x | c54x*)
-               basic_machine=tic54x-unknown
-               os=-coff
-               ;;
-       tic55x | c55x*)
-               basic_machine=tic55x-unknown
-               os=-coff
-               ;;
-       tic6x | c6x*)
-               basic_machine=tic6x-unknown
-               os=-coff
-               ;;
-       tx39)
-               basic_machine=mipstx39-unknown
-               ;;
-       tx39el)
-               basic_machine=mipstx39el-unknown
-               ;;
-       toad1)
-               basic_machine=pdp10-xkl
-               os=-tops20
-               ;;
-       tower | tower-32)
-               basic_machine=m68k-ncr
-               ;;
-       tpf)
-               basic_machine=s390x-ibm
-               os=-tpf
-               ;;
-       udi29k)
-               basic_machine=a29k-amd
-               os=-udi
-               ;;
-       ultra3)
-               basic_machine=a29k-nyu
-               os=-sym1
-               ;;
-       v810 | necv810)
-               basic_machine=v810-nec
-               os=-none
-               ;;
-       vaxv)
-               basic_machine=vax-dec
-               os=-sysv
-               ;;
-       vms)
-               basic_machine=vax-dec
-               os=-vms
-               ;;
-       vpp*|vx|vx-*)
-               basic_machine=f301-fujitsu
-               ;;
-       vxworks960)
-               basic_machine=i960-wrs
-               os=-vxworks
-               ;;
-       vxworks68)
-               basic_machine=m68k-wrs
-               os=-vxworks
-               ;;
-       vxworks29k)
-               basic_machine=a29k-wrs
-               os=-vxworks
-               ;;
-       w65*)
-               basic_machine=w65-wdc
-               os=-none
-               ;;
-       w89k-*)
-               basic_machine=hppa1.1-winbond
-               os=-proelf
-               ;;
-       xbox)
-               basic_machine=i686-pc
-               os=-mingw32
-               ;;
-       xps | xps100)
-               basic_machine=xps100-honeywell
-               ;;
-       ymp)
-               basic_machine=ymp-cray
-               os=-unicos
-               ;;
-       z8k-*-coff)
-               basic_machine=z8k-unknown
-               os=-sim
-               ;;
-       none)
-               basic_machine=none-none
-               os=-none
-               ;;
-
-# Here we handle the default manufacturer of certain CPU types.  It is in
-# some cases the only manufacturer, in others, it is the most popular.
-       w89k)
-               basic_machine=hppa1.1-winbond
-               ;;
-       op50n)
-               basic_machine=hppa1.1-oki
-               ;;
-       op60c)
-               basic_machine=hppa1.1-oki
-               ;;
-       romp)
-               basic_machine=romp-ibm
-               ;;
-       mmix)
-               basic_machine=mmix-knuth
-               ;;
-       rs6000)
-               basic_machine=rs6000-ibm
-               ;;
-       vax)
-               basic_machine=vax-dec
-               ;;
-       pdp10)
-               # there are many clones, so DEC is not a safe bet
-               basic_machine=pdp10-unknown
-               ;;
-       pdp11)
-               basic_machine=pdp11-dec
-               ;;
-       we32k)
-               basic_machine=we32k-att
-               ;;
-       sh3 | sh4 | sh[34]eb | sh[1234]le | sh[23]ele)
-               basic_machine=sh-unknown
-               ;;
-       sh64)
-               basic_machine=sh64-unknown
-               ;;
-       sparc | sparcv8 | sparcv9 | sparcv9b)
-               basic_machine=sparc-sun
-               ;;
-       cydra)
-               basic_machine=cydra-cydrome
-               ;;
-       orion)
-               basic_machine=orion-highlevel
-               ;;
-       orion105)
-               basic_machine=clipper-highlevel
-               ;;
-       mac | mpw | mac-mpw)
-               basic_machine=m68k-apple
-               ;;
-       pmac | pmac-mpw)
-               basic_machine=powerpc-apple
-               ;;
-       *-unknown)
-               # Make sure to match an already-canonicalized machine name.
-               ;;
-       *)
-               echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
-               exit 1
-               ;;
-esac
-
-# Here we canonicalize certain aliases for manufacturers.
-case $basic_machine in
-       *-digital*)
-               basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'`
-               ;;
-       *-commodore*)
-               basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'`
-               ;;
-       *)
-               ;;
-esac
-
-# Decode manufacturer-specific aliases for certain operating systems.
-
-if [ x"$os" != x"" ]
-then
-case $os in
-        # First match some system type aliases
-        # that might get confused with valid system types.
-       # -solaris* is a basic system type, with this one exception.
-       -solaris1 | -solaris1.*)
-               os=`echo $os | sed -e 's|solaris1|sunos4|'`
-               ;;
-       -solaris)
-               os=-solaris2
-               ;;
-       -svr4*)
-               os=-sysv4
-               ;;
-       -unixware*)
-               os=-sysv4.2uw
-               ;;
-       -gnu/linux*)
-               os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
-               ;;
-       # First accept the basic system types.
-       # The portable systems comes first.
-       # Each alternative MUST END IN A *, to match a version number.
-       # -sysv* is not here because it comes later, after sysvr4.
-       -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
-             | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\
-             | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \
-             | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
-             | -aos* \
-             | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
-             | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
-             | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* | -openbsd* \
-             | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
-             | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
-             | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
-             | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
-             | -chorusos* | -chorusrdb* \
-             | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
-             | -mingw32* | -linux-gnu* | -linux-uclibc* | -uxpv* | -beos* | -mpeix* | -udk* \
-             | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
-             | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
-             | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
-             | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
-             | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
-             | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly*)
-       # Remember, each alternative MUST END IN *, to match a version number.
-               ;;
-       -qnx*)
-               case $basic_machine in
-                   x86-* | i*86-*)
-                       ;;
-                   *)
-                       os=-nto$os
-                       ;;
-               esac
-               ;;
-       -nto-qnx*)
-               ;;
-       -nto*)
-               os=`echo $os | sed -e 's|nto|nto-qnx|'`
-               ;;
-       -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
-             | -windows* | -osx | -abug | -netware* | -os9* | -beos* \
-             | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*)
-               ;;
-       -mac*)
-               os=`echo $os | sed -e 's|mac|macos|'`
-               ;;
-       -linux-dietlibc)
-               os=-linux-dietlibc
-               ;;
-       -linux*)
-               os=`echo $os | sed -e 's|linux|linux-gnu|'`
-               ;;
-       -sunos5*)
-               os=`echo $os | sed -e 's|sunos5|solaris2|'`
-               ;;
-       -sunos6*)
-               os=`echo $os | sed -e 's|sunos6|solaris3|'`
-               ;;
-       -opened*)
-               os=-openedition
-               ;;
-        -os400*)
-               os=-os400
-               ;;
-       -wince*)
-               os=-wince
-               ;;
-       -osfrose*)
-               os=-osfrose
-               ;;
-       -osf*)
-               os=-osf
-               ;;
-       -utek*)
-               os=-bsd
-               ;;
-       -dynix*)
-               os=-bsd
-               ;;
-       -acis*)
-               os=-aos
-               ;;
-       -atheos*)
-               os=-atheos
-               ;;
-       -syllable*)
-               os=-syllable
-               ;;
-       -386bsd)
-               os=-bsd
-               ;;
-       -ctix* | -uts*)
-               os=-sysv
-               ;;
-       -nova*)
-               os=-rtmk-nova
-               ;;
-       -ns2 )
-               os=-nextstep2
-               ;;
-       -nsk*)
-               os=-nsk
-               ;;
-       # Preserve the version number of sinix5.
-       -sinix5.*)
-               os=`echo $os | sed -e 's|sinix|sysv|'`
-               ;;
-       -sinix*)
-               os=-sysv4
-               ;;
-        -tpf*)
-               os=-tpf
-               ;;
-       -triton*)
-               os=-sysv3
-               ;;
-       -oss*)
-               os=-sysv3
-               ;;
-       -svr4)
-               os=-sysv4
-               ;;
-       -svr3)
-               os=-sysv3
-               ;;
-       -sysvr4)
-               os=-sysv4
-               ;;
-       # This must come after -sysvr4.
-       -sysv*)
-               ;;
-       -ose*)
-               os=-ose
-               ;;
-       -es1800*)
-               os=-ose
-               ;;
-       -xenix)
-               os=-xenix
-               ;;
-       -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
-               os=-mint
-               ;;
-       -aros*)
-               os=-aros
-               ;;
-       -kaos*)
-               os=-kaos
-               ;;
-       -zvmoe)
-               os=-zvmoe
-               ;;
-       -none)
-               ;;
-       *)
-               # Get rid of the `-' at the beginning of $os.
-               os=`echo $os | sed 's/[^-]*-//'`
-               echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2
-               exit 1
-               ;;
-esac
-else
-
-# Here we handle the default operating systems that come with various machines.
-# The value should be what the vendor currently ships out the door with their
-# machine or put another way, the most popular os provided with the machine.
-
-# Note that if you're going to try to match "-MANUFACTURER" here (say,
-# "-sun"), then you have to tell the case statement up towards the top
-# that MANUFACTURER isn't an operating system.  Otherwise, code above
-# will signal an error saying that MANUFACTURER isn't an operating
-# system, and we'll never get to this point.
-
-case $basic_machine in
-       *-acorn)
-               os=-riscix1.2
-               ;;
-       arm*-rebel)
-               os=-linux
-               ;;
-       arm*-semi)
-               os=-aout
-               ;;
-    c4x-* | tic4x-*)
-        os=-coff
-        ;;
-       # This must come before the *-dec entry.
-       pdp10-*)
-               os=-tops20
-               ;;
-       pdp11-*)
-               os=-none
-               ;;
-       *-dec | vax-*)
-               os=-ultrix4.2
-               ;;
-       m68*-apollo)
-               os=-domain
-               ;;
-       i386-sun)
-               os=-sunos4.0.2
-               ;;
-       m68000-sun)
-               os=-sunos3
-               # This also exists in the configure program, but was not the
-               # default.
-               # os=-sunos4
-               ;;
-       m68*-cisco)
-               os=-aout
-               ;;
-       mips*-cisco)
-               os=-elf
-               ;;
-       mips*-*)
-               os=-elf
-               ;;
-       or32-*)
-               os=-coff
-               ;;
-       *-tti)  # must be before sparc entry or we get the wrong os.
-               os=-sysv3
-               ;;
-       sparc-* | *-sun)
-               os=-sunos4.1.1
-               ;;
-       *-be)
-               os=-beos
-               ;;
-       *-ibm)
-               os=-aix
-               ;;
-       *-knuth)
-               os=-mmixware
-               ;;
-       *-wec)
-               os=-proelf
-               ;;
-       *-winbond)
-               os=-proelf
-               ;;
-       *-oki)
-               os=-proelf
-               ;;
-       *-hp)
-               os=-hpux
-               ;;
-       *-hitachi)
-               os=-hiux
-               ;;
-       i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
-               os=-sysv
-               ;;
-       *-cbm)
-               os=-amigaos
-               ;;
-       *-dg)
-               os=-dgux
-               ;;
-       *-dolphin)
-               os=-sysv3
-               ;;
-       m68k-ccur)
-               os=-rtu
-               ;;
-       m88k-omron*)
-               os=-luna
-               ;;
-       *-next )
-               os=-nextstep
-               ;;
-       *-sequent)
-               os=-ptx
-               ;;
-       *-crds)
-               os=-unos
-               ;;
-       *-ns)
-               os=-genix
-               ;;
-       i370-*)
-               os=-mvs
-               ;;
-       *-next)
-               os=-nextstep3
-               ;;
-       *-gould)
-               os=-sysv
-               ;;
-       *-highlevel)
-               os=-bsd
-               ;;
-       *-encore)
-               os=-bsd
-               ;;
-       *-sgi)
-               os=-irix
-               ;;
-       *-siemens)
-               os=-sysv4
-               ;;
-       *-masscomp)
-               os=-rtu
-               ;;
-       f30[01]-fujitsu | f700-fujitsu)
-               os=-uxpv
-               ;;
-       *-rom68k)
-               os=-coff
-               ;;
-       *-*bug)
-               os=-coff
-               ;;
-       *-apple)
-               os=-macos
-               ;;
-       *-atari*)
-               os=-mint
-               ;;
-       *)
-               os=-none
-               ;;
-esac
-fi
-
-# Here we handle the case where we know the os, and the CPU type, but not the
-# manufacturer.  We pick the logical manufacturer.
-vendor=unknown
-case $basic_machine in
-       *-unknown)
-               case $os in
-                       -riscix*)
-                               vendor=acorn
-                               ;;
-                       -sunos*)
-                               vendor=sun
-                               ;;
-                       -aix*)
-                               vendor=ibm
-                               ;;
-                       -beos*)
-                               vendor=be
-                               ;;
-                       -hpux*)
-                               vendor=hp
-                               ;;
-                       -mpeix*)
-                               vendor=hp
-                               ;;
-                       -hiux*)
-                               vendor=hitachi
-                               ;;
-                       -unos*)
-                               vendor=crds
-                               ;;
-                       -dgux*)
-                               vendor=dg
-                               ;;
-                       -luna*)
-                               vendor=omron
-                               ;;
-                       -genix*)
-                               vendor=ns
-                               ;;
-                       -mvs* | -opened*)
-                               vendor=ibm
-                               ;;
-                       -os400*)
-                               vendor=ibm
-                               ;;
-                       -ptx*)
-                               vendor=sequent
-                               ;;
-                       -tpf*)
-                               vendor=ibm
-                               ;;
-                       -vxsim* | -vxworks* | -windiss*)
-                               vendor=wrs
-                               ;;
-                       -aux*)
-                               vendor=apple
-                               ;;
-                       -hms*)
-                               vendor=hitachi
-                               ;;
-                       -mpw* | -macos*)
-                               vendor=apple
-                               ;;
-                       -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
-                               vendor=atari
-                               ;;
-                       -vos*)
-                               vendor=stratus
-                               ;;
-               esac
-               basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
-               ;;
-esac
-
-echo $basic_machine$os
-exit 0
-
-# Local variables:
-# eval: (add-hook 'write-file-hooks 'time-stamp)
-# time-stamp-start: "timestamp='"
-# time-stamp-format: "%:y-%02m-%02d"
-# time-stamp-end: "'"
-# End:
index ce57eec..1fdc3f7 100755 (executable)
--- a/configure
+++ b/configure
@@ -1,60 +1,83 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.61 for avsystem 1.0.
+# Generated by GNU Autoconf 2.67 for avsystem 1.0.
+#
 #
 # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
-# 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
+# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software
+# Foundation, Inc.
+#
+#
 # This configure script is free software; the Free Software Foundation
 # gives unlimited permission to copy, distribute and modify it.
-## --------------------- ##
-## M4sh Initialization.  ##
-## --------------------- ##
+## -------------------- ##
+## M4sh Initialization. ##
+## -------------------- ##
 
 # Be more Bourne compatible
 DUALCASE=1; export DUALCASE # for MKS sh
-if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then :
   emulate sh
   NULLCMD=:
-  # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
+  # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
   # is contrary to our usage.  Disable this feature.
   alias -g '${1+"$@"}'='"$@"'
   setopt NO_GLOB_SUBST
 else
-  case `(set -o) 2>/dev/null` in
-  *posix*) set -o posix ;;
+  case `(set -o) 2>/dev/null` in #(
+  *posix*) :
+    set -o posix ;; #(
+  *) :
+     ;;
 esac
-
 fi
 
 
-
-
-# PATH needs CR
-# Avoid depending upon Character Ranges.
-as_cr_letters='abcdefghijklmnopqrstuvwxyz'
-as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
-as_cr_Letters=$as_cr_letters$as_cr_LETTERS
-as_cr_digits='0123456789'
-as_cr_alnum=$as_cr_Letters$as_cr_digits
-
-# The user is always right.
-if test "${PATH_SEPARATOR+set}" != set; then
-  echo "#! /bin/sh" >conf$$.sh
-  echo  "exit 0"   >>conf$$.sh
-  chmod +x conf$$.sh
-  if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
-    PATH_SEPARATOR=';'
+as_nl='
+'
+export as_nl
+# Printing a long string crashes Solaris 7 /usr/bin/printf.
+as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
+as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo
+as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo
+# Prefer a ksh shell builtin over an external printf program on Solaris,
+# but without wasting forks for bash or zsh.
+if test -z "$BASH_VERSION$ZSH_VERSION" \
+    && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then
+  as_echo='print -r --'
+  as_echo_n='print -rn --'
+elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
+  as_echo='printf %s\n'
+  as_echo_n='printf %s'
+else
+  if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then
+    as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"'
+    as_echo_n='/usr/ucb/echo -n'
   else
-    PATH_SEPARATOR=:
+    as_echo_body='eval expr "X$1" : "X\\(.*\\)"'
+    as_echo_n_body='eval
+      arg=$1;
+      case $arg in #(
+      *"$as_nl"*)
+       expr "X$arg" : "X\\(.*\\)$as_nl";
+       arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;;
+      esac;
+      expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl"
+    '
+    export as_echo_n_body
+    as_echo_n='sh -c $as_echo_n_body as_echo'
   fi
-  rm -f conf$$.sh
+  export as_echo_body
+  as_echo='sh -c $as_echo_body as_echo'
 fi
 
-# Support unset when possible.
-if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
-  as_unset=unset
-else
-  as_unset=false
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+  PATH_SEPARATOR=:
+  (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
+    (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
+      PATH_SEPARATOR=';'
+  }
 fi
 
 
@@ -63,20 +86,18 @@ fi
 # there to prevent editors from complaining about space-tab.
 # (If _AS_PATH_WALK were called with IFS unset, it would disable word
 # splitting by setting IFS to empty value.)
-as_nl='
-'
 IFS=" ""       $as_nl"
 
 # Find who we are.  Look in the path if we contain no directory separator.
-case $0 in
+case $0 in #((
   *[\\/]* ) as_myself=$0 ;;
   *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
 for as_dir in $PATH
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
-done
+    test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+  done
 IFS=$as_save_IFS
 
      ;;
@@ -87,32 +108,270 @@ if test "x$as_myself" = x; then
   as_myself=$0
 fi
 if test ! -f "$as_myself"; then
-  echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
-  { (exit 1); exit 1; }
+  $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
+  exit 1
 fi
 
-# Work around bugs in pre-3.0 UWIN ksh.
-for as_var in ENV MAIL MAILPATH
-do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
+# Unset variables that we do not need and which cause bugs (e.g. in
+# pre-3.0 UWIN ksh).  But do not cause bugs in bash 2.01; the "|| exit 1"
+# suppresses any "Segmentation fault" message there.  '((' could
+# trigger a bug in pdksh 5.2.14.
+for as_var in BASH_ENV ENV MAIL MAILPATH
+do eval test x\${$as_var+set} = xset \
+  && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || :
 done
 PS1='$ '
 PS2='> '
 PS4='+ '
 
 # NLS nuisances.
-for as_var in \
-  LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
-  LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
-  LC_TELEPHONE LC_TIME
+LC_ALL=C
+export LC_ALL
+LANGUAGE=C
+export LANGUAGE
+
+# CDPATH.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+if test "x$CONFIG_SHELL" = x; then
+  as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then :
+  emulate sh
+  NULLCMD=:
+  # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which
+  # is contrary to our usage.  Disable this feature.
+  alias -g '\${1+\"\$@\"}'='\"\$@\"'
+  setopt NO_GLOB_SUBST
+else
+  case \`(set -o) 2>/dev/null\` in #(
+  *posix*) :
+    set -o posix ;; #(
+  *) :
+     ;;
+esac
+fi
+"
+  as_required="as_fn_return () { (exit \$1); }
+as_fn_success () { as_fn_return 0; }
+as_fn_failure () { as_fn_return 1; }
+as_fn_ret_success () { return 0; }
+as_fn_ret_failure () { return 1; }
+
+exitcode=0
+as_fn_success || { exitcode=1; echo as_fn_success failed.; }
+as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; }
+as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; }
+as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; }
+if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then :
+
+else
+  exitcode=1; echo positional parameters were not saved.
+fi
+test x\$exitcode = x0 || exit 1"
+  as_suggested="  as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO
+  as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO
+  eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" &&
+  test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1
+test \$(( 1 + 1 )) = 2 || exit 1"
+  if (eval "$as_required") 2>/dev/null; then :
+  as_have_required=yes
+else
+  as_have_required=no
+fi
+  if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then :
+
+else
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+as_found=false
+for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
 do
-  if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
-    eval $as_var=C; export $as_var
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  as_found=:
+  case $as_dir in #(
+        /*)
+          for as_base in sh bash ksh sh5; do
+            # Try only shells that exist, to save several forks.
+            as_shell=$as_dir/$as_base
+            if { test -f "$as_shell" || test -f "$as_shell.exe"; } &&
+                   { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then :
+  CONFIG_SHELL=$as_shell as_have_required=yes
+                  if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then :
+  break 2
+fi
+fi
+          done;;
+       esac
+  as_found=false
+done
+$as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } &&
+             { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then :
+  CONFIG_SHELL=$SHELL as_have_required=yes
+fi; }
+IFS=$as_save_IFS
+
+
+      if test "x$CONFIG_SHELL" != x; then :
+  # We cannot yet assume a decent shell, so we have to provide a
+       # neutralization value for shells without unset; and this also
+       # works around shells that cannot unset nonexistent variables.
+       BASH_ENV=/dev/null
+       ENV=/dev/null
+       (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
+       export CONFIG_SHELL
+       exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"}
+fi
+
+    if test x$as_have_required = xno; then :
+  $as_echo "$0: This script requires a shell more modern than all"
+  $as_echo "$0: the shells that I found on your system."
+  if test x${ZSH_VERSION+set} = xset ; then
+    $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should"
+    $as_echo "$0: be upgraded to zsh 4.3.4 or later."
   else
-    ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
+    $as_echo "$0: Please tell bug-autoconf@gnu.org about your system,
+$0: including any error possibly output before this
+$0: message. Then install a modern shell, or manually run
+$0: the script under such a shell if you do have one."
   fi
-done
+  exit 1
+fi
+fi
+fi
+SHELL=${CONFIG_SHELL-/bin/sh}
+export SHELL
+# Unset more variables known to interfere with behavior of common tools.
+CLICOLOR_FORCE= GREP_OPTIONS=
+unset CLICOLOR_FORCE GREP_OPTIONS
+
+## --------------------- ##
+## M4sh Shell Functions. ##
+## --------------------- ##
+# as_fn_unset VAR
+# ---------------
+# Portably unset VAR.
+as_fn_unset ()
+{
+  { eval $1=; unset $1;}
+}
+as_unset=as_fn_unset
+
+# as_fn_set_status STATUS
+# -----------------------
+# Set $? to STATUS, without forking.
+as_fn_set_status ()
+{
+  return $1
+} # as_fn_set_status
+
+# as_fn_exit STATUS
+# -----------------
+# Exit the shell with STATUS, even in a "trap 0" or "set -e" context.
+as_fn_exit ()
+{
+  set +e
+  as_fn_set_status $1
+  exit $1
+} # as_fn_exit
+
+# as_fn_mkdir_p
+# -------------
+# Create "$as_dir" as a directory, including parents if necessary.
+as_fn_mkdir_p ()
+{
+
+  case $as_dir in #(
+  -*) as_dir=./$as_dir;;
+  esac
+  test -d "$as_dir" || eval $as_mkdir_p || {
+    as_dirs=
+    while :; do
+      case $as_dir in #(
+      *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'(
+      *) as_qdir=$as_dir;;
+      esac
+      as_dirs="'$as_qdir' $as_dirs"
+      as_dir=`$as_dirname -- "$as_dir" ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+        X"$as_dir" : 'X\(//\)[^/]' \| \
+        X"$as_dir" : 'X\(//\)$' \| \
+        X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$as_dir" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+           s//\1/
+           q
+         }
+         /^X\(\/\/\)[^/].*/{
+           s//\1/
+           q
+         }
+         /^X\(\/\/\)$/{
+           s//\1/
+           q
+         }
+         /^X\(\/\).*/{
+           s//\1/
+           q
+         }
+         s/.*/./; q'`
+      test -d "$as_dir" && break
+    done
+    test -z "$as_dirs" || eval "mkdir $as_dirs"
+  } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir"
+
+
+} # as_fn_mkdir_p
+# as_fn_append VAR VALUE
+# ----------------------
+# Append the text in VALUE to the end of the definition contained in VAR. Take
+# advantage of any shell optimizations that allow amortized linear growth over
+# repeated appends, instead of the typical quadratic growth present in naive
+# implementations.
+if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then :
+  eval 'as_fn_append ()
+  {
+    eval $1+=\$2
+  }'
+else
+  as_fn_append ()
+  {
+    eval $1=\$$1\$2
+  }
+fi # as_fn_append
+
+# as_fn_arith ARG...
+# ------------------
+# Perform arithmetic evaluation on the ARGs, and store the result in the
+# global $as_val. Take advantage of shells that can avoid forks. The arguments
+# must be portable across $(()) and expr.
+if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then :
+  eval 'as_fn_arith ()
+  {
+    as_val=$(( $* ))
+  }'
+else
+  as_fn_arith ()
+  {
+    as_val=`expr "$@" || test $? -eq 1`
+  }
+fi # as_fn_arith
+
+
+# as_fn_error STATUS ERROR [LINENO LOG_FD]
+# ----------------------------------------
+# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are
+# provided, also output the error to LOG_FD, referencing LINENO. Then exit the
+# script with STATUS, using 1 if that was 0.
+as_fn_error ()
+{
+  as_status=$1; test $as_status -eq 0 && as_status=1
+  if test "$4"; then
+    as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+    $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4
+  fi
+  $as_echo "$as_me: error: $2" >&2
+  as_fn_exit $as_status
+} # as_fn_error
 
-# Required to use basename.
 if expr a : '\(a\)' >/dev/null 2>&1 &&
    test "X`expr 00001 : '.*\(...\)'`" = X001; then
   as_expr=expr
@@ -126,13 +385,17 @@ else
   as_basename=false
 fi
 
+if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
+  as_dirname=dirname
+else
+  as_dirname=false
+fi
 
-# Name of the executable.
 as_me=`$as_basename -- "$0" ||
 $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
         X"$0" : 'X\(//\)$' \| \
         X"$0" : 'X\(/\)' \| . 2>/dev/null ||
-echo X/"$0" |
+$as_echo X/"$0" |
     sed '/^.*\/\([^/][^/]*\)\/*$/{
            s//\1/
            q
@@ -147,418 +410,132 @@ echo X/"$0" |
          }
          s/.*/./; q'`
 
-# CDPATH.
-$as_unset CDPATH
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
 
 
-if test "x$CONFIG_SHELL" = x; then
-  if (eval ":") 2>/dev/null; then
-  as_have_required=yes
-else
-  as_have_required=no
-fi
+  as_lineno_1=$LINENO as_lineno_1a=$LINENO
+  as_lineno_2=$LINENO as_lineno_2a=$LINENO
+  eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" &&
+  test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || {
+  # Blame Lee E. McMahon (1931-1989) for sed's syntax.  :-)
+  sed -n '
+    p
+    /[$]LINENO/=
+  ' <$as_myself |
+    sed '
+      s/[$]LINENO.*/&-/
+      t lineno
+      b
+      :lineno
+      N
+      :loop
+      s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/
+      t loop
+      s/-\n.*//
+    ' >$as_me.lineno &&
+  chmod +x "$as_me.lineno" ||
+    { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; }
 
-  if test $as_have_required = yes &&    (eval ":
-(as_func_return () {
-  (exit \$1)
-}
-as_func_success () {
-  as_func_return 0
-}
-as_func_failure () {
-  as_func_return 1
-}
-as_func_ret_success () {
-  return 0
-}
-as_func_ret_failure () {
-  return 1
+  # Don't try to exec as it changes $[0], causing all sort of problems
+  # (the dirname of $[0] is not the place where we might find the
+  # original and so on.  Autoconf is especially sensitive to this).
+  . "./$as_me.lineno"
+  # Exit status is that of the last command.
+  exit
 }
 
-exitcode=0
-if as_func_success; then
-  :
-else
-  exitcode=1
-  echo as_func_success failed.
-fi
-
-if as_func_failure; then
-  exitcode=1
-  echo as_func_failure succeeded.
-fi
+ECHO_C= ECHO_N= ECHO_T=
+case `echo -n x` in #(((((
+-n*)
+  case `echo 'xy\c'` in
+  *c*) ECHO_T='        ';;     # ECHO_T is single tab character.
+  xy)  ECHO_C='\c';;
+  *)   echo `echo ksh88 bug on AIX 6.1` > /dev/null
+       ECHO_T='        ';;
+  esac;;
+*)
+  ECHO_N='-n';;
+esac
 
-if as_func_ret_success; then
-  :
+rm -f conf$$ conf$$.exe conf$$.file
+if test -d conf$$.dir; then
+  rm -f conf$$.dir/conf$$.file
+else
+  rm -f conf$$.dir
+  mkdir conf$$.dir 2>/dev/null
+fi
+if (echo >conf$$.file) 2>/dev/null; then
+  if ln -s conf$$.file conf$$ 2>/dev/null; then
+    as_ln_s='ln -s'
+    # ... but there are two gotchas:
+    # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
+    # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
+    # In both cases, we have to default to `cp -p'.
+    ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
+      as_ln_s='cp -p'
+  elif ln conf$$.file conf$$ 2>/dev/null; then
+    as_ln_s=ln
+  else
+    as_ln_s='cp -p'
+  fi
 else
-  exitcode=1
-  echo as_func_ret_success failed.
+  as_ln_s='cp -p'
 fi
+rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
+rmdir conf$$.dir 2>/dev/null
 
-if as_func_ret_failure; then
-  exitcode=1
-  echo as_func_ret_failure succeeded.
+if mkdir -p . 2>/dev/null; then
+  as_mkdir_p='mkdir -p "$as_dir"'
+else
+  test -d ./-p && rmdir ./-p
+  as_mkdir_p=false
 fi
 
-if ( set x; as_func_ret_success y && test x = \"\$1\" ); then
-  :
+if test -x / >/dev/null 2>&1; then
+  as_test_x='test -x'
 else
-  exitcode=1
-  echo positional parameters were not saved.
+  if ls -dL / >/dev/null 2>&1; then
+    as_ls_L_option=L
+  else
+    as_ls_L_option=
+  fi
+  as_test_x='
+    eval sh -c '\''
+      if test -d "$1"; then
+       test -d "$1/.";
+      else
+       case $1 in #(
+       -*)set "./$1";;
+       esac;
+       case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #((
+       ???[sx]*):;;*)false;;esac;fi
+    '\'' sh
+  '
 fi
+as_executable_p=$as_test_x
 
-test \$exitcode = 0) || { (exit 1); exit 1; }
+# Sed expression to map a string onto a valid CPP name.
+as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
 
-(
-  as_lineno_1=\$LINENO
-  as_lineno_2=\$LINENO
-  test \"x\$as_lineno_1\" != \"x\$as_lineno_2\" &&
-  test \"x\`expr \$as_lineno_1 + 1\`\" = \"x\$as_lineno_2\") || { (exit 1); exit 1; }
-") 2> /dev/null; then
-  :
-else
-  as_candidate_shells=
-    as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  case $as_dir in
-        /*)
-          for as_base in sh bash ksh sh5; do
-            as_candidate_shells="$as_candidate_shells $as_dir/$as_base"
-          done;;
-       esac
-done
-IFS=$as_save_IFS
+# Sed expression to map a string onto a valid variable name.
+as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
 
 
-      for as_shell in $as_candidate_shells $SHELL; do
-        # Try only shells that exist, to save several forks.
-        if { test -f "$as_shell" || test -f "$as_shell.exe"; } &&
-               { ("$as_shell") 2> /dev/null <<\_ASEOF
-if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
-  emulate sh
-  NULLCMD=:
-  # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
-  # is contrary to our usage.  Disable this feature.
-  alias -g '${1+"$@"}'='"$@"'
-  setopt NO_GLOB_SUBST
-else
-  case `(set -o) 2>/dev/null` in
-  *posix*) set -o posix ;;
-esac
 
-fi
+# Check that we are running under the correct shell.
+SHELL=${CONFIG_SHELL-/bin/sh}
 
-
-:
-_ASEOF
-}; then
-  CONFIG_SHELL=$as_shell
-              as_have_required=yes
-              if { "$as_shell" 2> /dev/null <<\_ASEOF
-if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
-  emulate sh
-  NULLCMD=:
-  # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
-  # is contrary to our usage.  Disable this feature.
-  alias -g '${1+"$@"}'='"$@"'
-  setopt NO_GLOB_SUBST
-else
-  case `(set -o) 2>/dev/null` in
-  *posix*) set -o posix ;;
-esac
-
-fi
-
-
-:
-(as_func_return () {
-  (exit $1)
-}
-as_func_success () {
-  as_func_return 0
-}
-as_func_failure () {
-  as_func_return 1
-}
-as_func_ret_success () {
-  return 0
-}
-as_func_ret_failure () {
-  return 1
-}
-
-exitcode=0
-if as_func_success; then
-  :
-else
-  exitcode=1
-  echo as_func_success failed.
-fi
-
-if as_func_failure; then
-  exitcode=1
-  echo as_func_failure succeeded.
-fi
-
-if as_func_ret_success; then
-  :
-else
-  exitcode=1
-  echo as_func_ret_success failed.
-fi
-
-if as_func_ret_failure; then
-  exitcode=1
-  echo as_func_ret_failure succeeded.
-fi
-
-if ( set x; as_func_ret_success y && test x = "$1" ); then
-  :
-else
-  exitcode=1
-  echo positional parameters were not saved.
-fi
-
-test $exitcode = 0) || { (exit 1); exit 1; }
-
-(
-  as_lineno_1=$LINENO
-  as_lineno_2=$LINENO
-  test "x$as_lineno_1" != "x$as_lineno_2" &&
-  test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2") || { (exit 1); exit 1; }
-
-_ASEOF
-}; then
-  break
-fi
-
-fi
-
-      done
-
-      if test "x$CONFIG_SHELL" != x; then
-  for as_var in BASH_ENV ENV
-        do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
-        done
-        export CONFIG_SHELL
-        exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"}
-fi
-
-
-    if test $as_have_required = no; then
-  echo This script requires a shell more modern than all the
-      echo shells that I found on your system.  Please install a
-      echo modern shell, or manually run the script under such a
-      echo shell if you do have one.
-      { (exit 1); exit 1; }
-fi
-
-
-fi
-
-fi
-
-
-
-(eval "as_func_return () {
-  (exit \$1)
-}
-as_func_success () {
-  as_func_return 0
-}
-as_func_failure () {
-  as_func_return 1
-}
-as_func_ret_success () {
-  return 0
-}
-as_func_ret_failure () {
-  return 1
-}
-
-exitcode=0
-if as_func_success; then
-  :
-else
-  exitcode=1
-  echo as_func_success failed.
-fi
-
-if as_func_failure; then
-  exitcode=1
-  echo as_func_failure succeeded.
-fi
-
-if as_func_ret_success; then
-  :
-else
-  exitcode=1
-  echo as_func_ret_success failed.
-fi
-
-if as_func_ret_failure; then
-  exitcode=1
-  echo as_func_ret_failure succeeded.
-fi
-
-if ( set x; as_func_ret_success y && test x = \"\$1\" ); then
-  :
-else
-  exitcode=1
-  echo positional parameters were not saved.
-fi
-
-test \$exitcode = 0") || {
-  echo No shell found that supports shell functions.
-  echo Please tell autoconf@gnu.org about your system,
-  echo including any error possibly output before this
-  echo message
-}
-
-
-
-  as_lineno_1=$LINENO
-  as_lineno_2=$LINENO
-  test "x$as_lineno_1" != "x$as_lineno_2" &&
-  test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || {
-
-  # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
-  # uniformly replaced by the line number.  The first 'sed' inserts a
-  # line-number line after each line using $LINENO; the second 'sed'
-  # does the real work.  The second script uses 'N' to pair each
-  # line-number line with the line containing $LINENO, and appends
-  # trailing '-' during substitution so that $LINENO is not a special
-  # case at line end.
-  # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
-  # scripts with optimization help from Paolo Bonzini.  Blame Lee
-  # E. McMahon (1931-1989) for sed's syntax.  :-)
-  sed -n '
-    p
-    /[$]LINENO/=
-  ' <$as_myself |
-    sed '
-      s/[$]LINENO.*/&-/
-      t lineno
-      b
-      :lineno
-      N
-      :loop
-      s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/
-      t loop
-      s/-\n.*//
-    ' >$as_me.lineno &&
-  chmod +x "$as_me.lineno" ||
-    { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2
-   { (exit 1); exit 1; }; }
-
-  # Don't try to exec as it changes $[0], causing all sort of problems
-  # (the dirname of $[0] is not the place where we might find the
-  # original and so on.  Autoconf is especially sensitive to this).
-  . "./$as_me.lineno"
-  # Exit status is that of the last command.
-  exit
-}
-
-
-if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
-  as_dirname=dirname
-else
-  as_dirname=false
-fi
-
-ECHO_C= ECHO_N= ECHO_T=
-case `echo -n x` in
--n*)
-  case `echo 'x\c'` in
-  *c*) ECHO_T='        ';;     # ECHO_T is single tab character.
-  *)   ECHO_C='\c';;
-  esac;;
-*)
-  ECHO_N='-n';;
-esac
-
-if expr a : '\(a\)' >/dev/null 2>&1 &&
-   test "X`expr 00001 : '.*\(...\)'`" = X001; then
-  as_expr=expr
-else
-  as_expr=false
-fi
-
-rm -f conf$$ conf$$.exe conf$$.file
-if test -d conf$$.dir; then
-  rm -f conf$$.dir/conf$$.file
-else
-  rm -f conf$$.dir
-  mkdir conf$$.dir
-fi
-echo >conf$$.file
-if ln -s conf$$.file conf$$ 2>/dev/null; then
-  as_ln_s='ln -s'
-  # ... but there are two gotchas:
-  # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
-  # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
-  # In both cases, we have to default to `cp -p'.
-  ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
-    as_ln_s='cp -p'
-elif ln conf$$.file conf$$ 2>/dev/null; then
-  as_ln_s=ln
-else
-  as_ln_s='cp -p'
-fi
-rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
-rmdir conf$$.dir 2>/dev/null
-
-if mkdir -p . 2>/dev/null; then
-  as_mkdir_p=:
-else
-  test -d ./-p && rmdir ./-p
-  as_mkdir_p=false
-fi
-
-if test -x / >/dev/null 2>&1; then
-  as_test_x='test -x'
-else
-  if ls -dL / >/dev/null 2>&1; then
-    as_ls_L_option=L
-  else
-    as_ls_L_option=
-  fi
-  as_test_x='
-    eval sh -c '\''
-      if test -d "$1"; then
-        test -d "$1/.";
-      else
-       case $1 in
-        -*)set "./$1";;
-       esac;
-       case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in
-       ???[sx]*):;;*)false;;esac;fi
-    '\'' sh
-  '
-fi
-as_executable_p=$as_test_x
-
-# Sed expression to map a string onto a valid CPP name.
-as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
-
-# Sed expression to map a string onto a valid variable name.
-as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
-
-
-
-
-# Check that we are running under the correct shell.
-SHELL=${CONFIG_SHELL-/bin/sh}
-
-case X$lt_ECHO in
-X*--fallback-echo)
-  # Remove one level of quotation (which was required for Make).
-  ECHO=`echo "$lt_ECHO" | sed 's,\\\\\$\\$0,'$0','`
-  ;;
-esac
+case X$lt_ECHO in
+X*--fallback-echo)
+  # Remove one level of quotation (which was required for Make).
+  ECHO=`echo "$lt_ECHO" | sed 's,\\\\\$\\$0,'$0','`
+  ;;
+esac
 
 ECHO=${lt_ECHO-echo}
 if test "X$1" = X--no-reexec; then
@@ -698,10 +675,11 @@ fi
 
 
 
-exec 7<&0 </dev/null 6>&1
+test -n "$DJDIR" || exec 7<&0 </dev/null
+exec 6>&1
 
 # Name of the host.
-# hostname on some systems (SVR3.2, Linux) returns a bogus exit status,
+# hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status,
 # so uname gets run too.
 ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q`
 
@@ -716,7 +694,6 @@ cross_compiling=no
 subdirs=
 MFLAGS=
 MAKEFLAGS=
-SHELL=${CONFIG_SHELL-/bin/sh}
 
 # Identity of this package.
 PACKAGE_NAME='avsystem'
@@ -724,7 +701,9 @@ PACKAGE_TARNAME='avsystem'
 PACKAGE_VERSION='1.0'
 PACKAGE_STRING='avsystem 1.0'
 PACKAGE_BUGREPORT=''
+PACKAGE_URL=''
 
+ac_header_list=
 # Factoring default headers for most tests.
 ac_includes_default="\
 #include <stdio.h>
@@ -761,123 +740,154 @@ ac_includes_default="\
 # include <unistd.h>
 #endif"
 
-ac_subst_vars='SHELL
-PATH_SEPARATOR
-PACKAGE_NAME
-PACKAGE_TARNAME
-PACKAGE_VERSION
-PACKAGE_STRING
-PACKAGE_BUGREPORT
-exec_prefix
-prefix
-program_transform_name
-bindir
-sbindir
-libexecdir
-datarootdir
-datadir
-sysconfdir
-sharedstatedir
-localstatedir
-includedir
-oldincludedir
-docdir
-infodir
-htmldir
-dvidir
-pdfdir
-psdir
-libdir
-localedir
-mandir
-DEFS
-ECHO_C
-ECHO_N
-ECHO_T
-LIBS
-build_alias
-host_alias
-target_alias
-INSTALL_PROGRAM
-INSTALL_SCRIPT
-INSTALL_DATA
-am__isrc
-CYGPATH_W
-PACKAGE
-VERSION
-ACLOCAL
-AUTOCONF
-AUTOMAKE
-AUTOHEADER
-MAKEINFO
-install_sh
-STRIP
-INSTALL_STRIP_PROGRAM
-mkdir_p
-AWK
-SET_MAKE
-am__leading_dot
-AMTAR
-am__tar
-am__untar
-CC
-CFLAGS
-LDFLAGS
-CPPFLAGS
-ac_ct_CC
-EXEEXT
-OBJEXT
-DEPDIR
-am__include
-am__quote
-AMDEP_TRUE
-AMDEP_FALSE
-AMDEPBACKSLASH
-CCDEPMODE
-am__fastdepCC_TRUE
-am__fastdepCC_FALSE
-CPP
-GREP
-EGREP
-LIBOBJS
-LIBTOOL
-build
-build_cpu
-build_vendor
-build_os
-host
-host_cpu
-host_vendor
-host_os
-SED
-FGREP
-LD
-DUMPBIN
-ac_ct_DUMPBIN
-NM
-LN_S
-AR
-RANLIB
-lt_ECHO
-DSYMUTIL
-NMEDIT
-LIPO
-OTOOL
-OTOOL64
-IS_AQUILA_TRUE
-IS_AQUILA_FALSE
-IS_SDK_TRUE
-IS_SDK_FALSE
-PKG_CONFIG
-AVSYSTEM_CFLAGS
-AVSYSTEM_LIBS
-MMCOMMON_CFLAGS
-MMCOMMON_LIBS
-MMLOG_CFLAGS
-MMLOG_LIBS
+ac_subst_vars='am__EXEEXT_FALSE
+am__EXEEXT_TRUE
+LTLIBOBJS
 ALLOCA
-LTLIBOBJS'
+USE_PULSE_FALSE
+USE_PULSE_TRUE
+PULSE_LIBS
+PULSE_CFLAGS
+HEYNOTI_LIBS
+HEYNOTI_CFLAGS
+VCONF_LIBS
+VCONF_CFLAGS
+GLIB2_LIBS
+GLIB2_CFLAGS
+AUDIOSESSIONMGR_LIBS
+AUDIOSESSIONMGR_CFLAGS
+MMSESSION_LIBS
+MMSESSION_CFLAGS
+MMLOG_LIBS
+MMLOG_CFLAGS
+MMCOMMON_LIBS
+MMCOMMON_CFLAGS
+AVSYSTEM_LIBS
+AVSYSTEM_CFLAGS
+PKG_CONFIG_LIBDIR
+PKG_CONFIG_PATH
+PKG_CONFIG
+IS_SDK_FALSE
+IS_SDK_TRUE
+OTOOL64
+OTOOL
+LIPO
+NMEDIT
+DSYMUTIL
+lt_ECHO
+RANLIB
+AR
+OBJDUMP
+LN_S
+NM
+ac_ct_DUMPBIN
+DUMPBIN
+LD
+FGREP
+SED
+host_os
+host_vendor
+host_cpu
+host
+build_os
+build_vendor
+build_cpu
+build
+LIBTOOL
+LIBOBJS
+EGREP
+GREP
+CPP
+am__fastdepCC_FALSE
+am__fastdepCC_TRUE
+CCDEPMODE
+AMDEPBACKSLASH
+AMDEP_FALSE
+AMDEP_TRUE
+am__quote
+am__include
+DEPDIR
+OBJEXT
+EXEEXT
+ac_ct_CC
+CPPFLAGS
+LDFLAGS
+CFLAGS
+CC
+am__untar
+am__tar
+AMTAR
+am__leading_dot
+SET_MAKE
+AWK
+mkdir_p
+MKDIR_P
+INSTALL_STRIP_PROGRAM
+STRIP
+install_sh
+MAKEINFO
+AUTOHEADER
+AUTOMAKE
+AUTOCONF
+ACLOCAL
+VERSION
+PACKAGE
+CYGPATH_W
+am__isrc
+INSTALL_DATA
+INSTALL_SCRIPT
+INSTALL_PROGRAM
+target_alias
+host_alias
+build_alias
+LIBS
+ECHO_T
+ECHO_N
+ECHO_C
+DEFS
+mandir
+localedir
+libdir
+psdir
+pdfdir
+dvidir
+htmldir
+infodir
+docdir
+oldincludedir
+includedir
+localstatedir
+sharedstatedir
+sysconfdir
+datadir
+datarootdir
+libexecdir
+sbindir
+bindir
+program_transform_name
+prefix
+exec_prefix
+PACKAGE_URL
+PACKAGE_BUGREPORT
+PACKAGE_STRING
+PACKAGE_VERSION
+PACKAGE_TARNAME
+PACKAGE_NAME
+PATH_SEPARATOR
+SHELL'
 ac_subst_files=''
+ac_user_opts='
+enable_option_checking
+enable_dependency_tracking
+enable_shared
+enable_static
+with_pic
+enable_fast_install
+with_gnu_ld
+enable_libtool_lock
+enable_sdk
+enable_pulse
+'
       ac_precious_vars='build_alias
 host_alias
 target_alias
@@ -888,17 +898,33 @@ LIBS
 CPPFLAGS
 CPP
 PKG_CONFIG
+PKG_CONFIG_PATH
+PKG_CONFIG_LIBDIR
 AVSYSTEM_CFLAGS
 AVSYSTEM_LIBS
 MMCOMMON_CFLAGS
 MMCOMMON_LIBS
 MMLOG_CFLAGS
-MMLOG_LIBS'
+MMLOG_LIBS
+MMSESSION_CFLAGS
+MMSESSION_LIBS
+AUDIOSESSIONMGR_CFLAGS
+AUDIOSESSIONMGR_LIBS
+GLIB2_CFLAGS
+GLIB2_LIBS
+VCONF_CFLAGS
+VCONF_LIBS
+HEYNOTI_CFLAGS
+HEYNOTI_LIBS
+PULSE_CFLAGS
+PULSE_LIBS'
 
 
 # Initialize some variables set by options.
 ac_init_help=
 ac_init_version=false
+ac_unrecognized_opts=
+ac_unrecognized_sep=
 # The variables have the same names as the options, with
 # dashes changed to underlines.
 cache_file=/dev/null
@@ -954,8 +980,9 @@ do
   fi
 
   case $ac_option in
-  *=*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;;
-  *)   ac_optarg=yes ;;
+  *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;;
+  *=)   ac_optarg= ;;
+  *)    ac_optarg=yes ;;
   esac
 
   # Accept the important Cygnus configure options, so we can diagnose typos.
@@ -997,13 +1024,20 @@ do
     datarootdir=$ac_optarg ;;
 
   -disable-* | --disable-*)
-    ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
+    ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
     # Reject names that are not valid shell variable names.
-    expr "x$ac_feature" : ".*[^-._$as_cr_alnum]" >/dev/null &&
-      { echo "$as_me: error: invalid feature name: $ac_feature" >&2
-   { (exit 1); exit 1; }; }
-    ac_feature=`echo $ac_feature | sed 's/[-.]/_/g'`
-    eval enable_$ac_feature=no ;;
+    expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
+      as_fn_error $? "invalid feature name: $ac_useropt"
+    ac_useropt_orig=$ac_useropt
+    ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
+    case $ac_user_opts in
+      *"
+"enable_$ac_useropt"
+"*) ;;
+      *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig"
+        ac_unrecognized_sep=', ';;
+    esac
+    eval enable_$ac_useropt=no ;;
 
   -docdir | --docdir | --docdi | --doc | --do)
     ac_prev=docdir ;;
@@ -1016,13 +1050,20 @@ do
     dvidir=$ac_optarg ;;
 
   -enable-* | --enable-*)
-    ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
+    ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
     # Reject names that are not valid shell variable names.
-    expr "x$ac_feature" : ".*[^-._$as_cr_alnum]" >/dev/null &&
-      { echo "$as_me: error: invalid feature name: $ac_feature" >&2
-   { (exit 1); exit 1; }; }
-    ac_feature=`echo $ac_feature | sed 's/[-.]/_/g'`
-    eval enable_$ac_feature=\$ac_optarg ;;
+    expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
+      as_fn_error $? "invalid feature name: $ac_useropt"
+    ac_useropt_orig=$ac_useropt
+    ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
+    case $ac_user_opts in
+      *"
+"enable_$ac_useropt"
+"*) ;;
+      *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig"
+        ac_unrecognized_sep=', ';;
+    esac
+    eval enable_$ac_useropt=\$ac_optarg ;;
 
   -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
   | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
@@ -1213,22 +1254,36 @@ do
     ac_init_version=: ;;
 
   -with-* | --with-*)
-    ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
+    ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
     # Reject names that are not valid shell variable names.
-    expr "x$ac_package" : ".*[^-._$as_cr_alnum]" >/dev/null &&
-      { echo "$as_me: error: invalid package name: $ac_package" >&2
-   { (exit 1); exit 1; }; }
-    ac_package=`echo $ac_package | sed 's/[-.]/_/g'`
-    eval with_$ac_package=\$ac_optarg ;;
+    expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
+      as_fn_error $? "invalid package name: $ac_useropt"
+    ac_useropt_orig=$ac_useropt
+    ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
+    case $ac_user_opts in
+      *"
+"with_$ac_useropt"
+"*) ;;
+      *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig"
+        ac_unrecognized_sep=', ';;
+    esac
+    eval with_$ac_useropt=\$ac_optarg ;;
 
   -without-* | --without-*)
-    ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'`
+    ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'`
     # Reject names that are not valid shell variable names.
-    expr "x$ac_package" : ".*[^-._$as_cr_alnum]" >/dev/null &&
-      { echo "$as_me: error: invalid package name: $ac_package" >&2
-   { (exit 1); exit 1; }; }
-    ac_package=`echo $ac_package | sed 's/[-.]/_/g'`
-    eval with_$ac_package=no ;;
+    expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
+      as_fn_error $? "invalid package name: $ac_useropt"
+    ac_useropt_orig=$ac_useropt
+    ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
+    case $ac_user_opts in
+      *"
+"with_$ac_useropt"
+"*) ;;
+      *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig"
+        ac_unrecognized_sep=', ';;
+    esac
+    eval with_$ac_useropt=no ;;
 
   --x)
     # Obsolete; use --with-x.
@@ -1248,25 +1303,25 @@ do
   | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
     x_libraries=$ac_optarg ;;
 
-  -*) { echo "$as_me: error: unrecognized option: $ac_option
-Try \`$0 --help' for more information." >&2
-   { (exit 1); exit 1; }; }
+  -*) as_fn_error $? "unrecognized option: \`$ac_option'
+Try \`$0 --help' for more information"
     ;;
 
   *=*)
     ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='`
     # Reject names that are not valid shell variable names.
-    expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null &&
-      { echo "$as_me: error: invalid variable name: $ac_envvar" >&2
-   { (exit 1); exit 1; }; }
+    case $ac_envvar in #(
+      '' | [0-9]* | *[!_$as_cr_alnum]* )
+      as_fn_error $? "invalid variable name: \`$ac_envvar'" ;;
+    esac
     eval $ac_envvar=\$ac_optarg
     export $ac_envvar ;;
 
   *)
     # FIXME: should be removed in autoconf 3.0.
-    echo "$as_me: WARNING: you should use --build, --host, --target" >&2
+    $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2
     expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null &&
-      echo "$as_me: WARNING: invalid host type: $ac_option" >&2
+      $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2
     : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}
     ;;
 
@@ -1275,23 +1330,36 @@ done
 
 if test -n "$ac_prev"; then
   ac_option=--`echo $ac_prev | sed 's/_/-/g'`
-  { echo "$as_me: error: missing argument to $ac_option" >&2
-   { (exit 1); exit 1; }; }
+  as_fn_error $? "missing argument to $ac_option"
+fi
+
+if test -n "$ac_unrecognized_opts"; then
+  case $enable_option_checking in
+    no) ;;
+    fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;;
+    *)     $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;;
+  esac
 fi
 
-# Be sure to have absolute directory names.
+# Check all directory arguments for consistency.
 for ac_var in  exec_prefix prefix bindir sbindir libexecdir datarootdir \
                datadir sysconfdir sharedstatedir localstatedir includedir \
                oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
                libdir localedir mandir
 do
   eval ac_val=\$$ac_var
+  # Remove trailing slashes.
+  case $ac_val in
+    */ )
+      ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'`
+      eval $ac_var=\$ac_val;;
+  esac
+  # Be sure to have absolute directory names.
   case $ac_val in
     [\\/$]* | ?:[\\/]* )  continue;;
     NONE | '' ) case $ac_var in *prefix ) continue;; esac;;
   esac
-  { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
-   { (exit 1); exit 1; }; }
+  as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val"
 done
 
 # There might be people who depend on the old broken behavior: `$host'
@@ -1305,8 +1373,8 @@ target=$target_alias
 if test "x$host_alias" != x; then
   if test "x$build_alias" = x; then
     cross_compiling=maybe
-    echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host.
-    If a cross compiler is detected then cross compile mode will be used." >&2
+    $as_echo "$as_me: WARNING: if you wanted to set the --build type, don't use --host.
+    If a cross compiler is detected then cross compile mode will be used" >&2
   elif test "x$build_alias" != "x$host_alias"; then
     cross_compiling=yes
   fi
@@ -1321,23 +1389,21 @@ test "$silent" = yes && exec 6>/dev/null
 ac_pwd=`pwd` && test -n "$ac_pwd" &&
 ac_ls_di=`ls -di .` &&
 ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` ||
-  { echo "$as_me: error: Working directory cannot be determined" >&2
-   { (exit 1); exit 1; }; }
+  as_fn_error $? "working directory cannot be determined"
 test "X$ac_ls_di" = "X$ac_pwd_ls_di" ||
-  { echo "$as_me: error: pwd does not report name of working directory" >&2
-   { (exit 1); exit 1; }; }
+  as_fn_error $? "pwd does not report name of working directory"
 
 
 # Find the source files, if location was not specified.
 if test -z "$srcdir"; then
   ac_srcdir_defaulted=yes
   # Try the directory containing this script, then the parent directory.
-  ac_confdir=`$as_dirname -- "$0" ||
-$as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
-        X"$0" : 'X\(//\)[^/]' \| \
-        X"$0" : 'X\(//\)$' \| \
-        X"$0" : 'X\(/\)' \| . 2>/dev/null ||
-echo X"$0" |
+  ac_confdir=`$as_dirname -- "$as_myself" ||
+$as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+        X"$as_myself" : 'X\(//\)[^/]' \| \
+        X"$as_myself" : 'X\(//\)$' \| \
+        X"$as_myself" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$as_myself" |
     sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
            s//\1/
            q
@@ -1364,13 +1430,11 @@ else
 fi
 if test ! -r "$srcdir/$ac_unique_file"; then
   test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .."
-  { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2
-   { (exit 1); exit 1; }; }
+  as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir"
 fi
 ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work"
 ac_abs_confdir=`(
-       cd "$srcdir" && test -r "./$ac_unique_file" || { echo "$as_me: error: $ac_msg" >&2
-   { (exit 1); exit 1; }; }
+       cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg"
        pwd)`
 # When building in place, set srcdir=.
 if test "$ac_abs_confdir" = "$ac_pwd"; then
@@ -1410,7 +1474,7 @@ Configuration:
       --help=short        display options specific to this package
       --help=recursive    display the short help of all the included packages
   -V, --version           display version information and exit
-  -q, --quiet, --silent   do not print \`checking...' messages
+  -q, --quiet, --silent   do not print \`checking ...' messages
       --cache-file=FILE   cache test results in FILE [disabled]
   -C, --config-cache      alias for \`--cache-file=config.cache'
   -n, --no-create         do not create output files
@@ -1418,9 +1482,9 @@ Configuration:
 
 Installation directories:
   --prefix=PREFIX         install architecture-independent files in PREFIX
-                         [$ac_default_prefix]
+                          [$ac_default_prefix]
   --exec-prefix=EPREFIX   install architecture-dependent files in EPREFIX
-                         [PREFIX]
+                          [PREFIX]
 
 By default, \`make install' will install all the files in
 \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc.  You can specify
@@ -1430,25 +1494,25 @@ for instance \`--prefix=\$HOME'.
 For better control, use the options below.
 
 Fine tuning of the installation directories:
-  --bindir=DIR           user executables [EPREFIX/bin]
-  --sbindir=DIR          system admin executables [EPREFIX/sbin]
-  --libexecdir=DIR       program executables [EPREFIX/libexec]
-  --sysconfdir=DIR       read-only single-machine data [PREFIX/etc]
-  --sharedstatedir=DIR   modifiable architecture-independent data [PREFIX/com]
-  --localstatedir=DIR    modifiable single-machine data [PREFIX/var]
-  --libdir=DIR           object code libraries [EPREFIX/lib]
-  --includedir=DIR       C header files [PREFIX/include]
-  --oldincludedir=DIR    C header files for non-gcc [/usr/include]
-  --datarootdir=DIR      read-only arch.-independent data root [PREFIX/share]
-  --datadir=DIR          read-only architecture-independent data [DATAROOTDIR]
-  --infodir=DIR          info documentation [DATAROOTDIR/info]
-  --localedir=DIR        locale-dependent data [DATAROOTDIR/locale]
-  --mandir=DIR           man documentation [DATAROOTDIR/man]
-  --docdir=DIR           documentation root [DATAROOTDIR/doc/avsystem]
-  --htmldir=DIR          html documentation [DOCDIR]
-  --dvidir=DIR           dvi documentation [DOCDIR]
-  --pdfdir=DIR           pdf documentation [DOCDIR]
-  --psdir=DIR            ps documentation [DOCDIR]
+  --bindir=DIR            user executables [EPREFIX/bin]
+  --sbindir=DIR           system admin executables [EPREFIX/sbin]
+  --libexecdir=DIR        program executables [EPREFIX/libexec]
+  --sysconfdir=DIR        read-only single-machine data [PREFIX/etc]
+  --sharedstatedir=DIR    modifiable architecture-independent data [PREFIX/com]
+  --localstatedir=DIR     modifiable single-machine data [PREFIX/var]
+  --libdir=DIR            object code libraries [EPREFIX/lib]
+  --includedir=DIR        C header files [PREFIX/include]
+  --oldincludedir=DIR     C header files for non-gcc [/usr/include]
+  --datarootdir=DIR       read-only arch.-independent data root [PREFIX/share]
+  --datadir=DIR           read-only architecture-independent data [DATAROOTDIR]
+  --infodir=DIR           info documentation [DATAROOTDIR/info]
+  --localedir=DIR         locale-dependent data [DATAROOTDIR/locale]
+  --mandir=DIR            man documentation [DATAROOTDIR/man]
+  --docdir=DIR            documentation root [DATAROOTDIR/doc/avsystem]
+  --htmldir=DIR           html documentation [DOCDIR]
+  --dvidir=DIR            dvi documentation [DOCDIR]
+  --pdfdir=DIR            pdf documentation [DOCDIR]
+  --psdir=DIR             ps documentation [DOCDIR]
 _ACEOF
 
   cat <<\_ACEOF
@@ -1471,6 +1535,7 @@ if test -n "$ac_init_help"; then
   cat <<\_ACEOF
 
 Optional Features:
+  --disable-option-checking  ignore unrecognized --enable/--with options
   --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
   --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
   --disable-dependency-tracking  speeds up one-time build
@@ -1480,11 +1545,8 @@ Optional Features:
   --enable-fast-install[=PKGS]
                           optimize for fast installation [default=yes]
   --disable-libtool-lock  avoid locking (might break parallel builds)
-  --enable-platform-debug use platform debug default=no
-  --enable-platform-intercall
-                          use platform intercall default=yes
-  --enable-aquila         using enable-aquila
   --enable-sdk            sdk build
+  --enable-pulse          enable pulseaudio client
 
 Optional Packages:
   --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
@@ -1492,7 +1554,6 @@ Optional Packages:
   --with-pic              try to use only PIC/non-PIC objects [default=use
                           both]
   --with-gnu-ld           assume the C compiler uses GNU ld [default=no]
-  --with-xo               apply xo configuration [default=yes]
 
 Some influential environment variables:
   CC          C compiler command
@@ -1500,10 +1561,14 @@ Some influential environment variables:
   LDFLAGS     linker flags, e.g. -L<lib dir> if you have libraries in a
               nonstandard directory <lib dir>
   LIBS        libraries to pass to the linker, e.g. -l<library>
-  CPPFLAGS    C/C++/Objective C preprocessor flags, e.g. -I<include dir> if
+  CPPFLAGS    (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if
               you have headers in a nonstandard directory <include dir>
   CPP         C preprocessor
   PKG_CONFIG  path to pkg-config utility
+  PKG_CONFIG_PATH
+              directories to add to pkg-config's search path
+  PKG_CONFIG_LIBDIR
+              path overriding pkg-config's built-in search path
   AVSYSTEM_CFLAGS
               C compiler flags for AVSYSTEM, overriding pkg-config
   AVSYSTEM_LIBS
@@ -1515,10 +1580,32 @@ Some influential environment variables:
   MMLOG_CFLAGS
               C compiler flags for MMLOG, overriding pkg-config
   MMLOG_LIBS  linker flags for MMLOG, overriding pkg-config
+  MMSESSION_CFLAGS
+              C compiler flags for MMSESSION, overriding pkg-config
+  MMSESSION_LIBS
+              linker flags for MMSESSION, overriding pkg-config
+  AUDIOSESSIONMGR_CFLAGS
+              C compiler flags for AUDIOSESSIONMGR, overriding pkg-config
+  AUDIOSESSIONMGR_LIBS
+              linker flags for AUDIOSESSIONMGR, overriding pkg-config
+  GLIB2_CFLAGS
+              C compiler flags for GLIB2, overriding pkg-config
+  GLIB2_LIBS  linker flags for GLIB2, overriding pkg-config
+  VCONF_CFLAGS
+              C compiler flags for VCONF, overriding pkg-config
+  VCONF_LIBS  linker flags for VCONF, overriding pkg-config
+  HEYNOTI_CFLAGS
+              C compiler flags for HEYNOTI, overriding pkg-config
+  HEYNOTI_LIBS
+              linker flags for HEYNOTI, overriding pkg-config
+  PULSE_CFLAGS
+              C compiler flags for PULSE, overriding pkg-config
+  PULSE_LIBS  linker flags for PULSE, overriding pkg-config
 
 Use these variables to override the choices made by `configure' or to help
 it to find libraries and programs with nonstandard names/locations.
 
+Report bugs to the package provider.
 _ACEOF
 ac_status=$?
 fi
@@ -1526,15 +1613,17 @@ fi
 if test "$ac_init_help" = "recursive"; then
   # If there are subdirs, report their specific --help.
   for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue
-    test -d "$ac_dir" || continue
+    test -d "$ac_dir" ||
+      { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } ||
+      continue
     ac_builddir=.
 
 case "$ac_dir" in
 .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
 *)
-  ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
+  ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'`
   # A ".." for each directory in $ac_dir_suffix.
-  ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'`
+  ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'`
   case $ac_top_builddir_sub in
   "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
   *)  ac_top_build_prefix=$ac_top_builddir_sub/ ;;
@@ -1570,7 +1659,7 @@ ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
       echo &&
       $SHELL "$ac_srcdir/configure" --help=recursive
     else
-      echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2
+      $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2
     fi || ac_status=$?
     cd "$ac_pwd" || { ac_status=$?; break; }
   done
@@ -1580,70 +1669,475 @@ test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
 avsystem configure 1.0
-generated by GNU Autoconf 2.61
+generated by GNU Autoconf 2.67
 
-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
-2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
+Copyright (C) 2010 Free Software Foundation, Inc.
 This configure script is free software; the Free Software Foundation
 gives unlimited permission to copy, distribute and modify it.
 _ACEOF
   exit
 fi
-cat >config.log <<_ACEOF
-This file contains any messages produced by compilers while
-running configure, to aid debugging if configure makes a mistake.
-
-It was created by avsystem $as_me 1.0, which was
-generated by GNU Autoconf 2.61.  Invocation command line was
 
-  $ $0 $@
+## ------------------------ ##
+## Autoconf initialization. ##
+## ------------------------ ##
 
-_ACEOF
-exec 5>>config.log
+# ac_fn_c_try_compile LINENO
+# --------------------------
+# Try to compile conftest.$ac_ext, and return whether this succeeded.
+ac_fn_c_try_compile ()
 {
-cat <<_ASUNAME
-## --------- ##
-## Platform. ##
-## --------- ##
-
-hostname = `(hostname || uname -n) 2>/dev/null | sed 1q`
-uname -m = `(uname -m) 2>/dev/null || echo unknown`
-uname -r = `(uname -r) 2>/dev/null || echo unknown`
-uname -s = `(uname -s) 2>/dev/null || echo unknown`
-uname -v = `(uname -v) 2>/dev/null || echo unknown`
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  rm -f conftest.$ac_objext
+  if { { ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_compile") 2>conftest.err
+  ac_status=$?
+  if test -s conftest.err; then
+    grep -v '^ *+' conftest.err >conftest.er1
+    cat conftest.er1 >&5
+    mv -f conftest.er1 conftest.err
+  fi
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then :
+  ac_retval=0
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
 
-/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown`
-/bin/uname -X     = `(/bin/uname -X) 2>/dev/null     || echo unknown`
+       ac_retval=1
+fi
+  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+  as_fn_set_status $ac_retval
 
-/bin/arch              = `(/bin/arch) 2>/dev/null              || echo unknown`
-/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null       || echo unknown`
-/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown`
-/usr/bin/hostinfo      = `(/usr/bin/hostinfo) 2>/dev/null      || echo unknown`
-/bin/machine           = `(/bin/machine) 2>/dev/null           || echo unknown`
-/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null       || echo unknown`
-/bin/universe          = `(/bin/universe) 2>/dev/null          || echo unknown`
+} # ac_fn_c_try_compile
 
-_ASUNAME
+# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES
+# -------------------------------------------------------
+# Tests whether HEADER exists and can be compiled using the include files in
+# INCLUDES, setting the cache variable VAR accordingly.
+ac_fn_c_check_header_compile ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if eval "test \"\${$3+set}\"" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$4
+#include <$2>
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  eval "$3=yes"
+else
+  eval "$3=no"
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+eval ac_res=\$$3
+              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
 
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  echo "PATH: $as_dir"
-done
-IFS=$as_save_IFS
+} # ac_fn_c_check_header_compile
 
-} >&5
+# ac_fn_c_try_cpp LINENO
+# ----------------------
+# Try to preprocess conftest.$ac_ext, and return whether this succeeded.
+ac_fn_c_try_cpp ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  if { { ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err
+  ac_status=$?
+  if test -s conftest.err; then
+    grep -v '^ *+' conftest.err >conftest.er1
+    cat conftest.er1 >&5
+    mv -f conftest.er1 conftest.err
+  fi
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } > conftest.i && {
+        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       }; then :
+  ac_retval=0
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
 
-cat >&5 <<_ACEOF
+    ac_retval=1
+fi
+  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+  as_fn_set_status $ac_retval
 
+} # ac_fn_c_try_cpp
 
-## ----------- ##
-## Core tests. ##
-## ----------- ##
+# ac_fn_c_try_run LINENO
+# ----------------------
+# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes
+# that executables *can* be run.
+ac_fn_c_try_run ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  if { { ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_link") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } && { ac_try='./conftest$ac_exeext'
+  { { case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; }; then :
+  ac_retval=0
+else
+  $as_echo "$as_me: program exited with status $ac_status" >&5
+       $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
 
-_ACEOF
+       ac_retval=$ac_status
+fi
+  rm -rf conftest.dSYM conftest_ipa8_conftest.oo
+  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+  as_fn_set_status $ac_retval
+
+} # ac_fn_c_try_run
+
+# ac_fn_c_try_link LINENO
+# -----------------------
+# Try to link conftest.$ac_ext, and return whether this succeeded.
+ac_fn_c_try_link ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  rm -f conftest.$ac_objext conftest$ac_exeext
+  if { { ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_link") 2>conftest.err
+  ac_status=$?
+  if test -s conftest.err; then
+    grep -v '^ *+' conftest.err >conftest.er1
+    cat conftest.er1 >&5
+    mv -f conftest.er1 conftest.err
+  fi
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then :
+  ac_retval=0
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+       ac_retval=1
+fi
+  # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information
+  # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would
+  # interfere with the next link command; also delete a directory that is
+  # left behind by Apple's compiler.  We do this before executing the actions.
+  rm -rf conftest.dSYM conftest_ipa8_conftest.oo
+  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+  as_fn_set_status $ac_retval
+
+} # ac_fn_c_try_link
+
+# ac_fn_c_check_func LINENO FUNC VAR
+# ----------------------------------
+# Tests whether FUNC exists, setting the cache variable VAR accordingly
+ac_fn_c_check_func ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if eval "test \"\${$3+set}\"" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+/* Define $2 to an innocuous variant, in case <limits.h> declares $2.
+   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
+#define $2 innocuous_$2
+
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $2 (); below.
+    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+    <limits.h> exists even on freestanding compilers.  */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef $2
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char $2 ();
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined __stub_$2 || defined __stub___$2
+choke me
+#endif
+
+int
+main ()
+{
+return $2 ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  eval "$3=yes"
+else
+  eval "$3=no"
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+fi
+eval ac_res=\$$3
+              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+
+} # ac_fn_c_check_func
+
+# ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES
+# -------------------------------------------------------
+# Tests whether HEADER exists, giving a warning if it cannot be compiled using
+# the include files in INCLUDES and setting the cache variable VAR
+# accordingly.
+ac_fn_c_check_header_mongrel ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  if eval "test \"\${$3+set}\"" = set; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if eval "test \"\${$3+set}\"" = set; then :
+  $as_echo_n "(cached) " >&6
+fi
+eval ac_res=\$$3
+              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+else
+  # Is the header compilable?
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5
+$as_echo_n "checking $2 usability... " >&6; }
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$4
+#include <$2>
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_header_compiler=yes
+else
+  ac_header_compiler=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5
+$as_echo "$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5
+$as_echo_n "checking $2 presence... " >&6; }
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <$2>
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+  ac_header_preproc=yes
+else
+  ac_header_preproc=no
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5
+$as_echo "$ac_header_preproc" >&6; }
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #((
+  yes:no: )
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5
+$as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
+$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
+    ;;
+  no:yes:* )
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5
+$as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;}
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2:     check for missing prerequisite headers?" >&5
+$as_echo "$as_me: WARNING: $2:     check for missing prerequisite headers?" >&2;}
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5
+$as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;}
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2:     section \"Present But Cannot Be Compiled\"" >&5
+$as_echo "$as_me: WARNING: $2:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
+$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
+    ;;
+esac
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if eval "test \"\${$3+set}\"" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  eval "$3=\$ac_header_compiler"
+fi
+eval ac_res=\$$3
+              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+fi
+  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+
+} # ac_fn_c_check_header_mongrel
+
+# ac_fn_c_check_type LINENO TYPE VAR INCLUDES
+# -------------------------------------------
+# Tests whether TYPE exists after having included INCLUDES, setting cache
+# variable VAR accordingly.
+ac_fn_c_check_type ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if eval "test \"\${$3+set}\"" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  eval "$3=no"
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$4
+int
+main ()
+{
+if (sizeof ($2))
+        return 0;
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$4
+int
+main ()
+{
+if (sizeof (($2)))
+           return 0;
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+
+else
+  eval "$3=yes"
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+eval ac_res=\$$3
+              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+
+} # ac_fn_c_check_type
+cat >config.log <<_ACEOF
+This file contains any messages produced by compilers while
+running configure, to aid debugging if configure makes a mistake.
+
+It was created by avsystem $as_me 1.0, which was
+generated by GNU Autoconf 2.67.  Invocation command line was
+
+  $ $0 $@
+
+_ACEOF
+exec 5>>config.log
+{
+cat <<_ASUNAME
+## --------- ##
+## Platform. ##
+## --------- ##
+
+hostname = `(hostname || uname -n) 2>/dev/null | sed 1q`
+uname -m = `(uname -m) 2>/dev/null || echo unknown`
+uname -r = `(uname -r) 2>/dev/null || echo unknown`
+uname -s = `(uname -s) 2>/dev/null || echo unknown`
+uname -v = `(uname -v) 2>/dev/null || echo unknown`
+
+/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown`
+/bin/uname -X     = `(/bin/uname -X) 2>/dev/null     || echo unknown`
+
+/bin/arch              = `(/bin/arch) 2>/dev/null              || echo unknown`
+/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null       || echo unknown`
+/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown`
+/usr/bin/hostinfo      = `(/usr/bin/hostinfo) 2>/dev/null      || echo unknown`
+/bin/machine           = `(/bin/machine) 2>/dev/null           || echo unknown`
+/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null       || echo unknown`
+/bin/universe          = `(/bin/universe) 2>/dev/null          || echo unknown`
+
+_ASUNAME
+
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    $as_echo "PATH: $as_dir"
+  done
+IFS=$as_save_IFS
+
+} >&5
+
+cat >&5 <<_ACEOF
+
+
+## ----------- ##
+## Core tests. ##
+## ----------- ##
+
+_ACEOF
 
 
 # Keep a trace of the command line.
@@ -1665,12 +2159,12 @@ do
     | -silent | --silent | --silen | --sile | --sil)
       continue ;;
     *\'*)
-      ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
+      ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
     esac
     case $ac_pass in
-    1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;;
+    1) as_fn_append ac_configure_args0 " '$ac_arg'" ;;
     2)
-      ac_configure_args1="$ac_configure_args1 '$ac_arg'"
+      as_fn_append ac_configure_args1 " '$ac_arg'"
       if test $ac_must_keep_next = true; then
        ac_must_keep_next=false # Got value, back to normal.
       else
@@ -1686,13 +2180,13 @@ do
          -* ) ac_must_keep_next=true ;;
        esac
       fi
-      ac_configure_args="$ac_configure_args '$ac_arg'"
+      as_fn_append ac_configure_args " '$ac_arg'"
       ;;
     esac
   done
 done
-$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; }
-$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; }
+{ ac_configure_args0=; unset ac_configure_args0;}
+{ ac_configure_args1=; unset ac_configure_args1;}
 
 # When interrupted or exit'd, cleanup temporary files, and complete
 # config.log.  We remove comments because anyway the quotes in there
@@ -1704,11 +2198,9 @@ trap 'exit_status=$?
   {
     echo
 
-    cat <<\_ASBOX
-## ---------------- ##
+    $as_echo "## ---------------- ##
 ## Cache variables. ##
-## ---------------- ##
-_ASBOX
+## ---------------- ##"
     echo
     # The following way of writing the cache mishandles newlines in values,
 (
@@ -1717,12 +2209,13 @@ _ASBOX
     case $ac_val in #(
     *${as_nl}*)
       case $ac_var in #(
-      *_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5
-echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;;
+      *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5
+$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
       esac
       case $ac_var in #(
       _ | IFS | as_nl) ;; #(
-      *) $as_unset $ac_var ;;
+      BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #(
+      *) { eval $ac_var=; unset $ac_var;} ;;
       esac ;;
     esac
   done
@@ -1741,131 +2234,142 @@ echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;;
 )
     echo
 
-    cat <<\_ASBOX
-## ----------------- ##
+    $as_echo "## ----------------- ##
 ## Output variables. ##
-## ----------------- ##
-_ASBOX
+## ----------------- ##"
     echo
     for ac_var in $ac_subst_vars
     do
       eval ac_val=\$$ac_var
       case $ac_val in
-      *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
+      *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
       esac
-      echo "$ac_var='\''$ac_val'\''"
+      $as_echo "$ac_var='\''$ac_val'\''"
     done | sort
     echo
 
     if test -n "$ac_subst_files"; then
-      cat <<\_ASBOX
-## ------------------- ##
+      $as_echo "## ------------------- ##
 ## File substitutions. ##
-## ------------------- ##
-_ASBOX
+## ------------------- ##"
       echo
       for ac_var in $ac_subst_files
       do
        eval ac_val=\$$ac_var
        case $ac_val in
-       *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
+       *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
        esac
-       echo "$ac_var='\''$ac_val'\''"
+       $as_echo "$ac_var='\''$ac_val'\''"
       done | sort
       echo
     fi
 
     if test -s confdefs.h; then
-      cat <<\_ASBOX
-## ----------- ##
+      $as_echo "## ----------- ##
 ## confdefs.h. ##
-## ----------- ##
-_ASBOX
+## ----------- ##"
       echo
       cat confdefs.h
       echo
     fi
     test "$ac_signal" != 0 &&
-      echo "$as_me: caught signal $ac_signal"
-    echo "$as_me: exit $exit_status"
+      $as_echo "$as_me: caught signal $ac_signal"
+    $as_echo "$as_me: exit $exit_status"
   } >&5
   rm -f core *.core core.conftest.* &&
     rm -f -r conftest* confdefs* conf$$* $ac_clean_files &&
     exit $exit_status
 ' 0
 for ac_signal in 1 2 13 15; do
-  trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal
+  trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal
 done
 ac_signal=0
 
 # confdefs.h avoids OS command line length limits that DEFS can exceed.
 rm -f -r conftest* confdefs.h
 
+$as_echo "/* confdefs.h */" > confdefs.h
+
 # Predefined preprocessor variables.
 
 cat >>confdefs.h <<_ACEOF
 #define PACKAGE_NAME "$PACKAGE_NAME"
 _ACEOF
 
-
 cat >>confdefs.h <<_ACEOF
 #define PACKAGE_TARNAME "$PACKAGE_TARNAME"
 _ACEOF
 
-
 cat >>confdefs.h <<_ACEOF
 #define PACKAGE_VERSION "$PACKAGE_VERSION"
 _ACEOF
 
-
 cat >>confdefs.h <<_ACEOF
 #define PACKAGE_STRING "$PACKAGE_STRING"
 _ACEOF
 
-
 cat >>confdefs.h <<_ACEOF
 #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT"
 _ACEOF
 
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_URL "$PACKAGE_URL"
+_ACEOF
+
 
 # Let the site file select an alternate cache file if it wants to.
-# Prefer explicitly selected file to automatically selected ones.
+# Prefer an explicitly selected file to automatically selected ones.
+ac_site_file1=NONE
+ac_site_file2=NONE
 if test -n "$CONFIG_SITE"; then
-  set x "$CONFIG_SITE"
+  # We do not want a PATH search for config.site.
+  case $CONFIG_SITE in #((
+    -*)  ac_site_file1=./$CONFIG_SITE;;
+    */*) ac_site_file1=$CONFIG_SITE;;
+    *)   ac_site_file1=./$CONFIG_SITE;;
+  esac
 elif test "x$prefix" != xNONE; then
-  set x "$prefix/share/config.site" "$prefix/etc/config.site"
+  ac_site_file1=$prefix/share/config.site
+  ac_site_file2=$prefix/etc/config.site
 else
-  set x "$ac_default_prefix/share/config.site" \
-       "$ac_default_prefix/etc/config.site"
+  ac_site_file1=$ac_default_prefix/share/config.site
+  ac_site_file2=$ac_default_prefix/etc/config.site
 fi
-shift
-for ac_site_file
+for ac_site_file in "$ac_site_file1" "$ac_site_file2"
 do
-  if test -r "$ac_site_file"; then
-    { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5
-echo "$as_me: loading site script $ac_site_file" >&6;}
+  test "x$ac_site_file" = xNONE && continue
+  if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5
+$as_echo "$as_me: loading site script $ac_site_file" >&6;}
     sed 's/^/| /' "$ac_site_file" >&5
-    . "$ac_site_file"
+    . "$ac_site_file" \
+      || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "failed to load site script $ac_site_file
+See \`config.log' for more details" "$LINENO" 5 ; }
   fi
 done
 
 if test -r "$cache_file"; then
-  # Some versions of bash will fail to source /dev/null (special
-  # files actually), so we avoid doing that.
-  if test -f "$cache_file"; then
-    { echo "$as_me:$LINENO: loading cache $cache_file" >&5
-echo "$as_me: loading cache $cache_file" >&6;}
+  # Some versions of bash will fail to source /dev/null (special files
+  # actually), so we avoid doing that.  DJGPP emulates it as a regular file.
+  if test /dev/null != "$cache_file" && test -f "$cache_file"; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5
+$as_echo "$as_me: loading cache $cache_file" >&6;}
     case $cache_file in
       [\\/]* | ?:[\\/]* ) . "$cache_file";;
       *)                      . "./$cache_file";;
     esac
   fi
 else
-  { echo "$as_me:$LINENO: creating cache $cache_file" >&5
-echo "$as_me: creating cache $cache_file" >&6;}
+  { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5
+$as_echo "$as_me: creating cache $cache_file" >&6;}
   >$cache_file
 fi
 
+as_fn_append ac_header_list " stdlib.h"
+as_fn_append ac_header_list " unistd.h"
+as_fn_append ac_header_list " sys/param.h"
 # Check that the precious variables saved in the cache have kept the same
 # value.
 ac_cache_corrupted=false
@@ -1876,68 +2380,56 @@ for ac_var in $ac_precious_vars; do
   eval ac_new_val=\$ac_env_${ac_var}_value
   case $ac_old_set,$ac_new_set in
     set,)
-      { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
-echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;}
+      { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
+$as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;}
       ac_cache_corrupted=: ;;
     ,set)
-      { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5
-echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;}
+      { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5
+$as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;}
       ac_cache_corrupted=: ;;
     ,);;
     *)
       if test "x$ac_old_val" != "x$ac_new_val"; then
-       { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5
-echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
-       { echo "$as_me:$LINENO:   former value:  $ac_old_val" >&5
-echo "$as_me:   former value:  $ac_old_val" >&2;}
-       { echo "$as_me:$LINENO:   current value: $ac_new_val" >&5
-echo "$as_me:   current value: $ac_new_val" >&2;}
-       ac_cache_corrupted=:
+       # differences in whitespace do not lead to failure.
+       ac_old_val_w=`echo x $ac_old_val`
+       ac_new_val_w=`echo x $ac_new_val`
+       if test "$ac_old_val_w" != "$ac_new_val_w"; then
+         { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5
+$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
+         ac_cache_corrupted=:
+       else
+         { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5
+$as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;}
+         eval $ac_var=\$ac_old_val
+       fi
+       { $as_echo "$as_me:${as_lineno-$LINENO}:   former value:  \`$ac_old_val'" >&5
+$as_echo "$as_me:   former value:  \`$ac_old_val'" >&2;}
+       { $as_echo "$as_me:${as_lineno-$LINENO}:   current value: \`$ac_new_val'" >&5
+$as_echo "$as_me:   current value: \`$ac_new_val'" >&2;}
       fi;;
   esac
   # Pass precious variables to config.status.
   if test "$ac_new_set" = set; then
     case $ac_new_val in
-    *\'*) ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;;
+    *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;;
     *) ac_arg=$ac_var=$ac_new_val ;;
     esac
     case " $ac_configure_args " in
       *" '$ac_arg' "*) ;; # Avoid dups.  Use of quotes ensures accuracy.
-      *) ac_configure_args="$ac_configure_args '$ac_arg'" ;;
+      *) as_fn_append ac_configure_args " '$ac_arg'" ;;
     esac
   fi
 done
 if $ac_cache_corrupted; then
-  { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5
-echo "$as_me: error: changes in the environment can compromise the build" >&2;}
-  { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5
-echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;}
-   { (exit 1); exit 1; }; }
+  { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+  { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5
+$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;}
+  as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5
 fi
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+## -------------------- ##
+## Main body of script. ##
+## -------------------- ##
 
 ac_ext=c
 ac_cpp='$CPP $CPPFLAGS'
@@ -1946,7 +2438,7 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $
 ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
 
-am__api_version='1.10'
+am__api_version='1.11'
 
 ac_aux_dir=
 for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do
@@ -1965,9 +2457,7 @@ for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do
   fi
 done
 if test -z "$ac_aux_dir"; then
-  { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&5
-echo "$as_me: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&2;}
-   { (exit 1); exit 1; }; }
+  as_fn_error $? "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5
 fi
 
 # These three variables are undocumented and unsupported,
@@ -1992,22 +2482,23 @@ ac_configure="$SHELL $ac_aux_dir/configure"  # Please don't use this var.
 # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
 # OS/2's system install, which has a completely different semantic
 # ./install, which can be erroneously created by make from ./install.sh.
-{ echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5
-echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6; }
+# Reject install programs that cannot install multiple files.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5
+$as_echo_n "checking for a BSD-compatible install... " >&6; }
 if test -z "$INSTALL"; then
-if test "${ac_cv_path_install+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+if test "${ac_cv_path_install+set}" = set; then :
+  $as_echo_n "(cached) " >&6
 else
   as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
 for as_dir in $PATH
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  # Account for people who put trailing slashes in PATH elements.
-case $as_dir/ in
-  ./ | .// | /cC/* | \
+    # Account for people who put trailing slashes in PATH elements.
+case $as_dir/ in #((
+  ./ | .// | /[cC]/* | \
   /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \
-  ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \
+  ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \
   /usr/ucb/* ) ;;
   *)
     # OSF1 and SCO ODT 3.0 have their own names for install.
@@ -2025,17 +2516,29 @@ case $as_dir/ in
            # program-specific install script used by HP pwplus--don't use.
            :
          else
-           ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c"
-           break 3
+           rm -rf conftest.one conftest.two conftest.dir
+           echo one > conftest.one
+           echo two > conftest.two
+           mkdir conftest.dir
+           if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" &&
+             test -s conftest.one && test -s conftest.two &&
+             test -s conftest.dir/conftest.one &&
+             test -s conftest.dir/conftest.two
+           then
+             ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c"
+             break 3
+           fi
          fi
        fi
       done
     done
     ;;
 esac
-done
+
+  done
 IFS=$as_save_IFS
 
+rm -rf conftest.one conftest.two conftest.dir
 
 fi
   if test "${ac_cv_path_install+set}" = set; then
@@ -2048,8 +2551,8 @@ fi
     INSTALL=$ac_install_sh
   fi
 fi
-{ echo "$as_me:$LINENO: result: $INSTALL" >&5
-echo "${ECHO_T}$INSTALL" >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5
+$as_echo "$INSTALL" >&6; }
 
 # Use test -z because SunOS4 sh mishandles braces in ${var-val}.
 # It thinks the first close brace ends the variable substitution.
@@ -2059,21 +2562,34 @@ test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
 
 test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
 
-{ echo "$as_me:$LINENO: checking whether build environment is sane" >&5
-echo $ECHO_N "checking whether build environment is sane... $ECHO_C" >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5
+$as_echo_n "checking whether build environment is sane... " >&6; }
 # Just in case
 sleep 1
 echo timestamp > conftest.file
+# Reject unsafe characters in $srcdir or the absolute working directory
+# name.  Accept space and tab only in the latter.
+am_lf='
+'
+case `pwd` in
+  *[\\\"\#\$\&\'\`$am_lf]*)
+    as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5 ;;
+esac
+case $srcdir in
+  *[\\\"\#\$\&\'\`$am_lf\ \    ]*)
+    as_fn_error $? "unsafe srcdir value: \`$srcdir'" "$LINENO" 5 ;;
+esac
+
 # Do `set' in a subshell so we don't clobber the current shell's
 # arguments.  Must try -L first in case configure is actually a
 # symlink; some systems play weird games with the mod time of symlinks
 # (eg FreeBSD returns the mod time of the symlink's containing
 # directory).
 if (
-   set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null`
+   set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
    if test "$*" = "X"; then
       # -L didn't work.
-      set X `ls -t $srcdir/configure conftest.file`
+      set X `ls -t "$srcdir/configure" conftest.file`
    fi
    rm -f conftest.file
    if test "$*" != "X $srcdir/configure conftest.file" \
@@ -2083,11 +2599,8 @@ if (
       # if, for instance, CONFIG_SHELL is bash and it inherits a
       # broken ls alias from the environment.  This has actually
       # happened.  Such a system could not be considered "sane".
-      { { echo "$as_me:$LINENO: error: ls -t appears to fail.  Make sure there is not a broken
-alias in your environment" >&5
-echo "$as_me: error: ls -t appears to fail.  Make sure there is not a broken
-alias in your environment" >&2;}
-   { (exit 1); exit 1; }; }
+      as_fn_error $? "ls -t appears to fail.  Make sure there is not a broken
+alias in your environment" "$LINENO" 5
    fi
 
    test "$2" = conftest.file
@@ -2096,68 +2609,179 @@ then
    # Ok.
    :
 else
-   { { echo "$as_me:$LINENO: error: newly created file is older than distributed files!
-Check your system clock" >&5
-echo "$as_me: error: newly created file is older than distributed files!
-Check your system clock" >&2;}
-   { (exit 1); exit 1; }; }
+   as_fn_error $? "newly created file is older than distributed files!
+Check your system clock" "$LINENO" 5
 fi
-{ echo "$as_me:$LINENO: result: yes" >&5
-echo "${ECHO_T}yes" >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
 test "$program_prefix" != NONE &&
   program_transform_name="s&^&$program_prefix&;$program_transform_name"
 # Use a double $ so make ignores it.
 test "$program_suffix" != NONE &&
   program_transform_name="s&\$&$program_suffix&;$program_transform_name"
-# Double any \ or $.  echo might interpret backslashes.
+# Double any \ or $.
 # By default was `s,x,x', remove it if useless.
-cat <<\_ACEOF >conftest.sed
-s/[\\$]/&&/g;s/;s,x,x,$//
-_ACEOF
-program_transform_name=`echo $program_transform_name | sed -f conftest.sed`
-rm -f conftest.sed
+ac_script='s/[\\$]/&&/g;s/;s,x,x,$//'
+program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"`
 
 # expand $ac_aux_dir to an absolute path
 am_aux_dir=`cd $ac_aux_dir && pwd`
 
-test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing"
+if test x"${MISSING+set}" != xset; then
+  case $am_aux_dir in
+  *\ * | *\    *)
+    MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
+  *)
+    MISSING="\${SHELL} $am_aux_dir/missing" ;;
+  esac
+fi
 # Use eval to expand $SHELL
 if eval "$MISSING --run true"; then
   am_missing_run="$MISSING --run "
 else
   am_missing_run=
-  { echo "$as_me:$LINENO: WARNING: \`missing' script is too old or missing" >&5
-echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;}
+  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`missing' script is too old or missing" >&5
+$as_echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;}
 fi
 
-{ echo "$as_me:$LINENO: checking for a thread-safe mkdir -p" >&5
-echo $ECHO_N "checking for a thread-safe mkdir -p... $ECHO_C" >&6; }
-if test -z "$MKDIR_P"; then
-  if test "${ac_cv_path_mkdir+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+if test x"${install_sh}" != xset; then
+  case $am_aux_dir in
+  *\ * | *\    *)
+    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
+  *)
+    install_sh="\${SHELL} $am_aux_dir/install-sh"
+  esac
+fi
+
+# Installed binaries are usually stripped using `strip' when the user
+# run `make install-strip'.  However `strip' might not be the right
+# tool to use in cross-compilation environments, therefore Automake
+# will honor the `STRIP' environment variable to overrule this program.
+if test "$cross_compiling" != no; then
+  if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
+set dummy ${ac_tool_prefix}strip; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_STRIP+set}" = set; then :
+  $as_echo_n "(cached) " >&6
 else
-  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin
+  if test -n "$STRIP"; then
+  ac_cv_prog_STRIP="$STRIP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for ac_prog in mkdir gmkdir; do
-        for ac_exec_ext in '' $ac_executable_extensions; do
-          { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; } || continue
-          case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #(
-            'mkdir (GNU coreutils) '* | \
-            'mkdir (coreutils) '* | \
-            'mkdir (fileutils) '4.1*)
-              ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext
-              break 3;;
-          esac
-        done
-       done
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_STRIP="${ac_tool_prefix}strip"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+STRIP=$ac_cv_prog_STRIP
+if test -n "$STRIP"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5
+$as_echo "$STRIP" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_STRIP"; then
+  ac_ct_STRIP=$STRIP
+  # Extract the first word of "strip", so it can be a program name with args.
+set dummy strip; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_STRIP"; then
+  ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_STRIP="strip"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
 done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP
+if test -n "$ac_ct_STRIP"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5
+$as_echo "$ac_ct_STRIP" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  if test "x$ac_ct_STRIP" = x; then
+    STRIP=":"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    STRIP=$ac_ct_STRIP
+  fi
+else
+  STRIP="$ac_cv_prog_STRIP"
+fi
+
+fi
+INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5
+$as_echo_n "checking for a thread-safe mkdir -p... " >&6; }
+if test -z "$MKDIR_P"; then
+  if test "${ac_cv_path_mkdir+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_prog in mkdir gmkdir; do
+        for ac_exec_ext in '' $ac_executable_extensions; do
+          { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; } || continue
+          case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #(
+            'mkdir (GNU coreutils) '* | \
+            'mkdir (coreutils) '* | \
+            'mkdir (fileutils) '4.1*)
+              ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext
+              break 3;;
+          esac
+        done
+       done
+  done
 IFS=$as_save_IFS
 
 fi
 
+  test -d ./--version && rmdir ./--version
   if test "${ac_cv_path_mkdir+set}" = set; then
     MKDIR_P="$ac_cv_path_mkdir -p"
   else
@@ -2165,12 +2789,11 @@ fi
     # value for MKDIR_P within a source directory, because that will
     # break other packages using the cache if that directory is
     # removed, or if the value is a relative name.
-    test -d ./--version && rmdir ./--version
     MKDIR_P="$ac_install_sh -d"
   fi
 fi
-{ echo "$as_me:$LINENO: result: $MKDIR_P" >&5
-echo "${ECHO_T}$MKDIR_P" >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5
+$as_echo "$MKDIR_P" >&6; }
 
 mkdir_p="$MKDIR_P"
 case $mkdir_p in
@@ -2182,10 +2805,10 @@ for ac_prog in gawk mawk nawk awk
 do
   # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
-if test "${ac_cv_prog_AWK+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_AWK+set}" = set; then :
+  $as_echo_n "(cached) " >&6
 else
   if test -n "$AWK"; then
   ac_cv_prog_AWK="$AWK" # Let the user override the test.
@@ -2195,43 +2818,44 @@ for as_dir in $PATH
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_prog_AWK="$ac_prog"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
-done
+  done
 IFS=$as_save_IFS
 
 fi
 fi
 AWK=$ac_cv_prog_AWK
 if test -n "$AWK"; then
-  { echo "$as_me:$LINENO: result: $AWK" >&5
-echo "${ECHO_T}$AWK" >&6; }
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5
+$as_echo "$AWK" >&6; }
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
 
   test -n "$AWK" && break
 done
 
-{ echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5
-echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6; }
-set x ${MAKE-make}; ac_make=`echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'`
-if { as_var=ac_cv_prog_make_${ac_make}_set; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5
+$as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; }
+set x ${MAKE-make}
+ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'`
+if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\"" = set; then :
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.make <<\_ACEOF
 SHELL = /bin/sh
 all:
        @echo '@@@%%%=$(MAKE)=@@@%%%'
 _ACEOF
-# GNU make sometimes prints "make[1]: Entering...", which would confuse us.
+# GNU make sometimes prints "make[1]: Entering ...", which would confuse us.
 case `${MAKE-make} -f conftest.make 2>/dev/null` in
   *@@@%%%=?*=@@@%%%*)
     eval ac_cv_prog_make_${ac_make}_set=yes;;
@@ -2241,12 +2865,12 @@ esac
 rm -f conftest.make
 fi
 if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then
-  { echo "$as_me:$LINENO: result: yes" >&5
-echo "${ECHO_T}yes" >&6; }
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
   SET_MAKE=
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
   SET_MAKE="MAKE=${MAKE-make}"
 fi
 
@@ -2265,9 +2889,7 @@ if test "`cd $srcdir && pwd`" != "`pwd`"; then
   am__isrc=' -I$(srcdir)'
   # test to see if srcdir already configured
   if test -f $srcdir/config.status; then
-    { { echo "$as_me:$LINENO: error: source directory already configured; run \"make distclean\" there first" >&5
-echo "$as_me: error: source directory already configured; run \"make distclean\" there first" >&2;}
-   { (exit 1); exit 1; }; }
+    as_fn_error $? "source directory already configured; run \"make distclean\" there first" "$LINENO" 5
   fi
 fi
 
@@ -2311,112 +2933,6 @@ AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"}
 
 MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"}
 
-install_sh=${install_sh-"\$(SHELL) $am_aux_dir/install-sh"}
-
-# Installed binaries are usually stripped using `strip' when the user
-# run `make install-strip'.  However `strip' might not be the right
-# tool to use in cross-compilation environments, therefore Automake
-# will honor the `STRIP' environment variable to overrule this program.
-if test "$cross_compiling" != no; then
-  if test -n "$ac_tool_prefix"; then
-  # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
-set dummy ${ac_tool_prefix}strip; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
-if test "${ac_cv_prog_STRIP+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  if test -n "$STRIP"; then
-  ac_cv_prog_STRIP="$STRIP" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_prog_STRIP="${ac_tool_prefix}strip"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-done
-IFS=$as_save_IFS
-
-fi
-fi
-STRIP=$ac_cv_prog_STRIP
-if test -n "$STRIP"; then
-  { echo "$as_me:$LINENO: result: $STRIP" >&5
-echo "${ECHO_T}$STRIP" >&6; }
-else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
-fi
-
-
-fi
-if test -z "$ac_cv_prog_STRIP"; then
-  ac_ct_STRIP=$STRIP
-  # Extract the first word of "strip", so it can be a program name with args.
-set dummy strip; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
-if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  if test -n "$ac_ct_STRIP"; then
-  ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_prog_ac_ct_STRIP="strip"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-done
-IFS=$as_save_IFS
-
-fi
-fi
-ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP
-if test -n "$ac_ct_STRIP"; then
-  { echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5
-echo "${ECHO_T}$ac_ct_STRIP" >&6; }
-else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
-fi
-
-  if test "x$ac_ct_STRIP" = x; then
-    STRIP=":"
-  else
-    case $cross_compiling:$ac_tool_warned in
-yes:)
-{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet.  If you think this
-configuration is useful to you, please write to autoconf@gnu.org." >&5
-echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet.  If you think this
-configuration is useful to you, please write to autoconf@gnu.org." >&2;}
-ac_tool_warned=yes ;;
-esac
-    STRIP=$ac_ct_STRIP
-  fi
-else
-  STRIP="$ac_cv_prog_STRIP"
-fi
-
-fi
-INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
-
 # We need awk for the "check" target.  The system "awk" is bad on
 # some platforms.
 # Always define AMTAR for backward compatibility.
@@ -2443,10 +2959,10 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
 if test -n "$ac_tool_prefix"; then
   # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
 set dummy ${ac_tool_prefix}gcc; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
-if test "${ac_cv_prog_CC+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_CC+set}" = set; then :
+  $as_echo_n "(cached) " >&6
 else
   if test -n "$CC"; then
   ac_cv_prog_CC="$CC" # Let the user override the test.
@@ -2456,25 +2972,25 @@ for as_dir in $PATH
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_prog_CC="${ac_tool_prefix}gcc"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
-done
+  done
 IFS=$as_save_IFS
 
 fi
 fi
 CC=$ac_cv_prog_CC
 if test -n "$CC"; then
-  { echo "$as_me:$LINENO: result: $CC" >&5
-echo "${ECHO_T}$CC" >&6; }
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
 
@@ -2483,10 +2999,10 @@ if test -z "$ac_cv_prog_CC"; then
   ac_ct_CC=$CC
   # Extract the first word of "gcc", so it can be a program name with args.
 set dummy gcc; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
-if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then :
+  $as_echo_n "(cached) " >&6
 else
   if test -n "$ac_ct_CC"; then
   ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
@@ -2496,25 +3012,25 @@ for as_dir in $PATH
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_prog_ac_ct_CC="gcc"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
-done
+  done
 IFS=$as_save_IFS
 
 fi
 fi
 ac_ct_CC=$ac_cv_prog_ac_ct_CC
 if test -n "$ac_ct_CC"; then
-  { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
-echo "${ECHO_T}$ac_ct_CC" >&6; }
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
+$as_echo "$ac_ct_CC" >&6; }
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
   if test "x$ac_ct_CC" = x; then
@@ -2522,12 +3038,8 @@ fi
   else
     case $cross_compiling:$ac_tool_warned in
 yes:)
-{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet.  If you think this
-configuration is useful to you, please write to autoconf@gnu.org." >&5
-echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet.  If you think this
-configuration is useful to you, please write to autoconf@gnu.org." >&2;}
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
 ac_tool_warned=yes ;;
 esac
     CC=$ac_ct_CC
@@ -2540,10 +3052,10 @@ if test -z "$CC"; then
           if test -n "$ac_tool_prefix"; then
     # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
 set dummy ${ac_tool_prefix}cc; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
-if test "${ac_cv_prog_CC+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_CC+set}" = set; then :
+  $as_echo_n "(cached) " >&6
 else
   if test -n "$CC"; then
   ac_cv_prog_CC="$CC" # Let the user override the test.
@@ -2553,25 +3065,25 @@ for as_dir in $PATH
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_prog_CC="${ac_tool_prefix}cc"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
-done
+  done
 IFS=$as_save_IFS
 
 fi
 fi
 CC=$ac_cv_prog_CC
 if test -n "$CC"; then
-  { echo "$as_me:$LINENO: result: $CC" >&5
-echo "${ECHO_T}$CC" >&6; }
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
 
@@ -2580,10 +3092,10 @@ fi
 if test -z "$CC"; then
   # Extract the first word of "cc", so it can be a program name with args.
 set dummy cc; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
-if test "${ac_cv_prog_CC+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_CC+set}" = set; then :
+  $as_echo_n "(cached) " >&6
 else
   if test -n "$CC"; then
   ac_cv_prog_CC="$CC" # Let the user override the test.
@@ -2594,18 +3106,18 @@ for as_dir in $PATH
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
        ac_prog_rejected=yes
        continue
      fi
     ac_cv_prog_CC="cc"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
-done
+  done
 IFS=$as_save_IFS
 
 if test $ac_prog_rejected = yes; then
@@ -2624,11 +3136,11 @@ fi
 fi
 CC=$ac_cv_prog_CC
 if test -n "$CC"; then
-  { echo "$as_me:$LINENO: result: $CC" >&5
-echo "${ECHO_T}$CC" >&6; }
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
 
@@ -2639,10 +3151,10 @@ if test -z "$CC"; then
   do
     # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
 set dummy $ac_tool_prefix$ac_prog; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
-if test "${ac_cv_prog_CC+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_CC+set}" = set; then :
+  $as_echo_n "(cached) " >&6
 else
   if test -n "$CC"; then
   ac_cv_prog_CC="$CC" # Let the user override the test.
@@ -2652,25 +3164,25 @@ for as_dir in $PATH
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
-done
+  done
 IFS=$as_save_IFS
 
 fi
 fi
 CC=$ac_cv_prog_CC
 if test -n "$CC"; then
-  { echo "$as_me:$LINENO: result: $CC" >&5
-echo "${ECHO_T}$CC" >&6; }
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
 
@@ -2683,10 +3195,10 @@ if test -z "$CC"; then
 do
   # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
-if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then :
+  $as_echo_n "(cached) " >&6
 else
   if test -n "$ac_ct_CC"; then
   ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
@@ -2696,25 +3208,25 @@ for as_dir in $PATH
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_prog_ac_ct_CC="$ac_prog"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
-done
+  done
 IFS=$as_save_IFS
 
 fi
 fi
 ac_ct_CC=$ac_cv_prog_ac_ct_CC
 if test -n "$ac_ct_CC"; then
-  { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
-echo "${ECHO_T}$ac_ct_CC" >&6; }
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
+$as_echo "$ac_ct_CC" >&6; }
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
 
@@ -2726,12 +3238,8 @@ done
   else
     case $cross_compiling:$ac_tool_warned in
 yes:)
-{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet.  If you think this
-configuration is useful to you, please write to autoconf@gnu.org." >&5
-echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet.  If you think this
-configuration is useful to you, please write to autoconf@gnu.org." >&2;}
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
 ac_tool_warned=yes ;;
 esac
     CC=$ac_ct_CC
@@ -2741,51 +3249,37 @@ fi
 fi
 
 
-test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH
-See \`config.log' for more details." >&5
-echo "$as_me: error: no acceptable C compiler found in \$PATH
-See \`config.log' for more details." >&2;}
-   { (exit 1); exit 1; }; }
+test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "no acceptable C compiler found in \$PATH
+See \`config.log' for more details" "$LINENO" 5 ; }
 
 # Provide some information about the compiler.
-echo "$as_me:$LINENO: checking for C compiler version" >&5
-ac_compiler=`set X $ac_compile; echo $2`
-{ (ac_try="$ac_compiler --version >&5"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compiler --version >&5") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }
-{ (ac_try="$ac_compiler -v >&5"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compiler -v >&5") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }
-{ (ac_try="$ac_compiler -V >&5"
+$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5
+set X $ac_compile
+ac_compiler=$2
+for ac_option in --version -v -V -qversion; do
+  { { ac_try="$ac_compiler $ac_option >&5"
 case "(($ac_try" in
   *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
   *) ac_try_echo=$ac_try;;
 esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compiler -V >&5") 2>&5
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_compiler $ac_option >&5") 2>conftest.err
   ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }
+  if test -s conftest.err; then
+    sed '10a\
+... rest of stderr output deleted ...
+         10q' conftest.err >conftest.er1
+    cat conftest.er1 >&5
+  fi
+  rm -f conftest.er1 conftest.err
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }
+done
 
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 int
@@ -2797,42 +3291,38 @@ main ()
 }
 _ACEOF
 ac_clean_files_save=$ac_clean_files
-ac_clean_files="$ac_clean_files a.out a.exe b.out"
+ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out"
 # Try to create an executable without -o first, disregard a.out.
 # It will help us diagnose broken compilers, and finding out an intuition
 # of exeext.
-{ echo "$as_me:$LINENO: checking for C compiler default output file name" >&5
-echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6; }
-ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
-#
-# List of possible output files, starting from the most likely.
-# The algorithm is not robust to junk in `.', hence go to wildcards (a.*)
-# only as a last resort.  b.out is created by i960 compilers.
-ac_files='a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out'
-#
-# The IRIX 6 linker writes into existing files which may not be
-# executable, retaining their permissions.  Remove them first so a
-# subsequent execution test works.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5
+$as_echo_n "checking whether the C compiler works... " >&6; }
+ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
+
+# The possible output files:
+ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*"
+
 ac_rmfiles=
 for ac_file in $ac_files
 do
   case $ac_file in
-    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;;
+    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;;
     * ) ac_rmfiles="$ac_rmfiles $ac_file";;
   esac
 done
 rm -f $ac_rmfiles
 
-if { (ac_try="$ac_link_default"
+if { ac_try="$ac_link_default"
 case "(($ac_try" in
   *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
   *) ac_try_echo=$ac_try;;
 esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
   (eval "$ac_link_default") 2>&5
   ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; then
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then :
   # Autoconf-2.13 could set the ac_cv_exeext variable to `no'.
 # So ignore a value of `no', otherwise this would lead to `EXEEXT = no'
 # in a Makefile.  We should not override ac_cv_exeext if it was cached,
@@ -2842,14 +3332,14 @@ for ac_file in $ac_files ''
 do
   test -f "$ac_file" || continue
   case $ac_file in
-    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj )
+    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj )
        ;;
     [ab].out )
        # We found the default executable, but exeext='' is most
        # certainly right.
        break;;
     *.* )
-        if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no;
+       if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no;
        then :; else
           ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
        fi
@@ -2868,78 +3358,41 @@ test "$ac_cv_exeext" = no && ac_cv_exeext=
 else
   ac_file=''
 fi
-
-{ echo "$as_me:$LINENO: result: $ac_file" >&5
-echo "${ECHO_T}$ac_file" >&6; }
-if test -z "$ac_file"; then
-  echo "$as_me: failed program was:" >&5
+if test -z "$ac_file"; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+$as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-{ { echo "$as_me:$LINENO: error: C compiler cannot create executables
-See \`config.log' for more details." >&5
-echo "$as_me: error: C compiler cannot create executables
-See \`config.log' for more details." >&2;}
-   { (exit 77); exit 77; }; }
+{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error 77 "C compiler cannot create executables
+See \`config.log' for more details" "$LINENO" 5 ; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
 fi
-
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5
+$as_echo_n "checking for C compiler default output file name... " >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5
+$as_echo "$ac_file" >&6; }
 ac_exeext=$ac_cv_exeext
 
-# Check that the compiler produces executables we can run.  If not, either
-# the compiler is broken, or we cross compile.
-{ echo "$as_me:$LINENO: checking whether the C compiler works" >&5
-echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6; }
-# FIXME: These cross compiler hacks should be removed for Autoconf 3.0
-# If not cross compiling, check that we can run a simple program.
-if test "$cross_compiling" != yes; then
-  if { ac_try='./$ac_file'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-    cross_compiling=no
-  else
-    if test "$cross_compiling" = maybe; then
-       cross_compiling=yes
-    else
-       { { echo "$as_me:$LINENO: error: cannot run C compiled programs.
-If you meant to cross compile, use \`--host'.
-See \`config.log' for more details." >&5
-echo "$as_me: error: cannot run C compiled programs.
-If you meant to cross compile, use \`--host'.
-See \`config.log' for more details." >&2;}
-   { (exit 1); exit 1; }; }
-    fi
-  fi
-fi
-{ echo "$as_me:$LINENO: result: yes" >&5
-echo "${ECHO_T}yes" >&6; }
-
-rm -f a.out a.exe conftest$ac_cv_exeext b.out
+rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out
 ac_clean_files=$ac_clean_files_save
-# Check that the compiler produces executables we can run.  If not, either
-# the compiler is broken, or we cross compile.
-{ echo "$as_me:$LINENO: checking whether we are cross compiling" >&5
-echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6; }
-{ echo "$as_me:$LINENO: result: $cross_compiling" >&5
-echo "${ECHO_T}$cross_compiling" >&6; }
-
-{ echo "$as_me:$LINENO: checking for suffix of executables" >&5
-echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6; }
-if { (ac_try="$ac_link"
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5
+$as_echo_n "checking for suffix of executables... " >&6; }
+if { { ac_try="$ac_link"
 case "(($ac_try" in
   *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
   *) ac_try_echo=$ac_try;;
 esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
   (eval "$ac_link") 2>&5
   ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; then
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then :
   # If both `conftest.exe' and `conftest' are `present' (well, observable)
 # catch `conftest.exe'.  For instance with Cygwin, `ls conftest' will
 # work properly (i.e., refer to `conftest.exe'), while it won't with
@@ -2947,37 +3400,90 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
 for ac_file in conftest.exe conftest conftest.*; do
   test -f "$ac_file" || continue
   case $ac_file in
-    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;;
+    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;;
     *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
          break;;
     * ) break;;
   esac
 done
 else
-  { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link
-See \`config.log' for more details." >&5
-echo "$as_me: error: cannot compute suffix of executables: cannot compile and link
-See \`config.log' for more details." >&2;}
-   { (exit 1); exit 1; }; }
+  { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "cannot compute suffix of executables: cannot compile and link
+See \`config.log' for more details" "$LINENO" 5 ; }
 fi
-
-rm -f conftest$ac_cv_exeext
-{ echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5
-echo "${ECHO_T}$ac_cv_exeext" >&6; }
+rm -f conftest conftest$ac_cv_exeext
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5
+$as_echo "$ac_cv_exeext" >&6; }
 
 rm -f conftest.$ac_ext
 EXEEXT=$ac_cv_exeext
 ac_exeext=$EXEEXT
-{ echo "$as_me:$LINENO: checking for suffix of object files" >&5
-echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6; }
-if test "${ac_cv_objext+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <stdio.h>
+int
+main ()
+{
+FILE *f = fopen ("conftest.out", "w");
+ return ferror (f) || fclose (f) != 0;
+
+  ;
+  return 0;
+}
 _ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+ac_clean_files="$ac_clean_files conftest.out"
+# Check that the compiler produces executables we can run.  If not, either
+# the compiler is broken, or we cross compile.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5
+$as_echo_n "checking whether we are cross compiling... " >&6; }
+if test "$cross_compiling" != yes; then
+  { { ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_link") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }
+  if { ac_try='./conftest$ac_cv_exeext'
+  { { case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; }; then
+    cross_compiling=no
+  else
+    if test "$cross_compiling" = maybe; then
+       cross_compiling=yes
+    else
+       { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "cannot run C compiled programs.
+If you meant to cross compile, use \`--host'.
+See \`config.log' for more details" "$LINENO" 5 ; }
+    fi
+  fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5
+$as_echo "$cross_compiling" >&6; }
+
+rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out
+ac_clean_files=$ac_clean_files_save
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5
+$as_echo_n "checking for suffix of object files... " >&6; }
+if test "${ac_cv_objext+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 int
@@ -2989,51 +3495,46 @@ main ()
 }
 _ACEOF
 rm -f conftest.o conftest.obj
-if { (ac_try="$ac_compile"
+if { ac_try="$ac_compile"
 case "(($ac_try" in
   *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
   *) ac_try_echo=$ac_try;;
 esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
   (eval "$ac_compile") 2>&5
   ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; then
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then :
   for ac_file in conftest.o conftest.obj conftest.*; do
   test -f "$ac_file" || continue;
   case $ac_file in
-    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf ) ;;
+    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;;
     *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'`
        break;;
   esac
 done
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile
-See \`config.log' for more details." >&5
-echo "$as_me: error: cannot compute suffix of object files: cannot compile
-See \`config.log' for more details." >&2;}
-   { (exit 1); exit 1; }; }
+{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "cannot compute suffix of object files: cannot compile
+See \`config.log' for more details" "$LINENO" 5 ; }
 fi
-
 rm -f conftest.$ac_cv_objext conftest.$ac_ext
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_objext" >&5
-echo "${ECHO_T}$ac_cv_objext" >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5
+$as_echo "$ac_cv_objext" >&6; }
 OBJEXT=$ac_cv_objext
 ac_objext=$OBJEXT
-{ echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5
-echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6; }
-if test "${ac_cv_c_compiler_gnu+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5
+$as_echo_n "checking whether we are using the GNU C compiler... " >&6; }
+if test "${ac_cv_c_compiler_gnu+set}" = set; then :
+  $as_echo_n "(cached) " >&6
 else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 int
@@ -3047,54 +3548,34 @@ main ()
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
+if ac_fn_c_try_compile "$LINENO"; then :
   ac_compiler_gnu=yes
 else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_compiler_gnu=no
+  ac_compiler_gnu=no
 fi
-
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 ac_cv_c_compiler_gnu=$ac_compiler_gnu
 
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5
-echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6; }
-GCC=`test $ac_compiler_gnu = yes && echo yes`
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5
+$as_echo "$ac_cv_c_compiler_gnu" >&6; }
+if test $ac_compiler_gnu = yes; then
+  GCC=yes
+else
+  GCC=
+fi
 ac_test_CFLAGS=${CFLAGS+set}
 ac_save_CFLAGS=$CFLAGS
-{ echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5
-echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6; }
-if test "${ac_cv_prog_cc_g+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5
+$as_echo_n "checking whether $CC accepts -g... " >&6; }
+if test "${ac_cv_prog_cc_g+set}" = set; then :
+  $as_echo_n "(cached) " >&6
 else
   ac_save_c_werror_flag=$ac_c_werror_flag
    ac_c_werror_flag=yes
    ac_cv_prog_cc_g=no
    CFLAGS="-g"
-   cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 int
@@ -3105,34 +3586,11 @@ main ()
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
+if ac_fn_c_try_compile "$LINENO"; then :
   ac_cv_prog_cc_g=yes
 else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       CFLAGS=""
-      cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  CFLAGS=""
+      cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 int
@@ -3143,35 +3601,12 @@ main ()
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  :
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+if ac_fn_c_try_compile "$LINENO"; then :
 
-       ac_c_werror_flag=$ac_save_c_werror_flag
+else
+  ac_c_werror_flag=$ac_save_c_werror_flag
         CFLAGS="-g"
-        cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+        cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 int
@@ -3182,42 +3617,18 @@ main ()
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
+if ac_fn_c_try_compile "$LINENO"; then :
   ac_cv_prog_cc_g=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
 fi
-
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
-
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
-
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
    ac_c_werror_flag=$ac_save_c_werror_flag
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5
-echo "${ECHO_T}$ac_cv_prog_cc_g" >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5
+$as_echo "$ac_cv_prog_cc_g" >&6; }
 if test "$ac_test_CFLAGS" = set; then
   CFLAGS=$ac_save_CFLAGS
 elif test $ac_cv_prog_cc_g = yes; then
@@ -3233,18 +3644,14 @@ else
     CFLAGS=
   fi
 fi
-{ echo "$as_me:$LINENO: checking for $CC option to accept ISO C89" >&5
-echo $ECHO_N "checking for $CC option to accept ISO C89... $ECHO_C" >&6; }
-if test "${ac_cv_prog_cc_c89+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5
+$as_echo_n "checking for $CC option to accept ISO C89... " >&6; }
+if test "${ac_cv_prog_cc_c89+set}" = set; then :
+  $as_echo_n "(cached) " >&6
 else
   ac_cv_prog_cc_c89=no
 ac_save_CC=$CC
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 #include <stdarg.h>
 #include <stdio.h>
@@ -3301,31 +3708,9 @@ for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \
        -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
 do
   CC="$ac_save_CC $ac_arg"
-  rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
+  if ac_fn_c_try_compile "$LINENO"; then :
   ac_cv_prog_cc_c89=$ac_arg
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
 fi
-
 rm -f core conftest.err conftest.$ac_objext
   test "x$ac_cv_prog_cc_c89" != "xno" && break
 done
@@ -3336,17 +3721,19 @@ fi
 # AC_CACHE_VAL
 case "x$ac_cv_prog_cc_c89" in
   x)
-    { echo "$as_me:$LINENO: result: none needed" >&5
-echo "${ECHO_T}none needed" >&6; } ;;
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5
+$as_echo "none needed" >&6; } ;;
   xno)
-    { echo "$as_me:$LINENO: result: unsupported" >&5
-echo "${ECHO_T}unsupported" >&6; } ;;
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5
+$as_echo "unsupported" >&6; } ;;
   *)
     CC="$CC $ac_cv_prog_cc_c89"
-    { echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c89" >&5
-echo "${ECHO_T}$ac_cv_prog_cc_c89" >&6; } ;;
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5
+$as_echo "$ac_cv_prog_cc_c89" >&6; } ;;
 esac
+if test "x$ac_cv_prog_cc_c89" != xno; then :
 
+fi
 
 ac_ext=c
 ac_cpp='$CPP $CPPFLAGS'
@@ -3361,44 +3748,44 @@ ac_config_commands="$ac_config_commands depfiles"
 am_make=${MAKE-make}
 cat > confinc << 'END'
 am__doit:
-       @echo done
+       @echo this is the am__doit target
 .PHONY: am__doit
 END
 # If we don't find an include directive, just comment out the code.
-{ echo "$as_me:$LINENO: checking for style of include used by $am_make" >&5
-echo $ECHO_N "checking for style of include used by $am_make... $ECHO_C" >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for style of include used by $am_make" >&5
+$as_echo_n "checking for style of include used by $am_make... " >&6; }
 am__include="#"
 am__quote=
 _am_result=none
 # First try GNU make style include.
 echo "include confinc" > confmf
-# We grep out `Entering directory' and `Leaving directory'
-# messages which can occur if `w' ends up in MAKEFLAGS.
-# In particular we don't look at `^make:' because GNU make might
-# be invoked under some other name (usually "gmake"), in which
-# case it prints its new name instead of `make'.
-if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then
-   am__include=include
-   am__quote=
-   _am_result=GNU
-fi
+# Ignore all kinds of additional output from `make'.
+case `$am_make -s -f confmf 2> /dev/null` in #(
+*the\ am__doit\ target*)
+  am__include=include
+  am__quote=
+  _am_result=GNU
+  ;;
+esac
 # Now try BSD make style include.
 if test "$am__include" = "#"; then
    echo '.include "confinc"' > confmf
-   if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then
-      am__include=.include
-      am__quote="\""
-      _am_result=BSD
-   fi
+   case `$am_make -s -f confmf 2> /dev/null` in #(
+   *the\ am__doit\ target*)
+     am__include=.include
+     am__quote="\""
+     _am_result=BSD
+     ;;
+   esac
 fi
 
 
-{ echo "$as_me:$LINENO: result: $_am_result" >&5
-echo "${ECHO_T}$_am_result" >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $_am_result" >&5
+$as_echo "$_am_result" >&6; }
 rm -f confinc confmf
 
 # Check whether --enable-dependency-tracking was given.
-if test "${enable_dependency_tracking+set}" = set; then
+if test "${enable_dependency_tracking+set}" = set; then :
   enableval=$enable_dependency_tracking;
 fi
 
@@ -3418,10 +3805,10 @@ fi
 
 depcc="$CC"   am_compiler_list=
 
-{ echo "$as_me:$LINENO: checking dependency style of $depcc" >&5
-echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6; }
-if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5
+$as_echo_n "checking dependency style of $depcc... " >&6; }
+if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then :
+  $as_echo_n "(cached) " >&6
 else
   if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
   # We make a subdir and do the tests there.  Otherwise we can end up
@@ -3446,6 +3833,11 @@ else
   if test "$am_compiler_list" = ""; then
      am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp`
   fi
+  am__universal=false
+  case " $depcc " in #(
+     *\ -arch\ *\ -arch\ *) am__universal=true ;;
+     esac
+
   for depmode in $am_compiler_list; do
     # Setup a source with many dependencies, because some compilers
     # like to wrap large dependency lists on column 80 (with \), and
@@ -3463,7 +3855,17 @@ else
     done
     echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
 
+    # We check with `-c' and `-o' for the sake of the "dashmstdout"
+    # mode.  It turns out that the SunPro C++ compiler does not properly
+    # handle `-M -o', and we need to detect this.  Also, some Intel
+    # versions had trouble with output in subdirs
+    am__obj=sub/conftest.${OBJEXT-o}
+    am__minus_obj="-o $am__obj"
     case $depmode in
+    gcc)
+      # This depmode causes a compiler race in universal mode.
+      test "$am__universal" = false || continue
+      ;;
     nosideeffect)
       # after this tag, mechanisms are not by side-effect, so they'll
       # only be used when explicitly requested
@@ -3473,19 +3875,23 @@ else
        break
       fi
       ;;
+    msvisualcpp | msvcmsys)
+      # This compiler won't grok `-c -o', but also, the minuso test has
+      # not run yet.  These depmodes are late enough in the game, and
+      # so weak that their functioning should not be impacted.
+      am__obj=conftest.${OBJEXT-o}
+      am__minus_obj=
+      ;;
     none) break ;;
     esac
-    # We check with `-c' and `-o' for the sake of the "dashmstdout"
-    # mode.  It turns out that the SunPro C++ compiler does not properly
-    # handle `-M -o', and we need to detect this.
     if depmode=$depmode \
-       source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \
+       source=sub/conftest.c object=$am__obj \
        depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
-       $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \
+       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
          >/dev/null 2>conftest.err &&
        grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
        grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
-       grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 &&
+       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
        ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
       # icc doesn't choke on unknown options, it will just issue warnings
       # or remarks (even with -Werror).  So we grep stderr for any message
@@ -3509,8 +3915,8 @@ else
 fi
 
 fi
-{ echo "$as_me:$LINENO: result: $am_cv_CC_dependencies_compiler_type" >&5
-echo "${ECHO_T}$am_cv_CC_dependencies_compiler_type" >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5
+$as_echo "$am_cv_CC_dependencies_compiler_type" >&6; }
 CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type
 
  if
@@ -3525,16 +3931,12 @@ fi
 
 
 
-{ echo "$as_me:$LINENO: checking for an ANSI C-conforming const" >&5
-echo $ECHO_N "checking for an ANSI C-conforming const... $ECHO_C" >&6; }
-if test "${ac_cv_c_const+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for an ANSI C-conforming const" >&5
+$as_echo_n "checking for an ANSI C-conforming const... " >&6; }
+if test "${ac_cv_c_const+set}" = set; then :
+  $as_echo_n "(cached) " >&6
 else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 int
@@ -3594,40 +3996,18 @@ main ()
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
+if ac_fn_c_try_compile "$LINENO"; then :
   ac_cv_c_const=yes
 else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_cv_c_const=no
+  ac_cv_c_const=no
 fi
-
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_c_const" >&5
-echo "${ECHO_T}$ac_cv_c_const" >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_const" >&5
+$as_echo "$ac_cv_c_const" >&6; }
 if test $ac_cv_c_const = no; then
 
-cat >>confdefs.h <<\_ACEOF
-#define const
-_ACEOF
+$as_echo "#define const /**/" >>confdefs.h
 
 fi
 
@@ -3636,15 +4016,15 @@ ac_cpp='$CPP $CPPFLAGS'
 ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
 ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
 ac_compiler_gnu=$ac_cv_c_compiler_gnu
-{ echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5
-echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5
+$as_echo_n "checking how to run the C preprocessor... " >&6; }
 # On Suns, sometimes $CPP names a directory.
 if test -n "$CPP" && test -d "$CPP"; then
   CPP=
 fi
 if test -z "$CPP"; then
-  if test "${ac_cv_prog_CPP+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  if test "${ac_cv_prog_CPP+set}" = set; then :
+  $as_echo_n "(cached) " >&6
 else
       # Double quotes because CPP needs to be expanded
     for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp"
@@ -3658,11 +4038,7 @@ do
   # <limits.h> exists even on freestanding compilers.
   # On the NeXT, cc -E runs the code through the compiler's parser,
   # not just through cpp. "Syntax error" is here to catch this case.
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 #ifdef __STDC__
 # include <limits.h>
@@ -3671,76 +4047,34 @@ cat >>conftest.$ac_ext <<_ACEOF
 #endif
                     Syntax error
 _ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       }; then
-  :
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+if ac_fn_c_try_cpp "$LINENO"; then :
 
+else
   # Broken: fails on valid input.
 continue
 fi
-
-rm -f conftest.err conftest.$ac_ext
+rm -f conftest.err conftest.i conftest.$ac_ext
 
   # OK, works on sane cases.  Now check whether nonexistent headers
   # can be detected and how.
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 #include <ac_nonexistent.h>
 _ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       }; then
+if ac_fn_c_try_cpp "$LINENO"; then :
   # Broken: success on invalid input.
 continue
 else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
   # Passes both tests.
 ac_preproc_ok=:
 break
 fi
-
-rm -f conftest.err conftest.$ac_ext
+rm -f conftest.err conftest.i conftest.$ac_ext
 
 done
 # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
-rm -f conftest.err conftest.$ac_ext
-if $ac_preproc_ok; then
+rm -f conftest.i conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then :
   break
 fi
 
@@ -3752,8 +4086,8 @@ fi
 else
   ac_cv_prog_CPP=$CPP
 fi
-{ echo "$as_me:$LINENO: result: $CPP" >&5
-echo "${ECHO_T}$CPP" >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5
+$as_echo "$CPP" >&6; }
 ac_preproc_ok=false
 for ac_c_preproc_warn_flag in '' yes
 do
@@ -3763,11 +4097,7 @@ do
   # <limits.h> exists even on freestanding compilers.
   # On the NeXT, cc -E runs the code through the compiler's parser,
   # not just through cpp. "Syntax error" is here to catch this case.
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 #ifdef __STDC__
 # include <limits.h>
@@ -3776,83 +4106,40 @@ cat >>conftest.$ac_ext <<_ACEOF
 #endif
                     Syntax error
 _ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       }; then
-  :
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+if ac_fn_c_try_cpp "$LINENO"; then :
 
+else
   # Broken: fails on valid input.
 continue
 fi
-
-rm -f conftest.err conftest.$ac_ext
+rm -f conftest.err conftest.i conftest.$ac_ext
 
   # OK, works on sane cases.  Now check whether nonexistent headers
   # can be detected and how.
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 #include <ac_nonexistent.h>
 _ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       }; then
+if ac_fn_c_try_cpp "$LINENO"; then :
   # Broken: success on invalid input.
 continue
 else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
   # Passes both tests.
 ac_preproc_ok=:
 break
 fi
-
-rm -f conftest.err conftest.$ac_ext
+rm -f conftest.err conftest.i conftest.$ac_ext
 
 done
 # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
-rm -f conftest.err conftest.$ac_ext
-if $ac_preproc_ok; then
-  :
+rm -f conftest.i conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then :
+
 else
-  { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check
-See \`config.log' for more details." >&5
-echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check
-See \`config.log' for more details." >&2;}
-   { (exit 1); exit 1; }; }
+  { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "C preprocessor \"$CPP\" fails sanity check
+See \`config.log' for more details" "$LINENO" 5 ; }
 fi
 
 ac_ext=c
@@ -3862,45 +4149,40 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $
 ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
 
-{ echo "$as_me:$LINENO: checking for grep that handles long lines and -e" >&5
-echo $ECHO_N "checking for grep that handles long lines and -e... $ECHO_C" >&6; }
-if test "${ac_cv_path_GREP+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  # Extract the first word of "grep ggrep" to use in msg output
-if test -z "$GREP"; then
-set dummy grep ggrep; ac_prog_name=$2
-if test "${ac_cv_path_GREP+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5
+$as_echo_n "checking for grep that handles long lines and -e... " >&6; }
+if test "${ac_cv_path_GREP+set}" = set; then :
+  $as_echo_n "(cached) " >&6
 else
+  if test -z "$GREP"; then
   ac_path_GREP_found=false
-# Loop through the user's path and test for each of PROGNAME-LIST
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+  # Loop through the user's path and test for each of PROGNAME-LIST
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
 for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for ac_prog in grep ggrep; do
-  for ac_exec_ext in '' $ac_executable_extensions; do
-    ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext"
-    { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue
-    # Check for GNU ac_path_GREP and select it if it is found.
+    for ac_prog in grep ggrep; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
+      ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext"
+      { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue
+# Check for GNU ac_path_GREP and select it if it is found.
   # Check for GNU $ac_path_GREP
 case `"$ac_path_GREP" --version 2>&1` in
 *GNU*)
   ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;;
 *)
   ac_count=0
-  echo $ECHO_N "0123456789$ECHO_C" >"conftest.in"
+  $as_echo_n 0123456789 >"conftest.in"
   while :
   do
     cat "conftest.in" "conftest.in" >"conftest.tmp"
     mv "conftest.tmp" "conftest.in"
     cp "conftest.in" "conftest.nl"
-    echo 'GREP' >> "conftest.nl"
+    $as_echo 'GREP' >> "conftest.nl"
     "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break
     diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
-    ac_count=`expr $ac_count + 1`
+    as_fn_arith $ac_count + 1 && ac_count=$as_val
     if test $ac_count -gt ${ac_path_GREP_max-0}; then
       # Best one so far, save it but keep looking for a better one
       ac_cv_path_GREP="$ac_path_GREP"
@@ -3912,77 +4194,61 @@ case `"$ac_path_GREP" --version 2>&1` in
   rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
 esac
 
-
-    $ac_path_GREP_found && break 3
+      $ac_path_GREP_found && break 3
+    done
+  done
   done
-done
-
-done
 IFS=$as_save_IFS
-
-
-fi
-
-GREP="$ac_cv_path_GREP"
-if test -z "$GREP"; then
-  { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5
-echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;}
-   { (exit 1); exit 1; }; }
-fi
-
+  if test -z "$ac_cv_path_GREP"; then
+    as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
+  fi
 else
   ac_cv_path_GREP=$GREP
 fi
 
-
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_path_GREP" >&5
-echo "${ECHO_T}$ac_cv_path_GREP" >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5
+$as_echo "$ac_cv_path_GREP" >&6; }
  GREP="$ac_cv_path_GREP"
 
 
-{ echo "$as_me:$LINENO: checking for egrep" >&5
-echo $ECHO_N "checking for egrep... $ECHO_C" >&6; }
-if test "${ac_cv_path_EGREP+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5
+$as_echo_n "checking for egrep... " >&6; }
+if test "${ac_cv_path_EGREP+set}" = set; then :
+  $as_echo_n "(cached) " >&6
 else
   if echo a | $GREP -E '(a|b)' >/dev/null 2>&1
    then ac_cv_path_EGREP="$GREP -E"
    else
-     # Extract the first word of "egrep" to use in msg output
-if test -z "$EGREP"; then
-set dummy egrep; ac_prog_name=$2
-if test "${ac_cv_path_EGREP+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
+     if test -z "$EGREP"; then
   ac_path_EGREP_found=false
-# Loop through the user's path and test for each of PROGNAME-LIST
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+  # Loop through the user's path and test for each of PROGNAME-LIST
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
 for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for ac_prog in egrep; do
-  for ac_exec_ext in '' $ac_executable_extensions; do
-    ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext"
-    { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue
-    # Check for GNU ac_path_EGREP and select it if it is found.
+    for ac_prog in egrep; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
+      ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext"
+      { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue
+# Check for GNU ac_path_EGREP and select it if it is found.
   # Check for GNU $ac_path_EGREP
 case `"$ac_path_EGREP" --version 2>&1` in
 *GNU*)
   ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;;
 *)
   ac_count=0
-  echo $ECHO_N "0123456789$ECHO_C" >"conftest.in"
+  $as_echo_n 0123456789 >"conftest.in"
   while :
   do
     cat "conftest.in" "conftest.in" >"conftest.tmp"
     mv "conftest.tmp" "conftest.in"
     cp "conftest.in" "conftest.nl"
-    echo 'EGREP' >> "conftest.nl"
+    $as_echo 'EGREP' >> "conftest.nl"
     "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break
     diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
-    ac_count=`expr $ac_count + 1`
+    as_fn_arith $ac_count + 1 && ac_count=$as_val
     if test $ac_count -gt ${ac_path_EGREP_max-0}; then
       # Best one so far, save it but keep looking for a better one
       ac_cv_path_EGREP="$ac_path_EGREP"
@@ -3994,46 +4260,31 @@ case `"$ac_path_EGREP" --version 2>&1` in
   rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
 esac
 
-
-    $ac_path_EGREP_found && break 3
+      $ac_path_EGREP_found && break 3
+    done
+  done
   done
-done
-
-done
 IFS=$as_save_IFS
-
-
-fi
-
-EGREP="$ac_cv_path_EGREP"
-if test -z "$EGREP"; then
-  { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5
-echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;}
-   { (exit 1); exit 1; }; }
-fi
-
+  if test -z "$ac_cv_path_EGREP"; then
+    as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
+  fi
 else
   ac_cv_path_EGREP=$EGREP
 fi
 
-
    fi
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_path_EGREP" >&5
-echo "${ECHO_T}$ac_cv_path_EGREP" >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5
+$as_echo "$ac_cv_path_EGREP" >&6; }
  EGREP="$ac_cv_path_EGREP"
 
 
-{ echo "$as_me:$LINENO: checking for ANSI C header files" >&5
-echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6; }
-if test "${ac_cv_header_stdc+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5
+$as_echo_n "checking for ANSI C header files... " >&6; }
+if test "${ac_cv_header_stdc+set}" = set; then :
+  $as_echo_n "(cached) " >&6
 else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 #include <stdlib.h>
 #include <stdarg.h>
@@ -4048,47 +4299,23 @@ main ()
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
+if ac_fn_c_try_compile "$LINENO"; then :
   ac_cv_header_stdc=yes
 else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_cv_header_stdc=no
+  ac_cv_header_stdc=no
 fi
-
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 
 if test $ac_cv_header_stdc = yes; then
   # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 #include <string.h>
 
 _ACEOF
 if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  $EGREP "memchr" >/dev/null 2>&1; then
-  :
+  $EGREP "memchr" >/dev/null 2>&1; then :
+
 else
   ac_cv_header_stdc=no
 fi
@@ -4098,18 +4325,14 @@ fi
 
 if test $ac_cv_header_stdc = yes; then
   # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 #include <stdlib.h>
 
 _ACEOF
 if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  $EGREP "free" >/dev/null 2>&1; then
-  :
+  $EGREP "free" >/dev/null 2>&1; then :
+
 else
   ac_cv_header_stdc=no
 fi
@@ -4119,14 +4342,10 @@ fi
 
 if test $ac_cv_header_stdc = yes; then
   # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
-  if test "$cross_compiling" = yes; then
+  if test "$cross_compiling" = yes; then :
   :
 else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 #include <ctype.h>
 #include <stdlib.h>
@@ -4153,113 +4372,53 @@ main ()
   return 0;
 }
 _ACEOF
-rm -f conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_link") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  :
-else
-  echo "$as_me: program exited with status $ac_status" >&5
-echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+if ac_fn_c_try_run "$LINENO"; then :
 
-( exit $ac_status )
-ac_cv_header_stdc=no
+else
+  ac_cv_header_stdc=no
 fi
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
 fi
 
-
 fi
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5
-echo "${ECHO_T}$ac_cv_header_stdc" >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5
+$as_echo "$ac_cv_header_stdc" >&6; }
 if test $ac_cv_header_stdc = yes; then
 
-cat >>confdefs.h <<\_ACEOF
-#define STDC_HEADERS 1
-_ACEOF
+$as_echo "#define STDC_HEADERS 1" >>confdefs.h
 
 fi
 
 # On IRIX 5.3, sys/types and inttypes.h are conflicting.
+for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \
+                 inttypes.h stdint.h unistd.h
+do :
+  as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default
+"
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
+  cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
 
+fi
 
+done
 
 
 
 
 
-
-
-for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \
-                 inttypes.h stdint.h unistd.h
-do
-as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-{ echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  eval "$as_ac_Header=yes"
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       eval "$as_ac_Header=no"
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
+  for ac_header in $ac_header_list
+do :
+  as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default
+"
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
   cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
 _ACEOF
 
 fi
@@ -4269,252 +4428,30 @@ done
 
 
 
-for ac_header in stdlib.h unistd.h
-do
-as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-else
-  # Is the header compilable?
-{ echo "$as_me:$LINENO: checking $ac_header usability" >&5
-echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ echo "$as_me:$LINENO: checking $ac_header presence" >&5
-echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <$ac_header>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6; }
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
-
-    ;;
-esac
-{ echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
 
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
-  cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-
-fi
 
-done
 
 
 for ac_func in getpagesize
-do
-as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
-{ echo "$as_me:$LINENO: checking for $ac_func" >&5
-echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; }
-if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
-   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
-#define $ac_func innocuous_$ac_func
-
-/* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char $ac_func (); below.
-    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
-    <limits.h> exists even on freestanding compilers.  */
-
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-
-#undef $ac_func
-
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char $ac_func ();
-/* The GNU C library defines this for functions which it implements
-    to always fail with ENOSYS.  Some functions are actually named
-    something starting with __ and the normal name is an alias.  */
-#if defined __stub_$ac_func || defined __stub___$ac_func
-choke me
-#endif
-
-int
-main ()
-{
-return $ac_func ();
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
-  eval "$as_ac_var=yes"
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       eval "$as_ac_var=no"
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-fi
-ac_res=`eval echo '${'$as_ac_var'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-if test `eval echo '${'$as_ac_var'}'` = yes; then
+do :
+  ac_fn_c_check_func "$LINENO" "getpagesize" "ac_cv_func_getpagesize"
+if test "x$ac_cv_func_getpagesize" = x""yes; then :
   cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+#define HAVE_GETPAGESIZE 1
 _ACEOF
 
 fi
 done
 
-{ echo "$as_me:$LINENO: checking for working mmap" >&5
-echo $ECHO_N "checking for working mmap... $ECHO_C" >&6; }
-if test "${ac_cv_func_mmap_fixed_mapped+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for working mmap" >&5
+$as_echo_n "checking for working mmap... " >&6; }
+if test "${ac_cv_func_mmap_fixed_mapped+set}" = set; then :
+  $as_echo_n "(cached) " >&6
 else
-  if test "$cross_compiling" = yes; then
+  if test "$cross_compiling" = yes; then :
   ac_cv_func_mmap_fixed_mapped=no
 else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 $ac_includes_default
 /* malloc might have been renamed as rpl_malloc. */
@@ -4551,11 +4488,6 @@ char *malloc ();
 
 /* This mess was copied from the GNU getpagesize.h.  */
 #ifndef HAVE_GETPAGESIZE
-/* Assume that all systems that can run configure have sys/param.h.  */
-# ifndef HAVE_SYS_PARAM_H
-#  define HAVE_SYS_PARAM_H 1
-# endif
-
 # ifdef _SC_PAGESIZE
 #  define getpagesize() sysconf(_SC_PAGESIZE)
 # else /* no _SC_PAGESIZE */
@@ -4590,8 +4522,9 @@ int
 main ()
 {
   char *data, *data2, *data3;
+  const char *cdata2;
   int i, pagesize;
-  int fd;
+  int fd, fd2;
 
   pagesize = getpagesize ();
 
@@ -4604,27 +4537,41 @@ main ()
   umask (0);
   fd = creat ("conftest.mmap", 0600);
   if (fd < 0)
-    return 1;
+    return 2;
   if (write (fd, data, pagesize) != pagesize)
-    return 1;
+    return 3;
   close (fd);
 
+  /* Next, check that the tail of a page is zero-filled.  File must have
+     non-zero length, otherwise we risk SIGBUS for entire page.  */
+  fd2 = open ("conftest.txt", O_RDWR | O_CREAT | O_TRUNC, 0600);
+  if (fd2 < 0)
+    return 4;
+  cdata2 = "";
+  if (write (fd2, cdata2, 1) != 1)
+    return 5;
+  data2 = (char *) mmap (0, pagesize, PROT_READ | PROT_WRITE, MAP_SHARED, fd2, 0L);
+  if (data2 == MAP_FAILED)
+    return 6;
+  for (i = 0; i < pagesize; ++i)
+    if (*(data2 + i))
+      return 7;
+  close (fd2);
+  if (munmap (data2, pagesize))
+    return 8;
+
   /* Next, try to mmap the file at a fixed address which already has
      something else allocated at it.  If we can, also make sure that
      we see the same garbage.  */
   fd = open ("conftest.mmap", O_RDWR);
   if (fd < 0)
-    return 1;
-  data2 = (char *) malloc (2 * pagesize);
-  if (!data2)
-    return 1;
-  data2 += (pagesize - ((long int) data2 & (pagesize - 1))) & (pagesize - 1);
+    return 9;
   if (data2 != mmap (data2, pagesize, PROT_READ | PROT_WRITE,
                     MAP_PRIVATE | MAP_FIXED, fd, 0L))
-    return 1;
+    return 10;
   for (i = 0; i < pagesize; ++i)
     if (*(data + i) != *(data2 + i))
-      return 1;
+      return 11;
 
   /* Finally, make sure that changes to the mapped area do not
      percolate back to the file as seen by read().  (This is a bug on
@@ -4633,214 +4580,56 @@ main ()
     *(data2 + i) = *(data2 + i) + 1;
   data3 = (char *) malloc (pagesize);
   if (!data3)
-    return 1;
+    return 12;
   if (read (fd, data3, pagesize) != pagesize)
-    return 1;
+    return 13;
   for (i = 0; i < pagesize; ++i)
     if (*(data + i) != *(data3 + i))
-      return 1;
+      return 14;
   close (fd);
   return 0;
 }
 _ACEOF
-rm -f conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_link") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+if ac_fn_c_try_run "$LINENO"; then :
   ac_cv_func_mmap_fixed_mapped=yes
 else
-  echo "$as_me: program exited with status $ac_status" >&5
-echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-( exit $ac_status )
-ac_cv_func_mmap_fixed_mapped=no
+  ac_cv_func_mmap_fixed_mapped=no
 fi
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
 fi
 
-
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_func_mmap_fixed_mapped" >&5
-echo "${ECHO_T}$ac_cv_func_mmap_fixed_mapped" >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_mmap_fixed_mapped" >&5
+$as_echo "$ac_cv_func_mmap_fixed_mapped" >&6; }
 if test $ac_cv_func_mmap_fixed_mapped = yes; then
 
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_MMAP 1
-_ACEOF
+$as_echo "#define HAVE_MMAP 1" >>confdefs.h
 
 fi
-rm -f conftest.mmap
-
+rm -f conftest.mmap conftest.txt
 
 for ac_header in stdlib.h
-do
-as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-else
-  # Is the header compilable?
-{ echo "$as_me:$LINENO: checking $ac_header usability" >&5
-echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ echo "$as_me:$LINENO: checking $ac_header presence" >&5
-echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <$ac_header>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6; }
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
-
-    ;;
-esac
-{ echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
+do :
+  ac_fn_c_check_header_mongrel "$LINENO" "stdlib.h" "ac_cv_header_stdlib_h" "$ac_includes_default"
+if test "x$ac_cv_header_stdlib_h" = x""yes; then :
   cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+#define HAVE_STDLIB_H 1
 _ACEOF
 
 fi
 
 done
 
-{ echo "$as_me:$LINENO: checking for GNU libc compatible realloc" >&5
-echo $ECHO_N "checking for GNU libc compatible realloc... $ECHO_C" >&6; }
-if test "${ac_cv_func_realloc_0_nonnull+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU libc compatible realloc" >&5
+$as_echo_n "checking for GNU libc compatible realloc... " >&6; }
+if test "${ac_cv_func_realloc_0_nonnull+set}" = set; then :
+  $as_echo_n "(cached) " >&6
 else
-  if test "$cross_compiling" = yes; then
+  if test "$cross_compiling" = yes; then :
   ac_cv_func_realloc_0_nonnull=no
 else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 #if defined STDC_HEADERS || defined HAVE_STDLIB_H
 # include <stdlib.h>
@@ -4856,52 +4645,24 @@ return ! realloc (0, 0);
   return 0;
 }
 _ACEOF
-rm -f conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_link") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+if ac_fn_c_try_run "$LINENO"; then :
   ac_cv_func_realloc_0_nonnull=yes
 else
-  echo "$as_me: program exited with status $ac_status" >&5
-echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-( exit $ac_status )
-ac_cv_func_realloc_0_nonnull=no
+  ac_cv_func_realloc_0_nonnull=no
 fi
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
 fi
 
-
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_func_realloc_0_nonnull" >&5
-echo "${ECHO_T}$ac_cv_func_realloc_0_nonnull" >&6; }
-if test $ac_cv_func_realloc_0_nonnull = yes; then
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_realloc_0_nonnull" >&5
+$as_echo "$ac_cv_func_realloc_0_nonnull" >&6; }
+if test $ac_cv_func_realloc_0_nonnull = yes; then :
 
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_REALLOC 1
-_ACEOF
+$as_echo "#define HAVE_REALLOC 1" >>confdefs.h
 
 else
-  cat >>confdefs.h <<\_ACEOF
-#define HAVE_REALLOC 0
-_ACEOF
+  $as_echo "#define HAVE_REALLOC 0" >>confdefs.h
 
    case " $LIBOBJS " in
   *" realloc.$ac_objext "* ) ;;
@@ -4910,222 +4671,65 @@ _ACEOF
 esac
 
 
-cat >>confdefs.h <<\_ACEOF
-#define realloc rpl_realloc
-_ACEOF
+$as_echo "#define realloc rpl_realloc" >>confdefs.h
 
 fi
 
 
+for ac_header in sys/select.h sys/socket.h
+do :
+  as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
+  cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
 
+fi
 
+done
 
-for ac_header in sys/select.h sys/socket.h
-do
-as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking types of arguments for select" >&5
+$as_echo_n "checking types of arguments for select... " >&6; }
+if test "${ac_cv_func_select_args+set}" = set; then :
+  $as_echo_n "(cached) " >&6
 else
-  # Is the header compilable?
-{ echo "$as_me:$LINENO: checking $ac_header usability" >&5
-echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  for ac_arg234 in 'fd_set *' 'int *' 'void *'; do
+ for ac_arg1 in 'int' 'size_t' 'unsigned long int' 'unsigned int'; do
+  for ac_arg5 in 'struct timeval *' 'const struct timeval *'; do
+   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 $ac_includes_default
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+#ifdef HAVE_SYS_SELECT_H
+# include <sys/select.h>
+#endif
+#ifdef HAVE_SYS_SOCKET_H
+# include <sys/socket.h>
+#endif
 
-       ac_header_compiler=no
+int
+main ()
+{
+extern int select ($ac_arg1,
+                                           $ac_arg234, $ac_arg234, $ac_arg234,
+                                           $ac_arg5);
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_func_select_args="$ac_arg1,$ac_arg234,$ac_arg5"; break 3
 fi
-
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ echo "$as_me:$LINENO: checking $ac_header presence" >&5
-echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <$ac_header>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6; }
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
-
-    ;;
-esac
-{ echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
-  cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-
-done
-
-{ echo "$as_me:$LINENO: checking types of arguments for select" >&5
-echo $ECHO_N "checking types of arguments for select... $ECHO_C" >&6; }
-if test "${ac_cv_func_select_args+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  for ac_arg234 in 'fd_set *' 'int *' 'void *'; do
- for ac_arg1 in 'int' 'size_t' 'unsigned long int' 'unsigned int'; do
-  for ac_arg5 in 'struct timeval *' 'const struct timeval *'; do
-   cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#ifdef HAVE_SYS_SELECT_H
-# include <sys/select.h>
-#endif
-#ifdef HAVE_SYS_SOCKET_H
-# include <sys/socket.h>
-#endif
-
-int
-main ()
-{
-extern int select ($ac_arg1,
-                                           $ac_arg234, $ac_arg234, $ac_arg234,
-                                           $ac_arg5);
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_cv_func_select_args="$ac_arg1,$ac_arg234,$ac_arg5"; break 3
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-  done
- done
-done
-# Provide a safe default value.
-: ${ac_cv_func_select_args='int,int *,struct timeval *'}
+  done
+ done
+done
+# Provide a safe default value.
+: ${ac_cv_func_select_args='int,int *,struct timeval *'}
 
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_func_select_args" >&5
-echo "${ECHO_T}$ac_cv_func_select_args" >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_select_args" >&5
+$as_echo "$ac_cv_func_select_args" >&6; }
 ac_save_IFS=$IFS; IFS=','
 set dummy `echo "$ac_cv_func_select_args" | sed 's/\*/\*/g'`
 IFS=$ac_save_IFS
@@ -5147,29 +4751,25 @@ _ACEOF
 
 rm -f conftest*
 
-{ echo "$as_me:$LINENO: checking whether lstat dereferences a symlink specified with a trailing slash" >&5
-echo $ECHO_N "checking whether lstat dereferences a symlink specified with a trailing slash... $ECHO_C" >&6; }
-if test "${ac_cv_func_lstat_dereferences_slashed_symlink+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether lstat correctly handles trailing slash" >&5
+$as_echo_n "checking whether lstat correctly handles trailing slash... " >&6; }
+if test "${ac_cv_func_lstat_dereferences_slashed_symlink+set}" = set; then :
+  $as_echo_n "(cached) " >&6
 else
   rm -f conftest.sym conftest.file
 echo >conftest.file
 if test "$as_ln_s" = "ln -s" && ln -s conftest.file conftest.sym; then
-  if test "$cross_compiling" = yes; then
+  if test "$cross_compiling" = yes; then :
   ac_cv_func_lstat_dereferences_slashed_symlink=no
 else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 $ac_includes_default
 int
 main ()
 {
 struct stat sbuf;
-     /* Linux will dereference the symlink and fail.
+     /* Linux will dereference the symlink and fail, as required by POSIX.
        That is better in the sense that it means we will not
        have to compile and use the lstat wrapper.  */
      return lstat ("conftest.sym/", &sbuf) == 0;
@@ -5177,39 +4777,15 @@ struct stat sbuf;
   return 0;
 }
 _ACEOF
-rm -f conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_link") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+if ac_fn_c_try_run "$LINENO"; then :
   ac_cv_func_lstat_dereferences_slashed_symlink=yes
 else
-  echo "$as_me: program exited with status $ac_status" >&5
-echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-( exit $ac_status )
-ac_cv_func_lstat_dereferences_slashed_symlink=no
+  ac_cv_func_lstat_dereferences_slashed_symlink=no
 fi
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
 fi
 
-
 else
   # If the `ln -s' command failed, then we probably don't even
   # have an lstat function.
@@ -5218,8 +4794,8 @@ fi
 rm -f conftest.sym conftest.file
 
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_func_lstat_dereferences_slashed_symlink" >&5
-echo "${ECHO_T}$ac_cv_func_lstat_dereferences_slashed_symlink" >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_lstat_dereferences_slashed_symlink" >&5
+$as_echo "$ac_cv_func_lstat_dereferences_slashed_symlink" >&6; }
 
 test $ac_cv_func_lstat_dereferences_slashed_symlink = yes &&
 
@@ -5228,7 +4804,7 @@ cat >>confdefs.h <<_ACEOF
 _ACEOF
 
 
-if test $ac_cv_func_lstat_dereferences_slashed_symlink = no; then
+if test "x$ac_cv_func_lstat_dereferences_slashed_symlink" = xno; then
   case " $LIBOBJS " in
   *" lstat.$ac_objext "* ) ;;
   *) LIBOBJS="$LIBOBJS lstat.$ac_objext"
@@ -5237,19 +4813,15 @@ esac
 
 fi
 
-{ echo "$as_me:$LINENO: checking whether stat accepts an empty string" >&5
-echo $ECHO_N "checking whether stat accepts an empty string... $ECHO_C" >&6; }
-if test "${ac_cv_func_stat_empty_string_bug+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stat accepts an empty string" >&5
+$as_echo_n "checking whether stat accepts an empty string... " >&6; }
+if test "${ac_cv_func_stat_empty_string_bug+set}" = set; then :
+  $as_echo_n "(cached) " >&6
 else
-  if test "$cross_compiling" = yes; then
+  if test "$cross_compiling" = yes; then :
   ac_cv_func_stat_empty_string_bug=yes
 else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 $ac_includes_default
 int
@@ -5261,42 +4833,18 @@ struct stat sbuf;
   return 0;
 }
 _ACEOF
-rm -f conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_link") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+if ac_fn_c_try_run "$LINENO"; then :
   ac_cv_func_stat_empty_string_bug=no
 else
-  echo "$as_me: program exited with status $ac_status" >&5
-echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-( exit $ac_status )
-ac_cv_func_stat_empty_string_bug=yes
+  ac_cv_func_stat_empty_string_bug=yes
 fi
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
 fi
 
-
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_func_stat_empty_string_bug" >&5
-echo "${ECHO_T}$ac_cv_func_stat_empty_string_bug" >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_stat_empty_string_bug" >&5
+$as_echo "$ac_cv_func_stat_empty_string_bug" >&6; }
 if test $ac_cv_func_stat_empty_string_bug = yes; then
   case " $LIBOBJS " in
   *" stat.$ac_objext "* ) ;;
@@ -5311,183 +4859,18 @@ _ACEOF
 
 fi
 
-
 for ac_func in vprintf
-do
-as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
-{ echo "$as_me:$LINENO: checking for $ac_func" >&5
-echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; }
-if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
-   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
-#define $ac_func innocuous_$ac_func
-
-/* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char $ac_func (); below.
-    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
-    <limits.h> exists even on freestanding compilers.  */
-
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-
-#undef $ac_func
-
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char $ac_func ();
-/* The GNU C library defines this for functions which it implements
-    to always fail with ENOSYS.  Some functions are actually named
-    something starting with __ and the normal name is an alias.  */
-#if defined __stub_$ac_func || defined __stub___$ac_func
-choke me
-#endif
-
-int
-main ()
-{
-return $ac_func ();
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
-  eval "$as_ac_var=yes"
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       eval "$as_ac_var=no"
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-fi
-ac_res=`eval echo '${'$as_ac_var'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-if test `eval echo '${'$as_ac_var'}'` = yes; then
+do :
+  ac_fn_c_check_func "$LINENO" "vprintf" "ac_cv_func_vprintf"
+if test "x$ac_cv_func_vprintf" = x""yes; then :
   cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
-_ACEOF
-
-{ echo "$as_me:$LINENO: checking for _doprnt" >&5
-echo $ECHO_N "checking for _doprnt... $ECHO_C" >&6; }
-if test "${ac_cv_func__doprnt+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-/* Define _doprnt to an innocuous variant, in case <limits.h> declares _doprnt.
-   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
-#define _doprnt innocuous__doprnt
-
-/* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char _doprnt (); below.
-    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
-    <limits.h> exists even on freestanding compilers.  */
-
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-
-#undef _doprnt
-
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char _doprnt ();
-/* The GNU C library defines this for functions which it implements
-    to always fail with ENOSYS.  Some functions are actually named
-    something starting with __ and the normal name is an alias.  */
-#if defined __stub__doprnt || defined __stub____doprnt
-choke me
-#endif
-
-int
-main ()
-{
-return _doprnt ();
-  ;
-  return 0;
-}
+#define HAVE_VPRINTF 1
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
-  ac_cv_func__doprnt=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_cv_func__doprnt=no
-fi
 
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_func__doprnt" >&5
-echo "${ECHO_T}$ac_cv_func__doprnt" >&6; }
-if test $ac_cv_func__doprnt = yes; then
+ac_fn_c_check_func "$LINENO" "_doprnt" "ac_cv_func__doprnt"
+if test "x$ac_cv_func__doprnt" = x""yes; then :
 
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_DOPRNT 1
-_ACEOF
+$as_echo "#define HAVE_DOPRNT 1" >>confdefs.h
 
 fi
 
@@ -5495,16 +4878,12 @@ fi
 done
 
 
-{ echo "$as_me:$LINENO: checking for stdbool.h that conforms to C99" >&5
-echo $ECHO_N "checking for stdbool.h that conforms to C99... $ECHO_C" >&6; }
-if test "${ac_cv_header_stdbool_h+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for stdbool.h that conforms to C99" >&5
+$as_echo_n "checking for stdbool.h that conforms to C99... " >&6; }
+if test "${ac_cv_header_stdbool_h+set}" = set; then :
+  $as_echo_n "(cached) " >&6
 else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 #include <stdbool.h>
@@ -5539,6 +4918,8 @@ cat >>conftest.$ac_ext <<_ACEOF
        char h[sizeof (_Bool)];
        char i[sizeof s.t];
        enum { j = false, k = true, l = false * true, m = true * 256 };
+       /* The following fails for
+          HP aC++/ANSI C B3910B A.05.55 [Dec 04 2003]. */
        _Bool n[m];
        char o[sizeof n == m * sizeof n[0] ? 1 : -1];
        char p[-1 - (_Bool) 0 < 0 && -1 - (bool) 0 < 0 ? 1 : -1];
@@ -5582,89 +4963,17 @@ main ()
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
+if ac_fn_c_try_compile "$LINENO"; then :
   ac_cv_header_stdbool_h=yes
 else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_cv_header_stdbool_h=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_header_stdbool_h" >&5
-echo "${ECHO_T}$ac_cv_header_stdbool_h" >&6; }
-{ echo "$as_me:$LINENO: checking for _Bool" >&5
-echo $ECHO_N "checking for _Bool... $ECHO_C" >&6; }
-if test "${ac_cv_type__Bool+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-typedef _Bool ac__type_new_;
-int
-main ()
-{
-if ((ac__type_new_ *) 0)
-  return 0;
-if (sizeof (ac__type_new_))
-  return 0;
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_cv_type__Bool=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_cv_type__Bool=no
+  ac_cv_header_stdbool_h=no
 fi
-
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_type__Bool" >&5
-echo "${ECHO_T}$ac_cv_type__Bool" >&6; }
-if test $ac_cv_type__Bool = yes; then
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdbool_h" >&5
+$as_echo "$ac_cv_header_stdbool_h" >&6; }
+ac_fn_c_check_type "$LINENO" "_Bool" "ac_cv_type__Bool" "$ac_includes_default"
+if test "x$ac_cv_type__Bool" = x""yes; then :
 
 cat >>confdefs.h <<_ACEOF
 #define HAVE__BOOL 1
@@ -5675,22 +4984,16 @@ fi
 
 if test $ac_cv_header_stdbool_h = yes; then
 
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_STDBOOL_H 1
-_ACEOF
+$as_echo "#define HAVE_STDBOOL_H 1" >>confdefs.h
 
 fi
 
-{ echo "$as_me:$LINENO: checking for ANSI C header files" >&5
-echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6; }
-if test "${ac_cv_header_stdc+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5
+$as_echo_n "checking for ANSI C header files... " >&6; }
+if test "${ac_cv_header_stdc+set}" = set; then :
+  $as_echo_n "(cached) " >&6
 else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 #include <stdlib.h>
 #include <stdarg.h>
@@ -5705,47 +5008,23 @@ main ()
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
+if ac_fn_c_try_compile "$LINENO"; then :
   ac_cv_header_stdc=yes
 else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_cv_header_stdc=no
+  ac_cv_header_stdc=no
 fi
-
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 
 if test $ac_cv_header_stdc = yes; then
   # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 #include <string.h>
 
 _ACEOF
 if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  $EGREP "memchr" >/dev/null 2>&1; then
-  :
+  $EGREP "memchr" >/dev/null 2>&1; then :
+
 else
   ac_cv_header_stdc=no
 fi
@@ -5755,18 +5034,14 @@ fi
 
 if test $ac_cv_header_stdc = yes; then
   # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 #include <stdlib.h>
 
 _ACEOF
 if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  $EGREP "free" >/dev/null 2>&1; then
-  :
+  $EGREP "free" >/dev/null 2>&1; then :
+
 else
   ac_cv_header_stdc=no
 fi
@@ -5776,14 +5051,10 @@ fi
 
 if test $ac_cv_header_stdc = yes; then
   # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
-  if test "$cross_compiling" = yes; then
+  if test "$cross_compiling" = yes; then :
   :
 else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 #include <ctype.h>
 #include <stdlib.h>
@@ -5810,61 +5081,31 @@ main ()
   return 0;
 }
 _ACEOF
-rm -f conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_link") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  :
-else
-  echo "$as_me: program exited with status $ac_status" >&5
-echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+if ac_fn_c_try_run "$LINENO"; then :
 
-( exit $ac_status )
-ac_cv_header_stdc=no
+else
+  ac_cv_header_stdc=no
 fi
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
 fi
 
-
 fi
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5
-echo "${ECHO_T}$ac_cv_header_stdc" >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5
+$as_echo "$ac_cv_header_stdc" >&6; }
 if test $ac_cv_header_stdc = yes; then
 
-cat >>confdefs.h <<\_ACEOF
-#define STDC_HEADERS 1
-_ACEOF
+$as_echo "#define STDC_HEADERS 1" >>confdefs.h
 
 fi
 
-{ echo "$as_me:$LINENO: checking whether time.h and sys/time.h may both be included" >&5
-echo $ECHO_N "checking whether time.h and sys/time.h may both be included... $ECHO_C" >&6; }
-if test "${ac_cv_header_time+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether time.h and sys/time.h may both be included" >&5
+$as_echo_n "checking whether time.h and sys/time.h may both be included... " >&6; }
+if test "${ac_cv_header_time+set}" = set; then :
+  $as_echo_n "(cached) " >&6
 else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 #include <sys/types.h>
 #include <sys/time.h>
@@ -5879,61 +5120,35 @@ return 0;
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
+if ac_fn_c_try_compile "$LINENO"; then :
   ac_cv_header_time=yes
 else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_cv_header_time=no
+  ac_cv_header_time=no
 fi
-
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_header_time" >&5
-echo "${ECHO_T}$ac_cv_header_time" >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_time" >&5
+$as_echo "$ac_cv_header_time" >&6; }
 if test $ac_cv_header_time = yes; then
 
-cat >>confdefs.h <<\_ACEOF
-#define TIME_WITH_SYS_TIME 1
-_ACEOF
+$as_echo "#define TIME_WITH_SYS_TIME 1" >>confdefs.h
 
 fi
 
 if test $ac_cv_c_compiler_gnu = yes; then
-    { echo "$as_me:$LINENO: checking whether $CC needs -traditional" >&5
-echo $ECHO_N "checking whether $CC needs -traditional... $ECHO_C" >&6; }
-if test "${ac_cv_prog_gcc_traditional+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC needs -traditional" >&5
+$as_echo_n "checking whether $CC needs -traditional... " >&6; }
+if test "${ac_cv_prog_gcc_traditional+set}" = set; then :
+  $as_echo_n "(cached) " >&6
 else
     ac_pattern="Autoconf.*'x'"
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 #include <sgtty.h>
 Autoconf TIOCGETP
 _ACEOF
 if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  $EGREP "$ac_pattern" >/dev/null 2>&1; then
+  $EGREP "$ac_pattern" >/dev/null 2>&1; then :
   ac_cv_prog_gcc_traditional=yes
 else
   ac_cv_prog_gcc_traditional=no
@@ -5942,25 +5157,21 @@ rm -f conftest*
 
 
   if test $ac_cv_prog_gcc_traditional = no; then
-    cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 #include <termio.h>
 Autoconf TCGETA
 _ACEOF
 if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  $EGREP "$ac_pattern" >/dev/null 2>&1; then
+  $EGREP "$ac_pattern" >/dev/null 2>&1; then :
   ac_cv_prog_gcc_traditional=yes
 fi
 rm -f conftest*
 
   fi
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_prog_gcc_traditional" >&5
-echo "${ECHO_T}$ac_cv_prog_gcc_traditional" >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_gcc_traditional" >&5
+$as_echo "$ac_cv_prog_gcc_traditional" >&6; }
   if test $ac_cv_prog_gcc_traditional = yes; then
     CC="$CC -traditional"
   fi
@@ -5968,14 +5179,14 @@ fi
 
 case `pwd` in
   *\ * | *\    *)
-    { echo "$as_me:$LINENO: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5
-echo "$as_me: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&2;} ;;
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5
+$as_echo "$as_me: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&2;} ;;
 esac
 
 
 
-macro_version='2.2.4'
-macro_revision='1.2976'
+macro_version='2.2.6b'
+macro_revision='1.3017'
 
 
 
@@ -5993,35 +5204,27 @@ ltmain="$ac_aux_dir/ltmain.sh"
 
 # Make sure we can run config.sub.
 $SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 ||
-  { { echo "$as_me:$LINENO: error: cannot run $SHELL $ac_aux_dir/config.sub" >&5
-echo "$as_me: error: cannot run $SHELL $ac_aux_dir/config.sub" >&2;}
-   { (exit 1); exit 1; }; }
+  as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5
 
-{ echo "$as_me:$LINENO: checking build system type" >&5
-echo $ECHO_N "checking build system type... $ECHO_C" >&6; }
-if test "${ac_cv_build+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5
+$as_echo_n "checking build system type... " >&6; }
+if test "${ac_cv_build+set}" = set; then :
+  $as_echo_n "(cached) " >&6
 else
   ac_build_alias=$build_alias
 test "x$ac_build_alias" = x &&
   ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"`
 test "x$ac_build_alias" = x &&
-  { { echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5
-echo "$as_me: error: cannot guess build type; you must specify one" >&2;}
-   { (exit 1); exit 1; }; }
+  as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5
 ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` ||
-  { { echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&5
-echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&2;}
-   { (exit 1); exit 1; }; }
+  as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5
 
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_build" >&5
-echo "${ECHO_T}$ac_cv_build" >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5
+$as_echo "$ac_cv_build" >&6; }
 case $ac_cv_build in
 *-*-*) ;;
-*) { { echo "$as_me:$LINENO: error: invalid value of canonical build" >&5
-echo "$as_me: error: invalid value of canonical build" >&2;}
-   { (exit 1); exit 1; }; };;
+*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5 ;;
 esac
 build=$ac_cv_build
 ac_save_IFS=$IFS; IFS='-'
@@ -6037,28 +5240,24 @@ IFS=$ac_save_IFS
 case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac
 
 
-{ echo "$as_me:$LINENO: checking host system type" >&5
-echo $ECHO_N "checking host system type... $ECHO_C" >&6; }
-if test "${ac_cv_host+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5
+$as_echo_n "checking host system type... " >&6; }
+if test "${ac_cv_host+set}" = set; then :
+  $as_echo_n "(cached) " >&6
 else
   if test "x$host_alias" = x; then
   ac_cv_host=$ac_cv_build
 else
   ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` ||
-    { { echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&5
-echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&2;}
-   { (exit 1); exit 1; }; }
+    as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5
 fi
 
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_host" >&5
-echo "${ECHO_T}$ac_cv_host" >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5
+$as_echo "$ac_cv_host" >&6; }
 case $ac_cv_host in
 *-*-*) ;;
-*) { { echo "$as_me:$LINENO: error: invalid value of canonical host" >&5
-echo "$as_me: error: invalid value of canonical host" >&2;}
-   { (exit 1); exit 1; }; };;
+*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5 ;;
 esac
 host=$ac_cv_host
 ac_save_IFS=$IFS; IFS='-'
@@ -6074,51 +5273,46 @@ IFS=$ac_save_IFS
 case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac
 
 
-{ echo "$as_me:$LINENO: checking for a sed that does not truncate output" >&5
-echo $ECHO_N "checking for a sed that does not truncate output... $ECHO_C" >&6; }
-if test "${ac_cv_path_SED+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5
+$as_echo_n "checking for a sed that does not truncate output... " >&6; }
+if test "${ac_cv_path_SED+set}" = set; then :
+  $as_echo_n "(cached) " >&6
 else
             ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/
      for ac_i in 1 2 3 4 5 6 7; do
        ac_script="$ac_script$as_nl$ac_script"
      done
-     echo "$ac_script" | sed 99q >conftest.sed
-     $as_unset ac_script || ac_script=
-     # Extract the first word of "sed gsed" to use in msg output
-if test -z "$SED"; then
-set dummy sed gsed; ac_prog_name=$2
-if test "${ac_cv_path_SED+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
+     echo "$ac_script" 2>/dev/null | sed 99q >conftest.sed
+     { ac_script=; unset ac_script;}
+     if test -z "$SED"; then
   ac_path_SED_found=false
-# Loop through the user's path and test for each of PROGNAME-LIST
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+  # Loop through the user's path and test for each of PROGNAME-LIST
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
 for as_dir in $PATH
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for ac_prog in sed gsed; do
-  for ac_exec_ext in '' $ac_executable_extensions; do
-    ac_path_SED="$as_dir/$ac_prog$ac_exec_ext"
-    { test -f "$ac_path_SED" && $as_test_x "$ac_path_SED"; } || continue
-    # Check for GNU ac_path_SED and select it if it is found.
+    for ac_prog in sed gsed; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
+      ac_path_SED="$as_dir/$ac_prog$ac_exec_ext"
+      { test -f "$ac_path_SED" && $as_test_x "$ac_path_SED"; } || continue
+# Check for GNU ac_path_SED and select it if it is found.
   # Check for GNU $ac_path_SED
 case `"$ac_path_SED" --version 2>&1` in
 *GNU*)
   ac_cv_path_SED="$ac_path_SED" ac_path_SED_found=:;;
 *)
   ac_count=0
-  echo $ECHO_N "0123456789$ECHO_C" >"conftest.in"
+  $as_echo_n 0123456789 >"conftest.in"
   while :
   do
     cat "conftest.in" "conftest.in" >"conftest.tmp"
     mv "conftest.tmp" "conftest.in"
     cp "conftest.in" "conftest.nl"
-    echo '' >> "conftest.nl"
+    $as_echo '' >> "conftest.nl"
     "$ac_path_SED" -f conftest.sed < "conftest.nl" >"conftest.out" 2>/dev/null || break
     diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
-    ac_count=`expr $ac_count + 1`
+    as_fn_arith $ac_count + 1 && ac_count=$as_val
     if test $ac_count -gt ${ac_path_SED_max-0}; then
       # Best one so far, save it but keep looking for a better one
       ac_cv_path_SED="$ac_path_SED"
@@ -6130,31 +5324,21 @@ case `"$ac_path_SED" --version 2>&1` in
   rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
 esac
 
-
-    $ac_path_SED_found && break 3
+      $ac_path_SED_found && break 3
+    done
+  done
   done
-done
-
-done
 IFS=$as_save_IFS
-
-
-fi
-
-SED="$ac_cv_path_SED"
-if test -z "$SED"; then
-  { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in \$PATH" >&5
-echo "$as_me: error: no acceptable $ac_prog_name could be found in \$PATH" >&2;}
-   { (exit 1); exit 1; }; }
-fi
-
+  if test -z "$ac_cv_path_SED"; then
+    as_fn_error $? "no acceptable sed could be found in \$PATH" "$LINENO" 5
+  fi
 else
   ac_cv_path_SED=$SED
 fi
 
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_path_SED" >&5
-echo "${ECHO_T}$ac_cv_path_SED" >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_SED" >&5
+$as_echo "$ac_cv_path_SED" >&6; }
  SED="$ac_cv_path_SED"
   rm -f conftest.sed
 
@@ -6171,48 +5355,43 @@ Xsed="$SED -e 1s/^X//"
 
 
 
-{ echo "$as_me:$LINENO: checking for fgrep" >&5
-echo $ECHO_N "checking for fgrep... $ECHO_C" >&6; }
-if test "${ac_cv_path_FGREP+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for fgrep" >&5
+$as_echo_n "checking for fgrep... " >&6; }
+if test "${ac_cv_path_FGREP+set}" = set; then :
+  $as_echo_n "(cached) " >&6
 else
   if echo 'ab*c' | $GREP -F 'ab*c' >/dev/null 2>&1
    then ac_cv_path_FGREP="$GREP -F"
    else
-     # Extract the first word of "fgrep" to use in msg output
-if test -z "$FGREP"; then
-set dummy fgrep; ac_prog_name=$2
-if test "${ac_cv_path_FGREP+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
+     if test -z "$FGREP"; then
   ac_path_FGREP_found=false
-# Loop through the user's path and test for each of PROGNAME-LIST
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+  # Loop through the user's path and test for each of PROGNAME-LIST
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
 for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for ac_prog in fgrep; do
-  for ac_exec_ext in '' $ac_executable_extensions; do
-    ac_path_FGREP="$as_dir/$ac_prog$ac_exec_ext"
-    { test -f "$ac_path_FGREP" && $as_test_x "$ac_path_FGREP"; } || continue
-    # Check for GNU ac_path_FGREP and select it if it is found.
+    for ac_prog in fgrep; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
+      ac_path_FGREP="$as_dir/$ac_prog$ac_exec_ext"
+      { test -f "$ac_path_FGREP" && $as_test_x "$ac_path_FGREP"; } || continue
+# Check for GNU ac_path_FGREP and select it if it is found.
   # Check for GNU $ac_path_FGREP
 case `"$ac_path_FGREP" --version 2>&1` in
 *GNU*)
   ac_cv_path_FGREP="$ac_path_FGREP" ac_path_FGREP_found=:;;
 *)
   ac_count=0
-  echo $ECHO_N "0123456789$ECHO_C" >"conftest.in"
+  $as_echo_n 0123456789 >"conftest.in"
   while :
   do
     cat "conftest.in" "conftest.in" >"conftest.tmp"
     mv "conftest.tmp" "conftest.in"
     cp "conftest.in" "conftest.nl"
-    echo 'FGREP' >> "conftest.nl"
+    $as_echo 'FGREP' >> "conftest.nl"
     "$ac_path_FGREP" FGREP < "conftest.nl" >"conftest.out" 2>/dev/null || break
     diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
-    ac_count=`expr $ac_count + 1`
+    as_fn_arith $ac_count + 1 && ac_count=$as_val
     if test $ac_count -gt ${ac_path_FGREP_max-0}; then
       # Best one so far, save it but keep looking for a better one
       ac_cv_path_FGREP="$ac_path_FGREP"
@@ -6224,33 +5403,22 @@ case `"$ac_path_FGREP" --version 2>&1` in
   rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
 esac
 
-
-    $ac_path_FGREP_found && break 3
+      $ac_path_FGREP_found && break 3
+    done
+  done
   done
-done
-
-done
 IFS=$as_save_IFS
-
-
-fi
-
-FGREP="$ac_cv_path_FGREP"
-if test -z "$FGREP"; then
-  { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5
-echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;}
-   { (exit 1); exit 1; }; }
-fi
-
+  if test -z "$ac_cv_path_FGREP"; then
+    as_fn_error $? "no acceptable fgrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
+  fi
 else
   ac_cv_path_FGREP=$FGREP
 fi
 
-
    fi
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_path_FGREP" >&5
-echo "${ECHO_T}$ac_cv_path_FGREP" >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_FGREP" >&5
+$as_echo "$ac_cv_path_FGREP" >&6; }
  FGREP="$ac_cv_path_FGREP"
 
 
@@ -6275,7 +5443,7 @@ test -z "$GREP" && GREP=grep
 
 
 # Check whether --with-gnu-ld was given.
-if test "${with_gnu_ld+set}" = set; then
+if test "${with_gnu_ld+set}" = set; then :
   withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes
 else
   with_gnu_ld=no
@@ -6284,8 +5452,8 @@ fi
 ac_prog=ld
 if test "$GCC" = yes; then
   # Check if gcc -print-prog-name=ld gives a path.
-  { echo "$as_me:$LINENO: checking for ld used by $CC" >&5
-echo $ECHO_N "checking for ld used by $CC... $ECHO_C" >&6; }
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5
+$as_echo_n "checking for ld used by $CC... " >&6; }
   case $host in
   *-*-mingw*)
     # gcc leaves a trailing carriage return which upsets mingw
@@ -6314,14 +5482,14 @@ echo $ECHO_N "checking for ld used by $CC... $ECHO_C" >&6; }
     ;;
   esac
 elif test "$with_gnu_ld" = yes; then
-  { echo "$as_me:$LINENO: checking for GNU ld" >&5
-echo $ECHO_N "checking for GNU ld... $ECHO_C" >&6; }
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5
+$as_echo_n "checking for GNU ld... " >&6; }
 else
-  { echo "$as_me:$LINENO: checking for non-GNU ld" >&5
-echo $ECHO_N "checking for non-GNU ld... $ECHO_C" >&6; }
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5
+$as_echo_n "checking for non-GNU ld... " >&6; }
 fi
-if test "${lt_cv_path_LD+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+if test "${lt_cv_path_LD+set}" = set; then :
+  $as_echo_n "(cached) " >&6
 else
   if test -z "$LD"; then
   lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
@@ -6351,19 +5519,17 @@ fi
 
 LD="$lt_cv_path_LD"
 if test -n "$LD"; then
-  { echo "$as_me:$LINENO: result: $LD" >&5
-echo "${ECHO_T}$LD" >&6; }
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LD" >&5
+$as_echo "$LD" >&6; }
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 fi
-test -z "$LD" && { { echo "$as_me:$LINENO: error: no acceptable ld found in \$PATH" >&5
-echo "$as_me: error: no acceptable ld found in \$PATH" >&2;}
-   { (exit 1); exit 1; }; }
-{ echo "$as_me:$LINENO: checking if the linker ($LD) is GNU ld" >&5
-echo $ECHO_N "checking if the linker ($LD) is GNU ld... $ECHO_C" >&6; }
-if test "${lt_cv_prog_gnu_ld+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5
+$as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; }
+if test "${lt_cv_prog_gnu_ld+set}" = set; then :
+  $as_echo_n "(cached) " >&6
 else
   # I'd rather use --version here, but apparently some GNU lds only accept -v.
 case `$LD -v 2>&1 </dev/null` in
@@ -6375,8 +5541,8 @@ case `$LD -v 2>&1 </dev/null` in
   ;;
 esac
 fi
-{ echo "$as_me:$LINENO: result: $lt_cv_prog_gnu_ld" >&5
-echo "${ECHO_T}$lt_cv_prog_gnu_ld" >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_gnu_ld" >&5
+$as_echo "$lt_cv_prog_gnu_ld" >&6; }
 with_gnu_ld=$lt_cv_prog_gnu_ld
 
 
@@ -6387,10 +5553,10 @@ with_gnu_ld=$lt_cv_prog_gnu_ld
 
 
 
-{ echo "$as_me:$LINENO: checking for BSD- or MS-compatible name lister (nm)" >&5
-echo $ECHO_N "checking for BSD- or MS-compatible name lister (nm)... $ECHO_C" >&6; }
-if test "${lt_cv_path_NM+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for BSD- or MS-compatible name lister (nm)" >&5
+$as_echo_n "checking for BSD- or MS-compatible name lister (nm)... " >&6; }
+if test "${lt_cv_path_NM+set}" = set; then :
+  $as_echo_n "(cached) " >&6
 else
   if test -n "$NM"; then
   # Let the user override the test.
@@ -6436,8 +5602,8 @@ else
   : ${lt_cv_path_NM=no}
 fi
 fi
-{ echo "$as_me:$LINENO: result: $lt_cv_path_NM" >&5
-echo "${ECHO_T}$lt_cv_path_NM" >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_NM" >&5
+$as_echo "$lt_cv_path_NM" >&6; }
 if test "$lt_cv_path_NM" != "no"; then
   NM="$lt_cv_path_NM"
 else
@@ -6447,10 +5613,10 @@ else
   do
     # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
 set dummy $ac_tool_prefix$ac_prog; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
-if test "${ac_cv_prog_DUMPBIN+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_DUMPBIN+set}" = set; then :
+  $as_echo_n "(cached) " >&6
 else
   if test -n "$DUMPBIN"; then
   ac_cv_prog_DUMPBIN="$DUMPBIN" # Let the user override the test.
@@ -6460,25 +5626,25 @@ for as_dir in $PATH
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_prog_DUMPBIN="$ac_tool_prefix$ac_prog"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
-done
+  done
 IFS=$as_save_IFS
 
 fi
 fi
 DUMPBIN=$ac_cv_prog_DUMPBIN
 if test -n "$DUMPBIN"; then
-  { echo "$as_me:$LINENO: result: $DUMPBIN" >&5
-echo "${ECHO_T}$DUMPBIN" >&6; }
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DUMPBIN" >&5
+$as_echo "$DUMPBIN" >&6; }
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
 
@@ -6491,10 +5657,10 @@ if test -z "$DUMPBIN"; then
 do
   # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
-if test "${ac_cv_prog_ac_ct_DUMPBIN+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_DUMPBIN+set}" = set; then :
+  $as_echo_n "(cached) " >&6
 else
   if test -n "$ac_ct_DUMPBIN"; then
   ac_cv_prog_ac_ct_DUMPBIN="$ac_ct_DUMPBIN" # Let the user override the test.
@@ -6504,25 +5670,25 @@ for as_dir in $PATH
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_prog_ac_ct_DUMPBIN="$ac_prog"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
-done
+  done
 IFS=$as_save_IFS
 
 fi
 fi
 ac_ct_DUMPBIN=$ac_cv_prog_ac_ct_DUMPBIN
 if test -n "$ac_ct_DUMPBIN"; then
-  { echo "$as_me:$LINENO: result: $ac_ct_DUMPBIN" >&5
-echo "${ECHO_T}$ac_ct_DUMPBIN" >&6; }
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DUMPBIN" >&5
+$as_echo "$ac_ct_DUMPBIN" >&6; }
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
 
@@ -6534,12 +5700,8 @@ done
   else
     case $cross_compiling:$ac_tool_warned in
 yes:)
-{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet.  If you think this
-configuration is useful to you, please write to autoconf@gnu.org." >&5
-echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet.  If you think this
-configuration is useful to you, please write to autoconf@gnu.org." >&2;}
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
 ac_tool_warned=yes ;;
 esac
     DUMPBIN=$ac_ct_DUMPBIN
@@ -6558,45 +5720,45 @@ test -z "$NM" && NM=nm
 
 
 
-{ echo "$as_me:$LINENO: checking the name lister ($NM) interface" >&5
-echo $ECHO_N "checking the name lister ($NM) interface... $ECHO_C" >&6; }
-if test "${lt_cv_nm_interface+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking the name lister ($NM) interface" >&5
+$as_echo_n "checking the name lister ($NM) interface... " >&6; }
+if test "${lt_cv_nm_interface+set}" = set; then :
+  $as_echo_n "(cached) " >&6
 else
   lt_cv_nm_interface="BSD nm"
   echo "int some_variable = 0;" > conftest.$ac_ext
-  (eval echo "\"\$as_me:6568: $ac_compile\"" >&5)
+  (eval echo "\"\$as_me:5730: $ac_compile\"" >&5)
   (eval "$ac_compile" 2>conftest.err)
   cat conftest.err >&5
-  (eval echo "\"\$as_me:6571: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
+  (eval echo "\"\$as_me:5733: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
   (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
   cat conftest.err >&5
-  (eval echo "\"\$as_me:6574: output\"" >&5)
+  (eval echo "\"\$as_me:5736: output\"" >&5)
   cat conftest.out >&5
   if $GREP 'External.*some_variable' conftest.out > /dev/null; then
     lt_cv_nm_interface="MS dumpbin"
   fi
   rm -f conftest*
 fi
-{ echo "$as_me:$LINENO: result: $lt_cv_nm_interface" >&5
-echo "${ECHO_T}$lt_cv_nm_interface" >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_nm_interface" >&5
+$as_echo "$lt_cv_nm_interface" >&6; }
 
-{ echo "$as_me:$LINENO: checking whether ln -s works" >&5
-echo $ECHO_N "checking whether ln -s works... $ECHO_C" >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5
+$as_echo_n "checking whether ln -s works... " >&6; }
 LN_S=$as_ln_s
 if test "$LN_S" = "ln -s"; then
-  { echo "$as_me:$LINENO: result: yes" >&5
-echo "${ECHO_T}yes" >&6; }
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
 else
-  { echo "$as_me:$LINENO: result: no, using $LN_S" >&5
-echo "${ECHO_T}no, using $LN_S" >&6; }
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, using $LN_S" >&5
+$as_echo "no, using $LN_S" >&6; }
 fi
 
 # find the maximum length of command line arguments
-{ echo "$as_me:$LINENO: checking the maximum length of command line arguments" >&5
-echo $ECHO_N "checking the maximum length of command line arguments... $ECHO_C" >&6; }
-if test "${lt_cv_sys_max_cmd_len+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking the maximum length of command line arguments" >&5
+$as_echo_n "checking the maximum length of command line arguments... " >&6; }
+if test "${lt_cv_sys_max_cmd_len+set}" = set; then :
+  $as_echo_n "(cached) " >&6
 else
     i=0
   teststring="ABCD"
@@ -6617,7 +5779,7 @@ else
     lt_cv_sys_max_cmd_len=-1;
     ;;
 
-  cygwin* | mingw*)
+  cygwin* | mingw* | cegcc*)
     # On Win9x/ME, this test blows up -- it succeeds, but takes
     # about 5 minutes as the teststring grows exponentially.
     # Worse, since 9x/ME are not pre-emptively multitasking,
@@ -6713,11 +5875,11 @@ else
 fi
 
 if test -n $lt_cv_sys_max_cmd_len ; then
-  { echo "$as_me:$LINENO: result: $lt_cv_sys_max_cmd_len" >&5
-echo "${ECHO_T}$lt_cv_sys_max_cmd_len" >&6; }
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sys_max_cmd_len" >&5
+$as_echo "$lt_cv_sys_max_cmd_len" >&6; }
 else
-  { echo "$as_me:$LINENO: result: none" >&5
-echo "${ECHO_T}none" >&6; }
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: none" >&5
+$as_echo "none" >&6; }
 fi
 max_cmd_len=$lt_cv_sys_max_cmd_len
 
@@ -6730,8 +5892,8 @@ max_cmd_len=$lt_cv_sys_max_cmd_len
 : ${MV="mv -f"}
 : ${RM="rm -f"}
 
-{ echo "$as_me:$LINENO: checking whether the shell understands some XSI constructs" >&5
-echo $ECHO_N "checking whether the shell understands some XSI constructs... $ECHO_C" >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the shell understands some XSI constructs" >&5
+$as_echo_n "checking whether the shell understands some XSI constructs... " >&6; }
 # Try some XSI features
 xsi_shell=no
 ( _lt_dummy="a/b/c"
@@ -6740,18 +5902,18 @@ xsi_shell=no
     && eval 'test $(( 1 + 1 )) -eq 2 \
     && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \
   && xsi_shell=yes
-{ echo "$as_me:$LINENO: result: $xsi_shell" >&5
-echo "${ECHO_T}$xsi_shell" >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $xsi_shell" >&5
+$as_echo "$xsi_shell" >&6; }
 
 
-{ echo "$as_me:$LINENO: checking whether the shell understands \"+=\"" >&5
-echo $ECHO_N "checking whether the shell understands \"+=\"... $ECHO_C" >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the shell understands \"+=\"" >&5
+$as_echo_n "checking whether the shell understands \"+=\"... " >&6; }
 lt_shell_append=no
 ( foo=bar; set foo baz; eval "$1+=\$2" && test "$foo" = barbaz ) \
     >/dev/null 2>&1 \
   && lt_shell_append=yes
-{ echo "$as_me:$LINENO: result: $lt_shell_append" >&5
-echo "${ECHO_T}$lt_shell_append" >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_shell_append" >&5
+$as_echo "$lt_shell_append" >&6; }
 
 
 if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
@@ -6785,15 +5947,15 @@ esac
 
 
 
-{ echo "$as_me:$LINENO: checking for $LD option to reload object files" >&5
-echo $ECHO_N "checking for $LD option to reload object files... $ECHO_C" >&6; }
-if test "${lt_cv_ld_reload_flag+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $LD option to reload object files" >&5
+$as_echo_n "checking for $LD option to reload object files... " >&6; }
+if test "${lt_cv_ld_reload_flag+set}" = set; then :
+  $as_echo_n "(cached) " >&6
 else
   lt_cv_ld_reload_flag='-r'
 fi
-{ echo "$as_me:$LINENO: result: $lt_cv_ld_reload_flag" >&5
-echo "${ECHO_T}$lt_cv_ld_reload_flag" >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_reload_flag" >&5
+$as_echo "$lt_cv_ld_reload_flag" >&6; }
 reload_flag=$lt_cv_ld_reload_flag
 case $reload_flag in
 "" | " "*) ;;
@@ -6818,11 +5980,112 @@ esac
 
 
 
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args.
+set dummy ${ac_tool_prefix}objdump; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_OBJDUMP+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$OBJDUMP"; then
+  ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+OBJDUMP=$ac_cv_prog_OBJDUMP
+if test -n "$OBJDUMP"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OBJDUMP" >&5
+$as_echo "$OBJDUMP" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_OBJDUMP"; then
+  ac_ct_OBJDUMP=$OBJDUMP
+  # Extract the first word of "objdump", so it can be a program name with args.
+set dummy objdump; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_OBJDUMP+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_OBJDUMP"; then
+  ac_cv_prog_ac_ct_OBJDUMP="$ac_ct_OBJDUMP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_OBJDUMP="objdump"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP
+if test -n "$ac_ct_OBJDUMP"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJDUMP" >&5
+$as_echo "$ac_ct_OBJDUMP" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  if test "x$ac_ct_OBJDUMP" = x; then
+    OBJDUMP="false"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    OBJDUMP=$ac_ct_OBJDUMP
+  fi
+else
+  OBJDUMP="$ac_cv_prog_OBJDUMP"
+fi
+
+test -z "$OBJDUMP" && OBJDUMP=objdump
+
+
+
+
+
+
+
+
 
-{ echo "$as_me:$LINENO: checking how to recognize dependent libraries" >&5
-echo $ECHO_N "checking how to recognize dependent libraries... $ECHO_C" >&6; }
-if test "${lt_cv_deplibs_check_method+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to recognize dependent libraries" >&5
+$as_echo_n "checking how to recognize dependent libraries... " >&6; }
+if test "${lt_cv_deplibs_check_method+set}" = set; then :
+  $as_echo_n "(cached) " >&6
 else
   lt_cv_file_magic_cmd='$MAGIC_CMD'
 lt_cv_file_magic_test_file=
@@ -6872,6 +6135,12 @@ mingw* | pw32*)
   fi
   ;;
 
+cegcc)
+  # use the weaker test based on 'objdump'. See mingw*.
+  lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?'
+  lt_cv_file_magic_cmd='$OBJDUMP -f'
+  ;;
+
 darwin* | rhapsody*)
   lt_cv_deplibs_check_method=pass_all
   ;;
@@ -6930,11 +6199,11 @@ irix5* | irix6* | nonstopux*)
   ;;
 
 # This must be Linux ELF.
-linux* | k*bsd*-gnu)
+linux* | k*bsd*-gnu | kopensolaris*-gnu)
   lt_cv_deplibs_check_method=pass_all
   ;;
 
-netbsd*)
+netbsd* | netbsdelf*-gnu)
   if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then
     lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$'
   else
@@ -7009,8 +6278,8 @@ tpf*)
 esac
 
 fi
-{ echo "$as_me:$LINENO: result: $lt_cv_deplibs_check_method" >&5
-echo "${ECHO_T}$lt_cv_deplibs_check_method" >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_deplibs_check_method" >&5
+$as_echo "$lt_cv_deplibs_check_method" >&6; }
 file_magic_cmd=$lt_cv_file_magic_cmd
 deplibs_check_method=$lt_cv_deplibs_check_method
 test -z "$deplibs_check_method" && deplibs_check_method=unknown
@@ -7029,10 +6298,10 @@ test -z "$deplibs_check_method" && deplibs_check_method=unknown
 if test -n "$ac_tool_prefix"; then
   # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args.
 set dummy ${ac_tool_prefix}ar; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
-if test "${ac_cv_prog_AR+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_AR+set}" = set; then :
+  $as_echo_n "(cached) " >&6
 else
   if test -n "$AR"; then
   ac_cv_prog_AR="$AR" # Let the user override the test.
@@ -7042,25 +6311,25 @@ for as_dir in $PATH
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_prog_AR="${ac_tool_prefix}ar"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
-done
+  done
 IFS=$as_save_IFS
 
 fi
 fi
 AR=$ac_cv_prog_AR
 if test -n "$AR"; then
-  { echo "$as_me:$LINENO: result: $AR" >&5
-echo "${ECHO_T}$AR" >&6; }
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5
+$as_echo "$AR" >&6; }
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
 
@@ -7069,10 +6338,10 @@ if test -z "$ac_cv_prog_AR"; then
   ac_ct_AR=$AR
   # Extract the first word of "ar", so it can be a program name with args.
 set dummy ar; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
-if test "${ac_cv_prog_ac_ct_AR+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_AR+set}" = set; then :
+  $as_echo_n "(cached) " >&6
 else
   if test -n "$ac_ct_AR"; then
   ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test.
@@ -7082,25 +6351,25 @@ for as_dir in $PATH
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_prog_ac_ct_AR="ar"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
-done
+  done
 IFS=$as_save_IFS
 
 fi
 fi
 ac_ct_AR=$ac_cv_prog_ac_ct_AR
 if test -n "$ac_ct_AR"; then
-  { echo "$as_me:$LINENO: result: $ac_ct_AR" >&5
-echo "${ECHO_T}$ac_ct_AR" >&6; }
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5
+$as_echo "$ac_ct_AR" >&6; }
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
   if test "x$ac_ct_AR" = x; then
@@ -7108,12 +6377,8 @@ fi
   else
     case $cross_compiling:$ac_tool_warned in
 yes:)
-{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet.  If you think this
-configuration is useful to you, please write to autoconf@gnu.org." >&5
-echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet.  If you think this
-configuration is useful to you, please write to autoconf@gnu.org." >&2;}
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
 ac_tool_warned=yes ;;
 esac
     AR=$ac_ct_AR
@@ -7138,10 +6403,10 @@ test -z "$AR_FLAGS" && AR_FLAGS=cru
 if test -n "$ac_tool_prefix"; then
   # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
 set dummy ${ac_tool_prefix}strip; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
-if test "${ac_cv_prog_STRIP+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_STRIP+set}" = set; then :
+  $as_echo_n "(cached) " >&6
 else
   if test -n "$STRIP"; then
   ac_cv_prog_STRIP="$STRIP" # Let the user override the test.
@@ -7151,25 +6416,25 @@ for as_dir in $PATH
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_prog_STRIP="${ac_tool_prefix}strip"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
-done
+  done
 IFS=$as_save_IFS
 
 fi
 fi
 STRIP=$ac_cv_prog_STRIP
 if test -n "$STRIP"; then
-  { echo "$as_me:$LINENO: result: $STRIP" >&5
-echo "${ECHO_T}$STRIP" >&6; }
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5
+$as_echo "$STRIP" >&6; }
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
 
@@ -7178,10 +6443,10 @@ if test -z "$ac_cv_prog_STRIP"; then
   ac_ct_STRIP=$STRIP
   # Extract the first word of "strip", so it can be a program name with args.
 set dummy strip; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
-if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then :
+  $as_echo_n "(cached) " >&6
 else
   if test -n "$ac_ct_STRIP"; then
   ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test.
@@ -7191,25 +6456,25 @@ for as_dir in $PATH
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_prog_ac_ct_STRIP="strip"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
-done
+  done
 IFS=$as_save_IFS
 
 fi
 fi
 ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP
 if test -n "$ac_ct_STRIP"; then
-  { echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5
-echo "${ECHO_T}$ac_ct_STRIP" >&6; }
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5
+$as_echo "$ac_ct_STRIP" >&6; }
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
   if test "x$ac_ct_STRIP" = x; then
@@ -7217,12 +6482,8 @@ fi
   else
     case $cross_compiling:$ac_tool_warned in
 yes:)
-{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet.  If you think this
-configuration is useful to you, please write to autoconf@gnu.org." >&5
-echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet.  If you think this
-configuration is useful to you, please write to autoconf@gnu.org." >&2;}
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
 ac_tool_warned=yes ;;
 esac
     STRIP=$ac_ct_STRIP
@@ -7241,10 +6502,10 @@ test -z "$STRIP" && STRIP=:
 if test -n "$ac_tool_prefix"; then
   # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
 set dummy ${ac_tool_prefix}ranlib; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
-if test "${ac_cv_prog_RANLIB+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_RANLIB+set}" = set; then :
+  $as_echo_n "(cached) " >&6
 else
   if test -n "$RANLIB"; then
   ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
@@ -7254,25 +6515,25 @@ for as_dir in $PATH
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
-done
+  done
 IFS=$as_save_IFS
 
 fi
 fi
 RANLIB=$ac_cv_prog_RANLIB
 if test -n "$RANLIB"; then
-  { echo "$as_me:$LINENO: result: $RANLIB" >&5
-echo "${ECHO_T}$RANLIB" >&6; }
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5
+$as_echo "$RANLIB" >&6; }
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
 
@@ -7281,10 +6542,10 @@ if test -z "$ac_cv_prog_RANLIB"; then
   ac_ct_RANLIB=$RANLIB
   # Extract the first word of "ranlib", so it can be a program name with args.
 set dummy ranlib; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
-if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then :
+  $as_echo_n "(cached) " >&6
 else
   if test -n "$ac_ct_RANLIB"; then
   ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test.
@@ -7294,25 +6555,25 @@ for as_dir in $PATH
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_prog_ac_ct_RANLIB="ranlib"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
-done
+  done
 IFS=$as_save_IFS
 
 fi
 fi
 ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB
 if test -n "$ac_ct_RANLIB"; then
-  { echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5
-echo "${ECHO_T}$ac_ct_RANLIB" >&6; }
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5
+$as_echo "$ac_ct_RANLIB" >&6; }
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
   if test "x$ac_ct_RANLIB" = x; then
@@ -7320,12 +6581,8 @@ fi
   else
     case $cross_compiling:$ac_tool_warned in
 yes:)
-{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet.  If you think this
-configuration is useful to you, please write to autoconf@gnu.org." >&5
-echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet.  If you think this
-configuration is useful to you, please write to autoconf@gnu.org." >&2;}
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
 ac_tool_warned=yes ;;
 esac
     RANLIB=$ac_ct_RANLIB
@@ -7402,10 +6659,10 @@ compiler=$CC
 
 
 # Check for command to grab the raw symbol name followed by C symbol from nm.
-{ echo "$as_me:$LINENO: checking command to parse $NM output from $compiler object" >&5
-echo $ECHO_N "checking command to parse $NM output from $compiler object... $ECHO_C" >&6; }
-if test "${lt_cv_sys_global_symbol_pipe+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking command to parse $NM output from $compiler object" >&5
+$as_echo_n "checking command to parse $NM output from $compiler object... " >&6; }
+if test "${lt_cv_sys_global_symbol_pipe+set}" = set; then :
+  $as_echo_n "(cached) " >&6
 else
 
 # These are sane defaults that work on at least a few old systems.
@@ -7422,7 +6679,7 @@ case $host_os in
 aix*)
   symcode='[BCDT]'
   ;;
-cygwin* | mingw* | pw32*)
+cygwin* | mingw* | pw32* | cegcc*)
   symcode='[ABCDGISTW]'
   ;;
 hpux*)
@@ -7520,18 +6777,18 @@ void nm_test_func(void){}
 int main(){nm_test_var='a';nm_test_func();return(0);}
 _LT_EOF
 
-  if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; then
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
     # Now try to grab the symbols.
     nlist=conftest.nm
-    if { (eval echo "$as_me:$LINENO: \"$NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist\"") >&5
+    if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist\""; } >&5
   (eval $NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) 2>&5
   ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && test -s "$nlist"; then
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } && test -s "$nlist"; then
       # Try sorting and uniquifying the output.
       if sort "$nlist" | uniq > "$nlist"T; then
        mv -f "$nlist"T "$nlist"
@@ -7584,11 +6841,11 @@ _LT_EOF
          lt_save_CFLAGS="$CFLAGS"
          LIBS="conftstm.$ac_objext"
          CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag"
-         if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+         if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && test -s conftest${ac_exeext}; then
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } && test -s conftest${ac_exeext}; then
            pipe_works=yes
          fi
          LIBS="$lt_save_LIBS"
@@ -7622,11 +6879,11 @@ if test -z "$lt_cv_sys_global_symbol_pipe"; then
   lt_cv_sys_global_symbol_to_cdecl=
 fi
 if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then
-  { echo "$as_me:$LINENO: result: failed" >&5
-echo "${ECHO_T}failed" >&6; }
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: failed" >&5
+$as_echo "failed" >&6; }
 else
-  { echo "$as_me:$LINENO: result: ok" >&5
-echo "${ECHO_T}ok" >&6; }
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5
+$as_echo "ok" >&6; }
 fi
 
 
@@ -7651,7 +6908,7 @@ fi
 
 
 # Check whether --enable-libtool-lock was given.
-if test "${enable_libtool_lock+set}" = set; then
+if test "${enable_libtool_lock+set}" = set; then :
   enableval=$enable_libtool_lock;
 fi
 
@@ -7663,11 +6920,11 @@ case $host in
 ia64-*-hpux*)
   # Find out which ABI we are using.
   echo 'int i;' > conftest.$ac_ext
-  if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; then
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
     case `/usr/bin/file conftest.$ac_objext` in
       *ELF-32*)
        HPUX_IA64_MODE="32"
@@ -7681,12 +6938,12 @@ ia64-*-hpux*)
   ;;
 *-*-irix6*)
   # Find out which ABI we are using.
-  echo '#line 7684 "configure"' > conftest.$ac_ext
-  if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  echo '#line 6941 "configure"' > conftest.$ac_ext
+  if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; then
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
     if test "$lt_cv_prog_gnu_ld" = yes; then
       case `/usr/bin/file conftest.$ac_objext` in
        *32-bit*)
@@ -7720,11 +6977,11 @@ x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \
 s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
   # Find out which ABI we are using.
   echo 'int i;' > conftest.$ac_ext
-  if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; then
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
     case `/usr/bin/file conftest.o` in
       *32-bit*)
        case $host in
@@ -7773,10 +7030,10 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
   # On SCO OpenServer 5, we need -belf to get full-featured binaries.
   SAVE_CFLAGS="$CFLAGS"
   CFLAGS="$CFLAGS -belf"
-  { echo "$as_me:$LINENO: checking whether the C compiler needs -belf" >&5
-echo $ECHO_N "checking whether the C compiler needs -belf... $ECHO_C" >&6; }
-if test "${lt_cv_cc_needs_belf+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler needs -belf" >&5
+$as_echo_n "checking whether the C compiler needs -belf... " >&6; }
+if test "${lt_cv_cc_needs_belf+set}" = set; then :
+  $as_echo_n "(cached) " >&6
 else
   ac_ext=c
 ac_cpp='$CPP $CPPFLAGS'
@@ -7784,11 +7041,7 @@ ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
 ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
 ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
-     cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+     cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 int
@@ -7799,34 +7052,13 @@ main ()
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+if ac_fn_c_try_link "$LINENO"; then :
   lt_cv_cc_needs_belf=yes
 else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       lt_cv_cc_needs_belf=no
+  lt_cv_cc_needs_belf=no
 fi
-
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
      ac_ext=c
 ac_cpp='$CPP $CPPFLAGS'
 ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
@@ -7834,8 +7066,8 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $
 ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
 fi
-{ echo "$as_me:$LINENO: result: $lt_cv_cc_needs_belf" >&5
-echo "${ECHO_T}$lt_cv_cc_needs_belf" >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_cc_needs_belf" >&5
+$as_echo "$lt_cv_cc_needs_belf" >&6; }
   if test x"$lt_cv_cc_needs_belf" != x"yes"; then
     # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
     CFLAGS="$SAVE_CFLAGS"
@@ -7844,11 +7076,11 @@ echo "${ECHO_T}$lt_cv_cc_needs_belf" >&6; }
 sparc*-*solaris*)
   # Find out which ABI we are using.
   echo 'int i;' > conftest.$ac_ext
-  if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; then
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
     case `/usr/bin/file conftest.o` in
     *64-bit*)
       case $lt_cv_prog_gnu_ld in
@@ -7874,10 +7106,10 @@ need_locks="$enable_libtool_lock"
     if test -n "$ac_tool_prefix"; then
   # Extract the first word of "${ac_tool_prefix}dsymutil", so it can be a program name with args.
 set dummy ${ac_tool_prefix}dsymutil; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
-if test "${ac_cv_prog_DSYMUTIL+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_DSYMUTIL+set}" = set; then :
+  $as_echo_n "(cached) " >&6
 else
   if test -n "$DSYMUTIL"; then
   ac_cv_prog_DSYMUTIL="$DSYMUTIL" # Let the user override the test.
@@ -7887,25 +7119,25 @@ for as_dir in $PATH
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_prog_DSYMUTIL="${ac_tool_prefix}dsymutil"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
-done
+  done
 IFS=$as_save_IFS
 
 fi
 fi
 DSYMUTIL=$ac_cv_prog_DSYMUTIL
 if test -n "$DSYMUTIL"; then
-  { echo "$as_me:$LINENO: result: $DSYMUTIL" >&5
-echo "${ECHO_T}$DSYMUTIL" >&6; }
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DSYMUTIL" >&5
+$as_echo "$DSYMUTIL" >&6; }
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
 
@@ -7914,10 +7146,10 @@ if test -z "$ac_cv_prog_DSYMUTIL"; then
   ac_ct_DSYMUTIL=$DSYMUTIL
   # Extract the first word of "dsymutil", so it can be a program name with args.
 set dummy dsymutil; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
-if test "${ac_cv_prog_ac_ct_DSYMUTIL+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_DSYMUTIL+set}" = set; then :
+  $as_echo_n "(cached) " >&6
 else
   if test -n "$ac_ct_DSYMUTIL"; then
   ac_cv_prog_ac_ct_DSYMUTIL="$ac_ct_DSYMUTIL" # Let the user override the test.
@@ -7927,25 +7159,25 @@ for as_dir in $PATH
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_prog_ac_ct_DSYMUTIL="dsymutil"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
-done
+  done
 IFS=$as_save_IFS
 
 fi
 fi
 ac_ct_DSYMUTIL=$ac_cv_prog_ac_ct_DSYMUTIL
 if test -n "$ac_ct_DSYMUTIL"; then
-  { echo "$as_me:$LINENO: result: $ac_ct_DSYMUTIL" >&5
-echo "${ECHO_T}$ac_ct_DSYMUTIL" >&6; }
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DSYMUTIL" >&5
+$as_echo "$ac_ct_DSYMUTIL" >&6; }
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
   if test "x$ac_ct_DSYMUTIL" = x; then
@@ -7953,12 +7185,8 @@ fi
   else
     case $cross_compiling:$ac_tool_warned in
 yes:)
-{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet.  If you think this
-configuration is useful to you, please write to autoconf@gnu.org." >&5
-echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet.  If you think this
-configuration is useful to you, please write to autoconf@gnu.org." >&2;}
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
 ac_tool_warned=yes ;;
 esac
     DSYMUTIL=$ac_ct_DSYMUTIL
@@ -7970,10 +7198,10 @@ fi
     if test -n "$ac_tool_prefix"; then
   # Extract the first word of "${ac_tool_prefix}nmedit", so it can be a program name with args.
 set dummy ${ac_tool_prefix}nmedit; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
-if test "${ac_cv_prog_NMEDIT+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_NMEDIT+set}" = set; then :
+  $as_echo_n "(cached) " >&6
 else
   if test -n "$NMEDIT"; then
   ac_cv_prog_NMEDIT="$NMEDIT" # Let the user override the test.
@@ -7983,25 +7211,25 @@ for as_dir in $PATH
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_prog_NMEDIT="${ac_tool_prefix}nmedit"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
-done
+  done
 IFS=$as_save_IFS
 
 fi
 fi
 NMEDIT=$ac_cv_prog_NMEDIT
 if test -n "$NMEDIT"; then
-  { echo "$as_me:$LINENO: result: $NMEDIT" >&5
-echo "${ECHO_T}$NMEDIT" >&6; }
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $NMEDIT" >&5
+$as_echo "$NMEDIT" >&6; }
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
 
@@ -8010,10 +7238,10 @@ if test -z "$ac_cv_prog_NMEDIT"; then
   ac_ct_NMEDIT=$NMEDIT
   # Extract the first word of "nmedit", so it can be a program name with args.
 set dummy nmedit; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
-if test "${ac_cv_prog_ac_ct_NMEDIT+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_NMEDIT+set}" = set; then :
+  $as_echo_n "(cached) " >&6
 else
   if test -n "$ac_ct_NMEDIT"; then
   ac_cv_prog_ac_ct_NMEDIT="$ac_ct_NMEDIT" # Let the user override the test.
@@ -8023,25 +7251,25 @@ for as_dir in $PATH
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_prog_ac_ct_NMEDIT="nmedit"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
-done
+  done
 IFS=$as_save_IFS
 
 fi
 fi
 ac_ct_NMEDIT=$ac_cv_prog_ac_ct_NMEDIT
 if test -n "$ac_ct_NMEDIT"; then
-  { echo "$as_me:$LINENO: result: $ac_ct_NMEDIT" >&5
-echo "${ECHO_T}$ac_ct_NMEDIT" >&6; }
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_NMEDIT" >&5
+$as_echo "$ac_ct_NMEDIT" >&6; }
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
   if test "x$ac_ct_NMEDIT" = x; then
@@ -8049,12 +7277,8 @@ fi
   else
     case $cross_compiling:$ac_tool_warned in
 yes:)
-{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet.  If you think this
-configuration is useful to you, please write to autoconf@gnu.org." >&5
-echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet.  If you think this
-configuration is useful to you, please write to autoconf@gnu.org." >&2;}
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
 ac_tool_warned=yes ;;
 esac
     NMEDIT=$ac_ct_NMEDIT
@@ -8066,10 +7290,10 @@ fi
     if test -n "$ac_tool_prefix"; then
   # Extract the first word of "${ac_tool_prefix}lipo", so it can be a program name with args.
 set dummy ${ac_tool_prefix}lipo; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
-if test "${ac_cv_prog_LIPO+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_LIPO+set}" = set; then :
+  $as_echo_n "(cached) " >&6
 else
   if test -n "$LIPO"; then
   ac_cv_prog_LIPO="$LIPO" # Let the user override the test.
@@ -8079,25 +7303,25 @@ for as_dir in $PATH
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_prog_LIPO="${ac_tool_prefix}lipo"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
-done
+  done
 IFS=$as_save_IFS
 
 fi
 fi
 LIPO=$ac_cv_prog_LIPO
 if test -n "$LIPO"; then
-  { echo "$as_me:$LINENO: result: $LIPO" >&5
-echo "${ECHO_T}$LIPO" >&6; }
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIPO" >&5
+$as_echo "$LIPO" >&6; }
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
 
@@ -8106,10 +7330,10 @@ if test -z "$ac_cv_prog_LIPO"; then
   ac_ct_LIPO=$LIPO
   # Extract the first word of "lipo", so it can be a program name with args.
 set dummy lipo; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
-if test "${ac_cv_prog_ac_ct_LIPO+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_LIPO+set}" = set; then :
+  $as_echo_n "(cached) " >&6
 else
   if test -n "$ac_ct_LIPO"; then
   ac_cv_prog_ac_ct_LIPO="$ac_ct_LIPO" # Let the user override the test.
@@ -8119,25 +7343,25 @@ for as_dir in $PATH
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_prog_ac_ct_LIPO="lipo"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
-done
+  done
 IFS=$as_save_IFS
 
 fi
 fi
 ac_ct_LIPO=$ac_cv_prog_ac_ct_LIPO
 if test -n "$ac_ct_LIPO"; then
-  { echo "$as_me:$LINENO: result: $ac_ct_LIPO" >&5
-echo "${ECHO_T}$ac_ct_LIPO" >&6; }
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_LIPO" >&5
+$as_echo "$ac_ct_LIPO" >&6; }
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
   if test "x$ac_ct_LIPO" = x; then
@@ -8145,12 +7369,8 @@ fi
   else
     case $cross_compiling:$ac_tool_warned in
 yes:)
-{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet.  If you think this
-configuration is useful to you, please write to autoconf@gnu.org." >&5
-echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet.  If you think this
-configuration is useful to you, please write to autoconf@gnu.org." >&2;}
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
 ac_tool_warned=yes ;;
 esac
     LIPO=$ac_ct_LIPO
@@ -8162,10 +7382,10 @@ fi
     if test -n "$ac_tool_prefix"; then
   # Extract the first word of "${ac_tool_prefix}otool", so it can be a program name with args.
 set dummy ${ac_tool_prefix}otool; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
-if test "${ac_cv_prog_OTOOL+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_OTOOL+set}" = set; then :
+  $as_echo_n "(cached) " >&6
 else
   if test -n "$OTOOL"; then
   ac_cv_prog_OTOOL="$OTOOL" # Let the user override the test.
@@ -8175,25 +7395,25 @@ for as_dir in $PATH
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_prog_OTOOL="${ac_tool_prefix}otool"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
-done
+  done
 IFS=$as_save_IFS
 
 fi
 fi
 OTOOL=$ac_cv_prog_OTOOL
 if test -n "$OTOOL"; then
-  { echo "$as_me:$LINENO: result: $OTOOL" >&5
-echo "${ECHO_T}$OTOOL" >&6; }
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL" >&5
+$as_echo "$OTOOL" >&6; }
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
 
@@ -8202,10 +7422,10 @@ if test -z "$ac_cv_prog_OTOOL"; then
   ac_ct_OTOOL=$OTOOL
   # Extract the first word of "otool", so it can be a program name with args.
 set dummy otool; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
-if test "${ac_cv_prog_ac_ct_OTOOL+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_OTOOL+set}" = set; then :
+  $as_echo_n "(cached) " >&6
 else
   if test -n "$ac_ct_OTOOL"; then
   ac_cv_prog_ac_ct_OTOOL="$ac_ct_OTOOL" # Let the user override the test.
@@ -8215,25 +7435,25 @@ for as_dir in $PATH
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_prog_ac_ct_OTOOL="otool"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
-done
+  done
 IFS=$as_save_IFS
 
 fi
 fi
 ac_ct_OTOOL=$ac_cv_prog_ac_ct_OTOOL
 if test -n "$ac_ct_OTOOL"; then
-  { echo "$as_me:$LINENO: result: $ac_ct_OTOOL" >&5
-echo "${ECHO_T}$ac_ct_OTOOL" >&6; }
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL" >&5
+$as_echo "$ac_ct_OTOOL" >&6; }
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
   if test "x$ac_ct_OTOOL" = x; then
@@ -8241,12 +7461,8 @@ fi
   else
     case $cross_compiling:$ac_tool_warned in
 yes:)
-{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet.  If you think this
-configuration is useful to you, please write to autoconf@gnu.org." >&5
-echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet.  If you think this
-configuration is useful to you, please write to autoconf@gnu.org." >&2;}
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
 ac_tool_warned=yes ;;
 esac
     OTOOL=$ac_ct_OTOOL
@@ -8258,10 +7474,10 @@ fi
     if test -n "$ac_tool_prefix"; then
   # Extract the first word of "${ac_tool_prefix}otool64", so it can be a program name with args.
 set dummy ${ac_tool_prefix}otool64; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
-if test "${ac_cv_prog_OTOOL64+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_OTOOL64+set}" = set; then :
+  $as_echo_n "(cached) " >&6
 else
   if test -n "$OTOOL64"; then
   ac_cv_prog_OTOOL64="$OTOOL64" # Let the user override the test.
@@ -8271,25 +7487,25 @@ for as_dir in $PATH
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_prog_OTOOL64="${ac_tool_prefix}otool64"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
-done
+  done
 IFS=$as_save_IFS
 
 fi
 fi
 OTOOL64=$ac_cv_prog_OTOOL64
 if test -n "$OTOOL64"; then
-  { echo "$as_me:$LINENO: result: $OTOOL64" >&5
-echo "${ECHO_T}$OTOOL64" >&6; }
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL64" >&5
+$as_echo "$OTOOL64" >&6; }
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
 
@@ -8298,10 +7514,10 @@ if test -z "$ac_cv_prog_OTOOL64"; then
   ac_ct_OTOOL64=$OTOOL64
   # Extract the first word of "otool64", so it can be a program name with args.
 set dummy otool64; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
-if test "${ac_cv_prog_ac_ct_OTOOL64+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_OTOOL64+set}" = set; then :
+  $as_echo_n "(cached) " >&6
 else
   if test -n "$ac_ct_OTOOL64"; then
   ac_cv_prog_ac_ct_OTOOL64="$ac_ct_OTOOL64" # Let the user override the test.
@@ -8311,25 +7527,25 @@ for as_dir in $PATH
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_prog_ac_ct_OTOOL64="otool64"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
-done
+  done
 IFS=$as_save_IFS
 
 fi
 fi
 ac_ct_OTOOL64=$ac_cv_prog_ac_ct_OTOOL64
 if test -n "$ac_ct_OTOOL64"; then
-  { echo "$as_me:$LINENO: result: $ac_ct_OTOOL64" >&5
-echo "${ECHO_T}$ac_ct_OTOOL64" >&6; }
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL64" >&5
+$as_echo "$ac_ct_OTOOL64" >&6; }
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
   if test "x$ac_ct_OTOOL64" = x; then
@@ -8337,12 +7553,8 @@ fi
   else
     case $cross_compiling:$ac_tool_warned in
 yes:)
-{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet.  If you think this
-configuration is useful to you, please write to autoconf@gnu.org." >&5
-echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet.  If you think this
-configuration is useful to you, please write to autoconf@gnu.org." >&2;}
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
 ac_tool_warned=yes ;;
 esac
     OTOOL64=$ac_ct_OTOOL64
@@ -8377,10 +7589,10 @@ fi
 
 
 
-    { echo "$as_me:$LINENO: checking for -single_module linker flag" >&5
-echo $ECHO_N "checking for -single_module linker flag... $ECHO_C" >&6; }
-if test "${lt_cv_apple_cc_single_mod+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -single_module linker flag" >&5
+$as_echo_n "checking for -single_module linker flag... " >&6; }
+if test "${lt_cv_apple_cc_single_mod+set}" = set; then :
+  $as_echo_n "(cached) " >&6
 else
   lt_cv_apple_cc_single_mod=no
       if test -z "${LT_MULTI_MODULE}"; then
@@ -8404,22 +7616,18 @@ else
        rm -f conftest.*
       fi
 fi
-{ echo "$as_me:$LINENO: result: $lt_cv_apple_cc_single_mod" >&5
-echo "${ECHO_T}$lt_cv_apple_cc_single_mod" >&6; }
-    { echo "$as_me:$LINENO: checking for -exported_symbols_list linker flag" >&5
-echo $ECHO_N "checking for -exported_symbols_list linker flag... $ECHO_C" >&6; }
-if test "${lt_cv_ld_exported_symbols_list+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_apple_cc_single_mod" >&5
+$as_echo "$lt_cv_apple_cc_single_mod" >&6; }
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -exported_symbols_list linker flag" >&5
+$as_echo_n "checking for -exported_symbols_list linker flag... " >&6; }
+if test "${lt_cv_ld_exported_symbols_list+set}" = set; then :
+  $as_echo_n "(cached) " >&6
 else
   lt_cv_ld_exported_symbols_list=no
       save_LDFLAGS=$LDFLAGS
       echo "_main" > conftest.sym
       LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym"
-      cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+      cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 int
@@ -8430,39 +7638,18 @@ main ()
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+if ac_fn_c_try_link "$LINENO"; then :
   lt_cv_ld_exported_symbols_list=yes
 else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       lt_cv_ld_exported_symbols_list=no
+  lt_cv_ld_exported_symbols_list=no
 fi
-
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
        LDFLAGS="$save_LDFLAGS"
 
 fi
-{ echo "$as_me:$LINENO: result: $lt_cv_ld_exported_symbols_list" >&5
-echo "${ECHO_T}$lt_cv_ld_exported_symbols_list" >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_exported_symbols_list" >&5
+$as_echo "$lt_cv_ld_exported_symbols_list" >&6; }
     case $host_os in
     rhapsody* | darwin1.[012])
       _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;;
@@ -8498,58 +7685,13 @@ echo "${ECHO_T}$lt_cv_ld_exported_symbols_list" >&6; }
     ;;
   esac
 
-
 for ac_header in dlfcn.h
-do
-as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-{ echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  eval "$as_ac_Header=yes"
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       eval "$as_ac_Header=no"
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
+do :
+  ac_fn_c_check_header_compile "$LINENO" "dlfcn.h" "ac_cv_header_dlfcn_h" "$ac_includes_default
+"
+if test "x$ac_cv_header_dlfcn_h" = x""yes; then :
   cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+#define HAVE_DLFCN_H 1
 _ACEOF
 
 fi
@@ -8569,7 +7711,7 @@ done
 
 
             # Check whether --enable-shared was given.
-if test "${enable_shared+set}" = set; then
+if test "${enable_shared+set}" = set; then :
   enableval=$enable_shared; p=${PACKAGE-default}
     case $enableval in
     yes) enable_shared=yes ;;
@@ -8600,7 +7742,7 @@ fi
 
 
   # Check whether --enable-static was given.
-if test "${enable_static+set}" = set; then
+if test "${enable_static+set}" = set; then :
   enableval=$enable_static; p=${PACKAGE-default}
     case $enableval in
     yes) enable_static=yes ;;
@@ -8632,7 +7774,7 @@ fi
 
 
 # Check whether --with-pic was given.
-if test "${with_pic+set}" = set; then
+if test "${with_pic+set}" = set; then :
   withval=$with_pic; pic_mode="$withval"
 else
   pic_mode=default
@@ -8648,7 +7790,7 @@ test -z "$pic_mode" && pic_mode=default
 
 
   # Check whether --enable-fast-install was given.
-if test "${enable_fast_install+set}" = set; then
+if test "${enable_fast_install+set}" = set; then :
   enableval=$enable_fast_install; p=${PACKAGE-default}
     case $enableval in
     yes) enable_fast_install=yes ;;
@@ -8729,10 +7871,10 @@ if test -n "${ZSH_VERSION+set}" ; then
    setopt NO_GLOB_SUBST
 fi
 
-{ echo "$as_me:$LINENO: checking for objdir" >&5
-echo $ECHO_N "checking for objdir... $ECHO_C" >&6; }
-if test "${lt_cv_objdir+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for objdir" >&5
+$as_echo_n "checking for objdir... " >&6; }
+if test "${lt_cv_objdir+set}" = set; then :
+  $as_echo_n "(cached) " >&6
 else
   rm -f .libs 2>/dev/null
 mkdir .libs 2>/dev/null
@@ -8744,8 +7886,8 @@ else
 fi
 rmdir .libs 2>/dev/null
 fi
-{ echo "$as_me:$LINENO: result: $lt_cv_objdir" >&5
-echo "${ECHO_T}$lt_cv_objdir" >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_objdir" >&5
+$as_echo "$lt_cv_objdir" >&6; }
 objdir=$lt_cv_objdir
 
 
@@ -8837,10 +7979,10 @@ test -z "$MAGIC_CMD" && MAGIC_CMD=file
 case $deplibs_check_method in
 file_magic*)
   if test "$file_magic_cmd" = '$MAGIC_CMD'; then
-    { echo "$as_me:$LINENO: checking for ${ac_tool_prefix}file" >&5
-echo $ECHO_N "checking for ${ac_tool_prefix}file... $ECHO_C" >&6; }
-if test "${lt_cv_path_MAGIC_CMD+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${ac_tool_prefix}file" >&5
+$as_echo_n "checking for ${ac_tool_prefix}file... " >&6; }
+if test "${lt_cv_path_MAGIC_CMD+set}" = set; then :
+  $as_echo_n "(cached) " >&6
 else
   case $MAGIC_CMD in
 [\\/*] |  ?:[\\/]*)
@@ -8890,11 +8032,11 @@ fi
 
 MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
 if test -n "$MAGIC_CMD"; then
-  { echo "$as_me:$LINENO: result: $MAGIC_CMD" >&5
-echo "${ECHO_T}$MAGIC_CMD" >&6; }
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5
+$as_echo "$MAGIC_CMD" >&6; }
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
 
@@ -8903,10 +8045,10 @@ fi
 
 if test -z "$lt_cv_path_MAGIC_CMD"; then
   if test -n "$ac_tool_prefix"; then
-    { echo "$as_me:$LINENO: checking for file" >&5
-echo $ECHO_N "checking for file... $ECHO_C" >&6; }
-if test "${lt_cv_path_MAGIC_CMD+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for file" >&5
+$as_echo_n "checking for file... " >&6; }
+if test "${lt_cv_path_MAGIC_CMD+set}" = set; then :
+  $as_echo_n "(cached) " >&6
 else
   case $MAGIC_CMD in
 [\\/*] |  ?:[\\/]*)
@@ -8956,11 +8098,11 @@ fi
 
 MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
 if test -n "$MAGIC_CMD"; then
-  { echo "$as_me:$LINENO: result: $MAGIC_CMD" >&5
-echo "${ECHO_T}$MAGIC_CMD" >&6; }
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5
+$as_echo "$MAGIC_CMD" >&6; }
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
 
@@ -9036,10 +8178,10 @@ lt_prog_compiler_no_builtin_flag=
 if test "$GCC" = yes; then
   lt_prog_compiler_no_builtin_flag=' -fno-builtin'
 
-  { echo "$as_me:$LINENO: checking if $compiler supports -fno-rtti -fno-exceptions" >&5
-echo $ECHO_N "checking if $compiler supports -fno-rtti -fno-exceptions... $ECHO_C" >&6; }
-if test "${lt_cv_prog_compiler_rtti_exceptions+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -fno-rtti -fno-exceptions" >&5
+$as_echo_n "checking if $compiler supports -fno-rtti -fno-exceptions... " >&6; }
+if test "${lt_cv_prog_compiler_rtti_exceptions+set}" = set; then :
+  $as_echo_n "(cached) " >&6
 else
   lt_cv_prog_compiler_rtti_exceptions=no
    ac_outfile=conftest.$ac_objext
@@ -9054,11 +8196,11 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:9057: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:8199: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:9061: \$? = $ac_status" >&5
+   echo "$as_me:8203: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings other than the usual output.
@@ -9071,8 +8213,8 @@ else
    $RM conftest*
 
 fi
-{ echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_rtti_exceptions" >&5
-echo "${ECHO_T}$lt_cv_prog_compiler_rtti_exceptions" >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_rtti_exceptions" >&5
+$as_echo "$lt_cv_prog_compiler_rtti_exceptions" >&6; }
 
 if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then
     lt_prog_compiler_no_builtin_flag="$lt_prog_compiler_no_builtin_flag -fno-rtti -fno-exceptions"
@@ -9091,8 +8233,8 @@ fi
 lt_prog_compiler_pic=
 lt_prog_compiler_static=
 
-{ echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5
-echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5
+$as_echo_n "checking for $compiler option to produce PIC... " >&6; }
 
   if test "$GCC" = yes; then
     lt_prog_compiler_wl='-Wl,'
@@ -9126,7 +8268,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6; }
       # PIC is the default for these OSes.
       ;;
 
-    mingw* | cygwin* | pw32* | os2*)
+    mingw* | cygwin* | pw32* | os2* | cegcc*)
       # This hack is so that the source file can tell whether it is being
       # built for inclusion in a dll (and should export symbols for example).
       # Although the cygwin gcc ignores -fPIC, still need this for old-style
@@ -9141,10 +8283,11 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6; }
       ;;
 
     hpux*)
-      # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
-      # not for PA HP-UX.
+      # PIC is the default for 64-bit PA HP-UX, but not for 32-bit
+      # PA HP-UX.  On IA64 HP-UX, PIC is the default but the pic flag
+      # sets the default TLS model and affects inlining.
       case $host_cpu in
-      hppa*64*|ia64*)
+      hppa*64*)
        # +Z the default
        ;;
       *)
@@ -9194,7 +8337,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6; }
       fi
       ;;
 
-    mingw* | cygwin* | pw32* | os2*)
+    mingw* | cygwin* | pw32* | os2* | cegcc*)
       # This hack is so that the source file can tell whether it is being
       # built for inclusion in a dll (and should export symbols for example).
       lt_prog_compiler_pic='-DDLL_EXPORT'
@@ -9222,13 +8365,27 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6; }
       lt_prog_compiler_static='-non_shared'
       ;;
 
-    linux* | k*bsd*-gnu)
+    linux* | k*bsd*-gnu | kopensolaris*-gnu)
       case $cc_basename in
-      icc* | ecc* | ifort*)
+      # old Intel for x86_64 which still supported -KPIC.
+      ecc*)
        lt_prog_compiler_wl='-Wl,'
        lt_prog_compiler_pic='-KPIC'
        lt_prog_compiler_static='-static'
         ;;
+      # icc used to be incompatible with GCC.
+      # ICC 10 doesn't accept -KPIC any more.
+      icc* | ifort*)
+       lt_prog_compiler_wl='-Wl,'
+       lt_prog_compiler_pic='-fPIC'
+       lt_prog_compiler_static='-static'
+        ;;
+      # Lahey Fortran 8.1.
+      lf95*)
+       lt_prog_compiler_wl='-Wl,'
+       lt_prog_compiler_pic='--shared'
+       lt_prog_compiler_static='--static'
+       ;;
       pgcc* | pgf77* | pgf90* | pgf95*)
         # Portland Group compilers (*not* the Pentium gcc compiler,
        # which looks to be a dead project)
@@ -9348,8 +8505,8 @@ case $host_os in
     lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC"
     ;;
 esac
-{ echo "$as_me:$LINENO: result: $lt_prog_compiler_pic" >&5
-echo "${ECHO_T}$lt_prog_compiler_pic" >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_prog_compiler_pic" >&5
+$as_echo "$lt_prog_compiler_pic" >&6; }
 
 
 
@@ -9360,10 +8517,10 @@ echo "${ECHO_T}$lt_prog_compiler_pic" >&6; }
 # Check to make sure the PIC flag actually works.
 #
 if test -n "$lt_prog_compiler_pic"; then
-  { echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5
-echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic works... $ECHO_C" >&6; }
-if test "${lt_cv_prog_compiler_pic_works+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5
+$as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic works... " >&6; }
+if test "${lt_cv_prog_compiler_pic_works+set}" = set; then :
+  $as_echo_n "(cached) " >&6
 else
   lt_cv_prog_compiler_pic_works=no
    ac_outfile=conftest.$ac_objext
@@ -9378,11 +8535,11 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:9381: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:8538: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:9385: \$? = $ac_status" >&5
+   echo "$as_me:8542: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings other than the usual output.
@@ -9395,8 +8552,8 @@ else
    $RM conftest*
 
 fi
-{ echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_pic_works" >&5
-echo "${ECHO_T}$lt_cv_prog_compiler_pic_works" >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works" >&5
+$as_echo "$lt_cv_prog_compiler_pic_works" >&6; }
 
 if test x"$lt_cv_prog_compiler_pic_works" = xyes; then
     case $lt_prog_compiler_pic in
@@ -9419,10 +8576,10 @@ fi
 # Check to make sure the static flag actually works.
 #
 wl=$lt_prog_compiler_wl eval lt_tmp_static_flag=\"$lt_prog_compiler_static\"
-{ echo "$as_me:$LINENO: checking if $compiler static flag $lt_tmp_static_flag works" >&5
-echo $ECHO_N "checking if $compiler static flag $lt_tmp_static_flag works... $ECHO_C" >&6; }
-if test "${lt_cv_prog_compiler_static_works+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5
+$as_echo_n "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; }
+if test "${lt_cv_prog_compiler_static_works+set}" = set; then :
+  $as_echo_n "(cached) " >&6
 else
   lt_cv_prog_compiler_static_works=no
    save_LDFLAGS="$LDFLAGS"
@@ -9447,8 +8604,8 @@ else
    LDFLAGS="$save_LDFLAGS"
 
 fi
-{ echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_static_works" >&5
-echo "${ECHO_T}$lt_cv_prog_compiler_static_works" >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works" >&5
+$as_echo "$lt_cv_prog_compiler_static_works" >&6; }
 
 if test x"$lt_cv_prog_compiler_static_works" = xyes; then
     :
@@ -9462,10 +8619,10 @@ fi
 
 
 
-  { echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5
-echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6; }
-if test "${lt_cv_prog_compiler_c_o+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5
+$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; }
+if test "${lt_cv_prog_compiler_c_o+set}" = set; then :
+  $as_echo_n "(cached) " >&6
 else
   lt_cv_prog_compiler_c_o=no
    $RM -r conftest 2>/dev/null
@@ -9483,11 +8640,11 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:9486: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:8643: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:9490: \$? = $ac_status" >&5
+   echo "$as_me:8647: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
    then
      # The compiler can only warn and ignore the option if not recognized
@@ -9509,18 +8666,18 @@ else
    $RM conftest*
 
 fi
-{ echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o" >&5
-echo "${ECHO_T}$lt_cv_prog_compiler_c_o" >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5
+$as_echo "$lt_cv_prog_compiler_c_o" >&6; }
 
 
 
 
 
 
-  { echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5
-echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6; }
-if test "${lt_cv_prog_compiler_c_o+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5
+$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; }
+if test "${lt_cv_prog_compiler_c_o+set}" = set; then :
+  $as_echo_n "(cached) " >&6
 else
   lt_cv_prog_compiler_c_o=no
    $RM -r conftest 2>/dev/null
@@ -9538,11 +8695,11 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:9541: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:8698: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:9545: \$? = $ac_status" >&5
+   echo "$as_me:8702: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
    then
      # The compiler can only warn and ignore the option if not recognized
@@ -9564,8 +8721,8 @@ else
    $RM conftest*
 
 fi
-{ echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o" >&5
-echo "${ECHO_T}$lt_cv_prog_compiler_c_o" >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5
+$as_echo "$lt_cv_prog_compiler_c_o" >&6; }
 
 
 
@@ -9573,19 +8730,19 @@ echo "${ECHO_T}$lt_cv_prog_compiler_c_o" >&6; }
 hard_links="nottested"
 if test "$lt_cv_prog_compiler_c_o" = no && test "$need_locks" != no; then
   # do not overwrite the value of need_locks provided by the user
-  { echo "$as_me:$LINENO: checking if we can lock with hard links" >&5
-echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6; }
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5
+$as_echo_n "checking if we can lock with hard links... " >&6; }
   hard_links=yes
   $RM conftest*
   ln conftest.a conftest.b 2>/dev/null && hard_links=no
   touch conftest.a
   ln conftest.a conftest.b 2>&5 || hard_links=no
   ln conftest.a conftest.b 2>/dev/null && hard_links=no
-  { echo "$as_me:$LINENO: result: $hard_links" >&5
-echo "${ECHO_T}$hard_links" >&6; }
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5
+$as_echo "$hard_links" >&6; }
   if test "$hard_links" = no; then
-    { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5
-echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;}
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5
+$as_echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;}
     need_locks=warn
   fi
 else
@@ -9597,8 +8754,8 @@ fi
 
 
 
-  { echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5
-echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6; }
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5
+$as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; }
 
   runpath_var=
   allow_undefined_flag=
@@ -9642,7 +8799,7 @@ echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared librar
   extract_expsyms_cmds=
 
   case $host_os in
-  cygwin* | mingw* | pw32*)
+  cygwin* | mingw* | pw32* | cegcc*)
     # FIXME: the MSVC++ port hasn't been tested in a loooong time
     # When not using gcc, we currently assume that we are using
     # Microsoft Visual C++.
@@ -9657,6 +8814,9 @@ echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared librar
   openbsd*)
     with_gnu_ld=no
     ;;
+  linux* | k*bsd*-gnu)
+    link_all_deplibs=no
+    ;;
   esac
 
   ld_shlibs=yes
@@ -9678,6 +8838,7 @@ echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared librar
     fi
     supports_anon_versioning=no
     case `$LD -v 2>&1` in
+      *GNU\ gold*) supports_anon_versioning=yes ;;
       *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11
       *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ...
       *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ...
@@ -9729,7 +8890,7 @@ _LT_EOF
       fi
       ;;
 
-    cygwin* | mingw* | pw32*)
+    cygwin* | mingw* | pw32* | cegcc*)
       # _LT_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless,
       # as there is no search path for DLLs.
       hardcode_libdir_flag_spec='-L$libdir'
@@ -9769,7 +8930,7 @@ _LT_EOF
       archive_expsym_cmds='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
       ;;
 
-    gnu* | linux* | tpf* | k*bsd*-gnu)
+    gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu)
       tmp_diet=no
       if test "$host_os" = linux-dietlibc; then
        case $cc_basename in
@@ -9795,6 +8956,9 @@ _LT_EOF
          tmp_addflag=' -i_dynamic -nofor_main' ;;
        ifc* | ifort*)                  # Intel Fortran compiler
          tmp_addflag=' -nofor_main' ;;
+       lf95*)                          # Lahey Fortran 8.1
+         whole_archive_flag_spec=
+         tmp_sharedflag='--shared' ;;
        xl[cC]*)                        # IBM XL C 8.0 on PPC (deal with xlf below)
          tmp_sharedflag='-qmkshrobj'
          tmp_addflag= ;;
@@ -9836,7 +9000,7 @@ _LT_EOF
       fi
       ;;
 
-    netbsd*)
+    netbsd* | netbsdelf*-gnu)
       if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
        archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
        wlarc=
@@ -10011,6 +9175,7 @@ _LT_EOF
        if test "$aix_use_runtimelinking" = yes; then
          shared_flag="$shared_flag "'${wl}-G'
        fi
+       link_all_deplibs=no
       else
        # not using gcc
        if test "$host_cpu" = ia64; then
@@ -10026,6 +9191,7 @@ _LT_EOF
        fi
       fi
 
+      export_dynamic_flag_spec='${wl}-bexpall'
       # It seems that -bexpall does not export symbols beginning with
       # underscore (_), so it is better to generate a list of symbols to export.
       always_export_symbols=yes
@@ -10035,11 +9201,7 @@ _LT_EOF
        allow_undefined_flag='-berok'
         # Determine the default libpath from the value encoded in an
         # empty executable.
-        cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+        cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 int
@@ -10050,24 +9212,7 @@ main ()
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+if ac_fn_c_try_link "$LINENO"; then :
 
 lt_aix_libpath_sed='
     /Import File Strings/,/^$/ {
@@ -10081,15 +9226,9 @@ aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpat
 if test -z "$aix_libpath"; then
   aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
 fi
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
 fi
-
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
 if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
 
         hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
@@ -10102,11 +9241,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
        else
         # Determine the default libpath from the value encoded in an
         # empty executable.
-        cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+        cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 int
@@ -10117,24 +9252,7 @@ main ()
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+if ac_fn_c_try_link "$LINENO"; then :
 
 lt_aix_libpath_sed='
     /Import File Strings/,/^$/ {
@@ -10148,15 +9266,9 @@ aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpat
 if test -z "$aix_libpath"; then
   aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
 fi
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
 fi
-
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
 if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
 
         hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
@@ -10192,7 +9304,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
       export_dynamic_flag_spec=-rdynamic
       ;;
 
-    cygwin* | mingw* | pw32*)
+    cygwin* | mingw* | pw32* | cegcc*)
       # When not using gcc, we currently assume that we are using
       # Microsoft Visual C++.
       # hardcode_libdir_flag_spec is actually meaningless, as there is
@@ -10223,7 +9335,11 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
   whole_archive_flag_spec=''
   link_all_deplibs=yes
   allow_undefined_flag="$_lt_dar_allow_undefined"
-  if test "$GCC" = "yes"; then
+  case $cc_basename in
+     ifort*) _lt_dar_can_shared=yes ;;
+     *) _lt_dar_can_shared=$GCC ;;
+  esac
+  if test "$_lt_dar_can_shared" = "yes"; then
     output_verbose_link_cmd=echo
     archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
     module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
@@ -10315,7 +9431,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
          archive_cmds='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
          ;;
        ia64*)
-         archive_cmds='$CC -shared ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+         archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
          ;;
        *)
          archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
@@ -10364,38 +9480,16 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
        # implicitly export all symbols.
         save_LDFLAGS="$LDFLAGS"
         LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null"
-        cat >conftest.$ac_ext <<_ACEOF
+        cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
 int foo(void) {}
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+if ac_fn_c_try_link "$LINENO"; then :
   archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib'
 
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
 fi
-
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
         LDFLAGS="$save_LDFLAGS"
       else
        archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'
@@ -10408,7 +9502,7 @@ rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       link_all_deplibs=yes
       ;;
 
-    netbsd*)
+    netbsd* | netbsdelf*-gnu)
       if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
        archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'  # a.out
       else
@@ -10651,8 +9745,8 @@ rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
     fi
   fi
 
-{ echo "$as_me:$LINENO: result: $ld_shlibs" >&5
-echo "${ECHO_T}$ld_shlibs" >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs" >&5
+$as_echo "$ld_shlibs" >&6; }
 test "$ld_shlibs" = no && can_build_shared=no
 
 with_gnu_ld=$with_gnu_ld
@@ -10688,16 +9782,16 @@ x|xyes)
       # Test whether the compiler implicitly links with -lc since on some
       # systems, -lgcc has to come before -lc. If gcc already passes -lc
       # to ld, don't add -lc before -lgcc.
-      { echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5
-echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6; }
+      { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5
+$as_echo_n "checking whether -lc should be explicitly linked in... " >&6; }
       $RM conftest*
       echo "$lt_simple_compile_test_code" > conftest.$ac_ext
 
-      if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+      if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } 2>conftest.err; then
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } 2>conftest.err; then
         soname=conftest
         lib=conftest
         libobjs=conftest.$ac_objext
@@ -10711,11 +9805,11 @@ echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&
         libname=conftest
         lt_save_allow_undefined_flag=$allow_undefined_flag
         allow_undefined_flag=
-        if { (eval echo "$as_me:$LINENO: \"$archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\"") >&5
+        if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5
   (eval $archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5
   ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }
         then
          archive_cmds_need_lc=no
         else
@@ -10726,8 +9820,8 @@ echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&
         cat conftest.err 1>&5
       fi
       $RM conftest*
-      { echo "$as_me:$LINENO: result: $archive_cmds_need_lc" >&5
-echo "${ECHO_T}$archive_cmds_need_lc" >&6; }
+      { $as_echo "$as_me:${as_lineno-$LINENO}: result: $archive_cmds_need_lc" >&5
+$as_echo "$archive_cmds_need_lc" >&6; }
       ;;
     esac
   fi
@@ -10890,8 +9984,8 @@ esac
 
 
 
-  { echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5
-echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6; }
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5
+$as_echo_n "checking dynamic linker characteristics... " >&6; }
 
 if test "$GCC" = yes; then
   case $host_os in
@@ -11053,14 +10147,14 @@ bsdi[45]*)
   # libtool to hard-code these into programs
   ;;
 
-cygwin* | mingw* | pw32*)
+cygwin* | mingw* | pw32* | cegcc*)
   version_type=windows
   shrext_cmds=".dll"
   need_version=no
   need_lib_prefix=no
 
   case $GCC,$host_os in
-  yes,cygwin* | yes,mingw* | yes,pw32*)
+  yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
     library_names_spec='$libname.dll.a'
     # DLL is installed to $(libdir)/../bin by postinstall_cmds
     postinstall_cmds='base_file=`basename \${file}`~
@@ -11083,7 +10177,7 @@ cygwin* | mingw* | pw32*)
       soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
       sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib"
       ;;
-    mingw*)
+    mingw* | cegcc*)
       # MinGW DLLs use traditional 'lib' prefix
       soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
       sys_lib_search_path_spec=`$CC -print-search-dirs | $GREP "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"`
@@ -11298,7 +10392,7 @@ linux*oldld* | linux*aout* | linux*coff*)
   ;;
 
 # This must be Linux ELF.
-linux* | k*bsd*-gnu)
+linux* | k*bsd*-gnu | kopensolaris*-gnu)
   version_type=linux
   need_lib_prefix=no
   need_version=no
@@ -11312,11 +10406,7 @@ linux* | k*bsd*-gnu)
   save_libdir=$libdir
   eval "libdir=/foo; wl=\"$lt_prog_compiler_wl\"; \
        LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec\""
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 int
@@ -11327,37 +10417,13 @@ main ()
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
-  if  ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null; then
+if ac_fn_c_try_link "$LINENO"; then :
+  if  ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null; then :
   shlibpath_overrides_runpath=yes
 fi
-
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
 fi
-
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
   LDFLAGS=$save_LDFLAGS
   libdir=$save_libdir
 
@@ -11381,6 +10447,18 @@ rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
   dynamic_linker='GNU/Linux ld.so'
   ;;
 
+netbsdelf*-gnu)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  dynamic_linker='NetBSD ld.elf_so'
+  ;;
+
 netbsd*)
   version_type=sunos
   need_lib_prefix=no
@@ -11552,7 +10630,7 @@ tpf*)
   version_type=linux
   need_lib_prefix=no
   need_version=no
-  library_name_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
   shlibpath_var=LD_LIBRARY_PATH
   shlibpath_overrides_runpath=no
   hardcode_into_libs=yes
@@ -11569,8 +10647,8 @@ uts4*)
   dynamic_linker=no
   ;;
 esac
-{ echo "$as_me:$LINENO: result: $dynamic_linker" >&5
-echo "${ECHO_T}$dynamic_linker" >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5
+$as_echo "$dynamic_linker" >&6; }
 test "$dynamic_linker" = no && can_build_shared=no
 
 variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
@@ -11671,8 +10749,8 @@ fi
 
 
 
-  { echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5
-echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6; }
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5
+$as_echo_n "checking how to hardcode library paths into programs... " >&6; }
 hardcode_action=
 if test -n "$hardcode_libdir_flag_spec" ||
    test -n "$runpath_var" ||
@@ -11696,8 +10774,8 @@ else
   # directories.
   hardcode_action=unsupported
 fi
-{ echo "$as_me:$LINENO: result: $hardcode_action" >&5
-echo "${ECHO_T}$hardcode_action" >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $hardcode_action" >&5
+$as_echo "$hardcode_action" >&6; }
 
 if test "$hardcode_action" = relink ||
    test "$inherit_rpath" = yes; then
@@ -11729,7 +10807,7 @@ else
     lt_cv_dlopen_self=yes
     ;;
 
-  mingw* | pw32*)
+  mingw* | pw32* | cegcc*)
     lt_cv_dlopen="LoadLibrary"
     lt_cv_dlopen_libs=
     ;;
@@ -11741,18 +10819,14 @@ else
 
   darwin*)
   # if libdl is installed we need to link against it
-    { echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5
-echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6; }
-if test "${ac_cv_lib_dl_dlopen+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5
+$as_echo_n "checking for dlopen in -ldl... " >&6; }
+if test "${ac_cv_lib_dl_dlopen+set}" = set; then :
+  $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-ldl  $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 /* Override any GCC internal prototype to avoid an error.
@@ -11770,39 +10844,18 @@ return dlopen ();
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+if ac_fn_c_try_link "$LINENO"; then :
   ac_cv_lib_dl_dlopen=yes
 else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_cv_lib_dl_dlopen=no
+  ac_cv_lib_dl_dlopen=no
 fi
-
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5
-echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6; }
-if test $ac_cv_lib_dl_dlopen = yes; then
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5
+$as_echo "$ac_cv_lib_dl_dlopen" >&6; }
+if test "x$ac_cv_lib_dl_dlopen" = x""yes; then :
   lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"
 else
 
     ;;
 
   *)
-    { echo "$as_me:$LINENO: checking for shl_load" >&5
-echo $ECHO_N "checking for shl_load... $ECHO_C" >&6; }
-if test "${ac_cv_func_shl_load+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-/* Define shl_load to an innocuous variant, in case <limits.h> declares shl_load.
-   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
-#define shl_load innocuous_shl_load
-
-/* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char shl_load (); below.
-    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
-    <limits.h> exists even on freestanding compilers.  */
-
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-
-#undef shl_load
-
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char shl_load ();
-/* The GNU C library defines this for functions which it implements
-    to always fail with ENOSYS.  Some functions are actually named
-    something starting with __ and the normal name is an alias.  */
-#if defined __stub_shl_load || defined __stub___shl_load
-choke me
-#endif
-
-int
-main ()
-{
-return shl_load ();
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
-  ac_cv_func_shl_load=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_cv_func_shl_load=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_func_shl_load" >&5
-echo "${ECHO_T}$ac_cv_func_shl_load" >&6; }
-if test $ac_cv_func_shl_load = yes; then
+    ac_fn_c_check_func "$LINENO" "shl_load" "ac_cv_func_shl_load"
+if test "x$ac_cv_func_shl_load" = x""yes; then :
   lt_cv_dlopen="shl_load"
 else
-  { echo "$as_me:$LINENO: checking for shl_load in -ldld" >&5
-echo $ECHO_N "checking for shl_load in -ldld... $ECHO_C" >&6; }
-if test "${ac_cv_lib_dld_shl_load+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shl_load in -ldld" >&5
+$as_echo_n "checking for shl_load in -ldld... " >&6; }
+if test "${ac_cv_lib_dld_shl_load+set}" = set; then :
+  $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-ldld  $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 /* Override any GCC internal prototype to avoid an error.
@@ -11928,137 +10897,32 @@ return shl_load ();
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+if ac_fn_c_try_link "$LINENO"; then :
   ac_cv_lib_dld_shl_load=yes
 else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_cv_lib_dld_shl_load=no
+  ac_cv_lib_dld_shl_load=no
 fi
-
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_lib_dld_shl_load" >&5
-echo "${ECHO_T}$ac_cv_lib_dld_shl_load" >&6; }
-if test $ac_cv_lib_dld_shl_load = yes; then
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_shl_load" >&5
+$as_echo "$ac_cv_lib_dld_shl_load" >&6; }
+if test "x$ac_cv_lib_dld_shl_load" = x""yes; then :
   lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld"
 else
-  { echo "$as_me:$LINENO: checking for dlopen" >&5
-echo $ECHO_N "checking for dlopen... $ECHO_C" >&6; }
-if test "${ac_cv_func_dlopen+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-/* Define dlopen to an innocuous variant, in case <limits.h> declares dlopen.
-   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
-#define dlopen innocuous_dlopen
-
-/* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char dlopen (); below.
-    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
-    <limits.h> exists even on freestanding compilers.  */
-
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-
-#undef dlopen
-
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char dlopen ();
-/* The GNU C library defines this for functions which it implements
-    to always fail with ENOSYS.  Some functions are actually named
-    something starting with __ and the normal name is an alias.  */
-#if defined __stub_dlopen || defined __stub___dlopen
-choke me
-#endif
-
-int
-main ()
-{
-return dlopen ();
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
-  ac_cv_func_dlopen=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_cv_func_dlopen=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_func_dlopen" >&5
-echo "${ECHO_T}$ac_cv_func_dlopen" >&6; }
-if test $ac_cv_func_dlopen = yes; then
+  ac_fn_c_check_func "$LINENO" "dlopen" "ac_cv_func_dlopen"
+if test "x$ac_cv_func_dlopen" = x""yes; then :
   lt_cv_dlopen="dlopen"
 else
-  { echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5
-echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6; }
-if test "${ac_cv_lib_dl_dlopen+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5
+$as_echo_n "checking for dlopen in -ldl... " >&6; }
+if test "${ac_cv_lib_dl_dlopen+set}" = set; then :
+  $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-ldl  $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 /* Override any GCC internal prototype to avoid an error.
@@ -12076,53 +10940,28 @@ return dlopen ();
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+if ac_fn_c_try_link "$LINENO"; then :
   ac_cv_lib_dl_dlopen=yes
 else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_cv_lib_dl_dlopen=no
+  ac_cv_lib_dl_dlopen=no
 fi
-
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5
-echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6; }
-if test $ac_cv_lib_dl_dlopen = yes; then
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5
+$as_echo "$ac_cv_lib_dl_dlopen" >&6; }
+if test "x$ac_cv_lib_dl_dlopen" = x""yes; then :
   lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"
 else
-  { echo "$as_me:$LINENO: checking for dlopen in -lsvld" >&5
-echo $ECHO_N "checking for dlopen in -lsvld... $ECHO_C" >&6; }
-if test "${ac_cv_lib_svld_dlopen+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -lsvld" >&5
+$as_echo_n "checking for dlopen in -lsvld... " >&6; }
+if test "${ac_cv_lib_svld_dlopen+set}" = set; then :
+  $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-lsvld  $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 /* Override any GCC internal prototype to avoid an error.
@@ -12140,53 +10979,28 @@ return dlopen ();
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+if ac_fn_c_try_link "$LINENO"; then :
   ac_cv_lib_svld_dlopen=yes
 else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_cv_lib_svld_dlopen=no
+  ac_cv_lib_svld_dlopen=no
 fi
-
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_lib_svld_dlopen" >&5
-echo "${ECHO_T}$ac_cv_lib_svld_dlopen" >&6; }
-if test $ac_cv_lib_svld_dlopen = yes; then
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_svld_dlopen" >&5
+$as_echo "$ac_cv_lib_svld_dlopen" >&6; }
+if test "x$ac_cv_lib_svld_dlopen" = x""yes; then :
   lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"
 else
-  { echo "$as_me:$LINENO: checking for dld_link in -ldld" >&5
-echo $ECHO_N "checking for dld_link in -ldld... $ECHO_C" >&6; }
-if test "${ac_cv_lib_dld_dld_link+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dld_link in -ldld" >&5
+$as_echo_n "checking for dld_link in -ldld... " >&6; }
+if test "${ac_cv_lib_dld_dld_link+set}" = set; then :
+  $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-ldld  $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 /* Override any GCC internal prototype to avoid an error.
@@ -12204,39 +11018,18 @@ return dld_link ();
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+if ac_fn_c_try_link "$LINENO"; then :
   ac_cv_lib_dld_dld_link=yes
 else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_cv_lib_dld_dld_link=no
+  ac_cv_lib_dld_dld_link=no
 fi
-
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_lib_dld_dld_link" >&5
-echo "${ECHO_T}$ac_cv_lib_dld_dld_link" >&6; }
-if test $ac_cv_lib_dld_dld_link = yes; then
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_dld_link" >&5
+$as_echo "$ac_cv_lib_dld_dld_link" >&6; }
+if test "x$ac_cv_lib_dld_dld_link" = x""yes; then :
   lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld"
 fi
 
     save_LIBS="$LIBS"
     LIBS="$lt_cv_dlopen_libs $LIBS"
 
-    { echo "$as_me:$LINENO: checking whether a program can dlopen itself" >&5
-echo $ECHO_N "checking whether a program can dlopen itself... $ECHO_C" >&6; }
-if test "${lt_cv_dlopen_self+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a program can dlopen itself" >&5
+$as_echo_n "checking whether a program can dlopen itself... " >&6; }
+if test "${lt_cv_dlopen_self+set}" = set; then :
+  $as_echo_n "(cached) " >&6
 else
          if test "$cross_compiling" = yes; then :
   lt_cv_dlopen_self=cross
@@ -12286,7 +11079,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 12289 "configure"
+#line 11082 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -12327,10 +11120,6 @@ else
 #  endif
 #endif
 
-#ifdef __cplusplus
-extern "C" void exit (int);
-#endif
-
 void fnord() { int i=42;}
 int main ()
 {
@@ -12346,14 +11135,14 @@ int main ()
   else
     puts (dlerror ());
 
-    exit (status);
+  return status;
 }
 _LT_EOF
-  if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && test -s conftest${ac_exeext} 2>/dev/null; then
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } && test -s conftest${ac_exeext} 2>/dev/null; then
     (./conftest; exit; ) >&5 2>/dev/null
     lt_status=$?
     case x$lt_status in
@@ -12370,15 +11159,15 @@ rm -fr conftest*
 
 
 fi
-{ echo "$as_me:$LINENO: result: $lt_cv_dlopen_self" >&5
-echo "${ECHO_T}$lt_cv_dlopen_self" >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self" >&5
+$as_echo "$lt_cv_dlopen_self" >&6; }
 
     if test "x$lt_cv_dlopen_self" = xyes; then
       wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\"
-      { echo "$as_me:$LINENO: checking whether a statically linked program can dlopen itself" >&5
-echo $ECHO_N "checking whether a statically linked program can dlopen itself... $ECHO_C" >&6; }
-if test "${lt_cv_dlopen_self_static+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+      { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a statically linked program can dlopen itself" >&5
+$as_echo_n "checking whether a statically linked program can dlopen itself... " >&6; }
+if test "${lt_cv_dlopen_self_static+set}" = set; then :
+  $as_echo_n "(cached) " >&6
 else
          if test "$cross_compiling" = yes; then :
   lt_cv_dlopen_self_static=cross
@@ -12386,7 +11175,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 12389 "configure"
+#line 11178 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -12427,10 +11216,6 @@ else
 #  endif
 #endif
 
-#ifdef __cplusplus
-extern "C" void exit (int);
-#endif
-
 void fnord() { int i=42;}
 int main ()
 {
@@ -12446,14 +11231,14 @@ int main ()
   else
     puts (dlerror ());
 
-    exit (status);
+  return status;
 }
 _LT_EOF
-  if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && test -s conftest${ac_exeext} 2>/dev/null; then
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } && test -s conftest${ac_exeext} 2>/dev/null; then
     (./conftest; exit; ) >&5 2>/dev/null
     lt_status=$?
     case x$lt_status in
@@ -12470,8 +11255,8 @@ rm -fr conftest*
 
 
 fi
-{ echo "$as_me:$LINENO: result: $lt_cv_dlopen_self_static" >&5
-echo "${ECHO_T}$lt_cv_dlopen_self_static" >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self_static" >&5
+$as_echo "$lt_cv_dlopen_self_static" >&6; }
     fi
 
     CPPFLAGS="$save_CPPFLAGS"
 
 striplib=
 old_striplib=
-{ echo "$as_me:$LINENO: checking whether stripping libraries is possible" >&5
-echo $ECHO_N "checking whether stripping libraries is possible... $ECHO_C" >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stripping libraries is possible" >&5
+$as_echo_n "checking whether stripping libraries is possible... " >&6; }
 if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then
   test -z "$old_striplib" && old_striplib="$STRIP --strip-debug"
   test -z "$striplib" && striplib="$STRIP --strip-unneeded"
-  { echo "$as_me:$LINENO: result: yes" >&5
-echo "${ECHO_T}yes" >&6; }
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
 else
 # FIXME - insert some real tests, host_os isn't really good enough
   case $host_os in
@@ -12523,16 +11308,16 @@ else
     if test -n "$STRIP" ; then
       striplib="$STRIP -x"
       old_striplib="$STRIP -S"
-      { echo "$as_me:$LINENO: result: yes" >&5
-echo "${ECHO_T}yes" >&6; }
+      { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
     else
-      { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+      { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
     fi
     ;;
   *)
-    { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
     ;;
   esac
 fi
 
 
   # Report which library types will actually be built
-  { echo "$as_me:$LINENO: checking if libtool supports shared libraries" >&5
-echo $ECHO_N "checking if libtool supports shared libraries... $ECHO_C" >&6; }
-  { echo "$as_me:$LINENO: result: $can_build_shared" >&5
-echo "${ECHO_T}$can_build_shared" >&6; }
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking if libtool supports shared libraries" >&5
+$as_echo_n "checking if libtool supports shared libraries... " >&6; }
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $can_build_shared" >&5
+$as_echo "$can_build_shared" >&6; }
 
-  { echo "$as_me:$LINENO: checking whether to build shared libraries" >&5
-echo $ECHO_N "checking whether to build shared libraries... $ECHO_C" >&6; }
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build shared libraries" >&5
+$as_echo_n "checking whether to build shared libraries... " >&6; }
   test "$can_build_shared" = "no" && enable_shared=no
 
   # On AIX, shared libraries and static libraries use the same namespace, and
@@ -12575,15 +11360,15 @@ echo $ECHO_N "checking whether to build shared libraries... $ECHO_C" >&6; }
     fi
     ;;
   esac
-  { echo "$as_me:$LINENO: result: $enable_shared" >&5
-echo "${ECHO_T}$enable_shared" >&6; }
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_shared" >&5
+$as_echo "$enable_shared" >&6; }
 
-  { echo "$as_me:$LINENO: checking whether to build static libraries" >&5
-echo $ECHO_N "checking whether to build static libraries... $ECHO_C" >&6; }
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build static libraries" >&5
+$as_echo_n "checking whether to build static libraries... " >&6; }
   # Make sure either enable_shared or enable_static is yes.
   test "$enable_shared" = yes || enable_static=yes
-  { echo "$as_me:$LINENO: result: $enable_static" >&5
-echo "${ECHO_T}$enable_static" >&6; }
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_static" >&5
+$as_echo "$enable_static" >&6; }
 
 
 
@@ -12618,415 +11403,748 @@ CC="$lt_save_CC"
 
 
 
+# Check whether --enable-sdk was given.
+if test "${enable_sdk+set}" = set; then :
+  enableval=$enable_sdk;
+        case "${enableval}" in
+         yes) IS_SDK=yes ;;
+         no)  IS_SDK=no ;;
+         *)   as_fn_error $? "bad value ${enableval} for --enable-sdk" "$LINENO" 5  ;;
+        esac
 
-
-# Check whether --with-xo was given.
-if test "${with_xo+set}" = set; then
-  withval=$with_xo; test "$withval" = yes || with_xo=no
 else
-  with_xo=yes
+  IS_SDK=no
 fi
 
+ if test "x$IS_SDK" = "xyes"; then
+  IS_SDK_TRUE=
+  IS_SDK_FALSE='#'
+else
+  IS_SDK_TRUE='#'
+  IS_SDK_FALSE=
+fi
 
-  if test "$with_xo" = yes; then
-    if test "x$MODEL" != "x" ; then
-
-cat >>confdefs.h <<_ACEOF
-#define PLATFORM_MODEL_NAME "$MODEL"
-_ACEOF
-
-    else
-      echo "model_name not specified"
-    fi
-
-    if test "x$WINSYS" = "xtinyx";  then
-
-cat >>confdefs.h <<\_ACEOF
-#define PLATFORM_WINSYS "X"
-_ACEOF
-
-    else
-
-cat >>confdefs.h <<\_ACEOF
-#define PLATFORM_WINSYS "DFB"
-_ACEOF
-
-    fi
-
-    if test "x$LCDTYPE" = "xWVGA" ; then
 
-cat >>confdefs.h <<\_ACEOF
-#define PLATFORM_LCDTYPE "WVGA"
-_ACEOF
+# Checks for libraries.
 
 
-cat >>confdefs.h <<\_ACEOF
-#define PLATFORM_LCD_WIDTH 800
-_ACEOF
 
 
-cat >>confdefs.h <<\_ACEOF
-#define PLATFORM_LCD_HEIGHT 480
-_ACEOF
 
-    elif test "x$LCDTYPE" = "xWQVGA" ; then
 
-cat >>confdefs.h <<\_ACEOF
-#define PLATFORM_LCDEYPE "WQVGA"
-_ACEOF
+if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
+       if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args.
+set dummy ${ac_tool_prefix}pkg-config; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_PKG_CONFIG+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $PKG_CONFIG in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
 
+  ;;
+esac
+fi
+PKG_CONFIG=$ac_cv_path_PKG_CONFIG
+if test -n "$PKG_CONFIG"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5
+$as_echo "$PKG_CONFIG" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
 
-cat >>confdefs.h <<\_ACEOF
-#define PLATFORM_LCD_WIDTH 400
-_ACEOF
 
+fi
+if test -z "$ac_cv_path_PKG_CONFIG"; then
+  ac_pt_PKG_CONFIG=$PKG_CONFIG
+  # Extract the first word of "pkg-config", so it can be a program name with args.
+set dummy pkg-config; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_ac_pt_PKG_CONFIG+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $ac_pt_PKG_CONFIG in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
 
-cat >>confdefs.h <<\_ACEOF
-#define PLATFORM_LCD_HEIGHT 240
-_ACEOF
+  ;;
+esac
+fi
+ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG
+if test -n "$ac_pt_PKG_CONFIG"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5
+$as_echo "$ac_pt_PKG_CONFIG" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
 
-    elif test "x$LCDTYPE" = "xSQVGA" ; then
+  if test "x$ac_pt_PKG_CONFIG" = x; then
+    PKG_CONFIG=""
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    PKG_CONFIG=$ac_pt_PKG_CONFIG
+  fi
+else
+  PKG_CONFIG="$ac_cv_path_PKG_CONFIG"
+fi
 
-cat >>confdefs.h <<\_ACEOF
-#define PLATFORM_LCDTYPE "SQVGA"
-_ACEOF
+fi
+if test -n "$PKG_CONFIG"; then
+       _pkg_min_version=0.9.0
+       { $as_echo "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5
+$as_echo_n "checking pkg-config is at least version $_pkg_min_version... " >&6; }
+       if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
+               { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+       else
+               { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+               PKG_CONFIG=""
+       fi
+fi
 
+pkg_failed=no
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for AVSYSTEM" >&5
+$as_echo_n "checking for AVSYSTEM... " >&6; }
+
+if test -n "$AVSYSTEM_CFLAGS"; then
+    pkg_cv_AVSYSTEM_CFLAGS="$AVSYSTEM_CFLAGS"
+ elif test -n "$PKG_CONFIG"; then
+    if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"avsysaudio\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "avsysaudio") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_AVSYSTEM_CFLAGS=`$PKG_CONFIG --cflags "avsysaudio" 2>/dev/null`
+else
+  pkg_failed=yes
+fi
+ else
+    pkg_failed=untried
+fi
+if test -n "$AVSYSTEM_LIBS"; then
+    pkg_cv_AVSYSTEM_LIBS="$AVSYSTEM_LIBS"
+ elif test -n "$PKG_CONFIG"; then
+    if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"avsysaudio\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "avsysaudio") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_AVSYSTEM_LIBS=`$PKG_CONFIG --libs "avsysaudio" 2>/dev/null`
+else
+  pkg_failed=yes
+fi
+ else
+    pkg_failed=untried
+fi
 
-cat >>confdefs.h <<\_ACEOF
-#define PLATFORM_LCD_WIDTH 320
-_ACEOF
 
 
-cat >>confdefs.h <<\_ACEOF
-#define PLATFORM_LCD_HEIGHT 320
-_ACEOF
+if test $pkg_failed = yes; then
+       { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 
-    elif test "x$LCDTYPE" = "xQVGA" ; then
+if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
+        _pkg_short_errors_supported=yes
+else
+        _pkg_short_errors_supported=no
+fi
+        if test $_pkg_short_errors_supported = yes; then
+               AVSYSTEM_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "avsysaudio" 2>&1`
+        else
+               AVSYSTEM_PKG_ERRORS=`$PKG_CONFIG --print-errors "avsysaudio" 2>&1`
+        fi
+       # Put the nasty error message in config.log where it belongs
+       echo "$AVSYSTEM_PKG_ERRORS" >&5
 
-cat >>confdefs.h <<\_ACEOF
-#define PLATFORM_LCDTYPE "QVGA"
-_ACEOF
+       as_fn_error $? "Package requirements (avsysaudio) were not met:
 
+$AVSYSTEM_PKG_ERRORS
 
-cat >>confdefs.h <<\_ACEOF
-#define PLATFORM_LCD_WIDTH 240
-_ACEOF
+Consider adjusting the PKG_CONFIG_PATH environment variable if you
+installed software in a non-standard prefix.
 
+Alternatively, you may set the environment variables AVSYSTEM_CFLAGS
+and AVSYSTEM_LIBS to avoid the need to call pkg-config.
+See the pkg-config man page for more details." "$LINENO" 5
+elif test $pkg_failed = untried; then
+       { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+       { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "The pkg-config script could not be found or is too old.  Make sure it
+is in your PATH or set the PKG_CONFIG environment variable to the full
+path to pkg-config.
 
-cat >>confdefs.h <<\_ACEOF
-#define PLATFORM_LCD_HEIGHT 320
-_ACEOF
+Alternatively, you may set the environment variables AVSYSTEM_CFLAGS
+and AVSYSTEM_LIBS to avoid the need to call pkg-config.
+See the pkg-config man page for more details.
 
-    else
-      echo "lcdtype not specified"
-    fi
+To get pkg-config, see <http://pkg-config.freedesktop.org/>.
+See \`config.log' for more details" "$LINENO" 5 ; }
+else
+       AVSYSTEM_CFLAGS=$pkg_cv_AVSYSTEM_CFLAGS
+       AVSYSTEM_LIBS=$pkg_cv_AVSYSTEM_LIBS
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
 
-    if test "x$EFFECT" = "xall" ; then
+fi
 
-cat >>confdefs.h <<\_ACEOF
-#define PLATFORM_EFFECT "all"
-_ACEOF
 
-    elif test "x$EFFECT" = "xwindow" ; then
 
-cat >>confdefs.h <<\_ACEOF
-#define PLATFORM_EFFECT "window"
-_ACEOF
 
-    elif test "x$EFFECT" = "xwidget" ; then
+pkg_failed=no
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for MMCOMMON" >&5
+$as_echo_n "checking for MMCOMMON... " >&6; }
+
+if test -n "$MMCOMMON_CFLAGS"; then
+    pkg_cv_MMCOMMON_CFLAGS="$MMCOMMON_CFLAGS"
+ elif test -n "$PKG_CONFIG"; then
+    if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"mm-common\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "mm-common") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_MMCOMMON_CFLAGS=`$PKG_CONFIG --cflags "mm-common" 2>/dev/null`
+else
+  pkg_failed=yes
+fi
+ else
+    pkg_failed=untried
+fi
+if test -n "$MMCOMMON_LIBS"; then
+    pkg_cv_MMCOMMON_LIBS="$MMCOMMON_LIBS"
+ elif test -n "$PKG_CONFIG"; then
+    if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"mm-common\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "mm-common") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_MMCOMMON_LIBS=`$PKG_CONFIG --libs "mm-common" 2>/dev/null`
+else
+  pkg_failed=yes
+fi
+ else
+    pkg_failed=untried
+fi
 
-cat >>confdefs.h <<\_ACEOF
-#define PLATFORM_EFFECT "widget"
-_ACEOF
 
-    else
 
-cat >>confdefs.h <<\_ACEOF
-#define PLATFORM_EFFECT "none"
-_ACEOF
+if test $pkg_failed = yes; then
+       { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 
-    fi
+if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
+        _pkg_short_errors_supported=yes
+else
+        _pkg_short_errors_supported=no
+fi
+        if test $_pkg_short_errors_supported = yes; then
+               MMCOMMON_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "mm-common" 2>&1`
+        else
+               MMCOMMON_PKG_ERRORS=`$PKG_CONFIG --print-errors "mm-common" 2>&1`
+        fi
+       # Put the nasty error message in config.log where it belongs
+       echo "$MMCOMMON_PKG_ERRORS" >&5
 
-    if test "x$MMC_ROOT_PATH" != "x";  then
+       as_fn_error $? "Package requirements (mm-common) were not met:
 
-cat >>confdefs.h <<_ACEOF
-#define PLATFORM_MMC_ROOT_PATH "$MMC_ROOT_PATH"
-_ACEOF
+$MMCOMMON_PKG_ERRORS
 
-    fi
+Consider adjusting the PKG_CONFIG_PATH environment variable if you
+installed software in a non-standard prefix.
 
+Alternatively, you may set the environment variables MMCOMMON_CFLAGS
+and MMCOMMON_LIBS to avoid the need to call pkg-config.
+See the pkg-config man page for more details." "$LINENO" 5
+elif test $pkg_failed = untried; then
+       { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+       { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "The pkg-config script could not be found or is too old.  Make sure it
+is in your PATH or set the PKG_CONFIG environment variable to the full
+path to pkg-config.
 
-cat >>confdefs.h <<\_ACEOF
-#define EXPORT_API __attribute__((visibility("default")))
-_ACEOF
+Alternatively, you may set the environment variables MMCOMMON_CFLAGS
+and MMCOMMON_LIBS to avoid the need to call pkg-config.
+See the pkg-config man page for more details.
+
+To get pkg-config, see <http://pkg-config.freedesktop.org/>.
+See \`config.log' for more details" "$LINENO" 5 ; }
+else
+       MMCOMMON_CFLAGS=$pkg_cv_MMCOMMON_CFLAGS
+       MMCOMMON_LIBS=$pkg_cv_MMCOMMON_LIBS
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
 
+fi
 
-  else
-   echo ""
-  fi
 
-  # Check whether --enable-platform-debug was given.
-if test "${enable_platform_debug+set}" = set; then
-  enableval=$enable_platform_debug;
+
+if test "x$IS_SDK" = "xyes";
+then
+echo "SDK build does not use mm-log"
+else
+
+pkg_failed=no
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for MMLOG" >&5
+$as_echo_n "checking for MMLOG... " >&6; }
+
+if test -n "$MMLOG_CFLAGS"; then
+    pkg_cv_MMLOG_CFLAGS="$MMLOG_CFLAGS"
+ elif test -n "$PKG_CONFIG"; then
+    if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"mm-log\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "mm-log") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_MMLOG_CFLAGS=`$PKG_CONFIG --cflags "mm-log" 2>/dev/null`
 else
-  enable_platform_debug=no
+  pkg_failed=yes
+fi
+ else
+    pkg_failed=untried
+fi
+if test -n "$MMLOG_LIBS"; then
+    pkg_cv_MMLOG_LIBS="$MMLOG_LIBS"
+ elif test -n "$PKG_CONFIG"; then
+    if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"mm-log\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "mm-log") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_MMLOG_LIBS=`$PKG_CONFIG --libs "mm-log" 2>/dev/null`
+else
+  pkg_failed=yes
+fi
+ else
+    pkg_failed=untried
 fi
 
 
-  if test x$enable_platform_debug = xyes; then
 
-cat >>confdefs.h <<\_ACEOF
-#define PLATFORM_DEBUG "yes"
-_ACEOF
+if test $pkg_failed = yes; then
+       { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
+        _pkg_short_errors_supported=yes
+else
+        _pkg_short_errors_supported=no
+fi
+        if test $_pkg_short_errors_supported = yes; then
+               MMLOG_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "mm-log" 2>&1`
+        else
+               MMLOG_PKG_ERRORS=`$PKG_CONFIG --print-errors "mm-log" 2>&1`
+        fi
+       # Put the nasty error message in config.log where it belongs
+       echo "$MMLOG_PKG_ERRORS" >&5
+
+       as_fn_error $? "Package requirements (mm-log) were not met:
+
+$MMLOG_PKG_ERRORS
+
+Consider adjusting the PKG_CONFIG_PATH environment variable if you
+installed software in a non-standard prefix.
+
+Alternatively, you may set the environment variables MMLOG_CFLAGS
+and MMLOG_LIBS to avoid the need to call pkg-config.
+See the pkg-config man page for more details." "$LINENO" 5
+elif test $pkg_failed = untried; then
+       { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+       { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "The pkg-config script could not be found or is too old.  Make sure it
+is in your PATH or set the PKG_CONFIG environment variable to the full
+path to pkg-config.
+
+Alternatively, you may set the environment variables MMLOG_CFLAGS
+and MMLOG_LIBS to avoid the need to call pkg-config.
+See the pkg-config man page for more details.
+
+To get pkg-config, see <http://pkg-config.freedesktop.org/>.
+See \`config.log' for more details" "$LINENO" 5 ; }
+else
+       MMLOG_CFLAGS=$pkg_cv_MMLOG_CFLAGS
+       MMLOG_LIBS=$pkg_cv_MMLOG_LIBS
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+fi
+
+
+fi
+
+
+pkg_failed=no
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for MMSESSION" >&5
+$as_echo_n "checking for MMSESSION... " >&6; }
+
+if test -n "$MMSESSION_CFLAGS"; then
+    pkg_cv_MMSESSION_CFLAGS="$MMSESSION_CFLAGS"
+ elif test -n "$PKG_CONFIG"; then
+    if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"mm-session\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "mm-session") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_MMSESSION_CFLAGS=`$PKG_CONFIG --cflags "mm-session" 2>/dev/null`
+else
+  pkg_failed=yes
+fi
+ else
+    pkg_failed=untried
+fi
+if test -n "$MMSESSION_LIBS"; then
+    pkg_cv_MMSESSION_LIBS="$MMSESSION_LIBS"
+ elif test -n "$PKG_CONFIG"; then
+    if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"mm-session\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "mm-session") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_MMSESSION_LIBS=`$PKG_CONFIG --libs "mm-session" 2>/dev/null`
+else
+  pkg_failed=yes
+fi
+ else
+    pkg_failed=untried
+fi
+
+
+
+if test $pkg_failed = yes; then
+       { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
+        _pkg_short_errors_supported=yes
+else
+        _pkg_short_errors_supported=no
+fi
+        if test $_pkg_short_errors_supported = yes; then
+               MMSESSION_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "mm-session" 2>&1`
+        else
+               MMSESSION_PKG_ERRORS=`$PKG_CONFIG --print-errors "mm-session" 2>&1`
+        fi
+       # Put the nasty error message in config.log where it belongs
+       echo "$MMSESSION_PKG_ERRORS" >&5
+
+       as_fn_error $? "Package requirements (mm-session) were not met:
+
+$MMSESSION_PKG_ERRORS
+
+Consider adjusting the PKG_CONFIG_PATH environment variable if you
+installed software in a non-standard prefix.
+
+Alternatively, you may set the environment variables MMSESSION_CFLAGS
+and MMSESSION_LIBS to avoid the need to call pkg-config.
+See the pkg-config man page for more details." "$LINENO" 5
+elif test $pkg_failed = untried; then
+       { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+       { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "The pkg-config script could not be found or is too old.  Make sure it
+is in your PATH or set the PKG_CONFIG environment variable to the full
+path to pkg-config.
+
+Alternatively, you may set the environment variables MMSESSION_CFLAGS
+and MMSESSION_LIBS to avoid the need to call pkg-config.
+See the pkg-config man page for more details.
+
+To get pkg-config, see <http://pkg-config.freedesktop.org/>.
+See \`config.log' for more details" "$LINENO" 5 ; }
+else
+       MMSESSION_CFLAGS=$pkg_cv_MMSESSION_CFLAGS
+       MMSESSION_LIBS=$pkg_cv_MMSESSION_LIBS
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+fi
+
+
+
+
+pkg_failed=no
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for AUDIOSESSIONMGR" >&5
+$as_echo_n "checking for AUDIOSESSIONMGR... " >&6; }
+
+if test -n "$AUDIOSESSIONMGR_CFLAGS"; then
+    pkg_cv_AUDIOSESSIONMGR_CFLAGS="$AUDIOSESSIONMGR_CFLAGS"
+ elif test -n "$PKG_CONFIG"; then
+    if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"audio-session-mgr\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "audio-session-mgr") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_AUDIOSESSIONMGR_CFLAGS=`$PKG_CONFIG --cflags "audio-session-mgr" 2>/dev/null`
+else
+  pkg_failed=yes
+fi
+ else
+    pkg_failed=untried
+fi
+if test -n "$AUDIOSESSIONMGR_LIBS"; then
+    pkg_cv_AUDIOSESSIONMGR_LIBS="$AUDIOSESSIONMGR_LIBS"
+ elif test -n "$PKG_CONFIG"; then
+    if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"audio-session-mgr\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "audio-session-mgr") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_AUDIOSESSIONMGR_LIBS=`$PKG_CONFIG --libs "audio-session-mgr" 2>/dev/null`
+else
+  pkg_failed=yes
+fi
+ else
+    pkg_failed=untried
+fi
 
-  else
 
-cat >>confdefs.h <<\_ACEOF
-#define PLATFORM_DEBUG "no"
-_ACEOF
 
-  fi
+if test $pkg_failed = yes; then
+       { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 
-  # Check whether --enable-platform-intercall was given.
-if test "${enable_platform_intercall+set}" = set; then
-  enableval=$enable_platform_intercall;
+if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
+        _pkg_short_errors_supported=yes
 else
-  enable_platform_intercall=yes
+        _pkg_short_errors_supported=no
 fi
+        if test $_pkg_short_errors_supported = yes; then
+               AUDIOSESSIONMGR_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "audio-session-mgr" 2>&1`
+        else
+               AUDIOSESSIONMGR_PKG_ERRORS=`$PKG_CONFIG --print-errors "audio-session-mgr" 2>&1`
+        fi
+       # Put the nasty error message in config.log where it belongs
+       echo "$AUDIOSESSIONMGR_PKG_ERRORS" >&5
 
+       as_fn_error $? "Package requirements (audio-session-mgr) were not met:
 
-  have_platform_intercall=no
-  if test x$enable_platform_intercall= xyes; then
+$AUDIOSESSIONMGR_PKG_ERRORS
 
-cat >>confdefs.h <<\_ACEOF
-#define PLATFORM_INTERCALL "yes"
-_ACEOF
+Consider adjusting the PKG_CONFIG_PATH environment variable if you
+installed software in a non-standard prefix.
 
-  else
+Alternatively, you may set the environment variables AUDIOSESSIONMGR_CFLAGS
+and AUDIOSESSIONMGR_LIBS to avoid the need to call pkg-config.
+See the pkg-config man page for more details." "$LINENO" 5
+elif test $pkg_failed = untried; then
+       { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+       { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "The pkg-config script could not be found or is too old.  Make sure it
+is in your PATH or set the PKG_CONFIG environment variable to the full
+path to pkg-config.
 
-cat >>confdefs.h <<\_ACEOF
-#define PLATFORM_INTERCALL "no"
-_ACEOF
+Alternatively, you may set the environment variables AUDIOSESSIONMGR_CFLAGS
+and AUDIOSESSIONMGR_LIBS to avoid the need to call pkg-config.
+See the pkg-config man page for more details.
 
-  fi
+To get pkg-config, see <http://pkg-config.freedesktop.org/>.
+See \`config.log' for more details" "$LINENO" 5 ; }
+else
+       AUDIOSESSIONMGR_CFLAGS=$pkg_cv_AUDIOSESSIONMGR_CFLAGS
+       AUDIOSESSIONMGR_LIBS=$pkg_cv_AUDIOSESSIONMGR_LIBS
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
 
+fi
 
 
 
-# Check whether --enable-aquila was given.
-if test "${enable_aquila+set}" = set; then
-  enableval=$enable_aquila;
-        case "${enableval}" in
-         yes) IS_AQUILA=yes ;;
-         no)  IS_AQUILA=no ;;
-         *)   { { echo "$as_me:$LINENO: error: bad value ${enableval} for --enable-aquila" >&5
-echo "$as_me: error: bad value ${enableval} for --enable-aquila" >&2;}
-   { (exit 1); exit 1; }; } ;;
-        esac
 
+pkg_failed=no
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for GLIB2" >&5
+$as_echo_n "checking for GLIB2... " >&6; }
+
+if test -n "$GLIB2_CFLAGS"; then
+    pkg_cv_GLIB2_CFLAGS="$GLIB2_CFLAGS"
+ elif test -n "$PKG_CONFIG"; then
+    if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"glib-2.0 gthread-2.0\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "glib-2.0 gthread-2.0") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_GLIB2_CFLAGS=`$PKG_CONFIG --cflags "glib-2.0 gthread-2.0" 2>/dev/null`
 else
-  IS_AQUILA=yes
+  pkg_failed=yes
 fi
-
- if test "x$IS_AQUILA" = "xyes"; then
-  IS_AQUILA_TRUE=
-  IS_AQUILA_FALSE='#'
+ else
+    pkg_failed=untried
+fi
+if test -n "$GLIB2_LIBS"; then
+    pkg_cv_GLIB2_LIBS="$GLIB2_LIBS"
+ elif test -n "$PKG_CONFIG"; then
+    if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"glib-2.0 gthread-2.0\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "glib-2.0 gthread-2.0") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_GLIB2_LIBS=`$PKG_CONFIG --libs "glib-2.0 gthread-2.0" 2>/dev/null`
 else
-  IS_AQUILA_TRUE='#'
-  IS_AQUILA_FALSE=
+  pkg_failed=yes
+fi
+ else
+    pkg_failed=untried
 fi
 
 
-# Check whether --enable-sdk was given.
-if test "${enable_sdk+set}" = set; then
-  enableval=$enable_sdk;
-        case "${enableval}" in
-         yes) IS_SDK=yes ;;
-         no)  IS_SDK=no ;;
-         *)   { { echo "$as_me:$LINENO: error: bad value ${enableval} for --enable-sdk" >&5
-echo "$as_me: error: bad value ${enableval} for --enable-sdk" >&2;}
-   { (exit 1); exit 1; }; } ;;
-        esac
 
-else
-  IS_SDK=no
-fi
+if test $pkg_failed = yes; then
+       { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 
- if test "x$IS_SDK" = "xyes"; then
-  IS_SDK_TRUE=
-  IS_SDK_FALSE='#'
+if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
+        _pkg_short_errors_supported=yes
 else
-  IS_SDK_TRUE='#'
-  IS_SDK_FALSE=
+        _pkg_short_errors_supported=no
 fi
+        if test $_pkg_short_errors_supported = yes; then
+               GLIB2_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "glib-2.0 gthread-2.0" 2>&1`
+        else
+               GLIB2_PKG_ERRORS=`$PKG_CONFIG --print-errors "glib-2.0 gthread-2.0" 2>&1`
+        fi
+       # Put the nasty error message in config.log where it belongs
+       echo "$GLIB2_PKG_ERRORS" >&5
 
+       as_fn_error $? "Package requirements (glib-2.0 gthread-2.0) were not met:
 
-# Checks for libraries.
-
+$GLIB2_PKG_ERRORS
 
-if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
-       if test -n "$ac_tool_prefix"; then
-  # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args.
-set dummy ${ac_tool_prefix}pkg-config; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
-if test "${ac_cv_path_PKG_CONFIG+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  case $PKG_CONFIG in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path.
-  ;;
-  *)
-  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-done
-IFS=$as_save_IFS
+Consider adjusting the PKG_CONFIG_PATH environment variable if you
+installed software in a non-standard prefix.
 
-  ;;
-esac
-fi
-PKG_CONFIG=$ac_cv_path_PKG_CONFIG
-if test -n "$PKG_CONFIG"; then
-  { echo "$as_me:$LINENO: result: $PKG_CONFIG" >&5
-echo "${ECHO_T}$PKG_CONFIG" >&6; }
-else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
-fi
+Alternatively, you may set the environment variables GLIB2_CFLAGS
+and GLIB2_LIBS to avoid the need to call pkg-config.
+See the pkg-config man page for more details." "$LINENO" 5
+elif test $pkg_failed = untried; then
+       { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+       { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "The pkg-config script could not be found or is too old.  Make sure it
+is in your PATH or set the PKG_CONFIG environment variable to the full
+path to pkg-config.
 
+Alternatively, you may set the environment variables GLIB2_CFLAGS
+and GLIB2_LIBS to avoid the need to call pkg-config.
+See the pkg-config man page for more details.
 
-fi
-if test -z "$ac_cv_path_PKG_CONFIG"; then
-  ac_pt_PKG_CONFIG=$PKG_CONFIG
-  # Extract the first word of "pkg-config", so it can be a program name with args.
-set dummy pkg-config; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
-if test "${ac_cv_path_ac_pt_PKG_CONFIG+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+To get pkg-config, see <http://pkg-config.freedesktop.org/>.
+See \`config.log' for more details" "$LINENO" 5 ; }
 else
-  case $ac_pt_PKG_CONFIG in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path.
-  ;;
-  *)
-  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-done
-IFS=$as_save_IFS
+       GLIB2_CFLAGS=$pkg_cv_GLIB2_CFLAGS
+       GLIB2_LIBS=$pkg_cv_GLIB2_LIBS
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
 
-  ;;
-esac
-fi
-ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG
-if test -n "$ac_pt_PKG_CONFIG"; then
-  { echo "$as_me:$LINENO: result: $ac_pt_PKG_CONFIG" >&5
-echo "${ECHO_T}$ac_pt_PKG_CONFIG" >&6; }
-else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
 fi
 
-  if test "x$ac_pt_PKG_CONFIG" = x; then
-    PKG_CONFIG=""
-  else
-    case $cross_compiling:$ac_tool_warned in
-yes:)
-{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet.  If you think this
-configuration is useful to you, please write to autoconf@gnu.org." >&5
-echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet.  If you think this
-configuration is useful to you, please write to autoconf@gnu.org." >&2;}
-ac_tool_warned=yes ;;
-esac
-    PKG_CONFIG=$ac_pt_PKG_CONFIG
-  fi
-else
-  PKG_CONFIG="$ac_cv_path_PKG_CONFIG"
-fi
 
-fi
-if test -n "$PKG_CONFIG"; then
-       _pkg_min_version=0.9.0
-       { echo "$as_me:$LINENO: checking pkg-config is at least version $_pkg_min_version" >&5
-echo $ECHO_N "checking pkg-config is at least version $_pkg_min_version... $ECHO_C" >&6; }
-       if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
-               { echo "$as_me:$LINENO: result: yes" >&5
-echo "${ECHO_T}yes" >&6; }
-       else
-               { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
-               PKG_CONFIG=""
-       fi
 
-fi
 
 pkg_failed=no
-{ echo "$as_me:$LINENO: checking for AVSYSTEM" >&5
-echo $ECHO_N "checking for AVSYSTEM... $ECHO_C" >&6; }
-
-if test -n "$PKG_CONFIG"; then
-    if test -n "$AVSYSTEM_CFLAGS"; then
-        pkg_cv_AVSYSTEM_CFLAGS="$AVSYSTEM_CFLAGS"
-    else
-        if test -n "$PKG_CONFIG" && \
-    { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"avsystem\"") >&5
-  ($PKG_CONFIG --exists --print-errors "avsystem") 2>&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for VCONF" >&5
+$as_echo_n "checking for VCONF... " >&6; }
+
+if test -n "$VCONF_CFLAGS"; then
+    pkg_cv_VCONF_CFLAGS="$VCONF_CFLAGS"
+ elif test -n "$PKG_CONFIG"; then
+    if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"vconf\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "vconf") 2>&5
   ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; then
-  pkg_cv_AVSYSTEM_CFLAGS=`$PKG_CONFIG --cflags "avsystem" 2>/dev/null`
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_VCONF_CFLAGS=`$PKG_CONFIG --cflags "vconf" 2>/dev/null`
 else
   pkg_failed=yes
 fi
-    fi
-else
-       pkg_failed=untried
+ else
+    pkg_failed=untried
 fi
-if test -n "$PKG_CONFIG"; then
-    if test -n "$AVSYSTEM_LIBS"; then
-        pkg_cv_AVSYSTEM_LIBS="$AVSYSTEM_LIBS"
-    else
-        if test -n "$PKG_CONFIG" && \
-    { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"avsystem\"") >&5
-  ($PKG_CONFIG --exists --print-errors "avsystem") 2>&5
+if test -n "$VCONF_LIBS"; then
+    pkg_cv_VCONF_LIBS="$VCONF_LIBS"
+ elif test -n "$PKG_CONFIG"; then
+    if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"vconf\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "vconf") 2>&5
   ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; then
-  pkg_cv_AVSYSTEM_LIBS=`$PKG_CONFIG --libs "avsystem" 2>/dev/null`
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_VCONF_LIBS=`$PKG_CONFIG --libs "vconf" 2>/dev/null`
 else
   pkg_failed=yes
 fi
-    fi
-else
-       pkg_failed=untried
+ else
+    pkg_failed=untried
 fi
 
 
 
 if test $pkg_failed = yes; then
+       { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 
 if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
         _pkg_short_errors_supported=yes
@@ -13034,113 +12152,91 @@ else
         _pkg_short_errors_supported=no
 fi
         if test $_pkg_short_errors_supported = yes; then
-               AVSYSTEM_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "avsystem"`
+               VCONF_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "vconf" 2>&1`
         else
-               AVSYSTEM_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "avsystem"`
+               VCONF_PKG_ERRORS=`$PKG_CONFIG --print-errors "vconf" 2>&1`
         fi
        # Put the nasty error message in config.log where it belongs
-       echo "$AVSYSTEM_PKG_ERRORS" >&5
-
-       { { echo "$as_me:$LINENO: error: Package requirements (avsystem) were not met:
-
-$AVSYSTEM_PKG_ERRORS
+       echo "$VCONF_PKG_ERRORS" >&5
 
-Consider adjusting the PKG_CONFIG_PATH environment variable if you
-installed software in a non-standard prefix.
-
-Alternatively, you may set the environment variables AVSYSTEM_CFLAGS
-and AVSYSTEM_LIBS to avoid the need to call pkg-config.
-See the pkg-config man page for more details.
-" >&5
-echo "$as_me: error: Package requirements (avsystem) were not met:
+       as_fn_error $? "Package requirements (vconf) were not met:
 
-$AVSYSTEM_PKG_ERRORS
+$VCONF_PKG_ERRORS
 
 Consider adjusting the PKG_CONFIG_PATH environment variable if you
 installed software in a non-standard prefix.
 
-Alternatively, you may set the environment variables AVSYSTEM_CFLAGS
-and AVSYSTEM_LIBS to avoid the need to call pkg-config.
-See the pkg-config man page for more details.
-" >&2;}
-   { (exit 1); exit 1; }; }
+Alternatively, you may set the environment variables VCONF_CFLAGS
+and VCONF_LIBS to avoid the need to call pkg-config.
+See the pkg-config man page for more details." "$LINENO" 5
 elif test $pkg_failed = untried; then
-       { { echo "$as_me:$LINENO: error: The pkg-config script could not be found or is too old.  Make sure it
-is in your PATH or set the PKG_CONFIG environment variable to the full
-path to pkg-config.
-
-Alternatively, you may set the environment variables AVSYSTEM_CFLAGS
-and AVSYSTEM_LIBS to avoid the need to call pkg-config.
-See the pkg-config man page for more details.
-
-To get pkg-config, see <http://www.freedesktop.org/software/pkgconfig>.
-See \`config.log' for more details." >&5
-echo "$as_me: error: The pkg-config script could not be found or is too old.  Make sure it
+       { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+       { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "The pkg-config script could not be found or is too old.  Make sure it
 is in your PATH or set the PKG_CONFIG environment variable to the full
 path to pkg-config.
 
-Alternatively, you may set the environment variables AVSYSTEM_CFLAGS
-and AVSYSTEM_LIBS to avoid the need to call pkg-config.
+Alternatively, you may set the environment variables VCONF_CFLAGS
+and VCONF_LIBS to avoid the need to call pkg-config.
 See the pkg-config man page for more details.
 
-To get pkg-config, see <http://www.freedesktop.org/software/pkgconfig>.
-See \`config.log' for more details." >&2;}
-   { (exit 1); exit 1; }; }
+To get pkg-config, see <http://pkg-config.freedesktop.org/>.
+See \`config.log' for more details" "$LINENO" 5 ; }
 else
-       AVSYSTEM_CFLAGS=$pkg_cv_AVSYSTEM_CFLAGS
-       AVSYSTEM_LIBS=$pkg_cv_AVSYSTEM_LIBS
-        { echo "$as_me:$LINENO: result: yes" >&5
-echo "${ECHO_T}yes" >&6; }
-       :
+       VCONF_CFLAGS=$pkg_cv_VCONF_CFLAGS
+       VCONF_LIBS=$pkg_cv_VCONF_LIBS
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
 fi
 
 
 
 
 pkg_failed=no
-{ echo "$as_me:$LINENO: checking for MMCOMMON" >&5
-echo $ECHO_N "checking for MMCOMMON... $ECHO_C" >&6; }
-
-if test -n "$PKG_CONFIG"; then
-    if test -n "$MMCOMMON_CFLAGS"; then
-        pkg_cv_MMCOMMON_CFLAGS="$MMCOMMON_CFLAGS"
-    else
-        if test -n "$PKG_CONFIG" && \
-    { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"mm-common\"") >&5
-  ($PKG_CONFIG --exists --print-errors "mm-common") 2>&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for HEYNOTI" >&5
+$as_echo_n "checking for HEYNOTI... " >&6; }
+
+if test -n "$HEYNOTI_CFLAGS"; then
+    pkg_cv_HEYNOTI_CFLAGS="$HEYNOTI_CFLAGS"
+ elif test -n "$PKG_CONFIG"; then
+    if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"heynoti\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "heynoti") 2>&5
   ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; then
-  pkg_cv_MMCOMMON_CFLAGS=`$PKG_CONFIG --cflags "mm-common" 2>/dev/null`
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_HEYNOTI_CFLAGS=`$PKG_CONFIG --cflags "heynoti" 2>/dev/null`
 else
   pkg_failed=yes
 fi
-    fi
-else
-       pkg_failed=untried
+ else
+    pkg_failed=untried
 fi
-if test -n "$PKG_CONFIG"; then
-    if test -n "$MMCOMMON_LIBS"; then
-        pkg_cv_MMCOMMON_LIBS="$MMCOMMON_LIBS"
-    else
-        if test -n "$PKG_CONFIG" && \
-    { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"mm-common\"") >&5
-  ($PKG_CONFIG --exists --print-errors "mm-common") 2>&5
+if test -n "$HEYNOTI_LIBS"; then
+    pkg_cv_HEYNOTI_LIBS="$HEYNOTI_LIBS"
+ elif test -n "$PKG_CONFIG"; then
+    if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"heynoti\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "heynoti") 2>&5
   ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; then
-  pkg_cv_MMCOMMON_LIBS=`$PKG_CONFIG --libs "mm-common" 2>/dev/null`
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_HEYNOTI_LIBS=`$PKG_CONFIG --libs "heynoti" 2>/dev/null`
 else
   pkg_failed=yes
 fi
-    fi
-else
-       pkg_failed=untried
+ else
+    pkg_failed=untried
 fi
 
 
 
 if test $pkg_failed = yes; then
+       { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 
 if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
         _pkg_short_errors_supported=yes
         _pkg_short_errors_supported=no
 fi
         if test $_pkg_short_errors_supported = yes; then
-               MMCOMMON_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "mm-common"`
+               HEYNOTI_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "heynoti" 2>&1`
         else
-               MMCOMMON_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "mm-common"`
+               HEYNOTI_PKG_ERRORS=`$PKG_CONFIG --print-errors "heynoti" 2>&1`
         fi
        # Put the nasty error message in config.log where it belongs
-       echo "$MMCOMMON_PKG_ERRORS" >&5
-
-       { { echo "$as_me:$LINENO: error: Package requirements (mm-common) were not met:
-
-$MMCOMMON_PKG_ERRORS
+       echo "$HEYNOTI_PKG_ERRORS" >&5
 
-Consider adjusting the PKG_CONFIG_PATH environment variable if you
-installed software in a non-standard prefix.
-
-Alternatively, you may set the environment variables MMCOMMON_CFLAGS
-and MMCOMMON_LIBS to avoid the need to call pkg-config.
-See the pkg-config man page for more details.
-" >&5
-echo "$as_me: error: Package requirements (mm-common) were not met:
+       as_fn_error $? "Package requirements (heynoti) were not met:
 
-$MMCOMMON_PKG_ERRORS
+$HEYNOTI_PKG_ERRORS
 
 Consider adjusting the PKG_CONFIG_PATH environment variable if you
 installed software in a non-standard prefix.
 
-Alternatively, you may set the environment variables MMCOMMON_CFLAGS
-and MMCOMMON_LIBS to avoid the need to call pkg-config.
-See the pkg-config man page for more details.
-" >&2;}
-   { (exit 1); exit 1; }; }
+Alternatively, you may set the environment variables HEYNOTI_CFLAGS
+and HEYNOTI_LIBS to avoid the need to call pkg-config.
+See the pkg-config man page for more details." "$LINENO" 5
 elif test $pkg_failed = untried; then
-       { { echo "$as_me:$LINENO: error: The pkg-config script could not be found or is too old.  Make sure it
-is in your PATH or set the PKG_CONFIG environment variable to the full
-path to pkg-config.
-
-Alternatively, you may set the environment variables MMCOMMON_CFLAGS
-and MMCOMMON_LIBS to avoid the need to call pkg-config.
-See the pkg-config man page for more details.
-
-To get pkg-config, see <http://www.freedesktop.org/software/pkgconfig>.
-See \`config.log' for more details." >&5
-echo "$as_me: error: The pkg-config script could not be found or is too old.  Make sure it
+       { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+       { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "The pkg-config script could not be found or is too old.  Make sure it
 is in your PATH or set the PKG_CONFIG environment variable to the full
 path to pkg-config.
 
-Alternatively, you may set the environment variables MMCOMMON_CFLAGS
-and MMCOMMON_LIBS to avoid the need to call pkg-config.
+Alternatively, you may set the environment variables HEYNOTI_CFLAGS
+and HEYNOTI_LIBS to avoid the need to call pkg-config.
 See the pkg-config man page for more details.
 
-To get pkg-config, see <http://www.freedesktop.org/software/pkgconfig>.
-See \`config.log' for more details." >&2;}
-   { (exit 1); exit 1; }; }
+To get pkg-config, see <http://pkg-config.freedesktop.org/>.
+See \`config.log' for more details" "$LINENO" 5 ; }
 else
-       MMCOMMON_CFLAGS=$pkg_cv_MMCOMMON_CFLAGS
-       MMCOMMON_LIBS=$pkg_cv_MMCOMMON_LIBS
-        { echo "$as_me:$LINENO: result: yes" >&5
-echo "${ECHO_T}yes" >&6; }
-       :
+       HEYNOTI_CFLAGS=$pkg_cv_HEYNOTI_CFLAGS
+       HEYNOTI_LIBS=$pkg_cv_HEYNOTI_LIBS
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
 fi
 
 
-#PKG_CHECK_MODULES(EXIF, libexif)
-#AC_SUBST(EXIF_CFLAGS)
-#AC_SUBST(EXIF_LIBS)
 
-if test "x$IS_SDK" = "xyes";
-then
-echo "SDK build does not use mm-log"
+
+# Check whether --enable-pulse was given.
+if test "${enable_pulse+set}" = set; then :
+  enableval=$enable_pulse;
+ case "${enableval}" in
+        yes) USE_PULSE=yes ;;
+        no)  USE_PULSE=no ;;
+        *)   as_fn_error $? "bad value ${enableval} for --enable-pulse" "$LINENO" 5  ;;
+ esac
+
 else
+  USE_PULSE=no
+fi
 
-pkg_failed=no
-{ echo "$as_me:$LINENO: checking for MMLOG" >&5
-echo $ECHO_N "checking for MMLOG... $ECHO_C" >&6; }
+if test "x$USE_PULSE" = "xyes"; then
 
-if test -n "$PKG_CONFIG"; then
-    if test -n "$MMLOG_CFLAGS"; then
-        pkg_cv_MMLOG_CFLAGS="$MMLOG_CFLAGS"
-    else
-        if test -n "$PKG_CONFIG" && \
-    { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"mm-log\"") >&5
-  ($PKG_CONFIG --exists --print-errors "mm-log") 2>&5
+pkg_failed=no
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for PULSE" >&5
+$as_echo_n "checking for PULSE... " >&6; }
+
+if test -n "$PULSE_CFLAGS"; then
+    pkg_cv_PULSE_CFLAGS="$PULSE_CFLAGS"
+ elif test -n "$PKG_CONFIG"; then
+    if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libpulse\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "libpulse") 2>&5
   ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; then
-  pkg_cv_MMLOG_CFLAGS=`$PKG_CONFIG --cflags "mm-log" 2>/dev/null`
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_PULSE_CFLAGS=`$PKG_CONFIG --cflags "libpulse" 2>/dev/null`
 else
   pkg_failed=yes
 fi
-    fi
-else
-       pkg_failed=untried
+ else
+    pkg_failed=untried
 fi
-if test -n "$PKG_CONFIG"; then
-    if test -n "$MMLOG_LIBS"; then
-        pkg_cv_MMLOG_LIBS="$MMLOG_LIBS"
-    else
-        if test -n "$PKG_CONFIG" && \
-    { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"mm-log\"") >&5
-  ($PKG_CONFIG --exists --print-errors "mm-log") 2>&5
+if test -n "$PULSE_LIBS"; then
+    pkg_cv_PULSE_LIBS="$PULSE_LIBS"
+ elif test -n "$PKG_CONFIG"; then
+    if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libpulse\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "libpulse") 2>&5
   ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; then
-  pkg_cv_MMLOG_LIBS=`$PKG_CONFIG --libs "mm-log" 2>/dev/null`
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_PULSE_LIBS=`$PKG_CONFIG --libs "libpulse" 2>/dev/null`
 else
   pkg_failed=yes
 fi
-    fi
-else
-       pkg_failed=untried
+ else
+    pkg_failed=untried
 fi
 
 
 
 if test $pkg_failed = yes; then
+       { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 
 if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
         _pkg_short_errors_supported=yes
@@ -13269,80 +12351,65 @@ else
         _pkg_short_errors_supported=no
 fi
         if test $_pkg_short_errors_supported = yes; then
-               MMLOG_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "mm-log"`
+               PULSE_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "libpulse" 2>&1`
         else
-               MMLOG_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "mm-log"`
+               PULSE_PKG_ERRORS=`$PKG_CONFIG --print-errors "libpulse" 2>&1`
         fi
        # Put the nasty error message in config.log where it belongs
-       echo "$MMLOG_PKG_ERRORS" >&5
-
-       { { echo "$as_me:$LINENO: error: Package requirements (mm-log) were not met:
-
-$MMLOG_PKG_ERRORS
-
-Consider adjusting the PKG_CONFIG_PATH environment variable if you
-installed software in a non-standard prefix.
-
-Alternatively, you may set the environment variables MMLOG_CFLAGS
-and MMLOG_LIBS to avoid the need to call pkg-config.
-See the pkg-config man page for more details.
-" >&5
-echo "$as_me: error: Package requirements (mm-log) were not met:
-
-$MMLOG_PKG_ERRORS
+       echo "$PULSE_PKG_ERRORS" >&5
 
-Consider adjusting the PKG_CONFIG_PATH environment variable if you
-installed software in a non-standard prefix.
+       as_fn_error $? "Package requirements (libpulse) were not met:
 
-Alternatively, you may set the environment variables MMLOG_CFLAGS
-and MMLOG_LIBS to avoid the need to call pkg-config.
-See the pkg-config man page for more details.
-" >&2;}
-   { (exit 1); exit 1; }; }
-elif test $pkg_failed = untried; then
-       { { echo "$as_me:$LINENO: error: The pkg-config script could not be found or is too old.  Make sure it
-is in your PATH or set the PKG_CONFIG environment variable to the full
-path to pkg-config.
+$PULSE_PKG_ERRORS
 
-Alternatively, you may set the environment variables MMLOG_CFLAGS
-and MMLOG_LIBS to avoid the need to call pkg-config.
-See the pkg-config man page for more details.
+Consider adjusting the PKG_CONFIG_PATH environment variable if you
+installed software in a non-standard prefix.
 
-To get pkg-config, see <http://www.freedesktop.org/software/pkgconfig>.
-See \`config.log' for more details." >&5
-echo "$as_me: error: The pkg-config script could not be found or is too old.  Make sure it
+Alternatively, you may set the environment variables PULSE_CFLAGS
+and PULSE_LIBS to avoid the need to call pkg-config.
+See the pkg-config man page for more details." "$LINENO" 5
+elif test $pkg_failed = untried; then
+       { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+       { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "The pkg-config script could not be found or is too old.  Make sure it
 is in your PATH or set the PKG_CONFIG environment variable to the full
 path to pkg-config.
 
-Alternatively, you may set the environment variables MMLOG_CFLAGS
-and MMLOG_LIBS to avoid the need to call pkg-config.
+Alternatively, you may set the environment variables PULSE_CFLAGS
+and PULSE_LIBS to avoid the need to call pkg-config.
 See the pkg-config man page for more details.
 
-To get pkg-config, see <http://www.freedesktop.org/software/pkgconfig>.
-See \`config.log' for more details." >&2;}
-   { (exit 1); exit 1; }; }
+To get pkg-config, see <http://pkg-config.freedesktop.org/>.
+See \`config.log' for more details" "$LINENO" 5 ; }
 else
-       MMLOG_CFLAGS=$pkg_cv_MMLOG_CFLAGS
-       MMLOG_LIBS=$pkg_cv_MMLOG_LIBS
-        { echo "$as_me:$LINENO: result: yes" >&5
-echo "${ECHO_T}yes" >&6; }
-       :
+       PULSE_CFLAGS=$pkg_cv_PULSE_CFLAGS
+       PULSE_LIBS=$pkg_cv_PULSE_LIBS
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
 fi
 
 
 fi
+ if test "x$USE_PULSE" = "xyes"; then
+  USE_PULSE_TRUE=
+  USE_PULSE_FALSE='#'
+else
+  USE_PULSE_TRUE='#'
+  USE_PULSE_FALSE=
+fi
+
+
 
 # Checks for header files.
-{ echo "$as_me:$LINENO: checking for ANSI C header files" >&5
-echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6; }
-if test "${ac_cv_header_stdc+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5
+$as_echo_n "checking for ANSI C header files... " >&6; }
+if test "${ac_cv_header_stdc+set}" = set; then :
+  $as_echo_n "(cached) " >&6
 else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 #include <stdlib.h>
 #include <stdarg.h>
@@ -13357,47 +12424,23 @@ main ()
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
+if ac_fn_c_try_compile "$LINENO"; then :
   ac_cv_header_stdc=yes
 else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_cv_header_stdc=no
+  ac_cv_header_stdc=no
 fi
-
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 
 if test $ac_cv_header_stdc = yes; then
   # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 #include <string.h>
 
 _ACEOF
 if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  $EGREP "memchr" >/dev/null 2>&1; then
-  :
+  $EGREP "memchr" >/dev/null 2>&1; then :
+
 else
   ac_cv_header_stdc=no
 fi
 
 if test $ac_cv_header_stdc = yes; then
   # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 #include <stdlib.h>
 
 _ACEOF
 if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  $EGREP "free" >/dev/null 2>&1; then
-  :
+  $EGREP "free" >/dev/null 2>&1; then :
+
 else
   ac_cv_header_stdc=no
 fi
 
 if test $ac_cv_header_stdc = yes; then
   # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
-  if test "$cross_compiling" = yes; then
+  if test "$cross_compiling" = yes; then :
   :
 else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 #include <ctype.h>
 #include <stdlib.h>
@@ -13462,193 +12497,32 @@ main ()
   return 0;
 }
 _ACEOF
-rm -f conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_link") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  :
-else
-  echo "$as_me: program exited with status $ac_status" >&5
-echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+if ac_fn_c_try_run "$LINENO"; then :
 
-( exit $ac_status )
-ac_cv_header_stdc=no
+else
+  ac_cv_header_stdc=no
 fi
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
 fi
 
-
 fi
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5
-echo "${ECHO_T}$ac_cv_header_stdc" >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5
+$as_echo "$ac_cv_header_stdc" >&6; }
 if test $ac_cv_header_stdc = yes; then
 
-cat >>confdefs.h <<\_ACEOF
-#define STDC_HEADERS 1
-_ACEOF
+$as_echo "#define STDC_HEADERS 1" >>confdefs.h
 
 fi
 
-
-
-
-
-
-
-
-
-
 for ac_header in fcntl.h memory.h stdlib.h string.h sys/time.h unistd.h errno.h sys/types.h sys/stat.h
-do
-as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-else
-  # Is the header compilable?
-{ echo "$as_me:$LINENO: checking $ac_header usability" >&5
-echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ echo "$as_me:$LINENO: checking $ac_header presence" >&5
-echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <$ac_header>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6; }
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
-
-    ;;
-esac
-{ echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
+do :
+  as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
   cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
 _ACEOF
 
 fi
@@ -13657,16 +12531,12 @@ done
 
 
 # Checks for typedefs, structures, and compiler characteristics.
-{ echo "$as_me:$LINENO: checking for an ANSI C-conforming const" >&5
-echo $ECHO_N "checking for an ANSI C-conforming const... $ECHO_C" >&6; }
-if test "${ac_cv_c_const+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for an ANSI C-conforming const" >&5
+$as_echo_n "checking for an ANSI C-conforming const... " >&6; }
+if test "${ac_cv_c_const+set}" = set; then :
+  $as_echo_n "(cached) " >&6
 else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 int
@@ -13726,98 +12596,24 @@ main ()
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
+if ac_fn_c_try_compile "$LINENO"; then :
   ac_cv_c_const=yes
 else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_cv_c_const=no
+  ac_cv_c_const=no
 fi
-
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_c_const" >&5
-echo "${ECHO_T}$ac_cv_c_const" >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_const" >&5
+$as_echo "$ac_cv_c_const" >&6; }
 if test $ac_cv_c_const = no; then
 
-cat >>confdefs.h <<\_ACEOF
-#define const
-_ACEOF
+$as_echo "#define const /**/" >>confdefs.h
 
 fi
 
-{ echo "$as_me:$LINENO: checking for pid_t" >&5
-echo $ECHO_N "checking for pid_t... $ECHO_C" >&6; }
-if test "${ac_cv_type_pid_t+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-typedef pid_t ac__type_new_;
-int
-main ()
-{
-if ((ac__type_new_ *) 0)
-  return 0;
-if (sizeof (ac__type_new_))
-  return 0;
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_cv_type_pid_t=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_cv_type_pid_t=no
-fi
+ac_fn_c_check_type "$LINENO" "pid_t" "ac_cv_type_pid_t" "$ac_includes_default"
+if test "x$ac_cv_type_pid_t" = x""yes; then :
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_type_pid_t" >&5
-echo "${ECHO_T}$ac_cv_type_pid_t" >&6; }
-if test $ac_cv_type_pid_t = yes; then
-  :
 else
 
 cat >>confdefs.h <<_ACEOF
@@ -13826,61 +12622,9 @@ _ACEOF
 
 fi
 
-{ echo "$as_me:$LINENO: checking for size_t" >&5
-echo $ECHO_N "checking for size_t... $ECHO_C" >&6; }
-if test "${ac_cv_type_size_t+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-typedef size_t ac__type_new_;
-int
-main ()
-{
-if ((ac__type_new_ *) 0)
-  return 0;
-if (sizeof (ac__type_new_))
-  return 0;
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_cv_type_size_t=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_cv_type_size_t=no
-fi
+ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default"
+if test "x$ac_cv_type_size_t" = x""yes; then :
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_type_size_t" >&5
-echo "${ECHO_T}$ac_cv_type_size_t" >&6; }
-if test $ac_cv_type_size_t = yes; then
-  :
 else
 
 cat >>confdefs.h <<_ACEOF
 # Checks for library functions.
 # The Ultrix 4.2 mips builtin alloca declared by alloca.h only works
 # for constant arguments.  Useless!
-{ echo "$as_me:$LINENO: checking for working alloca.h" >&5
-echo $ECHO_N "checking for working alloca.h... $ECHO_C" >&6; }
-if test "${ac_cv_working_alloca_h+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for working alloca.h" >&5
+$as_echo_n "checking for working alloca.h... " >&6; }
+if test "${ac_cv_working_alloca_h+set}" = set; then :
+  $as_echo_n "(cached) " >&6
 else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 #include <alloca.h>
 int
@@ -13914,55 +12654,28 @@ char *p = (char *) alloca (2 * sizeof (int));
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+if ac_fn_c_try_link "$LINENO"; then :
   ac_cv_working_alloca_h=yes
 else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_cv_working_alloca_h=no
+  ac_cv_working_alloca_h=no
 fi
-
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_working_alloca_h" >&5
-echo "${ECHO_T}$ac_cv_working_alloca_h" >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_working_alloca_h" >&5
+$as_echo "$ac_cv_working_alloca_h" >&6; }
 if test $ac_cv_working_alloca_h = yes; then
 
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_ALLOCA_H 1
-_ACEOF
+$as_echo "#define HAVE_ALLOCA_H 1" >>confdefs.h
 
 fi
 
-{ echo "$as_me:$LINENO: checking for alloca" >&5
-echo $ECHO_N "checking for alloca... $ECHO_C" >&6; }
-if test "${ac_cv_func_alloca_works+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for alloca" >&5
+$as_echo_n "checking for alloca... " >&6; }
+if test "${ac_cv_func_alloca_works+set}" = set; then :
+  $as_echo_n "(cached) " >&6
 else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 #ifdef __GNUC__
 # define alloca __builtin_alloca
@@ -13994,43 +12707,20 @@ char *p = (char *) alloca (1);
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+if ac_fn_c_try_link "$LINENO"; then :
   ac_cv_func_alloca_works=yes
 else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_cv_func_alloca_works=no
+  ac_cv_func_alloca_works=no
 fi
-
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_func_alloca_works" >&5
-echo "${ECHO_T}$ac_cv_func_alloca_works" >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_alloca_works" >&5
+$as_echo "$ac_cv_func_alloca_works" >&6; }
 
 if test $ac_cv_func_alloca_works = yes; then
 
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_ALLOCA 1
-_ACEOF
+$as_echo "#define HAVE_ALLOCA 1" >>confdefs.h
 
 else
   # The SVR3 libPW and SVR4 libucb both contain incompatible functions
@@ -14040,126 +12730,39 @@ else
 
 ALLOCA=\${LIBOBJDIR}alloca.$ac_objext
 
-cat >>confdefs.h <<\_ACEOF
-#define C_ALLOCA 1
-_ACEOF
+$as_echo "#define C_ALLOCA 1" >>confdefs.h
 
 
-{ echo "$as_me:$LINENO: checking whether \`alloca.c' needs Cray hooks" >&5
-echo $ECHO_N "checking whether \`alloca.c' needs Cray hooks... $ECHO_C" >&6; }
-if test "${ac_cv_os_cray+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether \`alloca.c' needs Cray hooks" >&5
+$as_echo_n "checking whether \`alloca.c' needs Cray hooks... " >&6; }
+if test "${ac_cv_os_cray+set}" = set; then :
+  $as_echo_n "(cached) " >&6
 else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 #if defined CRAY && ! defined CRAY2
-webecray
-#else
-wenotbecray
-#endif
-
-_ACEOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  $EGREP "webecray" >/dev/null 2>&1; then
-  ac_cv_os_cray=yes
-else
-  ac_cv_os_cray=no
-fi
-rm -f conftest*
-
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_os_cray" >&5
-echo "${ECHO_T}$ac_cv_os_cray" >&6; }
-if test $ac_cv_os_cray = yes; then
-  for ac_func in _getb67 GETB67 getb67; do
-    as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
-{ echo "$as_me:$LINENO: checking for $ac_func" >&5
-echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; }
-if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
-   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
-#define $ac_func innocuous_$ac_func
-
-/* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char $ac_func (); below.
-    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
-    <limits.h> exists even on freestanding compilers.  */
-
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-
-#undef $ac_func
-
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char $ac_func ();
-/* The GNU C library defines this for functions which it implements
-    to always fail with ENOSYS.  Some functions are actually named
-    something starting with __ and the normal name is an alias.  */
-#if defined __stub_$ac_func || defined __stub___$ac_func
-choke me
+webecray
+#else
+wenotbecray
 #endif
 
-int
-main ()
-{
-return $ac_func ();
-  ;
-  return 0;
-}
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
-  eval "$as_ac_var=yes"
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "webecray" >/dev/null 2>&1; then :
+  ac_cv_os_cray=yes
 else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       eval "$as_ac_var=no"
+  ac_cv_os_cray=no
 fi
+rm -f conftest*
 
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
 fi
-ac_res=`eval echo '${'$as_ac_var'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-if test `eval echo '${'$as_ac_var'}'` = yes; then
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_os_cray" >&5
+$as_echo "$ac_cv_os_cray" >&6; }
+if test $ac_cv_os_cray = yes; then
+  for ac_func in _getb67 GETB67 getb67; do
+    as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
+if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
 
 cat >>confdefs.h <<_ACEOF
 #define CRAY_STACKSEG_END $ac_func
   done
 fi
 
-{ echo "$as_me:$LINENO: checking stack direction for C alloca" >&5
-echo $ECHO_N "checking stack direction for C alloca... $ECHO_C" >&6; }
-if test "${ac_cv_c_stack_direction+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking stack direction for C alloca" >&5
+$as_echo_n "checking stack direction for C alloca... " >&6; }
+if test "${ac_cv_c_stack_direction+set}" = set; then :
+  $as_echo_n "(cached) " >&6
 else
-  if test "$cross_compiling" = yes; then
+  if test "$cross_compiling" = yes; then :
   ac_cv_c_stack_direction=0
 else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 $ac_includes_default
 int
@@ -14206,43 +12805,18 @@ main ()
   return find_stack_direction () < 0;
 }
 _ACEOF
-rm -f conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_link") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+if ac_fn_c_try_run "$LINENO"; then :
   ac_cv_c_stack_direction=1
 else
-  echo "$as_me: program exited with status $ac_status" >&5
-echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-( exit $ac_status )
-ac_cv_c_stack_direction=-1
+  ac_cv_c_stack_direction=-1
 fi
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
 fi
 
-
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_c_stack_direction" >&5
-echo "${ECHO_T}$ac_cv_c_stack_direction" >&6; }
-
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_stack_direction" >&5
+$as_echo "$ac_cv_c_stack_direction" >&6; }
 cat >>confdefs.h <<_ACEOF
 #define STACK_DIRECTION $ac_cv_c_stack_direction
 _ACEOF
@@ -14250,255 +12824,40 @@ _ACEOF
 
 fi
 
-
 for ac_header in vfork.h
-do
-as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-else
-  # Is the header compilable?
-{ echo "$as_me:$LINENO: checking $ac_header usability" >&5
-echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ echo "$as_me:$LINENO: checking $ac_header presence" >&5
-echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <$ac_header>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6; }
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
-
-    ;;
-esac
-{ echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
+do :
+  ac_fn_c_check_header_mongrel "$LINENO" "vfork.h" "ac_cv_header_vfork_h" "$ac_includes_default"
+if test "x$ac_cv_header_vfork_h" = x""yes; then :
   cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+#define HAVE_VFORK_H 1
 _ACEOF
 
 fi
 
 done
 
-
-
 for ac_func in fork vfork
-do
-as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
-{ echo "$as_me:$LINENO: checking for $ac_func" >&5
-echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; }
-if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
-   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
-#define $ac_func innocuous_$ac_func
-
-/* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char $ac_func (); below.
-    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
-    <limits.h> exists even on freestanding compilers.  */
-
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-
-#undef $ac_func
-
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char $ac_func ();
-/* The GNU C library defines this for functions which it implements
-    to always fail with ENOSYS.  Some functions are actually named
-    something starting with __ and the normal name is an alias.  */
-#if defined __stub_$ac_func || defined __stub___$ac_func
-choke me
-#endif
-
-int
-main ()
-{
-return $ac_func ();
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
-  eval "$as_ac_var=yes"
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       eval "$as_ac_var=no"
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-fi
-ac_res=`eval echo '${'$as_ac_var'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-if test `eval echo '${'$as_ac_var'}'` = yes; then
+do :
+  as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
+if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
   cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
 _ACEOF
 
 fi
 done
 
 if test "x$ac_cv_func_fork" = xyes; then
-  { echo "$as_me:$LINENO: checking for working fork" >&5
-echo $ECHO_N "checking for working fork... $ECHO_C" >&6; }
-if test "${ac_cv_func_fork_works+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working fork" >&5
+$as_echo_n "checking for working fork... " >&6; }
+if test "${ac_cv_func_fork_works+set}" = set; then :
+  $as_echo_n "(cached) " >&6
 else
-  if test "$cross_compiling" = yes; then
+  if test "$cross_compiling" = yes; then :
   ac_cv_func_fork_works=cross
 else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 $ac_includes_default
 int
@@ -14512,42 +12871,18 @@ main ()
   return 0;
 }
 _ACEOF
-rm -f conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_link") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+if ac_fn_c_try_run "$LINENO"; then :
   ac_cv_func_fork_works=yes
 else
-  echo "$as_me: program exited with status $ac_status" >&5
-echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-( exit $ac_status )
-ac_cv_func_fork_works=no
+  ac_cv_func_fork_works=no
 fi
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
 fi
 
-
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_func_fork_works" >&5
-echo "${ECHO_T}$ac_cv_func_fork_works" >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_fork_works" >&5
+$as_echo "$ac_cv_func_fork_works" >&6; }
 
 else
   ac_cv_func_fork_works=$ac_cv_func_fork
@@ -14562,24 +12897,20 @@ if test "x$ac_cv_func_fork_works" = xcross; then
       ac_cv_func_fork_works=yes
       ;;
   esac
-  { echo "$as_me:$LINENO: WARNING: result $ac_cv_func_fork_works guessed because of cross compilation" >&5
-echo "$as_me: WARNING: result $ac_cv_func_fork_works guessed because of cross compilation" >&2;}
+  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: result $ac_cv_func_fork_works guessed because of cross compilation" >&5
+$as_echo "$as_me: WARNING: result $ac_cv_func_fork_works guessed because of cross compilation" >&2;}
 fi
 ac_cv_func_vfork_works=$ac_cv_func_vfork
 if test "x$ac_cv_func_vfork" = xyes; then
-  { echo "$as_me:$LINENO: checking for working vfork" >&5
-echo $ECHO_N "checking for working vfork... $ECHO_C" >&6; }
-if test "${ac_cv_func_vfork_works+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working vfork" >&5
+$as_echo_n "checking for working vfork... " >&6; }
+if test "${ac_cv_func_vfork_works+set}" = set; then :
+  $as_echo_n "(cached) " >&6
 else
-  if test "$cross_compiling" = yes; then
+  if test "$cross_compiling" = yes; then :
   ac_cv_func_vfork_works=cross
 else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 /* Thanks to Paul Eggert for this test.  */
 $ac_includes_default
@@ -14671,224 +13002,62 @@ main ()
   }
 }
 _ACEOF
-rm -f conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_link") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+if ac_fn_c_try_run "$LINENO"; then :
   ac_cv_func_vfork_works=yes
 else
-  echo "$as_me: program exited with status $ac_status" >&5
-echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-( exit $ac_status )
-ac_cv_func_vfork_works=no
+  ac_cv_func_vfork_works=no
 fi
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
 fi
 
-
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_func_vfork_works" >&5
-echo "${ECHO_T}$ac_cv_func_vfork_works" >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_vfork_works" >&5
+$as_echo "$ac_cv_func_vfork_works" >&6; }
 
 fi;
 if test "x$ac_cv_func_fork_works" = xcross; then
   ac_cv_func_vfork_works=$ac_cv_func_vfork
-  { echo "$as_me:$LINENO: WARNING: result $ac_cv_func_vfork_works guessed because of cross compilation" >&5
-echo "$as_me: WARNING: result $ac_cv_func_vfork_works guessed because of cross compilation" >&2;}
+  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: result $ac_cv_func_vfork_works guessed because of cross compilation" >&5
+$as_echo "$as_me: WARNING: result $ac_cv_func_vfork_works guessed because of cross compilation" >&2;}
 fi
 
 if test "x$ac_cv_func_vfork_works" = xyes; then
 
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_WORKING_VFORK 1
-_ACEOF
+$as_echo "#define HAVE_WORKING_VFORK 1" >>confdefs.h
 
 else
 
-cat >>confdefs.h <<\_ACEOF
-#define vfork fork
-_ACEOF
+$as_echo "#define vfork fork" >>confdefs.h
 
 fi
 if test "x$ac_cv_func_fork_works" = xyes; then
 
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_WORKING_FORK 1
-_ACEOF
+$as_echo "#define HAVE_WORKING_FORK 1" >>confdefs.h
 
 fi
 
-
 for ac_header in stdlib.h
-do
-as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-else
-  # Is the header compilable?
-{ echo "$as_me:$LINENO: checking $ac_header usability" >&5
-echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ echo "$as_me:$LINENO: checking $ac_header presence" >&5
-echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <$ac_header>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6; }
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
-
-    ;;
-esac
-{ echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
+do :
+  ac_fn_c_check_header_mongrel "$LINENO" "stdlib.h" "ac_cv_header_stdlib_h" "$ac_includes_default"
+if test "x$ac_cv_header_stdlib_h" = x""yes; then :
   cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+#define HAVE_STDLIB_H 1
 _ACEOF
 
 fi
 
 done
 
-{ echo "$as_me:$LINENO: checking for GNU libc compatible malloc" >&5
-echo $ECHO_N "checking for GNU libc compatible malloc... $ECHO_C" >&6; }
-if test "${ac_cv_func_malloc_0_nonnull+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU libc compatible malloc" >&5
+$as_echo_n "checking for GNU libc compatible malloc... " >&6; }
+if test "${ac_cv_func_malloc_0_nonnull+set}" = set; then :
+  $as_echo_n "(cached) " >&6
 else
-  if test "$cross_compiling" = yes; then
+  if test "$cross_compiling" = yes; then :
   ac_cv_func_malloc_0_nonnull=no
 else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 #if defined STDC_HEADERS || defined HAVE_STDLIB_H
 # include <stdlib.h>
@@ -14904,52 +13073,24 @@ return ! malloc (0);
   return 0;
 }
 _ACEOF
-rm -f conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_link") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+if ac_fn_c_try_run "$LINENO"; then :
   ac_cv_func_malloc_0_nonnull=yes
 else
-  echo "$as_me: program exited with status $ac_status" >&5
-echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-( exit $ac_status )
-ac_cv_func_malloc_0_nonnull=no
+  ac_cv_func_malloc_0_nonnull=no
 fi
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
 fi
 
-
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_func_malloc_0_nonnull" >&5
-echo "${ECHO_T}$ac_cv_func_malloc_0_nonnull" >&6; }
-if test $ac_cv_func_malloc_0_nonnull = yes; then
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_malloc_0_nonnull" >&5
+$as_echo "$ac_cv_func_malloc_0_nonnull" >&6; }
+if test $ac_cv_func_malloc_0_nonnull = yes; then :
 
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_MALLOC 1
-_ACEOF
+$as_echo "#define HAVE_MALLOC 1" >>confdefs.h
 
 else
-  cat >>confdefs.h <<\_ACEOF
-#define HAVE_MALLOC 0
-_ACEOF
+  $as_echo "#define HAVE_MALLOC 0" >>confdefs.h
 
    case " $LIBOBJS " in
   *" malloc.$ac_objext "* ) ;;
@@ -14958,27 +13099,20 @@ _ACEOF
 esac
 
 
-cat >>confdefs.h <<\_ACEOF
-#define malloc rpl_malloc
-_ACEOF
+$as_echo "#define malloc rpl_malloc" >>confdefs.h
 
 fi
 
 
-
-{ echo "$as_me:$LINENO: checking for working memcmp" >&5
-echo $ECHO_N "checking for working memcmp... $ECHO_C" >&6; }
-if test "${ac_cv_func_memcmp_working+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for working memcmp" >&5
+$as_echo_n "checking for working memcmp... " >&6; }
+if test "${ac_cv_func_memcmp_working+set}" = set; then :
+  $as_echo_n "(cached) " >&6
 else
-  if test "$cross_compiling" = yes; then
+  if test "$cross_compiling" = yes; then :
   ac_cv_func_memcmp_working=no
 else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 $ac_includes_default
 int
@@ -15013,42 +13147,18 @@ main ()
   return 0;
 }
 _ACEOF
-rm -f conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_link") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+if ac_fn_c_try_run "$LINENO"; then :
   ac_cv_func_memcmp_working=yes
 else
-  echo "$as_me: program exited with status $ac_status" >&5
-echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-( exit $ac_status )
-ac_cv_func_memcmp_working=no
+  ac_cv_func_memcmp_working=no
 fi
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
 fi
 
-
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_func_memcmp_working" >&5
-echo "${ECHO_T}$ac_cv_func_memcmp_working" >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_memcmp_working" >&5
+$as_echo "$ac_cv_func_memcmp_working" >&6; }
 test $ac_cv_func_memcmp_working = no && case " $LIBOBJS " in
   *" memcmp.$ac_objext "* ) ;;
   *) LIBOBJS="$LIBOBJS memcmp.$ac_objext"
@@ -15056,160 +13166,28 @@ test $ac_cv_func_memcmp_working = no && case " $LIBOBJS " in
 esac
 
 
-
-
 for ac_header in sys/select.h sys/socket.h
-do
-as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-else
-  # Is the header compilable?
-{ echo "$as_me:$LINENO: checking $ac_header usability" >&5
-echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ echo "$as_me:$LINENO: checking $ac_header presence" >&5
-echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <$ac_header>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6; }
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
-
-    ;;
-esac
-{ echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
+do :
+  as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
   cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
 _ACEOF
 
 fi
 
 done
 
-{ echo "$as_me:$LINENO: checking types of arguments for select" >&5
-echo $ECHO_N "checking types of arguments for select... $ECHO_C" >&6; }
-if test "${ac_cv_func_select_args+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking types of arguments for select" >&5
+$as_echo_n "checking types of arguments for select... " >&6; }
+if test "${ac_cv_func_select_args+set}" = set; then :
+  $as_echo_n "(cached) " >&6
 else
   for ac_arg234 in 'fd_set *' 'int *' 'void *'; do
  for ac_arg1 in 'int' 'size_t' 'unsigned long int' 'unsigned int'; do
   for ac_arg5 in 'struct timeval *' 'const struct timeval *'; do
-   cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 $ac_includes_default
 #ifdef HAVE_SYS_SELECT_H
@@ -15229,31 +13207,9 @@ extern int select ($ac_arg1,
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
+if ac_fn_c_try_compile "$LINENO"; then :
   ac_cv_func_select_args="$ac_arg1,$ac_arg234,$ac_arg5"; break 3
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
 fi
-
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
   done
  done
@@ -15262,8 +13218,8 @@ done
 : ${ac_cv_func_select_args='int,int *,struct timeval *'}
 
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_func_select_args" >&5
-echo "${ECHO_T}$ac_cv_func_select_args" >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_select_args" >&5
+$as_echo "$ac_cv_func_select_args" >&6; }
 ac_save_IFS=$IFS; IFS=','
 set dummy `echo "$ac_cv_func_select_args" | sed 's/\*/\*/g'`
 IFS=$ac_save_IFS
@@ -15285,16 +13241,12 @@ _ACEOF
 
 rm -f conftest*
 
-{ echo "$as_me:$LINENO: checking return type of signal handlers" >&5
-echo $ECHO_N "checking return type of signal handlers... $ECHO_C" >&6; }
-if test "${ac_cv_type_signal+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking return type of signal handlers" >&5
+$as_echo_n "checking return type of signal handlers... " >&6; }
+if test "${ac_cv_type_signal+set}" = set; then :
+  $as_echo_n "(cached) " >&6
 else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 #include <sys/types.h>
 #include <signal.h>
@@ -15307,138 +13259,34 @@ return *(signal (0, 0)) (0) == 1;
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
+if ac_fn_c_try_compile "$LINENO"; then :
   ac_cv_type_signal=int
 else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_cv_type_signal=void
+  ac_cv_type_signal=void
 fi
-
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_type_signal" >&5
-echo "${ECHO_T}$ac_cv_type_signal" >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_type_signal" >&5
+$as_echo "$ac_cv_type_signal" >&6; }
 
 cat >>confdefs.h <<_ACEOF
 #define RETSIGTYPE $ac_cv_type_signal
 _ACEOF
 
 
-
-
 for ac_func in memset select
-do
-as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
-{ echo "$as_me:$LINENO: checking for $ac_func" >&5
-echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; }
-if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
-   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
-#define $ac_func innocuous_$ac_func
-
-/* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char $ac_func (); below.
-    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
-    <limits.h> exists even on freestanding compilers.  */
-
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-
-#undef $ac_func
-
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char $ac_func ();
-/* The GNU C library defines this for functions which it implements
-    to always fail with ENOSYS.  Some functions are actually named
-    something starting with __ and the normal name is an alias.  */
-#if defined __stub_$ac_func || defined __stub___$ac_func
-choke me
-#endif
-
-int
-main ()
-{
-return $ac_func ();
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
-  eval "$as_ac_var=yes"
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       eval "$as_ac_var=no"
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-fi
-ac_res=`eval echo '${'$as_ac_var'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-if test `eval echo '${'$as_ac_var'}'` = yes; then
+do :
+  as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
+if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
   cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
 _ACEOF
 
 fi
 done
 
-#server/plugin/mp3/Makefile
-ac_config_files="$ac_config_files Makefile server/Makefile server/plugin/Makefile server/plugin/wav/Makefile server/plugin/wav_new/Makefile server/plugin/keytone/Makefile server/plugin/headset/Makefile pkgconfig/Makefile pkgconfig/mm-sound.pc testsuite/Makefile"
+ac_config_files="$ac_config_files common/Makefile Makefile server/Makefile server/plugin/Makefile server/plugin/wav/Makefile server/plugin/keytone/Makefile server/plugin/headset/Makefile server/plugin/tone/Makefile pkgconfig/Makefile pkgconfig/mm-sound.pc pkgconfig/mm-keysound.pc pkgconfig-sdk/Makefile pkgconfig-sdk/mm-sound.pc pkgconfig-sdk/mm-keysound.pc testsuite/Makefile init/Makefile"
 
 cat >confcache <<\_ACEOF
 # This file is a shell script that caches the results of configure
@@ -15467,12 +13315,13 @@ _ACEOF
     case $ac_val in #(
     *${as_nl}*)
       case $ac_var in #(
-      *_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5
-echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;;
+      *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5
+$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
       esac
       case $ac_var in #(
       _ | IFS | as_nl) ;; #(
-      *) $as_unset $ac_var ;;
+      BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #(
+      *) { eval $ac_var=; unset $ac_var;} ;;
       esac ;;
     esac
   done
@@ -15480,8 +13329,8 @@ echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;;
   (set) 2>&1 |
     case $as_nl`(ac_space=' '; set) 2>&1` in #(
     *${as_nl}ac_space=\ *)
-      # `set' does not quote correctly, so add quotes (double-quote
-      # substitution turns \\\\ into \\, and sed turns \\ into \).
+      # `set' does not quote correctly, so add quotesdouble-quote
+      # substitution turns \\\\ into \\, and sed turns \\ into \.
       sed -n \
        "s/'/'\\\\''/g;
          s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p"
@@ -15504,12 +13353,12 @@ echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;;
 if diff "$cache_file" confcache >/dev/null 2>&1; then :; else
   if test -w "$cache_file"; then
     test "x$cache_file" != "x/dev/null" &&
-      { echo "$as_me:$LINENO: updating cache $cache_file" >&5
-echo "$as_me: updating cache $cache_file" >&6;}
+      { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5
+$as_echo "$as_me: updating cache $cache_file" >&6;}
     cat confcache >$cache_file
   else
-    { echo "$as_me:$LINENO: not updating unwritable cache $cache_file" >&5
-echo "$as_me: not updating unwritable cache $cache_file" >&6;}
+    { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5
+$as_echo "$as_me: not updating unwritable cache $cache_file" >&6;}
   fi
 fi
 rm -f confcache
@@ -15522,55 +13371,54 @@ DEFS=-DHAVE_CONFIG_H
 
 ac_libobjs=
 ac_ltlibobjs=
+U=
 for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue
   # 1. Remove the extension, and $U if already installed.
   ac_script='s/\$U\././;s/\.o$//;s/\.obj$//'
-  ac_i=`echo "$ac_i" | sed "$ac_script"`
+  ac_i=`$as_echo "$ac_i" | sed "$ac_script"`
   # 2. Prepend LIBOBJDIR.  When used with automake>=1.10 LIBOBJDIR
   #    will be set to the directory where LIBOBJS objects are built.
-  ac_libobjs="$ac_libobjs \${LIBOBJDIR}$ac_i\$U.$ac_objext"
-  ac_ltlibobjs="$ac_ltlibobjs \${LIBOBJDIR}$ac_i"'$U.lo'
+  as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext"
+  as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo'
 done
 LIBOBJS=$ac_libobjs
 
 LTLIBOBJS=$ac_ltlibobjs
 
 
+ if test -n "$EXEEXT"; then
+  am__EXEEXT_TRUE=
+  am__EXEEXT_FALSE='#'
+else
+  am__EXEEXT_TRUE='#'
+  am__EXEEXT_FALSE=
+fi
+
 if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then
-  { { echo "$as_me:$LINENO: error: conditional \"AMDEP\" was never defined.
-Usually this means the macro was only invoked conditionally." >&5
-echo "$as_me: error: conditional \"AMDEP\" was never defined.
-Usually this means the macro was only invoked conditionally." >&2;}
-   { (exit 1); exit 1; }; }
+  as_fn_error $? "conditional \"AMDEP\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
 if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then
-  { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCC\" was never defined.
-Usually this means the macro was only invoked conditionally." >&5
-echo "$as_me: error: conditional \"am__fastdepCC\" was never defined.
-Usually this means the macro was only invoked conditionally." >&2;}
-   { (exit 1); exit 1; }; }
-fi
-if test -z "${IS_AQUILA_TRUE}" && test -z "${IS_AQUILA_FALSE}"; then
-  { { echo "$as_me:$LINENO: error: conditional \"IS_AQUILA\" was never defined.
-Usually this means the macro was only invoked conditionally." >&5
-echo "$as_me: error: conditional \"IS_AQUILA\" was never defined.
-Usually this means the macro was only invoked conditionally." >&2;}
-   { (exit 1); exit 1; }; }
+  as_fn_error $? "conditional \"am__fastdepCC\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
 if test -z "${IS_SDK_TRUE}" && test -z "${IS_SDK_FALSE}"; then
-  { { echo "$as_me:$LINENO: error: conditional \"IS_SDK\" was never defined.
-Usually this means the macro was only invoked conditionally." >&5
-echo "$as_me: error: conditional \"IS_SDK\" was never defined.
-Usually this means the macro was only invoked conditionally." >&2;}
-   { (exit 1); exit 1; }; }
+  as_fn_error $? "conditional \"IS_SDK\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${USE_PULSE_TRUE}" && test -z "${USE_PULSE_FALSE}"; then
+  as_fn_error $? "conditional \"USE_PULSE\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
 
 : ${CONFIG_STATUS=./config.status}
+ac_write_fail=0
 ac_clean_files_save=$ac_clean_files
 ac_clean_files="$ac_clean_files $CONFIG_STATUS"
-{ echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5
-echo "$as_me: creating $CONFIG_STATUS" >&6;}
-cat >$CONFIG_STATUS <<_ACEOF
+{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5
+$as_echo "$as_me: creating $CONFIG_STATUS" >&6;}
+as_write_fail=0
+cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1
 #! $SHELL
 # Generated by $as_me.
 # Run this file to recreate the current configuration.
@@ -15580,59 +13428,79 @@ cat >$CONFIG_STATUS <<_ACEOF
 debug=false
 ac_cs_recheck=false
 ac_cs_silent=false
-SHELL=\${CONFIG_SHELL-$SHELL}
-_ACEOF
 
-cat >>$CONFIG_STATUS <<\_ACEOF
-## --------------------- ##
-## M4sh Initialization.  ##
-## --------------------- ##
+SHELL=\${CONFIG_SHELL-$SHELL}
+export SHELL
+_ASEOF
+cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1
+## -------------------- ##
+## M4sh Initialization. ##
+## -------------------- ##
 
 # Be more Bourne compatible
 DUALCASE=1; export DUALCASE # for MKS sh
-if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then :
   emulate sh
   NULLCMD=:
-  # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
+  # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
   # is contrary to our usage.  Disable this feature.
   alias -g '${1+"$@"}'='"$@"'
   setopt NO_GLOB_SUBST
 else
-  case `(set -o) 2>/dev/null` in
-  *posix*) set -o posix ;;
+  case `(set -o) 2>/dev/null` in #(
+  *posix*) :
+    set -o posix ;; #(
+  *) :
+     ;;
 esac
-
 fi
 
 
-
-
-# PATH needs CR
-# Avoid depending upon Character Ranges.
-as_cr_letters='abcdefghijklmnopqrstuvwxyz'
-as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
-as_cr_Letters=$as_cr_letters$as_cr_LETTERS
-as_cr_digits='0123456789'
-as_cr_alnum=$as_cr_Letters$as_cr_digits
-
-# The user is always right.
-if test "${PATH_SEPARATOR+set}" != set; then
-  echo "#! /bin/sh" >conf$$.sh
-  echo  "exit 0"   >>conf$$.sh
-  chmod +x conf$$.sh
-  if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
-    PATH_SEPARATOR=';'
+as_nl='
+'
+export as_nl
+# Printing a long string crashes Solaris 7 /usr/bin/printf.
+as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
+as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo
+as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo
+# Prefer a ksh shell builtin over an external printf program on Solaris,
+# but without wasting forks for bash or zsh.
+if test -z "$BASH_VERSION$ZSH_VERSION" \
+    && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then
+  as_echo='print -r --'
+  as_echo_n='print -rn --'
+elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
+  as_echo='printf %s\n'
+  as_echo_n='printf %s'
+else
+  if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then
+    as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"'
+    as_echo_n='/usr/ucb/echo -n'
   else
-    PATH_SEPARATOR=:
+    as_echo_body='eval expr "X$1" : "X\\(.*\\)"'
+    as_echo_n_body='eval
+      arg=$1;
+      case $arg in #(
+      *"$as_nl"*)
+       expr "X$arg" : "X\\(.*\\)$as_nl";
+       arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;;
+      esac;
+      expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl"
+    '
+    export as_echo_n_body
+    as_echo_n='sh -c $as_echo_n_body as_echo'
   fi
-  rm -f conf$$.sh
+  export as_echo_body
+  as_echo='sh -c $as_echo_body as_echo'
 fi
 
-# Support unset when possible.
-if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
-  as_unset=unset
-else
-  as_unset=false
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+  PATH_SEPARATOR=:
+  (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
+    (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
+      PATH_SEPARATOR=';'
+  }
 fi
 
 
 # there to prevent editors from complaining about space-tab.
 # (If _AS_PATH_WALK were called with IFS unset, it would disable word
 # splitting by setting IFS to empty value.)
-as_nl='
-'
 IFS=" ""       $as_nl"
 
 # Find who we are.  Look in the path if we contain no directory separator.
-case $0 in
+case $0 in #((
   *[\\/]* ) as_myself=$0 ;;
   *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
 for as_dir in $PATH
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
-done
+    test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+  done
 IFS=$as_save_IFS
 
      ;;
@@ -15665,113 +13531,123 @@ if test "x$as_myself" = x; then
   as_myself=$0
 fi
 if test ! -f "$as_myself"; then
-  echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
-  { (exit 1); exit 1; }
+  $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
+  exit 1
 fi
 
-# Work around bugs in pre-3.0 UWIN ksh.
-for as_var in ENV MAIL MAILPATH
-do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
+# Unset variables that we do not need and which cause bugs (e.g. in
+# pre-3.0 UWIN ksh).  But do not cause bugs in bash 2.01; the "|| exit 1"
+# suppresses any "Segmentation fault" message there.  '((' could
+# trigger a bug in pdksh 5.2.14.
+for as_var in BASH_ENV ENV MAIL MAILPATH
+do eval test x\${$as_var+set} = xset \
+  && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || :
 done
 PS1='$ '
 PS2='> '
 PS4='+ '
 
 # NLS nuisances.
-for as_var in \
-  LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
-  LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
-  LC_TELEPHONE LC_TIME
-do
-  if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
-    eval $as_var=C; export $as_var
-  else
-    ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
-  fi
-done
-
-# Required to use basename.
-if expr a : '\(a\)' >/dev/null 2>&1 &&
-   test "X`expr 00001 : '.*\(...\)'`" = X001; then
-  as_expr=expr
-else
-  as_expr=false
-fi
-
-if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
-  as_basename=basename
-else
-  as_basename=false
-fi
-
-
-# Name of the executable.
-as_me=`$as_basename -- "$0" ||
-$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
-        X"$0" : 'X\(//\)$' \| \
-        X"$0" : 'X\(/\)' \| . 2>/dev/null ||
-echo X/"$0" |
-    sed '/^.*\/\([^/][^/]*\)\/*$/{
-           s//\1/
-           q
-         }
-         /^X\/\(\/\/\)$/{
-           s//\1/
-           q
-         }
-         /^X\/\(\/\).*/{
-           s//\1/
-           q
-         }
-         s/.*/./; q'`
+LC_ALL=C
+export LC_ALL
+LANGUAGE=C
+export LANGUAGE
 
 # CDPATH.
-$as_unset CDPATH
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
 
 
+# as_fn_error STATUS ERROR [LINENO LOG_FD]
+# ----------------------------------------
+# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are
+# provided, also output the error to LOG_FD, referencing LINENO. Then exit the
+# script with STATUS, using 1 if that was 0.
+as_fn_error ()
+{
+  as_status=$1; test $as_status -eq 0 && as_status=1
+  if test "$4"; then
+    as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+    $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4
+  fi
+  $as_echo "$as_me: error: $2" >&2
+  as_fn_exit $as_status
+} # as_fn_error
 
-  as_lineno_1=$LINENO
-  as_lineno_2=$LINENO
-  test "x$as_lineno_1" != "x$as_lineno_2" &&
-  test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || {
 
-  # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
-  # uniformly replaced by the line number.  The first 'sed' inserts a
-  # line-number line after each line using $LINENO; the second 'sed'
-  # does the real work.  The second script uses 'N' to pair each
-  # line-number line with the line containing $LINENO, and appends
-  # trailing '-' during substitution so that $LINENO is not a special
-  # case at line end.
-  # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
-  # scripts with optimization help from Paolo Bonzini.  Blame Lee
-  # E. McMahon (1931-1989) for sed's syntax.  :-)
-  sed -n '
-    p
-    /[$]LINENO/=
-  ' <$as_myself |
-    sed '
-      s/[$]LINENO.*/&-/
-      t lineno
-      b
-      :lineno
-      N
-      :loop
-      s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/
-      t loop
-      s/-\n.*//
-    ' >$as_me.lineno &&
-  chmod +x "$as_me.lineno" ||
-    { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2
-   { (exit 1); exit 1; }; }
+# as_fn_set_status STATUS
+# -----------------------
+# Set $? to STATUS, without forking.
+as_fn_set_status ()
+{
+  return $1
+} # as_fn_set_status
 
-  # Don't try to exec as it changes $[0], causing all sort of problems
-  # (the dirname of $[0] is not the place where we might find the
-  # original and so on.  Autoconf is especially sensitive to this).
-  . "./$as_me.lineno"
-  # Exit status is that of the last command.
-  exit
+# as_fn_exit STATUS
+# -----------------
+# Exit the shell with STATUS, even in a "trap 0" or "set -e" context.
+as_fn_exit ()
+{
+  set +e
+  as_fn_set_status $1
+  exit $1
+} # as_fn_exit
+
+# as_fn_unset VAR
+# ---------------
+# Portably unset VAR.
+as_fn_unset ()
+{
+  { eval $1=; unset $1;}
 }
+as_unset=as_fn_unset
+# as_fn_append VAR VALUE
+# ----------------------
+# Append the text in VALUE to the end of the definition contained in VAR. Take
+# advantage of any shell optimizations that allow amortized linear growth over
+# repeated appends, instead of the typical quadratic growth present in naive
+# implementations.
+if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then :
+  eval 'as_fn_append ()
+  {
+    eval $1+=\$2
+  }'
+else
+  as_fn_append ()
+  {
+    eval $1=\$$1\$2
+  }
+fi # as_fn_append
+
+# as_fn_arith ARG...
+# ------------------
+# Perform arithmetic evaluation on the ARGs, and store the result in the
+# global $as_val. Take advantage of shells that can avoid forks. The arguments
+# must be portable across $(()) and expr.
+if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then :
+  eval 'as_fn_arith ()
+  {
+    as_val=$(( $* ))
+  }'
+else
+  as_fn_arith ()
+  {
+    as_val=`expr "$@" || test $? -eq 1`
+  }
+fi # as_fn_arith
+
+
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+   test "X`expr 00001 : '.*\(...\)'`" = X001; then
+  as_expr=expr
+else
+  as_expr=false
+fi
 
+if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
+  as_basename=basename
+else
+  as_basename=false
+fi
 
 if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
   as_dirname=dirname
@@ -15779,50 +13655,122 @@ else
   as_dirname=false
 fi
 
+as_me=`$as_basename -- "$0" ||
+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
+        X"$0" : 'X\(//\)$' \| \
+        X"$0" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X/"$0" |
+    sed '/^.*\/\([^/][^/]*\)\/*$/{
+           s//\1/
+           q
+         }
+         /^X\/\(\/\/\)$/{
+           s//\1/
+           q
+         }
+         /^X\/\(\/\).*/{
+           s//\1/
+           q
+         }
+         s/.*/./; q'`
+
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
+
 ECHO_C= ECHO_N= ECHO_T=
-case `echo -n x` in
+case `echo -n x` in #(((((
 -n*)
-  case `echo 'x\c'` in
+  case `echo 'xy\c'` in
   *c*) ECHO_T='        ';;     # ECHO_T is single tab character.
-  *)   ECHO_C='\c';;
+  xy)  ECHO_C='\c';;
+  *)   echo `echo ksh88 bug on AIX 6.1` > /dev/null
+       ECHO_T='        ';;
   esac;;
 *)
   ECHO_N='-n';;
 esac
 
-if expr a : '\(a\)' >/dev/null 2>&1 &&
-   test "X`expr 00001 : '.*\(...\)'`" = X001; then
-  as_expr=expr
-else
-  as_expr=false
-fi
-
 rm -f conf$$ conf$$.exe conf$$.file
 if test -d conf$$.dir; then
   rm -f conf$$.dir/conf$$.file
 else
   rm -f conf$$.dir
-  mkdir conf$$.dir
-fi
-echo >conf$$.file
-if ln -s conf$$.file conf$$ 2>/dev/null; then
-  as_ln_s='ln -s'
-  # ... but there are two gotchas:
-  # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
-  # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
-  # In both cases, we have to default to `cp -p'.
-  ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
+  mkdir conf$$.dir 2>/dev/null
+fi
+if (echo >conf$$.file) 2>/dev/null; then
+  if ln -s conf$$.file conf$$ 2>/dev/null; then
+    as_ln_s='ln -s'
+    # ... but there are two gotchas:
+    # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
+    # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
+    # In both cases, we have to default to `cp -p'.
+    ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
+      as_ln_s='cp -p'
+  elif ln conf$$.file conf$$ 2>/dev/null; then
+    as_ln_s=ln
+  else
     as_ln_s='cp -p'
-elif ln conf$$.file conf$$ 2>/dev/null; then
-  as_ln_s=ln
+  fi
 else
   as_ln_s='cp -p'
 fi
 rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
 rmdir conf$$.dir 2>/dev/null
 
+
+# as_fn_mkdir_p
+# -------------
+# Create "$as_dir" as a directory, including parents if necessary.
+as_fn_mkdir_p ()
+{
+
+  case $as_dir in #(
+  -*) as_dir=./$as_dir;;
+  esac
+  test -d "$as_dir" || eval $as_mkdir_p || {
+    as_dirs=
+    while :; do
+      case $as_dir in #(
+      *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'(
+      *) as_qdir=$as_dir;;
+      esac
+      as_dirs="'$as_qdir' $as_dirs"
+      as_dir=`$as_dirname -- "$as_dir" ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+        X"$as_dir" : 'X\(//\)[^/]' \| \
+        X"$as_dir" : 'X\(//\)$' \| \
+        X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$as_dir" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+           s//\1/
+           q
+         }
+         /^X\(\/\/\)[^/].*/{
+           s//\1/
+           q
+         }
+         /^X\(\/\/\)$/{
+           s//\1/
+           q
+         }
+         /^X\(\/\).*/{
+           s//\1/
+           q
+         }
+         s/.*/./; q'`
+      test -d "$as_dir" && break
+    done
+    test -z "$as_dirs" || eval "mkdir $as_dirs"
+  } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir"
+
+
+} # as_fn_mkdir_p
 if mkdir -p . 2>/dev/null; then
-  as_mkdir_p=:
+  as_mkdir_p='mkdir -p "$as_dir"'
 else
   test -d ./-p && rmdir ./-p
   as_mkdir_p=false
@@ -15839,12 +13787,12 @@ else
   as_test_x='
     eval sh -c '\''
       if test -d "$1"; then
-        test -d "$1/.";
+       test -d "$1/.";
       else
-       case $1 in
-        -*)set "./$1";;
+       case $1 in #(
+       -*)set "./$1";;
        esac;
-       case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in
+       case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #((
        ???[sx]*):;;*)false;;esac;fi
     '\'' sh
   '
@@ -15859,13 +13807,19 @@ as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
 
 
 exec 6>&1
+## ----------------------------------- ##
+## Main body of $CONFIG_STATUS script. ##
+## ----------------------------------- ##
+_ASEOF
+test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1
 
-# Save the log message, to keep $[0] and so on meaningful, and to
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+# Save the log message, to keep $0 and so on meaningful, and to
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
 This file was extended by avsystem $as_me 1.0, which was
-generated by GNU Autoconf 2.61.  Invocation command line was
+generated by GNU Autoconf 2.67.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
   CONFIG_HEADERS  = $CONFIG_HEADERS
@@ -15878,7 +13832,16 @@ on `(hostname || uname -n) 2>/dev/null | sed 1q`
 
 _ACEOF
 
-cat >>$CONFIG_STATUS <<_ACEOF
+case $ac_config_files in *"
+"*) set x $ac_config_files; shift; ac_config_files=$*;;
+esac
+
+case $ac_config_headers in *"
+"*) set x $ac_config_headers; shift; ac_config_headers=$*;;
+esac
+
+
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 # Files that config.status was made for.
 config_files="$ac_config_files"
 config_headers="$ac_config_headers"
@@ -15886,22 +13849,25 @@ config_commands="$ac_config_commands"
 
 _ACEOF
 
-cat >>$CONFIG_STATUS <<\_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 ac_cs_usage="\
-\`$as_me' instantiates files from templates according to the
-current configuration.
+\`$as_me' instantiates files and other configuration actions
+from templates according to the current configuration.  Unless the files
+and actions are specified as TAGs, all are instantiated by default.
 
-Usage: $0 [OPTIONS] [FILE]...
+Usage: $0 [OPTION]... [TAG]...
 
   -h, --help       print this help, then exit
   -V, --version    print version number and configuration settings, then exit
-  -q, --quiet      do not print progress messages
+      --config     print configuration, then exit
+  -q, --quiet, --silent
+                   do not print progress messages
   -d, --debug      don't remove temporary files
       --recheck    update $as_me by reconfiguring in the same conditions
-  --file=FILE[:TEMPLATE]
-                  instantiate the configuration file FILE
-  --header=FILE[:TEMPLATE]
-                  instantiate the configuration header FILE
+      --file=FILE[:TEMPLATE]
+                   instantiate the configuration file FILE
+      --header=FILE[:TEMPLATE]
+                   instantiate the configuration header FILE
 
 Configuration files:
 $config_files
@@ -15912,16 +13878,17 @@ $config_headers
 Configuration commands:
 $config_commands
 
-Report bugs to <bug-autoconf@gnu.org>."
+Report bugs to the package provider."
 
 _ACEOF
-cat >>$CONFIG_STATUS <<_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
 avsystem config.status 1.0
-configured by $0, generated by GNU Autoconf 2.61,
-  with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
+configured by $0, generated by GNU Autoconf 2.67,
+  with options \\"\$ac_cs_config\\"
 
-Copyright (C) 2006 Free Software Foundation, Inc.
+Copyright (C) 2010 Free Software Foundation, Inc.
 This config.status script is free software; the Free Software Foundation
 gives unlimited permission to copy, distribute and modify it."
 
@@ -15929,20 +13896,26 @@ ac_pwd='$ac_pwd'
 srcdir='$srcdir'
 INSTALL='$INSTALL'
 MKDIR_P='$MKDIR_P'
+AWK='$AWK'
+test -n "\$AWK" || AWK=awk
 _ACEOF
 
-cat >>$CONFIG_STATUS <<\_ACEOF
-# If no file are specified by the user, then we need to provide default
-# value.  By we need to know if files were specified by the user.
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+# The default lists apply if the user does not specify any file.
 ac_need_defaults=:
 while test $# != 0
 do
   case $1 in
-  --*=*)
+  --*=?*)
     ac_option=`expr "X$1" : 'X\([^=]*\)='`
     ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'`
     ac_shift=:
     ;;
+  --*=)
+    ac_option=`expr "X$1" : 'X\([^=]*\)='`
+    ac_optarg=
+    ac_shift=:
+    ;;
   *)
     ac_option=$1
     ac_optarg=$2
   -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
     ac_cs_recheck=: ;;
   --version | --versio | --versi | --vers | --ver | --ve | --v | -V )
-    echo "$ac_cs_version"; exit ;;
+    $as_echo "$ac_cs_version"; exit ;;
+  --config | --confi | --conf | --con | --co | --c )
+    $as_echo "$ac_cs_config"; exit ;;
   --debug | --debu | --deb | --de | --d | -d )
     debug=: ;;
   --file | --fil | --fi | --f )
     $ac_shift
-    CONFIG_FILES="$CONFIG_FILES $ac_optarg"
+    case $ac_optarg in
+    *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;;
+    '') as_fn_error $? "missing file argument" ;;
+    esac
+    as_fn_append CONFIG_FILES " '$ac_optarg'"
     ac_need_defaults=false;;
   --header | --heade | --head | --hea )
     $ac_shift
-    CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg"
+    case $ac_optarg in
+    *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;;
+    esac
+    as_fn_append CONFIG_HEADERS " '$ac_optarg'"
     ac_need_defaults=false;;
   --he | --h)
     # Conflict between --help and --header
-    { echo "$as_me: error: ambiguous option: $1
-Try \`$0 --help' for more information." >&2
-   { (exit 1); exit 1; }; };;
+    as_fn_error $? "ambiguous option: \`$1'
+Try \`$0 --help' for more information.";;
   --help | --hel | -h )
-    echo "$ac_cs_usage"; exit ;;
+    $as_echo "$ac_cs_usage"; exit ;;
   -q | -quiet | --quiet | --quie | --qui | --qu | --q \
   | -silent | --silent | --silen | --sile | --sil | --si | --s)
     ac_cs_silent=: ;;
 
   # This is an error.
-  -*) { echo "$as_me: error: unrecognized option: $1
-Try \`$0 --help' for more information." >&2
-   { (exit 1); exit 1; }; } ;;
+  -*) as_fn_error $? "unrecognized option: \`$1'
+Try \`$0 --help' for more information." ;;
 
-  *) ac_config_targets="$ac_config_targets $1"
+  *) as_fn_append ac_config_targets " $1"
      ac_need_defaults=false ;;
 
   esac
@@ -15997,27 +13977,29 @@ if $ac_cs_silent; then
 fi
 
 _ACEOF
-cat >>$CONFIG_STATUS <<_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 if \$ac_cs_recheck; then
-  echo "running CONFIG_SHELL=$SHELL $SHELL $0 "$ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6
-  CONFIG_SHELL=$SHELL
+  set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
+  shift
+  \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6
+  CONFIG_SHELL='$SHELL'
   export CONFIG_SHELL
-  exec $SHELL "$0"$ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
+  exec "\$@"
 fi
 
 _ACEOF
-cat >>$CONFIG_STATUS <<\_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 exec 5>>config.log
 {
   echo
   sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
 ## Running $as_me. ##
 _ASBOX
-  echo "$ac_log"
+  $as_echo "$ac_log"
 } >&5
 
 _ACEOF
-cat >>$CONFIG_STATUS <<_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 #
 # INIT-COMMANDS
 #
@@ -16059,6 +14041,7 @@ lt_SP2NL='`$ECHO "X$lt_SP2NL" | $Xsed -e "$delay_single_quote_subst"`'
 lt_NL2SP='`$ECHO "X$lt_NL2SP" | $Xsed -e "$delay_single_quote_subst"`'
 reload_flag='`$ECHO "X$reload_flag" | $Xsed -e "$delay_single_quote_subst"`'
 reload_cmds='`$ECHO "X$reload_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+OBJDUMP='`$ECHO "X$OBJDUMP" | $Xsed -e "$delay_single_quote_subst"`'
 deplibs_check_method='`$ECHO "X$deplibs_check_method" | $Xsed -e "$delay_single_quote_subst"`'
 file_magic_cmd='`$ECHO "X$file_magic_cmd" | $Xsed -e "$delay_single_quote_subst"`'
 AR='`$ECHO "X$AR" | $Xsed -e "$delay_single_quote_subst"`'
@@ -16164,6 +14147,7 @@ LN_S \
 lt_SP2NL \
 lt_NL2SP \
 reload_flag \
+OBJDUMP \
 deplibs_check_method \
 file_magic_cmd \
 AR \
@@ -16278,7 +14262,7 @@ fi
 
 _ACEOF
 
-cat >>$CONFIG_STATUS <<\_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 
 # Handling of arguments.
 for ac_config_target in $ac_config_targets
     "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h:config.hin" ;;
     "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;;
     "libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;;
+    "common/Makefile") CONFIG_FILES="$CONFIG_FILES common/Makefile" ;;
     "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
     "server/Makefile") CONFIG_FILES="$CONFIG_FILES server/Makefile" ;;
     "server/plugin/Makefile") CONFIG_FILES="$CONFIG_FILES server/plugin/Makefile" ;;
     "server/plugin/wav/Makefile") CONFIG_FILES="$CONFIG_FILES server/plugin/wav/Makefile" ;;
-    "server/plugin/wav_new/Makefile") CONFIG_FILES="$CONFIG_FILES server/plugin/wav_new/Makefile" ;;
     "server/plugin/keytone/Makefile") CONFIG_FILES="$CONFIG_FILES server/plugin/keytone/Makefile" ;;
     "server/plugin/headset/Makefile") CONFIG_FILES="$CONFIG_FILES server/plugin/headset/Makefile" ;;
+    "server/plugin/tone/Makefile") CONFIG_FILES="$CONFIG_FILES server/plugin/tone/Makefile" ;;
     "pkgconfig/Makefile") CONFIG_FILES="$CONFIG_FILES pkgconfig/Makefile" ;;
     "pkgconfig/mm-sound.pc") CONFIG_FILES="$CONFIG_FILES pkgconfig/mm-sound.pc" ;;
+    "pkgconfig/mm-keysound.pc") CONFIG_FILES="$CONFIG_FILES pkgconfig/mm-keysound.pc" ;;
+    "pkgconfig-sdk/Makefile") CONFIG_FILES="$CONFIG_FILES pkgconfig-sdk/Makefile" ;;
+    "pkgconfig-sdk/mm-sound.pc") CONFIG_FILES="$CONFIG_FILES pkgconfig-sdk/mm-sound.pc" ;;
+    "pkgconfig-sdk/mm-keysound.pc") CONFIG_FILES="$CONFIG_FILES pkgconfig-sdk/mm-keysound.pc" ;;
     "testsuite/Makefile") CONFIG_FILES="$CONFIG_FILES testsuite/Makefile" ;;
+    "init/Makefile") CONFIG_FILES="$CONFIG_FILES init/Makefile" ;;
 
-  *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5
-echo "$as_me: error: invalid argument: $ac_config_target" >&2;}
-   { (exit 1); exit 1; }; };;
+  *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5 ;;
   esac
 done
 
@@ -16327,7 +14315,7 @@ $debug ||
   trap 'exit_status=$?
   { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status
 ' 0
-  trap '{ (exit 1); exit 1; }' 1 2 13 15
+  trap 'as_fn_exit 1' 1 2 13 15
 }
 # Create a (secure) tmp directory for tmp files.
 
@@ -16338,253 +14326,285 @@ $debug ||
 {
   tmp=./conf$$-$RANDOM
   (umask 077 && mkdir "$tmp")
-} ||
-{
-   echo "$me: cannot create a temporary directory in ." >&2
-   { (exit 1); exit 1; }
-}
-
-#
-# Set up the sed scripts for CONFIG_FILES section.
-#
+} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5
 
-# No need to generate the scripts if there are no CONFIG_FILES.
-# This happens for instance when ./config.status config.h
+# Set up the scripts for CONFIG_FILES section.
+# No need to generate them if there are no CONFIG_FILES.
+# This happens for instance with `./config.status config.h'.
 if test -n "$CONFIG_FILES"; then
 
-_ACEOF
-
-
-
-ac_delim='%!_!# '
-for ac_last_try in false false false false false :; do
-  cat >conf$$subs.sed <<_ACEOF
-SHELL!$SHELL$ac_delim
-PATH_SEPARATOR!$PATH_SEPARATOR$ac_delim
-PACKAGE_NAME!$PACKAGE_NAME$ac_delim
-PACKAGE_TARNAME!$PACKAGE_TARNAME$ac_delim
-PACKAGE_VERSION!$PACKAGE_VERSION$ac_delim
-PACKAGE_STRING!$PACKAGE_STRING$ac_delim
-PACKAGE_BUGREPORT!$PACKAGE_BUGREPORT$ac_delim
-exec_prefix!$exec_prefix$ac_delim
-prefix!$prefix$ac_delim
-program_transform_name!$program_transform_name$ac_delim
-bindir!$bindir$ac_delim
-sbindir!$sbindir$ac_delim
-libexecdir!$libexecdir$ac_delim
-datarootdir!$datarootdir$ac_delim
-datadir!$datadir$ac_delim
-sysconfdir!$sysconfdir$ac_delim
-sharedstatedir!$sharedstatedir$ac_delim
-localstatedir!$localstatedir$ac_delim
-includedir!$includedir$ac_delim
-oldincludedir!$oldincludedir$ac_delim
-docdir!$docdir$ac_delim
-infodir!$infodir$ac_delim
-htmldir!$htmldir$ac_delim
-dvidir!$dvidir$ac_delim
-pdfdir!$pdfdir$ac_delim
-psdir!$psdir$ac_delim
-libdir!$libdir$ac_delim
-localedir!$localedir$ac_delim
-mandir!$mandir$ac_delim
-DEFS!$DEFS$ac_delim
-ECHO_C!$ECHO_C$ac_delim
-ECHO_N!$ECHO_N$ac_delim
-ECHO_T!$ECHO_T$ac_delim
-LIBS!$LIBS$ac_delim
-build_alias!$build_alias$ac_delim
-host_alias!$host_alias$ac_delim
-target_alias!$target_alias$ac_delim
-INSTALL_PROGRAM!$INSTALL_PROGRAM$ac_delim
-INSTALL_SCRIPT!$INSTALL_SCRIPT$ac_delim
-INSTALL_DATA!$INSTALL_DATA$ac_delim
-am__isrc!$am__isrc$ac_delim
-CYGPATH_W!$CYGPATH_W$ac_delim
-PACKAGE!$PACKAGE$ac_delim
-VERSION!$VERSION$ac_delim
-ACLOCAL!$ACLOCAL$ac_delim
-AUTOCONF!$AUTOCONF$ac_delim
-AUTOMAKE!$AUTOMAKE$ac_delim
-AUTOHEADER!$AUTOHEADER$ac_delim
-MAKEINFO!$MAKEINFO$ac_delim
-install_sh!$install_sh$ac_delim
-STRIP!$STRIP$ac_delim
-INSTALL_STRIP_PROGRAM!$INSTALL_STRIP_PROGRAM$ac_delim
-mkdir_p!$mkdir_p$ac_delim
-AWK!$AWK$ac_delim
-SET_MAKE!$SET_MAKE$ac_delim
-am__leading_dot!$am__leading_dot$ac_delim
-AMTAR!$AMTAR$ac_delim
-am__tar!$am__tar$ac_delim
-am__untar!$am__untar$ac_delim
-CC!$CC$ac_delim
-CFLAGS!$CFLAGS$ac_delim
-LDFLAGS!$LDFLAGS$ac_delim
-CPPFLAGS!$CPPFLAGS$ac_delim
-ac_ct_CC!$ac_ct_CC$ac_delim
-EXEEXT!$EXEEXT$ac_delim
-OBJEXT!$OBJEXT$ac_delim
-DEPDIR!$DEPDIR$ac_delim
-am__include!$am__include$ac_delim
-am__quote!$am__quote$ac_delim
-AMDEP_TRUE!$AMDEP_TRUE$ac_delim
-AMDEP_FALSE!$AMDEP_FALSE$ac_delim
-AMDEPBACKSLASH!$AMDEPBACKSLASH$ac_delim
-CCDEPMODE!$CCDEPMODE$ac_delim
-am__fastdepCC_TRUE!$am__fastdepCC_TRUE$ac_delim
-am__fastdepCC_FALSE!$am__fastdepCC_FALSE$ac_delim
-CPP!$CPP$ac_delim
-GREP!$GREP$ac_delim
-EGREP!$EGREP$ac_delim
-LIBOBJS!$LIBOBJS$ac_delim
-LIBTOOL!$LIBTOOL$ac_delim
-build!$build$ac_delim
-build_cpu!$build_cpu$ac_delim
-build_vendor!$build_vendor$ac_delim
-build_os!$build_os$ac_delim
-host!$host$ac_delim
-host_cpu!$host_cpu$ac_delim
-host_vendor!$host_vendor$ac_delim
-host_os!$host_os$ac_delim
-SED!$SED$ac_delim
-FGREP!$FGREP$ac_delim
-LD!$LD$ac_delim
-DUMPBIN!$DUMPBIN$ac_delim
-ac_ct_DUMPBIN!$ac_ct_DUMPBIN$ac_delim
-NM!$NM$ac_delim
-LN_S!$LN_S$ac_delim
-AR!$AR$ac_delim
-RANLIB!$RANLIB$ac_delim
-_ACEOF
-
-  if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 97; then
-    break
-  elif $ac_last_try; then
-    { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
-echo "$as_me: error: could not make $CONFIG_STATUS" >&2;}
-   { (exit 1); exit 1; }; }
-  else
-    ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
-  fi
-done
 
-ac_eof=`sed -n '/^CEOF[0-9]*$/s/CEOF/0/p' conf$$subs.sed`
-if test -n "$ac_eof"; then
-  ac_eof=`echo "$ac_eof" | sort -nru | sed 1q`
-  ac_eof=`expr $ac_eof + 1`
+ac_cr=`echo X | tr X '\015'`
+# On cygwin, bash can eat \r inside `` if the user requested igncr.
+# But we know of no other shell where ac_cr would be empty at this
+# point, so we can use a bashism as a fallback.
+if test "x$ac_cr" = x; then
+  eval ac_cr=\$\'\\r\'
+fi
+ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' </dev/null 2>/dev/null`
+if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then
+  ac_cs_awk_cr='\\r'
+else
+  ac_cs_awk_cr=$ac_cr
 fi
 
-cat >>$CONFIG_STATUS <<_ACEOF
-cat >"\$tmp/subs-1.sed" <<\CEOF$ac_eof
-/@[a-zA-Z_][a-zA-Z_0-9]*@/!b
-_ACEOF
-sed '
-s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g
-s/^/s,@/; s/!/@,|#_!!_#|/
-:n
-t n
-s/'"$ac_delim"'$/,g/; t
-s/$/\\/; p
-N; s/^.*\n//; s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g; b n
-' >>$CONFIG_STATUS <conf$$subs.sed
-rm -f conf$$subs.sed
-cat >>$CONFIG_STATUS <<_ACEOF
-CEOF$ac_eof
+echo 'BEGIN {' >"$tmp/subs1.awk" &&
 _ACEOF
 
 
+{
+  echo "cat >conf$$subs.awk <<_ACEOF" &&
+  echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' &&
+  echo "_ACEOF"
+} >conf$$subs.sh ||
+  as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
+ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'`
 ac_delim='%!_!# '
 for ac_last_try in false false false false false :; do
-  cat >conf$$subs.sed <<_ACEOF
-lt_ECHO!$lt_ECHO$ac_delim
-DSYMUTIL!$DSYMUTIL$ac_delim
-NMEDIT!$NMEDIT$ac_delim
-LIPO!$LIPO$ac_delim
-OTOOL!$OTOOL$ac_delim
-OTOOL64!$OTOOL64$ac_delim
-IS_AQUILA_TRUE!$IS_AQUILA_TRUE$ac_delim
-IS_AQUILA_FALSE!$IS_AQUILA_FALSE$ac_delim
-IS_SDK_TRUE!$IS_SDK_TRUE$ac_delim
-IS_SDK_FALSE!$IS_SDK_FALSE$ac_delim
-PKG_CONFIG!$PKG_CONFIG$ac_delim
-AVSYSTEM_CFLAGS!$AVSYSTEM_CFLAGS$ac_delim
-AVSYSTEM_LIBS!$AVSYSTEM_LIBS$ac_delim
-MMCOMMON_CFLAGS!$MMCOMMON_CFLAGS$ac_delim
-MMCOMMON_LIBS!$MMCOMMON_LIBS$ac_delim
-MMLOG_CFLAGS!$MMLOG_CFLAGS$ac_delim
-MMLOG_LIBS!$MMLOG_LIBS$ac_delim
-ALLOCA!$ALLOCA$ac_delim
-LTLIBOBJS!$LTLIBOBJS$ac_delim
-_ACEOF
+  . ./conf$$subs.sh ||
+    as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
 
-  if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 19; then
+  ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X`
+  if test $ac_delim_n = $ac_delim_num; then
     break
   elif $ac_last_try; then
-    { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
-echo "$as_me: error: could not make $CONFIG_STATUS" >&2;}
-   { (exit 1); exit 1; }; }
+    as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
   else
     ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
   fi
 done
+rm -f conf$$subs.sh
+
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+cat >>"\$tmp/subs1.awk" <<\\_ACAWK &&
+_ACEOF
+sed -n '
+h
+s/^/S["/; s/!.*/"]=/
+p
+g
+s/^[^!]*!//
+:repl
+t repl
+s/'"$ac_delim"'$//
+t delim
+:nl
+h
+s/\(.\{148\}\)..*/\1/
+t more1
+s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/
+p
+n
+b repl
+:more1
+s/["\\]/\\&/g; s/^/"/; s/$/"\\/
+p
+g
+s/.\{148\}//
+t nl
+:delim
+h
+s/\(.\{148\}\)..*/\1/
+t more2
+s/["\\]/\\&/g; s/^/"/; s/$/"/
+p
+b
+:more2
+s/["\\]/\\&/g; s/^/"/; s/$/"\\/
+p
+g
+s/.\{148\}//
+t delim
+' <conf$$subs.awk | sed '
+/^[^""]/{
+  N
+  s/\n//
+}
+' >>$CONFIG_STATUS || ac_write_fail=1
+rm -f conf$$subs.awk
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+_ACAWK
+cat >>"\$tmp/subs1.awk" <<_ACAWK &&
+  for (key in S) S_is_set[key] = 1
+  FS = "\a"
 
-ac_eof=`sed -n '/^CEOF[0-9]*$/s/CEOF/0/p' conf$$subs.sed`
-if test -n "$ac_eof"; then
-  ac_eof=`echo "$ac_eof" | sort -nru | sed 1q`
-  ac_eof=`expr $ac_eof + 1`
-fi
+}
+{
+  line = $ 0
+  nfields = split(line, field, "@")
+  substed = 0
+  len = length(field[1])
+  for (i = 2; i < nfields; i++) {
+    key = field[i]
+    keylen = length(key)
+    if (S_is_set[key]) {
+      value = S[key]
+      line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3)
+      len += length(value) + length(field[++i])
+      substed = 1
+    } else
+      len += 1 + keylen
+  }
+
+  print line
+}
 
-cat >>$CONFIG_STATUS <<_ACEOF
-cat >"\$tmp/subs-2.sed" <<\CEOF$ac_eof
-/@[a-zA-Z_][a-zA-Z_0-9]*@/!b end
+_ACAWK
 _ACEOF
-sed '
-s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g
-s/^/s,@/; s/!/@,|#_!!_#|/
-:n
-t n
-s/'"$ac_delim"'$/,g/; t
-s/$/\\/; p
-N; s/^.*\n//; s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g; b n
-' >>$CONFIG_STATUS <conf$$subs.sed
-rm -f conf$$subs.sed
-cat >>$CONFIG_STATUS <<_ACEOF
-:end
-s/|#_!!_#|//g
-CEOF$ac_eof
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then
+  sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g"
+else
+  cat
+fi < "$tmp/subs1.awk" > "$tmp/subs.awk" \
+  || as_fn_error $? "could not setup config files machinery" "$LINENO" 5
 _ACEOF
 
-
-# VPATH may cause trouble with some makes, so we remove $(srcdir),
-# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and
+# VPATH may cause trouble with some makes, so we remove sole $(srcdir),
+# ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and
 # trailing colons and then remove the whole line if VPATH becomes empty
 # (actually we leave an empty line to preserve line numbers).
 if test "x$srcdir" = x.; then
-  ac_vpsub='/^[         ]*VPATH[        ]*=/{
-s/:*\$(srcdir):*/:/
-s/:*\${srcdir}:*/:/
-s/:*@srcdir@:*/:/
-s/^\([^=]*=[    ]*\):*/\1/
+  ac_vpsub='/^[         ]*VPATH[        ]*=[    ]*/{
+h
+s///
+s/^/:/
+s/[     ]*$/:/
+s/:\$(srcdir):/:/g
+s/:\${srcdir}:/:/g
+s/:@srcdir@:/:/g
+s/^:*//
 s/:*$//
+x
+s/\(=[  ]*\).*/\1/
+G
+s/\n//
 s/^[^=]*=[      ]*$//
 }'
 fi
 
-cat >>$CONFIG_STATUS <<\_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 fi # test -n "$CONFIG_FILES"
 
+# Set up the scripts for CONFIG_HEADERS section.
+# No need to generate them if there are no CONFIG_HEADERS.
+# This happens for instance with `./config.status Makefile'.
+if test -n "$CONFIG_HEADERS"; then
+cat >"$tmp/defines.awk" <<\_ACAWK ||
+BEGIN {
+_ACEOF
+
+# Transform confdefs.h into an awk script `defines.awk', embedded as
+# here-document in config.status, that substitutes the proper values into
+# config.h.in to produce config.h.
+
+# Create a delimiter string that does not exist in confdefs.h, to ease
+# handling of long lines.
+ac_delim='%!_!# '
+for ac_last_try in false false :; do
+  ac_t=`sed -n "/$ac_delim/p" confdefs.h`
+  if test -z "$ac_t"; then
+    break
+  elif $ac_last_try; then
+    as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5
+  else
+    ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
+  fi
+done
+
+# For the awk script, D is an array of macro values keyed by name,
+# likewise P contains macro parameters if any.  Preserve backslash
+# newline sequences.
+
+ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]*
+sed -n '
+s/.\{148\}/&'"$ac_delim"'/g
+t rset
+:rset
+s/^[    ]*#[    ]*define[       ][      ]*/ /
+t def
+d
+:def
+s/\\$//
+t bsnl
+s/["\\]/\\&/g
+s/^ \('"$ac_word_re"'\)\(([^()]*)\)[    ]*\(.*\)/P["\1"]="\2"\
+D["\1"]=" \3"/p
+s/^ \('"$ac_word_re"'\)[        ]*\(.*\)/D["\1"]=" \2"/p
+d
+:bsnl
+s/["\\]/\\&/g
+s/^ \('"$ac_word_re"'\)\(([^()]*)\)[    ]*\(.*\)/P["\1"]="\2"\
+D["\1"]=" \3\\\\\\n"\\/p
+t cont
+s/^ \('"$ac_word_re"'\)[        ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p
+t cont
+d
+:cont
+n
+s/.\{148\}/&'"$ac_delim"'/g
+t clear
+:clear
+s/\\$//
+t bsnlc
+s/["\\]/\\&/g; s/^/"/; s/$/"/p
+d
+:bsnlc
+s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p
+b cont
+' <confdefs.h | sed '
+s/'"$ac_delim"'/"\\\
+"/g' >>$CONFIG_STATUS || ac_write_fail=1
+
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+  for (key in D) D_is_set[key] = 1
+  FS = "\a"
+}
+/^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ {
+  line = \$ 0
+  split(line, arg, " ")
+  if (arg[1] == "#") {
+    defundef = arg[2]
+    mac1 = arg[3]
+  } else {
+    defundef = substr(arg[1], 2)
+    mac1 = arg[2]
+  }
+  split(mac1, mac2, "(") #)
+  macro = mac2[1]
+  prefix = substr(line, 1, index(line, defundef) - 1)
+  if (D_is_set[macro]) {
+    # Preserve the white space surrounding the "#".
+    print prefix "define", macro P[macro] D[macro]
+    next
+  } else {
+    # Replace #undef with comments.  This is necessary, for example,
+    # in the case of _POSIX_SOURCE, which is predefined and required
+    # on some systems where configure will not decide to define it.
+    if (defundef == "undef") {
+      print "/*", prefix defundef, macro, "*/"
+      next
+    }
+  }
+}
+{ print }
+_ACAWK
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+  as_fn_error $? "could not setup config headers machinery" "$LINENO" 5
+fi # test -n "$CONFIG_HEADERS"
+
 
-for ac_tag in  :F $CONFIG_FILES  :H $CONFIG_HEADERS    :C $CONFIG_COMMANDS
+eval set X "  :F $CONFIG_FILES  :H $CONFIG_HEADERS    :C $CONFIG_COMMANDS"
+shift
+for ac_tag
 do
   case $ac_tag in
   :[FHLC]) ac_mode=$ac_tag; continue;;
   esac
   case $ac_mode$ac_tag in
   :[FHL]*:*);;
-  :L* | :C*:*) { { echo "$as_me:$LINENO: error: Invalid tag $ac_tag." >&5
-echo "$as_me: error: Invalid tag $ac_tag." >&2;}
-   { (exit 1); exit 1; }; };;
+  :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5 ;;
   :[FH]-) ac_tag=-:-;;
   :[FH]*) ac_tag=$ac_tag:$ac_tag.in;;
   esac
@@ -16612,26 +14632,34 @@ echo "$as_me: error: Invalid tag $ac_tag." >&2;}
           [\\/$]*) false;;
           *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";;
           esac ||
-          { { echo "$as_me:$LINENO: error: cannot find input file: $ac_f" >&5
-echo "$as_me: error: cannot find input file: $ac_f" >&2;}
-   { (exit 1); exit 1; }; };;
+          as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5 ;;
       esac
-      ac_file_inputs="$ac_file_inputs $ac_f"
+      case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac
+      as_fn_append ac_file_inputs " '$ac_f'"
     done
 
     # Let's still pretend it is `configure' which instantiates (i.e., don't
     # use $as_me), people would be surprised to read:
     #    /* config.h.  Generated by config.status.  */
-    configure_input="Generated from "`IFS=:
-         echo $* | sed 's|^[^:]*/||;s|:[^:]*/|, |g'`" by configure."
+    configure_input='Generated from '`
+         $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g'
+       `' by configure.'
     if test x"$ac_file" != x-; then
       configure_input="$ac_file.  $configure_input"
-      { echo "$as_me:$LINENO: creating $ac_file" >&5
-echo "$as_me: creating $ac_file" >&6;}
+      { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5
+$as_echo "$as_me: creating $ac_file" >&6;}
     fi
+    # Neutralize special characters interpreted by sed in replacement strings.
+    case $configure_input in #(
+    *\&* | *\|* | *\\* )
+       ac_sed_conf_input=`$as_echo "$configure_input" |
+       sed 's/[\\\\&|]/\\\\&/g'`;; #(
+    *) ac_sed_conf_input=$configure_input;;
+    esac
 
     case $ac_tag in
-    *:-:* | *:-) cat >"$tmp/stdin";;
+    *:-:* | *:-) cat >"$tmp/stdin" \
+      || as_fn_error $? "could not create $ac_file" "$LINENO" 5  ;;
     esac
     ;;
   esac
@@ -16641,42 +14669,7 @@ $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
         X"$ac_file" : 'X\(//\)[^/]' \| \
         X"$ac_file" : 'X\(//\)$' \| \
         X"$ac_file" : 'X\(/\)' \| . 2>/dev/null ||
-echo X"$ac_file" |
-    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
-           s//\1/
-           q
-         }
-         /^X\(\/\/\)[^/].*/{
-           s//\1/
-           q
-         }
-         /^X\(\/\/\)$/{
-           s//\1/
-           q
-         }
-         /^X\(\/\).*/{
-           s//\1/
-           q
-         }
-         s/.*/./; q'`
-  { as_dir="$ac_dir"
-  case $as_dir in #(
-  -*) as_dir=./$as_dir;;
-  esac
-  test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || {
-    as_dirs=
-    while :; do
-      case $as_dir in #(
-      *\'*) as_qdir=`echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #(
-      *) as_qdir=$as_dir;;
-      esac
-      as_dirs="'$as_qdir' $as_dirs"
-      as_dir=`$as_dirname -- "$as_dir" ||
-$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
-        X"$as_dir" : 'X\(//\)[^/]' \| \
-        X"$as_dir" : 'X\(//\)$' \| \
-        X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
-echo X"$as_dir" |
+$as_echo X"$ac_file" |
     sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
            s//\1/
            q
@@ -16694,20 +14687,15 @@ echo X"$as_dir" |
            q
          }
          s/.*/./; q'`
-      test -d "$as_dir" && break
-    done
-    test -z "$as_dirs" || eval "mkdir $as_dirs"
-  } || test -d "$as_dir" || { { echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5
-echo "$as_me: error: cannot create directory $as_dir" >&2;}
-   { (exit 1); exit 1; }; }; }
+  as_dir="$ac_dir"; as_fn_mkdir_p
   ac_builddir=.
 
 case "$ac_dir" in
 .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
 *)
-  ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
+  ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'`
   # A ".." for each directory in $ac_dir_suffix.
-  ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'`
+  ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'`
   case $ac_top_builddir_sub in
   "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
   *)  ac_top_build_prefix=$ac_top_builddir_sub/ ;;
@@ -16752,12 +14740,12 @@ ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
   esac
 _ACEOF
 
-cat >>$CONFIG_STATUS <<\_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 # If the template does not know about datarootdir, expand it.
 # FIXME: This hack should be removed a few years after 2.60.
 ac_datarootdir_hack=; ac_datarootdir_seen=
-
-case `sed -n '/datarootdir/ {
+ac_sed_dataroot='
+/datarootdir/ {
   p
   q
 }
@@ -16765,36 +14753,37 @@ case `sed -n '/datarootdir/ {
 /@docdir@/p
 /@infodir@/p
 /@localedir@/p
-/@mandir@/p
-' $ac_file_inputs` in
+/@mandir@/p'
+case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in
 *datarootdir*) ac_datarootdir_seen=yes;;
 *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*)
-  { echo "$as_me:$LINENO: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5
-echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;}
+  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5
+$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;}
 _ACEOF
-cat >>$CONFIG_STATUS <<_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
   ac_datarootdir_hack='
   s&@datadir@&$datadir&g
   s&@docdir@&$docdir&g
   s&@infodir@&$infodir&g
   s&@localedir@&$localedir&g
   s&@mandir@&$mandir&g
-    s&\\\${datarootdir}&$datarootdir&g' ;;
+  s&\\\${datarootdir}&$datarootdir&g' ;;
 esac
 _ACEOF
 
 # Neutralize VPATH when `$srcdir' = `.'.
 # Shell code in configure.ac might set extrasub.
 # FIXME: do we really want to maintain this feature?
-cat >>$CONFIG_STATUS <<_ACEOF
-  sed "$ac_vpsub
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+ac_sed_extra="$ac_vpsub
 $extrasub
 _ACEOF
-cat >>$CONFIG_STATUS <<\_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 :t
 /@[a-zA-Z_][a-zA-Z_0-9]*@/!b
-s&@configure_input@&$configure_input&;t t
+s|@configure_input@|$ac_sed_conf_input|;t t
 s&@top_builddir@&$ac_top_builddir_sub&;t t
+s&@top_build_prefix@&$ac_top_build_prefix&;t t
 s&@srcdir@&$ac_srcdir&;t t
 s&@abs_srcdir@&$ac_abs_srcdir&;t t
 s&@top_srcdir@&$ac_top_srcdir&;t t
@@ -16805,121 +14794,50 @@ s&@abs_top_builddir@&$ac_abs_top_builddir&;t t
 s&@INSTALL@&$ac_INSTALL&;t t
 s&@MKDIR_P@&$ac_MKDIR_P&;t t
 $ac_datarootdir_hack
-" $ac_file_inputs | sed -f "$tmp/subs-1.sed" | sed -f "$tmp/subs-2.sed" >$tmp/out
+"
+eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$tmp/subs.awk" >$tmp/out \
+  || as_fn_error $? "could not create $ac_file" "$LINENO" 5
 
 test -z "$ac_datarootdir_hack$ac_datarootdir_seen" &&
   { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } &&
   { ac_out=`sed -n '/^[         ]*datarootdir[  ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } &&
-  { echo "$as_me:$LINENO: WARNING: $ac_file contains a reference to the variable \`datarootdir'
-which seems to be undefined.  Please make sure it is defined." >&5
-echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir'
-which seems to be undefined.  Please make sure it is defined." >&2;}
+  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir'
+which seems to be undefined.  Please make sure it is defined" >&5
+$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir'
+which seems to be undefined.  Please make sure it is defined" >&2;}
 
   rm -f "$tmp/stdin"
   case $ac_file in
-  -) cat "$tmp/out"; rm -f "$tmp/out";;
-  *) rm -f "$ac_file"; mv "$tmp/out" $ac_file;;
-  esac
+  -) cat "$tmp/out" && rm -f "$tmp/out";;
+  *) rm -f "$ac_file" && mv "$tmp/out" "$ac_file";;
+  esac \
+  || as_fn_error $? "could not create $ac_file" "$LINENO" 5
  ;;
   :H)
   #
   # CONFIG_HEADER
   #
-_ACEOF
-
-# Transform confdefs.h into a sed script `conftest.defines', that
-# substitutes the proper values into config.h.in to produce config.h.
-rm -f conftest.defines conftest.tail
-# First, append a space to every undef/define line, to ease matching.
-echo 's/$/ /' >conftest.defines
-# Then, protect against being on the right side of a sed subst, or in
-# an unquoted here document, in config.status.  If some macros were
-# called several times there might be several #defines for the same
-# symbol, which is useless.  But do not sort them, since the last
-# AC_DEFINE must be honored.
-ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]*
-# These sed commands are passed to sed as "A NAME B PARAMS C VALUE D", where
-# NAME is the cpp macro being defined, VALUE is the value it is being given.
-# PARAMS is the parameter list in the macro definition--in most cases, it's
-# just an empty string.
-ac_dA='s,^\\([  #]*\\)[^        ]*\\([  ]*'
-ac_dB='\\)[     (].*,\\1define\\2'
-ac_dC=' '
-ac_dD=' ,'
-
-uniq confdefs.h |
-  sed -n '
-       t rset
-       :rset
-       s/^[     ]*#[    ]*define[       ][      ]*//
-       t ok
-       d
-       :ok
-       s/[\\&,]/\\&/g
-       s/^\('"$ac_word_re"'\)\(([^()]*)\)[      ]*\(.*\)/ '"$ac_dA"'\1'"$ac_dB"'\2'"${ac_dC}"'\3'"$ac_dD"'/p
-       s/^\('"$ac_word_re"'\)[  ]*\(.*\)/'"$ac_dA"'\1'"$ac_dB$ac_dC"'\2'"$ac_dD"'/p
-  ' >>conftest.defines
-
-# Remove the space that was appended to ease matching.
-# Then replace #undef with comments.  This is necessary, for
-# example, in the case of _POSIX_SOURCE, which is predefined and required
-# on some systems where configure will not decide to define it.
-# (The regexp can be short, since the line contains either #define or #undef.)
-echo 's/ $//
-s,^[    #]*u.*,/* & */,' >>conftest.defines
-
-# Break up conftest.defines:
-ac_max_sed_lines=50
-
-# First sed command is:         sed -f defines.sed $ac_file_inputs >"$tmp/out1"
-# Second one is:        sed -f defines.sed "$tmp/out1" >"$tmp/out2"
-# Third one will be:    sed -f defines.sed "$tmp/out2" >"$tmp/out1"
-# et cetera.
-ac_in='$ac_file_inputs'
-ac_out='"$tmp/out1"'
-ac_nxt='"$tmp/out2"'
-
-while :
-do
-  # Write a here document:
-    cat >>$CONFIG_STATUS <<_ACEOF
-    # First, check the format of the line:
-    cat >"\$tmp/defines.sed" <<\\CEOF
-/^[     ]*#[    ]*undef[        ][      ]*$ac_word_re[  ]*\$/b def
-/^[     ]*#[    ]*define[       ][      ]*$ac_word_re[(         ]/b def
-b
-:def
-_ACEOF
-  sed ${ac_max_sed_lines}q conftest.defines >>$CONFIG_STATUS
-  echo 'CEOF
-    sed -f "$tmp/defines.sed"' "$ac_in >$ac_out" >>$CONFIG_STATUS
-  ac_in=$ac_out; ac_out=$ac_nxt; ac_nxt=$ac_in
-  sed 1,${ac_max_sed_lines}d conftest.defines >conftest.tail
-  grep . conftest.tail >/dev/null || break
-  rm -f conftest.defines
-  mv conftest.tail conftest.defines
-done
-rm -f conftest.defines conftest.tail
-
-echo "ac_result=$ac_in" >>$CONFIG_STATUS
-cat >>$CONFIG_STATUS <<\_ACEOF
   if test x"$ac_file" != x-; then
-    echo "/* $configure_input  */" >"$tmp/config.h"
-    cat "$ac_result" >>"$tmp/config.h"
-    if diff $ac_file "$tmp/config.h" >/dev/null 2>&1; then
-      { echo "$as_me:$LINENO: $ac_file is unchanged" >&5
-echo "$as_me: $ac_file is unchanged" >&6;}
+    {
+      $as_echo "/* $configure_input  */" \
+      && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs"
+    } >"$tmp/config.h" \
+      || as_fn_error $? "could not create $ac_file" "$LINENO" 5
+    if diff "$ac_file" "$tmp/config.h" >/dev/null 2>&1; then
+      { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5
+$as_echo "$as_me: $ac_file is unchanged" >&6;}
     else
-      rm -f $ac_file
-      mv "$tmp/config.h" $ac_file
+      rm -f "$ac_file"
+      mv "$tmp/config.h" "$ac_file" \
+       || as_fn_error $? "could not create $ac_file" "$LINENO" 5
     fi
   else
-    echo "/* $configure_input  */"
-    cat "$ac_result"
+    $as_echo "/* $configure_input  */" \
+      && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" \
+      || as_fn_error $? "could not create -" "$LINENO" 5
   fi
-  rm -f "$tmp/out12"
-# Compute $ac_file's index in $config_headers.
-_am_arg=$ac_file
+# Compute "$ac_file"'s index in $config_headers.
+_am_arg="$ac_file"
 _am_stamp_count=1
 for _am_header in $config_headers :; do
   case $_am_header in
@@ -16934,7 +14852,7 @@ $as_expr X"$_am_arg" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
         X"$_am_arg" : 'X\(//\)[^/]' \| \
         X"$_am_arg" : 'X\(//\)$' \| \
         X"$_am_arg" : 'X\(/\)' \| . 2>/dev/null ||
-echo X"$_am_arg" |
+$as_echo X"$_am_arg" |
     sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
            s//\1/
            q
@@ -16954,39 +14872,40 @@ echo X"$_am_arg" |
          s/.*/./; q'`/stamp-h$_am_stamp_count
  ;;
 
-  :C)  { echo "$as_me:$LINENO: executing $ac_file commands" >&5
-echo "$as_me: executing $ac_file commands" >&6;}
+  :C)  { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5
+$as_echo "$as_me: executing $ac_file commands" >&6;}
  ;;
   esac
 
 
   case $ac_file$ac_mode in
-    "depfiles":C) test x"$AMDEP_TRUE" != x"" || # Autoconf 2.62 quotes --file arguments for eval, but not when files
-# are listed without --file.  Let's play safe and only enable the eval
-# if we detect the quoting.
-case $CONFIG_FILES in
-*\'*) eval set x "$CONFIG_FILES" ;;
-*)   set x $CONFIG_FILES ;;
-esac
-shift
-for mf
-do
-  # Strip MF so we end up with the name of the file.
-  mf=`echo "$mf" | sed -e 's/:.*$//'`
-  # Check whether this is an Automake generated Makefile or not.
-  # We used to match only the files named `Makefile.in', but
-  # some people rename them; so instead we look at the file content.
-  # Grep'ing the first line is not enough: some people post-process
-  # each Makefile.in and add a new line on top of each file to say so.
-  # Grep'ing the whole file is not good either: AIX grep has a line
-  # limit of 2048, but all sed's we know have understand at least 4000.
-  if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
-    dirpart=`$as_dirname -- "$mf" ||
+    "depfiles":C) test x"$AMDEP_TRUE" != x"" || {
+  # Autoconf 2.62 quotes --file arguments for eval, but not when files
+  # are listed without --file.  Let's play safe and only enable the eval
+  # if we detect the quoting.
+  case $CONFIG_FILES in
+  *\'*) eval set x "$CONFIG_FILES" ;;
+  *)   set x $CONFIG_FILES ;;
+  esac
+  shift
+  for mf
+  do
+    # Strip MF so we end up with the name of the file.
+    mf=`echo "$mf" | sed -e 's/:.*$//'`
+    # Check whether this is an Automake generated Makefile or not.
+    # We used to match only the files named `Makefile.in', but
+    # some people rename them; so instead we look at the file content.
+    # Grep'ing the first line is not enough: some people post-process
+    # each Makefile.in and add a new line on top of each file to say so.
+    # Grep'ing the whole file is not good either: AIX grep has a line
+    # limit of 2048, but all sed's we know have understand at least 4000.
+    if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
+      dirpart=`$as_dirname -- "$mf" ||
 $as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
         X"$mf" : 'X\(//\)[^/]' \| \
         X"$mf" : 'X\(//\)$' \| \
         X"$mf" : 'X\(/\)' \| . 2>/dev/null ||
-echo X"$mf" |
+$as_echo X"$mf" |
     sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
            s//\1/
            q
@@ -17004,68 +14923,33 @@ echo X"$mf" |
            q
          }
          s/.*/./; q'`
-  else
-    continue
-  fi
-  # Extract the definition of DEPDIR, am__include, and am__quote
-  # from the Makefile without running `make'.
-  DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
-  test -z "$DEPDIR" && continue
-  am__include=`sed -n 's/^am__include = //p' < "$mf"`
-  test -z "am__include" && continue
-  am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
-  # When using ansi2knr, U may be empty or an underscore; expand it
-  U=`sed -n 's/^U = //p' < "$mf"`
-  # Find all dependency output files, they are included files with
-  # $(DEPDIR) in their names.  We invoke sed twice because it is the
-  # simplest approach to changing $(DEPDIR) to its actual value in the
-  # expansion.
-  for file in `sed -n "
-    s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
-       sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
-    # Make sure the directory exists.
-    test -f "$dirpart/$file" && continue
-    fdir=`$as_dirname -- "$file" ||
+    else
+      continue
+    fi
+    # Extract the definition of DEPDIR, am__include, and am__quote
+    # from the Makefile without running `make'.
+    DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
+    test -z "$DEPDIR" && continue
+    am__include=`sed -n 's/^am__include = //p' < "$mf"`
+    test -z "am__include" && continue
+    am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
+    # When using ansi2knr, U may be empty or an underscore; expand it
+    U=`sed -n 's/^U = //p' < "$mf"`
+    # Find all dependency output files, they are included files with
+    # $(DEPDIR) in their names.  We invoke sed twice because it is the
+    # simplest approach to changing $(DEPDIR) to its actual value in the
+    # expansion.
+    for file in `sed -n "
+      s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
+        sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
+      # Make sure the directory exists.
+      test -f "$dirpart/$file" && continue
+      fdir=`$as_dirname -- "$file" ||
 $as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
         X"$file" : 'X\(//\)[^/]' \| \
         X"$file" : 'X\(//\)$' \| \
         X"$file" : 'X\(/\)' \| . 2>/dev/null ||
-echo X"$file" |
-    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
-           s//\1/
-           q
-         }
-         /^X\(\/\/\)[^/].*/{
-           s//\1/
-           q
-         }
-         /^X\(\/\/\)$/{
-           s//\1/
-           q
-         }
-         /^X\(\/\).*/{
-           s//\1/
-           q
-         }
-         s/.*/./; q'`
-    { as_dir=$dirpart/$fdir
-  case $as_dir in #(
-  -*) as_dir=./$as_dir;;
-  esac
-  test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || {
-    as_dirs=
-    while :; do
-      case $as_dir in #(
-      *\'*) as_qdir=`echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #(
-      *) as_qdir=$as_dir;;
-      esac
-      as_dirs="'$as_qdir' $as_dirs"
-      as_dir=`$as_dirname -- "$as_dir" ||
-$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
-        X"$as_dir" : 'X\(//\)[^/]' \| \
-        X"$as_dir" : 'X\(//\)$' \| \
-        X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
-echo X"$as_dir" |
+$as_echo X"$file" |
     sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
            s//\1/
            q
@@ -17083,16 +14967,12 @@ echo X"$as_dir" |
            q
          }
          s/.*/./; q'`
-      test -d "$as_dir" && break
+      as_dir=$dirpart/$fdir; as_fn_mkdir_p
+      # echo "creating $dirpart/$file"
+      echo '# dummy' > "$dirpart/$file"
     done
-    test -z "$as_dirs" || eval "mkdir $as_dirs"
-  } || test -d "$as_dir" || { { echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5
-echo "$as_me: error: cannot create directory $as_dir" >&2;}
-   { (exit 1); exit 1; }; }; }
-    # echo "creating $dirpart/$file"
-    echo '# dummy' > "$dirpart/$file"
   done
-done
+}
  ;;
     "libtool":C)
 
@@ -17216,6 +15096,9 @@ NL2SP=$lt_lt_NL2SP
 reload_flag=$lt_reload_flag
 reload_cmds=$lt_reload_cmds
 
+# An object symbol dumper.
+OBJDUMP=$lt_OBJDUMP
+
 # Method to check whether dependent libraries are shared objects.
 deplibs_check_method=$lt_deplibs_check_method
 
@@ -17731,11 +15614,13 @@ _LT_EOF
 done # for ac_tag
 
 
-{ (exit 0); exit 0; }
+as_fn_exit 0
 _ACEOF
-chmod +x $CONFIG_STATUS
 ac_clean_files=$ac_clean_files_save
 
+test $ac_write_fail = 0 ||
+  as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5
+
 
 # configure is writing to config.log, and then calls config.status.
 # config.status does its own redirection, appending to config.log.
@@ -17755,6 +15640,10 @@ if test "$no_create" != yes; then
   exec 5>>config.log
   # Use ||, not &&, to avoid exiting from the if with $? = 1, which
   # would make configure fail if this is the last instruction.
-  $ac_cs_success || { (exit 1); exit 1; }
+  $ac_cs_success || as_fn_exit 1
+fi
+if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5
+$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;}
 fi
 
index b54664f..da77f1a 100644 (file)
@@ -21,17 +21,6 @@ AC_HEADER_TIME
 AC_PROG_GCC_TRADITIONAL
 AC_PROG_LIBTOOL
 
-AC_ARG_ENABLE(sdk, AC_HELP_STRING([--enable-sdk], [sdk build]),
-       [
-        case "${enableval}" in
-         yes) IS_SDK=yes ;;
-         no)  IS_SDK=no ;;
-         *)   AC_MSG_ERROR(bad value ${enableval} for --enable-sdk) ;;
-        esac
-       ],
-       [IS_SDK=no])
-AM_CONDITIONAL([IS_SDK], [test "x$IS_SDK" = "xyes"])
-
 # Checks for libraries.
 PKG_CHECK_MODULES(AVSYSTEM, avsysaudio)
 AC_SUBST(AVSYSTEM_CFLAGS)
@@ -70,7 +59,6 @@ PKG_CHECK_MODULES(HEYNOTI, heynoti)
 AC_SUBST(HEYNOTI_CFLAGS)
 AC_SUBST(HEYNOTI_LIBS)
 
-
 AC_ARG_ENABLE(pulse, AC_HELP_STRING([--enable-pulse], [enable pulseaudio client]),
 [
  case "${enableval}" in
@@ -86,6 +74,24 @@ AC_SUBST(PULSE_LIBS)
 fi
 AM_CONDITIONAL([USE_PULSE], [test "x$USE_PULSE" = "xyes"])
 
+dnl use security --------------------------------------------------------------------------
+AC_ARG_ENABLE(security, AC_HELP_STRING([--enable-security], [using security]),
+[
+ case "${enableval}" in
+    yes) USE_SECURITY=yes ;;
+     no)  USE_SECURITY=no ;;
+      *)   AC_MSG_ERROR(bad value ${enableval} for --enable-security) ;;
+ esac
+ ],[USE_SECURITY=no])
+
+if test "x$USE_SECURITY" = "xyes"; then
+PKG_CHECK_MODULES(SECURITY, security-server)
+AC_SUBST(SECURITY_CFLAGS)
+AC_SUBST(SECURITY_LIBS)
+fi
+AM_CONDITIONAL(USE_SECURITY, test "x$USE_SECURITY" = "xyes")
+dnl end --------------------------------------------------------------------
+
 
 # Checks for header files.
 AC_HEADER_STDC
@@ -111,14 +117,10 @@ server/Makefile
 server/plugin/Makefile
 server/plugin/wav/Makefile
 server/plugin/keytone/Makefile
-server/plugin/headset/Makefile
 server/plugin/tone/Makefile
 pkgconfig/Makefile
 pkgconfig/mm-sound.pc
 pkgconfig/mm-keysound.pc
-pkgconfig-sdk/Makefile
-pkgconfig-sdk/mm-sound.pc
-pkgconfig-sdk/mm-keysound.pc
 testsuite/Makefile
 init/Makefile
 ])
diff --git a/debian/changelog b/debian/changelog
deleted file mode 100644 (file)
index 8f2fce5..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-libmm-sound (0.5.11-0) unstable; urgency=low
-
-  * Initial release
-  * Git: pkgs/l/libmm-sound
-  * Tag: libmm-sound_0.5.11-0
-
- -- YoungHun Kim <yh8004.kim@samsung.com>  Fri, 10 Feb 2012 14:31:26 +0900
diff --git a/debian/compat b/debian/compat
deleted file mode 100644 (file)
index 7ed6ff8..0000000
+++ /dev/null
@@ -1 +0,0 @@
-5
diff --git a/debian/control b/debian/control
deleted file mode 100644 (file)
index 91acba9..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-Source: libmm-sound
-Section: libs
-Priority: optional
-Maintainer: Seungbae Shin <seungbae.shin@samsung.com>, JongHyuk Choi <jhchoi.choi@samsung.com>
-Uploaders: YoungHwan Ahn <younghwan_.an@samsung.com>, YoungHun Kim <yh8004.kim@samsung.com>
-Build-Depends: debhelper (>= 5), autotools-dev, libmm-common-dev, libavsystem-dev, libmm-log-dev, libmm-session-dev, libaudiosessionmgr-dev, libglib2.0-dev, libslp-setting-dev, libmm-common-internal-dev, libheynoti-dev
-Standards-Version: 3.7.2
-Homepage: N/A
-
-Package: libmm-sound-dev
-XB-Public-Package: no
-Section: libdevel
-Architecture: any
-Depends: libmm-sound-0 (= ${Source-Version}), libmm-sound-sdk-dev
-Standards-Version: 3.7.2
-Description: MMSound development package
-Version: 3.7.2
-
-Package: libmm-sound-sdk-dev
-XB-Generate-Docs: yes
-Section: libdevel
-Architecture: any
-Depends: libmm-sound-0 (= ${Source-Version}), libmm-common-dev, libavsystem-sdk-dev, libmm-log-sdk-dev, libmm-session-sdk-dev, libaudiosessionmgr-sdk-dev, libglib2.0-dev, libslp-setting-dev
-Standards-Version: 3.7.2
-Description: MMSound development package
-Version: 3.7.2
-
-Package: libmm-sound-0
-Section: libs
-Architecture: any
-Depends: ${shlibs:Depends}, ${misc:Depends}, libavsystem-0, libmm-common, libmm-log, libmm-session-0, libaudiosessionmgr-0, libglib2.0-0, libslp-setting-0, libheynoti-0
-Standards-Version: 3.7.2
-Description: MMSound Package contains client lib and sound_server binary
-Version: 3.7.2
-
-Package: libmm-sound-0-dbg
-Section: debug
-Architecture: any
-Depends: ${shlibs:Depends}, ${misc:Depends}, libmm-sound-0 (= ${Source-Version})
-Description: MMSound debug package (unstripped)
-Version: 3.7.2
-
-Package: libmm-sound-tool
-Section: utils
-Architecture: armel
-Depends: ${shlibs:Depends}, ${misc:Depends}, libmm-sound-0 (= ${Source-Version})
-Description: MMSound utility package - contians mm_sound_testsuite, sound_check
-Version: 3.7.2
diff --git a/debian/copyright b/debian/copyright
deleted file mode 100644 (file)
index 3498116..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
-
-Contact: Seungbae Shin <seungbae.shin@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.
diff --git a/debian/dirs b/debian/dirs
deleted file mode 100644 (file)
index ca882bb..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-usr/bin
-usr/sbin
diff --git a/debian/docs b/debian/docs
deleted file mode 100644 (file)
index e69de29..0000000
diff --git a/debian/libmm-sound-0.install.in b/debian/libmm-sound-0.install.in
deleted file mode 100755 (executable)
index 5e3bb40..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-# if your module, creates shared libraries
-@PREFIX@/lib/*.so*
-@PREFIX@/lib/soundplugins/*.so*
-@PREFIX@/bin/sound_server
-/etc/rc.d/*
diff --git a/debian/libmm-sound-0.postinst b/debian/libmm-sound-0.postinst
deleted file mode 100755 (executable)
index 70bade0..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-#!/bin/sh
-
-echo "postinst: make vconf keys"
-if [ ${USER} = "root" ] 
-then
-/usr/bin/vconftool set -t int db/volume/system 5 -g 29
-/usr/bin/vconftool set -t int db/volume/notification 7 -g 29
-/usr/bin/vconftool set -t int db/volume/alarm 6 -g 29
-/usr/bin/vconftool set -t int db/volume/ringtone 13 -g 29
-/usr/bin/vconftool set -t int db/volume/media 7 -g 29
-/usr/bin/vconftool set -t int db/volume/call 7 -g 29
-/usr/bin/vconftool set -t int db/volume/fixed 0 -g 29
-/usr/bin/vconftool set -t int db/volume/java 11 -g 29
-/usr/bin/vconftool set -t int memory/Sound/RoutePolicy 0 -i -g 29
-else
-/usr/bin/vconftool set -t int db/volume/system 5
-/usr/bin/vconftool set -t int db/volume/notification 7
-/usr/bin/vconftool set -t int db/volume/alarm 6
-/usr/bin/vconftool set -t int db/volume/ringtone 13
-/usr/bin/vconftool set -t int db/volume/media 7
-/usr/bin/vconftool set -t int db/volume/call 7
-/usr/bin/vconftool set -t int db/volume/fixed 0
-/usr/bin/vconftool set -t int db/volume/java 11
-/usr/bin/vconftool set -t int memory/Sound/RoutePolicy 0 -i
-fi
-
-if [ -n "`env|grep SBOX`" ]; then
-    echo "postinst: sbox installation skip lauching daemon"
-else
-       echo "postinst: run sound server again"
-       /usr/bin/sound_server -S&
-fi
diff --git a/debian/libmm-sound-0.preinst b/debian/libmm-sound-0.preinst
deleted file mode 100644 (file)
index 1e7fc87..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-#!/bin/sh
-
-if [ -n "`env|grep SBOX`" ]; then
-       echo "postinst: sbox installation"
-else
-       PID=`/bin/pidof sound_server`
-       if [ -n "$PID" ]; then
-               echo "preinst: kill current sound server"
-               /usr/bin/killall -9 sound_server
-       fi
-fi
diff --git a/debian/libmm-sound-dev.install.in b/debian/libmm-sound-dev.install.in
deleted file mode 100644 (file)
index 5cb222d..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-# if your module creates shared libraries
-@PREFIX@/include/mmf/mm_sound_private.h
diff --git a/debian/libmm-sound-sdk-dev.install.in b/debian/libmm-sound-sdk-dev.install.in
deleted file mode 100644 (file)
index 9a9e581..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-# if your module creates shared libraries
-@PREFIX@/include/mmf/mm_sound.h
-@PREFIX@/lib/*.a
-@PREFIX@/lib/*.la
-@PREFIX@/lib/pkgconfig/*
-
diff --git a/debian/libmm-sound-tool.install.in b/debian/libmm-sound-tool.install.in
deleted file mode 100644 (file)
index 8c17347..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-# if your module, creates shared libraries
-@PREFIX@/bin/mm_sound_testsuite
-
diff --git a/debian/rules b/debian/rules
deleted file mode 100755 (executable)
index fe21c18..0000000
+++ /dev/null
@@ -1,138 +0,0 @@
-#!/usr/bin/make -f
-# -*- makefile -*-
-# Sample debian/rules that uses debhelper.
-# This file was originally written by Joey Hess and Craig Small.
-# As a special exception, when this file is copied by dh-make into a
-# dh-make output file, you may use that output file without restriction.
-# This special exception was added by Craig Small in version 0.37 of dh-make.
-
-# Uncomment this to turn on verbose mode.
-#export DH_VERBOSE=1
-
-
-# These are used for cross-compiling and for saving the configure script
-# from having to guess our platform (since we know it already)
-DEB_BUILD_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
-DEB_HOST_GNU_TYPE   ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
-DEB_HOST_ARCH       ?= $(shell dpkg-architecture -qDEB_HOST_ARCH)
-DEB_HOST_ARCH_OS    ?= $(shell dpkg-architecture -qDEB_HOST_GNU_OS)
-
-CFLAGS ?= -Wall -g
-LDFLAGS ?= 
-PREFIX ?= /usr
-DATADIR ?= /opt
-CFLAGS += -fPIC
-
-ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
-       CFLAGS += -O0
-else
-       CFLAGS += -O2
-endif
-
-# architecture is not arm
-ifneq (, $(findstring arm, $(DEB_HOST_ARCH)))
-       # do something here for arm architecture
-       # do something here
-       OPTION= --enable-pulse
-else
-       OPTION= --enable-sdk --enable-pulse
-endif
-
-#LDFLAGS += -Wl,--rpath=$(PREFIX)/lib -Wl,--as-needed
-LDFLAGS += -Wl,--rpath=$(PREFIX)/lib -Wl,--hash-style=both -Wl,--as-needed
-
-config.status: configure
-       dh_testdir
-       # Add here commands to configure the package.
-       dh_buildinfo generate cat
-       ./autogen.sh
-       CFLAGS="$(CFLAGS) -fvisibility=hidden -DEXPORT_API=\"__attribute__((visibility(\\\"default\\\")))\"" LDFLAGS="$(LDFLAGS)" ./configure --prefix=$(PREFIX) $(OPTION)
-
-build: build-stamp
-
-build-stamp:  config.status
-       dh_testdir
-
-       # Add here commands to compile the package.
-       $(MAKE)
-       #docbook-to-man debian/ncurses.sgml > ncurses.1
-
-       for f in `find $(CURDIR)/debian/ -name "*.in"`; do \
-               cat $$f > $${f%.in}; \
-               sed -i -e "s#@PREFIX@#$(PREFIX)#g" $${f%.in}; \
-               sed -i -e "s#@DATADIR@#$(DATADIR)#g" $${f%.in}; \
-       done
-
-       touch $@
-
-clean:
-       dh_testdir
-       dh_testroot
-       rm -f build-stamp 
-
-       # Add here commands to clean up after the build process.
-       -$(MAKE) distclean
-ifneq "$(wildcard /usr/share/misc/config.sub)" ""
-       cp -f /usr/share/misc/config.sub config.sub
-endif
-ifneq "$(wildcard /usr/share/misc/config.guess)" ""
-       cp -f /usr/share/misc/config.guess config.guess
-endif
-
-       for f in `find $(CURDIR)/debian/ -name "*.in"`; do \
-               rm -f $${f%.in}; \
-       done
-
-       dh_clean 
-
-install: build
-       dh_testdir
-       dh_testroot
-       dh_clean -k 
-       dh_installdirs -s
-
-       # Add here commands to install the package into debian/ncurses.
-       $(MAKE) DESTDIR=$(CURDIR)/debian/tmp install
-       mkdir -p $(CURDIR)/debian/tmp/etc/rc.d/rc3.d/
-       ln -s ../init.d/soundserver $(CURDIR)/debian/tmp/etc/rc.d/rc3.d/S40soundserver
-       mkdir -p $(CURDIR)/debian/tmp/etc/rc.d/rc4.d/
-       ln -s ../init.d/soundserver $(CURDIR)/debian/tmp/etc/rc.d/rc4.d/S40soundserver
-
-# Build architecture-independent files here.
-binary-indep: build install
-# We have nothing to do by default.
-
-# Build architecture-dependent files here.
-binary-arch: build install
-       dh_testdir
-       dh_testroot
-       dh_installchangelogs -s
-       dh_installdocs
-       dh_buildinfo install
-       dh_installexamples
-       dh_install -s --list-missing --sourcedir=debian/tmp
-#      dh_installmenu
-#      dh_installdebconf       
-#      dh_installlogrotate
-#      dh_installemacsen
-#      dh_installpam
-#      dh_installmime
-#      dh_python
-#      dh_installinit
-#      dh_installcron
-#      dh_installinfo
-       dh_installman
-       dh_link -s
-       dh_strip -s --dbg-package=libmm-sound-0-dbg
-       dh_compress -s
-       dh_fixperms -s
-#      dh_perl
-       dh_makeshlibs -s
-       dh_installdeb -s
-       dh_shlibdeps -s
-       dh_gencontrol -s
-       dh_md5sums -s
-       dh_builddeb -s
-
-binary: binary-indep binary-arch
-.PHONY: build clean binary-indep binary-arch binary install 
index 0e9ae00..744b73b 100644 (file)
@@ -25,6 +25,8 @@
 #include <stdio.h>
 #include <unistd.h>
 
+#include "mm_sound.h"
+
 #define FILE_PATH 512
 
 typedef enum {
@@ -51,6 +53,13 @@ typedef struct
        int sharedkey;
        char filename[FILE_PATH];
 
+       /* Device */
+       int route;
+       int device_in;
+       int device_out;
+       int is_available;
+       int route_list[MM_SOUND_ROUTE_NUM];
+
        /* Common data */
        int handle;
        void *callback;
index f100f50..148a7b4 100644 (file)
@@ -762,6 +762,34 @@ int main(int argc, char* argv[])
 int mm_sound_pcm_play_open(MMSoundPcmHandle_t *handle, const unsigned int rate, MMSoundPcmChannel_t channel, MMSoundPcmFormat_t format, const volume_type_t volume);
 
 /**
+ * This function start pcm playback
+ *
+ * @param      handle  [in] handle to start playback
+ *
+ * @return     This function returns MM_ERROR_NONE on success, or negative value
+ *                     with error code.
+ * @remark
+ * @see
+ * @pre                PCM playback handle should be allocated.
+ * @post       PCM playback is ready to write.
+ */
+int mm_sound_pcm_play_start(MMSoundPcmHandle_t handle);
+
+/**
+ * This function stop pcm playback
+ *
+ * @param      handle  [in] handle to stop playback
+ *
+ * @return     This function returns MM_ERROR_NONE on success, or negative value
+ *                     with error code.
+ * @remark
+ * @see
+ * @pre                PCM playback handle should be allocated.
+ * @post       PCM playback data will not be buffered.
+ */
+int mm_sound_pcm_play_stop(MMSoundPcmHandle_t handle);
+
+/**
  * This function is to play PCM memory buffer.
  *
  * @param      handle  [in] handle to play pcm data
@@ -979,6 +1007,34 @@ int main(int argc, char* argv[])
 int mm_sound_pcm_capture_open(MMSoundPcmHandle_t *handle, const unsigned int rate, MMSoundPcmChannel_t channel, MMSoundPcmFormat_t format);
 
 /**
+ * This function start pcm capture
+ *
+ * @param      handle  [in] handle to start capture
+ *
+ * @return     This function returns read data size on success, or negative value
+ *                     with error code.
+ * @remark
+ * @see
+ * @pre                PCM capture handle should be allocated.
+ * @post       PCM capture data will be buffered.
+ */
+int mm_sound_pcm_capture_start(MMSoundPcmHandle_t handle);
+
+/**
+ * This function stop pcm capture
+ *
+ * @param      handle  [in] handle to stop capture
+ *
+ * @return     This function returns read data size on success, or negative value
+ *                     with error code.
+ * @remark
+ * @see
+ * @pre                PCM capture handle should be allocated.
+ * @post       PCM capture data will not be buffered.
+ */
+int mm_sound_pcm_capture_stop(MMSoundPcmHandle_t handle);
+
+/**
  * This function captures PCM to memory buffer. (Samsung extension)
  *
  * @param      handle  [in] handle to play pcm data
@@ -1832,6 +1888,246 @@ int make_callback()
  * @endcode
  */
 int mm_sound_route_remove_change_callback(void);
+
+/*
+ * Enumerations of device & route
+ */
+
+typedef enum{
+       MM_SOUND_DEVICE_IN_NONE                         = 0x00,
+       MM_SOUND_DEVICE_IN_MIC                          = 0x01,         /**< Device builtin mic. */
+       MM_SOUND_DEVICE_IN_WIRED_ACCESSORY      = 0x02,         /**< Wired input devices */
+       MM_SOUND_DEVICE_IN_BT_SCO                       = 0x04,         /**< Bluetooth SCO device */
+} mm_sound_device_in;
+
+typedef enum{
+       MM_SOUND_DEVICE_OUT_NONE                        = 0x00,
+       MM_SOUND_DEVICE_OUT_SPEAKER                     = 0x01<<8,      /**< Device builtin speaker */
+       MM_SOUND_DEVICE_OUT_RECEIVER            = 0x02<<8,      /**< Device builtin receiver */
+       MM_SOUND_DEVICE_OUT_WIRED_ACCESSORY     = 0x04<<8,      /**< Wired output devices such as headphone, headset, and so on. */
+       MM_SOUND_DEVICE_OUT_BT_SCO                      = 0x08<<8,      /**< Bluetooth SCO device */
+       MM_SOUND_DEVICE_OUT_BT_A2DP                     = 0x10<<8,      /**< Bluetooth A2DP device */
+} mm_sound_device_out;
+
+#define MM_SOUND_ROUTE_NUM 10
+
+typedef enum{
+       MM_SOUND_ROUTE_OUT_SPEAKER = MM_SOUND_DEVICE_OUT_SPEAKER, /**< Routing audio output to builtin device such as internal speaker. */
+       MM_SOUND_ROUTE_OUT_WIRED_ACCESSORY = MM_SOUND_DEVICE_OUT_WIRED_ACCESSORY,/**< Routing audio output to wired accessory such as headphone, headset, and so on. */
+       MM_SOUND_ROUTE_OUT_BLUETOOTH = MM_SOUND_DEVICE_OUT_BT_A2DP, /**< Routing audio output to bluetooth A2DP. */
+       MM_SOUND_ROUTE_IN_MIC = MM_SOUND_DEVICE_IN_MIC, /**< Routing audio input to device builtin mic. */
+       MM_SOUND_ROUTE_IN_WIRED_ACCESSORY = MM_SOUND_DEVICE_IN_WIRED_ACCESSORY, /**< Routing audio input to wired accessory. */
+       MM_SOUND_ROUTE_IN_MIC_OUT_RECEIVER = MM_SOUND_DEVICE_IN_MIC | MM_SOUND_DEVICE_OUT_RECEIVER, /**< Routing audio input to device builtin mic and routing audio output to builtin receiver*/
+       MM_SOUND_ROUTE_IN_MIC_OUT_SPEAKER = MM_SOUND_DEVICE_IN_MIC | MM_SOUND_DEVICE_OUT_SPEAKER , /**< Routing audio input to device builtin mic and routing audio output to builtin speaker */
+       MM_SOUND_ROUTE_IN_MIC_OUT_HEADPHONE = MM_SOUND_DEVICE_IN_MIC | MM_SOUND_DEVICE_OUT_WIRED_ACCESSORY,/**< Routing audio input to device builtin mic and routing audio output to headphone */
+       MM_SOUND_ROUTE_INOUT_HEADSET = MM_SOUND_DEVICE_IN_WIRED_ACCESSORY | MM_SOUND_DEVICE_OUT_WIRED_ACCESSORY,        /**< Routing audio input and output to headset*/
+       MM_SOUND_ROUTE_INOUT_BLUETOOTH = MM_SOUND_DEVICE_IN_BT_SCO | MM_SOUND_DEVICE_OUT_BT_SCO /**< Routing audio input and output to bluetooth SCO */
+} mm_sound_route;
+
+typedef int (*mm_sound_available_route_cb)(mm_sound_route route, void *user_data);
+
+int mm_sound_is_route_available(mm_sound_route route, bool *is_available);
+
+int mm_sound_foreach_available_route_cb(mm_sound_available_route_cb, void *user_data);
+
+int mm_sound_set_active_route(mm_sound_route route);
+
+/**
+ * This function is to get active playback device and capture device.
+ *
+ * @param      playback_device                 [out]   playback device.
+ * @param      capture_device                  [out]   capture device.
+ *
+ * @return     This function returns MM_ERROR_NONE on success, or negative value
+ *                     with error code.
+ * @remark     None.
+ * @pre                None.
+ * @post       None.
+ * @see                mm_sound_set_active_route mm_sound_device_in mm_sound_device_out
+ */
+int mm_sound_get_active_device(mm_sound_device_in *device_in, mm_sound_device_out *device_out);
+
+/**
+ * Active device changed callback function type.
+ *
+ * @param      user_data               [in]    Argument passed when callback has called
+ *
+ * @return     No return value
+ * @remark     None.
+ * @see                mm_sound_add_active_device_changed_callback mm_sound_remove_active_device_changed_callback
+ */
+typedef void (*mm_sound_active_device_changed_cb) (mm_sound_device_in device_in, mm_sound_device_out device_out, void *user_data);
+
+/**
+ * This function is to add active device callback.
+ *
+ * @param      func                    [in]    callback function pointer
+ * @param      user_data               [in]    user data passing to callback function
+ *
+ * @return     This function returns MM_ERROR_NONE on success, or negative value
+ *                     with error code.
+ * @remark     None.
+ * @see                mm_sound_remove_active_device_changed_callback mm_sound_active_device_changed_cb
+ * @pre                None.
+ * @post       None.
+ * @par Example
+ * @code
+
+void __active_device_callback(void *user_data)
+{
+       printf("Callback function\n");
+}
+
+int active_device_control()
+{
+       int ret = 0;
+
+       ret = mm_sound_add_active_device_changed_callback(__active_device_callback, NULL);
+       if ( MM_ERROR_NONE != ret)
+       {
+               printf("Can not add callback\n");
+       }
+       else
+       {
+               printf("Add callback success\n");
+       }
+
+       return ret;
+}
+
+ * @endcode
+ */
+int mm_sound_add_active_device_changed_callback(mm_sound_active_device_changed_cb func, void *user_data);
+
+/**
+ * This function is to remove active device callback.
+ *
+ * @return     This function returns MM_ERROR_NONE on success, or negative value
+ *                     with error code.
+ * @remark     None.
+ * @pre                Active device callback should be registered.
+ * @post       Active device callback deregistered and does not be called anymore.
+ * @see                mm_sound_add_active_device_changed_callback mm_sound_active_device_changed_cb
+ * @par Example
+ * @code
+void __active_device_callback(void *data)
+{
+       printf("Callback function\n");
+}
+
+int active_device_control()
+{
+       int ret = 0;
+
+       mm_sound_add_active_device_changed_callback(__active_device_callback, NULL);
+
+       ret = mm_sound_remove_active_device_changed_callback();
+       if ( MM_ERROR_NONE == ret)
+       {
+               printf("Remove callback success\n");
+       }
+       else
+       {
+               printf("Remove callback failed\n");
+       }
+
+       return ret;
+}
+
+ * @endcode
+ */
+int mm_sound_remove_active_device_changed_callback(void);
+
+/**
+ * Available route changed callback function type.
+ *
+ * @param      user_data               [in]    Argument passed when callback has called
+ *
+ * @return     No return value
+ * @remark     None.
+ * @see                mm_sound_add_active_device_changed_callback mm_sound_remove_active_device_changed_callback
+ */
+typedef void (*mm_sound_available_route_changed_cb) (mm_sound_route route, bool available, void *user_data);
+
+/**
+ * This function is to add available device callback.
+ *
+ * @param      func                    [in]    callback function pointer
+ * @param      user_data               [in]    user data passing to callback function
+ *
+ * @return     This function returns MM_ERROR_NONE on success, or negative value
+ *                     with error code.
+ * @remark     None.
+ * @see                mm_sound_remove_available_route_changed_callback mm_sound_active_device_changed_cb
+ * @pre                None.
+ * @post       None.
+ * @par Example
+ * @code
+
+void __available_device_callback(void *user_data)
+{
+       printf("Callback function\n");
+}
+
+int available_device_control()
+{
+       int ret = 0;
+
+       ret = mm_sound_add_available_route_changed_callback(__available_device_callback, NULL);
+       if ( MM_ERROR_NONE != ret)
+       {
+               printf("Can not add callback\n");
+       }
+       else
+       {
+               printf("Add callback success\n");
+       }
+
+       return ret;
+}
+
+ * @endcode
+ */
+int mm_sound_add_available_route_changed_callback(mm_sound_available_route_changed_cb func, void *user_data);
+
+/**
+ * This function is to remove available device callback.
+ *
+ * @return     This function returns MM_ERROR_NONE on success, or negative value
+ *                     with error code.
+ * @remark     None.
+ * @pre                available device callback should be registered.
+ * @post       available device callback deregistered and does not be called anymore.
+ * @see                mm_sound_add_available_route_changed_callback mm_sound_active_device_changed_cb
+ * @par Example
+ * @code
+void __available_device_callback(void *data)
+{
+       printf("Callback function\n");
+}
+
+int available_device_control()
+{
+       int ret = 0;
+
+       mm_sound_add_available_route_changed_callback(__available_device_callback, NULL);
+
+       ret = mm_sound_remove_available_route_changed_callback();
+       if ( MM_ERROR_NONE == ret)
+       {
+               printf("Remove callback success\n");
+       }
+       else
+       {
+               printf("Remove callback failed\n");
+       }
+
+       return ret;
+}
+
+ * @endcode
+ */
+int mm_sound_remove_available_route_changed_callback(void);
 /**
        @}
  */
index 90f3b7f..2628e6a 100644 (file)
@@ -31,7 +31,13 @@ int MMSoundClientCallbackFini(void);
 int MMSoundClientPlayTone(int number, int vol_type, double volume, int time, int *handle);
 int MMSoundClientPlaySound(MMSoundParamType *param, int tone, int keytone, int *handle);
 int MMSoundClientStopSound(int handle);
-int MMSoundClientIsBtA2dpOn (int* connected, char** bt_name);
-int MMSoundClientSetAudioRoute(int route);
+int _mm_sound_client_is_route_available(mm_sound_route route, bool *is_available);
+int _mm_sound_client_foreach_available_route_cb(mm_sound_available_route_cb, void *user_data);
+int _mm_sound_client_set_active_route(mm_sound_route route);
+int _mm_sound_client_get_active_device(mm_sound_device_in *device_in, mm_sound_device_out *device_out);
+int _mm_sound_client_add_active_device_changed_callback(mm_sound_active_device_changed_cb func, void* user_data);
+int _mm_sound_client_remove_active_device_changed_callback(void);
+int _mm_sound_client_add_available_route_changed_callback(mm_sound_available_route_changed_cb func, void* user_data);
+int _mm_sound_client_remove_available_route_changed_callback(void);
 
 #endif /* __MM_SOUND_CLIENT_H__ */
index ff9a712..daa94d3 100644 (file)
 #ifndef __MM_SOUND_COMMON_H__\r
 #define __MM_SOUND_COMMON_H__\r
 \r
-#define ROUTE_VCONF_KEY "memory/Sound/RoutePolicy"\r
-\r
 ///////////////////////////////////\r
 ////     MMSOUND VOLUME APIs\r
 ///////////////////////////////////\r
-#define VCONF_KEY_VOLUME_PREFIX                                "db/volume"\r
+#define VCONF_KEY_VOLUME_PREFIX                                "db/private/sound/volume"\r
 #define VCONF_KEY_VOLUME_TYPE_SYSTEM           VCONF_KEY_VOLUME_PREFIX"/system"\r
 #define VCONF_KEY_VOLUME_TYPE_NOTIFICATION     VCONF_KEY_VOLUME_PREFIX"/notification"\r
 #define VCONF_KEY_VOLUME_TYPE_ALARM                    VCONF_KEY_VOLUME_PREFIX"/alarm"\r
@@ -37,6 +35,8 @@
 #define VCONF_KEY_VOLUME_TYPE_ANDROID          VCONF_KEY_VOLUME_PREFIX"/fixed"\r
 #define VCONF_KEY_VOLUME_TYPE_JAVA                     VCONF_KEY_VOLUME_PREFIX"/java"\r
 \r
+#define ASM_READY_KEY          "memory/Sound/ASMReady"\r
+\r
 #define MMSOUND_ENTER_CRITICAL_SECTION(x_mutex) \\r
 switch ( pthread_mutex_lock( x_mutex ) ) \\r
 { \\r
index 3f706e7..e98bf28 100644 (file)
 #include <unistd.h>
 #include <mm_ipc.h>
 
-#define KEY_BASE_PATH  "/"
-#define SHM_NAME "SHM"
+#define KEY_BASE_PATH  "/tmp"
 #define RCV_MSG        0x21    /* rcv key */
 #define SND_MSG 0x24   /* snd key */
 #define CB_MSG   0x64          /* cb key */
 
-#define SERVER_RCV_TYPE 100000 /* rcv message type in server */
-#define SERVER_CB_TYPE 200000  /* cb message type in server */
-#define CLIENT_CB_TYPE 300000  /* cb message type in client */
-
 #define MEMTYPE_SUPPORT_MAX (1024 * 1024) /* 1MB */
 
 enum {
@@ -53,15 +48,33 @@ enum {
        MM_SOUND_MSG_RES_GET_AUDIO_ROUTE = 17,
        MM_SOUND_MSG_REQ_SET_AUDIO_ROUTE = 18,
        MM_SOUND_MSG_RES_SET_AUDIO_ROUTE = 19,
+#endif // PULSE_CLIENT
        MM_SOUND_MSG_REQ_IS_BT_A2DP_ON = 20,
        MM_SOUND_MSG_RES_IS_BT_A2DP_ON = 21,
-#endif // PULSE_CLIENT
-        MM_SOUND_MSG_REQ_DTMF          = 22,
-       MM_SOUND_MSG_RES_DTMF   = 23,
+       MM_SOUND_MSG_REQ_DTMF  = 22,
+       MM_SOUND_MSG_RES_DTMF = 23,
+       MM_SOUND_MSG_REQ_IS_ROUTE_AVAILABLE,
+       MM_SOUND_MSG_RES_IS_ROUTE_AVAILABLE,
+       MM_SOUND_MSG_REQ_FOREACH_AVAILABLE_ROUTE_CB,
+       MM_SOUND_MSG_RES_FOREACH_AVAILABLE_ROUTE_CB,
+       MM_SOUND_MSG_INF_FOREACH_AVAILABLE_ROUTE_CB,
+       MM_SOUND_MSG_REQ_SET_ACTIVE_ROUTE,
+       MM_SOUND_MSG_RES_SET_ACTIVE_ROUTE,
+       MM_SOUND_MSG_REQ_GET_ACTIVE_DEVICE,
+       MM_SOUND_MSG_RES_GET_ACTIVE_DEVICE,
+       MM_SOUND_MSG_REQ_ADD_ACTIVE_DEVICE_CB,
+       MM_SOUND_MSG_RES_ADD_ACTIVE_DEVICE_CB,
+       MM_SOUND_MSG_REQ_REMOVE_ACTIVE_DEVICE_CB,
+       MM_SOUND_MSG_RES_REMOVE_ACTIVE_DEVICE_CB,
+       MM_SOUND_MSG_INF_ACTIVE_DEVICE_CB,
+       MM_SOUND_MSG_REQ_ADD_AVAILABLE_ROUTE_CB,
+       MM_SOUND_MSG_RES_ADD_AVAILABLE_ROUTE_CB,
+       MM_SOUND_MSG_REQ_REMOVE_AVAILABLE_ROUTE_CB,
+       MM_SOUND_MSG_RES_REMOVE_AVAILABLE_ROUTE_CB,
+       MM_SOUND_MSG_INF_AVAILABLE_ROUTE_CB,
 };
 
 #define DSIZE sizeof(mm_ipc_msg_t)-sizeof(long)        /* data size for rcv & snd */
-#define CONVERT_MSG_REQ_RES(A) ((A) + (MM_SOUND_MSG_RES_NODE - MM_SOUND_MSG_REQ_NODE))
 
 #endif /* __MM_SOUND_MSG_H__  */
 
index 2534daa..82cda96 100644 (file)
@@ -94,22 +94,16 @@ enum MMSoundPathOptionType {
        MM_SOUND_PATH_OPTION_NONE                                       = 0x00000000,   /**< no sound path option */
        MM_SOUND_PATH_OPTION_AUTO_HEADSET_CONTROL       = 0x00000001,   /**< automatic sound path change by earphone event */
        MM_SOUND_PATH_OPTION_SPEAKER_WITH_HEADSET       = 0x00000002,   /**< play sound via speaker and earphone (if inserted) */
-       MM_SOUND_PATH_OPTION_LEFT_SPEAKER_ONLY          = 0x00000004,   /**< not used */
-       MM_SOUND_PATH_OPTION_RIGHT_SPEAKER_ONLY         = 0x00000008,   /**< not used */
        MM_SOUND_PATH_OPTION_VOICECALL_REC                      = 0x00000010,   /**< voice call recording option */
        MM_SOUND_PATH_OPTION_USE_SUB_MIC                                = 0x00000020,   /**< use sub-mic on call and recording */
-       MM_SOUND_PATH_OPTION_LEGACY_MODE                                = 0x10000000,   /**< not used */
 };
 
-/**
- * Sound param
- */
-enum {
-       MMSOUNDPARAM_FOLLOWING_ROUTE_POLICY,
-       MMSOUNDPARAM_SPEAKER_ONLY,
-       MMSOUNDPARAM_EARPHONE_AUTO,
-       MMSOUNDPARAM_SPEAKER_WITH_EARPHONE,
+
+enum mm_sound_handle_route_t {
+       MM_SOUND_HANDLE_ROUTE_USING_CURRENT,
+       MM_SOUND_HANDLE_ROUTE_SPEAKER
 };
+
 typedef struct {
        const char                      *filename;              /**< filename to play */
        int                                     volume;                 /**< relative volume level */
@@ -118,7 +112,7 @@ typedef struct {
        void                            *data;                  /**< user data to callback */
        void                            *mem_ptr;               /**< memory buffer to play */
        int                                     mem_size;               /**< size of memory buffer */
-       int                                     bluetooth;              /**< 1 for speaker only, 0 for by route policy */
+       int                                     handle_route;   /**< 1 for speaker, 0 for current */
        int                                     volume_table;   /**< Volume Type (SW Volume table type) */
        int                                     priority;               /**< 0 or 1 */
 } MMSoundParamType;
diff --git a/include/mm_sound_utils.h b/include/mm_sound_utils.h
new file mode 100644 (file)
index 0000000..aadf9e5
--- /dev/null
@@ -0,0 +1,52 @@
+/*
+ * libmm-sound
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Seungbae Shin <seungbae.shin@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.
+ *
+ */
+
+/**
+ * @file               mm_sound_utils.h
+ * @brief              Internal utility library for sound module.
+ * @date
+ * @version            Release
+ *
+ * Internal utility library for sound module.
+ */
+
+#ifndef __MM_SOUND_UTILS_H__
+#define __MM_SOUND_UTILS_H__
+
+#include <mm_types.h>
+#include <mm_error.h>
+
+#include "../include/mm_sound.h"
+
+#ifdef __cplusplus
+       extern "C" {
+#endif
+
+int _mm_sound_get_valid_route_list(mm_sound_route **route_list);
+bool _mm_sound_is_route_valid(mm_sound_route route);
+void _mm_sound_get_devices_from_route(mm_sound_route route, mm_sound_device_in *device_in, mm_sound_device_out *device_out);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __MM_SOUND_UTILS_H__ */
+
diff --git a/init/mmfwaudio b/init/mmfwaudio
new file mode 100755 (executable)
index 0000000..9ddc192
--- /dev/null
@@ -0,0 +1,10 @@
+#!/bin/sh
+#
+### BEGIN INIT INFO
+# Provides:          mmfwaudio
+# Default-Start:     2 3 4 5
+# Default-Stop:      0 1 6
+# Short-Description: start sound_server daemon
+### END INIT INFO
+
+dlogutil -v threadtime -f /var/log/mmfw_audio.log -r 1000 -n 10 MMFW_AVAUDIO:W MMFW_SOUND MMFW_SESSIONMGR &
index 67dffdc..d7b7884 100755 (executable)
@@ -7,7 +7,6 @@
 # Short-Description: start sound_server daemon
 ### END INIT INFO
 
-
 if [ -x /usr/bin/sound_server ]; then
-        /usr/bin/sound_server -S&
-fi 
+       /usr/bin/sound_server -S&
+fi
index 6eee30b..e92cef3 100644 (file)
@@ -38,6 +38,7 @@
 #include <mm_debug.h>
 #include "include/mm_sound_private.h"
 #include "include/mm_sound.h"
+#include "include/mm_sound_utils.h"
 #include "include/mm_sound_client.h"
 #include "include/mm_ipc.h"
 #include "include/mm_sound_common.h"
@@ -53,6 +54,9 @@
 #define _MAX_SYSTEM_SAMPLERATE 48000
 #define MIN_TONE_PLAY_TIME 300
 
+#define        TRUE    1
+#define        FALSE   0
+
 typedef struct {
        volume_callback_fn      func;
        void*                           data;
@@ -63,6 +67,23 @@ volume_cb_param g_volume_param[VOLUME_TYPE_MAX];
 
 static pthread_mutex_t _volume_mutex = PTHREAD_MUTEX_INITIALIZER;
 
+typedef struct {
+       avsys_handle_t          audio_handle;
+       int                                     asm_handle;
+       ASM_sound_events_t      asm_event;
+
+       int                             is_started;
+
+       MMMessageCallback       msg_cb;
+       void *msg_cb_param;
+
+
+} mm_sound_pcm_t;
+
+static int _pcm_sound_start (MMSoundPcmHandle_t handle);
+static int _pcm_sound_stop_internal (MMSoundPcmHandle_t handle);
+static int _pcm_sound_stop(MMSoundPcmHandle_t handle);
+
 int _validate_volume(volume_type_t type, int value)
 {
        if (value < 0)
@@ -70,7 +91,6 @@ int _validate_volume(volume_type_t type, int value)
 
        switch (type)
        {
-       case VOLUME_TYPE_ALARM:
        case VOLUME_TYPE_CALL:
                if (value >= AVSYS_AUDIO_VOLUME_MAX_BASIC) {
                        return -1;
@@ -78,6 +98,7 @@ int _validate_volume(volume_type_t type, int value)
                break;
        case VOLUME_TYPE_SYSTEM:
        case VOLUME_TYPE_MEDIA:
+       case VOLUME_TYPE_ALARM:
        case VOLUME_TYPE_EXT_JAVA:
        case VOLUME_TYPE_NOTIFICATION:
        case VOLUME_TYPE_RINGTONE:
@@ -206,23 +227,47 @@ int mm_sound_volume_set_value(volume_type_t type, const unsigned int value)
        char *keystr[] = {VCONF_KEY_VOLUME_TYPE_SYSTEM, VCONF_KEY_VOLUME_TYPE_NOTIFICATION, VCONF_KEY_VOLUME_TYPE_ALARM,
                        VCONF_KEY_VOLUME_TYPE_RINGTONE, VCONF_KEY_VOLUME_TYPE_MEDIA, VCONF_KEY_VOLUME_TYPE_CALL,
                        VCONF_KEY_VOLUME_TYPE_ANDROID,VCONF_KEY_VOLUME_TYPE_JAVA};
+       int vconf_value = 0;
+#ifdef SEPARATE_EARPHONE_VOLUME
+       system_audio_route_device_t dev = 0;
+#endif
 
        debug_fenter();
 
        /* Check input param */
-       if(0 > _validate_volume(type, (int)value)) {
+       if (0 > _validate_volume(type, (int)value)) {
                debug_error("invalid volume type %d, value %u\n", type, value);
                return MM_ERROR_INVALID_ARGUMENT;
        }
 
+#ifdef SEPARATE_EARPHONE_VOLUME
+       /* Get volume value from VCONF */
+       if (vconf_get_int(keystr[type], &vconf_value)){
+               debug_error("Can not get %s as %d\n", keystr[type], vconf_value);
+               return MM_ERROR_SOUND_INTERNAL;
+       }
+
+       /* Calculate volume value of current device */
+       mm_sound_route_get_playing_device(&dev);
+       if (dev == SYSTEM_AUDIO_ROUTE_PLAYBACK_DEVICE_EARPHONE) {
+               vconf_value = 0x10000 | (vconf_value & 0x00FF) | (value << 8);
+               debug_log("volume_set_value [earphone] %d(0x%04x)", value, vconf_value);
+       } else {
+               vconf_value = (vconf_value & 0xFF00) | value;
+               debug_log("volume_set_value [speaker] %d(0x%04x)", value, vconf_value);
+       }
+#else
+       vconf_value = value;
+#endif
+
        /* Set volume value to VCONF */
-       if(vconf_set_int(keystr[type], value)) {
-               debug_error("Can not set %s as %d\n", keystr[type], value);
+       if (vconf_set_int(keystr[type], vconf_value)) {
+               debug_error("Can not set %s as %d\n", keystr[type], vconf_value);
                ret = MM_ERROR_SOUND_INTERNAL;
        } else {
                /* update shared memory value */
                ret = avsys_audio_set_volume_by_type(type, value);
-               if(AVSYS_FAIL(ret)) {
+               if (AVSYS_FAIL(ret)) {
                        debug_error("Can not set volume to shared memory 0x%x\n", ret);
                }
        }
@@ -238,23 +283,41 @@ int mm_sound_volume_get_value(volume_type_t type, unsigned int *value)
        char *keystr[] = {VCONF_KEY_VOLUME_TYPE_SYSTEM, VCONF_KEY_VOLUME_TYPE_NOTIFICATION, VCONF_KEY_VOLUME_TYPE_ALARM,
                        VCONF_KEY_VOLUME_TYPE_RINGTONE, VCONF_KEY_VOLUME_TYPE_MEDIA, VCONF_KEY_VOLUME_TYPE_CALL,
                        VCONF_KEY_VOLUME_TYPE_ANDROID,VCONF_KEY_VOLUME_TYPE_JAVA};
+       int vconf_value = 0;
+#ifdef SEPARATE_EARPHONE_VOLUME
+       system_audio_route_device_t dev = 0;
+#endif
 
        debug_fenter();
 
        /* Check input param */
-       if(value == NULL)
+       if (value == NULL)
                return MM_ERROR_INVALID_ARGUMENT;
-       if(type < 0 || type >= VOLUME_TYPE_MAX) {
+       if (type < 0 || type >= VOLUME_TYPE_MAX) {
                debug_error("invalid volume type value %d\n", type);
                return MM_ERROR_INVALID_ARGUMENT;
        }
 
        /* Get volume value from VCONF */
-       if(vconf_get_int(keystr[type], (int*)value)) {
+       if (vconf_get_int(keystr[type], &vconf_value)) {
                debug_error("Can not get value of %s\n", keystr[type]);
                ret = MM_ERROR_SOUND_INTERNAL;
        }
 
+#ifdef SEPARATE_EARPHONE_VOLUME
+       /* Get volume value of current device */
+       mm_sound_route_get_playing_device(&dev);
+       if (dev == SYSTEM_AUDIO_ROUTE_PLAYBACK_DEVICE_EARPHONE) {
+               *value = (vconf_value >> 8) & 0x00FF;
+               debug_log("volume_get_value [earphone] %d(0x%04x)", *value, vconf_value);
+       } else {
+               *value = vconf_value & 0x00FF;
+               debug_log("volume_get_value [speaker] %d(0x%04x)", *value, vconf_value);
+       }
+#else
+       *value = vconf_value;
+#endif
+
        debug_fleave();
        return ret;
 }
@@ -329,17 +392,6 @@ int mm_sound_volume_get_current_playing_type(volume_type_t *type)
 ////     MMSOUND PCM APIs
 ///////////////////////////////////
 
-typedef struct {
-       avsys_handle_t          audio_handle;
-       int                                     asm_handle;
-       ASM_sound_events_t      asm_event;
-       int                                     asm_valid_flag;
-
-       MMMessageCallback       msg_cb;
-       void *msg_cb_param;
-
-} mm_sound_pcm_t;
-
 int _get_asm_event_type(ASM_sound_events_t *type)
 {
        int     sessionType = MM_SESSION_TYPE_SHARE;
@@ -417,18 +469,23 @@ ASM_cb_result_t sound_pcm_asm_callback(int handle, ASM_event_sources_t event_src
                return cb_res;
        }
 
-       debug_log ("command = %d, handle = %p, asm_valid_flag = %d\n",command, pcmHandle, pcmHandle->asm_valid_flag);
+       debug_log ("command = %d, handle = %p, is_started = %d\n",command, pcmHandle, pcmHandle->is_started);
        switch(command)
        {
        case ASM_COMMAND_STOP:
-       case ASM_COMMAND_PAUSE:
-               pcmHandle->asm_valid_flag = 0;
+               /* Do stop */
+               _pcm_sound_stop_internal (pcmHandle);
                cb_res = ASM_CB_RES_PAUSE;
                break;
-       case ASM_COMMAND_PLAY:
+
        case ASM_COMMAND_RESUME:
-               pcmHandle->asm_valid_flag = 1;
-               cb_res = ASM_CB_RES_PLAYING;
+               cb_res = ASM_CB_RES_IGNORE;
+               break;
+
+       case ASM_COMMAND_PAUSE:
+       case ASM_COMMAND_PLAY:
+       case ASM_COMMAND_NONE:
+               debug_error ("Not an expected case!!!!\n");
                break;
        }
 
@@ -494,17 +551,16 @@ int mm_sound_pcm_capture_open(MMSoundPcmHandle_t *handle, const unsigned int rat
                free(pcmHandle);
                return MM_ERROR_POLICY_INTERNAL;
        }
-       /* register asm as playing */
+       /* register asm */
        if(pcmHandle->asm_event != ASM_EVENT_CALL && pcmHandle->asm_event != ASM_EVENT_VIDEOCALL) {
                if(!ASM_register_sound(-1, &pcmHandle->asm_handle, pcmHandle->asm_event,
-                               ASM_STATE_PLAYING, sound_pcm_asm_callback, (void*)pcmHandle, ASM_RESOURCE_NONE, &errorcode))
+                               /* ASM_STATE_PLAYING */ ASM_STATE_NONE, sound_pcm_asm_callback, (void*)pcmHandle, ASM_RESOURCE_NONE, &errorcode))
                {
                        debug_error("ASM_register_sound() failed 0x%x\n", errorcode);
                        free(pcmHandle);
                        return MM_ERROR_POLICY_BLOCKED;
                }
        }
-       pcmHandle->asm_valid_flag = 1;
 
        /* Open */
        param.mode = AVSYS_AUDIO_MODE_INPUT;
@@ -524,10 +580,91 @@ int mm_sound_pcm_capture_open(MMSoundPcmHandle_t *handle, const unsigned int rat
        return size;
 }
 
+static int _pcm_sound_start (MMSoundPcmHandle_t handle)
+{
+       mm_sound_pcm_t *pcmHandle = NULL;
+       int errorcode = 0;
+
+       /* Check input param */
+       pcmHandle = (mm_sound_pcm_t*)handle;
+       if(pcmHandle == NULL)
+               return MM_ERROR_INVALID_ARGUMENT;
+
+       /* ASM set state to PLAYING */
+       if (!ASM_set_sound_state(pcmHandle->asm_handle, pcmHandle->asm_event, ASM_STATE_PLAYING, ASM_RESOURCE_NONE, &errorcode)) {
+               debug_error("ASM_set_sound_state(PLAYING) failed 0x%x\n", errorcode);
+               return MM_ERROR_POLICY_BLOCKED;
+       }
+
+       pcmHandle->is_started = TRUE;
+
+       /* Un-Cork */
+       return avsys_audio_cork(pcmHandle->audio_handle, 0);
+}
+
+
+EXPORT_API
+int mm_sound_pcm_capture_start(MMSoundPcmHandle_t handle)
+{
+       int ret = MM_ERROR_NONE;
+
+       ret = _pcm_sound_start (handle);
+       if (ret != MM_ERROR_NONE)  {
+               debug_error ("_pcm_sound_start() failed (%x)\n", ret);
+               return ret;
+       }
+
+       return ret;
+}
+
+static int _pcm_sound_stop_internal (MMSoundPcmHandle_t handle)
+{
+       mm_sound_pcm_t *pcmHandle = NULL;
+
+       /* Check input param */
+       pcmHandle = (mm_sound_pcm_t*)handle;
+       if(pcmHandle == NULL)
+               return MM_ERROR_INVALID_ARGUMENT;
+
+       pcmHandle->is_started = FALSE;
+
+       /* Cork */
+       return avsys_audio_cork(pcmHandle->audio_handle, 1);
+}
+
+static int _pcm_sound_stop(MMSoundPcmHandle_t handle)
+{
+       mm_sound_pcm_t *pcmHandle = NULL;
+       int errorcode = 0;
+
+       /* Check input param */
+       pcmHandle = (mm_sound_pcm_t*)handle;
+       if(pcmHandle == NULL)
+               return MM_ERROR_INVALID_ARGUMENT;
+
+       /* Set ASM State to STOP */
+       if (!ASM_set_sound_state(pcmHandle->asm_handle, pcmHandle->asm_event, ASM_STATE_STOP, ASM_RESOURCE_NONE, &errorcode)) {
+               debug_error("ASM_set_sound_state(STOP) failed 0x%x\n", errorcode);
+               return MM_ERROR_POLICY_BLOCKED;
+       }
+
+       return _pcm_sound_stop_internal(handle);
+}
+
+
+EXPORT_API
+int mm_sound_pcm_capture_stop(MMSoundPcmHandle_t handle)
+{
+       return _pcm_sound_stop (handle);
+}
+
+
 EXPORT_API
 int mm_sound_pcm_capture_read(MMSoundPcmHandle_t handle, void *buffer, const unsigned int length )
 {
        mm_sound_pcm_t *pcmHandle = NULL;
+       int is_corked = 0;
+       int result = AVSYS_STATE_SUCCESS;
 
        /* Check input param */
        pcmHandle = (mm_sound_pcm_t*)handle;
@@ -540,14 +677,12 @@ int mm_sound_pcm_capture_read(MMSoundPcmHandle_t handle, void *buffer, const uns
        if(length == 0 )
                return 0;
 
-       /* Check ASM */
-       if(!pcmHandle->asm_valid_flag) {
-               return MM_ERROR_POLICY_INTERRUPTED;
+       /* Check State : return fail if not started */
+       if (!pcmHandle->is_started) {
+               /*  not started, return fail */
+               return MM_ERROR_SOUND_INVALID_STATE;
        }
 
-       if(length == 0 )
-               return 0;
-
        /* Read */
        return avsys_audio_read(pcmHandle->audio_handle, buffer, length);
 }
@@ -578,7 +713,6 @@ int mm_sound_pcm_capture_close(MMSoundPcmHandle_t handle)
                if(!ASM_unregister_sound(pcmHandle->asm_handle, pcmHandle->asm_event, &errorcode)) {
                debug_error("ASM_unregister failed in %s with 0x%x\n", __func__, errorcode);
        }
-       pcmHandle->asm_valid_flag = 0;
     }
 
        /* Free handle */
@@ -666,30 +800,31 @@ int mm_sound_pcm_play_open_ex (MMSoundPcmHandle_t *handle, const unsigned int ra
 
        /* Register ASM */
        debug_log ("session start : input asm_event = %d-------------\n", asm_event);
-       //get session type
        if (asm_event == ASM_EVENT_NONE) {
-               if(MM_ERROR_NONE != _get_asm_event_type(&pcmHandle->asm_event)) {
-                       free(pcmHandle);
-                       return MM_ERROR_POLICY_INTERNAL;
-               }
-               //register asm as playing
                if(pcmHandle->asm_event != ASM_EVENT_CALL && pcmHandle->asm_event != ASM_EVENT_VIDEOCALL) {
+                       /* get session type */
+                       if(MM_ERROR_NONE != _get_asm_event_type(&pcmHandle->asm_event)) {
+                               free(pcmHandle);
+                               return MM_ERROR_POLICY_INTERNAL;
+                       }
+
+                       /* register asm */
                        if(!ASM_register_sound(-1, &pcmHandle->asm_handle, pcmHandle->asm_event,
-                                       ASM_STATE_PLAYING, sound_pcm_asm_callback, (void*)pcmHandle, ASM_RESOURCE_NONE, &errorcode)) {
+                                       ASM_STATE_NONE, sound_pcm_asm_callback, (void*)pcmHandle, ASM_RESOURCE_NONE, &errorcode)) {
                                debug_error("ASM_register_sound() failed 0x%x\n", errorcode);
                                free(pcmHandle);
                                return MM_ERROR_POLICY_BLOCKED;
                        }
                }
        } else {
+               /* register asm using asm_event input */
                if(!ASM_register_sound(-1, &pcmHandle->asm_handle, asm_event,
-                               ASM_STATE_PLAYING, NULL, (void*)pcmHandle, ASM_RESOURCE_NONE, &errorcode)) {
+                               ASM_STATE_NONE, NULL, (void*)pcmHandle, ASM_RESOURCE_NONE, &errorcode)) {
                        debug_error("ASM_register_sound() failed 0x%x\n", errorcode);
                        free(pcmHandle);
                        return MM_ERROR_POLICY_BLOCKED;
                }
        }
-       pcmHandle->asm_valid_flag = 1;
 
        param.mode = AVSYS_AUDIO_MODE_OUTPUT;
        param.vol_type = lvol_type;
@@ -720,6 +855,20 @@ int mm_sound_pcm_play_open(MMSoundPcmHandle_t *handle, const unsigned int rate,
 }
 
 EXPORT_API
+int mm_sound_pcm_play_start(MMSoundPcmHandle_t handle)
+{
+       return _pcm_sound_start (handle);
+}
+
+
+EXPORT_API
+int mm_sound_pcm_play_stop(MMSoundPcmHandle_t handle)
+{
+       return _pcm_sound_stop(handle);
+}
+
+
+EXPORT_API
 int mm_sound_pcm_play_write(MMSoundPcmHandle_t handle, void* ptr, unsigned int length_byte)
 {
        mm_sound_pcm_t *pcmHandle = NULL;
@@ -735,9 +884,11 @@ int mm_sound_pcm_play_write(MMSoundPcmHandle_t handle, void* ptr, unsigned int l
        if(length_byte == 0 )
                return 0;
 
-       /* Check ASM */
-       if(!pcmHandle->asm_valid_flag)
-               return MM_ERROR_POLICY_INTERRUPTED;
+       /* Check State : return fail if not started */
+       if (!pcmHandle->is_started) {
+               /* not started, return fail */
+               return MM_ERROR_SOUND_INVALID_STATE;
+       }
 
        /* Write */
        return avsys_audio_write(pcmHandle->audio_handle, ptr, length_byte);
@@ -772,7 +923,6 @@ int mm_sound_pcm_play_close(MMSoundPcmHandle_t handle)
                if(!ASM_unregister_sound(pcmHandle->asm_handle, pcmHandle->asm_event, &errorcode)) {
                debug_error("ASM_unregister failed in %s with 0x%x\n",__func__, errorcode);
        }
-       pcmHandle->asm_valid_flag = 0;
     }
 
        /* Free handle */
@@ -812,7 +962,7 @@ int mm_sound_play_loud_solo_sound(const char *filename, const volume_type_t volu
        param.loop = 1;
        param.volume_table = lvol_type;
        param.priority = AVSYS_AUDIO_PRIORITY_SOLO;
-       param.bluetooth = MMSOUNDPARAM_SPEAKER_ONLY;
+       param.handle_route = MM_SOUND_HANDLE_ROUTE_SPEAKER;
 
        err = MMSoundClientPlaySound(&param, 0, 0, &lhandle);
        if (err < 0) {
@@ -859,7 +1009,7 @@ int mm_sound_play_solo_sound(const char *filename, const volume_type_t volume_ty
        param.loop = 1;
        param.volume_table = lvol_type;
        param.priority = AVSYS_AUDIO_PRIORITY_SOLO;
-       param.bluetooth = MMSOUNDPARAM_FOLLOWING_ROUTE_POLICY;
+       param.handle_route = MM_SOUND_HANDLE_ROUTE_USING_CURRENT;
 
        err = MMSoundClientPlaySound(&param, 0, 0, &lhandle);
        if (err < 0) {
@@ -911,7 +1061,7 @@ int mm_sound_play_sound(const char *filename, const volume_type_t volume_type, m
        param.loop = 1;
        param.volume_table = lvol_type;
        param.priority = AVSYS_AUDIO_PRIORITY_NORMAL;
-       param.bluetooth = AVSYS_AUDIO_HANDLE_ROUTE_FOLLOWING_POLICY;
+       param.handle_route = MM_SOUND_HANDLE_ROUTE_USING_CURRENT;
 
        err = MMSoundClientPlaySound(&param, 0, 0, &lhandle);
        if (err < 0) {
@@ -1078,162 +1228,6 @@ enum {
 EXPORT_API
 int mm_sound_route_set_system_policy (system_audio_route_t route)
 {
-       int ret = MM_ERROR_NONE;
-       int pa_sink = USE_PA_SINK_ALSA;
-       int codec_option = AVSYS_AUDIO_PATH_OPTION_JACK_AUTO;
-       int current_route;
-       int gain, out, in, option; 
-
-       debug_fenter();
-
-       debug_log ("route = %d\n", route);
-       switch(route)
-       {
-       case SYSTEM_AUDIO_ROUTE_POLICY_IGNORE_A2DP:
-               codec_option = AVSYS_AUDIO_PATH_OPTION_JACK_AUTO;
-               pa_sink = USE_PA_SINK_ALSA;
-               break;
-       case SYSTEM_AUDIO_ROUTE_POLICY_HANDSET_ONLY:
-               codec_option = AVSYS_AUDIO_PATH_OPTION_NONE;
-               pa_sink = USE_PA_SINK_ALSA;
-               break;
-       case SYSTEM_AUDIO_ROUTE_POLICY_DEFAULT:
-               codec_option = AVSYS_AUDIO_PATH_OPTION_JACK_AUTO;
-               pa_sink = USE_PA_SINK_A2DP;
-               break;
-       default:
-               debug_error("Unknown route %d\n", route);
-               return MM_ERROR_INVALID_ARGUMENT;
-       }
-
-       if(MM_ERROR_NONE != __mm_sound_lock()) {
-               debug_error("Lock failed\n");
-               return MM_ERROR_SOUND_INTERNAL;
-       }
-
-       /* Vconf check */
-       ret = vconf_get_int(ROUTE_VCONF_KEY, &current_route);
-       if(ret < 0) {
-               debug_error("Can not get current route policy\n");
-               current_route = SYSTEM_AUDIO_ROUTE_POLICY_DEFAULT;
-               if(0 > vconf_set_int(ROUTE_VCONF_KEY, current_route)) {
-                       debug_error("Can not save current audio route policy to %s\n", ROUTE_VCONF_KEY);
-                       if(MM_ERROR_NONE != __mm_sound_unlock()) {
-                               debug_error("Unlock failed\n");
-                               return MM_ERROR_SOUND_INTERNAL;
-                       }
-                       return MM_ERROR_SOUND_INTERNAL;
-               }
-       }
-
-       /* If same as before, do nothing */
-       if(current_route == route)
-       {
-               debug_warning("Same route policy with current. Skip setting\n");
-               if(MM_ERROR_NONE != __mm_sound_unlock()) {
-                       debug_error("Unlock failed\n");
-                       return MM_ERROR_SOUND_INTERNAL;
-               }
-               return MM_ERROR_NONE;
-       }
-
-       /* Get Current gain */
-       avsys_audio_get_path_ex(&gain, &out, &in, &option);                                 
-       debug_msg ("gain = %x, out = %x, in = %x, option = %x\n", gain, out, in, option);   
-       if (gain == AVSYS_AUDIO_GAIN_EX_FMRADIO) {
-               int output_path = 0 ,res = 0;
-               
-               debug_msg ("This is FM radio gain mode.....\n");   
-
-               /* select output path from policy */
-               if (route == SYSTEM_AUDIO_ROUTE_POLICY_HANDSET_ONLY)
-                       output_path = AVSYS_AUDIO_PATH_EX_SPK;
-               else if (route == SYSTEM_AUDIO_ROUTE_POLICY_DEFAULT || route == SYSTEM_AUDIO_ROUTE_POLICY_IGNORE_A2DP)
-                       output_path = AVSYS_AUDIO_PATH_EX_HEADSET;
-
-               /* Do set path */
-               res = avsys_audio_set_path_ex( AVSYS_AUDIO_GAIN_EX_FMRADIO,            
-                                               output_path,                           
-                                               AVSYS_AUDIO_PATH_EX_FMINPUT,                            
-                                               AVSYS_AUDIO_PATH_OPTION_NONE );        
-               if(AVSYS_FAIL(ret)) {
-                       debug_error("Can not set playback sound path, error=0x%x\n", ret);
-                       if(MM_ERROR_NONE != __mm_sound_unlock()) {
-                               debug_error("Unlock failed\n");
-                               return MM_ERROR_SOUND_INTERNAL;
-                       }
-                       return ret;
-               }
-       } else {
-
-               /* Try to change default sink */
-               ret = MMSoundClientSetAudioRoute(pa_sink);
-               if (ret < 0) {
-                       debug_error("MMSoundClientsetAudioRoute() Failed for sink [%d]\n", pa_sink);
-                       if(pa_sink == USE_PA_SINK_ALSA) {
-                               /* PA_A2DP_SINK can be return error; */
-                               if(MM_ERROR_NONE != __mm_sound_unlock()) {
-                                       debug_error("Unlock failed\n");
-                                       return MM_ERROR_SOUND_INTERNAL;
-                               }
-                               return ret;
-                       }
-               }
-
-               /* Do Set path if (IGNORE A2DP or HANDSET) or (DEFAULT with no BT) */
-               if(pa_sink == USE_PA_SINK_ALSA || (pa_sink == USE_PA_SINK_A2DP && ret != MM_ERROR_NONE)) 
-               {
-                       ret = avsys_audio_set_path_ex(AVSYS_AUDIO_GAIN_EX_KEYTONE, AVSYS_AUDIO_PATH_EX_SPK, AVSYS_AUDIO_PATH_EX_NONE, codec_option);
-                       if(AVSYS_FAIL(ret)) {
-                               debug_error("Can not set playback sound path 0x%x\n", ret);
-                               if(MM_ERROR_NONE != __mm_sound_unlock()) {
-                                       debug_error("Unlock failed\n");
-                                       return MM_ERROR_SOUND_INTERNAL;
-                               }
-                               return ret;
-                       }
-                       ret = avsys_audio_set_path_ex(AVSYS_AUDIO_GAIN_EX_VOICEREC, AVSYS_AUDIO_PATH_EX_NONE, AVSYS_AUDIO_PATH_EX_MIC, codec_option);
-                       if(AVSYS_FAIL(ret)) {
-                               debug_error("Can not set capture sound path 0x%x\n", ret);
-                               if(MM_ERROR_NONE != __mm_sound_unlock()) {
-                                       debug_error("Unlock failed\n");
-                                       return MM_ERROR_SOUND_INTERNAL;
-                               }
-                               return ret;
-                       }
-               }
-
-       } /* if (gain == AVSYS_AUDIO_GAIN_EX_FMRADIO) {} else {} */
-       
-       /* Set route policy */
-       ret = avsys_audio_set_route_policy((avsys_audio_route_policy_t)route);
-       if(AVSYS_FAIL(ret)) {
-               debug_error("Can not set route policy to avsystem 0x%x\n", ret);
-               if(MM_ERROR_NONE != __mm_sound_unlock()) {
-                       debug_error("Unlock failed\n");
-                       return MM_ERROR_SOUND_INTERNAL;
-               }
-               return ret;
-       }
-
-       /* update vconf */
-       ret = vconf_set_int(ROUTE_VCONF_KEY, (int)route);
-       if(ret < 0) {
-               debug_error("Can not set route policy to vconf %s\n", ROUTE_VCONF_KEY);
-               if(MM_ERROR_NONE != __mm_sound_unlock()) {
-                       debug_error("Unlock failed\n");
-                       return MM_ERROR_SOUND_INTERNAL;
-               }
-               return MM_ERROR_SOUND_INTERNAL;
-       }
-
-       /* clean up */
-       if(MM_ERROR_NONE != __mm_sound_unlock()) {
-               debug_error("Unlock failed\n");
-               return MM_ERROR_SOUND_INTERNAL;
-       }
-
-       debug_fleave();
        return MM_ERROR_NONE;
 }
 
@@ -1241,54 +1235,7 @@ int mm_sound_route_set_system_policy (system_audio_route_t route)
 EXPORT_API
 int mm_sound_route_get_system_policy (system_audio_route_t *route)
 {
-       int ret = MM_ERROR_NONE;
-       int lv_route = 0;
-       if(route == NULL) {
-               debug_error("Null pointer\n");
-               return MM_ERROR_INVALID_ARGUMENT;
-       }
-
-       if(MM_ERROR_NONE != __mm_sound_lock()) {
-               debug_error("Lock failed\n");
-               return MM_ERROR_SOUND_INTERNAL;
-       }
-       ret = vconf_get_int(ROUTE_VCONF_KEY, &lv_route);
-       if(ret < 0 ) {
-               debug_error("Can not get route policy from vconf. set default\n");
-               if(0> vconf_set_int(ROUTE_VCONF_KEY, SYSTEM_AUDIO_ROUTE_POLICY_DEFAULT))
-               {
-                       debug_error("Set audio route policy to default failed\n");
-                       ret = MM_ERROR_SOUND_INTERNAL;
-               }
-               else {
-                       *route = SYSTEM_AUDIO_ROUTE_POLICY_DEFAULT;
-               }
-       }
-       else {
-               *route = lv_route;
-       }
-
-       if(ret == MM_ERROR_NONE) {
-               avsys_audio_route_policy_t av_route;
-               ret = avsys_audio_get_route_policy((avsys_audio_route_policy_t*)&av_route);
-               if(AVSYS_FAIL(ret)) {
-                       debug_error("Can not get route policy to avsystem 0x%x\n", ret);
-                       av_route = -1;
-               }
-               if(av_route != *route) {
-                       /* match vconf & shared mem info */
-                       ret = avsys_audio_set_route_policy(*route);
-                       if(AVSYS_FAIL(ret)) {
-                               debug_error("avsys_audio_set_route_policy failed 0x%x\n", ret);
-                       }
-               }
-       }
-
-       if(MM_ERROR_NONE != __mm_sound_unlock()) {
-               debug_error("Unlock failed\n");
-               return MM_ERROR_SOUND_INTERNAL;
-       }
-       return ret;
+       return MM_ERROR_NONE;
 }
 
 
@@ -1310,34 +1257,35 @@ int mm_sound_route_get_a2dp_status (int *connected, char **bt_name)
                debug_error("MMSoundClientIsBtA2dpOn() Failed\n");
                return ret;
        }
-               
+
        debug_fleave();
+
        return ret;
 }
 
 EXPORT_API
 int mm_sound_route_get_playing_device(system_audio_route_device_t *dev)
 {
-       avsys_audio_playing_devcie_t status;
+       mm_sound_device_in device_in = MM_SOUND_DEVICE_IN_NONE;
+       mm_sound_device_out device_out = MM_SOUND_DEVICE_OUT_NONE;
 
        if(!dev)
                return MM_ERROR_INVALID_ARGUMENT;
 
-       if(AVSYS_FAIL(avsys_audio_get_playing_device_info(&status)))
-       {
-               debug_error("Can not get playing device info\n");
+       if(MM_ERROR_NONE != mm_sound_get_active_device(&device_in, &device_out)) {
+               debug_error("Can not get active device info\n");
                return MM_ERROR_SOUND_INTERNAL;
        }
 
-       switch(status)
+       switch(device_out)
        {
-       case AVSYS_AUDIO_ROUTE_DEVICE_HANDSET:
+       case MM_SOUND_DEVICE_OUT_SPEAKER:
                *dev = SYSTEM_AUDIO_ROUTE_PLAYBACK_DEVICE_HANDSET;
                break;
-       case AVSYS_AUDIO_ROUTE_DEVICE_BLUETOOTH:
+       case MM_SOUND_DEVICE_OUT_BT_A2DP:
                *dev = SYSTEM_AUDIO_ROUTE_PLAYBACK_DEVICE_BLUETOOTH;
                break;
-       case AVSYS_AUDIO_ROUTE_DEVICE_EARPHONE:
+       case MM_SOUND_DEVICE_OUT_WIRED_ACCESSORY:
                *dev = SYSTEM_AUDIO_ROUTE_PLAYBACK_DEVICE_EARPHONE;
                break;
        default:
@@ -1348,89 +1296,208 @@ int mm_sound_route_get_playing_device(system_audio_route_device_t *dev)
        return MM_ERROR_NONE;
 }
 
+EXPORT_API
+int mm_sound_route_add_change_callback(audio_route_policy_changed_callback_fn func, void *user_data)
+{
+       /* Deprecated */
+       return MM_ERROR_NONE;
+}
 
-typedef struct {
-       audio_route_policy_changed_callback_fn func;
-       void* data;
-}route_change_cb_param;
+EXPORT_API
+int mm_sound_route_remove_change_callback()
+{
+       /* Deprecated */
+       return MM_ERROR_NONE;
+}
+
+#endif /* PULSE_CLIENT */
+
+EXPORT_API
+int mm_sound_system_get_capture_status(system_audio_capture_status_t *status)
+{
+       int err = AVSYS_STATE_SUCCESS;
+       int on_capture = 0;
 
-route_change_cb_param g_route_param;
+       if(!status)
+               return MM_ERROR_INVALID_ARGUMENT;
 
+       err = avsys_audio_get_capture_status(&on_capture);
+       if(err < 0) {
+               debug_error("Can not get capture status with 0x%x\n", err);
+               return MM_ERROR_SOUND_INTERNAL;
+       }
 
-void route_change_vconf_cb(keynode_t *node, void *data)
+       if(on_capture)
+               *status = SYSTEM_AUDIO_CAPTURE_ACTIVE;
+       else
+               *status = SYSTEM_AUDIO_CAPTURE_NONE;
+
+       return MM_ERROR_NONE;
+}
+
+EXPORT_API
+int mm_sound_is_route_available(mm_sound_route route, bool *is_available)
 {
        int ret = MM_ERROR_NONE;
-       int lv_route = 0;
-       route_change_cb_param *param = (route_change_cb_param *) data;
 
-       debug_msg("%s changed callback called\n", vconf_keynode_get_name(node));
-       ret = vconf_get_int(ROUTE_VCONF_KEY, &lv_route);
-       if(ret < 0) {
-               debug_error("Can not get route info from vconf..(in cb func)\n");
-               return;
+       debug_fenter();
+
+       if (!_mm_sound_is_route_valid(route)) {
+               debug_error("route is invalid %d\n", route);
+               return MM_ERROR_INVALID_ARGUMENT;
+       }
+       if (!is_available)
+       {
+               debug_error("is_available is invalid\n");
+               return MM_ERROR_INVALID_ARGUMENT;
        }
 
-       if(param && (param->func != NULL)) {
-               ((audio_route_policy_changed_callback_fn)param->func)(param->data, (system_audio_route_t)lv_route);
+       ret = _mm_sound_client_is_route_available(route, is_available);
+       if (ret < 0) {
+               debug_error("Can not check given route is available\n");
        }
-       return;
+
+       debug_fleave();
+       return ret;
 }
 
 EXPORT_API
-int mm_sound_route_add_change_callback(audio_route_policy_changed_callback_fn func, void *user_data)
+int mm_sound_foreach_available_route_cb(mm_sound_available_route_cb available_route_cb, void *user_data)
 {
        int ret = MM_ERROR_NONE;
 
-       g_route_param.func = func;
-       g_route_param.data = user_data;
+       debug_fenter();
 
-       ret = vconf_notify_key_changed(ROUTE_VCONF_KEY, route_change_vconf_cb, (void *)&g_route_param);
-       if(ret < 0) {
-               debug_error("Can not add callback - vconf error\n");
-               ret = MM_ERROR_SOUND_INTERNAL;
+       if (!available_route_cb)
+       {
+               debug_error("available_route_cb is invalid\n");
+               return MM_ERROR_INVALID_ARGUMENT;
+       }
+
+       ret = _mm_sound_client_foreach_available_route_cb(available_route_cb, user_data);
+       if (ret < 0) {
+               debug_error("Can not set foreach available route callback\n");
        }
+
+       debug_fleave();
        return ret;
 }
 
 EXPORT_API
-int mm_sound_route_remove_change_callback()
+int mm_sound_set_active_route(mm_sound_route route)
 {
        int ret = MM_ERROR_NONE;
 
-       g_route_param.func = NULL;
-       g_route_param.data = NULL;
+       debug_fenter();
 
-       ret = vconf_ignore_key_changed(ROUTE_VCONF_KEY, route_change_vconf_cb);
-       if(ret < 0) {
-               debug_error("Can not add callback - vconf error\n");
-               ret = MM_ERROR_SOUND_INTERNAL;
+       if (!_mm_sound_is_route_valid(route)) {
+               debug_error("route is invalid %d\n", route);
+               return MM_ERROR_INVALID_ARGUMENT;
+       }
+
+       ret = _mm_sound_client_set_active_route(route);
+       if (ret < 0) {
+               debug_error("Can not set active route\n");
        }
+
+       debug_fleave();
        return ret;
 }
 
-#endif /* PULSE_CLIENT */
 
 EXPORT_API
-int mm_sound_system_get_capture_status(system_audio_capture_status_t *status)
+int mm_sound_get_active_device(mm_sound_device_in *device_in, mm_sound_device_out *device_out)
 {
-       int err = AVSYS_STATE_SUCCESS;
-       int on_capture = 0;
+       int ret = MM_ERROR_NONE;
 
-       if(!status)
+       debug_fenter();
+
+       if (device_in == NULL || device_out == NULL) {
+               debug_error("argument is not valid\n");
                return MM_ERROR_INVALID_ARGUMENT;
+       }
 
-       err = avsys_audio_get_capture_status(&on_capture);
-       if(err < 0) {
-               debug_error("Can not get capture status with 0x%x\n", err);
-               return MM_ERROR_SOUND_INTERNAL;
+       ret = _mm_sound_client_get_active_device(device_in, device_out);
+       if (ret < 0) {
+               debug_error("Can not add active device callback\n");
        }
 
-       if(on_capture)
-               *status = SYSTEM_AUDIO_CAPTURE_ACTIVE;
-       else
-               *status = SYSTEM_AUDIO_CAPTURE_NONE;
+       debug_fleave();
+       return ret;
+}
 
-       return MM_ERROR_NONE;
+EXPORT_API
+int mm_sound_add_active_device_changed_callback(mm_sound_active_device_changed_cb func, void *user_data)
+{
+       int ret = MM_ERROR_NONE;
+
+       debug_fenter();
+
+       if (func == NULL) {
+               debug_error("argument is not valid\n");
+               return MM_ERROR_INVALID_ARGUMENT;
+       }
+
+       ret = _mm_sound_client_add_active_device_changed_callback(func, user_data);
+       if (ret < 0) {
+               debug_error("Can not add active device changed callback\n");
+       }
+
+       debug_fleave();
+       return ret;
+}
+
+EXPORT_API
+int mm_sound_remove_active_device_changed_callback(void)
+{
+       int ret = MM_ERROR_NONE;
+
+       debug_fenter();
+
+       ret = _mm_sound_client_remove_active_device_changed_callback();
+       if (ret < 0) {
+               debug_error("Can not remove active device changed callback\n");
+       }
+
+       debug_fleave();
+       return ret;
+}
+
+EXPORT_API
+int mm_sound_add_available_route_changed_callback(mm_sound_available_route_changed_cb func, void *user_data)
+{
+       int ret = MM_ERROR_NONE;
+
+       debug_fenter();
+
+       if (func == NULL) {
+               debug_error("argument is not valid\n");
+               return MM_ERROR_INVALID_ARGUMENT;
+       }
+
+       ret = _mm_sound_client_add_available_route_changed_callback(func, user_data);
+       if (ret < 0) {
+               debug_error("Can not add available route changed callback\n");
+       }
+
+       debug_fleave();
+       return ret;
+}
+
+EXPORT_API
+int mm_sound_remove_available_route_changed_callback(void)
+{
+       int ret = MM_ERROR_NONE;
+
+       debug_fenter();
+
+       ret = _mm_sound_client_remove_available_route_changed_callback();
+       if (ret < 0) {
+               debug_error("Can not remove available route changed callback\n");
+       }
+
+       debug_fleave();
+       return ret;
 }
 
 __attribute__ ((destructor))
index 473ba44..0cfaed1 100644 (file)
@@ -27,7 +27,6 @@
 #include <fcntl.h>
 #include <sys/msg.h>
 #include <assert.h>
-
 #include <errno.h>
 
 #include <pthread.h>
@@ -68,7 +67,7 @@ struct __callback_param
 
 pthread_t g_thread;
 static int g_exit_thread = 0;
-int g_thread_id=-1;
+int g_thread_id = -1;
 int g_mutex_initted = -1;
 pthread_mutex_t g_thread_mutex;
 
@@ -81,21 +80,12 @@ static int __MMIpcSndMsg(mm_ipc_msg_t *msg);
 static int __MMIpcCBRecvMsg(int msgtype, mm_ipc_msg_t *msg);
 static int __MMSoundGetMsg(void);
 
-int MMSoundCallbackInit(void)
-{
-       int ret = MM_ERROR_NONE;
-       debug_enter("\n");
-       
-       g_thread_id = -1;       /* for manage only one thread */
-
-       debug_leave("\n");
-       return ret;
-}
 int MMSoundClientInit(void)
 {
        int ret = MM_ERROR_NONE;
-       debug_enter("\n");
-       debug_leave("\n");
+       debug_fenter();
+
+       debug_fleave();
        return ret;
 }
 
@@ -104,7 +94,7 @@ int MMSoundClientCallbackFini(void)
        mm_ipc_msg_t msgsnd={0,};
        int ret = MM_ERROR_NONE;
        
-       debug_enter("\n");
+       debug_fenter();
 
        /* When the the callback thread is not created, do not wait destory thread */
        /* g_thread_id is initialized : -1 */
@@ -126,10 +116,10 @@ int MMSoundClientCallbackFini(void)
 
        if (g_mutex_initted != -1)
        {
-               pthread_mutex_destroy(&g_thread_mutex);
+               pthread_mutex_destroy(&g_thread_mutex);
                g_mutex_initted = -1;
        }
-       debug_leave("\n");
+       debug_fleave();
        return MM_ERROR_NONE;
 }
 
@@ -181,11 +171,11 @@ static void* callbackfunc(void *param)
        int run = 1;
        int instance;
 
-       debug_enter("\n");
-       
+       debug_fenter();
+
        instance = getpid();
        debug_msg("[Client] callback thread for [%d] is created\n", instance);
-       
+
        msgrcv = (mm_ipc_msg_t*)malloc(sizeof(mm_ipc_msg_t));
        if(NULL == msgrcv)
        {
@@ -207,15 +197,13 @@ static void* callbackfunc(void *param)
                debug_warning("[Client] Waiting message\n");
                ret = __MMIpcCBRecvMsg(instance, msgrcv);
                if (ret != MM_ERROR_NONE)
-               {       
+               {
                        debug_error("[Client] Fail to receive msg in callback\n");
                        continue;
                }
-               
 
                debug_msg("[Client] Receive msgtype : [%d]\n", msgrcv->sound_msg.msgtype);
 
-               
                switch (msgrcv->sound_msg.msgtype)
                {
                case MM_SOUND_MSG_INF_STOP_CB:
@@ -297,32 +285,58 @@ static void* callbackfunc(void *param)
                case MM_SOUND_MSG_INF_DESTROY_CB:
                        run = 0;
                        break;
+
+               case MM_SOUND_MSG_INF_ACTIVE_DEVICE_CB:
+                       debug_msg("[Client] device_in : %p\n", msgrcv->sound_msg.device_in);
+                       debug_msg("[Client] device_out : %p\n", msgrcv->sound_msg.device_out);
+                       debug_msg("[Client] callback : %p\n", msgrcv->sound_msg.callback);
+                       debug_msg("[Client] data : %p\n", msgrcv->sound_msg.cbdata);
+
+                       if (msgrcv->sound_msg.callback)
+                       {
+                               ((mm_sound_active_device_changed_cb)msgrcv->sound_msg.callback)(msgrcv->sound_msg.device_in, msgrcv->sound_msg.device_out, msgrcv->sound_msg.cbdata);
+                       }
+                       break;
+               case MM_SOUND_MSG_INF_AVAILABLE_ROUTE_CB:
+                       debug_msg("[Client] callback : %p\n", msgrcv->sound_msg.callback);
+                       debug_msg("[Client] data : %p\n", msgrcv->sound_msg.cbdata);
+
+                       if (msgrcv->sound_msg.callback)
+                       {
+                               int route_index;
+                               mm_sound_route route;
+
+                               for (route_index = 0; route_index < sizeof(msgrcv->sound_msg.route_list) / sizeof(int); route_index++) {
+                                       route = msgrcv->sound_msg.route_list[route_index];
+                                       if (route == 0)
+                                               break;
+                                       if (msgrcv->sound_msg.is_available) {
+                                               debug_msg("[Client] available route : %d\n", route);
+                                       } else {
+                                               debug_msg("[Client] unavailable route : %d\n", route);
+                                       }
+                                       ((mm_sound_available_route_changed_cb)msgrcv->sound_msg.callback)(route, msgrcv->sound_msg.is_available, msgrcv->sound_msg.cbdata);
+                               }
+                       }
+                       break;
                default:
                        /* Unexpected msg */
                        debug_msg("Receive wrong msg in callback func\n");
                        break;
                }
-
-
        }
        if(msgrcv)
                free(msgrcv);
 
        g_exit_thread = 1;
        debug_msg("[Client] callback [%d] is leaved\n", instance);
-       debug_leave("\n");
+       debug_fleave();
        return NULL;
 }
 
-int MMSoundClientPlayTone(int number, int vol_type, double volume, int time, int *handle)
+static int __mm_sound_client_get_msg_queue(void)
 {
-       mm_ipc_msg_t msgrcv = {0,};
-       mm_ipc_msg_t msgsnd = {0,};
-
        int ret = MM_ERROR_NONE;
-       int instance = -1;      /* instance is unique to communicate with server : client message queue filter type */
-
-       debug_enter("\n");
 
        if (g_mutex_initted == -1)
        {
@@ -335,10 +349,25 @@ int MMSoundClientPlayTone(int number, int vol_type, double volume, int time, int
                if(ret != MM_ERROR_NONE)
                {
                        debug_critical("[Client] Fail to get message queue id\n");
-                       return ret;
                }
        }
 
+       return ret;
+}
+
+int MMSoundClientPlayTone(int number, int vol_type, double volume, int time, int *handle)
+{
+       mm_ipc_msg_t msgrcv = {0,};
+       mm_ipc_msg_t msgsnd = {0,};
+
+       int ret = MM_ERROR_NONE;
+       int instance = -1;      /* instance is unique to communicate with server : client message queue filter type */
+
+       debug_fenter();
+
+       if (__mm_sound_client_get_msg_queue() != MM_ERROR_NONE)
+               return ret;
+
        /* read mm-session type */
        int sessionType = MM_SESSION_TYPE_SHARE;
        if(MM_ERROR_NONE != _mm_session_util_read_type(-1, &sessionType))
@@ -408,7 +437,7 @@ int MMSoundClientPlayTone(int number, int vol_type, double volume, int time, int
 cleanup:
        pthread_mutex_unlock(&g_thread_mutex);
 
-       debug_leave("\n");
+       debug_fleave();
        return ret;
 }
 
@@ -427,23 +456,12 @@ int MMSoundClientPlaySound(MMSoundParamType *param, int tone, int keytone, int *
        static int keybase = 0;
        int shm_fd = -1;
 
-       debug_enter("\n");
+       debug_fenter();
        memset(shm_name, 0, sizeof(shm_name));
 
-       if (g_mutex_initted == -1)
-       {
-               pthread_mutex_init(&g_thread_mutex, NULL);
-               debug_msg("[Client] mutex initialized. \n");
-               g_mutex_initted = 1;            
-
-               /* Get msg queue id */
-               ret = __MMSoundGetMsg();
-               if(ret != MM_ERROR_NONE)
-               {
-                       debug_critical("[Client] Fail to get message queue id\n");
-                       return ret;
-               }
-       }
+       ret = __mm_sound_client_get_msg_queue();
+       if (ret != MM_ERROR_NONE)
+               return ret;
 
        /* read mm-session type */
        int sessionType = MM_SESSION_TYPE_SHARE;
@@ -548,7 +566,7 @@ int MMSoundClientPlaySound(MMSoundParamType *param, int tone, int keytone, int *
                msgsnd.sound_msg.repeat = param->loop;
                msgsnd.sound_msg.volume_table = param->volume_table;
                msgsnd.sound_msg.keytone = keytone;
-               msgsnd.sound_msg.handle_route = param->bluetooth;
+               msgsnd.sound_msg.handle_route = param->handle_route;
 
                /* Send req memory */
                debug_msg("[Client] Shared mem ptr %p, %p, size %d\n", sharedmem, param->mem_ptr, param->mem_size);
@@ -583,7 +601,7 @@ int MMSoundClientPlaySound(MMSoundParamType *param, int tone, int keytone, int *
                msgsnd.sound_msg.volume_table = param->volume_table;
                msgsnd.sound_msg.session_type = sessionType;//asm_session_type;
                msgsnd.sound_msg.priority = param->priority;
-               msgsnd.sound_msg.handle_route = param->bluetooth;
+               msgsnd.sound_msg.handle_route = param->handle_route;
 
                if((strlen(param->filename)) < FILE_PATH)
                {
@@ -650,7 +668,7 @@ int MMSoundClientPlaySound(MMSoundParamType *param, int tone, int keytone, int *
 cleanup:
        pthread_mutex_unlock(&g_thread_mutex);
 
-       debug_leave("\n");
+       debug_fleave();
        return ret;
 }
 
@@ -661,7 +679,7 @@ int MMSoundClientStopSound(int handle)
        int ret = MM_ERROR_NONE;
        int instance;
 
-       debug_enter("\n");
+       debug_fenter();
        debug_msg("[Client] The stop audio handle ::: [%d]\n", handle);
 
        instance = getpid();
@@ -672,23 +690,9 @@ int MMSoundClientStopSound(int handle)
                return ret;
        }
        
-       /* For exception, if MMSoundStopSound is called at first, mutex & message queue must be initialized */
-       if (g_mutex_initted == -1)
-       {
-               pthread_mutex_init(&g_thread_mutex, NULL);
-               debug_msg("[Client] mutex initialized. \n");
-               g_mutex_initted = 1;            
-
-               /* Get msg queue id */
-               ret = __MMSoundGetMsg();
-               if(ret != MM_ERROR_NONE)
-               {
-                       debug_critical("[Client] Fail to get message queue id\n");
-                       return ret;
-               }
-       }
+       if (__mm_sound_client_get_msg_queue() != MM_ERROR_NONE)
+               return ret;
 
-                       
        pthread_mutex_lock(&g_thread_mutex);
        
        /* Send req STOP */
@@ -731,264 +735,345 @@ cleanup:
        pthread_mutex_unlock(&g_thread_mutex);
 
 
-       debug_leave("\n");
+       debug_fleave();
        return ret;
 }
 
-static int __MMIpcCBSndMsg(mm_ipc_msg_t *msg)
+int _mm_sound_client_is_route_available(mm_sound_route route, bool *is_available)
 {
-       /* rcv message */
-       msg->msg_type = msg->sound_msg.msgid;
-       if (msgsnd(g_msg_sccb, msg,DSIZE, 0)== -1)
+       mm_ipc_msg_t msgrcv = {0,};
+       mm_ipc_msg_t msgsnd = {0,};
+       int ret = MM_ERROR_NONE;
+       int instance;
+
+       debug_fenter();
+
+       *is_available = FALSE;
+
+       if (__mm_sound_client_get_msg_queue() != MM_ERROR_NONE)
+               return ret;
+
+       pthread_mutex_lock(&g_thread_mutex);
+
+       instance = getpid();
+       /* Send REQ_IS_ROUTE_AVAILABLE */
+       msgsnd.sound_msg.msgtype = MM_SOUND_MSG_REQ_IS_ROUTE_AVAILABLE;
+       msgsnd.sound_msg.msgid = instance;
+       msgsnd.sound_msg.route = route;
+
+       if (__MMIpcSndMsg(&msgsnd) != MM_ERROR_NONE)
+               goto cleanup;
+
+       /* Recieve */
+       if (__MMIpcRecvMsg(instance, &msgrcv) != MM_ERROR_NONE)
+               goto cleanup;
+
+       switch (msgrcv.sound_msg.msgtype)
        {
-               if(errno == EACCES)
-               {
-                       debug_warning("[Client] Not acces.\n");
-               }
-               else if(errno == EAGAIN)
-               {
-                       debug_warning("[Client] Blocked process [msgflag & IPC_NOWAIT != 0]\n");
-               }
-               else if(errno == EIDRM)
-               {
-                       debug_warning("[Client] Removed msgid from system\n");
-               }
-               else if(errno == EINTR)
-               {
-                       debug_warning("[Client] Iterrrupted by singnal\n");
-               }
-               else if(errno == EINVAL)
-               {
-                       debug_warning("[Client] Invalid msgid or msgtype < 1 or out of data size \n");
-               }
-               debug_critical("[Client] Fail to callback send message msgid : [%d] \n", g_msg_sccb);
-               return MM_ERROR_COMMON_UNKNOWN;
+       case MM_SOUND_MSG_RES_IS_ROUTE_AVAILABLE:
+               *is_available = msgrcv.sound_msg.is_available;
+               debug_msg("[Client] Success to check given route is available %d\n", *is_available);
+               break;
+       case MM_SOUND_MSG_RES_ERROR:
+               debug_error("[Client] Error occurred \n");
+               ret = msgrcv.sound_msg.code;
+               goto cleanup;
+               break;
+       default:
+               debug_critical("[Client] Unexpected state with communication \n");
+               ret = msgrcv.sound_msg.code;
+               goto cleanup;
+               break;
        }
-       return MM_ERROR_NONE;
+
+cleanup:
+       pthread_mutex_unlock(&g_thread_mutex);
+
+       debug_fleave();
+       return ret;
 }
 
-static int __MMIpcCBRecvMsg(int msgtype, mm_ipc_msg_t *msg)
+static int _handle_foreach_callback(mm_ipc_msg_t *msg)
 {
-       /* rcv message */
-       if(msgrcv(g_msg_sccb, msg, DSIZE, msgtype, 0) == -1)
-       {
-               if(errno == E2BIG)
-               {
-                       debug_warning("[Client] Not acces.\n");
-               }
-               else if(errno == EACCES)
-               {
-                       debug_warning("[Client] Access denied\n");
-               }
-               else if(errno == ENOMSG)
-               {
-                       debug_warning("[Client] Blocked process [msgflag & IPC_NOWAIT != 0]\n");
-               }
-               else if(errno == EIDRM)
-               {
-                       debug_warning("[Client] Removed msgid from system\n");
-               }
-               else if(errno == EINTR)
-               {
-                       debug_warning("[Client] Iterrrupted by singnal\n");
-               }
-               else if(errno == EINVAL)
-               {
-                       debug_warning("[Client] Invalid msgid \n");
-               }
+       int instance;
+       int route_index;
+       mm_sound_route route;
 
-               debug_critical("[Client] Fail to callback receive msgid : [%d] \n", g_msg_sccb);
-               return MM_ERROR_COMMON_UNKNOWN;
+       debug_fenter();
+
+       if (msg->sound_msg.callback == NULL) {
+               debug_error ("[Client] Foreach callback is [%p], cbdata = %p => exit",
+                               msg->sound_msg.callback, msg->sound_msg.cbdata);
+               return MM_ERROR_SOUND_INTERNAL;
        }
+
+       for (route_index = 0; route_index < sizeof(msg->sound_msg.route_list); route_index++) {
+               route = msg->sound_msg.route_list[route_index];
+               if (route == 0)
+                       break;
+               debug_msg("[Client] available route : %d\n", route);
+               if (((mm_sound_available_route_cb)msg->sound_msg.callback)(route, msg->sound_msg.cbdata) == false) {
+                       debug_msg ("[Client] user doesn't want anymore. quit loop!!\n");
+                       break;
+               }
+       }
+
+       debug_fleave();
+
        return MM_ERROR_NONE;
 }
 
-static int __MMIpcRecvMsg(int msgtype, mm_ipc_msg_t *msg)
+int _mm_sound_client_foreach_available_route_cb(mm_sound_available_route_cb available_route_cb, void *user_data)
 {
-       /* rcv message */
+       mm_ipc_msg_t msgrcv = {0,};
+       mm_ipc_msg_t msgsnd = {0,};
+       int ret = MM_ERROR_NONE;
+       int instance;
+       pthread_t thread_forech;
 
-       int retry_count = 0;
-       while(msgrcv(g_msg_scrcv, msg, DSIZE, msgtype, IPC_NOWAIT) == -1)
-       {
-               if(errno == ENOMSG)
-               {
-                       if (retry_count < 20000) /* usec is 10^-6 sec so, 5ms * 20000 = 10sec. */
-                       {
-                               usleep(5000);
-                               retry_count++;
-                               continue;
-                       }
-                       else
-                       {
-                               return MM_ERROR_SOUND_INTERNAL;
-                       }
-               }
-               else if(errno == E2BIG)
-               {
-                       debug_warning("[Client] Not acces.\n");
-               }
-               else if(errno == EACCES)
-               {
-                       debug_warning("[Client] Access denied\n");
-               }
-               else if(errno == ENOMSG)
-               {
-                       debug_warning("[Client] Blocked process [msgflag & IPC_NOWAIT != 0]\n");
-               }
-               else if(errno == EIDRM)
-               {
-                       debug_warning("[Client] Removed msgid from system\n");
-               }
-               else if(errno == EINTR)
-               {
-                       debug_warning("[Client] Iterrrupted by singnal\n");
-               continue;
-               }
-               else if(errno == EINVAL)
-               {
-                       debug_warning("[Client] Invalid msgid \n");
-               }
+       debug_fenter();
 
-               debug_warning("[Client] Fail to recive msgid : [%d] \n", g_msg_scrcv);
-               return MM_ERROR_COMMON_UNKNOWN;
+       if (__mm_sound_client_get_msg_queue() != MM_ERROR_NONE)
+               return ret;
+
+       pthread_mutex_lock(&g_thread_mutex);
+
+       instance = getpid();
+       /* Send REQ_FOREACH_AVAILABLE_ROUTE_CB */
+       msgsnd.sound_msg.msgtype = MM_SOUND_MSG_REQ_FOREACH_AVAILABLE_ROUTE_CB;
+       msgsnd.sound_msg.msgid = instance;
+       msgsnd.sound_msg.callback = (void *)available_route_cb;
+       msgsnd.sound_msg.cbdata = (void *)user_data;
+
+       if (__MMIpcSndMsg(&msgsnd) != MM_ERROR_NONE)
+               goto cleanup;
+
+       /* Recieve */
+       if (__MMIpcRecvMsg(instance, &msgrcv) != MM_ERROR_NONE)
+               goto cleanup;
+
+       switch (msgrcv.sound_msg.msgtype)
+       {
+       case MM_SOUND_MSG_RES_FOREACH_AVAILABLE_ROUTE_CB:
+               debug_msg("[Client] Success to set foreach available route callback\n");
+               msgrcv.sound_msg.callback = (void *)available_route_cb;
+               msgrcv.sound_msg.cbdata = (void *)user_data;
+               ret = _handle_foreach_callback (&msgrcv);
+               break;
+       case MM_SOUND_MSG_RES_ERROR:
+               debug_error("[Client] Error occurred \n");
+               ret = msgrcv.sound_msg.code;
+               goto cleanup;
+               break;
+       default:
+               debug_critical("[Client] Unexpected state with communication \n");
+               ret = msgrcv.sound_msg.code;
+               goto cleanup;
+               break;
        }
-     debug_log("[Client] Retry %d times when receive msg\n", retry_count);
 
-       return MM_ERROR_NONE;
+cleanup:
+       pthread_mutex_unlock(&g_thread_mutex);
+
+       debug_fleave();
+       return ret;
 }
 
-static int __MMIpcSndMsg(mm_ipc_msg_t *msg)
+int _mm_sound_client_set_active_route(mm_sound_route route)
 {
-       /* rcv message */
-       msg->msg_type = msg->sound_msg.msgid;
-       if (msgsnd(g_msg_scsnd, msg,DSIZE, 0) == -1)
-       {
-               if(errno == EACCES)
-               {
-                       debug_warning("[Client] Not access.\n");
-               }
-               else if(errno == EAGAIN)
-               {
-                       debug_warning("[Client] Blocked process msgflag & IPC_NOWAIT != 0]\n");
-               }
-               else if(errno == EIDRM)
-               {
-                       debug_warning("[Client] Removed msgid from system\n");
-               }
-               else if(errno == EINTR)
-               {
-                       debug_warning("[Client] Iterrrupted by singnal\n");
-               }
-               else if(errno == EINVAL)
-               {
-                       debug_warning("Invalid msgid or msgtype < 1 or out of data size \n");
-               }
-               else if(errno == EFAULT)
-               {
-                       debug_warning("[Client] The address pointed to by msgp isn't accessible \n");
-               }
-               else if(errno == ENOMEM)
-               {
-                       debug_warning("[Client] The system does not have enough memory to make a copy of the message pointed to by msgp\n");
-               }
+       mm_ipc_msg_t msgrcv = {0,};
+       mm_ipc_msg_t msgsnd = {0,};
+       int ret = MM_ERROR_NONE;
+       int instance;
 
-               debug_critical("[Client] Fail to send message msgid : [%d] \n", g_msg_scsnd);
-               return MM_ERROR_SOUND_INTERNAL;
+       debug_fenter();
+
+       if (__mm_sound_client_get_msg_queue() != MM_ERROR_NONE)
+               return ret;
+
+       pthread_mutex_lock(&g_thread_mutex);
+
+       instance = getpid();
+       /* Send REQ_SET_ACTIVE_ROUTE */
+       msgsnd.sound_msg.msgtype = MM_SOUND_MSG_REQ_SET_ACTIVE_ROUTE;
+       msgsnd.sound_msg.msgid = instance;
+       msgsnd.sound_msg.route = route;
+
+       if (__MMIpcSndMsg(&msgsnd) != MM_ERROR_NONE)
+               goto cleanup;
+
+       /* Recieve */
+       if (__MMIpcRecvMsg(instance, &msgrcv) != MM_ERROR_NONE)
+               goto cleanup;
+
+       switch (msgrcv.sound_msg.msgtype)
+       {
+       case MM_SOUND_MSG_RES_SET_ACTIVE_ROUTE:
+               debug_msg("[Client] Success to add active device callback\n");
+               break;
+       case MM_SOUND_MSG_RES_ERROR:
+               debug_error("[Client] Error occurred \n");
+               ret = msgrcv.sound_msg.code;
+               goto cleanup;
+               break;
+       default:
+               debug_critical("[Client] Unexpected state with communication \n");
+               ret = msgrcv.sound_msg.code;
+               goto cleanup;
+               break;
        }
-       return MM_ERROR_NONE;
+
+cleanup:
+       pthread_mutex_unlock(&g_thread_mutex);
+
+       debug_fleave();
+       return ret;
 }
 
-static int __MMSoundGetMsg(void)
+int _mm_sound_client_get_active_device(mm_sound_device_in *device_in, mm_sound_device_out *device_out)
 {
-       /* Init message queue, generate msgid for communication to server */
-       /* The key value to get msgid is defined "mm_sound_msg.h". Shared with server */
-       
-       debug_enter("\n");
-       
-       /* get msg queue rcv, snd, cb */        
-       g_msg_scsnd     = msgget(ftok(KEY_BASE_PATH, RCV_MSG), 0666);
-       g_msg_scrcv     = msgget(ftok(KEY_BASE_PATH, SND_MSG), 0666);
-       g_msg_sccb      = msgget(ftok(KEY_BASE_PATH, CB_MSG), 0666);
+       mm_ipc_msg_t msgrcv = {0,};
+       mm_ipc_msg_t msgsnd = {0,};
+       int ret = MM_ERROR_NONE;
+       int instance;
+
+       debug_fenter();
+
+       if (__mm_sound_client_get_msg_queue() != MM_ERROR_NONE)
+               return ret;
+
+       pthread_mutex_lock(&g_thread_mutex);
+
+       instance = getpid();
+       /* Send REQ_GET_ACTIVE_DEVICE */
+       msgsnd.sound_msg.msgtype = MM_SOUND_MSG_REQ_GET_ACTIVE_DEVICE;
+       msgsnd.sound_msg.msgid = instance;
+
+       if (__MMIpcSndMsg(&msgsnd) != MM_ERROR_NONE)
+               goto cleanup;
+
+       /* Recieve */
+       if (__MMIpcRecvMsg(instance, &msgrcv) != MM_ERROR_NONE)
+               goto cleanup;
 
-       if ((g_msg_scsnd == -1 || g_msg_scrcv == -1 || g_msg_sccb == -1) != MM_ERROR_NONE)
+       switch (msgrcv.sound_msg.msgtype)
        {
-               if(errno == EACCES)
-               {
-                       debug_warning("Require ROOT permission.\n");
-               }
-               else if(errno == ENOMEM)
-               {
-                       debug_warning("System memory is empty.\n");
-               }
-               else if(errno == ENOSPC)
-               {
-                       debug_warning("Resource is empty.\n");
-               }
-               debug_error("Fail to GET msgid\n");
-               return MM_ERROR_SOUND_INTERNAL;
+       case MM_SOUND_MSG_RES_GET_ACTIVE_DEVICE:
+               *device_in = msgrcv.sound_msg.device_in;
+               *device_out = msgrcv.sound_msg.device_out;
+               debug_msg("[Client] Success to get active device %d %d\n", *device_in, *device_out);
+               break;
+       case MM_SOUND_MSG_RES_ERROR:
+               debug_error("[Client] Error occurred \n");
+               ret = msgrcv.sound_msg.code;
+               goto cleanup;
+               break;
+       default:
+               debug_critical("[Client] Unexpected state with communication \n");
+               ret = msgrcv.sound_msg.code;
+               goto cleanup;
+               break;
        }
-       
-       debug_msg("Get msg queue id from server : [%d]\n", g_msg_scsnd);
-       debug_msg("Get msg queue id from server : [%d]\n", g_msg_scrcv);
-       debug_msg("Get msg queue id from server : [%d]\n", g_msg_sccb);
-       
-       debug_leave("\n");
-       return MM_ERROR_NONE;
+
+cleanup:
+       pthread_mutex_unlock(&g_thread_mutex);
+
+       debug_fleave();
+       return ret;
 }
 
-#ifdef PULSE_CLIENT
-int MMSoundClientGetAudioRoute()
+int _mm_sound_client_add_active_device_changed_callback(mm_sound_active_device_changed_cb func, void* user_data)
 {
        mm_ipc_msg_t msgrcv = {0,};
        mm_ipc_msg_t msgsnd = {0,};
        int ret = MM_ERROR_NONE;
        int instance;
 
-       debug_enter("\n");
+       debug_fenter();
 
-       instance = getpid();    
+       if (__mm_sound_client_get_msg_queue() != MM_ERROR_NONE)
+               return ret;
 
-       /* For exception, if MMSoundStopSound is called at first, mutex & messagequeue must be initialized */
-       if (g_mutex_initted == -1)
-       {
-               pthread_mutex_init(&g_thread_mutex, NULL);
-               debug_msg("mutex initialized. \n");
-               g_mutex_initted = 1;
+       pthread_mutex_lock(&g_thread_mutex);
 
-               /* Get msg queue id */
-               ret = __MMSoundGetMsg();
-               if(ret != MM_ERROR_NONE)
+       instance = getpid();
+       /* Send REQ_ADD_ACTIVE_DEVICE_CB */
+       msgsnd.sound_msg.msgtype = MM_SOUND_MSG_REQ_ADD_ACTIVE_DEVICE_CB;
+       msgsnd.sound_msg.msgid = instance;
+       msgsnd.sound_msg.callback = func;
+       msgsnd.sound_msg.cbdata = user_data;
+
+       if (__MMIpcSndMsg(&msgsnd) != MM_ERROR_NONE)
+               goto cleanup;
+
+       /* Recieve */
+       if (__MMIpcRecvMsg(instance, &msgrcv) != MM_ERROR_NONE)
+               goto cleanup;
+
+       switch (msgrcv.sound_msg.msgtype)
+       {
+       case MM_SOUND_MSG_RES_ADD_ACTIVE_DEVICE_CB:
+               debug_msg("[Client] Success to add active device callback\n");
+               if (g_thread_id == -1)
                {
-                       debug_critical("Fail to get message queue id\n");
-                       return ret;
+                       g_thread_id = pthread_create(&g_thread, NULL, callbackfunc, NULL);
+                       if (g_thread_id == -1)
+                       {
+                               debug_critical("[Client] Fail to create thread %s\n", strerror(errno));
+                               ret = MM_ERROR_SOUND_INTERNAL;
+                               goto cleanup;
+                       }
                }
+               break;
+       case MM_SOUND_MSG_RES_ERROR:
+               debug_error("[Client] Error occurred \n");
+               ret = msgrcv.sound_msg.code;
+               goto cleanup;
+               break;
+       default:
+               debug_critical("[Client] Unexpected state with communication \n");
+               ret = msgrcv.sound_msg.code;
+               goto cleanup;
+               break;
        }
 
+cleanup:
+       pthread_mutex_unlock(&g_thread_mutex);
+
+       debug_fleave();
+       return ret;
+}
+
+int _mm_sound_client_remove_active_device_changed_callback(void)
+{
+       mm_ipc_msg_t msgrcv = {0,};
+       mm_ipc_msg_t msgsnd = {0,};
+       int ret = MM_ERROR_NONE;
+       int instance;
+
+       debug_fenter();
+
+       if (__mm_sound_client_get_msg_queue() != MM_ERROR_NONE)
+               return ret;
+
        pthread_mutex_lock(&g_thread_mutex);
 
-       /* Send req STOP */
-       msgsnd.sound_msg.msgtype = MM_SOUND_MSG_REQ_GET_AUDIO_ROUTE;
+       instance = getpid();
+       /* Send REQ_REMOVE_ACTIVE_DEVICE_CB */
+       msgsnd.sound_msg.msgtype = MM_SOUND_MSG_REQ_REMOVE_ACTIVE_DEVICE_CB;
        msgsnd.sound_msg.msgid = instance;
 
-       ret = __MMIpcSndMsg(&msgsnd);
-       if (ret != MM_ERROR_NONE)
-       {
-               debug_error("[Client] Fail to send msg\n");
+       if (__MMIpcSndMsg(&msgsnd) != MM_ERROR_NONE)
                goto cleanup;
-       }
 
        /* Recieve */
-       ret = __MMIpcRecvMsg(instance, &msgrcv);
-       if (ret != MM_ERROR_NONE)
-       {
-               debug_error("[Client] Fail to recieve msg\n");
+       if (__MMIpcRecvMsg(instance, &msgrcv) != MM_ERROR_NONE)
                goto cleanup;
-       }
+
        switch (msgrcv.sound_msg.msgtype)
        {
-       case MM_SOUND_MSG_RES_GET_AUDIO_ROUTE:
-               debug_msg("[Client] Success to get audio route [%d]\n", msgrcv.sound_msg.code);
-               ret = msgrcv.sound_msg.code;
+       case MM_SOUND_MSG_RES_REMOVE_ACTIVE_DEVICE_CB:
+               debug_msg("[Client] Success to remove active device callback\n");
                break;
        case MM_SOUND_MSG_RES_ERROR:
                debug_error("[Client] Error occurred \n");
@@ -1005,84 +1090,288 @@ int MMSoundClientGetAudioRoute()
 cleanup:
        pthread_mutex_unlock(&g_thread_mutex);
 
-       debug_leave("\n");
+       debug_fleave();
        return ret;
 }
 
-
-int MMSoundClientSetAudioRoute(int route)
+int _mm_sound_client_add_available_route_changed_callback(mm_sound_available_route_changed_cb func, void* user_data)
 {
        mm_ipc_msg_t msgrcv = {0,};
        mm_ipc_msg_t msgsnd = {0,};
        int ret = MM_ERROR_NONE;
        int instance;
 
-       debug_enter("\n");
+       debug_fenter();
 
-       instance = getpid();    
+       if (__mm_sound_client_get_msg_queue() != MM_ERROR_NONE)
+               return ret;
 
-       /* For exception, if MMSoundStopSound is called at first, mutex & messagequeue must be initialized */
-       if (g_mutex_initted == -1)
-       {
-               pthread_mutex_init(&g_thread_mutex, NULL);
-               debug_msg("mutex initialized. \n");
-               g_mutex_initted = 1;
+       pthread_mutex_lock(&g_thread_mutex);
 
-               /* Get msg queue id */
-               ret = __MMSoundGetMsg();
-               if(ret != MM_ERROR_NONE)
+       instance = getpid();
+       /* Send REQ_ADD_AVAILABLE_ROUTE_CB */
+       msgsnd.sound_msg.msgtype = MM_SOUND_MSG_REQ_ADD_AVAILABLE_ROUTE_CB;
+       msgsnd.sound_msg.msgid = instance;
+       msgsnd.sound_msg.callback = func;
+       msgsnd.sound_msg.cbdata = user_data;
+
+       if (__MMIpcSndMsg(&msgsnd) != MM_ERROR_NONE)
+               goto cleanup;
+
+       /* Recieve */
+       if (__MMIpcRecvMsg(instance, &msgrcv) != MM_ERROR_NONE)
+               goto cleanup;
+
+       switch (msgrcv.sound_msg.msgtype)
+       {
+       case MM_SOUND_MSG_RES_ADD_AVAILABLE_ROUTE_CB:
+               debug_msg("[Client] Success to add available route callback\n");
+               if (g_thread_id == -1)
                {
-                       debug_critical("Fail to get message queue id\n");
-                       return ret;
+                       g_thread_id = pthread_create(&g_thread, NULL, callbackfunc, NULL);
+                       if (g_thread_id == -1)
+                       {
+                               debug_critical("[Client] Fail to create thread %s\n", strerror(errno));
+                               ret = MM_ERROR_SOUND_INTERNAL;
+                               goto cleanup;
+                       }
                }
+               break;
+       case MM_SOUND_MSG_RES_ERROR:
+               debug_error("[Client] Error occurred \n");
+               ret = msgrcv.sound_msg.code;
+               goto cleanup;
+               break;
+       default:
+               debug_critical("[Client] Unexpected state with communication \n");
+               ret = msgrcv.sound_msg.code;
+               goto cleanup;
+               break;
        }
 
+cleanup:
+       pthread_mutex_unlock(&g_thread_mutex);
+
+       debug_fleave();
+       return ret;
+}
+
+int _mm_sound_client_remove_available_route_changed_callback(void)
+{
+       mm_ipc_msg_t msgrcv = {0,};
+       mm_ipc_msg_t msgsnd = {0,};
+       int ret = MM_ERROR_NONE;
+       int instance;
+
+       debug_fenter();
+
+       if (__mm_sound_client_get_msg_queue() != MM_ERROR_NONE)
+               return ret;
+
        pthread_mutex_lock(&g_thread_mutex);
 
-       /* Send req STOP */
-       msgsnd.sound_msg.msgtype = MM_SOUND_MSG_REQ_SET_AUDIO_ROUTE;
+       instance = getpid();
+       /* Send REQ_REMOVE_AVAILABLE_ROUTE_CB */
+       msgsnd.sound_msg.msgtype = MM_SOUND_MSG_REQ_REMOVE_AVAILABLE_ROUTE_CB;
        msgsnd.sound_msg.msgid = instance;
-       msgsnd.sound_msg.handle = route;                /* handle means audio handle slot id */
 
-       ret = __MMIpcSndMsg(&msgsnd);
-       if (ret != MM_ERROR_NONE)
-       {
-               debug_error("Fail to send msg\n");
+       if (__MMIpcSndMsg(&msgsnd) != MM_ERROR_NONE)
                goto cleanup;
-       }
 
        /* Recieve */
-       ret = __MMIpcRecvMsg(instance, &msgrcv);
-       if (ret != MM_ERROR_NONE)
-       {
-               debug_error("Fail to recieve msg\n");
+       if (__MMIpcRecvMsg(instance, &msgrcv) != MM_ERROR_NONE)
                goto cleanup;
-       }
+
        switch (msgrcv.sound_msg.msgtype)
        {
-               case MM_SOUND_MSG_RES_SET_AUDIO_ROUTE:
-                       debug_msg("Success to set audio route [%d]\n", msgrcv.sound_msg.code);
-                       ret = msgrcv.sound_msg.code;
-                       break;
-               case MM_SOUND_MSG_RES_ERROR:
-                       debug_error("Error occurred \n");
-                       ret = msgrcv.sound_msg.code;
-                       goto cleanup;
-                       break;
-               default:
-                       debug_critical("Unexpected state with communication \n");
-                       ret = msgrcv.sound_msg.code;
-                       goto cleanup;
-                       break;
+       case MM_SOUND_MSG_RES_REMOVE_AVAILABLE_ROUTE_CB:
+               debug_msg("[Client] Success to remove available route callback\n");
+               break;
+       case MM_SOUND_MSG_RES_ERROR:
+               debug_error("[Client] Error occurred \n");
+               ret = msgrcv.sound_msg.code;
+               goto cleanup;
+               break;
+       default:
+               debug_critical("[Client] Unexpected state with communication \n");
+               ret = msgrcv.sound_msg.code;
+               goto cleanup;
+               break;
        }
 
 cleanup:
-               pthread_mutex_unlock(&g_thread_mutex);
+       pthread_mutex_unlock(&g_thread_mutex);
 
-       debug_leave("\n");
+       debug_fleave();
        return ret;
 }
 
+static int __MMIpcCBSndMsg(mm_ipc_msg_t *msg)
+{
+       /* rcv message */
+       msg->msg_type = msg->sound_msg.msgid;
+       if (msgsnd(g_msg_sccb, msg,DSIZE, 0)== -1)
+       {
+               if(errno == EACCES)
+               {
+                       debug_warning("[Client] Not acces.\n");
+               }
+               else if(errno == EAGAIN)
+               {
+                       debug_warning("[Client] Blocked process [msgflag & IPC_NOWAIT != 0]\n");
+               }
+               else if(errno == EIDRM)
+               {
+                       debug_warning("[Client] Removed msgid from system\n");
+               }
+               else if(errno == EINTR)
+               {
+                       debug_warning("[Client] Iterrrupted by singnal\n");
+               }
+               else if(errno == EINVAL)
+               {
+                       debug_warning("[Client] Invalid msgid or msgtype < 1 or out of data size \n");
+               }
+               debug_critical("[Client] Fail to callback send message msgid : [%d] \n", g_msg_sccb);
+               return MM_ERROR_COMMON_UNKNOWN;
+       }
+       return MM_ERROR_NONE;
+}
+
+static int __MMIpcCBRecvMsg(int msgtype, mm_ipc_msg_t *msg)
+{
+       /* rcv message */
+       if(msgrcv(g_msg_sccb, msg, DSIZE, msgtype, 0) == -1)
+       {
+               if(errno == E2BIG)
+               {
+                       debug_warning("[Client] Not acces.\n");
+               }
+               else if(errno == EACCES)
+               {
+                       debug_warning("[Client] Access denied\n");
+               }
+               else if(errno == ENOMSG)
+               {
+                       debug_warning("[Client] Blocked process [msgflag & IPC_NOWAIT != 0]\n");
+               }
+               else if(errno == EIDRM)
+               {
+                       debug_warning("[Client] Removed msgid from system\n");
+               }
+               else if(errno == EINTR)
+               {
+                       debug_warning("[Client] Iterrrupted by singnal\n");
+               }
+               else if(errno == EINVAL)
+               {
+                       debug_warning("[Client] Invalid msgid \n");
+               }
+
+               debug_error("[Client] Fail to callback receive msgid : [%d] \n", g_msg_sccb);
+               return MM_ERROR_COMMON_UNKNOWN;
+       }
+       return MM_ERROR_NONE;
+}
+
+static int __MMIpcRecvMsg(int msgtype, mm_ipc_msg_t *msg)
+{
+       int retry_count = 0;
+
+       /* rcv message */
+       while (msgrcv(g_msg_scrcv, msg, DSIZE, msgtype, IPC_NOWAIT) == -1) {
+               if (errno == ENOMSG) {
+                       if (retry_count < 20000) { /* usec is 10^-6 sec so, 5ms * 20000 = 10sec. */
+                               usleep(5000);
+                               retry_count++;
+                               continue;
+                       } else {
+                               return MM_ERROR_SOUND_INTERNAL;
+                       }
+               } else if (errno == E2BIG) {
+                       debug_warning("[Client] Not acces.\n");
+               } else if (errno == EACCES) {
+                       debug_warning("[Client] Access denied\n");
+               } else if (errno == ENOMSG) {
+                       debug_warning("[Client] Blocked process [msgflag & IPC_NOWAIT != 0]\n");
+               } else if (errno == EIDRM) {
+                       debug_warning("[Client] Removed msgid from system\n");
+               } else if (errno == EINTR) {
+                       debug_warning("[Client] Iterrrupted by singnal\n");
+                       continue;
+               } else if (errno == EINVAL) {
+                       debug_warning("[Client] Invalid msgid \n");
+               }
+
+               debug_error("[Client] Fail to recive msgid : [%d] \n", g_msg_scrcv);
+               return MM_ERROR_COMMON_UNKNOWN;
+       }
+       debug_log("[Client] Retry %d times when receive msg\n", retry_count);
+       return MM_ERROR_NONE;
+}
+
+static int __MMIpcSndMsg(mm_ipc_msg_t *msg)
+{
+       /* rcv message */
+       msg->msg_type = msg->sound_msg.msgid;
+       if (msgsnd(g_msg_scsnd, msg,DSIZE, 0) == -1)
+       {
+               if (errno == EACCES) {
+                       debug_warning("[Client] Not access.\n");
+               } else if (errno == EAGAIN) {
+                       debug_warning("[Client] Blocked process msgflag & IPC_NOWAIT != 0]\n");
+               } else if (errno == EIDRM) {
+                       debug_warning("[Client] Removed msgid from system\n");
+               } else if (errno == EINTR) {
+                       debug_warning("[Client] Iterrrupted by singnal\n");
+               } else if (errno == EINVAL) {
+                       debug_warning("Invalid msgid or msgtype < 1 or out of data size \n");
+               } else if (errno == EFAULT) {
+                       debug_warning("[Client] The address pointed to by msgp isn't accessible \n");
+               } else if (errno == ENOMEM) {
+                       debug_warning("[Client] The system does not have enough memory to make a copy of the message pointed to by msgp\n");
+               }
+
+               debug_critical("[Client] Fail to send message msgid : [%d] \n", g_msg_scsnd);
+               return MM_ERROR_SOUND_INTERNAL;
+       }
+       return MM_ERROR_NONE;
+}
+
+static int __MMSoundGetMsg(void)
+{
+       /* Init message queue, generate msgid for communication to server */
+       /* The key value to get msgid is defined "mm_sound_msg.h". Shared with server */
+       
+       debug_fenter();
+       
+       /* get msg queue rcv, snd, cb */
+       g_msg_scsnd = msgget(ftok(KEY_BASE_PATH, RCV_MSG), 0666);
+       g_msg_scrcv = msgget(ftok(KEY_BASE_PATH, SND_MSG), 0666);
+       g_msg_sccb = msgget(ftok(KEY_BASE_PATH, CB_MSG), 0666);
+
+       if ((g_msg_scsnd == -1 || g_msg_scrcv == -1 || g_msg_sccb == -1) != MM_ERROR_NONE) {
+               if (errno == EACCES) {
+                       debug_warning("Require ROOT permission.\n");
+               } else if (errno == ENOMEM) {
+                       debug_warning("System memory is empty.\n");
+               } else if(errno == ENOSPC) {
+                       debug_warning("Resource is empty.\n");
+               }
+               debug_error("Fail to GET msgid\n");
+               return MM_ERROR_SOUND_INTERNAL;
+       }
+       
+       debug_msg("Get msg queue id from server : [%d]\n", g_msg_scsnd);
+       debug_msg("Get msg queue id from server : [%d]\n", g_msg_scrcv);
+       debug_msg("Get msg queue id from server : [%d]\n", g_msg_sccb);
+       
+       debug_fleave();
+       return MM_ERROR_NONE;
+}
+
+#ifdef PULSE_CLIENT
+
 int MMSoundClientIsBtA2dpOn (int *connected, char** bt_name)
 {
        mm_ipc_msg_t msgrcv = {0,};
@@ -1090,25 +1379,12 @@ int MMSoundClientIsBtA2dpOn (int *connected, char** bt_name)
        int ret = MM_ERROR_NONE;
        int instance;
 
-       debug_enter("\n");
+       debug_fenter();
 
        instance = getpid();    
 
-       /* For exception, if MMSoundStopSound is called at first, mutex & messagequeue must be initialized */
-       if (g_mutex_initted == -1)
-       {
-               pthread_mutex_init(&g_thread_mutex, NULL);
-               debug_msg("mutex initialized. \n");
-               g_mutex_initted = 1;
-
-               /* Get msg queue id */
-               ret = __MMSoundGetMsg();
-               if(ret != MM_ERROR_NONE)
-               {
-                       debug_critical("Fail to get message queue id\n");
-                       return ret;
-               }
-       }
+       if (__mm_sound_client_get_msg_queue() != MM_ERROR_NONE)
+               return ret;
 
        pthread_mutex_lock(&g_thread_mutex);
 
@@ -1155,7 +1431,8 @@ int MMSoundClientIsBtA2dpOn (int *connected, char** bt_name)
 cleanup:
                pthread_mutex_unlock(&g_thread_mutex);
 
-       debug_leave("\n");
+       debug_fleave();
        return ret;
 }
+
 #endif // PULSE_CLIENT
index 0d7bf9f..55e97c1 100644 (file)
@@ -60,14 +60,11 @@ int mm_sound_play_keysound(const char *filename, const volume_type_t vol_type)
        /* Check whether file exists */
        fd = open(filename, O_RDONLY);
        if(fd == -1) {
-               debug_error("file open failed with %s\n", strerror(errno));
+               debug_error("file open failed with [%s][%d]\n", strerror(errno), errno);
                switch(errno)
                {
-               case EACCES:
+               case ENOENT:
                        return MM_ERROR_SOUND_FILE_NOT_FOUND;
-               case EMFILE:
-               case ENFILE:
-                       return MM_ERROR_SOUND_INVALID_STATE;
                default:
                        return MM_ERROR_SOUND_INTERNAL;
                }
index 834513c..b1922e4 100644 (file)
@@ -1,9 +1,9 @@
 Name:       libmm-sound
 Summary:    MMSound Package contains client lib and sound_server binary
-Version:    0.5.11
-Release:    1
-Group:      Libraries/Sound
-License:    Apache-2.0
+Version:    0.6.0
+Release:    13
+Group:      System/Libraries
+License:    LGPL
 Source0:    %{name}-%{version}.tar.gz
 Requires(pre): /bin/pidof
 Requires(post): /sbin/ldconfig
@@ -18,7 +18,7 @@ BuildRequires: pkgconfig(sysman)
 BuildRequires: pkgconfig(glib-2.0)
 BuildRequires: pkgconfig(vconf)
 BuildRequires: pkgconfig(heynoti)
-
+BuildRequires:  pkgconfig(security-server)
 
 %description
 MMSound Package contains client lib and sound_server binary for sound system
@@ -40,12 +40,12 @@ Requires:   %{name}-devel = %{version}-%{release}
 %description sdk-devel
 MMSound development package for sound system
 
-%package tools
+%package tool
 Summary: MMSound utility package - contians mm_sound_testsuite, sound_check
 Group:      TO_BE/FILLED_IN
 Requires:   %{name} = %{version}-%{release}
 
-%description tools
+%description tool
 MMSound utility package - contians mm_sound_testsuite, sound_check for sound system
 
 
@@ -55,66 +55,84 @@ MMSound utility package - contians mm_sound_testsuite, sound_check for sound sys
 
 
 %build
-CFLAGS="%{optflags} -fvisibility=hidden -DEXPORT_API=\"__attribute__((visibility(\\\"default\\\")))\""; export CFLAGS
 ./autogen.sh
-%configure  --enable-pulse
-
+%ifarch %{arm}
+CFLAGS="%{optflags} -fvisibility=hidden -DMM_DEBUG_FLAG -DSEPARATE_EARPHONE_VOLUME -DEXPORT_API=\"__attribute__((visibility(\\\"default\\\")))\""; export CFLAGS
+%else
+CFLAGS="%{optflags} -fvisibility=hidden -DMM_DEBUG_FLAG -DSEPARATE_EARPHONE_VOLUME -DEXPORT_API=\"__attribute__((visibility(\\\"default\\\")))\""; export CFLAGS
+%endif
+%configure --prefix=/usr --enable-pulse --enable-security
 make %{?jobs:-j%jobs}
 
 %install
+rm -rf %{buildroot}
 %make_install
 
 
+mkdir -p %{buildroot}%{_sysconfdir}/rc.d/rc3.d
+mkdir -p %{buildroot}%{_sysconfdir}/rc.d/rc4.d
+mkdir -p %{buildroot}%{_sysconfdir}/rc.d/rc5.d
+ln -s %{_sysconfdir}/rc.d/init.d/soundserver %{buildroot}%{_sysconfdir}/rc.d/rc3.d/S23soundserver
+ln -s %{_sysconfdir}/rc.d/init.d/soundserver %{buildroot}%{_sysconfdir}/rc.d/rc4.d/S23soundserver
+
+
+
 %post
 /sbin/ldconfig
-/usr/bin/vconftool set -t int db/volume/system 5 -g 29
-/usr/bin/vconftool set -t int db/volume/notification 7 -g 29
-/usr/bin/vconftool set -t int db/volume/alarm 6 -g 29
-/usr/bin/vconftool set -t int db/volume/ringtone 13 -g 29
-/usr/bin/vconftool set -t int db/volume/media 7 -g 29
-/usr/bin/vconftool set -t int db/volume/call 7 -g 29
-/usr/bin/vconftool set -t int db/volume/fixed 0 -g 29
-/usr/bin/vconftool set -t int db/volume/java 11 -g 29
-/usr/bin/vconftool set -t int memory/Sound/RoutePolicy 0 -i -g 29
-
-mkdir -p %{_sysconfdir}/rc.d/rc3.d
-mkdir -p %{_sysconfdir}/rc.d/rc4.d
-ln -s %{_sysconfdir}/init.d/soundserver %{_sysconfdir}/rc.d/rc3.d/S40soundserver
-ln -s %{_sysconfdir}/init.d/soundserver %{_sysconfdir}/rc.d/rc4.d/S40soundserver
+
+# -DSEPARATE_EARPHONE_VOLUME
+/usr/bin/vconftool set -t int db/private/sound/volume/system 1285 -g 29
+/usr/bin/vconftool set -t int db/private/sound/volume/notification 1799 -g 29
+/usr/bin/vconftool set -t int db/private/sound/volume/alarm 1799 -g 29
+/usr/bin/vconftool set -t int db/private/sound/volume/ringtone 3341 -g 29
+/usr/bin/vconftool set -t int db/private/sound/volume/media 1799 -g 29
+/usr/bin/vconftool set -t int db/private/sound/volume/call 1799 -g 29
+/usr/bin/vconftool set -t int db/private/sound/volume/fixed 0 -g 29
+/usr/bin/vconftool set -t int db/private/sound/volume/java 3084 -g 29
+
+# No -DSEPARATE_EARPHONE_VOLUME
+#/usr/bin/vconftool set -t int db/private/sound/volume/system 5 -g 29
+#/usr/bin/vconftool set -t int db/private/sound/volume/notification 7 -g 29
+#/usr/bin/vconftool set -t int db/private/sound/volume/alarm 7 -g 29
+#/usr/bin/vconftool set -t int db/private/sound/volume/ringtone 13 -g 29
+#/usr/bin/vconftool set -t int db/private/sound/volume/media 7 -g 29
+#/usr/bin/vconftool set -t int db/private/sound/volume/call 7 -g 29
+#/usr/bin/vconftool set -t int db/private/sound/volume/fixed 0 -g 29
+#/usr/bin/vconftool set -t int db/private/sound/volume/java 11 -g 29
 
 %postun -p /sbin/ldconfig
 
 
 %files
+%defattr(-,root,root,-)
 %{_bindir}/sound_server
 %{_libdir}/libmmfsound.so.*
-%{_libdir}/libsoundplugintone.so.*
 %{_libdir}/libmmfsoundcommon.so.*
-%{_libdir}/libsoundpluginwave.so.*
-%{_libdir}/libsoundpluginkeytone.so.*
 %{_libdir}/libmmfkeysound.so.*
-%{_libdir}/libsoundpluginheadset.so.*
-%{_libdir}/soundplugins/libsoundpluginktone.so
-%{_libdir}/soundplugins/libsoundpluginheadset.so
+%{_libdir}/libsoundplugintone.so*
+%{_libdir}/libsoundpluginwave.so*
+%{_libdir}/libsoundpluginkeytone.so*
+%{_libdir}/soundplugins/libsoundplugintone.so
 %{_libdir}/soundplugins/libsoundpluginwave.so
 %{_libdir}/soundplugins/libsoundpluginkeytone.so
 %{_sysconfdir}/rc.d/init.d/soundserver
+%{_sysconfdir}/rc.d/rc3.d/S23soundserver
+%{_sysconfdir}/rc.d/rc4.d/S23soundserver
+
+%files devel
+%defattr(-,root,root,-)
 %{_libdir}/libmmfkeysound.so
 %{_libdir}/libmmfsound.so
-%{_libdir}/libsoundpluginheadset.so
-%{_libdir}/libsoundplugintone.so
 %{_libdir}/libmmfsoundcommon.so
-%{_libdir}/libsoundpluginwave.so
-%{_libdir}/libsoundpluginkeytone.so
-
-%files devel
 %{_includedir}/mmf/mm_sound_private.h
 
 
 %files sdk-devel
+%defattr(-,root,root,-)
 %{_includedir}/mmf/mm_sound.h
 %{_libdir}/pkgconfig/mm-keysound.pc
 %{_libdir}/pkgconfig/mm-sound.pc
 
-%files tools
+%files tool
+%defattr(-,root,root,-)
 %{_bindir}/mm_sound_testsuite
diff --git a/pkgconfig-sdk/Makefile.am b/pkgconfig-sdk/Makefile.am
deleted file mode 100644 (file)
index 58e6f5e..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-pcfiles = mm-sound.pc mm-keysound.pc
-
-all-local: $(pcfiles)
-
-%.pc: %.pc
-       cp $< $@
-
-pkgconfigdir= $(libdir)/pkgconfig
-pkgconfig_DATA= $(pcfiles)
-
-CLEANFILES= $(pcfiles)
-
-pcinfiles= mm-sound.pc.in mm-keysound.pc.in
-
-EXTRA_DIST= $(pcinfiles)
-
diff --git a/pkgconfig-sdk/mm-keysound.pc.in b/pkgconfig-sdk/mm-keysound.pc.in
deleted file mode 100644 (file)
index f96c687..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-prefix = @prefix@
-exec_prefix= @exec_prefix@
-libdir = @libdir@
-includedir = @includedir@
-
-Name : mmfkeysound
-Description : Multimedia Framework Key Sound Library
-Requires : mm-common
-Version : @VERSION@
-Libs : -L${libdir} -lmmfkeysound 
-Cflags : -I${includedir}/mmf 
diff --git a/pkgconfig-sdk/mm-sound.pc.in b/pkgconfig-sdk/mm-sound.pc.in
deleted file mode 100644 (file)
index 100cfbd..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-prefix = @prefix@
-exec_prefix= @exec_prefix@
-libdir = @libdir@
-includedir = @includedir@
-
-Name : mmfsound
-Description : Multimedia Framework Sound Library
-Requires : mm-keysound avsysaudio mm-session glib-2.0 vconf
-Version : @VERSION@
-Libs : -L${libdir} -lmmfsound 
-Cflags : -I${includedir}/mmf 
index 303e35a..9a02966 100644 (file)
@@ -4,6 +4,10 @@ bin_PROGRAMS = sound_server
 sound_server_SOURCES = mm_sound_mgr_codec.c \
                                                mm_sound_mgr_ipc.c \
                                                mm_sound_mgr_pulse.c \
+                                               mm_sound_mgr_asm.c \
+                                               mm_sound_mgr_device.c \
+                                               mm_sound_mgr_headset.c \
+                                               mm_sound_mgr_session.c \
                                                mm_sound_mgr_run.c \
                                                mm_sound_plugin.c \
                                                mm_sound_server.c \
@@ -16,6 +20,7 @@ sound_server_CFLAGS = -I$(srcdir)/../include \
                                          $(MMLOGSVR_CFLAGS) \
                                          -DMMF_LOG_OWNER=0x020 \
                                          -DMMF_DEBUG_PREFIX=\"MMF-SOUND\" \
+                                         -D__DEBUG_MODE__ -DUSE_VCONF -D__USE_LOGMANAGER__ \
                                          $(MMSESSION_CFLAGS) \
                                          $(AVSYSTEM_CFLAGS) \
                                          $(AUDIOSESSIONMGR_CFLAGS) \
@@ -28,15 +33,21 @@ sound_server_LDADD = $(MMLOGSVR_LIBS) \
                     $(MMCOMMON_LIBS) \
                     $(MMSESSION_LIBS) \
                     $(AVSYSTEM_LIBS) \
-                        $(AUDIOSESSIONMGR_LIBS) \
-                        $(GLIB2_LIBS) \
-                        $(VCONF_LIBS) \
-                        $(HEYNOTI_LIBS) \
-                        $(srcdir)/../common/libmmfsoundcommon.la 
+                    $(AUDIOSESSIONMGR_LIBS) \
+                    $(GLIB2_LIBS) \
+                    $(VCONF_LIBS) \
+                    $(HEYNOTI_LIBS) \
+                    $(srcdir)/../libmmfsound.la \
+                    $(srcdir)/../common/libmmfsoundcommon.la 
 
 if USE_PULSE
 sound_server_CFLAGS += -DPULSE_CLIENT $(PULSE_CFLAGS)
 sound_server_LDADD += $(PULSE_LIBS)
 endif
 
+if USE_SECURITY
+sound_server_CFLAGS += $(SECURITY_CFLAGS) -DUSE_SECURITY
+sound_server_LDADD += $(SECURITY_LIBS)
+endif
+
 sound_server_DEPENDENCIES = $(srcdir)/../common/libmmfsoundcommon.la
diff --git a/server/include/asm-log.h b/server/include/asm-log.h
new file mode 100644 (file)
index 0000000..75cf615
--- /dev/null
@@ -0,0 +1,81 @@
+/*
+ * audio-session-manager
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Jonghyuk Choi <jhchoi.choi@samsung.com>
+ *
+ * This library is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the
+ * Free Software Foundation; either version 2.1 of the License, or (at your option)
+ * any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation, Inc., 51
+ * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#ifndef __ASM_LOG_H__
+#define __ASM_LOG_H__
+
+#ifdef __DEBUG_MODE__
+#include <stdio.h>
+#ifdef __USE_LOGMANAGER__
+#include <mm_log.h>
+#endif
+#endif
+
+#ifdef __DEBUG_MODE__
+
+#ifdef __USE_LOGMANAGER__
+#define asm_info_r(msg, args...) log_print_rel((MMF_LOG_OWNER), (LOG_CLASS_INFO), (msg), ##args)
+#define asm_warning_r(msg, args...) log_print_rel((MMF_LOG_OWNER), (LOG_CLASS_WARNING), (msg), ##args)
+#define asm_error_r(msg, args...) log_print_rel((MMF_LOG_OWNER), (LOG_CLASS_ERR), (msg), ##args)
+#define asm_critical_r(msg, args...) log_print_rel((MMF_LOG_OWNER), (LOG_CLASS_CRITICAL), (msg), ##args)
+#define asm_assert_r(condition)  log_assert_rel((condition))
+
+#define asm_info(msg, args...) log_print_dbg((MMF_LOG_OWNER), LOG_CLASS_INFO, (msg), ##args)
+#define asm_warning(msg, args...) log_print_dbg((MMF_LOG_OWNER), LOG_CLASS_WARNING, (msg), ##args)
+#define asm_error(msg, args...) log_print_dbg((MMF_LOG_OWNER), LOG_CLASS_ERR, (msg), ##args)
+#define asm_critical(msg, args...) log_print_dbg((MMF_LOG_OWNER), LOG_CLASS_CRITICAL, (msg), ##args)
+#define asm_assert(condition)  log_assert_dbg((condition))
+
+#else  //__USE_LOGMANAGER__
+
+#define asm_info_r(msg, args...) fprintf(stderr, msg, ##args)
+#define asm_warning_r(msg, args...) fprintf(stderr, msg, ##args)
+#define asm_error_r(msg, args...) fprintf(stderr, msg, ##args)
+#define asm_critical_r(msg, args...) fprintf(stderr, msg, ##args)
+#define asm_assert_r(condition)                (condition)
+
+#define asm_info(msg, args...) fprintf(stderr, msg, ##args)
+#define asm_warning(msg, args...) fprintf(stderr, msg, ##args)
+#define asm_error(msg, args...) fprintf(stderr, msg, ##args)
+#define asm_critical(msg, args...) fprintf(stderr, msg, ##args)
+#define asm_assert(condition)                  (condition)
+
+#endif //__USE_LOGMANAGER__
+
+#else  //__DEBUG_MODE__
+
+#define asm_info_r(msg, args...)
+#define asm_warning_r(msg, args...)
+#define asm_error_r(msg, args...)
+#define asm_critical_r(msg, args...)
+#define asm_assert_r(condition)        (condition)
+
+#define asm_info(msg, args...)
+#define asm_warning(msg, args...)
+#define asm_error(msg, args...)
+#define asm_critical(msg, args...)
+#define asm_assert(condition)          (condition)
+
+#endif  // __DEBUG_MODE__
+
+#endif /* __ASM_LOG_H__ */
diff --git a/server/include/mm_sound_mgr_asm.h b/server/include/mm_sound_mgr_asm.h
new file mode 100644 (file)
index 0000000..b69c28a
--- /dev/null
@@ -0,0 +1,35 @@
+/*
+ * libmm-sound
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Seungbae Shin <seungbae.shin@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.
+ *
+ */
+
+#ifndef __MM_SOUND_MGR_ASM_H__
+#define __MM_SOUND_MGR_ASM_H__
+
+#include "mm_ipc.h"
+#include <audio-session-manager.h>
+
+int MMSoundMgrASMInit(void);
+int MMSoundMgrASMFini(void);
+
+int __asm_process_message (ASM_msg_lib_to_asm_t *asm_rcv_msg, ASM_msg_asm_to_lib_t *asm_ret_msg);
+
+
+#endif /* __MM_SOUND_MGR_ASM_H__ */
+
diff --git a/server/include/mm_sound_mgr_device.h b/server/include/mm_sound_mgr_device.h
new file mode 100644 (file)
index 0000000..36fa536
--- /dev/null
@@ -0,0 +1,49 @@
+/*
+ * libmm-sound
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Seungbae Shin <seungbae.shin@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.
+ *
+ */
+
+
+#ifndef __MM_SOUND_MGR_DEVICE_H__
+#define __MM_SOUND_MGR_DEVICE_H__
+
+#include "../include/mm_sound.h"
+
+typedef struct {
+       int pid;
+       mm_sound_route route;
+       void *callback;
+       void *cbdata;
+} _mm_sound_mgr_device_param_t;
+
+int _mm_sound_mgr_device_init(void);
+int _mm_sound_mgr_device_fini(void);
+int _mm_sound_mgr_device_is_route_available(const _mm_sound_mgr_device_param_t *param, bool *is_available);
+int _mm_sound_mgr_device_foreach_available_route_cb(mm_ipc_msg_t *msg);
+int _mm_sound_mgr_device_set_active_route(const _mm_sound_mgr_device_param_t *param);
+int _mm_sound_mgr_device_get_active_device(const _mm_sound_mgr_device_param_t *param, mm_sound_device_in *device_in, mm_sound_device_out *device_out);
+int _mm_sound_mgr_device_add_active_device_callback(const _mm_sound_mgr_device_param_t *param);
+int _mm_sound_mgr_device_remove_active_device_callback(const _mm_sound_mgr_device_param_t *param);
+int _mm_sound_mgr_device_active_device_callback(mm_sound_device_in device_in, mm_sound_device_out device_out);
+int _mm_sound_mgr_device_add_available_route_callback(const _mm_sound_mgr_device_param_t *param);
+int _mm_sound_mgr_device_remove_available_route_callback(const _mm_sound_mgr_device_param_t *param);
+int _mm_sound_mgr_device_available_device_callback(mm_sound_device_in device_in, mm_sound_device_out device_out, bool available);
+
+#endif /* __MM_SOUND_MGR_DEVICE_H__ */
+
diff --git a/server/include/mm_sound_mgr_headset.h b/server/include/mm_sound_mgr_headset.h
new file mode 100644 (file)
index 0000000..26c519d
--- /dev/null
@@ -0,0 +1,33 @@
+/*
+ * libmm-sound
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Seungbae Shin <seungbae.shin@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.
+ *
+ */
+
+#ifndef __MM_SOUND_MGR_HEADSET_H__
+#define __MM_SOUND_MGR_HEADSET_H__
+
+#include "../../include/mm_ipc.h"
+
+int MMSoundMgrHeadsetInit(void);
+int MMSoundMgrHeadsetFini(void);
+int MMSoundMgrHeadsetGetType (int *type);
+
+
+#endif /* __MM_SOUND_MGR_HEADSET_H__ */
+
index e620d72..9d86817 100644 (file)
 
 #include "../../include/mm_sound_msg.h"
 
+#define SOUND_MSG_SET(sound_msg, x_msgtype, x_handle, x_code, x_msgid) \
+do { \
+       sound_msg.msgtype = x_msgtype; \
+       sound_msg.handle = x_handle; \
+       sound_msg.code = x_code; \
+       sound_msg.msgid = x_msgid; \
+} while(0)
+
 int MMSoundMgrIpcInit(void);
 int MMSoundMgrIpcFini(void);
 int MMSoundMgrIpcReady(void);
 
+int _MMIpcCBSndMsg(mm_ipc_msg_t *msg);
+
 #endif /* __MM_SOUND_MGR_H__ */
 
index b21793c..e6a19c4 100644 (file)
 #ifndef __MM_SOUND_MGR_PULSE_H__
 #define __MM_SOUND_MGR_PULSE_H__
 
-#include <pulse/pulseaudio.h>
-#include "../../include/mm_ipc.h"
-#include <vconf.h>
 
-typedef struct _server_struct
-{
-       mm_ipc_msg_t *msg;
-        int (*func)(mm_ipc_msg_t*);
-} server_struct;
+#include "../../include/mm_ipc.h"
 
-typedef struct _sink_struct
-{
-       int old_priority;
-       mm_ipc_msg_t *msg;
-       int is_speaker_on;
-       int is_bt_on;
-       int route_to;
-       char speaker_name[256];
-       char bt_name[256];
-       int (*func)(mm_ipc_msg_t*);
-} sink_struct;
+void* MMSoundMgrPulseInit(void);
+int MMSoundMgrPulseFini(void* handle);
 
-typedef struct _bt_struct
-{
-       int old_priority;
-       mm_ipc_msg_t *msg;
-       int bt_found;
-       char bt_name[256];
-       int (*func)(mm_ipc_msg_t*);
-} bt_struct;
+void MMSoundMgrPulseSetDefaultSink (char* default_sink_name);
 
-int MMSoundMgrPulseInit(void);
-int MMSoundMgrPulseFini(void);
+int MMSoundMgrPulseHandleRegisterMonoAudio (void* pinfo);
+int MMSoundMgrPulseHandleRegisterBluetoothStatus (void* pinfo);
 
-int MMSoundMgrPulseHandleGetAudioRouteReq (mm_ipc_msg_t *msg, int (*sendfunc)(mm_ipc_msg_t*));
-int MMSoundMgrPulseHandleSetAudioRouteReq (mm_ipc_msg_t *msg, int (*sendfunc)(mm_ipc_msg_t*));
 int MMSoundMgrPulseHandleIsBtA2DPOnReq (mm_ipc_msg_t *msg, int (*sendfunc)(mm_ipc_msg_t*));
-
-int MMSoundMgrPulseHandleRegisterMonoAudio ();
+void MMSoundMgrPulseGetInitialBTStatus (bool *a2dp, bool *sco);
 
 #endif /* __MM_SOUND_MGR_PULSE_H__ */
 
diff --git a/server/include/mm_sound_mgr_session.h b/server/include/mm_sound_mgr_session.h
new file mode 100644 (file)
index 0000000..1ca8fed
--- /dev/null
@@ -0,0 +1,97 @@
+/*
+ * libmm-sound
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Seungbae Shin <seungbae.shin@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.
+ *
+ */
+
+#ifndef __MM_SOUND_MGR_SESSION_H__
+#define __MM_SOUND_MGR_SESSION_H__
+
+//#include <pulse/pulseaudio.h>
+#include "../../include/mm_ipc.h"
+#include "include/mm_sound.h"
+//#include <vconf.h>
+
+typedef enum
+{
+       SESSION_END = 0,
+       SESSION_START,
+} session_state_t;
+
+typedef enum
+{
+       NOT_AVAILABLE = 0,
+       AVAILABLE,
+} device_status_t;
+
+typedef enum
+{
+       SESSION_MEDIA = 0,
+       SESSION_VOICECALL,
+       SESSION_VOIP,
+       SESSION_FMRADIO,
+       SESSION_NOTIFICATION,
+       SESSION_NUM
+} session_t;
+
+typedef enum
+{
+       SUBSESSION_VOICE = 0,
+       SUBSESSION_RINGTONE,
+       SUBSESSION_MEDIA,
+       SUBSESSION_NUM
+} subsession_t;
+
+typedef enum
+{
+       DEVICE_BUILTIN = 0,
+       DEVICE_WIRED,
+       DEVICE_BT_A2DP,
+       DEVICE_BT_SCO,
+       DEVICE_DOCK,
+} device_type_t;
+
+int MMSoundMgrSessionInit(void);
+int MMSoundMgrSessionFini(void);
+
+/* called by mgr headset, pulse */
+int MMSoundMgrSessionSetDeviceAvailable (device_type_t device, int available, int type, char* name);
+
+
+int MMSoundMgrSessionIsDeviceAvailable (mm_sound_device_out playback, mm_sound_device_in capture, bool *available);
+int MMSoundMgrSessionIsDeviceAvailableNoLock (mm_sound_device_out playback, mm_sound_device_in capture, bool *available);
+
+int MMSoundMgrSessionGetAvailableDevices (int *playback, int *capture);
+
+int MMSoundMgrSessionSetDeviceActive (mm_sound_device_out playback, mm_sound_device_in capture);
+int MMSoundMgrSessionGetDeviceActive (mm_sound_device_out *playback, mm_sound_device_in *capture);
+
+int MMSoundMgrSessionSetSession(session_t session, session_state_t state);     /* called by mgr_asm */
+int MMSoundMgrSessionGetSession(session_t *session);
+
+int MMSoundMgrSessionSetSubSession(subsession_t subsession); /* called by mgr_asm */
+int MMSoundMgrSessionGetSubSession(subsession_t *subsession);
+
+char* MMSoundMgrSessionGetBtA2DPName ();
+
+int MMSoundMgrSessionSetDefaultSink (char *default_sink_name);
+
+int MMSoundMgrSessionSCOChanged (bool connected);
+
+#endif /* __MM_SOUND_MGR_SESSION_H__ */
+
diff --git a/server/mm_sound_mgr_asm.c b/server/mm_sound_mgr_asm.c
new file mode 100644 (file)
index 0000000..2ae3921
--- /dev/null
@@ -0,0 +1,1837 @@
+/*
+ * libmm-sound
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Seungbae Shin <seungbae.shin@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 <stdlib.h>
+#include <string.h>
+
+#include <pthread.h>
+#include <sys/shm.h>
+#include <sys/msg.h>
+#include <sys/mman.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <stdbool.h>
+
+#include <errno.h>
+
+#include "include/mm_sound_mgr_common.h"
+#include "../include/mm_sound_common.h"
+
+#include <mm_error.h>
+#include <mm_debug.h>
+
+
+#include <avsys-audio.h>
+
+#include "include/mm_sound_mgr_asm.h"
+#include "include/mm_sound_mgr_session.h"
+
+pthread_mutex_t g_mutex_asm = PTHREAD_MUTEX_INITIALIZER;
+
+
+
+
+
+/******************************* ASM Code **********************************/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <unistd.h>
+
+#include <sys/types.h>
+#include <sys/wait.h>
+#include <sys/ipc.h>
+#include <sys/select.h>
+#include <sys/time.h>
+#include <sys/msg.h>
+#include <glib.h>
+#include <glib/gprintf.h>
+#include <poll.h>
+
+#include <vconf.h>
+#include <audio-session-manager.h>
+#include <asm-log.h>
+#include <string.h>
+#include <errno.h>
+
+#include <sysman.h>
+
+#ifdef USE_SECURITY
+#include <security-server.h>
+#endif
+
+#include <avsys-audio.h>
+
+#define USE_SYSTEM_SERVER_PROCESS_MONITORING
+
+#define SUPPORT_GCF /* currently in use */
+
+static const ASM_sound_cases_t ASM_sound_case[ASM_PRIORITY_MATRIX_MIN+1][ASM_PRIORITY_MATRIX_MIN+1] =
+{
+       /*        SP SC SS SO SA,  EP EC ES EO EA,  N C SF EF EU, A VC M RC*/
+               { 8, 8, 8, 8, 8,  6, 6, 6, 6, 6,  8, 8, 8, 6, 6,  6, 6, 8, 8 }, /* 00 Shared MMPlayer */
+               { 8, 8, 8, 8, 8,  5, 5, 5, 5, 5,  8, 5, 8, 5, 8,  5, 5, 8, 5},  /* 01 Shared MMCamcorder */
+               { 8, 8, 8, 8, 8,  5, 5, 5, 5, 5,  8, 5, 8, 5, 5,  5, 5, 8, 5},  /* 02 Shared MMSound */
+               { 8, 8, 8, 8, 8,  5, 5, 5, 5, 5,  8, 5, 8, 5, 6,  5, 5, 8, 5},  /* 03 Shared OpenAL */
+               { 8, 8, 8, 8, 8,  5, 5, 5, 5, 5,  8, 5, 8, 5, 8,  5, 5, 8, 5},  /* 04 Shared AVsystem */
+               { 6, 6, 6, 6, 6,  6, 6, 6, 6, 6,  8, 8, 6, 6, 6,  6, 6, 8, 8},  /* 05 Exclusive MMPlayer */
+               { 5, 5, 5, 5, 5,  5, 5, 5, 5, 5,  8, 5, 5, 5, 8,  5, 5 ,8, 5},  /* 06 Exclusive MMCamcorder */
+               { 5, 5, 5, 5, 5,  5, 5, 5, 5, 5,  8, 5, 5, 5, 5,  5, 5, 8, 5},  /* 07 Exclusive MMSound */
+               { 5, 5, 5, 5, 5,  5, 5, 5, 5, 5,  8, 5, 5, 5, 6,  5, 5, 8, 5},  /* 08 Exclusive OpenAL */
+               { 5, 5, 5, 5, 5,  5, 5, 5, 5, 5,  8, 5, 5, 5, 8,  5, 5, 8, 5},  /* 09 Exclusive AVsystem */
+               { 8, 8, 8, 8, 8,  8, 8, 8, 8, 8,  8, 5, 8, 8, 8,  5, 5, 8, 5},  /* 10 Notify */
+               { 1, 1, 1, 1, 1,  1, 1, 1, 1, 1,  8, 0, 1, 1, 8,  8, 1, 8, 0},  /* 11 Call */
+               { 8, 8, 8, 8, 8,  5, 5, 5, 5, 5,  8, 5, 5, 5, 5,  5, 5, 8, 5},  /* 12 Shared FMradio */
+               { 5, 5, 5, 5, 5,  5, 5, 5, 5, 5,  8, 5, 5, 5, 5,  5, 5, 8, 5},  /* 13 Exclusive FMradio */
+               { 8, 8, 8, 8, 8,  8, 8, 8, 8, 8,  8, 8, 8, 8, 8,  8, 8, 8, 8},  /* 14 Earjack Unplug */
+               { 1, 1, 1, 1, 1,  1, 1, 1, 1, 1,  8, 5, 1, 1, 8,  8, 5, 8, 5},  /* 15 Alarm */
+               { 1, 1, 1, 1, 1,  1, 1, 1, 1, 1,  8, 1, 1, 1, 8,  8, 0, 8, 1},  /* 16 Video Call */
+               { 8, 8, 8, 8, 8,  8, 8, 8, 8, 8,  8, 8, 8, 8, 8,  8, 8, 8, 8},  /* 17 Monitor */
+               { 1, 8, 1, 1, 1,  1, 1, 1, 1, 1,  8, 0, 1, 1, 8,  8, 1, 8, 0},  /* 18 Rich Call */
+};
+
+typedef struct _list
+{
+       long int                                instance_id;
+       int                                     sound_handle;
+       ASM_sound_events_t              sound_event;
+       ASM_sound_states_t              sound_state;
+       ASM_resume_states_t             need_resume;
+       ASM_resource_t                  mm_resource;
+       unsigned short                  monitor_active;
+       unsigned short                  monitor_dirty;
+       struct _list                    *next;
+} asm_instance_list_t;
+
+asm_instance_list_t *head_list, *tail_list;
+
+int asm_snd_msgid;
+int asm_rcv_msgid;
+int asm_cb_msgid;
+//ASM_msg_lib_to_asm_t asm_rcv_msg;
+//ASM_msg_asm_to_lib_t asm_snd_msg;
+//ASM_msg_asm_to_cb_t asm_cb_msg;
+
+bool asm_is_send_msg_to_cb = false;
+
+#ifdef SUPPORT_GCF
+#define GCF_DEFAULT    0
+int is_gcf = GCF_DEFAULT;
+#endif
+
+unsigned int g_sound_status_pause = 0;
+unsigned int g_sound_status_playing = 0;
+
+#define SERVER_HANDLE_MAX_COUNT        256
+
+static const char* ASM_sound_events_str[] =
+{
+       "SHARE_MMPLAYER",
+       "SHARE_MMCAMCORDER",
+       "SHARE_MMSOUND",
+       "SHARE_OPENAL",
+       "SHARE_AVSYSTEM",
+       "EXCLUSIVE_MMPLAYER",
+       "EXCLUSIVE_MMCAMCORDER",
+       "EXCLUSIVE_MMSOUND",
+       "EXCLUSIVE_OPENAL",
+       "EXCLUSIVE_AVSYSTEM",
+       "NOTIFY",
+       "CALL",
+       "SHARE_FMRADIO",
+       "EXCLUSIVE_FMRADIO",
+       "EARJACK_UNPLUG",
+       "ALARM",
+       "VIDEOCALL",
+       "MONITOR",
+       "RICH_CALL"
+};
+
+static const char* ASM_sound_state_str[] =
+{
+       "STATE_NONE",
+       "STATE_PLAYING",
+       "STATE_WAITING",
+       "STATE_STOP",
+       "STATE_PAUSE",
+       "STATE_PAUSE_BY_APP",
+       "STATE_ALTER_PLAYING"
+};
+
+
+static const char* ASM_sound_request_str[] =
+{
+       "REQUEST_REGISTER",
+       "REQUEST_UNREGISTER",
+       "REQUEST_GETSTATE",
+       "REQUEST_GETMYSTATE",
+       "REQUEST_SETSTATE",
+       "REQUEST_EMEGENT_EXIT",
+       "REQUEST_DUMP",
+       "REQUEST_SET_SUBSESSION",
+       "REQUEST_GET_SUBSESSION"
+};
+
+
+static const char* ASM_sound_cases_str[] =
+{
+       "CASE_NONE",
+       "CASE_1PLAY_2STOP",
+       "CASE_1PLAY_2ALTER_PLAY",
+       "CASE_1PLAY_2WAIT",
+       "CASE_1ALTER_PLAY_2PLAY",
+       "CASE_1STOP_2PLAY",
+       "CASE_1PAUSE_2PLAY",
+       "CASE_1VIRTUAL_2PLAY",
+       "CASE_1PLAY_2PLAY_MIX"
+};
+
+static const char* ASM_sound_resume_str[] =
+{
+               "NO-RESUME",
+               "RESUME"
+};
+
+
+static const char* ASM_sound_command_str[] =
+{
+       "CMD_NONE",
+       "CMD_WAIT",
+       "CMD_PLAY",
+       "CMD_STOP",
+       "CMD_PAUSE",
+       "CMD_RESUME",
+};
+
+static char *subsession_str[] =
+{
+       "VOICE",
+       "RINGTONE",
+       "MEDIA"
+};
+
+#define ASM_SND_MSG_SET(asm_snd_msg, x_alloc_handle, x_cmd_handle, x_result_sound_command, x_result_sound_state) \
+do { \
+       asm_snd_msg->data.alloc_handle                  = x_alloc_handle;                       \
+       asm_snd_msg->data.cmd_handle                    = x_cmd_handle;                         \
+       asm_snd_msg->data.result_sound_command  = x_result_sound_command;       \
+       asm_snd_msg->data.result_sound_state    = x_result_sound_state;         \
+} while (0)
+
+void selectSleep(int secs)
+{
+       struct timeval timeout;
+       timeout.tv_sec = (secs < 1 || secs > 10) ? 3 : secs;
+       timeout.tv_usec = 0;
+       select(0, NULL, NULL, NULL, &timeout);
+       return;
+}
+
+gboolean __is_need_resume (ASM_sound_events_t sound_event)
+{
+       gboolean result = FALSE;
+       switch (sound_event)
+       {
+       case ASM_EVENT_CALL:
+       case ASM_EVENT_RICH_CALL:
+       case ASM_EVENT_VIDEOCALL:
+       case ASM_EVENT_ALARM:
+               result = TRUE;
+               break;
+       default:
+               result = FALSE;
+               break;
+       }
+       return result;
+}
+
+gboolean __find_clean_monitor_handle(int instance_id, int *handle)
+{
+       asm_instance_list_t *temp_list = head_list;
+       int lhandle = -1;
+
+       while (temp_list->next != tail_list) {
+               if (temp_list->instance_id == instance_id && temp_list->sound_event == ASM_EVENT_MONITOR) {
+                       if (temp_list->monitor_dirty == 0) {
+                               lhandle = temp_list->sound_handle;
+                       }
+                       break;
+               }
+               temp_list = temp_list->next;
+       }
+       if (lhandle == -1) {
+               return FALSE;
+       } else {
+               *handle = lhandle;
+               return TRUE;
+       }
+}
+
+void __update_monitor_active(long int instance_id)
+{
+       asm_instance_list_t *temp_list = head_list;
+       asm_instance_list_t *monitor_list = NULL;
+       unsigned short active = 0;
+       asm_info("[ASM_Server] %s\n",__func__);
+
+       while (temp_list->next != tail_list) {
+               if (temp_list->instance_id == instance_id && temp_list->sound_event == ASM_EVENT_MONITOR) {
+                       /* backup monitor pointer */
+                       monitor_list = temp_list;
+                       break;
+               }
+               temp_list = temp_list->next;
+       }
+       if (NULL == monitor_list) {
+               asm_warning("[ASM_Server] %s : No monitor instance for %d\n",__func__, instance_id);
+               return;
+       }
+
+       temp_list = head_list;
+       while (temp_list->next != tail_list) {
+               if (temp_list->instance_id == instance_id && temp_list->sound_event != ASM_EVENT_MONITOR) {
+                       if (ASM_STATE_PLAYING == temp_list->sound_state) {
+                               active = 1;
+                               break;
+                       }
+               }
+               temp_list = temp_list->next;
+       }
+
+       monitor_list->monitor_active = active;
+}
+
+void __set_all_monitor_clean()
+{
+       asm_instance_list_t *temp_list = head_list;
+
+       while (temp_list->next != tail_list) {
+               if (temp_list->sound_event == ASM_EVENT_MONITOR) {
+                       temp_list->monitor_dirty = 0;
+               }
+               temp_list = temp_list->next;
+       }
+}
+
+void __set_monitor_dirty(long int instance_id)
+{
+       asm_instance_list_t *temp_list = head_list;
+
+       while (temp_list->next != tail_list) {
+               if (temp_list->instance_id == instance_id && temp_list->sound_event == ASM_EVENT_MONITOR) {
+                       temp_list->monitor_dirty = 1;
+                       break;
+               }
+               temp_list = temp_list->next;
+       }
+}
+
+/* callback without retcb */
+void __do_callback_wo_retcb(int instance_id,int handle,int command)
+{
+       int fd_ASM = 0, cur_handle = 0;
+       char *filename = g_strdup_printf("/tmp/ASM.%d.%d", instance_id, handle);
+
+       if ((fd_ASM = open(filename,O_WRONLY|O_NONBLOCK)) < 0) {
+               asm_info("[ASM_Server][CallCB] %s open error",filename);
+               g_free(filename);
+               return;
+       }
+       cur_handle = (unsigned int)(handle |(command << 4));
+       if (write(fd_ASM, (void *)&cur_handle, sizeof(cur_handle)) < 0) {
+               asm_info("[ASM_Server][CallCB] %s write error",filename);
+               g_free(filename);
+               return;
+       }
+       close(fd_ASM);
+       g_free(filename);
+       selectSleep(2); /* if return immediately bad sound occur */
+}
+
+
+int __do_callback(int instance_id,int handle,int command, ASM_event_sources_t event_src)
+{
+       char *filename = NULL;
+       char *filename2 = NULL;
+       struct timeval time;
+       int starttime = 0;
+       int endtime = 0;
+       int fd=0,nread = 0;
+       int fd_ASM = 0, cur_handle = 0;
+       int buf = 0;
+       struct pollfd pfd;
+       int pret = 0;
+       int pollingTimeout = 1500; /* NOTE : This is temporary code, because of Deadlock issues. If you fix that issue, remove this comment */
+
+       asm_info("[ASM_Server] __do_callback for pid(%d) handle(%d)\n", instance_id, handle);
+
+       /* Set start time */
+       gettimeofday(&time, NULL);
+       starttime = time.tv_sec * 1000000 + time.tv_usec;
+
+       /**************************************
+        *
+        * Open callback cmd pipe
+        *
+        **************************************/
+       filename = g_strdup_printf("/tmp/ASM.%d.%d", instance_id, handle);
+       if ((fd_ASM = open(filename, O_WRONLY|O_NONBLOCK)) < 0) {
+               asm_error("[ASM_Server][CallCB] %s open error\n", filename);
+               goto fail;
+       }
+
+       /******************************************
+        *
+        * Open callback result pipe
+        * before writing callback cmd to pipe
+        *
+        ******************************************/
+       filename2 = g_strdup_printf("/tmp/ASM.%d.%dr", instance_id, handle);
+       if ((fd=open(filename2,O_RDONLY|O_NONBLOCK))== -1) {
+               char str_error[256];
+               strerror_r (errno, str_error, sizeof(str_error));
+               asm_error("[ASM_Server][RETCB] Fail to open fifo (%s)\n", str_error);
+               goto fail;
+       }
+       asm_info("[ASM_Server] open return cb %s\n", filename2);
+
+
+       /*******************************************
+        * Write Callback msg
+        *******************************************/
+       cur_handle = (unsigned int)((0x0000ffff & handle) |(command << 16) | (event_src << 24));
+       if (write(fd_ASM, (void *)&cur_handle, sizeof(cur_handle)) < 0) {
+               asm_error("[ASM_Server][CallCB] %s write error\n", filename);
+               goto fail;
+       }
+       /**************************************
+        *
+        * Close callback cmd pipe
+        *
+        **************************************/
+       close(fd_ASM);
+       fd_ASM = -1;
+       g_free(filename);
+       filename = NULL;
+
+       /* If command is RESUME, then do not wait for client return */
+       if (command == ASM_COMMAND_RESUME) {
+               asm_info("[ASM_Server][RETCB] No need to wait return from client. \n");
+               return ASM_CB_RES_NONE;
+       }
+
+       pfd.fd = fd;
+       pfd.events = POLLIN;
+
+       asm_instance_list_t *temp_list = head_list;
+
+
+       /*********************************************
+        *
+        * Wait callback result msg
+        *
+        ********************************************/
+       asm_critical("[ASM_Server][RETCB]wait callback(tid=%d, handle=%d, cmd=%d, timeout=%d)\n", instance_id, handle, command, pollingTimeout);
+       pret = poll(&pfd, 1, pollingTimeout); //timeout 7sec
+       if (pret < 0) {
+               asm_error("[ASM_Server][RETCB]poll failed (%d)\n", pret);
+               goto fail;
+       }
+       if (pfd.revents & POLLIN) {
+               nread=read(fd, (void *)&buf, sizeof(buf));
+       }
+       g_free(filename2);
+       filename2 = NULL;
+
+       /* Calculate endtime and display*/
+       gettimeofday(&time, NULL);
+       endtime = time.tv_sec * 1000000 + time.tv_usec;
+       asm_critical("[ASM_Server][RETCB] ASM_CB_END cbtimelab=%3.3f(second), timeout=%d(milli second) (reciever=%d)\n", ((endtime-starttime)/1000000.), pollingTimeout, instance_id);
+
+       /**************************************
+        *
+        * Close callback result pipe
+        *
+        **************************************/
+       close(fd);
+       fd = -1;
+       asm_info("[ASM_Server][RETCB] Return value 0x%x\n", buf);
+       return buf;
+
+fail:
+       if (filename) {
+               g_free (filename);
+               filename = NULL;
+       }
+       if (filename2) {
+               g_free (filename2);
+               filename2 = NULL;
+       }
+       if (fd_ASM != -1) {
+               close(fd_ASM);
+               fd_ASM = -1;
+       }
+       if (fd != -1) {
+               close (fd);
+               fd = -1;
+       }
+
+       return -1;
+}
+
+gboolean __isPlayingNow()
+{
+       asm_instance_list_t *temp_list = head_list;
+       while (temp_list->next != tail_list) {
+               if (temp_list->sound_state == ASM_STATE_PLAYING ) {
+                       return TRUE;
+               }
+
+               temp_list = temp_list->next;
+       }
+       return FALSE;
+}
+
+gboolean __isItPlayingNow(int instance_id, int handle)
+{
+       asm_instance_list_t *temp_list = head_list;
+       while (temp_list->next != tail_list) {
+               if (temp_list->instance_id == instance_id && temp_list->sound_handle == handle) {
+                       if (temp_list->sound_state == ASM_STATE_PLAYING) {
+                               return TRUE;
+                       }
+               }
+
+               temp_list = temp_list->next;
+       }
+       return FALSE;
+}
+
+void __temp_print_list(char * msg)
+{
+       asm_instance_list_t *temp_list = head_list;
+       int i = 0;
+
+       if (NULL != msg) {
+               asm_warning("[ASM_Server] %s\n", msg);
+       }
+       while (temp_list->next != tail_list) {
+               asm_info("[ASM_Server] List[%02d] ( %5ld, %2d, %-20s, %-20s, %9s, 0x%04x)\n", i, temp_list->instance_id, temp_list->sound_handle,
+                                                                                               ASM_sound_events_str[temp_list->sound_event],
+                                                                                               ASM_sound_state_str[temp_list->sound_state],
+                                                                                               ASM_sound_resume_str[temp_list->need_resume],
+                                                                                               temp_list->mm_resource);
+               temp_list = temp_list->next;
+               i++;
+       }
+}
+
+void updatePhoneStatus()
+{
+       asm_instance_list_t *temp_list = head_list;
+       int i = 0, error = 0;
+
+       g_sound_status_pause = 0;
+       g_sound_status_playing = 0;
+
+       while (temp_list->next != tail_list) {
+               if (temp_list->sound_state == ASM_STATE_PLAYING) {
+                       if (temp_list->sound_event >= ASM_EVENT_SHARE_MMPLAYER && temp_list->sound_event  < ASM_EVENT_MAX) {
+                               g_sound_status_playing |= ASM_sound_type[(temp_list->sound_event) + 1].sound_status;
+                       }
+               } else if (temp_list->sound_state == ASM_STATE_PAUSE ) {
+                       if (temp_list->sound_event >= ASM_EVENT_SHARE_MMPLAYER && temp_list->sound_event < ASM_EVENT_MAX) {
+                               g_sound_status_pause |= ASM_sound_type[(temp_list->sound_event) + 1].sound_status;
+                       }
+               }
+               temp_list = temp_list->next;
+       }
+
+       if (vconf_set_int(SOUND_STATUS_KEY, g_sound_status_playing)) {
+               asm_info("[ASM_Server[Error = %d][1st try] phonestatus_set \n", error);
+               if (vconf_set_int(SOUND_STATUS_KEY, g_sound_status_playing)) {
+                       asm_critical("[ASM_Server][Error = %d][2nd try]  phonestatus_set \n", error);
+               }
+       }
+
+       asm_info("[ASM_Server] soundstatus set to (0x%08x)\n", g_sound_status_playing);
+}
+
+
+void __asm_register_list(long int instance_id, int handle, ASM_sound_events_t sound_event, ASM_sound_states_t sound_state, ASM_resource_t mm_resource)
+{
+       asm_instance_list_t *temp_list;
+       temp_list = (asm_instance_list_t *)malloc(sizeof(asm_instance_list_t));
+       temp_list->instance_id = instance_id;
+       temp_list->sound_handle = handle;
+       temp_list->sound_event = sound_event;
+       temp_list->sound_state = sound_state;
+       temp_list->need_resume = 0;
+       temp_list->mm_resource = mm_resource;
+       temp_list->monitor_active = 0;
+       temp_list->monitor_dirty = 0;
+       temp_list->next = head_list;
+       head_list = temp_list;
+
+       __temp_print_list("Register List");
+       updatePhoneStatus();
+}
+
+int __asm_unregister_list(int handle)
+{
+       asm_instance_list_t *temp_list = head_list;
+       asm_instance_list_t *temp_list2 = head_list;
+       int instance_id = -1;
+
+       asm_info("[ASM_Server] __asm_unregister_list \n");
+
+       while (temp_list->next != tail_list) {
+               if (temp_list->sound_handle == handle) {
+                       instance_id = temp_list->instance_id;
+                       if (temp_list == head_list)
+                               head_list = temp_list->next;
+                       else
+                               temp_list2->next = temp_list->next;
+                       free(temp_list);
+                       break;
+               }
+               temp_list2 = temp_list;
+               temp_list = temp_list->next;
+       }
+
+       __temp_print_list("Unregister List for handle");
+       updatePhoneStatus();
+       return instance_id;
+}
+
+
+/* -------------------------
+ * if PID exist return true, else return false
+ */
+gboolean isPIDExist(int pid)
+{
+       if (pid > 999999 || pid < 2)
+               return FALSE;
+       gchar *tmp = g_malloc0(25);
+       g_sprintf(tmp, "/proc/%d", pid);
+       if (access(tmp, R_OK)==0) {
+               g_free(tmp);
+               return TRUE;
+       }
+       g_free(tmp);
+       return FALSE;
+}
+
+
+/* -------------------------
+ *
+ */
+void __check_dead_process()
+{
+       asm_instance_list_t *temp_list = head_list;
+       asm_instance_list_t *temp_list2 = head_list;
+       while (temp_list->next != tail_list) {
+               if (!isPIDExist(temp_list->instance_id)) {
+                       asm_critical_r("[ASM_Server] PID(%ld) not exist! -> ASM_Server resource of pid(%ld) will be cleared \n", temp_list->instance_id, temp_list->instance_id);
+
+                       if (temp_list == head_list) {
+                               head_list = temp_list->next;
+                       }
+                       temp_list2->next = temp_list->next;
+                       free(temp_list);
+               } else {
+                       temp_list2 = temp_list;
+               }
+               temp_list = temp_list2->next;
+       }
+       updatePhoneStatus();
+}
+
+
+
+
+void emergent_exit(int exit_pid)
+{
+       asm_instance_list_t *temp_list = head_list;
+       int handle = -1;
+       int instance_id = -1;
+
+       while (temp_list->next != tail_list) {
+               if (temp_list->instance_id == exit_pid) {
+                       handle = temp_list->sound_handle;
+
+                       instance_id = __asm_unregister_list(handle);
+
+                       if (instance_id != -1) {
+                               char str_error[256];
+                               char* filename = g_strdup_printf("/tmp/ASM.%d.%d", instance_id, handle);
+                               char* filename2 = g_strdup_printf("/tmp/ASM.%d.%dr", instance_id, handle);
+                               if (!remove(filename)) {
+                                       asm_info("[ASM_Server] remove %s success\n", filename);
+                               } else {
+                                       strerror_r (errno, str_error, sizeof (str_error));
+                                       asm_error("[ASM_Server] remove %s failed with %s\n", filename, str_error);
+                               }
+
+                               if (!remove(filename2)) {
+                                       asm_info("[ASM_Server] remove %s success\n", filename2);
+                               } else {
+                                       strerror_r (errno, str_error, sizeof (str_error));
+                                       asm_error("[ASM_Server] remove %s failed with %s\n", filename2, str_error);
+                               }
+
+                               g_free(filename);
+                               g_free(filename2);
+                       }
+                       temp_list = head_list;
+               } else {
+                       temp_list = temp_list->next;
+               }
+       }
+
+       asm_info("[ASM_Server][EMERGENT_EXIT] complete\n");
+       return;
+}
+
+
+int ___reorder_state(ASM_sound_states_t input)
+{
+       int res = 0;
+
+       switch (input) {
+       case ASM_STATE_IGNORE:
+       case ASM_STATE_NONE:
+               res = 0;
+               break;
+       case ASM_STATE_WAITING:
+       case ASM_STATE_STOP:
+               res = 1;
+               break;
+       case ASM_STATE_PAUSE:
+       case ASM_STATE_PAUSE_BY_APP:
+               res = 2;
+               break;
+       case ASM_STATE_PLAYING:
+               res = 3;
+               break;
+       }
+       return res;
+}
+
+ASM_sound_states_t __asm_find_process_status(int pid)
+{
+       asm_instance_list_t *temp_list = head_list;
+       ASM_sound_states_t result_state = ASM_STATE_NONE;
+
+       asm_info("[ASM_Server] __asm_find_process_status for pid %d\n", pid);
+
+       while (temp_list->next != tail_list) {
+               if (temp_list->instance_id == pid) {
+                       if ( ___reorder_state(temp_list->sound_state) >= ___reorder_state(result_state)) {
+                               result_state = temp_list->sound_state;
+                       }
+               }
+               temp_list = temp_list->next;
+       }
+
+       return result_state;
+}
+
+ASM_sound_states_t __asm_find_list(ASM_requests_t request_id, int handle)
+{
+       asm_instance_list_t *temp_list = head_list;
+
+       asm_info("[ASM_Server] __asm_find_list\n");
+
+       while (temp_list->next != tail_list) {
+               if ((request_id == ASM_REQUEST_GETSTATE && temp_list->sound_handle == handle)) {
+                       return temp_list->sound_state;
+               } else {
+                       temp_list = temp_list->next;
+               }
+       }
+
+       return ASM_STATE_NONE;
+}
+
+void __asm_change_state_list(long int instance_id, int handle, ASM_sound_states_t sound_state, ASM_resource_t mm_resource)
+{
+       asm_instance_list_t *temp_list = head_list;
+       int monitor_handle = -1;
+       asm_info("[ASM_Server] __asm_change_state_list\n");
+       if (sound_state == ASM_STATE_IGNORE) {
+               asm_info("[ASM_Server] skip update state list %ld-%d\n", instance_id, handle);
+               return;
+       }
+
+       while (temp_list->next != tail_list) {
+               if (temp_list->instance_id == instance_id && temp_list->sound_handle == handle) {
+                       temp_list->sound_state = sound_state;
+                       temp_list->mm_resource = mm_resource;
+                       break;
+               }
+               temp_list = temp_list->next;
+       }
+       __update_monitor_active(instance_id);
+       updatePhoneStatus();
+}
+
+void __asm_change_need_resume_list(long int instance_id, int handle, ASM_resume_states_t need_resume)
+{
+       asm_instance_list_t *temp_list = head_list;
+       asm_info("[ASM_Server] __asm_change_need_resume_list\n");
+       while (temp_list->next != tail_list) {
+               if (temp_list->instance_id == instance_id && temp_list->sound_handle == handle) {
+                       temp_list->need_resume = need_resume;
+                       break;
+               }
+               temp_list = temp_list->next;
+       }
+}
+
+
+void __asm_create_message_queue()
+{
+       asm_rcv_msgid = msgget((key_t)2014, 0666 | IPC_CREAT);
+       asm_snd_msgid = msgget((key_t)4102, 0666 | IPC_CREAT);
+       asm_cb_msgid = msgget((key_t)4103, 0666 | IPC_CREAT);
+
+       if (asm_snd_msgid == -1 || asm_rcv_msgid == -1 || asm_cb_msgid == -1) {
+               asm_critical("[ASM_Server] msgget failed with error(%d,%s) \n", errno, strerror(errno));
+               exit(EXIT_FAILURE);
+       }
+}
+
+void __asm_snd_message(ASM_msg_asm_to_lib_t *asm_snd_msg)
+{
+       if (msgsnd(asm_snd_msgid, (void *)asm_snd_msg, sizeof(asm_snd_msg->data), 0) == -1) {
+               asm_critical("[ASM_Server] msgsnd failed with error %d\n", errno);
+               exit(EXIT_FAILURE);
+       }
+}
+
+void __asm_rcv_message(ASM_msg_lib_to_asm_t *asm_rcv_msg)
+{
+       if (msgrcv(asm_rcv_msgid, (void *)asm_rcv_msg, sizeof(asm_rcv_msg->data), 0, 0) == -1) {
+               asm_critical_r("[ASM_Server] msgrcv failed with error %d\n", errno);
+               exit(EXIT_FAILURE);
+       }
+}
+
+void __asm_get_empty_handle(long int instance_id, int *handle)
+{
+       asm_instance_list_t *temp_list = head_list;
+       unsigned int i = 0, find_empty = 0, j = 0;
+       char handle_info[SERVER_HANDLE_MAX_COUNT];
+
+       asm_info("[ASM_Server] __asm_make_handle for %ld\n", instance_id);
+       __temp_print_list("current list before get new handle");
+
+       memset(handle_info, 0, sizeof(char) * SERVER_HANDLE_MAX_COUNT);
+
+       while (temp_list->next != tail_list) {
+               handle_info[temp_list->sound_handle] = 1;
+               temp_list = temp_list->next;
+       }
+
+       for (i = 0; i < ASM_SERVER_HANDLE_MAX; i++) {
+               if (handle_info[i] == 0) {
+                       find_empty = 1;
+                       break;
+               }
+       }
+       if (find_empty && (i != ASM_SERVER_HANDLE_MAX)) {
+               asm_error_r("[ASM_Server] New handle for %ld is %d\n", instance_id, i);
+               *handle = i;
+       } else {
+               asm_error_r("[ASM_Server] Handle is full for pid %ld\n", instance_id);
+               *handle = -1;
+       }
+
+}
+
+void __print_resource(unsigned short resource_status)
+{
+       if (resource_status == ASM_RESOURCE_NONE)
+               asm_info("[ASM_Server] resource NONE\n");
+       if (resource_status | ASM_RESOURCE_CAMERA)
+               asm_info("[ASM_Server] resource CAMERA\n");
+       if (resource_status | ASM_RESOURCE_VIDEO_OVERLAY)
+               asm_info("[ASM_Server] resource VIDEO OVERLAY\n");
+       if (resource_status | ASM_RESOURCE_HW_ENCORDER)
+               asm_info("[ASM_Server] resource HW ENCORDER\n");
+       if (resource_status | ASM_RESOURCE_HW_DECORDER)
+               asm_info("[ASM_Server] resource HW DECORDER\n");
+       if (resource_status | ASM_RESOURCE_RADIO_TUNNER)
+               asm_info("[ASM_Server] resource RADIO TUNNER\n");
+       if (resource_status | ASM_RESOURCE_TV_TUNNER)
+               asm_info("[ASM_Server] resource TV TUNNER\n");
+}
+
+void __asm_compare_priority_matrix(ASM_msg_asm_to_lib_t *asm_snd_msg, ASM_msg_asm_to_lib_t *asm_ret_msg,
+                                                                 long int instance_id, int handle, ASM_requests_t request_id,
+                                  ASM_sound_events_t sound_event,ASM_sound_states_t sound_state, ASM_resource_t mm_resource)
+{
+       int no_conflict_flag = 0;
+
+       asm_info("[ASM_Server][%s] ENTER >>>>>> \n", __func__);
+
+       /* If nobody is playing now, this means no conflict */
+       if (ASM_STATUS_NONE == g_sound_status_playing) {
+               asm_info("[ASM_Server][%s] No conflict ( No existing Sound )\n", __func__);
+
+               ASM_SND_MSG_SET(asm_snd_msg, handle, -1, ASM_COMMAND_NONE, sound_state);
+
+               no_conflict_flag = 1;
+       } else { /* Somebody is playing */
+               asm_instance_list_t *temp_list = head_list;
+               int updatedflag = 0;
+               int cb_res = 0;
+               int update_state = ASM_STATE_NONE;
+
+               while (temp_list->next != tail_list) {
+
+                       asm_info("[ASM_Server][%s]( %5ld, %2d, %-20s, %-20s, %9s, 0x%04x) ..... [%s]\n", __func__,
+                                       temp_list->instance_id, temp_list->sound_handle,
+                                       ASM_sound_events_str[temp_list->sound_event],
+                                       ASM_sound_state_str[temp_list->sound_state],
+                                       ASM_sound_resume_str[temp_list->need_resume],
+                                       temp_list->mm_resource,
+                                       (temp_list->sound_state != ASM_STATE_PLAYING)? "PASS" : "CHECK");
+
+                       /* Find who's playing now */
+                       if (temp_list->sound_state != ASM_STATE_PLAYING) {
+                               temp_list = temp_list->next;
+                               continue;
+                       }
+
+                       /* Found it */
+                       ASM_sound_states_t current_play_state = temp_list->sound_state;
+                       ASM_sound_events_t current_play_sound_event = temp_list->sound_event;
+                       long int current_play_instance_id = temp_list->instance_id;
+                       int current_play_handle = temp_list->sound_handle;
+                       ASM_resource_t current_using_resource = temp_list->mm_resource;
+
+                       if ((current_play_instance_id == instance_id) && (current_play_handle == handle)) {
+                               asm_warning("[ASM_Server][%s] This is my handle. skip %d %d\n", __func__, instance_id, handle);
+                               temp_list = temp_list->next;
+                               continue;
+                       }
+
+                       /* Request is PLAYING */
+                       if (sound_state == ASM_STATE_PLAYING) {
+                               /* Determine sound policy */
+                               ASM_sound_cases_t sound_case = ASM_sound_case[current_play_sound_event][sound_event];
+
+#ifdef SUPPORT_GCF
+                               /* GCF case is exception case */
+                               /* NOTE : GCF exception case only */
+                               if ((is_gcf) && (sound_case != ASM_CASE_1PLAY_2PLAY_MIX)) {
+                                       sound_case = ASM_CASE_1PLAY_2PLAY_MIX;;
+                               }
+#endif
+
+                               asm_critical("[ASM_Server][%s] Conflict policy[%x][%x]: %s\n", __func__, current_play_sound_event,sound_event,ASM_sound_cases_str[sound_case]);
+                               switch (sound_case) {
+                               case ASM_CASE_1PLAY_2STOP:
+                               {
+                                       if (current_play_instance_id == instance_id) {
+                                               /* PID is policy group.*/
+                                               asm_info("[ASM_Server][%s] Do not send Stop callback in same pid %ld\n", __func__, instance_id);
+                                       } else {
+                                               ASM_SND_MSG_SET(asm_snd_msg, handle, handle, ASM_COMMAND_STOP, sound_state);
+                                               temp_list = tail_list;  /* skip all remain list */
+                                               break;
+                                       }
+
+                                       /* Prepare msg to send */
+                                       ASM_SND_MSG_SET(asm_snd_msg, handle, handle, ASM_COMMAND_PLAY, sound_state);
+
+                                       if (!updatedflag) {
+                                               if (request_id == ASM_REQUEST_REGISTER){
+                                                       __asm_register_list(instance_id, handle, sound_event, sound_state, mm_resource);
+                                               } else {
+                                                       __asm_change_state_list(instance_id, handle, sound_state, mm_resource);
+                                               }
+                                               updatedflag = 1;
+                                       }
+                                       break;
+                               }
+
+                               case ASM_CASE_1STOP_2PLAY:
+                               {
+                                       if (current_play_instance_id == instance_id) {
+                                               /* PID is policy group. */
+                                               asm_info("[ASM_Server][%s] Do not send Stop callback in same pid %ld\n", __func__, instance_id);
+                                       } else {
+                                               ASM_event_sources_t event_src;
+                                               unsigned short resource_status = current_using_resource & mm_resource;
+
+                                               /* Determine root cause of conflict */
+                                               if (resource_status != ASM_RESOURCE_NONE) {
+                                                       event_src = ASM_EVENT_SOURCE_RESOURCE_CONFLICT;
+                                               } else {
+                                                       switch (sound_event) {
+                                                       case ASM_EVENT_CALL:
+                                                       case ASM_EVENT_RICH_CALL:
+                                                       case ASM_EVENT_VIDEOCALL:
+                                                               event_src = ASM_EVENT_SOURCE_CALL_START;
+                                                               break;
+
+                                                       case ASM_EVENT_EARJACK_UNPLUG:
+                                                               event_src = ASM_EVENT_SOURCE_EARJACK_UNPLUG;
+                                                               break;
+
+                                                       case ASM_EVENT_ALARM:
+                                                               event_src = ASM_EVENT_SOURCE_ALARM_START;
+                                                               break;
+
+                                                       default:
+                                                               event_src = ASM_EVENT_SOURCE_OTHER_APP;
+                                                               break;
+                                                       }
+                                               }
+
+                                               /* Execute callback function for monitor handle */
+                                               int monitor_handle = -1;
+                                               if (__find_clean_monitor_handle(current_play_instance_id, &monitor_handle)) {
+                                                       cb_res = __do_callback(current_play_instance_id, monitor_handle, ASM_COMMAND_STOP, event_src);
+                                                       asm_warning("[ASM_Server][%s] send stop callback for monitor handle of pid %d\n", __func__, current_play_instance_id);
+                                                       if (cb_res != ASM_CB_RES_NONE && cb_res != ASM_CB_RES_STOP) {
+                                                               asm_error_r("[ASM_Server][%s] oops! not suspected callback result %d\n", __func__, cb_res);
+                                                       }
+                                                       __set_monitor_dirty(current_play_instance_id);
+
+                                                       /* If current is playing and input event is CALL/VIDEOCALL/ALARM, set to need resume */
+                                                       if ( __is_need_resume(sound_event) && (current_play_state == ASM_STATE_PLAYING) ) {
+                                                               __asm_change_need_resume_list(current_play_instance_id, monitor_handle, ASM_NEED_RESUME);
+                                                       }
+                                               }
+
+                                               /* Execute callback function for worker handle */
+                                               cb_res = __do_callback(current_play_instance_id,current_play_handle,ASM_COMMAND_STOP, event_src);
+                                               if (cb_res != ASM_CB_RES_NONE && cb_res != ASM_CB_RES_STOP)
+                                                       asm_error_r("[ASM_Server][%s] oops! not suspected result %d\n", __func__, cb_res);
+                                               asm_warning("[ASM_Server][%s]  __asm_compare_priority_matrix(1STOP_2PLAY) : __do_callback Complete : TID=%ld, handle=%d",
+                                                               __func__, current_play_instance_id,current_play_handle );
+
+                                               /* If current is playing and input event is CALL/VIDEOCALL/ALARM, set to need resume */
+                                               if( __is_need_resume(sound_event) && (current_play_state == ASM_STATE_PLAYING) ) {
+                                                       __asm_change_need_resume_list(current_play_instance_id, current_play_handle, ASM_NEED_RESUME);
+                                               }
+
+                                               /* Set state to NONE */
+                                               /* FIXME: is it okay to set none instead on STOP? */
+                                               //__asm_change_state_list(current_play_instance_id, current_play_handle, ASM_STATE_NONE, ASM_RESOURCE_NONE);
+                                               __asm_change_state_list(current_play_instance_id, current_play_handle,
+                                                               (cb_res == ASM_CB_RES_STOP)? ASM_STATE_STOP : ASM_STATE_NONE,
+                                                               ASM_RESOURCE_NONE);
+
+
+                                               /* TODO: what if stopped is fmradio???? */
+                                               if (current_play_sound_event == ASM_EVENT_SHARE_FMRADIO ||
+                                                       current_play_sound_event == ASM_EVENT_EXCLUSIVE_FMRADIO)
+                                               {
+                                                       session_t cur_session;
+                                                       MMSoundMgrSessionGetSession(&cur_session);
+                                                       if (cur_session == SESSION_FMRADIO) {
+                                                               asm_info ("[ASM_Server][%s] ****** SESSION_FMRADIO end ******\n", __func__);
+                                                               MMSoundMgrSessionSetSession(SESSION_FMRADIO, SESSION_END);
+                                                       }
+                                               }
+                                       }
+
+                                       /* Prepare msg to send */
+                                       ASM_SND_MSG_SET(asm_snd_msg, handle, handle, ASM_COMMAND_PLAY, sound_state);
+
+                                       if (!updatedflag) {
+                                               if (request_id == ASM_REQUEST_REGISTER) {
+                                                       __asm_register_list(instance_id, handle, sound_event, sound_state, mm_resource);
+                                               } else {
+                                                       __asm_change_state_list(instance_id, handle, sound_state, mm_resource);
+                                               }
+                                               updatedflag = 1;
+                                       }
+                                       break;
+                               }
+
+                               case ASM_CASE_1PAUSE_2PLAY:
+                               {
+                                       ASM_resource_t  update_resource = current_using_resource;
+                                       if (current_play_instance_id == instance_id)    {
+                                               asm_info("[ASM_Server][%s] Do not send Pause callback in same pid %ld\n", __func__, instance_id);
+                                       } else {
+                                               ASM_event_sources_t event_src;
+                                               ASM_sound_commands_t command;
+
+                                               unsigned short resource_status = current_using_resource & mm_resource;
+                                               if (resource_status != ASM_RESOURCE_NONE) {
+                                                       asm_info("[ASM_Server][%s] resource conflict found 0x%x\n", __func__, resource_status);
+                                                       event_src = ASM_EVENT_SOURCE_RESOURCE_CONFLICT;
+                                                       command = ASM_COMMAND_STOP;
+                                               } else {
+                                                       switch (sound_event) {
+                                                       case ASM_EVENT_CALL:
+                                                       case ASM_EVENT_RICH_CALL:
+                                                       case ASM_EVENT_VIDEOCALL:
+                                                               event_src = ASM_EVENT_SOURCE_CALL_START;
+                                                               break;
+
+                                                       case ASM_EVENT_EARJACK_UNPLUG:
+                                                               event_src = ASM_EVENT_SOURCE_EARJACK_UNPLUG;
+                                                               break;
+
+                                                       case ASM_EVENT_ALARM:
+                                                               event_src = ASM_EVENT_SOURCE_ALARM_START;
+                                                               break;
+
+                                                       case ASM_EVENT_SHARE_MMPLAYER:
+                                                       case ASM_EVENT_EXCLUSIVE_MMPLAYER:
+                                                               if (    current_play_sound_event == ASM_EVENT_SHARE_MMPLAYER ||
+                                                                       current_play_sound_event == ASM_EVENT_EXCLUSIVE_MMPLAYER ) {
+                                                                       event_src = ASM_EVENT_SOURCE_OTHER_PLAYER_APP;
+                                                                       break;
+                                                               }
+
+                                                       default:
+                                                               event_src = ASM_EVENT_SOURCE_OTHER_APP;
+                                                               break;
+                                                       }
+                                                       command = ASM_COMMAND_PAUSE;
+                                               }
+
+                                               /* Execute callback function for monitor handle */
+                                               int monitor_handle = -1;
+                                               if (__find_clean_monitor_handle(current_play_instance_id, &monitor_handle)) {
+                                                       cb_res = __do_callback(current_play_instance_id, monitor_handle, ASM_COMMAND_STOP, event_src);
+                                                       asm_warning("[ASM_Server][%s] send stop callback for monitor handle of pid %d\n", __func__, current_play_instance_id);
+                                                       if (cb_res != ASM_CB_RES_NONE && cb_res != ASM_CB_RES_STOP) {
+                                                               asm_error_r("[ASM_Server][%s] oops! not suspected callback result %d\n", __func__, cb_res);
+                                                       }
+                                                       __set_monitor_dirty(current_play_instance_id);
+
+                                                       /* If current is playing and input event is CALL/VIDEOCALL/ALARM, set to need resume */
+                                                       if( __is_need_resume(sound_event) && (current_play_state == ASM_STATE_PLAYING)) {
+                                                               __asm_change_need_resume_list(current_play_instance_id, monitor_handle, ASM_NEED_RESUME);
+                                                       }
+                                               }
+
+                                               /* Execute callback function for worker handle */
+                                               cb_res = __do_callback(current_play_instance_id,current_play_handle,command, event_src);
+                                               asm_warning("[ASM_Server][%s] (1PAUSE_2PLAY) : Callback of %s: TID(%ld)\n",
+                                                                       __func__,ASM_sound_command_str[command], current_play_instance_id);
+                                               /*Change current sound' state when it is in 1Pause_2Play case */
+                                               switch (cb_res) {
+                                               case ASM_CB_RES_PAUSE:
+                                                       update_state = ASM_STATE_PAUSE;
+                                                       break;
+
+                                               case ASM_CB_RES_NONE:
+                                               case ASM_CB_RES_STOP:
+                                                       update_state = ASM_STATE_NONE;
+                                                       update_resource = ASM_RESOURCE_NONE;
+                                                       break;
+
+                                               case ASM_CB_RES_IGNORE:
+                                                       update_state = ASM_STATE_IGNORE;
+                                                       break;
+
+                                               default:
+                                                       asm_error_r("[ASM_Server][%s] oops! not suspected result %d\n", __func__, cb_res);
+                                                       update_state = ASM_STATE_NONE;
+                                                       break;
+                                               }
+
+                                               /* If current is playing and input event is CALL/VIDEOCALL/ALARM, set to need resume */
+                                               if( __is_need_resume(sound_event)
+                                                       &&(current_play_state == ASM_STATE_PLAYING)) {
+                                                       __asm_change_need_resume_list(current_play_instance_id, current_play_handle, ASM_NEED_RESUME);
+                                               }
+
+                                               __asm_change_state_list(current_play_instance_id, current_play_handle, update_state, update_resource);
+                                       }
+
+                                       /* Prepare msg to send */
+                                       ASM_SND_MSG_SET(asm_snd_msg, handle, handle, ASM_COMMAND_PLAY, sound_state);
+
+                                       if (!updatedflag) {
+                                               if (request_id == ASM_REQUEST_REGISTER) {
+                                                       __asm_register_list(instance_id, handle, sound_event, sound_state, mm_resource);
+                                               } else {
+                                                       __asm_change_state_list(instance_id, handle, sound_state, mm_resource);
+                                               }
+                                               updatedflag = 1;
+                                       }
+                                       break;
+                               }
+
+                               case ASM_CASE_1PLAY_2PLAY_MIX:
+                               {
+                                       if (current_play_instance_id == instance_id) {
+                                               asm_info("[ASM_Server] Do not send check resource conflict in same pid %ld\n", instance_id);
+                                       } else {
+                                               /* MIX but need to check resource conflict */
+                                               asm_warning("[ASM_Server][%s] 1PLAY_2PLAY_MIX :  !!!\n", __func__);
+                                               ASM_resource_t update_resource = current_using_resource;
+                                               unsigned short resource_status = current_using_resource & mm_resource;
+                                               if (resource_status) { /* Resouce conflict */
+                                                       asm_warning("[ASM_Server][%s] there is system resource conflict 0x%x\n", __func__, resource_status);
+                                                       __print_resource(resource_status);
+
+                                                       /* Execute callback function for monitor handle */
+                                                       int monitor_handle = -1;
+                                                       if (__find_clean_monitor_handle(current_play_instance_id, &monitor_handle)) {
+                                                               cb_res = __do_callback(current_play_instance_id, monitor_handle, ASM_COMMAND_STOP, ASM_EVENT_SOURCE_RESOURCE_CONFLICT);
+                                                               if (cb_res != ASM_CB_RES_NONE && cb_res != ASM_CB_RES_STOP) {
+                                                                       asm_error_r("[ASM_Server][%s] oops! not suspected callback result %d\n", __func__, cb_res);
+                                                               }
+                                                               asm_warning("[ASM_Server][%s] send stop callback for monitor handle of pid %d\n", __func__, current_play_instance_id);
+                                                               __set_monitor_dirty(current_play_instance_id);
+
+                                                               /* If current is playing and input event is CALL/VIDEOCALL/ALARM, set to need resume */
+                                                               if( __is_need_resume(sound_event)
+                                                                       && (current_play_state == ASM_STATE_PLAYING) ) {
+                                                                       __asm_change_need_resume_list(current_play_instance_id, monitor_handle, ASM_NEED_RESUME);
+                                                               }
+                                                       }
+
+                                                       /* Execute callback function for worker handle */
+                                                       /* Stop current resource holding instance */
+                                                       cb_res = __do_callback(current_play_instance_id, current_play_handle, ASM_COMMAND_STOP, ASM_EVENT_SOURCE_RESOURCE_CONFLICT);
+                                                       asm_warning("[ASM_Server][%s]  1PLAY_2PLAY_MIX : Resource Conflict : TID(%ld)\n",
+                                                                       __func__, current_play_instance_id);
+
+                                                       /* Change current sound */
+                                                       switch (cb_res) {
+                                                       case ASM_CB_RES_NONE:
+                                                       case ASM_CB_RES_STOP:
+                                                               update_state = ASM_STATE_NONE;
+                                                               update_resource = ASM_RESOURCE_NONE;
+                                                               break;
+
+                                                       case ASM_CB_RES_IGNORE:
+                                                               update_state = ASM_STATE_IGNORE;
+                                                               break;
+
+                                                       default:
+                                                               asm_error_r("[ASM_Server][%s] oops! not suspected result %d\n", __func__, cb_res);
+                                                               update_state = ASM_STATE_NONE;
+                                                               break;
+                                                       }
+
+                                                       __asm_change_state_list(current_play_instance_id, current_play_handle, update_state, update_resource);
+                                               }
+                                       }
+
+                                       /* Prepare msg to send */
+                                       ASM_SND_MSG_SET(asm_snd_msg, handle, handle, ASM_COMMAND_PLAY, sound_state);
+
+                                       if (!updatedflag) {
+                                               if (request_id == ASM_REQUEST_REGISTER) {
+                                                       __asm_register_list(instance_id, handle, sound_event, sound_state, mm_resource);
+                                               } else {
+                                                       __asm_change_state_list(instance_id, handle, sound_state, mm_resource);
+                                               }
+                                               updatedflag = 1;
+                                       }
+                                       break;
+                               }
+
+                               default:
+                               {
+                                       ASM_SND_MSG_SET(asm_snd_msg, handle, handle, ASM_COMMAND_NONE, sound_state);
+                                       asm_warning("[ASM_Server][%s] ASM_CASE_NONE [It should not be seen] !!!\n", __func__);
+                                       break;
+                               }
+                               } /* switch (sound_case) */
+                       } else {
+                               /* Request was not PLAYING, this means no conflict, just do set */
+                               asm_info("[ASM_Server][%s] No Conflict (Just Register or Set State) !!!\n",__func__);
+                               ASM_SND_MSG_SET(asm_snd_msg, handle, handle, ASM_COMMAND_NONE, sound_state);
+
+                               if (sound_state == ASM_STATE_NONE) {
+                                       asm_info("[ASM_Server][%s] 1PLAY_2NONE : No Conflict !!!\n", __func__);
+                               } else if (sound_state == ASM_STATE_WAITING) {
+                                       asm_info("[ASM_Server][%s] 1PLAY_2WAIT : No Conflict !!!\n", __func__);
+                               }
+
+                               if (!updatedflag) {
+                                       if (request_id == ASM_REQUEST_REGISTER) {
+                                               __asm_register_list(instance_id, handle, sound_event, sound_state, mm_resource);
+                                       } else {
+                                               __asm_change_state_list(instance_id, handle, sound_state, mm_resource);
+                                       }
+                                       updatedflag = 1;
+                               }
+                       }
+
+                       temp_list = temp_list->next;
+
+               } /* while (temp_list->next != tail_list) */
+
+               /* Make all monitor handle dirty flag clean. */
+               __set_all_monitor_clean();
+       }
+
+       /* Find if resource confilct exists in case of 1Pause 2Play or 1Stop 2Play */
+       if (ASM_STATUS_NONE != g_sound_status_pause && mm_resource != ASM_RESOURCE_NONE &&
+               (asm_snd_msg->data.result_sound_command == ASM_COMMAND_PLAY || no_conflict_flag)) {
+               asm_instance_list_t *temp_list = head_list;
+               int cb_res = 0;
+
+               while (temp_list->next != tail_list) {
+                       /* Who is in PAUSE state? */
+                       if (temp_list->sound_state == ASM_STATE_PAUSE) {
+                               /* Found PAUSE state */
+                               asm_warning("[ASM_Server][%s] Now list's state is pause. %d %d\n", __func__, instance_id, handle);
+                               ASM_sound_states_t current_play_state = temp_list->sound_state;
+                               ASM_sound_events_t current_play_sound_event = temp_list->sound_event;
+                               long int current_play_instance_id = temp_list->instance_id;
+                               int current_play_handle = temp_list->sound_handle;
+                               ASM_resource_t current_using_resource = temp_list->mm_resource;
+
+                               if ((current_play_instance_id == instance_id) && (current_play_handle == handle)) {
+                                       if (request_id == ASM_REQUEST_SETSTATE) {
+                                               asm_warning("[ASM_Server][%s] Own handle. Pause state change to play. %d %d\n", __func__, instance_id, handle);
+                                               __asm_change_state_list(instance_id, handle, sound_state, mm_resource);
+                                       } else {
+                                               asm_warning("[ASM_Server][%s] This is my handle. skip %d %d\n", __func__, instance_id, handle);
+                                       }
+                                       temp_list = temp_list->next;
+                                       continue;
+                               }
+
+                               if (sound_state == ASM_STATE_PLAYING) {
+                                       ASM_sound_cases_t sound_case = ASM_sound_case[current_play_sound_event][sound_event];
+
+                                       asm_critical("[ASM_Server][%s] Conflict policy[%x][%x]: %s\n", __func__, current_play_sound_event, sound_event, ASM_sound_cases_str[sound_case]);
+                                       switch (sound_case) {
+                                       case ASM_CASE_1PAUSE_2PLAY:
+                                       case ASM_CASE_1STOP_2PLAY:
+                                       {
+                                               if (current_play_instance_id == instance_id) {
+                                                       //PID is policy group.
+                                                       asm_info("[ASM_Server][%s] Do not send Stop callback in same pid %ld\n", __func__, instance_id);
+                                               } else {
+                                                       unsigned short resource_status = current_using_resource & mm_resource;
+
+                                                       /* Check conflict with paused instance */
+                                                       if (resource_status != ASM_RESOURCE_NONE) {
+                                                               asm_warning("[ASM_Server][%s] there is system resource conflict with paused instance 0x%x\n", __func__, resource_status);
+                                                               __print_resource(resource_status);
+                                                       } else {
+                                                               asm_info("[ASM_Server][%s] no resource conflict with paused instance\n", __func__);
+                                                               break;
+                                                       }
+
+                                                       /* Execute callback function for monitor handle */
+                                                       int monitor_handle = -1;
+                                                       if (__find_clean_monitor_handle(current_play_instance_id, &monitor_handle)) {
+                                                               cb_res = __do_callback(current_play_instance_id, monitor_handle, ASM_COMMAND_STOP, ASM_EVENT_SOURCE_RESOURCE_CONFLICT);
+                                                               if (cb_res != ASM_CB_RES_NONE && cb_res != ASM_CB_RES_STOP) {
+                                                                       asm_error_r("[ASM_Server][%s] oops! not suspected callback result %d\n", __func__, cb_res);
+                                                               }
+                                                               asm_warning("[ASM_Server][%s] send stop callback for monitor handle of pid %d\n", __func__, current_play_instance_id);
+
+                                                               __set_monitor_dirty(current_play_instance_id);
+                                                       }
+
+                                                       /* Execute callback function for worker handle */
+                                                       cb_res = __do_callback(current_play_instance_id,current_play_handle, ASM_COMMAND_STOP, ASM_EVENT_SOURCE_RESOURCE_CONFLICT);
+                                                       if (cb_res != ASM_CB_RES_NONE && cb_res != ASM_CB_RES_STOP) {
+                                                               asm_error_r("[ASM_Server][%s] oops! not suspected result %d\n", __func__, cb_res);
+                                                       }
+                                                       asm_warning("[ASM_Server][%s]  1STOP_2PLAY cause RESOURCE : __do_callback Complete : TID=%ld, handle=%d",
+                                                                       __func__, current_play_instance_id,current_play_handle );
+
+                                                       __asm_change_state_list(current_play_instance_id, current_play_handle, ASM_STATE_NONE, ASM_RESOURCE_NONE);
+                                               }
+
+                                               asm_info("[ASM_Server][%s] 1STOP_2PLAY cause RESOURCE : msg sent and  then received msg !!!\n",__func__);
+                                               break;
+                                       }
+
+                                       default:
+                                               /* asm_warning("[ASM_Server] >>>> __asm_compare_priority_matrix : ASM_CASE_NONE [do not anything] !!!\n"); */
+                                               break;
+
+                                       } /* switch (sound_case) */
+                               } else {
+                                       /* asm_warning("[ASM_Server] >>>> __asm_compare_priority_matrix : ASM_CASE_NONE [do not anything] !!!\n"); */
+                               }
+                       } /* if (temp_list->sound_state == ASM_STATE_PAUSE) */
+
+                       temp_list = temp_list->next;
+               } /* while (temp_list->next != tail_list) */
+       }
+
+       /* Finally, no conflict */
+       if (no_conflict_flag) {
+               if (request_id == ASM_REQUEST_REGISTER) {
+                       __asm_register_list(instance_id, handle, sound_event, sound_state, mm_resource);
+               } else {
+                       __asm_change_state_list(instance_id, handle, sound_state, mm_resource);
+               }
+       }
+
+       /* Send response to client */
+       asm_snd_msg->instance_id = instance_id;
+
+#if 1
+       if (asm_ret_msg) {
+               *asm_ret_msg = *asm_snd_msg;
+       } else {
+               __asm_snd_message(asm_snd_msg);
+       }
+#else
+       __asm_snd_message(asm_snd_msg);
+#endif
+
+       asm_info("[ASM_Server][%s] LEAVE <<<<<< \n", __func__);
+}
+
+void __asm_do_all_resume_callback(ASM_event_sources_t eventsrc)
+{
+       asm_instance_list_t *temp_list = head_list;
+       int cb_res = 0;
+
+       asm_info("[ASM_Server][%s] >>>>>>>>>> ENTER with EventSrc [%d]\n", __func__, eventsrc);
+
+       while (temp_list->next != tail_list) {
+               if (temp_list->need_resume == ASM_NEED_RESUME) {
+                       {
+                               cb_res = __do_callback(temp_list->instance_id, temp_list->sound_handle, ASM_COMMAND_RESUME, eventsrc);
+                               switch (cb_res) {
+                               case ASM_CB_RES_PLAYING:
+                                       temp_list->sound_state = ASM_STATE_PLAYING;
+                                       break;
+                               case ASM_CB_RES_IGNORE:
+                               case ASM_CB_RES_NONE:
+                               case ASM_CB_RES_STOP:
+                               case ASM_CB_RES_PAUSE:
+                               default:
+                                       /* do nothing */
+                                       break;
+                               }
+                       }
+                       temp_list->need_resume = ASM_NEED_NOT_RESUME;
+               }
+               temp_list = temp_list->next;
+       }
+
+       asm_info("[ASM_Server][%s] <<<<<<<<<< LEAVE\n", __func__);
+}
+
+#ifdef USE_SECURITY
+gboolean __asm_check_check_privilege (unsigned char* cookie)
+{
+       int asm_gid = -1;
+       int retval = 0;
+
+       /* Get ASM server group id */
+       asm_gid = security_server_get_gid("asm");
+       asm_info ("[ASM_Server][Security] asm server gid = [%d]\n", asm_gid);
+       if (asm_gid < 0) {
+               asm_error ("[ASM_Server][Security] security_server_get_gid() failed. error=[%d]\n", asm_gid);
+               return false;
+       }
+
+       /* Check privilege with valid group id */
+       retval = security_server_check_privilege((char *)cookie, asm_gid);
+       if (retval == SECURITY_SERVER_API_SUCCESS) {
+               asm_info("[ASM_Server][Security] security_server_check_privilege() returns [%d]\n", retval);
+               return true;
+       } else {
+               asm_error("[ASM_Server][Security] security_server_check_privilege() returns [%d]\n", retval);
+               return false;
+       }
+}
+#endif /* USE_SECURITY */
+
+int __asm_process_message (ASM_msg_lib_to_asm_t *asm_rcv_msg, ASM_msg_asm_to_lib_t *asm_ret_msg)
+{
+       long int rcv_instance_id;
+       ASM_requests_t rcv_request_id;
+       ASM_sound_events_t rcv_sound_event;
+       ASM_sound_states_t rcv_sound_state;
+       ASM_resource_t rcv_resource;
+       int rcv_sound_handle;
+
+       ASM_msg_asm_to_lib_t asm_snd_msg;
+
+       asm_info ("[ASM_Server] ===================================================================== [%s] Starting.... ", __func__);
+       pthread_mutex_lock(&g_mutex_asm);
+       asm_info ("[ASM_Server] ===================================================================== [%s] Started!!! (LOCKED) ", __func__);
+
+       rcv_instance_id = asm_rcv_msg->instance_id;
+       rcv_sound_handle = asm_rcv_msg->data.handle;
+       rcv_request_id = asm_rcv_msg->data.request_id;
+       rcv_sound_event = asm_rcv_msg->data.sound_event;
+       rcv_sound_state = asm_rcv_msg->data.sound_state;
+       rcv_resource = asm_rcv_msg->data.system_resource;
+
+       /*******************************************************************/
+       asm_info("[ASM_Server] received msg (tid=%ld,handle=%d,req=%d,event=0x%x,state=0x%x,resource=0x%x)\n",
+                       rcv_instance_id, rcv_sound_handle, rcv_request_id, rcv_sound_event, rcv_sound_state, rcv_resource);
+       if (rcv_request_id != ASM_REQUEST_EMERGENT_EXIT) {
+               asm_warning("[ASM_Server]     request_id : %s\n", ASM_sound_request_str[rcv_request_id]);
+               if (rcv_request_id == ASM_REQUEST_SET_SUBSESSION) {
+                       asm_warning("[ASM_Server]     subsession : %s\n", subsession_str[rcv_sound_event]);
+               } else {
+                       asm_warning("[ASM_Server]     sound_event : %s\n", ASM_sound_events_str[rcv_sound_event]);
+                       asm_warning("[ASM_Server]     sound_state : %s\n", ASM_sound_state_str[rcv_sound_state]);
+                       asm_warning("[ASM_Server]     resource : 0x%x\n", rcv_resource);
+               }
+       }
+       /*******************************************************************/
+       asm_info ("[ASM_Server] +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ [%s]", __func__);
+
+       switch (rcv_request_id) {
+       case ASM_REQUEST_REGISTER:
+#ifdef USE_SECURITY
+               /* do security check */
+               if (__asm_check_check_privilege(asm_rcv_msg->data.cookie) == 0) {
+                       asm_error ("[ASM_Server][Security] __asm_check_check_privilege() failed....\n");
+                       asm_snd_msg.instance_id = rcv_instance_id;
+                       asm_snd_msg.data.alloc_handle = -1;
+                       asm_snd_msg.data.cmd_handle = -1;
+                       asm_snd_msg.data.check_privilege = 0;
+                       if (asm_ret_msg == NULL)
+                               __asm_snd_message(&asm_snd_msg);
+                       break;
+               }
+               asm_info ("[ASM_Server][Security] __asm_check_check_privilege() success\n");
+               asm_snd_msg.data.check_privilege = 1;
+#endif /* USE_SECURITY */
+               __check_dead_process();
+
+               __asm_get_empty_handle(rcv_instance_id, &rcv_sound_handle);
+               if (rcv_sound_handle == -1) {
+                       asm_snd_msg.instance_id = rcv_instance_id;
+                       asm_snd_msg.data.alloc_handle = -1;
+                       asm_snd_msg.data.cmd_handle = -1;
+                       if (asm_ret_msg == NULL)
+                               __asm_snd_message(&asm_snd_msg);
+               } else {
+                       __asm_compare_priority_matrix(&asm_snd_msg, asm_ret_msg,
+                                                                               rcv_instance_id, rcv_sound_handle, rcv_request_id, rcv_sound_event, rcv_sound_state, rcv_resource);
+
+                       /* FIXME: Is this right place? */
+                       if (rcv_sound_event == ASM_EVENT_CALL || rcv_sound_event == ASM_EVENT_RICH_CALL) {
+                               asm_info ("[ASM_Server] ****** SESSION_VOICECALL start ******\n");
+                               MMSoundMgrSessionSetSession(SESSION_VOICECALL, SESSION_START);
+                       } else if (rcv_sound_event == ASM_EVENT_VIDEOCALL) {
+                               asm_info ("[ASM_Server] ****** SESSION_VOIP start ******\n");
+                               MMSoundMgrSessionSetSession(SESSION_VOIP, SESSION_START);
+                       }
+               }
+
+               break;
+
+       case ASM_REQUEST_UNREGISTER:
+               __asm_unregister_list(rcv_sound_handle);
+               /* only support resuming at end of call & alarm interrupt */
+               switch (rcv_sound_event) {
+               case ASM_EVENT_CALL:
+               case ASM_EVENT_RICH_CALL:
+               case ASM_EVENT_VIDEOCALL:
+                       if (rcv_sound_event == ASM_EVENT_CALL || rcv_sound_event == ASM_EVENT_RICH_CALL) {
+                               asm_info ("[ASM_Server] ****** SESSION_VOICECALL end ******\n");
+                               MMSoundMgrSessionSetSession(SESSION_VOICECALL, SESSION_END);
+                       } else if (rcv_sound_event == ASM_EVENT_VIDEOCALL) {
+                               asm_info ("[ASM_Server] ****** SESSION_VOIP end ******\n");
+                               MMSoundMgrSessionSetSession(SESSION_VOIP, SESSION_END);
+                       }
+                       __asm_do_all_resume_callback(ASM_EVENT_SOURCE_CALL_END);
+                       break;
+               case ASM_EVENT_ALARM:
+                       asm_info ("[ASM_Server] ****** SESSION_NOTIFICATION end ******\n");
+                       MMSoundMgrSessionSetSession(SESSION_NOTIFICATION, SESSION_END);
+                       __asm_do_all_resume_callback(ASM_EVENT_SOURCE_ALARM_END);
+                       break;
+               default:
+                       break;
+               }
+
+               break;
+
+       case ASM_REQUEST_SETSTATE:
+               __check_dead_process();
+               if ( rcv_sound_state == ASM_STATE_PLAYING )     {
+                       if ( __isItPlayingNow(rcv_instance_id, rcv_sound_handle)) {
+                               __asm_change_state_list(rcv_instance_id, rcv_sound_handle, rcv_sound_state, rcv_resource);
+
+                               asm_snd_msg.data.cmd_handle = rcv_sound_handle;
+                               asm_snd_msg.data.result_sound_command = ASM_COMMAND_NONE;
+                               asm_snd_msg.data.result_sound_state = rcv_sound_state;
+                               asm_snd_msg.instance_id = rcv_instance_id;
+                               if (asm_ret_msg == NULL)
+                                       __asm_snd_message(&asm_snd_msg);
+                       } else {
+                               __asm_compare_priority_matrix(&asm_snd_msg, asm_ret_msg,
+                                                                                       rcv_instance_id, rcv_sound_handle, rcv_request_id, rcv_sound_event, rcv_sound_state, rcv_resource);
+
+                               /* FIXME: Is this right place? */
+                               /* If compare result is play and event was alarm, set session to notification */
+                               if (asm_snd_msg.data.result_sound_command == ASM_COMMAND_PLAY ||
+                                               asm_snd_msg.data.result_sound_command == ASM_COMMAND_NONE) {
+                                       switch (rcv_sound_event)
+                                       {
+                                       case ASM_EVENT_ALARM:
+                                               {
+                                                       session_t cur_session;
+                                                       MMSoundMgrSessionGetSession(&cur_session);
+                                                       if (cur_session == SESSION_NOTIFICATION) {
+                                                               asm_info ("[ASM_Server] ****** SESSION_NOTIFICATION ongoing ******\n");
+                                                       } else {
+                                                               asm_info ("[ASM_Server] ****** SESSION_NOTIFICATION start ******\n");
+                                                               MMSoundMgrSessionSetSession(SESSION_NOTIFICATION, SESSION_START);
+                                                       }
+                                               }
+                                               break;
+
+                                       case ASM_EVENT_SHARE_FMRADIO:
+                                       case ASM_EVENT_EXCLUSIVE_FMRADIO:
+                                               {
+                                                       session_t cur_session;
+                                                       MMSoundMgrSessionGetSession(&cur_session);
+                                                       if (cur_session == SESSION_FMRADIO) {
+                                                               asm_info ("[ASM_Server] ****** SESSION_FMRADIO ongoing ******\n");
+                                                       } else {
+                                                               asm_info ("[ASM_Server] ****** SESSION_FMRADIO start ******\n");
+                                                               MMSoundMgrSessionSetSession(SESSION_FMRADIO, SESSION_START);
+                                                       }
+                                               }
+                                               break;
+                                       }
+                               }
+                       }
+                       __temp_print_list("Set State (Play)");
+               } else {
+                       __asm_change_state_list(rcv_instance_id, rcv_sound_handle, rcv_sound_state, rcv_resource);
+
+                       if (rcv_sound_state == ASM_STATE_STOP) {
+                               switch (rcv_sound_event)
+                               {
+                               case ASM_EVENT_SHARE_FMRADIO:
+                               case ASM_EVENT_EXCLUSIVE_FMRADIO:
+                                       {
+                                               session_t cur_session;
+                                               MMSoundMgrSessionGetSession(&cur_session);
+                                               if (cur_session == SESSION_FMRADIO) {
+                                                       asm_info ("[ASM_Server] ****** SESSION_FMRADIO end ******\n");
+                                                       MMSoundMgrSessionSetSession(SESSION_FMRADIO, SESSION_END);
+                                               } else {
+                                                       asm_info ("[ASM_Server] Session is not SESSION_FMRADIO");
+                                               }
+                                       }
+                                       break;
+                               }
+                       }
+
+                       __temp_print_list("Set State (Not Play)");
+               }
+               break;
+
+       case ASM_REQUEST_GETSTATE:
+               asm_snd_msg.instance_id = rcv_instance_id;
+               asm_snd_msg.data.result_sound_state = __asm_find_list(rcv_request_id, rcv_sound_handle);
+               if (asm_ret_msg == NULL)
+                       __asm_snd_message(&asm_snd_msg);
+               break;
+
+       case ASM_REQUEST_GETMYSTATE:
+               __check_dead_process();
+               asm_snd_msg.instance_id = rcv_instance_id;
+               asm_snd_msg.data.result_sound_state = __asm_find_process_status(rcv_instance_id);
+               if (asm_ret_msg == NULL)
+                       __asm_snd_message(&asm_snd_msg);
+               break;
+
+       case ASM_REQUEST_DUMP:
+               __temp_print_list("DUMP");
+               break;
+
+       case ASM_REQUEST_SET_SUBSESSION:
+               {
+                       int rcv_subsession = rcv_sound_event;
+                       int ret = 0;
+
+                       /* FIXME: have to check only call instance with playing stsate can request this */
+                       if (rcv_subsession < SUBSESSION_VOICE || rcv_subsession >= SUBSESSION_NUM) {
+                               /* TODO : Error Handling */
+                               debug_error ("[ASM_Server] Invalid subsession [%d] to set\n", rcv_subsession);
+                       }
+
+                       asm_info ("[ASM_Server] ****** SUB-SESSION [%s] ******\n", subsession_str[rcv_subsession]);
+                       ret = MMSoundMgrSessionSetSubSession(rcv_subsession);
+                       if (ret != MM_ERROR_NONE) {
+                               /* TODO : Error Handling */
+                               debug_error ("[ASM_Server] MMSoundMgrSessionSetSubSession failed....ret = [%x]\n", ret);
+                       }
+
+                       /* Return result msg */
+                       asm_snd_msg.instance_id = rcv_instance_id;
+                       if (asm_ret_msg == NULL)
+                               __asm_snd_message(&asm_snd_msg);
+               }
+               break;
+
+       case ASM_REQUEST_GET_SUBSESSION:
+               {
+                       int subsession = 0;
+                       int ret = 0;
+
+                       /* FIXME: have to check only call instance with playing stsate can request this */
+                       asm_info ("[ASM_Server] ****** GET SUB-SESSION ******\n");
+                       ret = MMSoundMgrSessionGetSubSession(&subsession);
+                       if (ret != MM_ERROR_NONE) {
+                               /* TODO : Error Handling */
+                               debug_error ("[ASM_Server] MMSoundMgrSessionGetSubSession failed....ret = [%x]\n", ret);
+                       }
+
+                       /* Return result msg */
+                       asm_snd_msg.instance_id = rcv_instance_id;
+                       asm_snd_msg.data.result_sound_command = subsession;
+                       if (asm_ret_msg == NULL)
+                               __asm_snd_message(&asm_snd_msg);
+                       }
+               break;
+
+       case ASM_REQUEST_EMERGENT_EXIT:
+               emergent_exit(rcv_instance_id);
+               break;
+
+       default:
+               break;
+       }
+
+
+       if (asm_ret_msg) {
+               *asm_ret_msg = asm_snd_msg;
+       }
+
+       pthread_mutex_unlock(&g_mutex_asm);
+       asm_info ("[ASM_Server] --------------------------------------------------------------------- [%s] End (UNLOCKED) ", __func__);
+}
+
+int __asm_main_run (void* param)
+{
+       int pid = 0, ret = 0;
+
+       ASM_msg_lib_to_asm_t asm_rcv_msg;
+
+       if (sysconf_set_mempolicy(OOM_IGNORE)) {
+               fprintf(stderr, "set mem policy failed\n");
+       }
+       signal(SIGPIPE, SIG_IGN);
+
+       /* Init Msg Queue */
+       __asm_create_message_queue();
+
+       int temp_msgctl_id1 = msgctl(asm_snd_msgid, IPC_RMID, 0);
+       int temp_msgctl_id2 = msgctl(asm_rcv_msgid, IPC_RMID, 0);
+       int temp_msgctl_id3 = msgctl(asm_cb_msgid, IPC_RMID, 0);
+
+       if (temp_msgctl_id1 == -1 || temp_msgctl_id2 == -1 || temp_msgctl_id3 == -1) {
+               asm_critical("[ASM_Server] msgctl failed with error(%d,%s) \n", errno, strerror(errno));
+               exit(EXIT_FAILURE);
+       }
+       //-------------------------------------------------------------------
+       /*
+               This is unnessasry finaly, but nessasary during implement.
+       */
+       /* FIXME: Do we need to do this again ? */
+       __asm_create_message_queue();
+
+       /* Init List */
+       head_list = (asm_instance_list_t *)malloc(sizeof(asm_instance_list_t));
+       tail_list = (asm_instance_list_t *)malloc(sizeof(asm_instance_list_t));
+       head_list->next = tail_list;
+       tail_list->next = tail_list;
+
+
+       /*
+        * Init Vconf
+        */
+       if (vconf_set_int(SOUND_STATUS_KEY, 0)) {
+               asm_critical("[ASM_Server] vconf_set_int fail\n");
+               if (vconf_set_int(SOUND_STATUS_KEY, 0)) {
+                       asm_critical_r("[ASM_Server] vconf_set_int fail\n");
+               }
+       }
+
+#ifdef SUPPORT_GCF
+       if (vconf_get_int(VCONFKEY_ADMIN_GCF_TEST, &is_gcf)) {
+               asm_warning_r("[ASM_Server] vconf_get_int for VCONFKEY_ADMIN_GCF_TEST failed, set as default\n");
+               is_gcf = GCF_DEFAULT;
+       }
+#endif
+
+       /* Set READY flag */
+       if (vconf_set_int(ASM_READY_KEY, 1)) {
+               asm_critical("[ASM_Server] vconf_set_int fail\n");
+       }
+
+       /* Msg Loop */
+       while (true) {
+               asm_info("[ASM_Server] asm_Server is waiting message(%d)!!!\n", asm_is_send_msg_to_cb);
+               if (asm_is_send_msg_to_cb)
+                       continue;
+
+               /* Receive Msg */
+               __asm_rcv_message(&asm_rcv_msg);
+
+               /* Do msg handling */
+               __asm_process_message (&asm_rcv_msg, NULL);
+
+               /* TODO : Error Handling */
+       }
+
+       return 0;
+}
+
+
+int MMSoundMgrASMInit(void)
+{
+       int ret = 0;
+       debug_fenter();
+
+       ret = MMSoundThreadPoolRun(NULL, __asm_main_run);
+       if (ret != MM_ERROR_NONE) {
+               /* TODO : Error Handling */
+               debug_error ("MMSoundThreadPoolRun failed....ret = [%x]\n", ret);
+       }
+
+       debug_fleave();
+       return ret;
+}
+
+int MMSoundMgrASMFini(void)
+{
+       debug_fenter();
+
+       debug_fleave();
+       return MM_ERROR_NONE;
+}
+
index 6f95ad2..789e083 100644 (file)
@@ -35,6 +35,8 @@
 #include "include/mm_sound_plugin_codec.h"
 #include "include/mm_sound_thread_pool.h"
 
+#include "include/mm_sound_mgr_asm.h"
+
 
 
 #define _ENABLE_KEYTONE        /* Temporal test code */
@@ -241,8 +243,8 @@ int MMSoundMgrCodecPlay(int *slotid, const mmsound_mgr_codec_param_t *param)
        int need_asm_unregister = 0;
 
        if(param->session_type != ASM_EVENT_CALL && param->session_type != ASM_EVENT_VIDEOCALL) {
-               if(!ASM_register_sound((int)param->param, &param->session_handle, param->session_type, ASM_STATE_PLAYING,
-                                                               sound_codec_asm_callback, (void*)*slotid, ASM_RESOURCE_NONE, &errorcode))       {
+               if(!ASM_register_sound_ex((int)param->param, &param->session_handle, param->session_type, ASM_STATE_PLAYING,
+                                                               sound_codec_asm_callback, (void*)*slotid, ASM_RESOURCE_NONE, &errorcode, __asm_process_message))        {
                        debug_critical("ASM_register_sound() failed %d\n", errorcode);
                        pthread_mutex_unlock(&g_slot_mutex);
                        return MM_ERROR_POLICY_INTERNAL;
@@ -286,7 +288,7 @@ int MMSoundMgrCodecPlay(int *slotid, const mmsound_mgr_codec_param_t *param)
 
 cleanup:
        if(param->session_type != ASM_EVENT_CALL  && param->session_type != ASM_EVENT_VIDEOCALL && need_asm_unregister == 1) {
-               if(!ASM_unregister_sound(param->session_handle, param->session_type, &errorcode)) {
+               if(!ASM_unregister_sound_ex(param->session_handle, param->session_type, &errorcode,__asm_process_message)) {
                        debug_error("Unregister sound failed 0x%X\n", errorcode);
                        return MM_ERROR_POLICY_INTERNAL;
                }
@@ -358,8 +360,8 @@ int MMSoundMgrCodecPlayDtmf(int *slotid, const mmsound_mgr_codec_param_t *param)
        int need_asm_unregister = 0;
 
        if(param->session_type != ASM_EVENT_CALL && param->session_type != ASM_EVENT_VIDEOCALL) {
-               if(!ASM_register_sound((int)param->param, &param->session_handle, param->session_type, ASM_STATE_PLAYING,
-                                                               sound_codec_asm_callback, (void*)*slotid, ASM_RESOURCE_NONE, &errorcode)) {
+               if(!ASM_register_sound_ex((int)param->param, &param->session_handle, param->session_type, ASM_STATE_PLAYING,
+                                                               sound_codec_asm_callback, (void*)*slotid, ASM_RESOURCE_NONE, &errorcode, __asm_process_message)) {
                        debug_critical("ASM_register_sound() failed %d\n", errorcode);
                        pthread_mutex_unlock(&g_slot_mutex);
                        return MM_ERROR_POLICY_INTERNAL;
@@ -454,7 +456,7 @@ static int _MMSoundMgrCodecStopCallback(int param)
 
        if(g_slots[param].session_type != ASM_EVENT_CALL && g_slots[param].session_type != ASM_EVENT_VIDEOCALL) {
                debug_msg("[CODEC MGR] ASM unregister\n");
-               if(!ASM_unregister_sound(g_slots[param].session_handle, g_slots[param].session_type, &errorcode)) {
+               if(!ASM_unregister_sound_ex(g_slots[param].session_handle, g_slots[param].session_type, &errorcode, __asm_process_message)) {
                        debug_error("[CODEC MGR] Unregister sound failed 0x%X\n", errorcode);
                }
        }
diff --git a/server/mm_sound_mgr_device.c b/server/mm_sound_mgr_device.c
new file mode 100644 (file)
index 0000000..2f9c0e7
--- /dev/null
@@ -0,0 +1,395 @@
+/*
+ * libmm-sound
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Seungbae Shin <seungbae.shin@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 <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <pthread.h>
+#include <sys/stat.h>
+#include <glib.h>
+#include <errno.h>
+
+#include <mm_error.h>
+#include <mm_types.h>
+#include <mm_debug.h>
+#include <mm_ipc.h>
+
+#include "include/mm_sound_mgr_common.h"
+#include "include/mm_sound_mgr_ipc.h"
+#include "include/mm_sound_mgr_device.h"
+#include "include/mm_sound_thread_pool.h"
+#include "../include/mm_sound_msg.h"
+#include "../include/mm_sound_common.h"
+#include "../include/mm_sound_utils.h"
+
+#include "include/mm_sound_mgr_session.h"
+
+void _mm_sound_get_devices_from_route(mm_sound_route route, mm_sound_device_in *device_in, mm_sound_device_out *device_out);
+
+static GList *g_active_device_cb_list = NULL;
+static pthread_mutex_t g_active_device_cb_mutex = PTHREAD_MUTEX_INITIALIZER;
+static GList *g_available_route_cb_list = NULL;
+static pthread_mutex_t g_available_route_cb_mutex = PTHREAD_MUTEX_INITIALIZER;
+
+int _mm_sound_mgr_device_init(void)
+{
+       debug_fenter();
+
+       debug_fleave();
+       return MM_ERROR_NONE;
+}
+
+int _mm_sound_mgr_device_fini(void)
+{
+       debug_fenter();
+
+       debug_fleave();
+       return MM_ERROR_NONE;
+}
+
+int _mm_sound_mgr_device_is_route_available(const _mm_sound_mgr_device_param_t *param, bool *is_available)
+{
+       mm_sound_route route = param->route;
+       mm_sound_device_in device_in = MM_SOUND_DEVICE_IN_NONE;
+       mm_sound_device_out device_out = MM_SOUND_DEVICE_OUT_NONE;
+       int ret = MM_ERROR_NONE;
+
+       debug_fenter();
+
+       _mm_sound_get_devices_from_route(route, &device_in, &device_out);
+
+       /* check given input & output device is available */
+       MMSoundMgrSessionIsDeviceAvailable(device_out, device_in, is_available);
+
+       debug_fleave();
+       return ret;
+}
+
+int _mm_sound_mgr_device_foreach_available_route_cb(mm_ipc_msg_t *msg)
+{
+       mm_sound_route *route_list = NULL;
+       int route_list_count = 0;
+       int route_index = 0;
+       int available_count = 0;
+       bool is_available = 0;
+       int ret = MM_ERROR_NONE;
+
+       debug_fenter();
+
+       route_list_count = _mm_sound_get_valid_route_list(&route_list);
+       for (route_index = 0; route_index < route_list_count; route_index++) {
+               mm_sound_device_in device_in = MM_SOUND_DEVICE_IN_NONE;
+               mm_sound_device_out device_out = MM_SOUND_DEVICE_OUT_NONE;
+
+               _mm_sound_get_devices_from_route(route_list[route_index], &device_in, &device_out);
+               /* check input & output device of given route is available */
+               MMSoundMgrSessionIsDeviceAvailable(device_out, device_in, &is_available);
+
+               /* add route to avaiable route list */
+               if (is_available) {
+                       if (available_count >= (sizeof(msg->sound_msg.route_list) / sizeof(int))) {
+                               debug_error("Cannot add available route, list is full\n");
+                       }
+                       msg->sound_msg.route_list[available_count++] = route_list[route_index];
+               }
+       }
+
+       debug_fleave();
+       return ret;
+}
+
+int _mm_sound_mgr_device_set_active_route(const _mm_sound_mgr_device_param_t *param)
+{
+       mm_sound_route route = param->route;
+       mm_sound_device_in device_in = MM_SOUND_DEVICE_IN_NONE;
+       mm_sound_device_out device_out = MM_SOUND_DEVICE_OUT_NONE;
+       bool is_available = 0;
+       int ret = MM_ERROR_NONE;
+
+       debug_fenter();
+
+       _mm_sound_get_devices_from_route(route, &device_in, &device_out);
+       /* check specific route is available */
+       ret = _mm_sound_mgr_device_is_route_available(param, &is_available);
+       if ((ret != MM_ERROR_NONE) || (!is_available)) {
+
+       }
+
+       MMSoundMgrSessionSetDeviceActive(device_out, device_in);
+
+       debug_fleave();
+       return ret;
+}
+
+int _mm_sound_mgr_device_get_active_device(const _mm_sound_mgr_device_param_t *param, mm_sound_device_in *device_in, mm_sound_device_out *device_out)
+{
+       int ret = MM_ERROR_NONE;
+
+       debug_fenter();
+
+       MMSoundMgrSessionGetDeviceActive(device_out, device_in);
+
+       debug_fleave();
+       return ret;
+}
+
+int _mm_sound_mgr_device_add_active_device_callback(const _mm_sound_mgr_device_param_t *param)
+{
+       int ret = MM_ERROR_NONE;
+       GList *list;
+       _mm_sound_mgr_device_param_t *cb_param;
+       bool is_already_set = FALSE;
+
+       debug_fenter();
+
+       MMSOUND_ENTER_CRITICAL_SECTION_WITH_RETURN(&g_active_device_cb_mutex, MM_ERROR_SOUND_INTERNAL);
+
+       for (list = g_active_device_cb_list; list != NULL; list = list->next)
+       {
+               cb_param = (_mm_sound_mgr_device_param_t *)list->data;
+               if ((cb_param) && (cb_param->pid == param->pid))
+               {
+                       cb_param->callback = param->callback;
+                       cb_param->cbdata = param->cbdata;
+                       is_already_set = TRUE;
+                       break;
+               }
+       }
+       if (!is_already_set) {
+               cb_param = g_malloc(sizeof(_mm_sound_mgr_device_param_t));
+               memcpy(cb_param, param, sizeof(_mm_sound_mgr_device_param_t));
+               g_active_device_cb_list = g_list_append(g_active_device_cb_list, cb_param);
+               if (g_active_device_cb_list) {
+                       debug_log("active device cb registered for pid [%d]", cb_param->pid);
+               } else {
+                       debug_error("g_list_append failed\n");
+               }
+       }
+
+       MMSOUND_LEAVE_CRITICAL_SECTION(&g_active_device_cb_mutex);
+
+       debug_fleave();
+       return ret;
+}
+
+int _mm_sound_mgr_device_remove_active_device_callback(const _mm_sound_mgr_device_param_t *param)
+{
+       int ret = MM_ERROR_NONE;
+       GList *list;
+       _mm_sound_mgr_device_param_t *cb_param;
+
+       debug_fenter();
+
+       MMSOUND_ENTER_CRITICAL_SECTION_WITH_RETURN(&g_active_device_cb_mutex, MM_ERROR_SOUND_INTERNAL);
+
+       for (list = g_active_device_cb_list; list != NULL; list = list->next)
+       {
+               cb_param = (_mm_sound_mgr_device_param_t *)list->data;
+               if ((cb_param) && (cb_param->pid == param->pid))
+               {
+                       g_active_device_cb_list = g_list_remove(g_active_device_cb_list, cb_param);
+                       g_free(cb_param);
+                       break;
+               }
+       }
+
+       MMSOUND_LEAVE_CRITICAL_SECTION(&g_active_device_cb_mutex);
+
+       debug_fleave();
+       return ret;
+}
+
+int _mm_sound_mgr_device_active_device_callback(mm_sound_device_in device_in, mm_sound_device_out device_out)
+{
+       int ret = MM_ERROR_NONE;
+       GList *list;
+       _mm_sound_mgr_device_param_t *cb_param;
+       mm_ipc_msg_t msg;
+
+       debug_fenter();
+
+       MMSOUND_ENTER_CRITICAL_SECTION_WITH_RETURN(&g_active_device_cb_mutex, MM_ERROR_SOUND_INTERNAL);
+
+       for (list = g_active_device_cb_list; list != NULL; list = list->next)
+       {
+               cb_param = (_mm_sound_mgr_device_param_t *)list->data;
+               if ((cb_param) && (cb_param->callback))
+               {
+                       SOUND_MSG_SET(msg.sound_msg, MM_SOUND_MSG_INF_ACTIVE_DEVICE_CB, 0, MM_ERROR_NONE, cb_param->pid);
+                       msg.sound_msg.device_in = device_in;
+                       msg.sound_msg.device_out = device_out;
+                       msg.sound_msg.callback = cb_param->callback;
+                       msg.sound_msg.cbdata = cb_param->cbdata;
+
+                       ret = _MMIpcCBSndMsg(&msg);
+                       if (ret != MM_ERROR_NONE)
+                               debug_error("Fail to send callback message\n");
+               }
+       }
+
+       MMSOUND_LEAVE_CRITICAL_SECTION(&g_active_device_cb_mutex);
+
+       debug_fleave();
+       return ret;
+}
+
+int _mm_sound_mgr_device_add_available_route_callback(const _mm_sound_mgr_device_param_t *param)
+{
+       int ret = MM_ERROR_NONE;
+       GList *list;
+       _mm_sound_mgr_device_param_t *cb_param;
+       bool is_already_set = FALSE;
+
+       debug_fenter();
+
+       MMSOUND_ENTER_CRITICAL_SECTION_WITH_RETURN(&g_available_route_cb_mutex, MM_ERROR_SOUND_INTERNAL);
+
+       for (list = g_available_route_cb_list; list != NULL; list = list->next)
+       {
+               cb_param = (_mm_sound_mgr_device_param_t *)list->data;
+               if ((cb_param) && (cb_param->pid == param->pid))
+               {
+                       cb_param->callback = param->callback;
+                       cb_param->cbdata = param->cbdata;
+                       is_already_set = TRUE;
+                       break;
+               }
+       }
+       if (!is_already_set) {
+               cb_param = g_malloc(sizeof(_mm_sound_mgr_device_param_t));
+               memcpy(cb_param, param, sizeof(_mm_sound_mgr_device_param_t));
+               g_available_route_cb_list = g_list_append(g_available_route_cb_list, cb_param);
+               if (g_available_route_cb_list) {
+                       debug_log("available route cb registered for pid [%d]", cb_param->pid);
+               } else {
+                       debug_error("g_list_append failed\n");
+               }
+       }
+
+       MMSOUND_LEAVE_CRITICAL_SECTION(&g_available_route_cb_mutex);
+
+       debug_fleave();
+       return ret;
+}
+
+int _mm_sound_mgr_device_remove_available_route_callback(const _mm_sound_mgr_device_param_t *param)
+{
+       int ret = MM_ERROR_NONE;
+       GList *list;
+       _mm_sound_mgr_device_param_t *cb_param;
+
+       debug_fenter();
+
+       MMSOUND_ENTER_CRITICAL_SECTION_WITH_RETURN(&g_available_route_cb_mutex, MM_ERROR_SOUND_INTERNAL);
+
+       for (list = g_available_route_cb_list; list != NULL; list = list->next)
+       {
+               cb_param = (_mm_sound_mgr_device_param_t *)list->data;
+               if ((cb_param) && (cb_param->pid == param->pid))
+               {
+                       g_available_route_cb_list = g_list_remove(g_available_route_cb_list, cb_param);
+                       g_free(cb_param);
+                       break;
+               }
+       }
+
+       MMSOUND_LEAVE_CRITICAL_SECTION(&g_available_route_cb_mutex);
+
+       debug_fleave();
+       return ret;
+}
+
+int _mm_sound_mgr_device_available_device_callback(mm_sound_device_in device_in, mm_sound_device_out device_out, bool available)
+{
+       int ret = MM_ERROR_NONE;
+       _mm_sound_mgr_device_param_t *cb_param;
+       mm_ipc_msg_t msg;
+       int route_list_count = 0;
+       int route_index = 0;
+       int available_count = 0;
+       mm_sound_route *route_list = NULL;
+       GList *list = NULL;
+       GList *available_route_list = NULL;
+
+       debug_fenter();
+
+       route_list_count = _mm_sound_get_valid_route_list(&route_list);
+       for (route_index = 0; route_index < route_list_count; route_index++) {
+               mm_sound_device_in route_device_in = MM_SOUND_DEVICE_IN_NONE;
+               mm_sound_device_out route_device_out = MM_SOUND_DEVICE_OUT_NONE;
+               bool is_changed = 0;
+
+               _mm_sound_get_devices_from_route(route_list[route_index], &route_device_in, &route_device_out);
+               if ((device_in != MM_SOUND_DEVICE_IN_NONE) && (device_in == route_device_in)) {
+                       /* device(in&out) changed together & they can be combined as this route */
+                       if ((device_out != MM_SOUND_DEVICE_OUT_NONE) && (device_out == route_device_out)) {
+                               is_changed = 1;
+                       /* device(in) changed & this route has device(in) only */
+                       } else if (route_device_out == MM_SOUND_DEVICE_OUT_NONE) {
+                               is_changed = 1;
+                       /* device(in) changed & this route have device(in&out), we need to check availability of output device of this route */
+                       } else {
+                               MMSoundMgrSessionIsDeviceAvailableNoLock(route_device_out, MM_SOUND_DEVICE_IN_NONE, &is_changed);
+                       }
+               }
+               if ((is_changed == 0) && (device_out != MM_SOUND_DEVICE_OUT_NONE) && (device_out == route_device_out)) {
+                       /* device(out) changed & this route has device(out) only */
+                       if (route_device_in == MM_SOUND_DEVICE_IN_NONE) {
+                               is_changed = 1;
+                       /* device(out) changed & this route have device(in&out), we need to check availability of input device of this route */
+                       } else {
+                               MMSoundMgrSessionIsDeviceAvailableNoLock(MM_SOUND_DEVICE_OUT_NONE, route_device_in, &is_changed);
+                       }
+               }
+
+               /* add route to avaiable route list */
+               if (is_changed) {
+                       if (available_count >= (sizeof(msg.sound_msg.route_list) / sizeof(int))) {
+                               debug_error("Cannot add available route, list is full\n");
+                       }
+                       msg.sound_msg.route_list[available_count++] = route_list[route_index];
+               }
+       }
+
+       MMSOUND_ENTER_CRITICAL_SECTION_WITH_RETURN(&g_available_route_cb_mutex, MM_ERROR_SOUND_INTERNAL);
+
+       for (list = g_available_route_cb_list; list != NULL; list = list->next)
+       {
+               cb_param = (_mm_sound_mgr_device_param_t *)list->data;
+               if ((cb_param) && (cb_param->callback))
+               {
+                       SOUND_MSG_SET(msg.sound_msg, MM_SOUND_MSG_INF_AVAILABLE_ROUTE_CB, 0, MM_ERROR_NONE, cb_param->pid);
+                       msg.sound_msg.is_available = available;
+                       msg.sound_msg.callback = cb_param->callback;
+                       msg.sound_msg.cbdata = cb_param->cbdata;
+
+                       ret = _MMIpcCBSndMsg(&msg);
+                       if (ret != MM_ERROR_NONE)
+                               debug_error("Fail to send callback message\n");
+               }
+       }
+
+       MMSOUND_LEAVE_CRITICAL_SECTION(&g_available_route_cb_mutex);
+
+       debug_fleave();
+       return ret;
+}
+
diff --git a/server/mm_sound_mgr_headset.c b/server/mm_sound_mgr_headset.c
new file mode 100644 (file)
index 0000000..80a8ddf
--- /dev/null
@@ -0,0 +1,245 @@
+/*
+ * libmm-sound
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Seungbae Shin <seungbae.shin@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 <stdlib.h>
+#include <string.h>
+
+#include <pthread.h>
+#include <sys/shm.h>
+#include <sys/msg.h>
+#include <sys/mman.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <stdbool.h>
+
+#include <errno.h>
+
+#include "include/mm_sound_mgr_common.h"
+#include "../include/mm_sound_common.h"
+
+#include <mm_error.h>
+#include <mm_debug.h>
+
+//#include <audio-session-manager.h>
+#include <avsys-audio.h>
+
+#include "include/mm_sound_mgr_headset.h"
+//#include "include/mm_sound_mgr_asm.h"
+#include "include/mm_sound_mgr_session.h"
+
+/******************************* Headset Code **********************************/
+
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <stdbool.h>
+#include <errno.h>
+#include <assert.h>
+
+#include <mm_error.h>
+#include <mm_debug.h>
+#include <pthread.h>
+#include <avsys-audio.h>
+
+#include "mm_ipc.h"
+#include "mm_sound_common.h"
+#include "mm_sound.h"
+
+#include <string.h>
+
+#define EARJACK_EJECTED        0
+#define NO_FORCE_RESET  0
+
+int __headset_main_run (void* param)
+{
+       int current_type = 0;
+       int new_type = 0;
+       int waitfd = 0;
+       int err = AVSYS_STATE_SUCCESS;
+       int eject_event_count = 0;
+       int need_mute = 0;
+       int ret = 0;
+
+    /* re-check current path */
+    avsys_audio_path_ex_reset(NO_FORCE_RESET);
+
+       if(AVSYS_FAIL(avsys_audio_earjack_manager_init(&current_type, &waitfd)))
+               return MM_ERROR_SOUND_DEVICE_NOT_OPENED;
+
+       while(1)
+       {
+               //waiting earjack event
+               err = avsys_audio_earjack_manager_wait(waitfd, &current_type, &new_type, &need_mute);
+               debug_log ("wait result  = %x, current_type= %d, new_type = %d, need_mute = %d\n", err, current_type, new_type, need_mute);
+               if(err & AVSYS_STATE_ERROR) {
+#if !defined(_MMFW_I386_ALL_SIMULATOR)
+                       if(err != AVSYS_STATE_ERR_NULL_POINTER) {
+                               if(AVSYS_FAIL(avsys_audio_earjack_manager_unlock())) {
+                                       debug_error("avsys_audio_earjack_manager_unlock() failed in %s\n",__func__);
+                                       err = MM_ERROR_SOUND_INTERNAL;
+                                       goto fail;
+                               }
+                       }
+#endif
+                       break;
+               } else if((err & AVSYS_STATE_WARING)) {
+                       if(err != AVSYS_STATE_WAR_INVALID_VALUE) {
+                               if(AVSYS_FAIL(avsys_audio_earjack_manager_unlock())) {
+                                       debug_error("avsys_audio_earjack_manager_unlock() failed in %s\n",__func__);
+                                       err = MM_ERROR_SOUND_INTERNAL;
+                                       goto fail;
+                               }
+                       }
+                       continue; /* Ignore current changes and do wait again */
+               }
+               debug_warning("Current type is %d, New type is %d\n", current_type, new_type);
+
+               if(current_type == new_type) {
+                       if(AVSYS_FAIL(avsys_audio_earjack_manager_unlock())) {
+                               debug_error("avsys_audio_earjack_manager_unlock() failed in %s\n",__func__);
+                               err = MM_ERROR_SOUND_INTERNAL;
+                               goto fail;
+                       }
+                       continue; /* Ignore current changes and do wait again */
+               } else {
+                       current_type = new_type;
+               }
+               debug_warning("Current type is %d\n", current_type);
+
+               /* mute if needed, unmute will be done end of this loop */
+               if(need_mute) {
+                       if(AVSYS_FAIL(avsys_audio_set_global_mute(AVSYS_AUDIO_MUTE_NOLOCK)))
+                               debug_error("Set mute failed\n");
+               }
+
+               //current_type '0' means earjack ejected
+               if(current_type == EARJACK_EJECTED) {
+                       eject_event_count++;
+                       if(eject_event_count == 1) {
+                               debug_msg ("earjack [EJECTED]\n");
+
+                               /* ToDo: Device Update */
+                               MMSoundMgrSessionSetDeviceAvailable (DEVICE_WIRED, NOT_AVAILABLE, 0, NULL);
+
+                       }
+               } else if(current_type != EARJACK_EJECTED) { /* INSERT */
+                       debug_msg ("earjack is [INSERTED]\n");
+                       eject_event_count = 0;
+
+                       /* ToDo: Device Update */
+                       ret = MMSoundMgrSessionSetDeviceAvailable (DEVICE_WIRED, AVAILABLE, current_type, NULL);
+                       if (ret != MM_ERROR_NONE) {
+                               /* TODO : Error Handling */
+                               debug_error ("MMSoundMgrSessionSetDeviceAvailable failed....ret = [%x]\n", ret);
+                       }
+               }
+
+               //process change
+               err = avsys_audio_earjack_manager_process(current_type);
+               if(err & AVSYS_STATE_ERROR) {
+                       debug_error("Earjack Managing Fatal Error 0x%x\n", err);
+                       if(need_mute) {
+                               if(AVSYS_FAIL(avsys_audio_set_global_mute(AVSYS_AUDIO_UNMUTE_NOLOCK))) {
+                                       debug_error("Set unmute failed\n");
+                               }
+                       }
+#if !defined(_MMFW_I386_ALL_SIMULATOR)
+                       if(AVSYS_FAIL(avsys_audio_earjack_manager_unlock())) {
+                               debug_error("avsys_audio_earjack_manager_unlock() failed in %s\n",__func__);
+                               err = MM_ERROR_SOUND_INTERNAL;
+                               goto fail;
+                       }
+#endif
+                       break;
+               } else if(err & AVSYS_STATE_WARING) {
+                       debug_error("Earjack Managing Warning 0x%x\n", err);
+                       if(need_mute) {
+                               if(AVSYS_FAIL(avsys_audio_set_global_mute(AVSYS_AUDIO_UNMUTE_NOLOCK))) {
+                                       debug_error("Set unmute failed\n");
+                               }
+                       }
+
+                       if(AVSYS_FAIL(avsys_audio_earjack_manager_unlock())) {
+                               debug_error("avsys_audio_earjack_manager_unlock() failed in %s\n",__func__);
+                               err = MM_ERROR_SOUND_INTERNAL;
+                               goto fail;
+                       }
+                       continue;
+               }
+
+               /* Unmute if muted */
+               if(need_mute) {
+                       if(AVSYS_FAIL(avsys_audio_set_global_mute(AVSYS_AUDIO_UNMUTE_NOLOCK))) {
+                               debug_error("Set unmute failed\n");
+                       }
+               }
+
+               if(AVSYS_FAIL(avsys_audio_earjack_manager_unlock())) {
+                       debug_error("avsys_audio_earjack_manager_unlock() failed in %s\n",__func__);
+                       err = MM_ERROR_SOUND_INTERNAL;
+                       goto fail;
+               }
+       } /* while (1) */
+
+       if(AVSYS_FAIL(avsys_audio_earjack_manager_deinit(waitfd))) {
+               err = MM_ERROR_SOUND_INTERNAL;
+               goto fail;
+       }
+
+       return MM_ERROR_NONE;
+
+unlock_and_fail:
+       debug_error("earjack plugin unlock_and_fail\n");
+
+fail:
+       debug_error("earjack plugin fail\n");
+       debug_error("earphone plugin exit with 0x%x\n", err);
+
+       return err;
+}
+
+int MMSoundMgrHeadsetGetType (int *type)
+{
+       if (type) {
+               *type = avsys_audio_earjack_manager_get_type();
+       }
+       return MM_ERROR_NONE;
+}
+
+
+int MMSoundMgrHeadsetInit(void)
+{
+       debug_enter("\n");
+
+       MMSoundThreadPoolRun(NULL, __headset_main_run);
+
+       debug_leave("\n");
+       return MM_ERROR_NONE;
+}
+
+int MMSoundMgrHeadsetFini(void)
+{
+       debug_enter("\n");
+
+       debug_leave("\n");
+       return MM_ERROR_NONE;
+}
+
index 46cb31a..15ebccd 100644 (file)
@@ -37,6 +37,7 @@
 #include "../include/mm_sound_msg.h"
 #include "include/mm_sound_thread_pool.h"
 #include "include/mm_sound_mgr_codec.h"
+#include "include/mm_sound_mgr_device.h"
 #include <mm_error.h>
 #include <mm_debug.h>
 
@@ -44,7 +45,7 @@
 
 #define SHM_OPEN
 
-#ifdef PULSE_CLIENT
+#ifdef PULSE_CLIENT
 #include "include/mm_sound_mgr_pulse.h"
 #endif
 
@@ -60,29 +61,21 @@ static int _MMSoundMgrStopCB(int msgid, void* msgcallback, void *msgdata);  /* ms
 static int _MMSoundMgrIpcPlayFile(int *codechandle, mm_ipc_msg_t *msg);        /* codechandle means codec slotid */
 static int _MMSoundMgrIpcPlayMemory(int *codechandle, mm_ipc_msg_t *msg);
 static int _MMSoundMgrIpcStop(mm_ipc_msg_t *msg);
-static int _MMSoundMgrIpcCreate(int *codechandle, mm_ipc_msg_t *msg);
-static int _MMSoundMgrIpcDestroy(mm_ipc_msg_t *msg);
-static int _MMSoundMgrIpcPlay(mm_ipc_msg_t *msg);
 static int _MMSoundMgrIpcPlayDTMF(int *codechandle, mm_ipc_msg_t *msg);
-
-
+static int __mm_sound_mgr_ipc_is_route_available(mm_ipc_msg_t *msg, bool *is_available);
+static int __mm_sound_mgr_ipc_foreach_available_route_cb(mm_ipc_msg_t *msg);
+static int __mm_sound_mgr_ipc_set_active_route(mm_ipc_msg_t *msg);
+static int __mm_sound_mgr_ipc_get_active_device(mm_ipc_msg_t *msg, mm_sound_device_in *device_in, mm_sound_device_out *device_out);
+static int __mm_sound_mgr_ipc_add_active_device_changed_cb(mm_ipc_msg_t *msg);
+static int __mm_sound_mgr_ipc_remove_active_device_changed_cb(mm_ipc_msg_t *msg);
+static int __mm_sound_mgr_ipc_add_available_device_changed_cb(mm_ipc_msg_t *msg);
+static int __mm_sound_mgr_ipc_remove_available_device_changed_cb(mm_ipc_msg_t *msg);
 static int _MMIpcRecvMsg(int msgtype, mm_ipc_msg_t *msg);
 static int _MMIpcSndMsg(mm_ipc_msg_t *msg);
-static int _MMIpcCBSndMsg(mm_ipc_msg_t *msg);
-
-static int _MMSoundSetRespMsg(mm_ipc_msg_t *msgresp, int msgtype, int scmsgid, int handle, int code);
-
-#define SOUND_MSG_SET(sound_msg, x_msgtype, x_handle, x_code, x_msgid) \
-do { \
-       sound_msg.msgtype = x_msgtype; \
-       sound_msg.handle = x_handle; \
-       sound_msg.code = x_code; \
-       sound_msg.msgid = x_msgid; \
-} while(0)
 
 int MMSoundMgrIpcInit(void)
 {
-       debug_enter("\n");
+       debug_fenter();
 
        /* create msg queue rcv, snd, cb */
        /* This func is called only once */
@@ -109,7 +102,7 @@ int MMSoundMgrIpcInit(void)
        debug_msg("Created server msg queue id : [%d]\n", g_sndid);
        debug_msg("Created server msg queue id : [%d]\n", g_cbid);
        
-       debug_leave("\n");
+       debug_fleave();
        return MM_ERROR_NONE;
 }
 
@@ -125,7 +118,7 @@ int MMSoundMgrIpcReady(void)
        mm_ipc_msg_t msg = {0,};
        mm_ipc_msg_t resp  = {0,};
 
-       debug_enter("\n");
+       debug_fenter();
 
        debug_msg("Created server msg queue id : [%d]\n", g_rcvid);
        debug_msg("Created server msg queue id : [%d]\n", g_sndid);
@@ -156,12 +149,20 @@ int MMSoundMgrIpcReady(void)
                case MM_SOUND_MSG_REQ_FILE:
                case MM_SOUND_MSG_REQ_MEMORY:
                case MM_SOUND_MSG_REQ_STOP:
-#ifdef PULSE_CLIENT                    
+#ifdef PULSE_CLIENT
                case MM_SOUND_MSG_REQ_GET_AUDIO_ROUTE:
                case MM_SOUND_MSG_REQ_SET_AUDIO_ROUTE:
+#endif
                case MM_SOUND_MSG_REQ_IS_BT_A2DP_ON:
-#endif                 
                case MM_SOUND_MSG_REQ_DTMF:
+               case MM_SOUND_MSG_REQ_IS_ROUTE_AVAILABLE:
+               case MM_SOUND_MSG_REQ_FOREACH_AVAILABLE_ROUTE_CB:
+               case MM_SOUND_MSG_REQ_SET_ACTIVE_ROUTE:
+               case MM_SOUND_MSG_REQ_GET_ACTIVE_DEVICE:
+               case MM_SOUND_MSG_REQ_ADD_ACTIVE_DEVICE_CB:
+               case MM_SOUND_MSG_REQ_REMOVE_ACTIVE_DEVICE_CB:
+               case MM_SOUND_MSG_REQ_ADD_AVAILABLE_ROUTE_CB:
+               case MM_SOUND_MSG_REQ_REMOVE_AVAILABLE_ROUTE_CB:
                        {
                                /* Create msg to queue : this will be freed inside thread function after use */
                                mm_ipc_msg_t* msg_to_queue = malloc (sizeof(mm_ipc_msg_t));
@@ -207,7 +208,7 @@ int MMSoundMgrIpcReady(void)
                return MM_ERROR_SOUND_INTERNAL;
        }
        
-       debug_leave("\n");
+       debug_fleave();
        return MM_ERROR_NONE;
 }
 
@@ -217,8 +218,11 @@ static void _MMSoundMgrRun(mm_ipc_msg_t *msg)
        int ret = MM_ERROR_NONE;
        int instance;
        int handle = -1;
+       bool is_available = 0;
+       mm_sound_device_in device_in = MM_SOUND_DEVICE_IN_NONE;
+       mm_sound_device_out device_out = MM_SOUND_DEVICE_OUT_NONE;
 
-       debug_enter("\n");
+       debug_fenter();
 
        instance = msg->sound_msg.msgid;
 
@@ -259,16 +263,6 @@ static void _MMSoundMgrRun(mm_ipc_msg_t *msg)
                break;
                
 #ifdef PULSE_CLIENT
-       case MM_SOUND_MSG_REQ_GET_AUDIO_ROUTE:
-               debug_msg("Recv REQ_GET_AUDIO_ROUTE msg\n");
-               MMSoundMgrPulseHandleGetAudioRouteReq (msg, _MMIpcSndMsg);
-               return; /* sending result will be done by inside _MMIpcSndMsg which is called by MMSoundMgrPulseHandleGetAudioRouteReq() : for sync operation.*/
-
-       case MM_SOUND_MSG_REQ_SET_AUDIO_ROUTE:
-               debug_msg("Recv REQ_SET_AUDIO_ROUTE msg\n");
-               MMSoundMgrPulseHandleSetAudioRouteReq (msg, _MMIpcSndMsg);
-               return;
-
        case MM_SOUND_MSG_REQ_IS_BT_A2DP_ON:
                debug_msg("Recv REQ_IS_BT_A2DP_ON msg\n");
                MMSoundMgrPulseHandleIsBtA2DPOnReq (msg,_MMIpcSndMsg);
@@ -286,6 +280,98 @@ static void _MMSoundMgrRun(mm_ipc_msg_t *msg)
                        SOUND_MSG_SET(respmsg.sound_msg, MM_SOUND_MSG_RES_DTMF, handle, MM_ERROR_NONE, instance);
                }
                break;
+
+       case MM_SOUND_MSG_REQ_IS_ROUTE_AVAILABLE:
+               debug_msg("Recv REQ_SET_ACTIVE_ROUTE msg\n");
+               ret = __mm_sound_mgr_ipc_is_route_available(msg, &is_available);
+               if (ret != MM_ERROR_NONE) {
+                       debug_error("Error to MM_SOUND_MSG_REQ_IS_ROUTE_AVAILABLE.\n");
+                       SOUND_MSG_SET(respmsg.sound_msg, MM_SOUND_MSG_RES_ERROR, -1, ret, instance);
+               } else {
+                       SOUND_MSG_SET(respmsg.sound_msg, MM_SOUND_MSG_RES_IS_ROUTE_AVAILABLE, 0, MM_ERROR_NONE, instance);
+                       respmsg.sound_msg.is_available = is_available;
+               }
+               break;
+
+       case MM_SOUND_MSG_REQ_FOREACH_AVAILABLE_ROUTE_CB:
+               debug_msg("Recv REQ_FOREACH_AVAILABLE_ROUTE_CB msg\n");
+               ret = __mm_sound_mgr_ipc_foreach_available_route_cb(&respmsg);
+               if (ret != MM_ERROR_NONE) {
+                       debug_error("Error to MM_SOUND_MSG_REQ_FOREACH_AVAILABLE_ROUTE_CB.\n");
+                       SOUND_MSG_SET(respmsg.sound_msg, MM_SOUND_MSG_RES_ERROR, -1, ret, instance);
+               } else {
+                       SOUND_MSG_SET(respmsg.sound_msg, MM_SOUND_MSG_RES_FOREACH_AVAILABLE_ROUTE_CB, 0, MM_ERROR_NONE, instance);
+               }
+               break;
+
+       case MM_SOUND_MSG_REQ_SET_ACTIVE_ROUTE:
+               debug_msg("Recv REQ_SET_ACTIVE_ROUTE msg\n");
+               ret = __mm_sound_mgr_ipc_set_active_route(msg);
+               if (ret != MM_ERROR_NONE) {
+                       debug_error("Error to MM_SOUND_MSG_REQ_SET_ACTIVE_ROUTE.\n");
+                       SOUND_MSG_SET(respmsg.sound_msg, MM_SOUND_MSG_RES_ERROR, -1, ret, instance);
+               } else {
+                       SOUND_MSG_SET(respmsg.sound_msg, MM_SOUND_MSG_RES_SET_ACTIVE_ROUTE, 0, MM_ERROR_NONE, instance);
+               }
+               break;
+
+       case MM_SOUND_MSG_REQ_GET_ACTIVE_DEVICE:
+               debug_msg("Recv REQ_GET_ACTIVE_DEVICE msg\n");
+               ret = __mm_sound_mgr_ipc_get_active_device(msg, &device_in, &device_out);
+               if (ret != MM_ERROR_NONE) {
+                       debug_error("Error to MM_SOUND_MSG_REQ_GET_ACTIVE_DEVICE.\n");
+                       SOUND_MSG_SET(respmsg.sound_msg, MM_SOUND_MSG_RES_ERROR, -1, ret, instance);
+               } else {
+                       SOUND_MSG_SET(respmsg.sound_msg, MM_SOUND_MSG_RES_GET_ACTIVE_DEVICE, 0, MM_ERROR_NONE, instance);
+                       respmsg.sound_msg.device_in = device_in;
+                       respmsg.sound_msg.device_out = device_out;
+               }
+               break;
+
+       case MM_SOUND_MSG_REQ_ADD_ACTIVE_DEVICE_CB:
+               debug_msg("Recv REQ_ADD_ACTIVE_DEVICE_CB msg\n");
+               ret = __mm_sound_mgr_ipc_add_active_device_changed_cb(msg);
+               if (ret != MM_ERROR_NONE) {
+                       debug_error("Error to MM_SOUND_MSG_REQ_ADD_DEVICE_CB.\n");
+                       SOUND_MSG_SET(respmsg.sound_msg, MM_SOUND_MSG_RES_ERROR, -1, ret, instance);
+               } else {
+                       SOUND_MSG_SET(respmsg.sound_msg, MM_SOUND_MSG_RES_ADD_ACTIVE_DEVICE_CB, 0, MM_ERROR_NONE, instance);
+               }
+               break;
+
+       case MM_SOUND_MSG_REQ_REMOVE_ACTIVE_DEVICE_CB:
+               debug_msg("Recv REQ_REMOVE_ACTIVE_DEVICE_CB msg\n");
+               ret = __mm_sound_mgr_ipc_remove_active_device_changed_cb(msg);
+               if (ret != MM_ERROR_NONE) {
+                       debug_error("Error to MM_SOUND_MSG_REQ_REMOVE_DEVICE_CB.\n");
+                       SOUND_MSG_SET(respmsg.sound_msg, MM_SOUND_MSG_RES_ERROR, -1, ret, instance);
+               } else {
+                       SOUND_MSG_SET(respmsg.sound_msg, MM_SOUND_MSG_RES_REMOVE_ACTIVE_DEVICE_CB, 0, MM_ERROR_NONE, instance);
+               }
+               break;
+
+       case MM_SOUND_MSG_REQ_ADD_AVAILABLE_ROUTE_CB:
+               debug_msg("Recv REQ_ADD_AVAILABLE_ROUTE_CB msg\n");
+               ret = __mm_sound_mgr_ipc_add_available_device_changed_cb(msg);
+               if (ret != MM_ERROR_NONE) {
+                       debug_error("Error to MM_SOUND_MSG_REQ_ADD_DEVICE_CB.\n");
+                       SOUND_MSG_SET(respmsg.sound_msg, MM_SOUND_MSG_RES_ERROR, -1, ret, instance);
+               } else {
+                       SOUND_MSG_SET(respmsg.sound_msg, MM_SOUND_MSG_RES_ADD_AVAILABLE_ROUTE_CB, 0, MM_ERROR_NONE, instance);
+               }
+               break;
+
+       case MM_SOUND_MSG_REQ_REMOVE_AVAILABLE_ROUTE_CB:
+               debug_msg("Recv REQ_REMOVE_AVAILABLE_ROUTE_CB msg\n");
+               ret = __mm_sound_mgr_ipc_remove_available_device_changed_cb(msg);
+               if (ret != MM_ERROR_NONE) {
+                       debug_error("Error to MM_SOUND_MSG_REQ_REMOVE_DEVICE_CB.\n");
+                       SOUND_MSG_SET(respmsg.sound_msg, MM_SOUND_MSG_RES_ERROR, -1, ret, instance);
+               } else {
+                       SOUND_MSG_SET(respmsg.sound_msg, MM_SOUND_MSG_RES_REMOVE_AVAILABLE_ROUTE_CB, 0, MM_ERROR_NONE, instance);
+               }
+               break;
+
        default:
                /* Response error unknown operation */;
                debug_critical("Unexpected msg. %d for PID:%d\n", msg->sound_msg.msgtype, msg->sound_msg.msgid );               
@@ -307,7 +393,7 @@ static void _MMSoundMgrRun(mm_ipc_msg_t *msg)
        }
 
        debug_msg("Ready to next msg\n");
-       debug_leave("\n");
+       debug_fleave();
 }
 
 static int _MMSoundMgrStopCB(int msgid, void* msgcallback, void *msgdata)
@@ -316,7 +402,7 @@ static int _MMSoundMgrStopCB(int msgid, void* msgcallback, void *msgdata)
        mm_ipc_msg_t resp = {0,};
        int ret = MM_ERROR_SOUND_INTERNAL;
        
-       debug_enter("\n");
+       debug_fenter();
 
        SOUND_MSG_SET(resp.sound_msg, MM_SOUND_MSG_INF_STOP_CB, 0, MM_ERROR_NONE, msgid);
        resp.sound_msg.callback = msgcallback;
@@ -326,7 +412,7 @@ static int _MMSoundMgrStopCB(int msgid, void* msgcallback, void *msgdata)
        if (ret != MM_ERROR_NONE)
                debug_error("Fail to send callback message\n");
 
-       debug_leave("\n");
+       debug_fleave();
        return MM_ERROR_NONE;
 }
 
@@ -337,7 +423,7 @@ static int _MMSoundMgrIpcPlayFile(int *codechandle, mm_ipc_msg_t *msg)
        int ret = MM_ERROR_NONE;
        int mm_session_type = MM_SESSION_TYPE_SHARE;
        
-       debug_enter("\n");
+       debug_fenter();
 
        /* Set source */
        source = (MMSourceType*)malloc(sizeof(MMSourceType));
@@ -377,7 +463,6 @@ static int _MMSoundMgrIpcPlayFile(int *codechandle, mm_ipc_msg_t *msg)
        debug_msg("keytone %d\n", param.keytone);
        debug_msg("Handle route %d\n", param.handle_route);
 
-
        //convert mm_session_type to asm_event_type
        switch(mm_session_type)
        {
@@ -413,15 +498,14 @@ static int _MMSoundMgrIpcPlayFile(int *codechandle, mm_ipc_msg_t *msg)
                return ret;             
        }
 
-       debug_leave("\n");
-
+       debug_fleave();
        return MM_ERROR_NONE;
 }
 static int _MMSoundMgrIpcStop(mm_ipc_msg_t *msg)
 {
        int ret = MM_ERROR_NONE;
 
-       debug_enter("\n");
+       debug_fenter();
 
        ret = MMSoundMgrCodecStop(msg->sound_msg.handle);
 
@@ -430,7 +514,7 @@ static int _MMSoundMgrIpcStop(mm_ipc_msg_t *msg)
                return ret;
        }
 
-       debug_leave("\n");
+       debug_fleave();
        return MM_ERROR_NONE;
 }
 
@@ -442,9 +526,9 @@ static int _MMSoundMgrIpcPlayMemory(int *codechandle, mm_ipc_msg_t *msg)
        int shm_fd = -1;
        void* mmap_buf = NULL;
 
-       debug_enter("\n");
+       debug_fenter();
 
-#ifndef SHM_OPEN       
+#ifndef SHM_OPEN
        if ((shmid = shmget((key_t)(msg->sound_msg.sharedkey), msg->sound_msg.memsize, 0)) == -1)
        {
                if(errno == ENOENT)
@@ -539,8 +623,7 @@ static int _MMSoundMgrIpcPlayMemory(int *codechandle, mm_ipc_msg_t *msg)
                return ret;             
        }
 
-       debug_leave("\n");
-
+       debug_fleave();
        return ret;
 }
 
@@ -550,7 +633,7 @@ static int _MMSoundMgrIpcPlayDTMF(int *codechandle, mm_ipc_msg_t *msg)
        mmsound_mgr_codec_param_t param = {0,};
        int ret = MM_ERROR_NONE;
 
-       debug_enter("\n");
+       debug_fenter();
 
        /* Set sound player parameter */
        param.tone = msg->sound_msg.tone;
@@ -578,22 +661,134 @@ static int _MMSoundMgrIpcPlayDTMF(int *codechandle, mm_ipc_msg_t *msg)
                return ret;             
        }
        
-       debug_leave("\n");
+       debug_fleave();
+       return ret;
+}
 
+static int __mm_sound_mgr_ipc_is_route_available(mm_ipc_msg_t *msg, bool *is_available)
+{
+       _mm_sound_mgr_device_param_t param;
+       mm_sound_route route;
+       int ret = MM_ERROR_NONE;
+
+       debug_fenter();
+
+       param.route = msg->sound_msg.route;
+       ret = _mm_sound_mgr_device_is_route_available(&param, is_available);
+
+       debug_fleave();
        return ret;
 }
 
+static int __mm_sound_mgr_ipc_foreach_available_route_cb(mm_ipc_msg_t *msg)
+{
+       int ret = MM_ERROR_NONE;
+
+       debug_fenter();
+
+       ret = _mm_sound_mgr_device_foreach_available_route_cb(msg);
 
-/* scmsgid means Sound Client msg id : instance / The param MUST be set indeed */ 
-static int _MMSoundSetRespMsg(mm_ipc_msg_t *msgresp, int msgtype, int scmsgid, int handle, int code)
+       debug_fleave();
+       return ret;
+}
+
+static int __mm_sound_mgr_ipc_set_active_route(mm_ipc_msg_t *msg)
 {
-       msgresp->sound_msg.msgid = scmsgid;
-       msgresp->sound_msg.msgtype = msgtype;
-       msgresp->sound_msg.handle = handle;
-       msgresp->sound_msg.code = code;
-       msgresp->sound_msg.msgid = scmsgid;
-       
-       return MM_ERROR_NONE;
+       _mm_sound_mgr_device_param_t param;
+       int ret = MM_ERROR_NONE;
+
+       debug_fenter();
+
+       param.pid = msg->sound_msg.msgid;
+       param.route = msg->sound_msg.route;
+       ret = _mm_sound_mgr_device_set_active_route(&param);
+
+       debug_fleave();
+       return ret;
+}
+
+static int __mm_sound_mgr_ipc_get_active_device(mm_ipc_msg_t *msg, mm_sound_device_in *device_in, mm_sound_device_out *device_out)
+{
+       _mm_sound_mgr_device_param_t param;
+       int ret = MM_ERROR_NONE;
+
+       debug_fenter();
+
+       memset(&param, 0x00, sizeof(_mm_sound_mgr_device_param_t));
+       param.pid = msg->sound_msg.msgid;
+
+       ret = _mm_sound_mgr_device_get_active_device(&param, device_in, device_out);
+
+       debug_fleave();
+       return ret;
+}
+
+static int __mm_sound_mgr_ipc_add_active_device_changed_cb(mm_ipc_msg_t *msg)
+{
+       _mm_sound_mgr_device_param_t param;
+       int ret = MM_ERROR_NONE;
+
+       debug_fenter();
+
+       memset(&param, 0x00, sizeof(_mm_sound_mgr_device_param_t));
+       param.pid = msg->sound_msg.msgid;
+       param.callback = msg->sound_msg.callback;
+       param.cbdata = msg->sound_msg.cbdata;
+
+       ret = _mm_sound_mgr_device_add_active_device_callback(&param);
+
+       debug_fleave();
+       return ret;
+}
+
+static int __mm_sound_mgr_ipc_remove_active_device_changed_cb(mm_ipc_msg_t *msg)
+{
+       _mm_sound_mgr_device_param_t param;
+       int ret = MM_ERROR_NONE;
+
+       debug_fenter();
+
+       memset(&param, 0x00, sizeof(_mm_sound_mgr_device_param_t));
+       param.pid = msg->sound_msg.msgid;
+
+       ret = _mm_sound_mgr_device_remove_active_device_callback(&param);
+
+       debug_fleave();
+       return ret;
+}
+
+static int __mm_sound_mgr_ipc_add_available_device_changed_cb(mm_ipc_msg_t *msg)
+{
+       _mm_sound_mgr_device_param_t param;
+       int ret = MM_ERROR_NONE;
+
+       debug_fenter();
+
+       memset(&param, 0x00, sizeof(_mm_sound_mgr_device_param_t));
+       param.pid = msg->sound_msg.msgid;
+       param.callback = msg->sound_msg.callback;
+       param.cbdata = msg->sound_msg.cbdata;
+
+       ret = _mm_sound_mgr_device_add_available_route_callback(&param);
+
+       debug_fleave();
+       return ret;
+}
+
+static int __mm_sound_mgr_ipc_remove_available_device_changed_cb(mm_ipc_msg_t *msg)
+{
+       _mm_sound_mgr_device_param_t param;
+       int ret = MM_ERROR_NONE;
+
+       debug_fenter();
+
+       memset(&param, 0x00, sizeof(_mm_sound_mgr_device_param_t));
+       param.pid = msg->sound_msg.msgid;
+
+       ret = _mm_sound_mgr_device_remove_available_route_callback(&param);
+
+       debug_fleave();
+       return ret;
 }
 
 static int _MMIpcRecvMsg(int msgtype, mm_ipc_msg_t *msg)
@@ -652,7 +847,7 @@ int _MMIpcSndMsg(mm_ipc_msg_t *msg)
        return MM_ERROR_NONE;
 }
 
-static int _MMIpcCBSndMsg(mm_ipc_msg_t *msg)
+int _MMIpcCBSndMsg(mm_ipc_msg_t *msg)
 {
        /* rcv message */
        msg->msg_type = msg->sound_msg.msgid;
index d92655a..1fe93c2 100644 (file)
 #include <errno.h>
 
 #include "include/mm_sound_mgr_common.h"
-#include "../include/mm_sound_msg.h"
 #include "../include/mm_sound_common.h"
 
 #include <mm_error.h>
 #include <mm_debug.h>
 
-#include <audio-session-manager.h>
-#include <avsys-audio.h>
+//#include <audio-session-manager.h>
+//#include <avsys-audio.h>
 
+#include <pulse/pulseaudio.h>
 #include <pulse/ext-policy.h>
 
 #define SUPPORT_MONO_AUDIO
-//#define BT_DISCONNECT_PAUSE
 
-#include "include/mm_sound_mgr_pulse.h"
+#define SUPPORT_BT_SCO_DETECT
 
-#define SOUND_MSG_SET(sound_msg, x_msgtype, x_handle, x_code, x_msgid) \
-do { \
-       sound_msg.msgtype = x_msgtype; \
-       sound_msg.handle = x_handle; \
-       sound_msg.code = x_code; \
-       sound_msg.msgid = x_msgid; \
-} while(0)
+#include "include/mm_sound_mgr_pulse.h"
+#include "include/mm_sound_mgr_session.h"
 
-pa_threaded_mainloop *g_m;
-pa_context *g_context;
+#include "include/mm_sound_msg.h"
+#include "include/mm_sound_mgr_ipc.h"
 
-pthread_mutex_t g_mutex = PTHREAD_MUTEX_INITIALIZER;
 
+#include <vconf.h>
+#include <vconf-keys.h>
 
-#ifdef BT_DISCONNECT_PAUSE
-int g_asm_handle = -1;
+#define MAX_STRING     64
 
-bool _asm_register_for_bt ()
+typedef struct _pulse_info
 {
-       int asm_error = 0;
-       if(!ASM_register_sound(-1, &g_asm_handle, ASM_EVENT_EARJACK_UNPLUG, ASM_STATE_NONE, NULL, NULL, ASM_RESOURCE_NONE, &asm_error))
-       {
-               debug_warning("earjack event register failed with 0x%x\n", asm_error);
-               return false;
-       }
-       return true;
-}
+       pa_threaded_mainloop *m;
+       pa_context *context;
+       char sink_to_find[MAX_STRING];
+       bool init_bt_status;
+}pulse_info_t;
 
+pthread_mutex_t g_mutex = PTHREAD_MUTEX_INITIALIZER;
 
-int set_audio_route_to_default()
-{
-       int ret = MM_ERROR_NONE;
-       int codec_option = AVSYS_AUDIO_PATH_OPTION_JACK_AUTO;
+pulse_info_t* pulse_info = NULL;
 
-       debug_msg("Set audio route to default by sound_server pulse mgr\n");
+/* -------------------------------- PULSEAUDIO --------------------------------------------*/
 
-       if(MM_ERROR_NONE != __mm_sound_lock()) {
-               debug_error("Lock failed\n");
-               return MM_ERROR_SOUND_INTERNAL;
-       }
+static void server_info_cb(pa_context *c, const pa_server_info *i, void *userdata)
+{
+       int ret = 0;
 
-       ret = avsys_audio_set_path_ex(AVSYS_AUDIO_GAIN_EX_KEYTONE, AVSYS_AUDIO_PATH_EX_SPK, AVSYS_AUDIO_PATH_EX_NONE, codec_option);
-       if(AVSYS_FAIL(ret)) {
-               debug_error("Can not set playback sound path 0x%x\n", ret);
-               if(MM_ERROR_NONE != __mm_sound_unlock()) {
-                       debug_error("Unlock failed\n");
-                       return MM_ERROR_SOUND_INTERNAL;
-               }
-               return ret;
-       }
-       ret = avsys_audio_set_path_ex(AVSYS_AUDIO_GAIN_EX_VOICEREC, AVSYS_AUDIO_PATH_EX_NONE, AVSYS_AUDIO_PATH_EX_MIC, codec_option);
-       if(AVSYS_FAIL(ret)) {
-               debug_error("Can not set capture sound path 0x%x\n", ret);
-               if(MM_ERROR_NONE != __mm_sound_unlock()) {
-                       debug_error("Unlock failed\n");
-                       return MM_ERROR_SOUND_INTERNAL;
-               }
-               return ret;
-       }
+       if (!i) {
+               debug_error("error in server info callback\n");
 
-       ret = avsys_audio_set_route_policy(AVSYS_AUDIO_ROUTE_POLICY_DEFAULT);
-       if(AVSYS_FAIL(ret)) {
-               debug_error("Can not set route policy to avsystem 0x%x\n", ret);
-               if(MM_ERROR_NONE != __mm_sound_unlock()) {
-                       debug_error("Unlock failed\n");
-                       return MM_ERROR_SOUND_INTERNAL;
-               }
-               return ret;
-       }
+    } else {
+               debug_msg ("We got default sink = [%s]\n", i->default_sink_name);
 
-       ret = vconf_set_int(ROUTE_VCONF_KEY, (int)AVSYS_AUDIO_ROUTE_POLICY_DEFAULT);
-       if(ret < 0) {
-               debug_error("Can not set route policy to vconf %s\n", ROUTE_VCONF_KEY);
-               if(MM_ERROR_NONE != __mm_sound_unlock()) {
-                       debug_error("Unlock failed\n");
-                       return MM_ERROR_SOUND_INTERNAL;
+               /* ToDo: Update server info */
+               ret = MMSoundMgrSessionSetDefaultSink (i->default_sink_name);
+               if (ret != MM_ERROR_NONE) {
+                       /* TODO : Error Handling */
+                       debug_error ("MMSoundMgrSessionSetDefaultSink failed....ret = [%x]\n", ret);
                }
-               return MM_ERROR_SOUND_INTERNAL;
-       }
+    }
+}
 
-       if(MM_ERROR_NONE != __mm_sound_unlock()) {
-               debug_error("Unlock failed\n");
-               return MM_ERROR_SOUND_INTERNAL;
+static void init_card_info_cb (pa_context *c, const pa_card_info *i, int eol, void *userdata)
+{
+       pulse_info_t *pinfo = (pulse_info_t *)userdata;
+       if (eol || i == NULL) {
+               debug_msg ("signaling--------------\n");
+               pa_threaded_mainloop_signal (pinfo->m, 0);
+               return;
        }
 
-       return MM_ERROR_NONE;
+       if (strstr (i->name, "bluez")) {
+               pinfo->init_bt_status = true;
+       }
 }
 
-int process_asm_pause ()
+static void card_info_cb (pa_context *c, const pa_card_info *i, int eol, void *userdata)
 {
-       int asm_error = 0;
-
-       // mute is not affecting now
-       //if(AVSYS_FAIL(avsys_audio_set_global_mute(AVSYS_AUDIO_MUTE)))
-         //debug_error("Set unmute failed\n");
-
-       if (g_asm_handle ==  -1) {
-               debug_msg ("ASM handle is not valid, try to register once more\n");
-               /* This register should be success */
-               if (_asm_register_for_bt ()) {
-                       debug_msg("_asm_register_for_bt() success\n");
-               } else {
-                       debug_error("_asm_register_for_bt() failed\n");
-               }
-       }
+       int ret = 0;
+       char* desc = NULL;
 
-       if(!ASM_set_sound_state(g_asm_handle, ASM_EVENT_EARJACK_UNPLUG, ASM_STATE_PLAYING, ASM_RESOURCE_NONE, &asm_error ))
-               debug_error("earjack event set sound state to playing failed with 0x%x\n", asm_error);
+       if (eol || i == NULL) {
+               return;
+       }
 
-       if(!ASM_set_sound_state(g_asm_handle, ASM_EVENT_EARJACK_UNPLUG, ASM_STATE_STOP, ASM_RESOURCE_NONE, &asm_error ))
-               debug_error("earjack event set sound state to stop failed with 0x%x\n", asm_error);
+       /* Get device name : eg. SBH-600 */
+       desc = pa_proplist_gets(i->proplist, PA_PROP_DEVICE_DESCRIPTION);
+       debug_msg ("[%s][%d] card name is [%s], card.property.device.description = [%s]\n", __func__, __LINE__, i->name, desc);
 
-       //if(AVSYS_FAIL(avsys_audio_set_global_mute(AVSYS_AUDIO_UNMUTE)))
-               //debug_error("Set unmute failed\n");
+       /* ToDo: Update Device */
+       ret = MMSoundMgrSessionSetDeviceAvailable (DEVICE_BT_A2DP, AVAILABLE, 0, (desc)? desc : "NONAME");
+       if (ret != MM_ERROR_NONE) {
+               /* TODO : Error Handling */
+               debug_error ("MMSoundMgrSessionSetDeviceAvailable failed....ret = [%x]\n", ret);
+       }
 }
 
-static void
-context_subscribe_cb (pa_context * c,
-    pa_subscription_event_type_t t, uint32_t idx, void *userdata)
+static void context_subscribe_cb (pa_context * c, pa_subscription_event_type_t t, uint32_t idx, void *userdata)
 {
-    debug_msg (">>>>>>>>> [%s][%d] type=(%d) idx=(%u)\n", __func__, __LINE__,  t, idx);
-
-    /* if event is "sink" index is not 0 (alsa) then bluetooth sink device is load/unloaded */
-    /* FIXME : what if alsa index is not 0???? we have check more strictly*/
-    if ((t &  PA_SUBSCRIPTION_EVENT_FACILITY_MASK) == PA_SUBSCRIPTION_EVENT_SINK &&    idx != 0) {
-               if ((t & PA_SUBSCRIPTION_EVENT_TYPE_MASK) == PA_SUBSCRIPTION_EVENT_REMOVE) { /* unloaded */
-                       /* Check current policy */
-               avsys_audio_route_policy_t cur_policy;
-               if (avsys_audio_get_route_policy(&cur_policy) == AVSYS_STATE_SUCCESS) {
-                       /* We Do pause if policy is default, if not, do nothing */
-                               if (cur_policy == AVSYS_AUDIO_ROUTE_POLICY_DEFAULT)     {
-                                        /* Do pause here */
-                                       debug_msg("Do pause here");
-                                       process_asm_pause();
-                               } else {
-                                       debug_msg("Policy is not default, Do nothing");
-                               }
-               } else {
-                       debug_error ("avsys_audio_get_route_policy() failed");
-                       }
-               } else if ((t & PA_SUBSCRIPTION_EVENT_TYPE_MASK) == PA_SUBSCRIPTION_EVENT_NEW) { /* loaded */
-                       /* Restore audio route policy to default */
-                       if(MM_ERROR_NONE != set_audio_route_to_default()) {
-                               debug_error("set_audio_route_to_default() failed\n");
-                       } else {
-                               debug_msg("set_audio_route_to_default() done.\n");
+       debug_msg (">>>>>>>>> [%s][%d] type=(0x%x) idx=(%u)\n", __func__, __LINE__,  t, idx);
+
+       if ((t &  PA_SUBSCRIPTION_EVENT_FACILITY_MASK) == PA_SUBSCRIPTION_EVENT_CARD) {
+               /* FIXME: We assumed that card is bt, card new/remove = bt new/remove */
+
+               if ((t & PA_SUBSCRIPTION_EVENT_TYPE_MASK) == PA_SUBSCRIPTION_EVENT_REMOVE) { /* BT is removed */
+                       /* ToDo: Update Device */
+                       //MMSoundMgrSessionSetDeviceBT (STATUS_NONE, NULL);
+                       MMSoundMgrSessionSetDeviceAvailable (DEVICE_BT_A2DP, NOT_AVAILABLE, 0, NULL);
+
+               } else if ((t & PA_SUBSCRIPTION_EVENT_TYPE_MASK) == PA_SUBSCRIPTION_EVENT_NEW) { /* BT is loaded */
+                       /* Get Card info for BT name. Update device after that */
+                       pa_operation *o;
+                       if (!(o =       pa_context_get_card_info_by_index (c, idx, card_info_cb, NULL))) {
+                               return;
                        }
+                       pa_operation_unref(o);
+
                }
-    }
+
+       } else if ((t &  PA_SUBSCRIPTION_EVENT_FACILITY_MASK) == PA_SUBSCRIPTION_EVENT_SERVER) {
+
+               pa_operation_unref(pa_context_get_server_info(c, server_info_cb, NULL));
+
+
+       } else {
+               debug_msg ("[%s][%d] type=(0x%x) idx=(%u) is not card or server event, skip...\n", __func__, __LINE__,  t, idx);
+               return;
+       }
 }
 
-#endif
 
-void context_state_cb (pa_context *c, void *userdata)
+static void context_state_cb (pa_context *c, void *userdata)
 {
-       //g_print (">>>>>>>>> [%s][%d]\n", __func__, __LINE__);
+       pulse_info_t *pinfo = (pulse_info_t *)userdata;
 
        switch (pa_context_get_state(c)) {
                case PA_CONTEXT_UNCONNECTED:
@@ -217,76 +177,60 @@ void context_state_cb (pa_context *c, void *userdata)
 
                case PA_CONTEXT_READY:
                {
-                       //g_print ("PA_CONTEXT_READY\n");
-
-                        if (g_context == c) {
-
-#ifdef BT_DISCONNECT_PAUSE
-                                /* Do SINK Subscribe */
-                               pa_context_set_subscribe_callback(c, context_subscribe_cb, NULL);
+                        if (pinfo->context == c) {
 
+                                /* Do CARD and SERVER Subscribe */
+                               pa_context_set_subscribe_callback(c, context_subscribe_cb, pinfo);
                                pa_operation *o;
-                               if (!(o = pa_context_subscribe(c, (pa_subscription_mask_t)PA_SUBSCRIPTION_MASK_SINK, NULL, NULL))) {
-                                       //g_print ("pa_context_subscribe() failed\n");
+                               if (!(o = pa_context_subscribe(c, (pa_subscription_mask_t)PA_SUBSCRIPTION_MASK_CARD | PA_SUBSCRIPTION_MASK_SERVER, NULL, NULL))) {
                                        return;
                                }
                                pa_operation_unref(o);
-#else
-                               //pa_context_set_subscribe_callback(c, NULL, NULL);
-#endif
 
-                               /* Signal */
-                               debug_msg ("signaling--------------\n");
-                               pa_threaded_mainloop_signal (g_m, 0);
+                               pa_operation_unref(pa_context_get_card_info_list (pinfo->context, init_card_info_cb, pinfo));
+
+                               /* signaling will be done after get card info in card info callback */
                        }
                        break;
                }
        }
-
-       return;
 }
 
 
-int pulse_init ()
+static int pulse_init (pulse_info_t * pinfo)
 {
        int res;
 
        debug_msg (">>>>>>>>> [%s][%d]\n", __func__, __LINE__);
-#ifdef BT_DISCONNECT_PAUSE
-       /* Set audio route policy to default when sound server startup */
-       if(MM_ERROR_NONE != set_audio_route_to_default())
-       {
-               debug_error("Set audio route policy to default failed\n");
-       }
-#endif
+
        /* Create new mainloop */
-       g_m = pa_threaded_mainloop_new();
+       pinfo->m = pa_threaded_mainloop_new();
        //g_assert(g_m);
 
-       res = pa_threaded_mainloop_start (g_m);
+       res = pa_threaded_mainloop_start (pinfo->m);
        //g_assert (res == 0);
 
        /* LOCK thread */
-       pa_threaded_mainloop_lock (g_m);
+       pa_threaded_mainloop_lock (pinfo->m);
 
        /* Get mainloop API */
-       pa_mainloop_api *api = pa_threaded_mainloop_get_api(g_m);
+       pa_mainloop_api *api = pa_threaded_mainloop_get_api(pinfo->m);
 
        /* Create new Context */
-       g_context = pa_context_new(api, "SOUND_SERVER_ROUTE_MANAGER");
+       pinfo->context = pa_context_new(api, "SOUND_SERVER_ROUTE_MANAGER");
 
        /* Set Callback */
-       pa_context_set_state_callback (g_context, context_state_cb, NULL);
+       pa_context_set_state_callback (pinfo->context, context_state_cb, pinfo);
 
        /* Connect */
-       if (pa_context_connect (g_context, NULL, PA_CONTEXT_NOAUTOSPAWN, NULL) < 0) {
+       if (pa_context_connect (pinfo->context, NULL, PA_CONTEXT_NOAUTOSPAWN, NULL) < 0) {
                debug_error ("connection error\n");
        }
 
        for (;;) {
                pa_context_state_t state;
 
-               state = pa_context_get_state (g_context);
+               state = pa_context_get_state (pinfo->context);
 
                debug_msg ("context state is now %d\n", state);
 
@@ -300,371 +244,226 @@ int pulse_init ()
 
                /* Wait until the context is ready */
                debug_msg ("waiting..................\n");
-               pa_threaded_mainloop_wait (g_m);
+               pa_threaded_mainloop_wait (pinfo->m);
        }
 
        /* UNLOCK thread */
-       pa_threaded_mainloop_unlock (g_m);
+       pa_threaded_mainloop_unlock (pinfo->m);
 
        debug_msg ("<<<<<<<<<< [%s][%d]\n", __func__, __LINE__);
 
-       return 0;
+       return res;
 }
 
-int pulse_deinit ()
-{
-       pa_threaded_mainloop_lock (g_m);
-
-       if (g_context) {
-               pa_context_disconnect (g_context);
 
-               /* Make sure we don't get any further callbacks */
-               pa_context_set_state_callback (g_context, NULL, NULL);
-
-               pa_context_unref (g_context);
-               g_context = NULL;
-       }
-       pa_threaded_mainloop_unlock (g_m);
-
-       pa_threaded_mainloop_stop (g_m);
-       pa_threaded_mainloop_free (g_m);
-
-       debug_msg ("<<<<<<<<<< [%s][%d]\n", __func__, __LINE__);
-
-       return 0;
-
-}
+static void sink_info_cb (pa_context *c, const pa_sink_info *i, int is_last, void *userdata)
+{
+       pulse_info_t * pinfo = (pulse_info_t *)userdata;
 
-void get_server_info_callback(pa_context *c, const pa_server_info *i, void *userdata) {
-       int ret;
-       mm_ipc_msg_t respmsg = {0,};
-       server_struct *ss = (server_struct *)userdata;
-       if (ss == NULL) {
-               debug_error ("Input userdata is NULL\n");
+       if (is_last || i == NULL || pinfo == NULL) {
+               if (is_last < 0) {
+                       debug_error("Failed to get sink information: %s\n", pa_strerror(pa_context_errno(c)));
+               }
                return;
        }
 
-    if (!i) {
-       debug_error("Error to MM_SOUND_MSG_REQ_GET_AUDIO_ROUTE.\n");
-               SOUND_MSG_SET(respmsg.sound_msg, MM_SOUND_MSG_RES_ERROR, -1, 0, ss->msg->sound_msg.msgid);
-    } else {
-               debug_msg ("We got default sink = [%s]\n", i->default_sink_name);
-               SOUND_MSG_SET(respmsg.sound_msg, MM_SOUND_MSG_RES_GET_AUDIO_ROUTE, ss->msg->sound_msg.handle, 0, ss->msg->sound_msg.msgid);
-               if (strstr (i->default_sink_name, "alsa"))
-                       respmsg.sound_msg.code = 0;
-               else if (strstr (i->default_sink_name, "bluez"))
-                       respmsg.sound_msg.code = 1;
-               else
-                       respmsg.sound_msg.code = 2;
-    }
+       if (i->name && i->proplist) {
+               const char *api_string = pa_proplist_gets (i->proplist, "device.api");
+               if (api_string) {
+                       debug_log ("sink name = [%s], api = [%s]\n", i->name, api_string);
+                       if (strcmp (api_string, pinfo->sink_to_find) == 0) {
+                               debug_log ("FOUND!!! set default sink to [%s]\n", i->name);
+                               pa_operation_unref(pa_context_set_default_sink(pinfo->context, i->name, NULL, NULL));
 
-       if (ss->func) {
-               ret = ss->func (&respmsg);
-               if (ret != MM_ERROR_NONE) {
-                       debug_error ("Fail to send message [%x]\n", ret);
-               } else {
-                       debug_msg("Sent msg to client msgid [%d] [codechandle %d][message type %d] (code 0x%08X)\n",
-                                       ss->msg->sound_msg.msgid, respmsg.sound_msg.handle, respmsg.sound_msg.msgtype, respmsg.sound_msg.code);
+                       } else {
+                               debug_warning ("No string [%s] match!!!!\n", pinfo->sink_to_find);
+                       }
                }
-       } else {
-               debug_error ("No send function\n");
        }
+}
 
-       debug_msg("Ready to next msg\n");
-       if (ss->msg) {
-               debug_msg ("free [%p]\n", ss->msg);
-               free (ss->msg);
-               ss->msg = NULL;
-       }
 
-       if (ss) {
-               free (ss);
-               ss = NULL;
-       }
-       pthread_mutex_unlock(&g_mutex);
+static void pulse_set_default_sink (pulse_info_t * pinfo, char *default_sink_name)
+{
+       strcpy (pinfo->sink_to_find, default_sink_name);
+       pa_operation_unref(pa_context_get_sink_info_list(pinfo->context, sink_info_cb, pinfo));
 }
 
-void get_sink_info_callback(pa_context *c, const pa_sink_info *i, int is_last, void *userdata)
+static int pulse_deinit (pulse_info_t * pinfo)
 {
-       int ret;
-       mm_ipc_msg_t respmsg = {0,};
-       sink_struct *ss = (sink_struct *)userdata;
-       if (ss == NULL) {
-               debug_error ("Input userdata is NULL\n");
-               return;
-       }
+       pa_threaded_mainloop_lock (pinfo->m);
+       if (pinfo->context) {
+               pa_context_disconnect (pinfo->context);
 
-   if (is_last) {
-               if (is_last < 0) { /* ERROR */ 
-                       /* Compose Error Response */
-                       debug_error("Failed to get sink information: %s\n", pa_strerror(pa_context_errno(c)));
-                       debug_error("Error to MM_SOUND_MSG_REQ_SET_AUDIO_ROUTE.\n");
-                       SOUND_MSG_SET(respmsg.sound_msg, MM_SOUND_MSG_RES_ERROR, -1, 0, ss->msg->sound_msg.msgid);
-               } else { /* FINISHED WELL */
-                       /* Compose Response */
-                       SOUND_MSG_SET(respmsg.sound_msg, MM_SOUND_MSG_RES_SET_AUDIO_ROUTE, ss->msg->sound_msg.handle, ss->route_to, ss->msg->sound_msg.msgid);
-
-                       /* Do further action related with route request */
-                       /* ToDo : is this sync operation??? */
-                       if (ss->route_to == 0 && ss->is_speaker_on ) {
-                               /* route to speaker and speaker is on */
-                               debug_msg ("Trying to set default sink to [%s] \n", ss->speaker_name);
-                               pa_operation_unref(pa_context_set_default_sink(g_context, ss->speaker_name, NULL, NULL));
-                       } else if (ss->route_to == 1 && ss->is_bt_on) {
-                               /* route to bt and bt is on */
-                               debug_msg ("Trying to set default sink to [%s] \n", ss->bt_name);
-                               pa_operation_unref(pa_context_set_default_sink(g_context, ss->bt_name, NULL, NULL));
-                       } else {
-                               /* Nothing to do.... */
-                               debug_warning ("No match for [%d] \n", ss->route_to);
-                               respmsg.sound_msg.code = -1; // this means no exists
-                       }
-               }
-               
-               if (ss) { 
-                       /* Send Response */
-                       if (ss->func) {
-                               ret = ss->func (&respmsg);
-                               if (ret != MM_ERROR_NONE) {
-                                       debug_error ("Fail to send message \n");
-                               }
-                               debug_msg("Sent msg to client msgid [%d] [codechandle %d][message type %d] (code 0x%08X)\n",
-                                                               ss->msg->sound_msg.msgid, respmsg.sound_msg.handle, respmsg.sound_msg.msgtype, respmsg.sound_msg.code);
-                       } else {
-                               debug_error ("No send function\n");
-                       }
-
-                       /* Cleanup */
-                       if (ss->msg)    {
-                               debug_msg ("free [%p]\n", ss->msg);
-                               free (ss->msg);
-                               ss->msg = NULL;
-                       }
-                       free (ss);
-                       ss = NULL;
-               }
-               debug_msg("Ready to next msg\n");
-               pthread_mutex_unlock(&g_mutex);
-                  
-          return;
-   }
-
-   //pa_assert(i);
-
-   if (i->name) {
-               debug_msg("sink name = [%s]\n", i->name);        
-   
-               if (strstr (i->name, "alsa_")) {
-                       ss->is_speaker_on = 1;
-                       strncpy (ss->speaker_name, i->name, sizeof(ss->speaker_name)-1);
-               } else if (strstr (i->name, "bluez")) {
-                       ss->is_bt_on = 1;
-                       strncpy (ss->bt_name, i->name, sizeof(ss->bt_name)-1);
-               } else
-                       debug_warning("Unknown sink name!!!\n");
-   }
-                  
-}
+               /* Make sure we don't get any further callbacks */
+               pa_context_set_state_callback (pinfo->context, NULL, NULL);
 
-void check_bt_sink_info_callback(pa_context *c, const pa_sink_info *i, int is_last, void *userdata)
-{
-       int ret;
-       mm_ipc_msg_t respmsg = {0,};
-       bt_struct *bs = (bt_struct *)userdata;
-       if (bs == NULL) {
-               debug_error ("Input userdata is NULL\n");
-               return;
+               pa_context_unref (pinfo->context);
+               pinfo->context = NULL;
        }
+       pa_threaded_mainloop_unlock (pinfo->m);
 
-       if (is_last) {
-               if (is_last < 0) { /* ERROR */
-                       /* Compose Error Response */
-                       debug_error("Failed to get sink information: %s\n", pa_strerror(pa_context_errno(c)));     
-                       debug_error("Error to MM_SOUND_MSG_RES_IS_BT_A2DP_ON.\n");
-                       SOUND_MSG_SET(respmsg.sound_msg, MM_SOUND_MSG_RES_ERROR, -1, 0, bs->msg->sound_msg.msgid);
-               } else { /* FINISHED WELL */
-                       /* Compose Response */
-                       SOUND_MSG_SET(respmsg.sound_msg, 
-                                                       MM_SOUND_MSG_RES_IS_BT_A2DP_ON, bs->msg->sound_msg.handle, (bs->bt_found)? 1:0, bs->msg->sound_msg.msgid);
-                       strncpy (respmsg.sound_msg.filename, bs->bt_name, sizeof (respmsg.sound_msg.filename)-1);
-               }                          
-
-               /* Send resone & clean up */
-               if (bs) {
-                       /* Send Response */
-                       if (bs->func) {
-                               ret = bs->func (&respmsg);
-                               if (ret != MM_ERROR_NONE) {
-                                       debug_error ("Fail to send message \n");
-                               } else {
-                                       debug_msg("Sent msg to client msgid [%d] [codechandle %d][message type %d] (code 0x%08X)\n",
-                                                       bs->msg->sound_msg.msgid, respmsg.sound_msg.handle, respmsg.sound_msg.msgtype, respmsg.sound_msg.code);
-                               }
-                       } else {
-                               debug_error ("No sendfunc!!!!\n");
-                       }
+       pa_threaded_mainloop_stop (pinfo->m);
+       pa_threaded_mainloop_free (pinfo->m);
 
-                       /* clean up */
-                       if (bs->msg) {
-                               debug_msg ("free [%p]\n", bs->msg);
-                               free (bs->msg);
-                               bs->msg = NULL;
-                       }
-                       free (bs);
-                       bs = NULL;
-               }
+       debug_msg ("<<<<<<<<<< [%s][%d]\n", __func__, __LINE__);
 
-               debug_msg("Ready to next msg\n");
-               pthread_mutex_unlock(&g_mutex);
-               return;
-       }
+       return 0;
 
-   //pa_assert(i);
-
-       if (i->name) {
-               debug_msg("sink name = [%s]\n", i->name);        
-   
-               if (strstr (i->name, "bluez")) {
-                       char* desc = pa_proplist_gets(i->proplist, PA_PROP_DEVICE_DESCRIPTION);
-                       if (desc && strlen(desc)>0) {
-                               debug_msg ("sink device description = [%s]\n", desc);
-                               bs->bt_found = 1;
-                               strncpy (bs->bt_name, desc, strlen(desc));      
-                       } else {
-                               debug_warning ("No Description!!!!\n");                         
-                       }                       
-               }                               
-       }
-                  
 }
 
-int MMSoundMgrPulseHandleGetAudioRouteReq (mm_ipc_msg_t *msg, int (*sendfunc)(mm_ipc_msg_t*))
-{
-       debug_enter("msg = %p , sendfunc = %p\n", msg, sendfunc);
+/* -------------------------------- MONO AUDIO --------------------------------------------*/
+#ifdef SUPPORT_MONO_AUDIO
+#define MONO_KEY VCONFKEY_SETAPPL_ACCESSIBILITY_MONO_AUDIO
 
-       pthread_mutex_lock(&g_mutex);
+static void success_cb (pa_context *c, int success, void *userdata)
+{
+       debug_msg ("success = %d\n", success);
+}
 
-       server_struct *ss = malloc (sizeof (server_struct));
-       memset (ss, 0, sizeof (server_struct));
+static void mono_changed_cb(keynode_t* node, void* data)
+{
+       int key_value;
+       pulse_info_t* pinfo = (pulse_info_t*)data;
 
-       /* common setting */
-       ss->msg = msg;
-       ss->func = sendfunc;
+       debug_msg ("%s changed callback called\n",vconf_keynode_get_name(node));
 
-       /* Do async pulse operation */
-       pa_operation_unref(pa_context_get_server_info(g_context, get_server_info_callback, ss));
+       vconf_get_bool(MONO_KEY, &key_value);
+       debug_msg ("key value = %d\n", key_value);
 
-       debug_leave("\n");
+       pa_operation_unref (pa_ext_policy_set_mono (pinfo->context, key_value, success_cb, NULL));
 }
 
-int MMSoundMgrPulseHandleSetAudioRouteReq (mm_ipc_msg_t *msg, int (*sendfunc)(mm_ipc_msg_t*))
+int MMSoundMgrPulseHandleRegisterMonoAudio (void* pinfo)
 {
-       debug_enter("\n");
+       int ret = vconf_notify_key_changed(MONO_KEY, mono_changed_cb, pinfo);
+       debug_msg ("vconf [%s] set ret = %d\n", MONO_KEY, ret);
+       return ret;
+}
+#endif /* SUPPORT_MONO_AUDIO */
 
-       pthread_mutex_lock(&g_mutex);
 
-       sink_struct *ss = malloc (sizeof (sink_struct));
-       memset (ss, 0, sizeof(sink_struct));
+/* -------------------------------- BT SCO --------------------------------------------*/
+#ifdef SUPPORT_BT_SCO_DETECT
 
-       /* common setting */
-       ss->msg = msg;
-       ss->func = sendfunc;
+static void bt_changed_cb(keynode_t* node, void* data)
+{
+       int bt_status = VCONFKEY_BT_DEVICE_NONE;
+       int available = 0;
+       pulse_info_t* pinfo = (pulse_info_t*)data;
 
-       /* specific setting */
-       ss->is_speaker_on = ss->is_bt_on = 0;
-       ss->route_to =  msg->sound_msg.handle;
+       debug_msg ("[%s] changed callback called\n", vconf_keynode_get_name(node));
 
-       /* Do async pulse operation */
-       pa_operation_unref(pa_context_get_sink_info_list(g_context, get_sink_info_callback, ss));
+       /* Get actual vconf value */
+       vconf_get_int(VCONFKEY_BT_DEVICE, &bt_status);
+       debug_msg ("key value = 0x%x\n", bt_status);
 
-       debug_leave("\n");
+       /* Set device available based on vconf key value */
+       available = (bt_status & VCONFKEY_BT_DEVICE_HEADSET_CONNECTED)? AVAILABLE : NOT_AVAILABLE;
+       MMSoundMgrSessionSetDeviceAvailable (DEVICE_BT_SCO, available, 0, NULL);
+}
+
+int MMSoundMgrPulseHandleRegisterBluetoothStatus (void* pinfo)
+{
+       /* set callback for vconf key change */
+       int ret = vconf_notify_key_changed(VCONFKEY_BT_DEVICE , bt_changed_cb, pinfo);
+       debug_msg ("vconf [%s] set ret = %d\n", VCONFKEY_BT_DEVICE, ret);
+       return ret;
 }
+#endif /* SUPPORT_BT_SCO_DETECT */
+
+/* -------------------------------- MGR MAIN --------------------------------------------*/
 
 int MMSoundMgrPulseHandleIsBtA2DPOnReq (mm_ipc_msg_t *msg, int (*sendfunc)(mm_ipc_msg_t*))
 {
+       int ret = 0;
+       mm_ipc_msg_t respmsg = {0,};
+       char* bt_name;
+       bool is_bt_on = false;
+       pthread_mutex_lock(&g_mutex);
+
        debug_enter("msg = %p, sendfunc = %p\n", msg, sendfunc);
 
-       pthread_mutex_lock(&g_mutex);
+       bt_name = MMSoundMgrSessionGetBtA2DPName();
+       if (bt_name && strlen(bt_name) > 0) {
+               is_bt_on = true;
+       }
 
-       bt_struct *bs = malloc (sizeof(bt_struct));
-       memset (bs, 0, sizeof (bt_struct));
+       debug_log ("is_bt_on = [%d], name = [%s]\n", is_bt_on, bt_name);
 
-       /* common setting */
-       bs->msg = msg;
-       bs->func = sendfunc;
+       SOUND_MSG_SET(respmsg.sound_msg,
+                               MM_SOUND_MSG_RES_IS_BT_A2DP_ON, msg->sound_msg.handle, is_bt_on, msg->sound_msg.msgid);
+       strncpy (respmsg.sound_msg.filename, bt_name,  sizeof (respmsg.sound_msg.filename)-1);
 
-       /* specific setting */
-       bs->bt_found = 0;
+       /* Send Response */
+       ret = sendfunc (&respmsg);
+       if (ret != MM_ERROR_NONE) {
+               /* TODO : Error Handling */
+               debug_error ("sendfunc failed....ret = [%x]\n", ret);
+       }
 
-       /* Do async pulse operation */
-       pa_operation_unref(pa_context_get_sink_info_list(g_context, check_bt_sink_info_callback, bs));
+       pthread_mutex_unlock(&g_mutex);
 
        debug_leave("\n");
-}
 
-#ifdef SUPPORT_MONO_AUDIO
-#define MONO_KEY "db/setting/accessibility/mono_audio"
+       return ret;
+}
 
-void success_cb (pa_context *c, int success, void *userdata)
+void MMSoundMgrPulseSetDefaultSink (char* default_sink_name)
 {
-       debug_msg ("success = %d\n", success);
+       debug_enter("\n");
+
+       pulse_set_default_sink(pulse_info, default_sink_name);
+
+       debug_leave("\n");
 }
 
-void mono_changed_cb(keynode_t* node, void* data)
+void MMSoundMgrPulseGetInitialBTStatus (bool *a2dp, bool *sco)
 {
-       debug_msg ("%s changed callback called\n",vconf_keynode_get_name(node));
+       int bt_status = VCONFKEY_BT_DEVICE_NONE;
 
-       int key_value;
-       vconf_get_bool(MONO_KEY, &key_value);
+       if (a2dp == NULL || sco == NULL) {
+               debug_error ("Invalide arguments!!!\n");
+               return;
+       }
 
-       debug_msg ("key value = %d\n", key_value);
+       /* Get saved bt status */
+       *a2dp = pulse_info->init_bt_status;
 
-       pa_operation_unref (pa_ext_policy_set_mono (g_context, key_value, success_cb, NULL));
-}
+       /* Get actual vconf value */
+       vconf_get_int(VCONFKEY_BT_DEVICE, &bt_status);
+       debug_msg ("key value = 0x%x\n", bt_status);
+       *sco = (bt_status & VCONFKEY_BT_DEVICE_HEADSET_CONNECTED)? true : false;
 
-int MMSoundMgrPulseHandleRegisterMonoAudio ()
-{
-       int ret = vconf_notify_key_changed(MONO_KEY, mono_changed_cb, NULL);
-       debug_enter ("vconf set ret = %d\n", ret);
-       return ret;
+       debug_msg ("returning a2dp=[%d], sco=[%d]\n", *a2dp, *sco);
 }
 
-#endif
-
-int MMSoundMgrPulseInit(void)
+void* MMSoundMgrPulseInit(void)
 {
+       pulse_info = (pulse_info_t*) malloc (sizeof(pulse_info_t));
+       memset (pulse_info, 0, sizeof(pulse_info_t));
+
        debug_enter("\n");
 
-       pulse_init();
+       pulse_init(pulse_info);
 
 #ifdef SUPPORT_MONO_AUDIO
-       MMSoundMgrPulseHandleRegisterMonoAudio();
+       MMSoundMgrPulseHandleRegisterMonoAudio(pulse_info);
 #endif
 
-#ifdef BT_DISCONNECT_PAUSE
-       /* This registeration can be failed when hibernation capture, because of security server */
-       _asm_register_for_bt ();
-
+#ifdef SUPPORT_BT_SCO_DETECT
+       MMSoundMgrPulseHandleRegisterBluetoothStatus(pulse_info);
 #endif
+
        debug_leave("\n");
-       return MM_ERROR_NONE;
+       return pulse_info;
 }
 
-int MMSoundMgrPulseFini(void)
+int MMSoundMgrPulseFini(void* handle)
 {
        debug_enter("\n");
 
-       pulse_deinit();
-
-#ifdef BT_DISCONNECT_PAUSE
-       {
-               int asm_error = 0;
-               if(!ASM_unregister_sound(g_asm_handle, ASM_EVENT_EARJACK_UNPLUG, &asm_error))
-               {
-                       debug_error("earjack event unregister failed with 0x%x\n", asm_error);
-               }
-       }
-#endif
+       pulse_deinit((pulse_info_t *)handle);
 
        debug_leave("\n");
        return MM_ERROR_NONE;
diff --git a/server/mm_sound_mgr_session.c b/server/mm_sound_mgr_session.c
new file mode 100644 (file)
index 0000000..bdcfa07
--- /dev/null
@@ -0,0 +1,1219 @@
+/*
+ * libmm-sound
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Seungbae Shin <seungbae.shin@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 <stdlib.h>
+#include <string.h>
+
+#include <pthread.h>
+#include <sys/shm.h>
+#include <sys/msg.h>
+#include <sys/mman.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <stdbool.h>
+
+#include <errno.h>
+
+#include "include/mm_sound_mgr_common.h"
+#include "../include/mm_sound_common.h"
+
+#include <mm_error.h>
+#include <mm_debug.h>
+
+#include <audio-session-manager.h>
+#include <avsys-audio.h>
+
+#include "include/mm_sound_mgr_session.h"
+#include "include/mm_sound_mgr_asm.h"
+
+#include <vconf.h>
+#include <vconf-keys.h>
+
+#define EARJACK_WITH_MIC       2
+
+#define MAX_STRING_LEN 64
+
+#define DEFAULT_SINK_BT                "bluez"
+#define DEFAULT_SINK_ALSA      "alsa"
+
+#define        MM_SOUND_DEVICE_OUT_ANY 0x0000FF00
+#define MM_SOUND_DEVICE_IN_ANY  0x000000FF
+
+#define        MM_SOUND_DEVICE_OUT_FILTER 0x000000FF
+#define MM_SOUND_DEVICE_IN_FILTER       0x0000FF00
+
+pthread_mutex_t g_mutex_session = PTHREAD_MUTEX_INITIALIZER;
+
+#define LOCK_SESSION()  do { debug_log("(*)LOCKING\n"); /*pthread_mutex_lock(&g_mutex_session);*/ debug_log("(+)LOCKED\n"); }while(0)
+#define UNLOCK_SESSION()  do {  /* pthread_mutex_unlock(&g_mutex_session);*/ debug_log("(-)UNLOCKED\n"); }while(0)
+
+#define RESET_ACTIVE(x)    (g_info.device_active &= x)
+#define RESET_AVAILABLE(x)    (g_info.device_available &= x)
+
+#define SET_ACTIVE(x)    (g_info.device_active |= x)
+#define SET_AVAILABLE(x)    (g_info.device_available |= x)
+
+#define SET_PLAYBACK_ONLY_ACTIVE(x)  do { RESET_ACTIVE(MM_SOUND_DEVICE_OUT_FILTER); SET_ACTIVE(x); }while(0)
+#define SET_CAPTURE_ONLY_ACTIVE(x)  do {  RESET_ACTIVE(MM_SOUND_DEVICE_IN_FILTER); SET_ACTIVE(x); }while(0)
+
+
+#define UNSET_ACTIVE(x)    (g_info.device_active &= (~x))
+#define UNSET_AVAILABLE(x)    (g_info.device_available &= (~x))
+
+#define TOGGLE_ACTIVE(x)    (g_info.device_active ^= x)
+#define TOGGLE_AVAILABLE(x)    (g_info.device_available ^= x)
+
+#define IS_ACTIVE(x)    (g_info.device_active & x)
+#define IS_AVAILABLE(x)    (g_info.device_available & x)
+
+#define GET_AVAILABLE_PLAYBACK()       IS_AVAILABLE(MM_SOUND_DEVICE_OUT_ANY)
+#define GET_AVAILABLE_CAPTURE()        IS_AVAILABLE(MM_SOUND_DEVICE_IN_ANY)
+
+#define GET_ACTIVE_PLAYBACK()  IS_ACTIVE(MM_SOUND_DEVICE_OUT_ANY)
+#define GET_ACTIVE_CAPTURE()   IS_ACTIVE(MM_SOUND_DEVICE_IN_ANY)
+
+#define IS_COMMUNICATION_SESSION() ((g_info.session == SESSION_VOICECALL) || (g_info.session == SESSION_VOIP))
+#define IS_NOTIFICATION_SESSION() (g_info.session == SESSION_NOTIFICATION)
+
+static int __set_sound_path_for_current_active ();
+static int __set_sound_path_to_dual ();
+
+#define ENABLE_CALLBACK
+#ifndef ENABLE_CALLBACK
+#define _mm_sound_mgr_device_available_device_callback(a,b,c)  MM_ERROR_NONE
+#define _mm_sound_mgr_device_active_device_callback(a,b)       MM_ERROR_NONE
+#endif
+
+
+typedef struct _session_info_struct
+{
+       int asm_handle;
+       int device_available;
+       int device_active;
+       int headset_type;
+
+       session_t session;
+       subsession_t subsession;
+
+       char bt_name[MAX_STRING_LEN];
+       char default_sink_name[MAX_STRING_LEN];
+
+
+} SESSION_INFO_STRUCT;
+
+
+SESSION_INFO_STRUCT g_info;
+
+#define PLAYBACK_NUM   5
+#define CAPTURE_NUM    3
+
+typedef enum
+{
+       NO_NOTI = 0,
+       DO_NOTI
+} noti_t;
+
+
+static void dump_info ()
+{
+       int i = 0;
+
+       char *playback_device_str[] = { "SPEAKER ", "RECEIVER ", "HEADSET ", "BTSCO ", "BTA2DP " };
+       char *capture_device_str[] = { "MAINMIC ", "HEADSET ", "BTMIC "  };
+
+       static char tmp_str[128];
+       static char tmp_str2[128];
+
+       debug_log ("<----------------------------------------------------->\n");
+
+
+       strcpy (tmp_str, "PLAYBACK = [ ");
+       for (i=0; i<PLAYBACK_NUM; i++) {
+               if (((g_info.device_available & MM_SOUND_DEVICE_OUT_ANY) >> 8) & (0x01 << i)) {
+                       strcat (tmp_str, playback_device_str[i]);
+               }
+       }
+       strcat (tmp_str, "]");
+
+       strcpy (tmp_str2, "CAPTURE = [ ");
+               for (i=0; i<CAPTURE_NUM; i++) {
+                       if ((g_info.device_available & MM_SOUND_DEVICE_IN_ANY) & (0x01 << i)) {
+                               strcat (tmp_str2, capture_device_str[i]);
+                       }
+       }
+       strcat (tmp_str2, "]");
+       debug_log ("*** Available = [0x%08x], %s %s", g_info.device_available, tmp_str, tmp_str2);
+
+       strcpy (tmp_str, "PLAYBACK = [ ");
+       for (i=0; i<PLAYBACK_NUM; i++) {
+               if (((g_info.device_active & MM_SOUND_DEVICE_OUT_ANY) >> 8) & (0x01 << i)) {
+                       strcat (tmp_str, playback_device_str[i]);
+               }
+       }
+       strcat (tmp_str, "]");
+
+       strcpy (tmp_str2, "CAPTURE = [ ");
+               for (i=0; i<CAPTURE_NUM; i++) {
+                       if ((g_info.device_active & MM_SOUND_DEVICE_IN_ANY) & (0x01 << i)) {
+                               strcat (tmp_str2, capture_device_str[i]);
+                       }
+       }
+       strcat (tmp_str2, "]");
+       debug_log ("***    Active = [0x%08x], %s %s", g_info.device_active, tmp_str, tmp_str2);
+
+
+       debug_log ("*** Headset type = [%d], BT = [%s], default sink = [%s]\n", g_info.headset_type, g_info.bt_name, g_info.default_sink_name);
+       debug_log ("*** Session = [%d], SubSession = [%d]\n", g_info.session, g_info.subsession);
+       debug_log ("<----------------------------------------------------->\n");
+}
+
+/* ------------------------- ASM ------------------------------------*/
+static pthread_mutex_t _asm_mutex = PTHREAD_MUTEX_INITIALIZER;
+
+static bool _asm_register_for_headset (int * handle)
+{
+       int asm_error = 0;
+
+       if (handle == NULL) {
+               debug_error ("Handle is not valid!!!\n");
+               return false;
+       }
+
+       if(!ASM_register_sound_ex (-1, handle, ASM_EVENT_EARJACK_UNPLUG, ASM_STATE_NONE, NULL, NULL, ASM_RESOURCE_NONE, &asm_error, __asm_process_message)) {
+                       debug_warning("earjack event register failed with 0x%x\n", asm_error);
+                       return false;
+       }
+
+       return true;
+}
+
+static void _asm_pause_process(int handle)
+{
+       int asm_error = 0;
+
+       MMSOUND_ENTER_CRITICAL_SECTION( &_asm_mutex )
+
+       /* If no asm handle register here */
+       if (g_info.asm_handle ==  -1) {
+               debug_msg ("ASM handle is not valid, try to register once more\n");
+
+               /* This register should be success */
+               if (_asm_register_for_headset (&g_info.asm_handle)) {
+                       debug_msg("_asm_register_for_headset() success\n");
+               } else {
+                       debug_error("_asm_register_for_headset() failed\n");
+               }
+       }
+
+       //do pause
+       debug_warning("Send earphone unplug event to Audio Session Manager Server for BT headset\n");
+
+       if(!ASM_set_sound_state_ex(handle, ASM_EVENT_EARJACK_UNPLUG, ASM_STATE_PLAYING, ASM_RESOURCE_NONE, &asm_error, __asm_process_message)) {
+               debug_error("earjack event set sound state to playing failed with 0x%x\n", asm_error);
+       }
+
+       if(!ASM_set_sound_state_ex(handle, ASM_EVENT_EARJACK_UNPLUG, ASM_STATE_STOP, ASM_RESOURCE_NONE, &asm_error, __asm_process_message)) {
+               debug_error("earjack event set sound state to stop failed with 0x%x\n", asm_error);
+       }
+
+       MMSOUND_LEAVE_CRITICAL_SECTION( &_asm_mutex )
+}
+
+static bool _asm_unregister_for_headset (int *handle)
+{
+       int asm_error = 0;
+
+       if (handle == NULL) {
+               debug_error ("Handle is not valid!!!\n");
+               return false;
+       }
+
+       if(!ASM_unregister_sound_ex(handle, ASM_EVENT_EARJACK_UNPLUG, &asm_error, __asm_process_message)) {
+               debug_error("earjack event unregister failed with 0x%x\n", asm_error);
+               return false;
+       }
+
+       return true;
+}
+
+/* ------------------------- INTERNAL FUNCTIONS ------------------------------------*/
+
+static void __update_volume_value(volume_type_t volume_type)
+{
+       int ret = 0;
+       int volume_value = 0;
+
+       ret = mm_sound_volume_get_value(volume_type, &volume_value);
+       if (ret == MM_ERROR_NONE) {
+               ret = mm_sound_volume_set_value(volume_type, volume_value);
+               if (ret != MM_ERROR_NONE) {
+                       debug_error("mm_sound_volume_get_value failed....ret = [%x]\n", ret);
+               }
+       } else {
+               debug_error("mm_sound_volume_get_value failed....ret = [%x]\n", ret);
+       }
+}
+
+static void _set_path_with_notification(noti_t noti)
+{
+       int ret = MM_ERROR_NONE;
+
+       debug_msg ("[%s] noti=%d\n", __func__,noti);
+
+       /* Set path based on current active device */
+       ret = __set_sound_path_for_current_active();
+       if (ret != MM_ERROR_NONE) {
+               debug_error ("__set_sound_path_for_current_active() failed [%x]\n", ret);
+               return;
+       }
+
+       if (noti == DO_NOTI) {
+               /* Notify current active device */
+               ret = _mm_sound_mgr_device_active_device_callback(GET_ACTIVE_CAPTURE(), GET_ACTIVE_PLAYBACK());
+               if (ret != MM_ERROR_NONE) {
+                       debug_error ("_mm_sound_mgr_device_active_device_callback() failed [%x]\n", ret);
+               }
+       }
+}
+
+static int __set_playback_route_communication (session_state_t state)
+{
+       int ret = MM_ERROR_NONE;
+       int gain;
+
+       debug_fenter();
+
+       if (state == SESSION_START) {
+               SET_AVAILABLE(MM_SOUND_DEVICE_OUT_RECEIVER);
+               debug_log ("voicecall session started...only receiver available set on...");
+
+               ret = _mm_sound_mgr_device_available_device_callback(MM_SOUND_DEVICE_IN_NONE, MM_SOUND_DEVICE_OUT_RECEIVER, 1);
+               if (ret != MM_ERROR_NONE) {
+                       debug_error ("_mm_sound_mgr_device_available_device_callback() failed [%x]\n", ret);
+                       goto ROUTE_COMM_EXIT;
+               }
+
+               /* (speaker = receiver, headset = headset, bt a2dp = bt sco) */
+               /* OUT */
+               if (IS_ACTIVE(MM_SOUND_DEVICE_OUT_SPEAKER)) {
+                       debug_log ("active out was SPEAKER => activate receiver!!\n");
+                       SET_PLAYBACK_ONLY_ACTIVE(MM_SOUND_DEVICE_OUT_RECEIVER);
+
+               } else if (IS_ACTIVE(MM_SOUND_DEVICE_OUT_BT_A2DP)) {
+                       debug_log ("active out was BT A2DP => activate BT SCO!!\n");
+                       SET_PLAYBACK_ONLY_ACTIVE(MM_SOUND_DEVICE_OUT_BT_SCO);
+                       SET_CAPTURE_ONLY_ACTIVE(MM_SOUND_DEVICE_IN_BT_SCO);
+               }
+               /* FIXME : Do we have to set IN device ??? */
+
+               _set_path_with_notification(DO_NOTI);
+
+               dump_info();
+
+       } else { /* SESSION_END */
+               UNSET_AVAILABLE(MM_SOUND_DEVICE_OUT_RECEIVER);
+
+               ret = _mm_sound_mgr_device_available_device_callback(MM_SOUND_DEVICE_IN_NONE, MM_SOUND_DEVICE_OUT_RECEIVER, 0);
+               if (ret != MM_ERROR_NONE) {
+                       debug_error ("_mm_sound_mgr_device_available_device_callback() failed [%x]\n", ret);
+                       goto ROUTE_COMM_EXIT;
+               }
+
+               // RESET
+               if (g_info.session == SESSION_VOICECALL)
+                       gain = AVSYS_AUDIO_GAIN_EX_VOICECALL;
+               else if (g_info.session == SESSION_VOIP)
+                       gain = AVSYS_AUDIO_GAIN_EX_VIDEOCALL;
+               else {
+                       debug_warning ("Not valid session info....\n");
+                       gain = AVSYS_AUDIO_GAIN_EX_VOICECALL;
+               }
+
+
+               if (AVSYS_FAIL(avsys_audio_set_path_ex( gain,
+                               AVSYS_AUDIO_PATH_EX_NONE, AVSYS_AUDIO_PATH_EX_NONE,
+                               AVSYS_AUDIO_PATH_OPTION_NONE ))) {
+                       debug_error ("avsys_audio_set_path_ex() failed [%x]\n", ret);
+                       ret = MM_ERROR_SOUND_INTERNAL;
+                       goto ROUTE_COMM_EXIT;
+               }
+
+               /* (speaker = receiver, headset = headset, bt a2dp = bt sco) */
+               /* OUT */
+               if (IS_ACTIVE(MM_SOUND_DEVICE_OUT_RECEIVER)) {
+                       debug_log ("active out was RECEIVER => activate SPEAKER!!\n");
+                       SET_PLAYBACK_ONLY_ACTIVE(MM_SOUND_DEVICE_OUT_SPEAKER);
+               } else if (IS_ACTIVE(MM_SOUND_DEVICE_OUT_BT_SCO)) {
+                       debug_log ("active out was BT SCO => activate BT A2DP!!\n");
+                       SET_PLAYBACK_ONLY_ACTIVE(MM_SOUND_DEVICE_OUT_BT_A2DP);
+                       if (IS_AVAILABLE(MM_SOUND_DEVICE_IN_WIRED_ACCESSORY)) {
+                               SET_CAPTURE_ONLY_ACTIVE(MM_SOUND_DEVICE_IN_WIRED_ACCESSORY);
+                       } else {
+                               SET_CAPTURE_ONLY_ACTIVE(MM_SOUND_DEVICE_IN_MIC);
+                       }
+               } else if (IS_ACTIVE(MM_SOUND_DEVICE_OUT_SPEAKER) || IS_ACTIVE(MM_SOUND_DEVICE_OUT_WIRED_ACCESSORY)) {
+                       debug_log ("Keep current active device\n");
+               } else {
+                       debug_error ("Error!!! No active device when call exit!!! Set default one\n");
+                       /* FIXME : This should be based on priority???? */
+                       SET_PLAYBACK_ONLY_ACTIVE(MM_SOUND_DEVICE_OUT_SPEAKER);
+                       SET_CAPTURE_ONLY_ACTIVE(MM_SOUND_DEVICE_IN_MIC);
+               }
+
+               debug_log ("voicecall session stopped...set path based on current active device");
+               _set_path_with_notification(DO_NOTI);
+
+               dump_info();
+       }
+
+ROUTE_COMM_EXIT:
+
+       debug_fleave();
+
+       return ret;
+}
+
+static int __set_playback_route_fmradio (session_state_t state)
+{
+       int ret = MM_ERROR_NONE;
+       int out;
+
+       debug_fenter();
+
+       if (state == SESSION_START) {
+
+               if (IS_ACTIVE(MM_SOUND_DEVICE_OUT_SPEAKER))
+                       out = AVSYS_AUDIO_PATH_EX_SPK;
+               else if (IS_ACTIVE(MM_SOUND_DEVICE_OUT_WIRED_ACCESSORY))
+                       out = AVSYS_AUDIO_PATH_EX_HEADSET;
+               else if (IS_ACTIVE(MM_SOUND_DEVICE_OUT_BT_A2DP))
+                       out = AVSYS_AUDIO_PATH_EX_A2DP;
+
+               /* PATH SET */
+               if (AVSYS_FAIL(avsys_audio_set_path_ex( AVSYS_AUDIO_GAIN_EX_FMRADIO,
+                                                                               out, AVSYS_AUDIO_PATH_EX_FMINPUT,
+                                                                               AVSYS_AUDIO_PATH_OPTION_NONE))) {
+                       debug_error ("avsys_audio_set_path_ex() failed\n");
+                       ret = MM_ERROR_SOUND_INTERNAL;
+                       goto ROUTE_FMRADIO_EXIT;
+               }
+
+
+       } else { /* SESSION_END */
+               /* PATH RELEASE */
+               if (AVSYS_FAIL(avsys_audio_set_path_ex( AVSYS_AUDIO_GAIN_EX_FMRADIO,
+                                                                               AVSYS_AUDIO_PATH_EX_NONE, AVSYS_AUDIO_PATH_EX_NONE,
+                                                                               AVSYS_AUDIO_PATH_OPTION_NONE ))) {
+                       debug_error ("avsys_audio_set_path_ex() failed\n");
+                       ret = MM_ERROR_SOUND_INTERNAL;
+                       goto ROUTE_FMRADIO_EXIT;
+               }
+
+               /* Set as current active status */
+               _set_path_with_notification (NO_NOTI);
+       }
+
+       if (AVSYS_FAIL(avsys_audio_set_ext_device_status(AVSYS_AUDIO_EXT_DEVICE_FMRADIO, state))) {
+               debug_error ("avsys_audio_set_ext_device_status() failed\n");
+               ret = MM_ERROR_SOUND_INTERNAL;
+       }
+
+ROUTE_FMRADIO_EXIT:
+
+       debug_fleave();
+
+       return ret;
+}
+
+static int __set_playback_route_notification (session_state_t state)
+{
+       int ret = MM_ERROR_NONE;
+
+       debug_fenter();
+
+       if (state == SESSION_START) {
+               ret = __set_sound_path_to_dual ();
+               if (ret != MM_ERROR_NONE) {
+                       debug_error ("__set_sound_path_to_dual() failed [%x]\n", ret);
+               }
+
+       } else { /* SESSION_END */
+               _set_path_with_notification (NO_NOTI);
+       }
+
+       debug_fleave();
+
+       return ret;
+}
+
+
+static int __set_sound_path_for_current_active ()
+{
+       int ret = MM_ERROR_NONE;
+       int option = AVSYS_AUDIO_PATH_OPTION_NONE;
+       int in, out, gain;
+       bool sound_play;
+
+       if (IS_NOTIFICATION_SESSION()) {
+               debug_log ("Current session is NOTI, pending path setting. path set will be done after NOTI ends")
+               return ret;
+       }
+
+       debug_fenter();
+
+       /* Pulseaudio route */
+       if (IS_ACTIVE(MM_SOUND_DEVICE_OUT_BT_A2DP)) {
+               debug_log ("BT A2DP is active, Set default sink to BLUEZ");
+               MMSoundMgrPulseSetDefaultSink (DEFAULT_SINK_BT);
+       } else {
+               debug_log ("BT A2DP is not active, Set default sink to ALSA");
+               MMSoundMgrPulseSetDefaultSink (DEFAULT_SINK_ALSA);
+       }
+
+       /* IN */
+       if (IS_ACTIVE(MM_SOUND_DEVICE_IN_MIC)) {
+               in = AVSYS_AUDIO_PATH_EX_MIC;
+       } else if (IS_ACTIVE(MM_SOUND_DEVICE_IN_WIRED_ACCESSORY)) {
+               in = AVSYS_AUDIO_PATH_EX_HEADSETMIC;
+       } else if (IS_ACTIVE(MM_SOUND_DEVICE_IN_BT_SCO)) {
+               in = AVSYS_AUDIO_PATH_EX_BTMIC;
+       }
+
+       /* OUT */
+       if (IS_ACTIVE(MM_SOUND_DEVICE_OUT_SPEAKER)) {
+               out = AVSYS_AUDIO_PATH_EX_SPK;
+       } else if (IS_ACTIVE(MM_SOUND_DEVICE_OUT_RECEIVER)) {
+               out = AVSYS_AUDIO_PATH_EX_RECV;
+       } else if (IS_ACTIVE(MM_SOUND_DEVICE_OUT_WIRED_ACCESSORY)) {
+               out = AVSYS_AUDIO_PATH_EX_HEADSET;
+       } else if (IS_ACTIVE(MM_SOUND_DEVICE_OUT_BT_SCO)) {
+               out = AVSYS_AUDIO_PATH_EX_BTHEADSET;
+       } else if (IS_ACTIVE(MM_SOUND_DEVICE_OUT_BT_A2DP)) {
+               out = AVSYS_AUDIO_PATH_EX_A2DP;
+       }
+
+       /* GAIN */
+       switch (g_info.session)
+       {
+       case SESSION_MEDIA:
+       case SESSION_NOTIFICATION:
+               gain = AVSYS_AUDIO_GAIN_EX_KEYTONE;
+               break;
+
+       case SESSION_VOICECALL:
+       case SESSION_VOIP:
+               if (g_info.subsession == SUBSESSION_RINGTONE) {
+                       gain = AVSYS_AUDIO_GAIN_EX_RINGTONE;
+                       in = AVSYS_AUDIO_PATH_EX_NONE;
+
+                       /* If sound is mute mode, force ringtone path to headset */
+                       vconf_get_bool(VCONFKEY_SETAPPL_SOUND_STATUS_BOOL, &sound_play);
+                       if (sound_play) {
+                               /* Normal Ringtone */
+                               out = AVSYS_AUDIO_PATH_EX_SPK;
+                               option = AVSYS_AUDIO_PATH_OPTION_DUAL_OUT;
+                       } else {
+                               /* Mute Ringtone */
+                               out = AVSYS_AUDIO_PATH_EX_HEADSET;
+                       }
+               } else if (g_info.subsession == SUBSESSION_MEDIA) {
+                       gain = AVSYS_AUDIO_GAIN_EX_CALLTONE;
+                       in = AVSYS_AUDIO_PATH_EX_NONE;
+               } else {
+                       gain = (g_info.session == SESSION_VOICECALL)?
+                                       AVSYS_AUDIO_GAIN_EX_VOICECALL : AVSYS_AUDIO_GAIN_EX_VIDEOCALL;
+               }
+               break;
+
+       case SESSION_FMRADIO:
+               gain = AVSYS_AUDIO_GAIN_EX_FMRADIO;
+               in = AVSYS_AUDIO_PATH_EX_FMINPUT;
+               break;
+       }
+
+       debug_log ("Trying to set avsys set path gain[%d], out[%d], in[%d], option[%d]\n", gain, out, in, option);
+
+       /* Set Path */
+       if(AVSYS_FAIL(avsys_audio_set_path_ex(gain, out, in, option))) {
+               debug_error ("avsys_audio_set_path_ex failed\n");
+               ret = MM_ERROR_SOUND_INTERNAL;
+       }
+
+       /* clean up */
+       debug_fleave();
+       return ret;
+}
+
+
+static int __set_sound_path_to_dual ()
+{
+       int ret = MM_ERROR_NONE;
+
+       debug_fenter();
+
+       /* Sound path for ALSA */
+       debug_log ("Set path to DUAL.\n");
+       if(AVSYS_FAIL(avsys_audio_set_path_ex(AVSYS_AUDIO_GAIN_EX_KEYTONE,
+                                               AVSYS_AUDIO_PATH_EX_SPK, AVSYS_AUDIO_PATH_EX_NONE,
+                                               AVSYS_AUDIO_PATH_OPTION_DUAL_OUT))) {
+               debug_error ("avsys_audio_set_path_ex failed\n");
+               ret = MM_ERROR_SOUND_INTERNAL;
+       }
+
+       /* clean up */
+       debug_fleave();
+       return ret;
+}
+
+
+
+
+static void _select_playback_active_device ()
+{
+       if (IS_ACTIVE(MM_SOUND_DEVICE_OUT_ANY)) {
+               debug_log ("Active device exists. Nothing needed...\n");
+               return;
+       }
+
+       debug_log ("No playback active device, set active based on priority!!\n");
+
+       /* set active device based on device priority (bt>ear>spk) */
+       if (IS_AVAILABLE(MM_SOUND_DEVICE_OUT_BT_A2DP)) {
+               debug_log ("BT A2DP available, set as active!!\n");
+               SET_ACTIVE(MM_SOUND_DEVICE_OUT_BT_A2DP);
+       } else if (IS_AVAILABLE(MM_SOUND_DEVICE_OUT_WIRED_ACCESSORY)) {
+               debug_log ("WIRED available, set as active!!\n");
+               SET_ACTIVE(MM_SOUND_DEVICE_OUT_WIRED_ACCESSORY);
+       } else {
+               debug_log ("SPEAKER available, set as active!!\n");
+               SET_ACTIVE(MM_SOUND_DEVICE_OUT_SPEAKER);
+       }
+}
+
+static void _select_capture_active_device ()
+{
+       if (IS_ACTIVE(MM_SOUND_DEVICE_IN_ANY)) {
+               debug_log ("Active device exists. Nothing needed...\n");
+               return;
+       }
+
+       debug_log ("No capture active device, set active based on priority!!\n");
+
+       /* set active device based on device priority (bt>ear>spk) */
+       if (IS_AVAILABLE(MM_SOUND_DEVICE_IN_BT_SCO) && IS_COMMUNICATION_SESSION()) {
+               debug_log ("BT SCO available, set as active!!\n");
+               SET_ACTIVE(MM_SOUND_DEVICE_IN_BT_SCO);
+       } else if (IS_AVAILABLE(MM_SOUND_DEVICE_IN_WIRED_ACCESSORY)) {
+               debug_log ("WIRED available, set as active!!\n");
+               SET_ACTIVE(MM_SOUND_DEVICE_IN_WIRED_ACCESSORY);
+       } else {
+               debug_log ("MIC available, set as active!!\n");
+               SET_ACTIVE(MM_SOUND_DEVICE_IN_MIC);
+       }
+}
+
+static void _set_initial_active_device ()
+{
+       int type = 0;
+       bool a2dp = 0, sco = 0;
+
+       /* Set SPK & MIC as default available device */
+       /* FIXME : spk & mic can be always on??? */
+       SET_AVAILABLE(MM_SOUND_DEVICE_OUT_SPEAKER);
+       SET_AVAILABLE(MM_SOUND_DEVICE_IN_MIC);
+
+       /* Get wired status and set available status */
+       MMSoundMgrHeadsetGetType (&type);
+       if (type > 0) {
+               SET_AVAILABLE(MM_SOUND_DEVICE_OUT_WIRED_ACCESSORY);
+               if (type == EARJACK_WITH_MIC) {
+                       SET_AVAILABLE(MM_SOUND_DEVICE_IN_WIRED_ACCESSORY);
+               }
+       }
+
+       /* Get BT status and set available status */
+       MMSoundMgrPulseGetInitialBTStatus (&a2dp, &sco);
+       if (a2dp) {
+               SET_AVAILABLE(MM_SOUND_DEVICE_OUT_BT_A2DP);
+       }
+       if (sco) {
+               SET_AVAILABLE(MM_SOUND_DEVICE_OUT_BT_SCO);
+               SET_AVAILABLE(MM_SOUND_DEVICE_IN_BT_SCO);
+       }
+
+       /* Set Active device based on priority */
+       _select_playback_active_device ();
+       _select_capture_active_device ();
+
+       _set_path_with_notification (NO_NOTI);
+
+       dump_info();
+}
+
+static void handle_bt_a2dp_on ()
+{
+       int ret = MM_ERROR_NONE;
+
+       /* at this time, pulseaudio default sink is bt sink */
+       if (IS_COMMUNICATION_SESSION()) {
+               debug_log ("Current session is VOICECALL, no auto-activation!!!\n");
+               return;
+       }
+
+       debug_log ("Activate BT_A2DP device\n");
+       SET_PLAYBACK_ONLY_ACTIVE(MM_SOUND_DEVICE_OUT_BT_A2DP);
+
+       ret = _mm_sound_mgr_device_active_device_callback(GET_ACTIVE_CAPTURE(), GET_ACTIVE_PLAYBACK());
+       if (ret != MM_ERROR_NONE) {
+               debug_error ("_mm_sound_mgr_device_active_device_callback() failed [%x]\n", ret);
+       }
+
+       dump_info ();
+}
+
+static void handle_bt_a2dp_off ()
+{
+       if (!IS_ACTIVE(MM_SOUND_DEVICE_OUT_BT_A2DP)) {
+               debug_msg("MM_SOUND_DEVICE_OUT_BT_A2DP was not active. nothing to do here.");
+               dump_info ();
+               return;
+       }
+
+       /* if bt was active, then do asm pause */
+       debug_msg("Do pause here");
+       _asm_pause_process (g_info.asm_handle);
+
+       /* set bt device to none */
+       debug_msg("Deactivate BT_A2DP device\n");
+       UNSET_ACTIVE(MM_SOUND_DEVICE_OUT_BT_A2DP);
+
+       /* activate current available device based on priority */
+       _select_playback_active_device();
+
+       /* Do set path and notify result */
+       _set_path_with_notification(DO_NOTI);
+
+       dump_info ();
+}
+
+static void handle_bt_sco_off ()
+{
+       /* If sco is not activated, just return */
+       if (!IS_ACTIVE(MM_SOUND_DEVICE_OUT_BT_SCO) && !IS_ACTIVE(MM_SOUND_DEVICE_IN_BT_SCO)) {
+               debug_msg("BT SCO was not active. nothing to do here.");
+               dump_info ();
+               return;
+       }
+
+       /* set bt device to none */
+       debug_msg("Deactivate BT_SCO device\n");
+       UNSET_ACTIVE(MM_SOUND_DEVICE_OUT_BT_SCO);
+       UNSET_ACTIVE(MM_SOUND_DEVICE_IN_BT_SCO);
+
+       /* activate current available device based on priority */
+       _select_playback_active_device();
+       _select_capture_active_device();
+
+       /* Do set path and notify result */
+       _set_path_with_notification(DO_NOTI);
+
+       dump_info ();
+}
+
+static void handle_headset_on (int type)
+{
+#ifdef SEPARATE_EARPHONE_VOLUME
+       int ret = MM_ERROR_NONE;
+       volume_type_t volume_type = VOLUME_TYPE_MAX;
+
+       /* get current volume type before changing device */
+       ret = mm_sound_volume_get_current_playing_type(&volume_type);
+       if (ret != MM_ERROR_NONE) {
+               debug_error("mm_sound_volume_get_current_playing_type failed....ret = [%x]\n", ret);
+       }
+#endif
+
+       /* at this time, pulseaudio default sink is bt sink */
+       /* if fmradio session, do nothing */
+
+       /* Skip when noti session */
+
+       /* ToDo : alarm/notification session ???? */
+       if (IS_COMMUNICATION_SESSION()) {
+               debug_log ("Current session is VOICECALL, no auto-activation!!!\n");
+               return;
+       }
+
+       debug_log ("Activate WIRED OUT device\n");
+       SET_PLAYBACK_ONLY_ACTIVE(MM_SOUND_DEVICE_OUT_WIRED_ACCESSORY);
+       if (type == EARJACK_WITH_MIC) {
+               debug_log ("Activate WIRED IN device\n");
+               SET_CAPTURE_ONLY_ACTIVE(MM_SOUND_DEVICE_IN_WIRED_ACCESSORY);
+       }
+
+#ifdef SEPARATE_EARPHONE_VOLUME
+       __update_volume_value(volume_type);
+#endif
+
+       /* Do set path and notify result */
+       _set_path_with_notification(DO_NOTI);
+
+       dump_info ();
+}
+
+static void handle_headset_off ()
+{
+#ifdef SEPARATE_EARPHONE_VOLUME
+       int ret = MM_ERROR_NONE;
+       volume_type_t volume_type = VOLUME_TYPE_MAX;
+
+       /* get current volume type before changing device */
+       ret = mm_sound_volume_get_current_playing_type(&volume_type);
+       if (ret != MM_ERROR_NONE) {
+               debug_error("mm_sound_volume_get_current_playing_type failed....ret = [%x]\n", ret);
+       }
+#endif
+
+       if (!IS_ACTIVE(MM_SOUND_DEVICE_OUT_WIRED_ACCESSORY)) {
+               debug_msg("MM_SOUND_DEVICE_OUT_WIRED_ACCESSORY was not active. nothing to do here.");
+               return;
+       }
+
+       /* if bt was active, then do asm pause */
+       debug_msg("Do pause here");
+       _asm_pause_process (g_info.asm_handle);
+
+       /* set bt device to none */
+       debug_msg("Deactivate WIRED IN/OUT device\n");
+       UNSET_ACTIVE(MM_SOUND_DEVICE_OUT_WIRED_ACCESSORY);
+       UNSET_ACTIVE(MM_SOUND_DEVICE_IN_WIRED_ACCESSORY);
+
+       /* For voicecall session, activation device is up-to application policy */
+       if (IS_COMMUNICATION_SESSION()) {
+               debug_log ("Current session is VOICECALL, no auto-activation!!!\n");
+               return;
+       }
+
+       /* activate current available device based on priority */
+       _select_playback_active_device();
+       _select_capture_active_device();
+
+#ifdef SEPARATE_EARPHONE_VOLUME
+       __update_volume_value(volume_type);
+#endif
+
+       /* Do set path and notify result */
+       _set_path_with_notification(DO_NOTI);
+
+       dump_info ();
+}
+
+/* ------------------------- EXTERNAL FUNCTIONS ------------------------------------*/
+/* DEVICE : Called by mgr_pulse for updating current default_sink_name */
+int MMSoundMgrSessionSetDefaultSink (char *default_sink_name)
+{
+       LOCK_SESSION();
+
+       strcpy (g_info.default_sink_name, default_sink_name);
+       debug_msg ("[SESSION][%s][%d] default sink=[%s]\n", __func__, __LINE__, default_sink_name);
+
+       /* ToDo: do something */
+
+       UNLOCK_SESSION();
+
+       return MM_ERROR_NONE;
+}
+
+/* DEVICE : Called by mgr_pulse for bt and mgr_headset for headset */
+int MMSoundMgrSessionSetDeviceAvailable (device_type_t device, int available, int type, char* name)
+{
+       LOCK_SESSION();
+
+       debug_msg ("[SESSION] device = %d, available = %d, type = %d, name = %s\n", device, available, type, name);
+       switch (device)
+       {
+       case DEVICE_WIRED:
+               if (available) {
+
+                       if (!IS_AVAILABLE(MM_SOUND_DEVICE_OUT_WIRED_ACCESSORY)) {
+                               SET_AVAILABLE(MM_SOUND_DEVICE_OUT_WIRED_ACCESSORY);
+                               if (type == EARJACK_WITH_MIC) {
+                                       SET_AVAILABLE(MM_SOUND_DEVICE_IN_WIRED_ACCESSORY);
+                                       _mm_sound_mgr_device_available_device_callback(
+                                                                                       MM_SOUND_DEVICE_IN_WIRED_ACCESSORY,
+                                                                                       MM_SOUND_DEVICE_OUT_WIRED_ACCESSORY,
+                                                                                       AVAILABLE);
+                               } else {
+                                       _mm_sound_mgr_device_available_device_callback(
+                                                                                       MM_SOUND_DEVICE_IN_NONE,
+                                                                                       MM_SOUND_DEVICE_OUT_WIRED_ACCESSORY,
+                                                                                       AVAILABLE);
+                               }
+                               handle_headset_on(type);
+                       } else {
+                               debug_log ("Already device [%d] is available...\n", device);
+                       }
+
+               } else {
+
+                       if (IS_AVAILABLE(MM_SOUND_DEVICE_OUT_WIRED_ACCESSORY)) {
+                               UNSET_AVAILABLE(MM_SOUND_DEVICE_OUT_WIRED_ACCESSORY);
+                               if (IS_AVAILABLE(MM_SOUND_DEVICE_IN_WIRED_ACCESSORY)) {
+                                       UNSET_AVAILABLE(MM_SOUND_DEVICE_IN_WIRED_ACCESSORY);
+                                       _mm_sound_mgr_device_available_device_callback(
+                                                                                       MM_SOUND_DEVICE_IN_WIRED_ACCESSORY,
+                                                                                       MM_SOUND_DEVICE_OUT_WIRED_ACCESSORY,
+                                                                                       NOT_AVAILABLE);
+
+                               } else {
+                                       _mm_sound_mgr_device_available_device_callback(
+                                                                                       MM_SOUND_DEVICE_IN_NONE,
+                                                                                       MM_SOUND_DEVICE_OUT_WIRED_ACCESSORY,
+                                                                                       NOT_AVAILABLE);
+                               }
+                               handle_headset_off();
+                       } else {
+                               debug_log ("Already device [%d] is unavailable...\n", device);
+                       }
+
+               }
+               break;
+
+       case DEVICE_BT_A2DP:
+               strcpy (g_info.bt_name, (name)? name : "");
+               if (available) {
+                       if (!IS_AVAILABLE(MM_SOUND_DEVICE_OUT_BT_A2DP)) {
+                               SET_AVAILABLE(MM_SOUND_DEVICE_OUT_BT_A2DP);
+                               _mm_sound_mgr_device_available_device_callback(
+                                                                                       MM_SOUND_DEVICE_IN_NONE,
+                                                                                       MM_SOUND_DEVICE_OUT_BT_A2DP,
+                                                                                       AVAILABLE);
+
+                               handle_bt_a2dp_on();
+                       } else {
+                               debug_log ("Already device [%d] is available...\n", device);
+                       }
+               } else {
+                       if (IS_AVAILABLE(MM_SOUND_DEVICE_OUT_BT_A2DP)) {
+                               UNSET_AVAILABLE(MM_SOUND_DEVICE_OUT_BT_A2DP);
+                               _mm_sound_mgr_device_available_device_callback(
+                                                                                       MM_SOUND_DEVICE_IN_NONE,
+                                                                                       MM_SOUND_DEVICE_OUT_BT_A2DP,
+                                                                                       NOT_AVAILABLE);
+
+                               handle_bt_a2dp_off();
+                       } else {
+                               debug_log ("Already device [%d] is unavailable...\n", device);
+                       }
+               }
+               break;
+
+       case DEVICE_BT_SCO:
+               if (available) {
+                       if (!IS_AVAILABLE(MM_SOUND_DEVICE_OUT_BT_SCO)) {
+                               SET_AVAILABLE(MM_SOUND_DEVICE_OUT_BT_SCO);
+                               SET_AVAILABLE(MM_SOUND_DEVICE_IN_BT_SCO);
+                               _mm_sound_mgr_device_available_device_callback(
+                                                                                       MM_SOUND_DEVICE_IN_BT_SCO,
+                                                                                       MM_SOUND_DEVICE_OUT_BT_SCO,
+                                                                                       AVAILABLE);
+                       } else {
+                               debug_log ("Already device [%d] is available...\n", device);
+                       }
+               } else {
+                       if (IS_AVAILABLE(MM_SOUND_DEVICE_OUT_BT_SCO)) {
+                               UNSET_AVAILABLE(MM_SOUND_DEVICE_OUT_BT_SCO);
+                               UNSET_AVAILABLE(MM_SOUND_DEVICE_IN_BT_SCO);
+                               _mm_sound_mgr_device_available_device_callback(
+                                                                                       MM_SOUND_DEVICE_IN_BT_SCO,
+                                                                                       MM_SOUND_DEVICE_OUT_BT_SCO,
+                                                                                       NOT_AVAILABLE);
+
+                               handle_bt_sco_off();
+                       } else {
+                               debug_log ("Already device [%d] is unavailable...\n", device);
+                       }
+               }
+               break;
+
+       case DEVICE_DOCK:
+               break;
+       }
+
+       UNLOCK_SESSION();
+
+       return MM_ERROR_NONE;
+}
+
+int MMSoundMgrSessionIsDeviceAvailableNoLock (mm_sound_device_out playback, mm_sound_device_in capture, bool *available)
+{
+       int ret = MM_ERROR_NONE;
+       debug_log ("[SESSION][%s][%d] query playback=[0x%X] capture=[0x%X], current available = [0x%X]\n",
+                       __func__, __LINE__, playback, capture, g_info.device_available);
+
+       if (available) {
+               if (playback == MM_SOUND_DEVICE_OUT_NONE) {
+                       *available = IS_AVAILABLE(capture);
+               } else if (capture == MM_SOUND_DEVICE_IN_NONE) {
+                       *available = IS_AVAILABLE(playback);
+               } else {
+                       *available = (IS_AVAILABLE(playback) && IS_AVAILABLE(capture));
+               }
+               debug_log ("[%s][%d] return available = [%d]\n", __func__, __LINE__, *available);
+       } else {
+               debug_warning ("Invalid argument!!!\n");
+               ret = MM_ERROR_INVALID_ARGUMENT;
+       }
+
+       return ret;
+}
+
+
+int MMSoundMgrSessionIsDeviceAvailable (mm_sound_device_out playback, mm_sound_device_in capture, bool *available)
+{
+       int ret = MM_ERROR_NONE;
+
+       LOCK_SESSION();
+       ret = MMSoundMgrSessionIsDeviceAvailableNoLock (playback, capture, available);
+       UNLOCK_SESSION();
+
+       return ret;
+}
+
+int MMSoundMgrSessionGetAvailableDevices (int *playback, int *capture)
+{
+       if (playback == NULL || capture == NULL) {
+               debug_error ("Invalid input parameter\n");
+               return MM_ERROR_INVALID_ARGUMENT;
+       }
+
+       LOCK_SESSION();
+
+       *playback = GET_AVAILABLE_PLAYBACK();
+       *capture  = GET_AVAILABLE_CAPTURE();
+       debug_msg ("[SESSION][%s][%d] return available playback=[0x%X]/capture=[0x%X]\n", __func__, __LINE__, *playback, *capture);
+
+       UNLOCK_SESSION();
+
+       return MM_ERROR_NONE;
+}
+
+int MMSoundMgrSessionSetDeviceActive (mm_sound_device_out playback, mm_sound_device_in capture)
+{
+       int ret = MM_ERROR_NONE;
+       int old_active = g_info.device_active;
+#ifdef SEPARATE_EARPHONE_VOLUME
+       volume_type_t volume_type = VOLUME_TYPE_MAX;
+
+       /* get current volume type before changing device */
+       ret = mm_sound_volume_get_current_playing_type(&volume_type);
+       if (ret != MM_ERROR_NONE) {
+               debug_error("mm_sound_volume_get_current_playing_type failed....ret = [%x]\n", ret);
+       }
+#endif
+
+       LOCK_SESSION();
+
+       debug_msg ("[SESSION][%s][%d] playback=[0x%X] capture=[0x%X]\n", __func__, __LINE__, playback, capture);
+
+       /* Check whether device is available */
+       if ((playback && !IS_AVAILABLE(playback)) || (capture && !IS_AVAILABLE(capture))) {
+               debug_warning ("Failed to set active state to unavailable device!!!\n");
+               ret = MM_ERROR_INVALID_ARGUMENT;
+               goto END_SET_DEVICE;
+       }
+
+       /* Update active state */
+       debug_log ("Update active device as request\n");
+       if (playback) {
+               SET_PLAYBACK_ONLY_ACTIVE(playback);
+       }
+       if (capture) {
+               SET_CAPTURE_ONLY_ACTIVE(capture);
+       }
+
+       /* If there's changes do path set and inform callback */
+       if (old_active != g_info.device_active) {
+               debug_msg ("Changes happens....set path based on current active device and inform callback!!!\n");
+
+#ifdef SEPARATE_EARPHONE_VOLUME
+               __update_volume_value(volume_type);
+#endif
+
+               /* Do set path based on current active state */
+               _set_path_with_notification(DO_NOTI);
+       } else {
+               debug_msg ("No changes....nothing to do...\n");
+       }
+
+END_SET_DEVICE:
+       UNLOCK_SESSION();
+       return ret;
+}
+
+int MMSoundMgrSessionGetDeviceActive (mm_sound_device_out *playback, mm_sound_device_in *capture)
+{
+       if (playback == NULL || capture == NULL) {
+               debug_error ("Invalid input parameter\n");
+               return MM_ERROR_INVALID_ARGUMENT;
+       }
+
+       LOCK_SESSION();
+
+       *playback = GET_ACTIVE_PLAYBACK();
+       *capture  = GET_ACTIVE_CAPTURE();
+       debug_msg ("[SESSION][%s][%d] return active playback=[0x%X]/capture=[0x%X]\n", __func__, __LINE__,
+                               *playback,*capture);
+
+       UNLOCK_SESSION();
+       return MM_ERROR_NONE;
+}
+
+/* SUBSESSION */
+int MMSoundMgrSessionSetSession(session_t session, session_state_t state)
+{
+       LOCK_SESSION();
+
+       debug_msg ("[SESSION][%s][%d] session=[%d] state=[%d]\n", __func__, __LINE__, session, state);
+
+       /* Update session */
+       if (state)
+               g_info.session = session;
+       else
+               g_info.session = SESSION_MEDIA;
+
+       /* Do action based on new session */
+       switch (session)
+       {
+       case SESSION_MEDIA:
+               /* ToDo:
+               start
+                       mic setting
+               end
+               */
+               break;
+
+       case SESSION_VOICECALL:
+       case SESSION_VOIP:
+               __set_playback_route_communication (state);
+               break;
+
+       case SESSION_FMRADIO:
+               __set_playback_route_fmradio (state);
+               break;
+
+       case SESSION_NOTIFICATION:
+               __set_playback_route_notification (state);
+               break;
+       }
+
+       UNLOCK_SESSION();
+       return MM_ERROR_NONE;
+}
+
+int MMSoundMgrSessionGetSession(session_t *session)
+{
+       if (session == NULL) {
+               debug_error ("Invalid input parameter\n");
+               return MM_ERROR_INVALID_ARGUMENT;
+       }
+
+       //LOCK_SESSION();
+       *session = g_info.session;
+       //UNLOCK_SESSION();
+
+       return MM_ERROR_NONE;
+}
+
+/* SUBSESSION */
+int MMSoundMgrSessionSetSubSession(subsession_t subsession)
+{
+       LOCK_SESSION();
+
+       g_info.subsession = subsession;
+       debug_msg ("[SESSION][%s][%d] subsession=[%d]\n", __func__, __LINE__, subsession);
+
+       _set_path_with_notification (NO_NOTI);
+
+       UNLOCK_SESSION();
+
+       return MM_ERROR_NONE;
+}
+
+int MMSoundMgrSessionGetSubSession(subsession_t *subsession)
+{
+       if (subsession == NULL) {
+               debug_error ("Invalid input parameter\n");
+               return MM_ERROR_INVALID_ARGUMENT;
+       }
+
+       LOCK_SESSION();
+
+       *subsession = g_info.subsession;
+
+       UNLOCK_SESSION();
+
+       return MM_ERROR_NONE;
+}
+
+char* MMSoundMgrSessionGetBtA2DPName ()
+{
+       return g_info.bt_name;
+}
+
+int MMSoundMgrSessionInit(void)
+{
+       LOCK_SESSION();
+
+       debug_fenter();
+
+       memset (&g_info, 0, sizeof (SESSION_INFO_STRUCT));
+
+       /* FIXME: Initial status should be updated */
+       _set_initial_active_device ();
+
+       /* Register for headset unplug */
+       if (_asm_register_for_headset (&g_info.asm_handle) == false) {
+               debug_error ("Failed to register ASM for headset\n");
+       }
+
+       debug_fleave();
+
+       UNLOCK_SESSION();
+       return MM_ERROR_NONE;
+}
+
+int MMSoundMgrSessionFini(void)
+{
+       LOCK_SESSION();
+
+       debug_fenter();
+
+       /* Unregister for headset unplug */
+       _asm_unregister_for_headset (&g_info.asm_handle);
+
+       debug_fleave();
+
+       UNLOCK_SESSION();
+
+       return MM_ERROR_NONE;
+}
+
index 7d601b6..20f7637 100644 (file)
@@ -26,7 +26,9 @@
 #include <vconf.h>
 #include <avsys-audio.h>
 
+#include "../include/mm_sound.h"
 #include "include/mm_sound_common.h"
+#include "include/mm_sound_mgr_session.h"
 
 
 int sound_system_bootup_recovery()
@@ -36,10 +38,14 @@ int sound_system_bootup_recovery()
                        VCONF_KEY_VOLUME_TYPE_RINGTONE, VCONF_KEY_VOLUME_TYPE_MEDIA, VCONF_KEY_VOLUME_TYPE_CALL,
                        VCONF_KEY_VOLUME_TYPE_ANDROID,VCONF_KEY_VOLUME_TYPE_JAVA, VCONF_KEY_VOLUME_TYPE_MEDIA};
        int vol[AVSYS_AUDIO_VOLUME_TYPE_MAX] = {5,7,6,13,7,7,0,11,11}, i=0;
+#ifdef SEPARATE_EARPHONE_VOLUME
+       mm_sound_device_in device_in = MM_SOUND_DEVICE_OUT_NONE;
+       mm_sound_device_out device_out = MM_SOUND_DEVICE_OUT_NONE;
+#endif
 
-       for(i=0; i<AVSYS_AUDIO_VOLUME_TYPE_MAX; i++) {
-               if(vconf_get_int(keystr[i], (int*)&vol[i])) {
-                       if(vconf_set_int(keystr[i], vol[i])) {
+       for (i=0; i<AVSYS_AUDIO_VOLUME_TYPE_MAX; i++) {
+               if (vconf_get_int(keystr[i], (int*)&vol[i])) {
+                       if (vconf_set_int(keystr[i], vol[i])) {
                                debug_error("Error on volume vconf key %s\n", keystr[i]);
                        } else {
                                debug_error("Set %s to default value %d\n", keystr[i], vol[i]);
@@ -47,6 +53,15 @@ int sound_system_bootup_recovery()
                } else {
                        debug_msg("Volume value of %s is %d\n", keystr[i], vol[i]);
                }
+#ifdef SEPARATE_EARPHONE_VOLUME
+               /* Get volume value of current device */
+               MMSoundMgrSessionGetDeviceActive(&device_out, &device_in);
+               if (device_out == MM_SOUND_DEVICE_OUT_WIRED_ACCESSORY) {
+                       vol[i] = vol[i] >> 8;
+               } else {
+                       vol[i] = vol[i] & 0x00FF;
+               }
+#endif
        }
 
        err = avsys_audio_hibernation_reset(vol);
index 6b1dbb0..d569227 100644 (file)
 #include "include/mm_sound_mgr_codec.h"
 #include "include/mm_sound_mgr_ipc.h"
 #include "include/mm_sound_mgr_pulse.h"
+#include "include/mm_sound_mgr_asm.h"
+#include "include/mm_sound_mgr_session.h"
+#include "include/mm_sound_mgr_headset.h"
 #include "include/mm_sound_recovery.h"
+#include "include/mm_sound_utils.h"
+#include "include/mm_sound_common.h"
 
 #include <heynoti.h>
 
 #define PLUGIN_DIR "/usr/lib/soundplugins/"
 #define PLUGIN_MAX 30
 
-#define HIBERNATION_CHECK_KEY  "memory/hibernation/sound_ready"
-#define HIBERNATION_READY              1
+#define HIBERNATION_SOUND_CHECK_PATH   "/tmp/hibernation/sound_ready"
 #define USE_SYSTEM_SERVER_PROCESS_MONITORING
 
+#define        ASM_CHECK_INTERVAL      10000
+
 typedef struct {
     char *plugdir;
     int startserver;
@@ -70,6 +76,8 @@ static void _exit_handler(int sig);
 
 GMainLoop *g_mainloop;
 
+void* pulse_handle;
+
 GThreadFunc event_loop_thread(gpointer data)
 {
        g_mainloop = g_main_loop_new(NULL, TRUE);
@@ -82,7 +90,8 @@ GThreadFunc event_loop_thread(gpointer data)
 
 void hibernation_leave_cb()
 {
-       MMSoundMgrPulseHandleRegisterMonoAudio();
+       MMSoundMgrPulseHandleRegisterMonoAudio(pulse_handle);
+       MMSoundMgrPulseHandleRegisterBluetoothStatus (pulse_handle);
 
        if(sound_system_bootup_recovery()) {
                debug_error("Audio reset failed\n");
@@ -91,6 +100,20 @@ void hibernation_leave_cb()
        }
 }
 
+void wait_for_asm_ready ()
+{
+       int retry_count = 0;
+       int asm_ready = 0;
+       while (!asm_ready) {
+               debug_log("Checking ASM ready....[%d]\n", retry_count++);
+               if (vconf_get_int(ASM_READY_KEY, &asm_ready)) {
+                       debug_warning("vconf_get_int for ASM_READY_KEY (%s) failed\n", ASM_READY_KEY);
+               }
+               usleep (ASM_CHECK_INTERVAL);
+       }
+       debug_log("ASM is now ready...clear key!!!\n");
+       vconf_unset (ASM_READY_KEY);
+}
 
 int main(int argc, char **argv)
 {
@@ -99,6 +122,7 @@ int main(int argc, char **argv)
        int ret;
        int heynotifd = -1;
 
+
        action.sa_handler = _exit_handler;
        action.sa_flags = 0;
        sigemptyset(&action.sa_mask);
@@ -182,7 +206,13 @@ int main(int argc, char **argv)
                if (!serveropt.testmode)
                        MMSoundMgrIpcInit();
 
-               MMSoundMgrPulseInit();
+               pulse_handle = MMSoundMgrPulseInit();
+               MMSoundMgrASMInit();
+               /* Wait for ASM Ready */
+               wait_for_asm_ready();
+               _mm_sound_mgr_device_init();
+               MMSoundMgrHeadsetInit();
+               MMSoundMgrSessionInit();
        }
 
        if (serveropt.startserver) {
@@ -190,9 +220,7 @@ int main(int argc, char **argv)
                MMSoundMgrRunRunAll();
 
                /* set hibernation check */
-               if(vconf_set_int(HIBERNATION_CHECK_KEY, HIBERNATION_READY)) {
-                       debug_error("[SoundServer] Hibernation check vconf_set_int fail\n");
-               }
+               _mm_sound_check_hibernation (HIBERNATION_SOUND_CHECK_PATH);
 
                /* Start Ipc mgr */
                MMSoundMgrIpcReady();
@@ -207,7 +235,11 @@ int main(int argc, char **argv)
                MMSoundMgrRunFini();
                MMSoundThreadPoolFini();
 
-               MMSoundMgrPulseFini();
+               MMSoundMgrHeadsetFini();
+               MMSoundMgrSessionFini();
+               _mm_sound_mgr_device_fini();
+               MMSoundMgrASMFini();
+               MMSoundMgrPulseFini(pulse_handle);
 
                if(heynoti_unsubscribe(heynotifd, "HIBERNATION_LEAVE", NULL)) {
                        debug_error("heynoti_unsubscribe failed..\n");
@@ -305,7 +337,7 @@ static void _exit_handler(int sig)
                debug_error("signal(SIGSYS) error");
                break;
        default:
-           ;
+               break;
        }
        raise(sig);
 }
index 70a314f..5cac361 100644 (file)
@@ -81,7 +81,7 @@ int MMSoundThreadPoolDump(int fulldump)
                                g_thread_pool_get_max_unused_threads(),
                                g_thread_pool_get_max_idle_time()       );
        }
-       debug_msg ("***** [ThreadPool] running=[%d], unused=[%d], %d\n",
+       debug_msg ("***** [ThreadPool] running=[%d], unused=[%d]\n",
                        g_thread_pool_get_num_threads (g_pool),
                        g_thread_pool_get_num_unused_threads() );
 
index 33b8c31..d25a171 100644 (file)
@@ -1 +1 @@
-SUBDIRS = headset wav keytone tone
+SUBDIRS = wav keytone tone
diff --git a/server/plugin/headset/Makefile.am b/server/plugin/headset/Makefile.am
deleted file mode 100644 (file)
index c8a76f0..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-lib_LTLIBRARIES = libsoundpluginheadset.la
-
-libsoundpluginheadset_la_SOURCES = mm_sound_plugin_run_headset.c
-
-libsoundpluginheadset_la_CFLAGS  = \
-                               $(MMCOMMON_CFLAGS) \
-                               $(AVSYSTEM_CFLAGS) \
-                               $(VCONF_CFLAGS) \
-                               $(AUDIOSESSIONMGR_CFLAGS)\
-                               -I$(srcdir)/../../../include \
-                               $(PULSE_CFLAGS) \
-                               $(MMLOGSVR_CFLAGS) -DMMF_LOG_OWNER=0x020 -DMMF_DEBUG_PREFIX=\"MMF-SOUND\"
-
-libsoundpluginheadset_la_LIBADD  =  \
-                               $(MMLOGSVR_LIBS) \
-                               $(AVSYSTEM_LIBS) \
-                               $(MMCOMMON_LIBS) \
-                               $(VCONF_LIBS) \
-                               $(AUDIOSESSIONMGR_LIBS) \
-                               $(PULSE_LIBS) \
-                               $(srcdir)/../../../common/libmmfsoundcommon.la
-
-install-exec-hook:
-       mkdir -p $(DESTDIR)$(libdir)/soundplugins
-       ln -sf /usr/lib/libsoundpluginheadset.so $(DESTDIR)$(libdir)/soundplugins/libsoundpluginheadset.so
-
diff --git a/server/plugin/headset/mm_sound_plugin_run_headset.c b/server/plugin/headset/mm_sound_plugin_run_headset.c
deleted file mode 100644 (file)
index 0ef9c0d..0000000
+++ /dev/null
@@ -1,788 +0,0 @@
-/*
- * libmm-sound
- *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Seungbae Shin <seungbae.shin@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 <sys/types.h>
-#include <sys/stat.h>
-#include <stdbool.h>
-#include <errno.h>
-#include <assert.h>
-
-#include <mm_error.h>
-#include <mm_debug.h>
-#include <pthread.h>
-#include <avsys-audio.h>
-#include <vconf.h>
-#include <pulse/pulseaudio.h>
-
-#include "../../include/mm_sound_plugin_run.h"
-
-#include <audio-session-manager.h>
-#include "../../../include/mm_ipc.h"
-#include "../../../include/mm_sound_common.h"
-#include "../../../include/mm_sound.h"
-
-#include <string.h>
-
-static int g_asm_handle;
-static avsys_audio_playing_devcie_t g_device;
-
-static pthread_mutex_t _asm_mutex = PTHREAD_MUTEX_INITIALIZER;
-
-#define PULSE_DEFAULT_SINK_ALSA        0
-#define PULSE_DEFAULT_SINK_BT          1
-#define EARJACK_EJECTED        0
-
-bool _asm_register_for_headset (int * handle)
-{
-       int asm_error = 0;
-
-       if (handle == NULL) {
-               debug_error ("Handle is not valid!!!\n");
-               return false;
-       }
-
-       if(!ASM_register_sound(-1, handle, ASM_EVENT_EARJACK_UNPLUG, ASM_STATE_NONE, NULL, NULL, ASM_RESOURCE_NONE, &asm_error)) {
-               debug_warning("earjack event register failed with 0x%x\n", asm_error);
-               return false;
-       }
-       return true;
-}
-
-void _asm_pause_process(int handle)
-{
-       int asm_error = 0;
-       MMSOUND_ENTER_CRITICAL_SECTION( &_asm_mutex )
-       if(!ASM_set_sound_state(handle, ASM_EVENT_EARJACK_UNPLUG, ASM_STATE_PLAYING, ASM_RESOURCE_NONE, &asm_error )) {
-               debug_error("earjack event set sound state to playing failed with 0x%x\n", asm_error);
-       }
-
-       if(!ASM_set_sound_state(handle, ASM_EVENT_EARJACK_UNPLUG, ASM_STATE_STOP, ASM_RESOURCE_NONE, &asm_error )) {
-               debug_error("earjack event set sound state to stop failed with 0x%x\n", asm_error);
-       }
-       MMSOUND_LEAVE_CRITICAL_SECTION( &_asm_mutex )
-}
-
-int _update_route_policy_from_vconf()
-{
-       //This functionis trivial work to match avsystem shared memory route information with vconf route information in db.
-       int err = MM_ERROR_NONE;
-       int lv_route = 0;
-    mode_t prev_mask = 0;
-
-    prev_mask = umask(0);
-       if(MM_ERROR_NONE != __mm_sound_lock()) {
-               debug_error("Lock failed\n");
-               umask(prev_mask);
-               return MM_ERROR_SOUND_INTERNAL;
-       }
-       umask(prev_mask);
-
-       err = vconf_get_int(ROUTE_VCONF_KEY, &lv_route);
-       if(err < 0 ) {
-               debug_error("Can not get route policy from vconf. during Headset plugin init. set default.\n");
-               err = vconf_set_int(ROUTE_VCONF_KEY, (int)AVSYS_AUDIO_ROUTE_POLICY_DEFAULT);
-               if(err < 0) {
-                       debug_error("Set route polpa_threaded_mainloop *mainloopicy to vconf failed in headset plugin\n");
-               }
-       } else {
-               avsys_audio_route_policy_t av_route;
-               err = avsys_audio_get_route_policy((avsys_audio_route_policy_t*)&av_route);
-               if(AVSYS_FAIL(err)) {
-                       debug_error("Can not get route policy to avsystem 0x%x\n", err);
-                       av_route = -1;
-               }
-               if(av_route != lv_route) {
-                       //match vconf & shared mem info
-                       err = avsys_audio_set_route_policy(lv_route);
-                       if(AVSYS_FAIL(err)) {
-                               debug_error("avsys_audio_set_route_policy failed 0x%x\n", err);
-                       }
-               }
-       }
-
-       if(MM_ERROR_NONE != __mm_sound_unlock()) {
-               debug_error("Unlock failed\n");
-               return MM_ERROR_SOUND_INTERNAL;
-       }
-
-       return MM_ERROR_NONE;
-}
-
-bool _is_normal_state ()
-{
-       int gain, out, in, option;
-
-       if (avsys_audio_get_path_ex(&gain, &out, &in, &option) == AVSYS_STATE_SUCCESS) {
-               debug_msg ("[%s] gain = %x, out = %x, in = %x, option = %x\n", __func__, gain, out, in, option);
-               if (gain != AVSYS_AUDIO_GAIN_EX_RINGTONE &&
-                       gain != AVSYS_AUDIO_GAIN_EX_VOICECALL &&
-                       gain != AVSYS_AUDIO_GAIN_EX_VIDEOCALL  &&
-                       gain != AVSYS_AUDIO_GAIN_EX_CALLTONE) {
-                       return true;
-               }
-       } else {
-               debug_error ("Failed to get path\n");
-       }
-
-       return false;
-}
-
-int _set_audio_route_to_default()
-{
-       int ret = MM_ERROR_NONE;
-       int codec_option = AVSYS_AUDIO_PATH_OPTION_JACK_AUTO;
-       int gain, out, in, option;
-       debug_msg("Set audio route to default by sound_server earjack plugin");
-
-       if(MM_ERROR_NONE != __mm_sound_lock()) {
-               debug_error("Lock failed\n");
-               return MM_ERROR_SOUND_INTERNAL;
-       }
-
-    
-       avsys_audio_get_path_ex(&gain, &out, &in, &option);
-       debug_msg ("gain = %x, out = %x, in = %x, option = %x\n", gain, out, in, option);
-       if (gain == AVSYS_AUDIO_GAIN_EX_FMRADIO) { 
-               debug_msg ("This is FM radio gain mode.....Nothing to do with sound path\n");
-       } else {
-                                                                                                       
-               ret = avsys_audio_set_path_ex(AVSYS_AUDIO_GAIN_EX_KEYTONE, AVSYS_AUDIO_PATH_EX_SPK, AVSYS_AUDIO_PATH_EX_NONE, codec_option);
-               if(AVSYS_FAIL(ret)) {
-                       debug_error("Can not set playback sound path 0x%x\n", ret);
-                       if(MM_ERROR_NONE != __mm_sound_unlock()) {
-                               debug_error("Unlock failed\n");
-                               return MM_ERROR_SOUND_INTERNAL;
-                       }
-                       return ret;
-               }
-               ret = avsys_audio_set_path_ex(AVSYS_AUDIO_GAIN_EX_VOICEREC, AVSYS_AUDIO_PATH_EX_NONE, AVSYS_AUDIO_PATH_EX_MIC, codec_option);
-               if(AVSYS_FAIL(ret)) {
-                       debug_error("Can not set capture sound path 0x%x\n", ret);
-                       if(MM_ERROR_NONE != __mm_sound_unlock()) {
-                               debug_error("Unlock failed\n");
-                               return MM_ERROR_SOUND_INTERNAL;
-                       }
-                               return ret;
-               }
-       }
-
-       ret = avsys_audio_set_route_policy(AVSYS_AUDIO_ROUTE_POLICY_DEFAULT);
-       if(AVSYS_FAIL(ret)) {
-               debug_error("Can not set route policy to avsystem 0x%x\n", ret);
-               if(MM_ERROR_NONE != __mm_sound_unlock()) {
-                       debug_error("Unlock failed\n");
-                       return MM_ERROR_SOUND_INTERNAL;
-               }
-               return ret;
-       }
-
-       ret = vconf_set_int(ROUTE_VCONF_KEY, (int)AVSYS_AUDIO_ROUTE_POLICY_DEFAULT);
-       if(ret < 0) {
-               debug_error("Can not set route policy to vconf %s\n", ROUTE_VCONF_KEY);
-               if(MM_ERROR_NONE != __mm_sound_unlock()) {
-                       debug_error("Unlock failed\n");
-                       return MM_ERROR_SOUND_INTERNAL;
-               }
-               return MM_ERROR_SOUND_INTERNAL;
-       }
-
-       if(MM_ERROR_NONE != __mm_sound_unlock()) {
-               debug_error("Unlock failed\n");
-               return MM_ERROR_SOUND_INTERNAL;
-       }
-
-       return MM_ERROR_NONE;
-}
-
-static void
-card_subscribe_cb (pa_context * c,
-    pa_subscription_event_type_t t, uint32_t idx, void *userdata)
-{
-       const char* api_name = NULL;
-
-       debug_msg (">>>>>>>>> [%s][%d] type=(0x%x) idx=(%u)\n", __func__, __LINE__,  t, idx);
-
-       if ((t &  PA_SUBSCRIPTION_EVENT_FACILITY_MASK) != PA_SUBSCRIPTION_EVENT_CARD) {
-               debug_msg ("[%s][%d] type=(0x%x) idx=(%u) is not sink event, skip...\n", __func__, __LINE__,  t, idx);
-               return;
-       }
-
-       if ( (t & PA_SUBSCRIPTION_EVENT_TYPE_MASK) != PA_SUBSCRIPTION_EVENT_REMOVE &&
-                (t & PA_SUBSCRIPTION_EVENT_TYPE_MASK) != PA_SUBSCRIPTION_EVENT_NEW) {
-               debug_msg ("[%s][%d] type=(0x%x) idx=(%u) is not sink (remove/new) event, skip...\n", __func__, __LINE__,  t, idx);
-               return;
-       }
-
-       /* FIXME: We assumed that card is bt, card new/remove = bt new/remove */
-
-       if ((t & PA_SUBSCRIPTION_EVENT_TYPE_MASK) == PA_SUBSCRIPTION_EVENT_REMOVE) {
-               /* BT is removed */
-
-               /* Check current policy */
-               avsys_audio_route_policy_t cur_policy;
-               if (avsys_audio_get_route_policy(&cur_policy) != AVSYS_STATE_SUCCESS) {
-                       debug_error ("avsys_audio_get_route_policy() failed");
-                       return;
-               }
-
-               /* We Do pause if policy is default, if not, do nothing */
-               if (cur_policy == AVSYS_AUDIO_ROUTE_POLICY_DEFAULT)     {
-                       bool is_alsa_loud = false;
-
-                        /* Do pause here */
-                       debug_msg("Do pause here");
-
-                       /* If no asm handle register here */
-                       if (g_asm_handle ==  -1) {
-                               debug_msg ("ASM handle is not valid, try to register once more\n");
-                               /* This register should be success */
-                               if (_asm_register_for_headset (&g_asm_handle)) {
-                                       debug_msg("_asm_register_for_headset() success\n");
-                               } else {
-                                       debug_error("_asm_register_for_headset() failed\n");
-                               }
-                       }
-
-                       //do pause
-                       debug_warning("Send earphone unplug event to Audio Session Manager Server for BT headset\n");
-                       _asm_pause_process(g_asm_handle);
-
-                       //update playing device info
-                       if(AVSYS_FAIL(avsys_audio_path_check_loud(&is_alsa_loud))) {
-                               debug_error("avsys_audio_path_check_loud() failed");
-                       }
-                       g_device = (is_alsa_loud)? AVSYS_AUDIO_ROUTE_DEVICE_HANDSET : AVSYS_AUDIO_ROUTE_DEVICE_EARPHONE;
-               } else {
-                       debug_msg("Policy is not default, Do nothing");
-               }
-       } else if ((t & PA_SUBSCRIPTION_EVENT_TYPE_MASK) == PA_SUBSCRIPTION_EVENT_NEW) {
-               /* BT is loaded */
-
-               /* Restore audio route policy to default */
-               if(MM_ERROR_NONE != _set_audio_route_to_default()) {
-                       debug_error("set_audio_route_to_default() failed\n");
-               } else {
-                       debug_msg("set_audio_route_to_default() done.\n");
-                       g_device = AVSYS_AUDIO_ROUTE_DEVICE_BLUETOOTH;
-               }
-       } /* if ((t & PA_SUBSCRIPTION_EVENT_TYPE_MASK) == PA_SUBSCRIPTION_EVENT_REMOVE) */
-}
-
-void sink_state_cb (pa_context *c, void *userdata)
-{
-       pa_threaded_mainloop *mainloop = (pa_threaded_mainloop*)userdata;
-       assert(mainloop);
-       assert(c);
-
-       switch (pa_context_get_state(c)) {
-               case PA_CONTEXT_UNCONNECTED:
-               case PA_CONTEXT_CONNECTING:
-               case PA_CONTEXT_AUTHORIZING:
-               case PA_CONTEXT_SETTING_NAME:
-               case PA_CONTEXT_FAILED:
-               case PA_CONTEXT_TERMINATED:
-                       break;
-
-               case PA_CONTEXT_READY:
-               {
-                        /* Do CARD Subscribe */
-                       pa_context_set_subscribe_callback(c, card_subscribe_cb, NULL);
-
-                       pa_operation *o;
-                       if (!(o = pa_context_subscribe(c, (pa_subscription_mask_t)PA_SUBSCRIPTION_MASK_CARD, NULL, NULL))) {
-                               return;
-                       }
-                       pa_operation_unref(o);
-
-                       /* Signal */
-                       debug_msg ("signaling--------------\n");
-                       pa_threaded_mainloop_signal (mainloop, 0);
-
-                       break;
-               }
-       }
-
-       return;
-}
-
-typedef struct _sinkinfo_struct
-{
-       pa_threaded_mainloop *mainloop;
-       int is_speaker_on;
-       int is_bt_on;
-       int route_to;
-       char speaker_name[256];
-       char bt_name[256];
-
-} sinkinfo_struct;
-
-void __get_sink_info_callback(pa_context *c, const pa_sink_info *i, int is_last, void *userdata)
-{
-       sinkinfo_struct *ss = (sinkinfo_struct *)userdata;
-
-   if (is_last < 0) {
-          debug_error("Failed to get sink information: %s\n", pa_strerror(pa_context_errno(c)));
-          debug_error("Error to MM_SOUND_MSG_REQ_SET_AUDIO_ROUTE.\n");
-   }
-
-   if (is_last) {
-          /* Change default sink which we want to */
-          if (ss->route_to == 0 && ss->is_speaker_on ) {
-                  debug_error ("Trying to set default sink to [%s] \n", ss->speaker_name);
-                  pa_operation_unref(pa_context_set_default_sink(c, ss->speaker_name, NULL, NULL));
-          } else if (ss->route_to == 1 && ss->is_bt_on) {
-                  debug_error ("Trying to set default sink to [%s] \n", ss->bt_name);
-                  pa_operation_unref(pa_context_set_default_sink(c, ss->bt_name, NULL, NULL));
-          } else {
-                  debug_error ("No match for [%d] \n", ss->route_to);
-          }
-
-               /* Signal */
-               debug_msg ("signaling--------------\n");
-               pa_threaded_mainloop_signal (ss->mainloop, 0);
-               return;
-   }
-
-   if (i->name) {
-               debug_error("sink name = [%s]\n", i->name);
-
-               if (strstr (i->name, "alsa_")) {
-                       ss->is_speaker_on = 1;
-                       strncpy (ss->speaker_name, i->name, sizeof(ss->speaker_name)-1);
-               } else if (strstr (i->name, "bluez")) {
-                       ss->is_bt_on = 1;
-                       strncpy (ss->bt_name, i->name, sizeof(ss->bt_name)-1);
-               } else
-                       debug_error("Unknown sink name!!!\n");
-   }
-
-}
-
-int __set_audio_route (pa_threaded_mainloop *mainloop, pa_context *context, int route)
-{
-       debug_enter("\n");
-       int ret = MM_ERROR_NONE;
-       int current_route = 0;
-       int policy_to_set;
-
-       sinkinfo_struct *ss = malloc (sizeof (sinkinfo_struct)); /* this will be freed end of this function */
-       memset (ss, 0, sizeof(sinkinfo_struct));
-       /* parament set */
-       ss->mainloop = mainloop;
-       ss->route_to = route; // 0=alsa 1=bt
-
-       if(MM_ERROR_NONE != __mm_sound_lock()) {
-               debug_error("Lock failed\n");
-               return MM_ERROR_SOUND_INTERNAL;
-       }
-
-       /* vconf check */
-       ret = vconf_get_int(ROUTE_VCONF_KEY, &current_route);
-       if(ret < 0) {
-               debug_error("Can not get current route policy\n");
-               current_route = SYSTEM_AUDIO_ROUTE_POLICY_DEFAULT;
-               if(0 > vconf_set_int(ROUTE_VCONF_KEY, current_route)) {
-                       debug_error("Can not save current audio route policy to %s\n", ROUTE_VCONF_KEY);
-                       if(MM_ERROR_NONE != __mm_sound_unlock()) {
-                               debug_error("Unlock failed\n");
-                               return MM_ERROR_SOUND_INTERNAL;
-                       }
-                       return MM_ERROR_SOUND_INTERNAL;
-               }
-       }
-
-       /* Do Pulseaudio works : start  */
-    pa_threaded_mainloop_lock(mainloop);
-       /* Do async pulse operation */
-       pa_operation_unref(pa_context_get_sink_info_list(context, __get_sink_info_callback, ss));
-
-    /* Wait until the context is ready */
-    pa_threaded_mainloop_wait(mainloop);
-    pa_threaded_mainloop_unlock(mainloop);
-       /* Do Pulseaudio works : end  */
-
-       /* Sound path for ALSA */
-       if(route == PULSE_DEFAULT_SINK_ALSA)
-       {
-               ret = avsys_audio_set_path_ex(AVSYS_AUDIO_GAIN_EX_KEYTONE, AVSYS_AUDIO_PATH_EX_SPK, AVSYS_AUDIO_PATH_EX_NONE, AVSYS_AUDIO_PATH_OPTION_JACK_AUTO);
-               if(AVSYS_FAIL(ret)) {
-                       debug_error("Can not set playback sound path 0x%x\n", ret);
-                       if(MM_ERROR_NONE != __mm_sound_unlock()) {
-                               debug_error("Unlock failed\n");
-                               return MM_ERROR_SOUND_INTERNAL;
-                       }    
-                       return ret; 
-               }    
-               ret = avsys_audio_set_path_ex(AVSYS_AUDIO_GAIN_EX_VOICEREC, AVSYS_AUDIO_PATH_EX_NONE, AVSYS_AUDIO_PATH_EX_MIC, AVSYS_AUDIO_PATH_OPTION_JACK_AUTO);
-               if(AVSYS_FAIL(ret)) {
-                       debug_error("Can not set capture sound path 0x%x\n", ret);
-                       if(MM_ERROR_NONE != __mm_sound_unlock()) {
-                               debug_error("Unlock failed\n");
-                               return MM_ERROR_SOUND_INTERNAL;
-                       }    
-                       return ret; 
-               }    
-       }    
-
-
-       /* set policy to avsystem & vconf : start */ 
-       /* select proper policy */
-       if (route == PULSE_DEFAULT_SINK_ALSA && ss->is_bt_on == 1) {
-               /* default sink changed to alsa successful but bt exists, this means policy is IGNORE A2DP */
-               policy_to_set = AVSYS_AUDIO_ROUTE_POLICY_IGNORE_A2DP;
-       } else {
-               /* otherwise set to DEFAULT policy */
-               policy_to_set = AVSYS_AUDIO_ROUTE_POLICY_DEFAULT;
-       }
-
-       /* set avsys policy */
-       ret = avsys_audio_set_route_policy(policy_to_set);
-       if(AVSYS_FAIL(ret)) {
-               debug_error("Can not set route policy to avsystem 0x%x\n", ret);
-               if(MM_ERROR_NONE != __mm_sound_unlock()) {
-                       debug_error("Unlock failed\n");
-                       return MM_ERROR_SOUND_INTERNAL;
-               }
-       }
-
-       /* vconf */
-       ret = vconf_set_int(ROUTE_VCONF_KEY, policy_to_set);
-       if(ret < 0) {
-               debug_error("Can not set route policy to vconf %s\n", ROUTE_VCONF_KEY);
-               if(MM_ERROR_NONE != __mm_sound_unlock()) {
-                       debug_error("Unlock failed\n");
-                       return MM_ERROR_SOUND_INTERNAL;
-               }
-               return MM_ERROR_SOUND_INTERNAL;
-       }
-       if(MM_ERROR_NONE != __mm_sound_unlock()) {
-               debug_error("Unlock failed\n");
-               return MM_ERROR_SOUND_INTERNAL;
-       }
-       /* set policy to avssytem & vconf : end */
-
-       /* clean up */
-       if (ss) {
-               free (ss);
-               ss = NULL;
-       }
-
-       debug_leave("\n");
-       return ret;
-}
-
-
-static int (*g_thread_pool_func)(void*, void (*)(void*)) = NULL;
-
-int MMSoundPlugRunHeadsetControlRun(void)
-{
-       int current_type = 0;
-       int new_type = 0;
-       int waitfd = 0;
-       int err = AVSYS_STATE_SUCCESS;
-       int error = PA_ERR_INTERNAL;
-       int asm_error = 0;
-       int eject_event_count = 0;
-       int need_mute = 0;
-       pa_threaded_mainloop *mainloop = NULL;
-       pa_context *context = NULL;
-
-       g_asm_handle = -1;
-       g_device = AVSYS_AUDIO_ROUTE_DEVICE_UNKNOWN;
-
-       if(MM_ERROR_NONE != (err = _update_route_policy_from_vconf()))
-               return err;
-
-       if(MM_ERROR_NONE != (err = _set_audio_route_to_default()))
-               return err;
-
-       if(AVSYS_FAIL(avsys_audio_earjack_manager_init(&current_type, &waitfd)))
-               return MM_ERROR_SOUND_DEVICE_NOT_OPENED;
-
-       if(current_type > 0)
-               g_device= AVSYS_AUDIO_ROUTE_DEVICE_EARPHONE;
-       else if(current_type == 0)
-               g_device = AVSYS_AUDIO_ROUTE_DEVICE_HANDSET;
-
-       //register pulseaudio event subscribe callback here
-    if (!(mainloop = pa_threaded_mainloop_new())) {
-       debug_error("pa_threaded_mainloop_new failed\n");
-        goto fail;
-    }
-
-    if (!(context = pa_context_new(pa_threaded_mainloop_get_api(mainloop), NULL))) {
-       debug_error("pa_context_new failed\n")
-        goto fail;
-    }
-
-    pa_context_set_state_callback(context, sink_state_cb, (void*)mainloop);
-
-    if (pa_context_connect(context, NULL, 0, NULL) < 0) {
-        error = pa_context_errno(context);
-        goto fail;
-    }
-
-    pa_threaded_mainloop_lock(mainloop);
-
-    if (pa_threaded_mainloop_start(mainloop) < 0) {
-       debug_error("pa_threaded_mainloop_start failed\n");
-        goto unlock_and_fail;
-    }
-
-    debug_msg("pa_threaded_mainloop_start() success");
-
-    for (;;) {
-        pa_context_state_t state;
-
-        state = pa_context_get_state(context);
-
-        if (state == PA_CONTEXT_READY)
-            break;
-
-        if (!PA_CONTEXT_IS_GOOD(state)) {
-            error = pa_context_errno(context);
-            debug_error("Connection with pa daemon failed %s\n", pa_strerror(error));
-            goto unlock_and_fail;
-        }
-
-        /* Wait until the context is ready */
-        pa_threaded_mainloop_wait(mainloop);
-    }
-
-    pa_threaded_mainloop_unlock(mainloop);
-
-       //share information between earphone and bluetooth
-
-       while(1)
-       {
-               //update playing device info
-               if(AVSYS_FAIL(avsys_audio_get_playing_device_info(&g_device)))
-                       debug_error("AVSYS_FAILavsys_audio_get_playing_device_info() failed");
-
-               //waiting earjack event
-               err = avsys_audio_earjack_manager_wait(waitfd, &current_type, &new_type, &need_mute);
-               debug_log ("wait result  = %x, current_type= %d, new_type = %d, need_mute = %d\n", err, current_type, new_type, need_mute);
-               if(err & AVSYS_STATE_ERROR) {
-#if !defined(_MMFW_I386_ALL_SIMULATOR)
-                       if(err != AVSYS_STATE_ERR_NULL_POINTER) {
-                               if(AVSYS_FAIL(avsys_audio_earjack_manager_unlock())) {
-                                       debug_error("avsys_audio_earjack_manager_unlock() failed in %s\n",__func__);
-                                       err = MM_ERROR_SOUND_INTERNAL;
-                                       goto fail;
-                               }
-                       }
-#endif
-                       break;
-               } else if((err & AVSYS_STATE_WARING)) {
-                       if(err != AVSYS_STATE_WAR_INVALID_VALUE) {
-                               if(AVSYS_FAIL(avsys_audio_earjack_manager_unlock())) {
-                                       debug_error("avsys_audio_earjack_manager_unlock() failed in %s\n",__func__);
-                                       err = MM_ERROR_SOUND_INTERNAL;
-                                       goto fail;
-                               }
-                       }
-                       continue; /* Ignore current changes and do wait again */
-               }
-               debug_warning("Current type is %d, New type is %d\n", current_type, new_type);
-
-               if(current_type == new_type) {
-                       if(AVSYS_FAIL(avsys_audio_earjack_manager_unlock())) {
-                               debug_error("avsys_audio_earjack_manager_unlock() failed in %s\n",__func__);
-                               err = MM_ERROR_SOUND_INTERNAL;
-                               goto fail;
-                       }
-                       continue; /* Ignore current changes and do wait again */
-               } else {
-                       current_type = new_type;
-               }
-               debug_warning("Current type is %d\n", current_type);
-
-               /* mute if needed, unmute will be done end of this loop */
-               if(need_mute) {
-                       //set global mute
-                       if(AVSYS_FAIL(avsys_audio_set_global_mute(AVSYS_AUDIO_MUTE_NOLOCK)))
-                               debug_error("Set mute failed\n");
-               }
-
-               //update playing device info
-               if(AVSYS_FAIL(avsys_audio_get_playing_device_info(&g_device))) {
-                       debug_error("AVSYS_FAILavsys_audio_get_playing_device_info() failed");
-               }
-               debug_msg ("Current playing device was [%d]\n", g_device);
-
-               //current_type '0' means earjack ejected
-               if(current_type == EARJACK_EJECTED) {
-                       eject_event_count++;
-                       if(eject_event_count == 1) {
-                               debug_msg ("earjack [EJECTED]\n");
-                       
-                               avsys_audio_route_policy_t route_policy;
-                               avsys_audio_get_route_policy(&route_policy);
-                       
-                               debug_msg ("Current policy is [%d]\n", route_policy);
-                               if (g_device == AVSYS_AUDIO_ROUTE_DEVICE_EARPHONE) {
-                                       debug_msg ("playing device was earjack while policy is not handset only : Do Pause!!!\n");
-                                       if (g_asm_handle ==  -1) {
-                                               debug_msg ("ASM handle is not valid, try to register once more\n");
-
-                                               /* This register should be success */
-                                               if (_asm_register_for_headset (&g_asm_handle)) {
-                                                       debug_msg("_asm_register_for_headset() success\n");
-                                               } else {
-                                                       debug_error("_asm_register_for_headset() failed\n");
-                                               }
-                                       }
-
-                                       debug_warning("Send earphone unplug event to Audio Session Manager Server\n");
-                                       _asm_pause_process(g_asm_handle);
-
-                                       /* FIXME: Check state */
-                                       if (_is_normal_state ()) {
-                                               debug_msg ("Playing device was disconnected, set to default and try to move bt if available\n");
-                                               __set_audio_route(mainloop, context, PULSE_DEFAULT_SINK_BT);
-                                       }
-                               }
-                       }
-               } else if(current_type != EARJACK_EJECTED) { /* INSERT */
-                       debug_msg ("earjack is [INSERTED], device was = %d\n", g_device);
-                       eject_event_count = 0;
-
-                       /* FIXME: Check state */
-                       if (_is_normal_state ()) {
-                               __set_audio_route(mainloop, context, PULSE_DEFAULT_SINK_ALSA);
-                       }
-               }
-
-               //process change
-               err = avsys_audio_earjack_manager_process(current_type);
-               if(err & AVSYS_STATE_ERROR) {
-                       debug_error("Earjack Managing Fatal Error 0x%x\n", err);
-                       if(need_mute) {
-                               if(AVSYS_FAIL(avsys_audio_set_global_mute(AVSYS_AUDIO_UNMUTE_NOLOCK))) {
-                                       debug_error("Set unmute failed\n");
-                               }
-                       }
-#if !defined(_MMFW_I386_ALL_SIMULATOR)
-                       if(AVSYS_FAIL(avsys_audio_earjack_manager_unlock())) {
-                               debug_error("avsys_audio_earjack_manager_unlock() failed in %s\n",__func__);
-                               err = MM_ERROR_SOUND_INTERNAL;
-                               goto fail;
-                       }
-#endif
-                       break;
-               } else if(err & AVSYS_STATE_WARING) {
-                       debug_error("Earjack Managing Warning 0x%x\n", err);
-                       if(need_mute) {
-                               if(AVSYS_FAIL(avsys_audio_set_global_mute(AVSYS_AUDIO_UNMUTE_NOLOCK))) {
-                                       debug_error("Set unmute failed\n");
-                               }
-                       }
-                       
-                       if(AVSYS_FAIL(avsys_audio_earjack_manager_unlock())) {
-                               debug_error("avsys_audio_earjack_manager_unlock() failed in %s\n",__func__);
-                               err = MM_ERROR_SOUND_INTERNAL;
-                               goto fail;
-                       }
-                       continue;
-               }
-
-               /* Unmute if muted */
-               if(need_mute) {
-                       //global unmute
-                       if(AVSYS_FAIL(avsys_audio_set_global_mute(AVSYS_AUDIO_UNMUTE_NOLOCK))) {
-                               debug_error("Set unmute failed\n");
-                       }
-               }
-       
-               if(AVSYS_FAIL(avsys_audio_earjack_manager_unlock())) {
-                       debug_error("avsys_audio_earjack_manager_unlock() failed in %s\n",__func__);
-                       err = MM_ERROR_SOUND_INTERNAL;
-                       goto fail;
-               }
-       } /* while (1) */
-
-       if(!ASM_unregister_sound(g_asm_handle, ASM_EVENT_EARJACK_UNPLUG, &asm_error)) {
-               debug_error("earjack event unregister failed with 0x%x\n", asm_error);
-       }
-       if(AVSYS_FAIL(avsys_audio_earjack_manager_deinit(waitfd))) {
-               err = MM_ERROR_SOUND_INTERNAL;
-               goto fail;
-       }
-
-       return MM_ERROR_NONE;
-
-unlock_and_fail:
-       debug_error("earjack plugin unlock_and_fail\n");
-       pa_threaded_mainloop_unlock(mainloop);
-
-       if(mainloop)
-               pa_threaded_mainloop_stop(mainloop);
-
-       if(context)
-               pa_context_disconnect(context);
-fail:
-       debug_error("earjack plugin fail\n");
-       if(context)
-               pa_context_unref(context);
-
-       if(mainloop)
-               pa_threaded_mainloop_free(mainloop);
-
-       debug_error("earphone plugin exit with 0x%x\n", err);
-
-       return err;
-}
-
-int MMSoundPlugRunHeadsetControlStop(void)
-{
-       ; /* No impl. Don`t stop */
-       return MM_ERROR_NONE;   
-}
-
-int MMSoundPlugRunHeadsetSetThreadPool(int (*func)(void*, void (*)(void*)))
-{
-       debug_enter("(func : %p)\n", func);
-       g_thread_pool_func = func;
-       debug_leave("\n");
-       return MM_ERROR_NONE;
-}
-
-EXPORT_API
-int MMSoundPlugRunGetInterface(mmsound_run_interface_t *intf)
-{
-       debug_enter("\n");
-       intf->run = MMSoundPlugRunHeadsetControlRun;
-       intf->stop = MMSoundPlugRunHeadsetControlStop;
-       intf->SetThreadPool = NULL;
-       debug_leave("\n");
-
-       return MM_ERROR_NONE;
-}
-
-EXPORT_API
-int MMSoundGetPluginType(void)
-{
-       debug_enter("\n");
-       debug_leave("\n");
-       return MM_SOUND_PLUGIN_TYPE_RUN;
-}
-
index 6a9a9cb..77ea6b4 100644 (file)
@@ -45,7 +45,7 @@
 #include "../../include/mm_sound_plugin_codec.h"
 
 #define TIMEOUT_SEC 2
-#define DASF_BUFFER_SIZE 1920
+#define MAX_BUFFER_SIZE 1920
 #define KEYTONE_PATH "/tmp/keytone"            /* Keytone pipe path */
 #define KEYTONE_GROUP  6526                    /* Keytone group : assigned by security */
 #define FILE_FULL_PATH 1024                            /* File path lenth */
@@ -134,9 +134,7 @@ int MMSoundPlugRunKeytoneControlRun(void)
        /* INIT IPC */
        pre_mask = umask(0);
        if (mknod(KEYTONE_PATH,S_IFIFO|0660,0)<0) {
-               if (errno!=EEXIST) {
-                       debug_warning("Already Exist device %s\n", KEYTONE_PATH);
-               }
+               debug_warning ("mknod failed. errno=[%d][%s]\n", errno, strerror(errno));
        }
        umask(pre_mask);
 
@@ -147,9 +145,14 @@ int MMSoundPlugRunKeytoneControlRun(void)
                return MM_ERROR_SOUND_INTERNAL;
        }
 
+       /* change access mode so group can use keytone pipe */
+       if (fchmod (fd, 0660) == -1) {
+               debug_warning("Changing keytone access mode is failed. errno=[%d][%s]\n", errno, strerror(errno));
+       }
+
        /* change group due to security request */
        if (fchown (fd, -1, KEYTONE_GROUP) == -1) {
-               debug_warning("Changing keytone group is failed. errno=[%d]\n", errno);
+               debug_warning("Changing keytone group is failed. errno=[%d][%s]\n", errno, strerror(errno));
        }
 
        /* Init Audio Handle & internal buffer */
@@ -161,7 +164,7 @@ int MMSoundPlugRunKeytoneControlRun(void)
        stop_flag = 1;
        source.ptr = NULL;
 
-       debug_msg("Trace\n");
+       debug_msg("[%s] Trace\n", __func__);
        size = sizeof(ipc_type);
        int once= MMSOUND_TRUE;
        int flag= MMSOUND_FALSE;
@@ -169,16 +172,17 @@ int MMSoundPlugRunKeytoneControlRun(void)
 
        while(stop_flag) {
                memset(&data, 0, sizeof(ipc_type));
-               debug_msg("The Keytone plugin is running\n");
+               debug_msg("[%s] The Keytone plugin is running......\n", __func__);
                ret = read(fd, (void *)&data, size);
                if(ret == -1) {
-                       debug_error("Fail to read file\n");
+                       debug_error("[%s] Fail to read file\n", __func__);
                        continue;
                }
+               debug_msg("[%s] The Keytone plugin is running......READ returns....\n", __func__);
 
                pthread_mutex_lock(&g_keytone.sw_lock);
                g_keytone.vol_type = data.vol_type;
-               debug_log("The volume type is [%d]\n", g_keytone.vol_type);
+               debug_log("[%s] The volume type is [%d]\n", __func__, g_keytone.vol_type);
 
                if (g_keytone.state == RENDER_STARTED) {
                        g_keytone.state = RENDER_STOP;
@@ -226,6 +230,7 @@ int MMSoundPlugRunKeytoneControlRun(void)
                        pthread_cond_signal(&g_keytone.sw_cond);
                }
 
+               debug_log ("[%s] set state to START, unlock \n", __func__);
                g_keytone.state = RENDER_START;
                pthread_mutex_unlock(&g_keytone.sw_lock);
 
@@ -340,8 +345,8 @@ int CreateAudioHandle(mmsound_codec_info_t info)
 
 
        //FIXME :: remove dasf buffer size
-       if(g_keytone.period>DASF_BUFFER_SIZE) {
-               g_keytone.period = DASF_BUFFER_SIZE;
+       if(g_keytone.period>MAX_BUFFER_SIZE) {
+               g_keytone.period = MAX_BUFFER_SIZE;
        }
 
        return err;
@@ -353,7 +358,7 @@ static int _MMSoundKeytoneRender(void *param_not_used)
        //static int IsAmpON = MMSOUND_FALSE; //FIXME :: this should be removed
        MMSourceType source = {0,};
        mmsound_codec_info_t info = {0,};
-       unsigned char *buf = NULL, Outbuf[g_keytone.period];
+       unsigned char *buf = NULL, Outbuf[MAX_BUFFER_SIZE];
        unsigned int size=0;
        buf_param_t *param=NULL;
        struct timespec timeout;
@@ -365,6 +370,7 @@ static int _MMSoundKeytoneRender(void *param_not_used)
        while(stop_flag) {
                pthread_mutex_lock(&g_keytone.sw_lock);
                if(g_keytone.state == RENDER_STOPED) {
+                       debug_log ("[%s] set state to STOPPED_N_WAIT and do cond wait\n", __func__);
                        g_keytone.state = RENDER_STOPED_N_WAIT;
                        pthread_cond_wait(&g_keytone.sw_cond, &g_keytone.sw_lock);
                }
@@ -372,6 +378,7 @@ static int _MMSoundKeytoneRender(void *param_not_used)
                if(g_keytone.state == RENDER_START) {
                        //IsAmpON = MMSOUND_TRUE;
 
+                       debug_log ("[%s] state is START\n", __func__);
                        param = (buf_param_t *)g_keytone.src;
 
                        source = *param->source; /* Copy source */
@@ -395,6 +402,7 @@ static int _MMSoundKeytoneRender(void *param_not_used)
                while(size && stop_flag) {
                        pthread_mutex_lock(&g_keytone.sw_lock);
                        if (g_keytone.state == RENDER_STOP) {
+                               debug_log ("[%s] state is STOP\n", __func__);
                                pthread_mutex_unlock(&g_keytone.sw_lock);
                                break;
                        }
@@ -402,7 +410,7 @@ static int _MMSoundKeytoneRender(void *param_not_used)
 
                        if(size<g_keytone.period) {
 #if defined(_DEBUG_VERBOS_)
-                               debug_msg("[Keysound] Last Buffer :: size=%d,period=%d\n", size, g_keytone.period);
+                               debug_msg("[%s][Keysound] Last Buffer :: size=%d, period=%d\n", __func__, size, g_keytone.period);
 #endif
                                memset(Outbuf, 0, g_keytone.period);
                                memcpy(Outbuf, buf, size);
@@ -415,7 +423,7 @@ static int _MMSoundKeytoneRender(void *param_not_used)
                                size = 0;
                        } else {
 #if defined(_DEBUG_VERBOS_)
-                               debug_msg("[Keysound] size=%d,period=%d\n",size, g_keytone.period);
+                               debug_msg("[%s][Keysound] size=%d, period=%d\n", __func__, size, g_keytone.period);
 #endif
                                memcpy(Outbuf, buf, g_keytone.period);
 
@@ -431,31 +439,27 @@ static int _MMSoundKeytoneRender(void *param_not_used)
 
                pthread_mutex_lock(&g_keytone.sw_lock);
                if(g_keytone.state == RENDER_STOP ) {
+                       debug_msg("[%s] state is STOP, do cond signal \n", __func__);
                        g_keytone.state = RENDER_STOPED;
                        pthread_cond_signal(&g_keytone.sw_cond);
                } else {
+                       debug_msg("[%s] state is not STOP\n", __func__);
                        g_keytone.state = RENDER_COND_TIMED_WAIT;
                        gettimeofday(&tv, NULL);
                        timeout.tv_sec = tv.tv_sec + TIMEOUT_SEC;
                        timeout.tv_nsec = tv.tv_usec;
                        stat = pthread_cond_timedwait(&g_keytone.sw_cond, &g_keytone.sw_lock, &timeout);
                        if(stat == ETIMEDOUT && g_keytone.state != RENDER_START) {
-                               //if(IsAmpON == MMSOUND_TRUE)
-                               {
-                                       debug_msg("close\n");
-                                       if(AVSYS_FAIL(avsys_audio_close(g_keytone.handle)))     {
-                                               debug_critical("avsys_audio_close() failed !!!!!!!!\n");
-                                       }
-
-                                       g_CreatedFlag = MMSOUND_FALSE;
-
-                                       //IsAmpON = MMSOUND_FALSE;
+                               debug_msg("[%s] Do audio handle close and set state to STOPPED\n", __func__);
+                               if(AVSYS_FAIL(avsys_audio_close(g_keytone.handle)))     {
+                                       debug_critical("avsys_audio_close() failed !!!!!!!!\n");
                                }
+
+                               g_CreatedFlag = MMSOUND_FALSE;
                                g_keytone.state = RENDER_STOPED;
-                               pthread_mutex_unlock(&g_keytone.sw_lock);
-                               continue;
                        }
-               }
+               } /* while(stop_flag) */
+
                pthread_mutex_unlock(&g_keytone.sw_lock);
        }
        return MMSOUND_FALSE;
index 8fa117b..b061bdd 100644 (file)
@@ -17,5 +17,5 @@ libsoundplugintone_la_LIBADD += $(AVSYSTEM_LIBS)
 
 install-exec-hook:
        mkdir -p $(DESTDIR)$(libdir)/soundplugins
-       ln -sf /usr/lib/libsoundplugintone.so $(DESTDIR)$(libdir)/soundplugins/libsoundpluginktone.so
+       ln -sf /usr/lib/libsoundplugintone.so $(DESTDIR)$(libdir)/soundplugins/libsoundplugintone.so
 
index 799621d..50f908b 100644 (file)
 #include <mm_error.h>
 #include <mm_debug.h>
 #include <pthread.h>
-#include <mm_sound.h>
-#include <mm_ipc.h>
-
 #include <avsys-audio.h>
 
+#include "../../include/mm_sound.h"
+#include "../../include/mm_ipc.h"
 #include "../../include/mm_sound_thread_pool.h"
 #include "../../include/mm_sound_plugin_codec.h"
 #include "../../../include/mm_sound_private.h"
@@ -290,10 +289,10 @@ int MMSoundPlugCodecWaveCreate(mmsound_codec_param_t *param, mmsound_codec_info_
        audio_param.vol_type = param->volume_table;
        audio_param.channels = info->channels;
        audio_param.samplerate = info->samplerate;
-       if(param->handle_route == MMSOUNDPARAM_FOLLOWING_ROUTE_POLICY)
-               audio_param.bluetooth = AVSYS_AUDIO_HANDLE_ROUTE_FOLLOWING_POLICY;
-       else
-               audio_param.bluetooth = AVSYS_AUDIO_HANDLE_ROUTE_HANDSET_ONLY;
+       if(param->handle_route == MM_SOUND_HANDLE_ROUTE_USING_CURRENT) /* normal, solo */
+               audio_param.handle_route = AVSYS_AUDIO_HANDLE_ROUTE_FOLLOWING_POLICY;
+       else /* loud solo */
+               audio_param.handle_route = AVSYS_AUDIO_HANDLE_ROUTE_HANDSET_ONLY;
        p->handle_route = param->handle_route;
 
        switch(info->format)
@@ -310,7 +309,7 @@ int MMSoundPlugCodecWaveCreate(mmsound_codec_param_t *param, mmsound_codec_info_
        }
 
        debug_msg("[CODEC WAV] PARAM mode : [%d]\n", audio_param.mode);
-       debug_msg("[CODEC WAV] ARAM priority: [%d]\n", audio_param.priority);
+       debug_msg("[CODEC WAV] PARAM priority: [%d]\n", audio_param.priority);
        debug_msg("[CODEC WAV] PARAM channels : [%d]\n", audio_param.channels);
        debug_msg("[CODEC WAV] PARAM samplerate : [%d]\n", audio_param.samplerate);
        debug_msg("[CODEC WAV] PARAM format : [%d]\n", audio_param.format);
@@ -371,14 +370,12 @@ static void _runing(void *param)
        int stop_size;
        char *dummy = NULL;
        int ret;
-       avsys_audio_route_policy_t route_policy = AVSYS_AUDIO_ROUTE_POLICY_DEFAULT;
 
-       debug_enter("[CODEC WAV] (Slot ID %d)\n", p->cb_param);
+       int gain, out, in, option;
+       int gain_after, out_after, in_after, option_after;
 
 
-       if(AVSYS_FAIL(avsys_audio_get_route_policy(&route_policy))) {
-               debug_error("[CODEC WAV] Can not get system audio route policy\n");
-       }
+       debug_enter("[CODEC WAV] (Slot ID %d)\n", p->cb_param);
 
        /* Set the thread schedule */
        org_cur = p->ptr_current;
@@ -403,16 +400,17 @@ static void _runing(void *param)
         */
        switch(p->handle_route)
        {
-       case MMSOUNDPARAM_SPEAKER_ONLY:
-               avsys_audio_set_path_ex(AVSYS_AUDIO_GAIN_EX_AUDIOPLAYER, AVSYS_AUDIO_PATH_EX_SPK, AVSYS_AUDIO_PATH_EX_NONE, AVSYS_AUDIO_PATH_OPTION_NONE);
-               break;
-       case MMSOUNDPARAM_EARPHONE_AUTO:
-               avsys_audio_set_path_ex(AVSYS_AUDIO_GAIN_EX_AUDIOPLAYER, AVSYS_AUDIO_PATH_EX_SPK, AVSYS_AUDIO_PATH_EX_NONE, AVSYS_AUDIO_PATH_OPTION_JACK_AUTO);
-               break;
-       case MMSOUNDPARAM_SPEAKER_WITH_EARPHONE:
-               avsys_audio_set_path_ex(AVSYS_AUDIO_GAIN_EX_AUDIOPLAYER, AVSYS_AUDIO_PATH_EX_SPK, AVSYS_AUDIO_PATH_EX_NONE, AVSYS_AUDIO_PATH_OPTION_DUAL_OUT);
+       case MM_SOUND_HANDLE_ROUTE_SPEAKER:
+               debug_msg("[CODEC WAV] Save backup path\n");
+               avsys_audio_get_path_ex(&gain, &out, &in, &option);
+
+               /* if current out is not speaker, then force set path to speaker */
+               if (out != AVSYS_AUDIO_PATH_EX_SPK) {
+                       debug_msg("[CODEC WAV] current out is not SPEAKER, set path to SPEAKER now!!!\n");
+                       avsys_audio_set_path_ex(AVSYS_AUDIO_GAIN_EX_AUDIOPLAYER, AVSYS_AUDIO_PATH_EX_SPK, AVSYS_AUDIO_PATH_EX_NONE, AVSYS_AUDIO_PATH_OPTION_NONE);
+               }
                break;
-       case MMSOUNDPARAM_FOLLOWING_ROUTE_POLICY:
+       case MM_SOUND_HANDLE_ROUTE_USING_CURRENT:
        default:
                break;
        }
@@ -470,19 +468,18 @@ static void _runing(void *param)
                /*
                 * Restore path here
                 */
-               switch(route_policy)
-               {
-               case AVSYS_AUDIO_ROUTE_POLICY_HANDSET_ONLY:
-                       ret = avsys_audio_set_path_ex(AVSYS_AUDIO_GAIN_EX_AUDIOPLAYER, AVSYS_AUDIO_PATH_EX_SPK, AVSYS_AUDIO_PATH_EX_NONE, AVSYS_AUDIO_PATH_OPTION_NONE);
-                       break;
-               case AVSYS_AUDIO_ROUTE_POLICY_IGNORE_A2DP:
-               case AVSYS_AUDIO_ROUTE_POLICY_DEFAULT:
-               default:
-                       ret = avsys_audio_set_path_ex(AVSYS_AUDIO_GAIN_EX_AUDIOPLAYER, AVSYS_AUDIO_PATH_EX_SPK, AVSYS_AUDIO_PATH_EX_NONE, AVSYS_AUDIO_PATH_OPTION_JACK_AUTO);
-                       break;
-               }
-               if(AVSYS_FAIL(ret)) {
-                       debug_error("[CODEC WAV] Can not restore sound path\n");
+               if (p->handle_route == MM_SOUND_HANDLE_ROUTE_SPEAKER) {
+                       avsys_audio_get_path_ex(&gain_after, &out_after, &in_after, &option_after);
+
+                       /* If current path is not same as before playing sound, restore the sound path */
+                       if (gain_after != gain || out_after != out || in_after != in || option_after != option) {
+
+                               debug_msg("[CODEC WAV] Restore path to previous one\n");
+                               ret = avsys_audio_set_path_ex(gain, out, in, option);
+                               if(AVSYS_FAIL(ret)) {
+                                       debug_error("[CODEC WAV] Can not restore sound path\n");
+                               }
+                       }
                }
 
                ret = avsys_audio_close(p->audio_handle);
old mode 100755 (executable)
new mode 100644 (file)
index a123a3d..8d24e3f
@@ -561,9 +561,6 @@ static void interpret (char *cmd)
                }
                else if (strncmp (cmd, "3",1) == 0) {
                        //dual out
-                       if (mm_sound_set_path(MM_SOUND_GAIN_KEYTONE, MM_SOUND_PATH_SPK, MM_SOUND_PATH_NONE, MM_SOUND_PATH_OPTION_AUTO_HEADSET_CONTROL)<0)
-                               debug_log ("Fail to set sound path !!!\n");
-                       g_print("Set path for auto headset control\n");
                }
                else if (strncmp (cmd, "4",1) == 0) {
                        //recording
@@ -573,9 +570,6 @@ static void interpret (char *cmd)
                }
                else if (strncmp (cmd, "5",1) == 0) {
                        //record release
-                       if (mm_sound_set_path(MM_SOUND_GAIN_VOICEREC, MM_SOUND_PATH_NONE, MM_SOUND_PATH_MIC, MM_SOUND_PATH_OPTION_AUTO_HEADSET_CONTROL)<0)
-                               debug_log ("Fail to set sound path !!!\n");
-                       g_print("Set path for recording with auto earjack control\n");
                }
                else if (strncmp (cmd, "6",1) == 0) {
                        //voice call
@@ -781,7 +775,6 @@ int main(int argc, char *argv[])
        g_volume_type = VOLUME_TYPE_MEDIA;
        mm_sound_volume_get_value(g_volume_type, &g_volume_value);
        mm_sound_volume_add_callback(g_volume_type, volume_change_callback, (void*) &g_volume_type);
-       mm_sound_route_add_change_callback(audio_route_policy_changed_callback, (void*)111);
        displaymenu();
        g_main_loop_run (g_loop);