--- /dev/null
+Seungbae Shin <seungbae.shin at samsung.com>
+Hyunseok Lee <hs7388 at samsung.com>
+Sangchul Lee <sc11.lee at samsung.com>
--- /dev/null
+Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ 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.
+
--- /dev/null
+SUBDIRS = common \
+ pkgconfig \
+ . \
+ server \
+ testsuite
+
+SUBDIRS += init
+
+lib_LTLIBRARIES = libmmfsound.la
+
+includelibmmfsounddir = $(includedir)/mmf
+includelibmmfsound_HEADERS = include/mm_sound.h \
+ include/mm_sound_private.h
+
+libmmfsound_la_SOURCES = mm_sound.c \
+ mm_sound_client.c
+
+libmmfsound_la_DEPENDENCIES = common/libmmfsoundcommon.la
+
+
+libmmfsound_la_CFLAGS = -I$(srcdir)/include \
+ $(MMCOMMON_CFLAGS) \
+ $(VCONF_CFLAGS) \
+ -I$(srcdir)/servertype/include \
+ $(AVSYSTEM_CFLAGS) \
+ $(GLIB2_CFLAGS) \
+ $(MMSESSION_CFLAGS) \
+ $(AUDIOSESSIONMGR_CFLAGS) \
+ -D_USE_INTERNAL_SOUND_PATH_ \
+ $(VCONF_CFLAGS)
+
+if USE_PULSE
+libmmfsound_la_CFLAGS += -DPULSE_CLIENT
+endif
+
+
+libmmfsound_la_LIBADD = $(MMCOMMON_LIBS) \
+ $(AVSYSTEM_LIBS) \
+ $(MMSESSION_LIBS) \
+ $(AUDIOSESSIONMGR_LIBS) \
+ $(GLIB2_LIBS) \
+ $(srcdir)/common/libmmfsoundcommon.la \
+ $(VCONF_LIBS)
+
+libmmfsound_la_LDFLAGS = -version-info 1:0:1
+
+#For logmanager
+libmmfsound_la_CFLAGS += $(MMLOGSVR_CFLAGS) -DMMF_LOG_OWNER=0x020 -DMMF_DEBUG_PREFIX=\"MMF-SOUND\"
+libmmfsound_la_LIBADD += $(MMLOGSVR_LIBS)
+
+
+
+
+
+
+
+lib_LTLIBRARIES += libmmfkeysound.la
+
+includelibmmfkeysounddir = $(includedir)/mmf
+
+libmmfkeysound_la_SOURCES = mm_sound_keysound.c
+
+libmmfkeysound_la_CFLAGS = -I$(srcdir)/include \
+ $(MMCOMMON_CFLAGS) \
+ -D_USE_INTERNAL_SOUND_PATH_
+
+libmmfkeysound_la_LIBADD = $(MMCOMMON_LIBS)
+libmmfkeysound_la_CFLAGS += $(MMLOGSVR_CFLAGS) -DMMF_LOG_OWNER=0x020 -DMMF_DEBUG_PREFIX=\"MMF-SOUND\"
+libmmfkeysound_la_LIBADD += $(MMLOGSVR_LIBS)
--- /dev/null
+Copyright (c) Samsung Electronics Co., Ltd. All rights reserved.
+Except as noted, this software is licensed under Apache License, Version 2.
+Please, see the LICENSE file for Apache License terms and conditions.
--- /dev/null
+aclocal
+libtoolize --copy -f
+autoheader
+autoconf
+automake --add-missing --copy --foreign
+#./configure --with-xo-machine=W1
--- /dev/null
+
+lib_LTLIBRARIES = libmmfsoundcommon.la
+
+libmmfsoundcommon_la_SOURCES = mm_ipc.c \
+ mm_sound_utils.c \
+ mm_source.c
+
+#libmmfsoundcommon_la_DEPENDENCIES = $(libdir)/libmmfcommon.la
+
+libmmfsoundcommon_la_CFLAGS = -I$(srcdir)/../include \
+ $(MMCOMMON_CFLAGS) \
+ $(AVSYSTEM_CFLAGS) \
+ $(VCONF_CFLAGS)
+
+libmmfsoundcommon_la_LIBADD = $(MMCOMMON_LIBS) \
+ $(AVSYSTEM_LIBS) \
+ $(VCONF_LIBS)
+
+#libmmfsound_la_LDFLAGS = -version-info 1:0:1
+
+
+#For logmanager
+libmmfsoundcommon_la_CFLAGS += $(MMLOGSVR_CFLAGS) -DMMF_LOG_OWNER=0x020 -DMMF_DEBUG_PREFIX=\"MMF-SOUND\"
+libmmfsoundcommon_la_LIBADD += $(MMLOGSVR_LIBS)
--- /dev/null
+/*
+ * 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 <stdlib.h>
+#include <string.h>
+#include <errno.h>
+
+#include <sys/time.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <semaphore.h>
+#include <fcntl.h>
+#include <unistd.h>
+
+#include <aio.h>
+
+#include <mm_ipc.h>
+#include <mm_error.h>
+#include <mm_debug.h>
+
+#define FIX_PROCESS 1
+
+#include <assert.h>
+#include <sys/ipc.h>
+#include <sys/msg.h>
+
+#include <vconf.h>
+
+#define AUDIO_ROUTE_POLICY_LOCK "audio_route_policy_lock"
+#define LOCK_TIMEOUT_SEC 6
+
+EXPORT_API
+int __mm_sound_lock()
+{
+ sem_t *sem = NULL;
+ int ret;
+ int err = MM_ERROR_NONE;
+ struct timespec wait_time;
+
+ sem = sem_open(AUDIO_ROUTE_POLICY_LOCK, O_CREAT, 0666, 1);
+ if (sem == SEM_FAILED)
+ {
+ debug_error("Semaphore open Fail! (name:%s, %s)\n", AUDIO_ROUTE_POLICY_LOCK, strerror(errno));
+ return MM_ERROR_SOUND_INTERNAL;
+ }
+retry_lock:
+ wait_time.tv_sec = (long int)(time(NULL)) + LOCK_TIMEOUT_SEC;
+ wait_time.tv_nsec = 0;
+ ret = sem_timedwait(sem, &wait_time);
+ if(ret == -1)
+ {
+ switch(errno)
+ {
+ case EINTR:
+ debug_error("Lock RETRY LOCK\n");
+ goto retry_lock;
+ break;
+ case EINVAL:
+ debug_error("Invalid semaphore\n");
+ err = MM_ERROR_SOUND_INTERNAL;
+ break;
+ case EAGAIN:
+ debug_error("EAGAIN\n");
+ err = MM_ERROR_SOUND_INTERNAL;
+ break;
+ case ETIMEDOUT:
+ debug_error("sem_wait leached %d seconds timeout.\n", LOCK_TIMEOUT_SEC);
+ {
+ //Recovery of sem_wait lock....in abnormal condition
+ int sem_value = -1;
+ if(0 == sem_getvalue(sem, &sem_value))
+ {
+ debug_error("%s sem value is %d\n",AUDIO_ROUTE_POLICY_LOCK, sem_value);
+ if(sem_value == 0)
+ {
+ ret = sem_post(sem);
+ if(ret == -1)
+ {
+ debug_error("sem_post error %s : %d\n", AUDIO_ROUTE_POLICY_LOCK, sem_value);
+ }
+ else
+ {
+ debug_error("lock recovery success...try lock again\n");
+ goto retry_lock;
+ }
+ }
+ else
+ {
+ debug_error("sem value is not 0. but failed sem_timedwait so retry.. : %s\n",AUDIO_ROUTE_POLICY_LOCK);
+ usleep(5);
+ goto retry_lock;
+ }
+ }
+ else
+ {
+ debug_error("sem_getvalue failed : %s\n",AUDIO_ROUTE_POLICY_LOCK);
+ }
+ }
+ err = MM_ERROR_SOUND_INTERNAL;
+ break;
+ }
+ }
+ sem_close(sem);
+ return err;
+}
+
+EXPORT_API
+int __mm_sound_unlock()
+{
+ sem_t *sem = NULL;
+ int ret;
+ int err = MM_ERROR_NONE;
+
+ sem = sem_open(AUDIO_ROUTE_POLICY_LOCK, O_CREAT, 0666, 1);
+ if (sem == SEM_FAILED)
+ {
+ debug_error("Semaphore open Fail! (name:%s, errno %d)\n", AUDIO_ROUTE_POLICY_LOCK, errno);
+ return MM_ERROR_SOUND_INTERNAL;
+ }
+
+ ret = sem_post(sem);
+ if (ret == -1)
+ {
+ debug_error("UNLOCK FAIL\n");
+ err = MM_ERROR_SOUND_INTERNAL;
+ }
+
+ sem_close(sem);
+ return err;
+}
+
--- /dev/null
+/*
+ * 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 <unistd.h>
+#include <errno.h>
+
+#include <vconf.h>
+#include <avsys-audio.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_common.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_OUT_DOCK, MM_SOUND_ROUTE_OUT_HDMI, MM_SOUND_ROUTE_OUT_WFD, MM_SOUND_ROUTE_OUT_USB_AUDIO,
+ 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
+};
+
+#define MM_SOUND_DEFAULT_VOLUME_SYSTEM 5
+#define MM_SOUND_DEFAULT_VOLUME_NOTIFICATION 7
+#define MM_SOUND_DEFAULT_VOLUME_ALARAM 6
+#define MM_SOUND_DEFAULT_VOLUME_RINGTONE 13
+#define MM_SOUND_DEFAULT_VOLUME_MEDIA 7
+#define MM_SOUND_DEFAULT_VOLUME_CALL 7
+#define MM_SOUND_DEFAULT_VOLUME_VOIP 7
+#define MM_SOUND_DEFAULT_VOLUME_ANDROID 0
+#define MM_SOUND_DEFAULT_VOLUME_JAVA 11
+static int g_default_volume[VOLUME_TYPE_MAX] = {
+ MM_SOUND_DEFAULT_VOLUME_SYSTEM,
+ MM_SOUND_DEFAULT_VOLUME_NOTIFICATION,
+ MM_SOUND_DEFAULT_VOLUME_ALARAM,
+ MM_SOUND_DEFAULT_VOLUME_RINGTONE,
+ MM_SOUND_DEFAULT_VOLUME_MEDIA,
+ MM_SOUND_DEFAULT_VOLUME_CALL,
+ MM_SOUND_DEFAULT_VOLUME_VOIP,
+ MM_SOUND_DEFAULT_VOLUME_ANDROID,
+ MM_SOUND_DEFAULT_VOLUME_JAVA,
+};
+static char *g_volume_vconf[VOLUME_TYPE_MAX] = {
+ VCONF_KEY_VOLUME_TYPE_SYSTEM, /* VOLUME_TYPE_SYSTEM */
+ VCONF_KEY_VOLUME_TYPE_NOTIFICATION, /* VOLUME_TYPE_NOTIFICATION */
+ VCONF_KEY_VOLUME_TYPE_ALARM, /* VOLUME_TYPE_ALARM */
+ VCONF_KEY_VOLUME_TYPE_RINGTONE, /* VOLUME_TYPE_RINGTONE */
+ VCONF_KEY_VOLUME_TYPE_MEDIA, /* VOLUME_TYPE_MEDIA */
+ VCONF_KEY_VOLUME_TYPE_CALL, /* VOLUME_TYPE_CALL */
+ VCONF_KEY_VOLUME_TYPE_VOIP, /* VOLUME_TYPE_VOIP */
+ VCONF_KEY_VOLUME_TYPE_ANDROID, /* VOLUME_TYPE_FIXED */
+ VCONF_KEY_VOLUME_TYPE_JAVA /* VOLUME_TYPE_EXT_JAVA */
+};
+static char *g_volume_str[VOLUME_TYPE_MAX] = {
+ "SYSTEM",
+ "NOTIFICATION",
+ "ALARM",
+ "RINGTONE",
+ "MEDIA",
+ "CALL",
+ "VOIP",
+ "FIXED",
+ "JAVA",
+};
+
+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 & 0xFFF00;
+ }
+}
+
+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;
+}
+
+EXPORT_API
+int _mm_sound_volume_add_callback(volume_type_t type, void *func, void* user_data)
+{
+ if (vconf_notify_key_changed(g_volume_vconf[type], func, user_data)) {
+ debug_error ("vconf_notify_key_changed failed..\n");
+ return MM_ERROR_SOUND_INTERNAL;
+ }
+
+ return MM_ERROR_NONE;
+}
+
+EXPORT_API
+int _mm_sound_volume_remove_callback(volume_type_t type, void *func)
+{
+ if (vconf_ignore_key_changed(g_volume_vconf[type], func)) {
+ debug_error ("vconf_ignore_key_changed failed..\n");
+ return MM_ERROR_SOUND_INTERNAL;
+ }
+
+ return MM_ERROR_NONE;
+}
+
+EXPORT_API
+int _mm_sound_volume_get_value_by_type(volume_type_t type, unsigned int *value)
+{
+ int vconf_value = 0;
+
+ /* Get volume value from VCONF */
+ if (vconf_get_int(g_volume_vconf[type], &vconf_value)) {
+ debug_error ("vconf_get_int(%s) failed..\n", g_volume_vconf[type]);
+ return MM_ERROR_SOUND_INTERNAL;
+ }
+
+ *value = vconf_value;
+ debug_log("volume_get_value %s %d", g_volume_str[type], *value);
+
+ return MM_ERROR_NONE;
+}
+
+EXPORT_API
+int _mm_sound_volume_set_value_by_type(volume_type_t type, unsigned int value)
+{
+ int vconf_value = 0;
+
+ vconf_value = value;
+ debug_log("volume_set_value %s %d", g_volume_str[type], value);
+
+ /* Set volume value to VCONF */
+ if (vconf_set_int(g_volume_vconf[type], vconf_value)) {
+ debug_error ("vconf_set_int(%s) failed..\n", g_volume_vconf[type]);
+ return MM_ERROR_SOUND_INTERNAL;
+ }
+
+ return MM_ERROR_NONE;
+}
+
+EXPORT_API
+int _mm_sound_volume_get_values_on_bootup(int *values)
+{
+ int i, vconf_value = 0;
+
+ for (i = 0; i < VOLUME_TYPE_MAX; i++) {
+ if (!vconf_get_int(g_volume_vconf[i], &vconf_value)) {
+ values[i] = vconf_value;
+ debug_log("volume_get_value %s %d", g_volume_str[i], values[i]);
+ } else {
+ debug_error ("vconf_get_int(%s) failed..\n", g_volume_vconf[i]);
+ values[i] = g_default_volume[i];
+ vconf_value = values[i];
+ if (vconf_set_int(g_volume_vconf[i], vconf_value)) {
+ debug_error ("vconf_set_int(%s) failed..\n", g_volume_vconf[i]);
+ }
+ }
+ }
+
+ return MM_ERROR_NONE;
+}
+
--- /dev/null
+/*
+ * 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 <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/mman.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+
+#include "mm_types.h"
+#include "mm_debug.h"
+#include "mm_error.h"
+#include "mm_source.h"
+
+
+bool _is_drm_file(
+ const char *filePath
+)
+{
+ if(!filePath || filePath[0] == '\0')
+ {
+ debug_error("invalid argument\n");
+ return false;
+ }
+ char *p = NULL;
+ p = (char*) strrchr(filePath, '.');
+
+ if( p && ((strncasecmp(p, ".odf", 4) == 0) || (strncasecmp(p, ".dcf", 4) == 0) || (strncasecmp(p, ".o4a", 4) == 0) || (strncasecmp(p, ".o4v", 4) == 0)))
+ {
+ return true;
+ }
+ return false;
+}
+
+EXPORT_API
+int mm_source_open_file(const char *filename, MMSourceType *source, int drmsupport)
+{
+ struct stat finfo = {0, };
+ int fd = -1;
+ void *mmap_buf = NULL;
+
+ if(filename == NULL)
+ {
+ debug_error("filename is null\n");
+ return MM_ERROR_SOUND_INVALID_FILE;
+ }
+ if(drmsupport)
+ {
+ if(_is_drm_file(filename))
+ {
+ debug_error("%s is DRM contents\n", filename);
+ return MM_ERROR_SOUND_UNSUPPORTED_MEDIA_TYPE;
+ }
+ }
+
+ fd = open(filename, O_RDONLY);
+ debug_fenter();
+ debug_msg("Open file name is %s\n", filename);
+ unsigned int mediaSize,readSize,offSet=0;
+ char genStr[20],i;
+
+ if (fd == -1)
+ {
+ debug_error("file open fail\n\n");
+ return MM_ERROR_SOUND_INTERNAL;
+ }
+ if (fstat(fd, &finfo) == -1)
+ {
+ debug_error("file get info fail\n");
+ close(fd);
+ return MM_ERROR_SOUND_INTERNAL;
+ }
+
+ mediaSize = (unsigned int)finfo.st_size;
+
+ {
+ /* get the extension (3 characters from last including NULL)*/
+ strncpy((void *)genStr,(void *)(filename+(strlen(filename)-2)),3);
+
+ debug_msg("ExtName of the Sound file %s\n",genStr);
+
+
+ if(strcasecmp (genStr, "dm") == 0)
+ {
+ debug_msg("It is DM file going ahead with special decoding\n");
+
+ /* Vlidation of the DM file */
+ readSize = read(fd,(void*)genStr,0x8);
+ if(readSize != 0x8)
+ {
+ debug_error("Error in Reading the file Header %x/0x8\n",readSize);
+ return MM_ERROR_SOUND_INTERNAL;
+ }
+
+ genStr[readSize] ='\0';
+
+ debug_msg("Header details of DM file %s\n",genStr);
+
+ if(strcasecmp (genStr, "--random") != 0)
+ {
+ debug_error("It is not a valied DM file");
+ return MM_ERROR_SOUND_INTERNAL;
+ }
+
+ /*checking the Media Type */
+ readSize = lseek(fd, 0x32, SEEK_SET);
+ if(readSize != 0x32)
+ {
+ debug_error("Error in Seeking the file to offset %x/0x32\n",readSize);
+ return MM_ERROR_SOUND_INTERNAL;
+ }
+
+ readSize = read(fd,(void*)genStr,0xf);
+
+ for(i=0;i<0xf;i++)
+ {
+ if(genStr[i] == (char)0xD)
+ {
+ genStr[i] ='\0';
+ break;
+ }
+ }
+
+ debug_msg("Header details of DM file %s\n",genStr);
+
+ /*Finding the Media Offset */
+
+ if(strcasecmp (genStr, "audio/mpeg") == 0)
+ {
+ offSet = 0x63;
+ }
+ else if(strcasecmp (genStr, "audio/wav") == 0)
+ {
+ offSet = 0x62;
+ }
+ else
+ {
+ debug_error("It is not MP3/Wav DM file \n");
+ return MM_ERROR_SOUND_INTERNAL;
+ }
+
+ /*Finding the Media Size */
+
+ mediaSize -= (offSet + 0x28);
+
+ /*Seeking the file to start */
+ readSize = lseek(fd, 0x0, SEEK_SET);
+
+ if( readSize != 0x0)
+ {
+ debug_error("Error in Seeking the file to offset %x/0x32\n",readSize);
+ return MM_ERROR_SOUND_INTERNAL;
+ }
+
+ }
+ else
+ {
+ debug_msg("It is NON DM file going ahead with normal decoding\n");
+ }
+ }
+
+ mmap_buf = mmap(0, finfo.st_size, PROT_READ, MAP_SHARED, fd,0);
+
+ if (mmap_buf == NULL)
+ {
+ debug_error("MMAP fail\n");
+ close(fd);
+ return MM_ERROR_SOUND_INTERNAL;
+ }
+ source->ptr = mmap_buf+offSet;
+ source->medOffset = offSet;
+ debug_msg("source ptr = %p\n", source->ptr);
+ debug_msg("Med Offset Size : %d",source->medOffset);
+ source->tot_size = finfo.st_size;
+ source->cur_size = mediaSize;
+ source->type = MM_SOURCE_FILE;
+ source->fd = fd;
+
+ return MM_ERROR_NONE;
+}
+
+EXPORT_API
+int mm_source_open_full_memory(const void *ptr, int totsize, int alloc, MMSourceType *source)
+{
+ int err = MM_ERROR_NONE;
+ if (ptr == NULL)
+ {
+ debug_error("PTR is NULL\n");
+ return MM_ERROR_INVALID_ARGUMENT;
+ }
+ if (alloc)
+ {
+ err = mm_source_open_memory(ptr, totsize, totsize, source);
+ }
+ else
+ {
+ source->ptr = ptr;
+ source->tot_size = totsize;
+ source->cur_size = totsize;
+
+ source->type = MM_SOURCE_MEMORY_NOTALLOC;
+ source->fd = -1;
+ }
+ return err;
+}
+
+EXPORT_API
+int mm_source_open_memory(const void *ptr, int totsize, int size, MMSourceType *source)
+{
+ source->ptr = (unsigned char*) malloc(totsize);
+ if (source->ptr == NULL)
+ {
+ debug_error("memory alloc fail\n");
+ return MM_ERROR_SOUND_NO_FREE_SPACE;
+ }
+ source->tot_size = totsize;
+ source->cur_size = 0;
+ source->type = MM_SOURCE_MEMORY;
+ source->fd = -1;
+
+ return mm_source_append_memory(ptr, size, source);
+}
+
+EXPORT_API
+int mm_source_append_memory(const void *ptr, int size, MMSourceType *source)
+{
+ if (source->cur_size + size > source->tot_size)
+ {
+ debug_error("memory too large\n");
+ return MM_ERROR_SOUND_NO_FREE_SPACE;
+ }
+
+ memcpy(source->ptr + source->cur_size, ptr, size);
+ source->cur_size += size;
+ return MM_ERROR_NONE;
+}
+
+EXPORT_API
+int mm_source_close(MMSourceType *source)
+{
+ debug_fenter();
+
+ ////PREVENT
+ if(source == NULL)
+ {
+ debug_critical("source is null %s\n", __func__);
+ return MM_ERROR_CLASS;
+ }
+ /////
+ debug_msg("Source type = %d\n", source->type);
+ switch(source->type)
+ {
+ case MM_SOURCE_FILE:
+ if(source->ptr != NULL)
+ {
+ source->ptr -= source->medOffset;
+ debug_msg("Med Offset Size : %d/%d",source->medOffset,source->tot_size);
+ if (munmap(source->ptr, source->tot_size) == -1) {
+ debug_error("MEM UNMAP fail\n\n");
+ }
+ }
+ close(source->fd);
+ break;
+ case MM_SOURCE_MEMORY:
+ if(source->ptr != NULL)
+ free(source->ptr);
+ break;
+ case MM_SOURCE_MEMORY_NOTALLOC:
+ break;
+ default:
+ debug_critical("Unknown Source\n");
+ break;
+ }
+ memset(source, 0, sizeof(MMSourceType));
+ return MM_ERROR_NONE;
+}
+
--- /dev/null
+#! /bin/sh
+# Guess values for system-dependent variables and create Makefiles.
+# 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, 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. ##
+## -------------------- ##
+
+# Be more Bourne compatible
+DUALCASE=1; export DUALCASE # for MKS sh
+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_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
+ 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
+ export as_echo_body
+ as_echo='sh -c $as_echo_body as_echo'
+fi
+
+# 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
+
+
+# IFS
+# We need space, tab and new line, in precisely that order. Quoting is
+# 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.)
+IFS=" "" $as_nl"
+
+# Find who we are. Look in the path if we contain no directory separator.
+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
+IFS=$as_save_IFS
+
+ ;;
+esac
+# We did not find ourselves, most probably we were run as `sh COMMAND'
+# in which case we are not to be found in the path.
+if test "x$as_myself" = x; then
+ as_myself=$0
+fi
+if test ! -f "$as_myself"; then
+ $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
+ exit 1
+fi
+
+# 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.
+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
+ 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_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
+ 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
+
+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
+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
+
+
+ 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; }
+
+ # 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
+}
+
+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
+
+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
+ 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='mkdir -p "$as_dir"'
+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
+
+ECHO=${lt_ECHO-echo}
+if test "X$1" = X--no-reexec; then
+ # Discard the --no-reexec flag, and continue.
+ shift
+elif test "X$1" = X--fallback-echo; then
+ # Avoid inline document here, it may be left over
+ :
+elif test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' ; then
+ # Yippee, $ECHO works!
+ :
+else
+ # Restart under the correct shell.
+ exec $SHELL "$0" --no-reexec ${1+"$@"}
+fi
+
+if test "X$1" = X--fallback-echo; then
+ # used as fallback echo
+ shift
+ cat <<_LT_EOF
+$*
+_LT_EOF
+ exit 0
+fi
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+if test -z "$lt_ECHO"; then
+ if test "X${echo_test_string+set}" != Xset; then
+ # find a string as large as possible, as long as the shell can cope with it
+ for cmd in 'sed 50q "$0"' 'sed 20q "$0"' 'sed 10q "$0"' 'sed 2q "$0"' 'echo test'; do
+ # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ...
+ if { echo_test_string=`eval $cmd`; } 2>/dev/null &&
+ { test "X$echo_test_string" = "X$echo_test_string"; } 2>/dev/null
+ then
+ break
+ fi
+ done
+ fi
+
+ if test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' &&
+ echo_testing_string=`{ $ECHO "$echo_test_string"; } 2>/dev/null` &&
+ test "X$echo_testing_string" = "X$echo_test_string"; then
+ :
+ else
+ # The Solaris, AIX, and Digital Unix default echo programs unquote
+ # backslashes. This makes it impossible to quote backslashes using
+ # echo "$something" | sed 's/\\/\\\\/g'
+ #
+ # So, first we look for a working echo in the user's PATH.
+
+ lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+ for dir in $PATH /usr/ucb; do
+ IFS="$lt_save_ifs"
+ if (test -f $dir/echo || test -f $dir/echo$ac_exeext) &&
+ test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' &&
+ echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` &&
+ test "X$echo_testing_string" = "X$echo_test_string"; then
+ ECHO="$dir/echo"
+ break
+ fi
+ done
+ IFS="$lt_save_ifs"
+
+ if test "X$ECHO" = Xecho; then
+ # We didn't find a better echo, so look for alternatives.
+ if test "X`{ print -r '\t'; } 2>/dev/null`" = 'X\t' &&
+ echo_testing_string=`{ print -r "$echo_test_string"; } 2>/dev/null` &&
+ test "X$echo_testing_string" = "X$echo_test_string"; then
+ # This shell has a builtin print -r that does the trick.
+ ECHO='print -r'
+ elif { test -f /bin/ksh || test -f /bin/ksh$ac_exeext; } &&
+ test "X$CONFIG_SHELL" != X/bin/ksh; then
+ # If we have ksh, try running configure again with it.
+ ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
+ export ORIGINAL_CONFIG_SHELL
+ CONFIG_SHELL=/bin/ksh
+ export CONFIG_SHELL
+ exec $CONFIG_SHELL "$0" --no-reexec ${1+"$@"}
+ else
+ # Try using printf.
+ ECHO='printf %s\n'
+ if test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' &&
+ echo_testing_string=`{ $ECHO "$echo_test_string"; } 2>/dev/null` &&
+ test "X$echo_testing_string" = "X$echo_test_string"; then
+ # Cool, printf works
+ :
+ elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "$0" --fallback-echo '\t') 2>/dev/null` &&
+ test "X$echo_testing_string" = 'X\t' &&
+ echo_testing_string=`($ORIGINAL_CONFIG_SHELL "$0" --fallback-echo "$echo_test_string") 2>/dev/null` &&
+ test "X$echo_testing_string" = "X$echo_test_string"; then
+ CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL
+ export CONFIG_SHELL
+ SHELL="$CONFIG_SHELL"
+ export SHELL
+ ECHO="$CONFIG_SHELL $0 --fallback-echo"
+ elif echo_testing_string=`($CONFIG_SHELL "$0" --fallback-echo '\t') 2>/dev/null` &&
+ test "X$echo_testing_string" = 'X\t' &&
+ echo_testing_string=`($CONFIG_SHELL "$0" --fallback-echo "$echo_test_string") 2>/dev/null` &&
+ test "X$echo_testing_string" = "X$echo_test_string"; then
+ ECHO="$CONFIG_SHELL $0 --fallback-echo"
+ else
+ # maybe with a smaller string...
+ prev=:
+
+ for cmd in 'echo test' 'sed 2q "$0"' 'sed 10q "$0"' 'sed 20q "$0"' 'sed 50q "$0"'; do
+ if { test "X$echo_test_string" = "X`eval $cmd`"; } 2>/dev/null
+ then
+ break
+ fi
+ prev="$cmd"
+ done
+
+ if test "$prev" != 'sed 50q "$0"'; then
+ echo_test_string=`eval $prev`
+ export echo_test_string
+ exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "$0" ${1+"$@"}
+ else
+ # Oops. We lost completely, so just stick with echo.
+ ECHO=echo
+ fi
+ fi
+ fi
+ fi
+ fi
+fi
+
+# Copy echo and quote the copy suitably for passing to libtool from
+# the Makefile, instead of quoting the original, which is used later.
+lt_ECHO=$ECHO
+if test "X$lt_ECHO" = "X$CONFIG_SHELL $0 --fallback-echo"; then
+ lt_ECHO="$CONFIG_SHELL \\\$\$0 --fallback-echo"
+fi
+
+
+
+
+test -n "$DJDIR" || exec 7<&0 </dev/null
+exec 6>&1
+
+# Name of the host.
+# 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`
+
+#
+# Initializations.
+#
+ac_default_prefix=/usr/local
+ac_clean_files=
+ac_config_libobj_dir=.
+LIBOBJS=
+cross_compiling=no
+subdirs=
+MFLAGS=
+MAKEFLAGS=
+
+# Identity of this package.
+PACKAGE_NAME='avsystem'
+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>
+#ifdef HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+#ifdef HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+#ifdef STDC_HEADERS
+# include <stdlib.h>
+# include <stddef.h>
+#else
+# ifdef HAVE_STDLIB_H
+# include <stdlib.h>
+# endif
+#endif
+#ifdef HAVE_STRING_H
+# if !defined STDC_HEADERS && defined HAVE_MEMORY_H
+# include <memory.h>
+# endif
+# include <string.h>
+#endif
+#ifdef HAVE_STRINGS_H
+# include <strings.h>
+#endif
+#ifdef HAVE_INTTYPES_H
+# include <inttypes.h>
+#endif
+#ifdef HAVE_STDINT_H
+# include <stdint.h>
+#endif
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif"
+
+ac_subst_vars='am__EXEEXT_FALSE
+am__EXEEXT_TRUE
+LTLIBOBJS
+ALLOCA
+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
+CC
+CFLAGS
+LDFLAGS
+LIBS
+CPPFLAGS
+CPP
+PKG_CONFIG
+PKG_CONFIG_PATH
+PKG_CONFIG_LIBDIR
+AVSYSTEM_CFLAGS
+AVSYSTEM_LIBS
+MMCOMMON_CFLAGS
+MMCOMMON_LIBS
+MMLOG_CFLAGS
+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
+exec_prefix=NONE
+no_create=
+no_recursion=
+prefix=NONE
+program_prefix=NONE
+program_suffix=NONE
+program_transform_name=s,x,x,
+silent=
+site=
+srcdir=
+verbose=
+x_includes=NONE
+x_libraries=NONE
+
+# Installation directory options.
+# These are left unexpanded so users can "make install exec_prefix=/foo"
+# and all the variables that are supposed to be based on exec_prefix
+# by default will actually change.
+# Use braces instead of parens because sh, perl, etc. also accept them.
+# (The list follows the same order as the GNU Coding Standards.)
+bindir='${exec_prefix}/bin'
+sbindir='${exec_prefix}/sbin'
+libexecdir='${exec_prefix}/libexec'
+datarootdir='${prefix}/share'
+datadir='${datarootdir}'
+sysconfdir='${prefix}/etc'
+sharedstatedir='${prefix}/com'
+localstatedir='${prefix}/var'
+includedir='${prefix}/include'
+oldincludedir='/usr/include'
+docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
+infodir='${datarootdir}/info'
+htmldir='${docdir}'
+dvidir='${docdir}'
+pdfdir='${docdir}'
+psdir='${docdir}'
+libdir='${exec_prefix}/lib'
+localedir='${datarootdir}/locale'
+mandir='${datarootdir}/man'
+
+ac_prev=
+ac_dashdash=
+for ac_option
+do
+ # If the previous option needs an argument, assign it.
+ if test -n "$ac_prev"; then
+ eval $ac_prev=\$ac_option
+ ac_prev=
+ continue
+ fi
+
+ case $ac_option in
+ *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;;
+ *=) ac_optarg= ;;
+ *) ac_optarg=yes ;;
+ esac
+
+ # Accept the important Cygnus configure options, so we can diagnose typos.
+
+ case $ac_dashdash$ac_option in
+ --)
+ ac_dashdash=yes ;;
+
+ -bindir | --bindir | --bindi | --bind | --bin | --bi)
+ ac_prev=bindir ;;
+ -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
+ bindir=$ac_optarg ;;
+
+ -build | --build | --buil | --bui | --bu)
+ ac_prev=build_alias ;;
+ -build=* | --build=* | --buil=* | --bui=* | --bu=*)
+ build_alias=$ac_optarg ;;
+
+ -cache-file | --cache-file | --cache-fil | --cache-fi \
+ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
+ ac_prev=cache_file ;;
+ -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
+ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
+ cache_file=$ac_optarg ;;
+
+ --config-cache | -C)
+ cache_file=config.cache ;;
+
+ -datadir | --datadir | --datadi | --datad)
+ ac_prev=datadir ;;
+ -datadir=* | --datadir=* | --datadi=* | --datad=*)
+ datadir=$ac_optarg ;;
+
+ -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \
+ | --dataroo | --dataro | --datar)
+ ac_prev=datarootdir ;;
+ -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \
+ | --dataroot=* | --dataroo=* | --dataro=* | --datar=*)
+ datarootdir=$ac_optarg ;;
+
+ -disable-* | --disable-*)
+ ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
+ # Reject names that are not valid shell variable names.
+ 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 ;;
+ -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*)
+ docdir=$ac_optarg ;;
+
+ -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv)
+ ac_prev=dvidir ;;
+ -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*)
+ dvidir=$ac_optarg ;;
+
+ -enable-* | --enable-*)
+ ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
+ # Reject names that are not valid shell variable names.
+ 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- \
+ | --exec | --exe | --ex)
+ ac_prev=exec_prefix ;;
+ -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
+ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
+ | --exec=* | --exe=* | --ex=*)
+ exec_prefix=$ac_optarg ;;
+
+ -gas | --gas | --ga | --g)
+ # Obsolete; use --with-gas.
+ with_gas=yes ;;
+
+ -help | --help | --hel | --he | -h)
+ ac_init_help=long ;;
+ -help=r* | --help=r* | --hel=r* | --he=r* | -hr*)
+ ac_init_help=recursive ;;
+ -help=s* | --help=s* | --hel=s* | --he=s* | -hs*)
+ ac_init_help=short ;;
+
+ -host | --host | --hos | --ho)
+ ac_prev=host_alias ;;
+ -host=* | --host=* | --hos=* | --ho=*)
+ host_alias=$ac_optarg ;;
+
+ -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht)
+ ac_prev=htmldir ;;
+ -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \
+ | --ht=*)
+ htmldir=$ac_optarg ;;
+
+ -includedir | --includedir | --includedi | --included | --include \
+ | --includ | --inclu | --incl | --inc)
+ ac_prev=includedir ;;
+ -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
+ | --includ=* | --inclu=* | --incl=* | --inc=*)
+ includedir=$ac_optarg ;;
+
+ -infodir | --infodir | --infodi | --infod | --info | --inf)
+ ac_prev=infodir ;;
+ -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
+ infodir=$ac_optarg ;;
+
+ -libdir | --libdir | --libdi | --libd)
+ ac_prev=libdir ;;
+ -libdir=* | --libdir=* | --libdi=* | --libd=*)
+ libdir=$ac_optarg ;;
+
+ -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
+ | --libexe | --libex | --libe)
+ ac_prev=libexecdir ;;
+ -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
+ | --libexe=* | --libex=* | --libe=*)
+ libexecdir=$ac_optarg ;;
+
+ -localedir | --localedir | --localedi | --localed | --locale)
+ ac_prev=localedir ;;
+ -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*)
+ localedir=$ac_optarg ;;
+
+ -localstatedir | --localstatedir | --localstatedi | --localstated \
+ | --localstate | --localstat | --localsta | --localst | --locals)
+ ac_prev=localstatedir ;;
+ -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
+ | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*)
+ localstatedir=$ac_optarg ;;
+
+ -mandir | --mandir | --mandi | --mand | --man | --ma | --m)
+ ac_prev=mandir ;;
+ -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
+ mandir=$ac_optarg ;;
+
+ -nfp | --nfp | --nf)
+ # Obsolete; use --without-fp.
+ with_fp=no ;;
+
+ -no-create | --no-create | --no-creat | --no-crea | --no-cre \
+ | --no-cr | --no-c | -n)
+ no_create=yes ;;
+
+ -no-recursion | --no-recursion | --no-recursio | --no-recursi \
+ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
+ no_recursion=yes ;;
+
+ -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \
+ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \
+ | --oldin | --oldi | --old | --ol | --o)
+ ac_prev=oldincludedir ;;
+ -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
+ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
+ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
+ oldincludedir=$ac_optarg ;;
+
+ -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
+ ac_prev=prefix ;;
+ -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
+ prefix=$ac_optarg ;;
+
+ -program-prefix | --program-prefix | --program-prefi | --program-pref \
+ | --program-pre | --program-pr | --program-p)
+ ac_prev=program_prefix ;;
+ -program-prefix=* | --program-prefix=* | --program-prefi=* \
+ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
+ program_prefix=$ac_optarg ;;
+
+ -program-suffix | --program-suffix | --program-suffi | --program-suff \
+ | --program-suf | --program-su | --program-s)
+ ac_prev=program_suffix ;;
+ -program-suffix=* | --program-suffix=* | --program-suffi=* \
+ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
+ program_suffix=$ac_optarg ;;
+
+ -program-transform-name | --program-transform-name \
+ | --program-transform-nam | --program-transform-na \
+ | --program-transform-n | --program-transform- \
+ | --program-transform | --program-transfor \
+ | --program-transfo | --program-transf \
+ | --program-trans | --program-tran \
+ | --progr-tra | --program-tr | --program-t)
+ ac_prev=program_transform_name ;;
+ -program-transform-name=* | --program-transform-name=* \
+ | --program-transform-nam=* | --program-transform-na=* \
+ | --program-transform-n=* | --program-transform-=* \
+ | --program-transform=* | --program-transfor=* \
+ | --program-transfo=* | --program-transf=* \
+ | --program-trans=* | --program-tran=* \
+ | --progr-tra=* | --program-tr=* | --program-t=*)
+ program_transform_name=$ac_optarg ;;
+
+ -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd)
+ ac_prev=pdfdir ;;
+ -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*)
+ pdfdir=$ac_optarg ;;
+
+ -psdir | --psdir | --psdi | --psd | --ps)
+ ac_prev=psdir ;;
+ -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*)
+ psdir=$ac_optarg ;;
+
+ -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+ | -silent | --silent | --silen | --sile | --sil)
+ silent=yes ;;
+
+ -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
+ ac_prev=sbindir ;;
+ -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
+ | --sbi=* | --sb=*)
+ sbindir=$ac_optarg ;;
+
+ -sharedstatedir | --sharedstatedir | --sharedstatedi \
+ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \
+ | --sharedst | --shareds | --shared | --share | --shar \
+ | --sha | --sh)
+ ac_prev=sharedstatedir ;;
+ -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \
+ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
+ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
+ | --sha=* | --sh=*)
+ sharedstatedir=$ac_optarg ;;
+
+ -site | --site | --sit)
+ ac_prev=site ;;
+ -site=* | --site=* | --sit=*)
+ site=$ac_optarg ;;
+
+ -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
+ ac_prev=srcdir ;;
+ -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
+ srcdir=$ac_optarg ;;
+
+ -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
+ | --syscon | --sysco | --sysc | --sys | --sy)
+ ac_prev=sysconfdir ;;
+ -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
+ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
+ sysconfdir=$ac_optarg ;;
+
+ -target | --target | --targe | --targ | --tar | --ta | --t)
+ ac_prev=target_alias ;;
+ -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
+ target_alias=$ac_optarg ;;
+
+ -v | -verbose | --verbose | --verbos | --verbo | --verb)
+ verbose=yes ;;
+
+ -version | --version | --versio | --versi | --vers | -V)
+ ac_init_version=: ;;
+
+ -with-* | --with-*)
+ ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
+ # Reject names that are not valid shell variable names.
+ 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_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'`
+ # Reject names that are not valid shell variable names.
+ 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.
+ with_x=yes ;;
+
+ -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
+ | --x-incl | --x-inc | --x-in | --x-i)
+ ac_prev=x_includes ;;
+ -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
+ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
+ x_includes=$ac_optarg ;;
+
+ -x-libraries | --x-libraries | --x-librarie | --x-librari \
+ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
+ ac_prev=x_libraries ;;
+ -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
+ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
+ x_libraries=$ac_optarg ;;
+
+ -*) 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.
+ 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.
+ $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2
+ expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null &&
+ $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2
+ : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}
+ ;;
+
+ esac
+done
+
+if test -n "$ac_prev"; then
+ ac_option=--`echo $ac_prev | sed 's/_/-/g'`
+ 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
+
+# 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
+ 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'
+# used to hold the argument of --host etc.
+# FIXME: To remove some day.
+build=$build_alias
+host=$host_alias
+target=$target_alias
+
+# FIXME: To remove some day.
+if test "x$host_alias" != x; then
+ if test "x$build_alias" = x; then
+ cross_compiling=maybe
+ $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
+fi
+
+ac_tool_prefix=
+test -n "$host_alias" && ac_tool_prefix=$host_alias-
+
+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 .` ||
+ as_fn_error $? "working directory cannot be determined"
+test "X$ac_ls_di" = "X$ac_pwd_ls_di" ||
+ 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 -- "$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
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ srcdir=$ac_confdir
+ if test ! -r "$srcdir/$ac_unique_file"; then
+ srcdir=..
+ fi
+else
+ ac_srcdir_defaulted=no
+fi
+if test ! -r "$srcdir/$ac_unique_file"; then
+ test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .."
+ 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" || as_fn_error $? "$ac_msg"
+ pwd)`
+# When building in place, set srcdir=.
+if test "$ac_abs_confdir" = "$ac_pwd"; then
+ srcdir=.
+fi
+# Remove unnecessary trailing slashes from srcdir.
+# Double slashes in file names in object file debugging info
+# mess up M-x gdb in Emacs.
+case $srcdir in
+*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;;
+esac
+for ac_var in $ac_precious_vars; do
+ eval ac_env_${ac_var}_set=\${${ac_var}+set}
+ eval ac_env_${ac_var}_value=\$${ac_var}
+ eval ac_cv_env_${ac_var}_set=\${${ac_var}+set}
+ eval ac_cv_env_${ac_var}_value=\$${ac_var}
+done
+
+#
+# Report the --help message.
+#
+if test "$ac_init_help" = "long"; then
+ # Omit some internal or obsolete options to make the list less imposing.
+ # This message is too long to be a string in the A/UX 3.1 sh.
+ cat <<_ACEOF
+\`configure' configures avsystem 1.0 to adapt to many kinds of systems.
+
+Usage: $0 [OPTION]... [VAR=VALUE]...
+
+To assign environment variables (e.g., CC, CFLAGS...), specify them as
+VAR=VALUE. See below for descriptions of some of the useful variables.
+
+Defaults for the options are specified in brackets.
+
+Configuration:
+ -h, --help display this help and exit
+ --help=short display options specific to this package
+ --help=recursive display the short help of all the included packages
+ -V, --version display version information and exit
+ -q, --quiet, --silent do not print \`checking ...' messages
+ --cache-file=FILE cache test results in FILE [disabled]
+ -C, --config-cache alias for \`--cache-file=config.cache'
+ -n, --no-create do not create output files
+ --srcdir=DIR find the sources in DIR [configure dir or \`..']
+
+Installation directories:
+ --prefix=PREFIX install architecture-independent files in PREFIX
+ [$ac_default_prefix]
+ --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
+ [PREFIX]
+
+By default, \`make install' will install all the files in
+\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify
+an installation prefix other than \`$ac_default_prefix' using \`--prefix',
+for instance \`--prefix=\$HOME'.
+
+For better control, use the options below.
+
+Fine tuning of the installation directories:
+ --bindir=DIR user executables [EPREFIX/bin]
+ --sbindir=DIR system admin executables [EPREFIX/sbin]
+ --libexecdir=DIR program executables [EPREFIX/libexec]
+ --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
+
+Program names:
+ --program-prefix=PREFIX prepend PREFIX to installed program names
+ --program-suffix=SUFFIX append SUFFIX to installed program names
+ --program-transform-name=PROGRAM run sed PROGRAM on installed program names
+
+System types:
+ --build=BUILD configure for building on BUILD [guessed]
+ --host=HOST cross-compile to build programs to run on HOST [BUILD]
+_ACEOF
+fi
+
+if test -n "$ac_init_help"; then
+ case $ac_init_help in
+ short | recursive ) echo "Configuration of avsystem 1.0:";;
+ esac
+ 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
+ --enable-dependency-tracking do not reject slow dependency extractors
+ --enable-shared[=PKGS] build shared libraries [default=yes]
+ --enable-static[=PKGS] build static libraries [default=yes]
+ --enable-fast-install[=PKGS]
+ optimize for fast installation [default=yes]
+ --disable-libtool-lock avoid locking (might break parallel builds)
+ --enable-sdk sdk build
+ --enable-pulse enable pulseaudio client
+
+Optional Packages:
+ --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
+ --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
+ --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]
+
+Some influential environment variables:
+ CC C compiler command
+ CFLAGS C compiler flags
+ 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 (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
+ linker flags for AVSYSTEM, overriding pkg-config
+ MMCOMMON_CFLAGS
+ C compiler flags for MMCOMMON, overriding pkg-config
+ MMCOMMON_LIBS
+ linker flags for MMCOMMON, overriding pkg-config
+ 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
+
+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" ||
+ { 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=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'`
+ # A ".." for each directory in $ac_dir_suffix.
+ 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/ ;;
+ esac ;;
+esac
+ac_abs_top_builddir=$ac_pwd
+ac_abs_builddir=$ac_pwd$ac_dir_suffix
+# for backward compatibility:
+ac_top_builddir=$ac_top_build_prefix
+
+case $srcdir in
+ .) # We are building in place.
+ ac_srcdir=.
+ ac_top_srcdir=$ac_top_builddir_sub
+ ac_abs_top_srcdir=$ac_pwd ;;
+ [\\/]* | ?:[\\/]* ) # Absolute name.
+ ac_srcdir=$srcdir$ac_dir_suffix;
+ ac_top_srcdir=$srcdir
+ ac_abs_top_srcdir=$srcdir ;;
+ *) # Relative name.
+ ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
+ ac_top_srcdir=$ac_top_build_prefix$srcdir
+ ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
+esac
+ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
+
+ cd "$ac_dir" || { ac_status=$?; continue; }
+ # Check for guested configure.
+ if test -f "$ac_srcdir/configure.gnu"; then
+ echo &&
+ $SHELL "$ac_srcdir/configure.gnu" --help=recursive
+ elif test -f "$ac_srcdir/configure"; then
+ echo &&
+ $SHELL "$ac_srcdir/configure" --help=recursive
+ else
+ $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2
+ fi || ac_status=$?
+ cd "$ac_pwd" || { ac_status=$?; break; }
+ done
+fi
+
+test -n "$ac_init_help" && exit $ac_status
+if $ac_init_version; then
+ cat <<\_ACEOF
+avsystem configure 1.0
+generated by GNU Autoconf 2.67
+
+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
+
+## ------------------------ ##
+## Autoconf initialization. ##
+## ------------------------ ##
+
+# ac_fn_c_try_compile LINENO
+# --------------------------
+# Try to compile conftest.$ac_ext, and return whether this succeeded.
+ac_fn_c_try_compile ()
+{
+ 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
+
+ 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_compile
+
+# 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;}
+
+} # ac_fn_c_check_header_compile
+
+# 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
+
+ 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
+
+# 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
+
+ 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.
+# Strip out --no-create and --no-recursion so they do not pile up.
+# Strip out --silent because we don't want to record it for future runs.
+# Also quote any args containing shell meta-characters.
+# Make two passes to allow for proper duplicate-argument suppression.
+ac_configure_args=
+ac_configure_args0=
+ac_configure_args1=
+ac_must_keep_next=false
+for ac_pass in 1 2
+do
+ for ac_arg
+ do
+ case $ac_arg in
+ -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;;
+ -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+ | -silent | --silent | --silen | --sile | --sil)
+ continue ;;
+ *\'*)
+ ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
+ esac
+ case $ac_pass in
+ 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;;
+ 2)
+ 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
+ case $ac_arg in
+ *=* | --config-cache | -C | -disable-* | --disable-* \
+ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \
+ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \
+ | -with-* | --with-* | -without-* | --without-* | --x)
+ case "$ac_configure_args0 " in
+ "$ac_configure_args1"*" '$ac_arg' "* ) continue ;;
+ esac
+ ;;
+ -* ) ac_must_keep_next=true ;;
+ esac
+ fi
+ as_fn_append ac_configure_args " '$ac_arg'"
+ ;;
+ esac
+ done
+done
+{ 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
+# would cause problems or look ugly.
+# WARNING: Use '\'' to represent an apostrophe within the trap.
+# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug.
+trap 'exit_status=$?
+ # Save into config.log some information that might help in debugging.
+ {
+ echo
+
+ $as_echo "## ---------------- ##
+## Cache variables. ##
+## ---------------- ##"
+ echo
+ # The following way of writing the cache mishandles newlines in values,
+(
+ for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do
+ eval ac_val=\$$ac_var
+ case $ac_val in #(
+ *${as_nl}*)
+ case $ac_var in #(
+ *_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) ;; #(
+ BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #(
+ *) { eval $ac_var=; unset $ac_var;} ;;
+ esac ;;
+ esac
+ done
+ (set) 2>&1 |
+ case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #(
+ *${as_nl}ac_space=\ *)
+ sed -n \
+ "s/'\''/'\''\\\\'\'''\''/g;
+ s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p"
+ ;; #(
+ *)
+ sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
+ ;;
+ esac |
+ sort
+)
+ echo
+
+ $as_echo "## ----------------- ##
+## Output variables. ##
+## ----------------- ##"
+ echo
+ for ac_var in $ac_subst_vars
+ do
+ eval ac_val=\$$ac_var
+ case $ac_val in
+ *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
+ esac
+ $as_echo "$ac_var='\''$ac_val'\''"
+ done | sort
+ echo
+
+ if test -n "$ac_subst_files"; then
+ $as_echo "## ------------------- ##
+## File substitutions. ##
+## ------------------- ##"
+ echo
+ for ac_var in $ac_subst_files
+ do
+ eval ac_val=\$$ac_var
+ case $ac_val in
+ *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
+ esac
+ $as_echo "$ac_var='\''$ac_val'\''"
+ done | sort
+ echo
+ fi
+
+ if test -s confdefs.h; then
+ $as_echo "## ----------- ##
+## confdefs.h. ##
+## ----------- ##"
+ echo
+ cat confdefs.h
+ echo
+ fi
+ test "$ac_signal" != 0 &&
+ $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'; 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 an explicitly selected file to automatically selected ones.
+ac_site_file1=NONE
+ac_site_file2=NONE
+if test -n "$CONFIG_SITE"; then
+ # 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
+ ac_site_file1=$prefix/share/config.site
+ ac_site_file2=$prefix/etc/config.site
+else
+ ac_site_file1=$ac_default_prefix/share/config.site
+ ac_site_file2=$ac_default_prefix/etc/config.site
+fi
+for ac_site_file in "$ac_site_file1" "$ac_site_file2"
+do
+ 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" \
+ || { { $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. 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
+ { $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
+for ac_var in $ac_precious_vars; do
+ eval ac_old_set=\$ac_cv_env_${ac_var}_set
+ eval ac_new_set=\$ac_env_${ac_var}_set
+ eval ac_old_val=\$ac_cv_env_${ac_var}_value
+ eval ac_new_val=\$ac_env_${ac_var}_value
+ case $ac_old_set,$ac_new_set in
+ set,)
+ { $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)
+ { $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
+ # 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=`$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.
+ *) as_fn_append ac_configure_args " '$ac_arg'" ;;
+ esac
+ fi
+done
+if $ac_cache_corrupted; then
+ { $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'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+am__api_version='1.11'
+
+ac_aux_dir=
+for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do
+ if test -f "$ac_dir/install-sh"; then
+ ac_aux_dir=$ac_dir
+ ac_install_sh="$ac_aux_dir/install-sh -c"
+ break
+ elif test -f "$ac_dir/install.sh"; then
+ ac_aux_dir=$ac_dir
+ ac_install_sh="$ac_aux_dir/install.sh -c"
+ break
+ elif test -f "$ac_dir/shtool"; then
+ ac_aux_dir=$ac_dir
+ ac_install_sh="$ac_aux_dir/shtool install -c"
+ break
+ fi
+done
+if test -z "$ac_aux_dir"; then
+ 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,
+# and are intended to be withdrawn in a future Autoconf release.
+# They can cause serious problems if a builder's source tree is in a directory
+# whose full name contains unusual characters.
+ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var.
+ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var.
+ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var.
+
+
+# Find a good install program. We prefer a C program (faster),
+# so one script is as good as another. But avoid the broken or
+# incompatible versions:
+# SysV /etc/install, /usr/sbin/install
+# SunOS /usr/etc/install
+# IRIX /sbin/install
+# AIX /bin/install
+# AmigaOS /C/install, which installs bootblocks on floppy discs
+# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
+# AFS /usr/afsws/bin/install, which mishandles nonexistent args
+# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
+# OS/2's system install, which has a completely different semantic
+# ./install, which can be erroneously created by make from ./install.sh.
+# 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 :
+ $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]/* | \
+ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \
+ ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \
+ /usr/ucb/* ) ;;
+ *)
+ # OSF1 and SCO ODT 3.0 have their own names for install.
+ # Don't use installbsd from OSF since it installs stuff as root
+ # by default.
+ for ac_prog in ginstall scoinst install; do
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then
+ if test $ac_prog = install &&
+ grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+ # AIX install. It has an incompatible calling convention.
+ :
+ elif test $ac_prog = install &&
+ grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+ # program-specific install script used by HP pwplus--don't use.
+ :
+ else
+ 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
+IFS=$as_save_IFS
+
+rm -rf conftest.one conftest.two conftest.dir
+
+fi
+ if test "${ac_cv_path_install+set}" = set; then
+ INSTALL=$ac_cv_path_install
+ else
+ # As a last resort, use the slow shell script. Don't cache a
+ # value for INSTALL 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.
+ INSTALL=$ac_install_sh
+ fi
+fi
+{ $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.
+test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
+
+test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
+
+test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
+
+{ $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`
+ if test "$*" = "X"; then
+ # -L didn't work.
+ set X `ls -t "$srcdir/configure" conftest.file`
+ fi
+ rm -f conftest.file
+ if test "$*" != "X $srcdir/configure conftest.file" \
+ && test "$*" != "X conftest.file $srcdir/configure"; then
+
+ # If neither matched, then we have a broken ls. This can happen
+ # if, for instance, CONFIG_SHELL is bash and it inherits a
+ # broken ls alias from the environment. This has actually
+ # happened. Such a system could not be considered "sane".
+ 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
+ )
+then
+ # Ok.
+ :
+else
+ as_fn_error $? "newly created file is older than distributed files!
+Check your system clock" "$LINENO" 5
+fi
+{ $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 $.
+# By default was `s,x,x', remove it if useless.
+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`
+
+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=
+ { $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
+
+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
+ 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"
+ $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
+ # As a last resort, use the slow shell script. Don't cache a
+ # 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.
+ MKDIR_P="$ac_install_sh -d"
+ fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5
+$as_echo "$MKDIR_P" >&6; }
+
+mkdir_p="$MKDIR_P"
+case $mkdir_p in
+ [\\/$]* | ?:[\\/]*) ;;
+ */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;;
+esac
+
+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
+{ $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.
+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_AWK="$ac_prog"
+ $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
+AWK=$ac_cv_prog_AWK
+if test -n "$AWK"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5
+$as_echo "$AWK" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$AWK" && break
+done
+
+{ $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.
+case `${MAKE-make} -f conftest.make 2>/dev/null` in
+ *@@@%%%=?*=@@@%%%*)
+ eval ac_cv_prog_make_${ac_make}_set=yes;;
+ *)
+ eval ac_cv_prog_make_${ac_make}_set=no;;
+esac
+rm -f conftest.make
+fi
+if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+ SET_MAKE=
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+ SET_MAKE="MAKE=${MAKE-make}"
+fi
+
+rm -rf .tst 2>/dev/null
+mkdir .tst 2>/dev/null
+if test -d .tst; then
+ am__leading_dot=.
+else
+ am__leading_dot=_
+fi
+rmdir .tst 2>/dev/null
+
+if test "`cd $srcdir && pwd`" != "`pwd`"; then
+ # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
+ # is not polluted with repeated "-I."
+ am__isrc=' -I$(srcdir)'
+ # test to see if srcdir already configured
+ if test -f $srcdir/config.status; then
+ as_fn_error $? "source directory already configured; run \"make distclean\" there first" "$LINENO" 5
+ fi
+fi
+
+# test whether we have cygpath
+if test -z "$CYGPATH_W"; then
+ if (cygpath --version) >/dev/null 2>/dev/null; then
+ CYGPATH_W='cygpath -w'
+ else
+ CYGPATH_W=echo
+ fi
+fi
+
+
+# Define the identity of the package.
+ PACKAGE='avsystem'
+ VERSION='1.0'
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE "$PACKAGE"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define VERSION "$VERSION"
+_ACEOF
+
+# Some tools Automake needs.
+
+ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"}
+
+
+AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"}
+
+
+AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"}
+
+
+AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"}
+
+
+MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"}
+
+# We need awk for the "check" target. The system "awk" is bad on
+# some platforms.
+# Always define AMTAR for backward compatibility.
+
+AMTAR=${AMTAR-"${am_missing_run}tar"}
+
+am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'
+
+
+
+
+
+ac_config_headers="$ac_config_headers config.h:config.hin"
+
+
+
+
+# Checks for programs.
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}gcc; ac_word=$2
+{ $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.
+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_CC="${ac_tool_prefix}gcc"
+ $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
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_CC"; then
+ ac_ct_CC=$CC
+ # Extract the first word of "gcc", so it can be a program name with args.
+set dummy gcc; ac_word=$2
+{ $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.
+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_CC="gcc"
+ $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_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
+$as_echo "$ac_ct_CC" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_CC" = x; then
+ CC=""
+ 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
+ CC=$ac_ct_CC
+ fi
+else
+ CC="$ac_cv_prog_CC"
+fi
+
+if test -z "$CC"; then
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}cc; ac_word=$2
+{ $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.
+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_CC="${ac_tool_prefix}cc"
+ $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
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ fi
+fi
+if test -z "$CC"; then
+ # Extract the first word of "cc", so it can be a program name with args.
+set dummy cc; ac_word=$2
+{ $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.
+else
+ ac_prog_rejected=no
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { 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"
+ $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
+
+if test $ac_prog_rejected = yes; then
+ # We found a bogon in the path, so make sure we never use it.
+ set dummy $ac_cv_prog_CC
+ shift
+ if test $# != 0; then
+ # We chose a different compiler from the bogus one.
+ # However, it has the same basename, so the bogon will be chosen
+ # first if we set CC to just the basename; use the full file name.
+ shift
+ ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@"
+ fi
+fi
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$CC"; then
+ if test -n "$ac_tool_prefix"; then
+ for ac_prog in cl.exe
+ 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
+{ $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.
+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_CC="$ac_tool_prefix$ac_prog"
+ $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
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$CC" && break
+ done
+fi
+if test -z "$CC"; then
+ ac_ct_CC=$CC
+ for ac_prog in cl.exe
+do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; 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_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.
+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_CC="$ac_prog"
+ $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_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
+$as_echo "$ac_ct_CC" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$ac_ct_CC" && break
+done
+
+ if test "x$ac_ct_CC" = x; then
+ CC=""
+ 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
+ CC=$ac_ct_CC
+ fi
+fi
+
+fi
+
+
+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.
+$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 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=$?
+ 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 confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+ac_clean_files_save=$ac_clean_files
+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.
+{ $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 | *.dSYM | *.o | *.obj ) ;;
+ * ) ac_rmfiles="$ac_rmfiles $ac_file";;
+ esac
+done
+rm -f $ac_rmfiles
+
+if { { ac_try="$ac_link_default"
+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_default") 2>&5
+ ac_status=$?
+ $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,
+# so that the user can short-circuit this test for compilers unknown to
+# Autoconf.
+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 | *.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;
+ then :; else
+ ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+ fi
+ # We set ac_cv_exeext here because the later test for it is not
+ # safe: cross compilers may not add the suffix if given an `-o'
+ # argument, so we may need to know it at that point already.
+ # Even if this section looks crufty: it has the advantage of
+ # actually working.
+ break;;
+ * )
+ break;;
+ esac
+done
+test "$ac_cv_exeext" = no && ac_cv_exeext=
+
+else
+ ac_file=''
+fi
+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
+
+{ { $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
+
+rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out
+ac_clean_files=$ac_clean_files_save
+{ $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 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; }; then :
+ # If both `conftest.exe' and `conftest' are `present' (well, observable)
+# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will
+# work properly (i.e., refer to `conftest.exe'), while it won't with
+# `rm'.
+for ac_file in conftest.exe conftest conftest.*; do
+ test -f "$ac_file" || continue
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;;
+ *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+ break;;
+ * ) break;;
+ esac
+done
+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 compute suffix of executables: cannot compile and link
+See \`config.log' for more details" "$LINENO" 5 ; }
+fi
+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
+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
+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
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.o conftest.obj
+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>&5
+ ac_status=$?
+ $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 | *.dSYM ) ;;
+ *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'`
+ break;;
+ esac
+done
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+{ { $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
+{ $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
+{ $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 confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+#ifndef __GNUC__
+ choke me
+#endif
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_compiler_gnu=yes
+else
+ 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
+{ $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
+{ $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 confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_prog_cc_g=yes
+else
+ CFLAGS=""
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+
+else
+ ac_c_werror_flag=$ac_save_c_werror_flag
+ CFLAGS="-g"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_prog_cc_g=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
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ ac_c_werror_flag=$ac_save_c_werror_flag
+fi
+{ $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
+ if test "$GCC" = yes; then
+ CFLAGS="-g -O2"
+ else
+ CFLAGS="-g"
+ fi
+else
+ if test "$GCC" = yes; then
+ CFLAGS="-O2"
+ else
+ CFLAGS=
+ fi
+fi
+{ $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 confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <stdarg.h>
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */
+struct buf { int x; };
+FILE * (*rcsopen) (struct buf *, struct stat *, int);
+static char *e (p, i)
+ char **p;
+ int i;
+{
+ return p[i];
+}
+static char *f (char * (*g) (char **, int), char **p, ...)
+{
+ char *s;
+ va_list v;
+ va_start (v,p);
+ s = g (p, va_arg (v,int));
+ va_end (v);
+ return s;
+}
+
+/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has
+ function prototypes and stuff, but not '\xHH' hex character constants.
+ These don't provoke an error unfortunately, instead are silently treated
+ as 'x'. The following induces an error, until -std is added to get
+ proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an
+ array size at least. It's necessary to write '\x00'==0 to get something
+ that's true only with -std. */
+int osf4_cc_array ['\x00' == 0 ? 1 : -1];
+
+/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters
+ inside strings and character constants. */
+#define FOO(x) 'x'
+int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1];
+
+int test (int i, double x);
+struct s1 {int (*f) (int a);};
+struct s2 {int (*f) (double a);};
+int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
+int argc;
+char **argv;
+int
+main ()
+{
+return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1];
+ ;
+ return 0;
+}
+_ACEOF
+for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \
+ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
+do
+ CC="$ac_save_CC $ac_arg"
+ if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_prog_cc_c89=$ac_arg
+fi
+rm -f core conftest.err conftest.$ac_objext
+ test "x$ac_cv_prog_cc_c89" != "xno" && break
+done
+rm -f conftest.$ac_ext
+CC=$ac_save_CC
+
+fi
+# AC_CACHE_VAL
+case "x$ac_cv_prog_cc_c89" in
+ x)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5
+$as_echo "none needed" >&6; } ;;
+ xno)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5
+$as_echo "unsupported" >&6; } ;;
+ *)
+ CC="$CC $ac_cv_prog_cc_c89"
+ { $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'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+DEPDIR="${am__leading_dot}deps"
+
+ac_config_commands="$ac_config_commands depfiles"
+
+
+am_make=${MAKE-make}
+cat > confinc << 'END'
+am__doit:
+ @echo this is the am__doit target
+.PHONY: am__doit
+END
+# If we don't find an include directive, just comment out the code.
+{ $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
+# 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
+ case `$am_make -s -f confmf 2> /dev/null` in #(
+ *the\ am__doit\ target*)
+ am__include=.include
+ am__quote="\""
+ _am_result=BSD
+ ;;
+ esac
+fi
+
+
+{ $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 :
+ enableval=$enable_dependency_tracking;
+fi
+
+if test "x$enable_dependency_tracking" != xno; then
+ am_depcomp="$ac_aux_dir/depcomp"
+ AMDEPBACKSLASH='\'
+fi
+ if test "x$enable_dependency_tracking" != xno; then
+ AMDEP_TRUE=
+ AMDEP_FALSE='#'
+else
+ AMDEP_TRUE='#'
+ AMDEP_FALSE=
+fi
+
+
+
+depcc="$CC" am_compiler_list=
+
+{ $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
+ # making bogus files that we don't know about and never remove. For
+ # instance it was reported that on HP-UX the gcc test will end up
+ # making a dummy file named `D' -- because `-MD' means `put the output
+ # in D'.
+ mkdir conftest.dir
+ # Copy depcomp to subdir because otherwise we won't find it if we're
+ # using a relative directory.
+ cp "$am_depcomp" conftest.dir
+ cd conftest.dir
+ # We will build objects and dependencies in a subdirectory because
+ # it helps to detect inapplicable dependency modes. For instance
+ # both Tru64's cc and ICC support -MD to output dependencies as a
+ # side effect of compilation, but ICC will put the dependencies in
+ # the current directory while Tru64 will put them in the object
+ # directory.
+ mkdir sub
+
+ am_cv_CC_dependencies_compiler_type=none
+ if test "$am_compiler_list" = ""; then
+ am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp`
+ fi
+ 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
+ # we should not choose a depcomp mode which is confused by this.
+ #
+ # We need to recreate these files for each test, as the compiler may
+ # overwrite some of them when testing with obscure command lines.
+ # This happens at least with the AIX C compiler.
+ : > sub/conftest.c
+ for i in 1 2 3 4 5 6; do
+ echo '#include "conftst'$i'.h"' >> sub/conftest.c
+ # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
+ # Solaris 8's {/usr,}/bin/sh.
+ touch sub/conftst$i.h
+ done
+ echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
+
+ # 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
+ if test "x$enable_dependency_tracking" = xyes; then
+ continue
+ 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
+ if depmode=$depmode \
+ source=sub/conftest.c object=$am__obj \
+ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
+ $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 $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
+ # that says an option was ignored or not supported.
+ # When given -MP, icc 7.0 and 7.1 complain thusly:
+ # icc: Command line warning: ignoring option '-M'; no argument required
+ # The diagnosis changed in icc 8.0:
+ # icc: Command line remark: option '-MP' not supported
+ if (grep 'ignoring option' conftest.err ||
+ grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
+ am_cv_CC_dependencies_compiler_type=$depmode
+ break
+ fi
+ fi
+ done
+
+ cd ..
+ rm -rf conftest.dir
+else
+ am_cv_CC_dependencies_compiler_type=none
+fi
+
+fi
+{ $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
+ test "x$enable_dependency_tracking" != xno \
+ && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then
+ am__fastdepCC_TRUE=
+ am__fastdepCC_FALSE='#'
+else
+ am__fastdepCC_TRUE='#'
+ am__fastdepCC_FALSE=
+fi
+
+
+
+{ $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 confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+/* FIXME: Include the comments suggested by Paul. */
+#ifndef __cplusplus
+ /* Ultrix mips cc rejects this. */
+ typedef int charset[2];
+ const charset cs;
+ /* SunOS 4.1.1 cc rejects this. */
+ char const *const *pcpcc;
+ char **ppc;
+ /* NEC SVR4.0.2 mips cc rejects this. */
+ struct point {int x, y;};
+ static struct point const zero = {0,0};
+ /* AIX XL C 1.02.0.0 rejects this.
+ It does not let you subtract one const X* pointer from another in
+ an arm of an if-expression whose if-part is not a constant
+ expression */
+ const char *g = "string";
+ pcpcc = &g + (g ? g-g : 0);
+ /* HPUX 7.0 cc rejects these. */
+ ++pcpcc;
+ ppc = (char**) pcpcc;
+ pcpcc = (char const *const *) ppc;
+ { /* SCO 3.2v4 cc rejects this. */
+ char *t;
+ char const *s = 0 ? (char *) 0 : (char const *) 0;
+
+ *t++ = 0;
+ if (s) return 0;
+ }
+ { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */
+ int x[] = {25, 17};
+ const int *foo = &x[0];
+ ++foo;
+ }
+ { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */
+ typedef const int *iptr;
+ iptr p = 0;
+ ++p;
+ }
+ { /* AIX XL C 1.02.0.0 rejects this saying
+ "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */
+ struct s { int j; const int *ap[3]; };
+ struct s *b; b->j = 5;
+ }
+ { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */
+ const int foo = 10;
+ if (!foo) return 0;
+ }
+ return !cs[0] && !zero.x;
+#endif
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_c_const=yes
+else
+ ac_cv_c_const=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $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
+
+$as_echo "#define const /**/" >>confdefs.h
+
+fi
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+{ $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 :
+ $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"
+ do
+ ac_preproc_ok=false
+for ac_c_preproc_warn_flag in '' yes
+do
+ # Use a header file that comes with gcc, so configuring glibc
+ # with a fresh cross-compiler works.
+ # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ # <limits.h> exists even on freestanding compilers.
+ # On the NeXT, cc -E runs the code through the compiler's parser,
+ # not just through cpp. "Syntax error" is here to catch this case.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+ Syntax error
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+
+else
+ # Broken: fails on valid input.
+continue
+fi
+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 confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <ac_nonexistent.h>
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+ # Broken: success on invalid input.
+continue
+else
+ # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.i conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then :
+ break
+fi
+
+ done
+ ac_cv_prog_CPP=$CPP
+
+fi
+ CPP=$ac_cv_prog_CPP
+else
+ ac_cv_prog_CPP=$CPP
+fi
+{ $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
+ # Use a header file that comes with gcc, so configuring glibc
+ # with a fresh cross-compiler works.
+ # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ # <limits.h> exists even on freestanding compilers.
+ # On the NeXT, cc -E runs the code through the compiler's parser,
+ # not just through cpp. "Syntax error" is here to catch this case.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+ Syntax error
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+
+else
+ # Broken: fails on valid input.
+continue
+fi
+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 confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <ac_nonexistent.h>
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+ # Broken: success on invalid input.
+continue
+else
+ # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.i conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then :
+
+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 $? "C preprocessor \"$CPP\" fails sanity check
+See \`config.log' for more details" "$LINENO" 5 ; }
+fi
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+{ $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
+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.
+ # 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
+ $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"
+ $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
+ 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"
+ ac_path_GREP_max=$ac_count
+ fi
+ # 10*(2^10) chars as input seems more than enough
+ test $ac_count -gt 10 && break
+ done
+ rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
+
+ $ac_path_GREP_found && break 3
+ done
+ done
+ done
+IFS=$as_save_IFS
+ 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
+{ $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"
+
+
+{ $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
+ 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
+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.
+ # 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
+ $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"
+ $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
+ 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"
+ ac_path_EGREP_max=$ac_count
+ fi
+ # 10*(2^10) chars as input seems more than enough
+ test $ac_count -gt 10 && break
+ done
+ rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
+
+ $ac_path_EGREP_found && break 3
+ done
+ done
+ done
+IFS=$as_save_IFS
+ 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
+{ $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"
+
+
+{ $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 confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <float.h>
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_header_stdc=yes
+else
+ 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 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 :
+
+else
+ ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+ # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
+ cat 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 :
+
+else
+ ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+ # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
+ if test "$cross_compiling" = yes; then :
+ :
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <ctype.h>
+#include <stdlib.h>
+#if ((' ' & 0x0FF) == 0x020)
+# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
+# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
+#else
+# define ISLOWER(c) \
+ (('a' <= (c) && (c) <= 'i') \
+ || ('j' <= (c) && (c) <= 'r') \
+ || ('s' <= (c) && (c) <= 'z'))
+# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
+#endif
+
+#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
+int
+main ()
+{
+ int i;
+ for (i = 0; i < 256; i++)
+ if (XOR (islower (i), ISLOWER (i))
+ || toupper (i) != TOUPPER (i))
+ return 2;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+
+else
+ ac_cv_header_stdc=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+ conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+fi
+fi
+{ $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
+
+$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 $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 `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
+
+
+
+
+
+
+for ac_func in getpagesize
+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 HAVE_GETPAGESIZE 1
+_ACEOF
+
+fi
+done
+
+{ $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 :
+ ac_cv_func_mmap_fixed_mapped=no
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$ac_includes_default
+/* malloc might have been renamed as rpl_malloc. */
+#undef malloc
+
+/* Thanks to Mike Haertel and Jim Avera for this test.
+ Here is a matrix of mmap possibilities:
+ mmap private not fixed
+ mmap private fixed at somewhere currently unmapped
+ mmap private fixed at somewhere already mapped
+ mmap shared not fixed
+ mmap shared fixed at somewhere currently unmapped
+ mmap shared fixed at somewhere already mapped
+ For private mappings, we should verify that changes cannot be read()
+ back from the file, nor mmap's back from the file at a different
+ address. (There have been systems where private was not correctly
+ implemented like the infamous i386 svr4.0, and systems where the
+ VM page cache was not coherent with the file system buffer cache
+ like early versions of FreeBSD and possibly contemporary NetBSD.)
+ For shared mappings, we should conversely verify that changes get
+ propagated back to all the places they're supposed to be.
+
+ Grep wants private fixed already mapped.
+ The main things grep needs to know about mmap are:
+ * does it exist and is it safe to write into the mmap'd area
+ * how to use it (BSD variants) */
+
+#include <fcntl.h>
+#include <sys/mman.h>
+
+#if !defined STDC_HEADERS && !defined HAVE_STDLIB_H
+char *malloc ();
+#endif
+
+/* This mess was copied from the GNU getpagesize.h. */
+#ifndef HAVE_GETPAGESIZE
+# ifdef _SC_PAGESIZE
+# define getpagesize() sysconf(_SC_PAGESIZE)
+# else /* no _SC_PAGESIZE */
+# ifdef HAVE_SYS_PARAM_H
+# include <sys/param.h>
+# ifdef EXEC_PAGESIZE
+# define getpagesize() EXEC_PAGESIZE
+# else /* no EXEC_PAGESIZE */
+# ifdef NBPG
+# define getpagesize() NBPG * CLSIZE
+# ifndef CLSIZE
+# define CLSIZE 1
+# endif /* no CLSIZE */
+# else /* no NBPG */
+# ifdef NBPC
+# define getpagesize() NBPC
+# else /* no NBPC */
+# ifdef PAGESIZE
+# define getpagesize() PAGESIZE
+# endif /* PAGESIZE */
+# endif /* no NBPC */
+# endif /* no NBPG */
+# endif /* no EXEC_PAGESIZE */
+# else /* no HAVE_SYS_PARAM_H */
+# define getpagesize() 8192 /* punt totally */
+# endif /* no HAVE_SYS_PARAM_H */
+# endif /* no _SC_PAGESIZE */
+
+#endif /* no HAVE_GETPAGESIZE */
+
+int
+main ()
+{
+ char *data, *data2, *data3;
+ const char *cdata2;
+ int i, pagesize;
+ int fd, fd2;
+
+ pagesize = getpagesize ();
+
+ /* First, make a file with some known garbage in it. */
+ data = (char *) malloc (pagesize);
+ if (!data)
+ return 1;
+ for (i = 0; i < pagesize; ++i)
+ *(data + i) = rand ();
+ umask (0);
+ fd = creat ("conftest.mmap", 0600);
+ if (fd < 0)
+ return 2;
+ if (write (fd, data, pagesize) != pagesize)
+ 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 9;
+ if (data2 != mmap (data2, pagesize, PROT_READ | PROT_WRITE,
+ MAP_PRIVATE | MAP_FIXED, fd, 0L))
+ return 10;
+ for (i = 0; i < pagesize; ++i)
+ if (*(data + i) != *(data2 + i))
+ 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
+ some variants of i386 svr4.0.) */
+ for (i = 0; i < pagesize; ++i)
+ *(data2 + i) = *(data2 + i) + 1;
+ data3 = (char *) malloc (pagesize);
+ if (!data3)
+ return 12;
+ if (read (fd, data3, pagesize) != pagesize)
+ return 13;
+ for (i = 0; i < pagesize; ++i)
+ if (*(data + i) != *(data3 + i))
+ return 14;
+ close (fd);
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+ ac_cv_func_mmap_fixed_mapped=yes
+else
+ 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.beam conftest.$ac_ext
+fi
+
+fi
+{ $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
+
+$as_echo "#define HAVE_MMAP 1" >>confdefs.h
+
+fi
+rm -f conftest.mmap conftest.txt
+
+for ac_header in stdlib.h
+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 HAVE_STDLIB_H 1
+_ACEOF
+
+fi
+
+done
+
+{ $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 :
+ ac_cv_func_realloc_0_nonnull=no
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#if defined STDC_HEADERS || defined HAVE_STDLIB_H
+# include <stdlib.h>
+#else
+char *realloc ();
+#endif
+
+int
+main ()
+{
+return ! realloc (0, 0);
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+ ac_cv_func_realloc_0_nonnull=yes
+else
+ 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.beam conftest.$ac_ext
+fi
+
+fi
+{ $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 :
+
+$as_echo "#define HAVE_REALLOC 1" >>confdefs.h
+
+else
+ $as_echo "#define HAVE_REALLOC 0" >>confdefs.h
+
+ case " $LIBOBJS " in
+ *" realloc.$ac_objext "* ) ;;
+ *) LIBOBJS="$LIBOBJS realloc.$ac_objext"
+ ;;
+esac
+
+
+$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
+
+{ $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 confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* 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
+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
+ done
+ done
+done
+# Provide a safe default value.
+: ${ac_cv_func_select_args='int,int *,struct timeval *'}
+
+fi
+{ $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
+shift
+
+cat >>confdefs.h <<_ACEOF
+#define SELECT_TYPE_ARG1 $1
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define SELECT_TYPE_ARG234 ($2)
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define SELECT_TYPE_ARG5 ($3)
+_ACEOF
+
+rm -f conftest*
+
+{ $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 :
+ ac_cv_func_lstat_dereferences_slashed_symlink=no
+else
+ 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, 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;
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+ ac_cv_func_lstat_dereferences_slashed_symlink=yes
+else
+ 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.beam conftest.$ac_ext
+fi
+
+else
+ # If the `ln -s' command failed, then we probably don't even
+ # have an lstat function.
+ ac_cv_func_lstat_dereferences_slashed_symlink=no
+fi
+rm -f conftest.sym conftest.file
+
+fi
+{ $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 &&
+
+cat >>confdefs.h <<_ACEOF
+#define LSTAT_FOLLOWS_SLASHED_SYMLINK 1
+_ACEOF
+
+
+if test "x$ac_cv_func_lstat_dereferences_slashed_symlink" = xno; then
+ case " $LIBOBJS " in
+ *" lstat.$ac_objext "* ) ;;
+ *) LIBOBJS="$LIBOBJS lstat.$ac_objext"
+ ;;
+esac
+
+fi
+
+{ $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 :
+ ac_cv_func_stat_empty_string_bug=yes
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+struct stat sbuf;
+ return stat ("", &sbuf) == 0;
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+ ac_cv_func_stat_empty_string_bug=no
+else
+ 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.beam conftest.$ac_ext
+fi
+
+fi
+{ $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 "* ) ;;
+ *) LIBOBJS="$LIBOBJS stat.$ac_objext"
+ ;;
+esac
+
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_STAT_EMPTY_STRING_BUG 1
+_ACEOF
+
+fi
+
+for ac_func in vprintf
+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 HAVE_VPRINTF 1
+_ACEOF
+
+ac_fn_c_check_func "$LINENO" "_doprnt" "ac_cv_func__doprnt"
+if test "x$ac_cv_func__doprnt" = x""yes; then :
+
+$as_echo "#define HAVE_DOPRNT 1" >>confdefs.h
+
+fi
+
+fi
+done
+
+
+{ $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 confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+#include <stdbool.h>
+#ifndef bool
+ "error: bool is not defined"
+#endif
+#ifndef false
+ "error: false is not defined"
+#endif
+#if false
+ "error: false is not 0"
+#endif
+#ifndef true
+ "error: true is not defined"
+#endif
+#if true != 1
+ "error: true is not 1"
+#endif
+#ifndef __bool_true_false_are_defined
+ "error: __bool_true_false_are_defined is not defined"
+#endif
+
+ struct s { _Bool s: 1; _Bool t; } s;
+
+ char a[true == 1 ? 1 : -1];
+ char b[false == 0 ? 1 : -1];
+ char c[__bool_true_false_are_defined == 1 ? 1 : -1];
+ char d[(bool) 0.5 == true ? 1 : -1];
+ bool e = &s;
+ char f[(_Bool) 0.0 == false ? 1 : -1];
+ char g[true];
+ 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];
+# if defined __xlc__ || defined __GNUC__
+ /* Catch a bug in IBM AIX xlc compiler version 6.0.0.0
+ reported by James Lemley on 2005-10-05; see
+ http://lists.gnu.org/archive/html/bug-coreutils/2005-10/msg00086.html
+ This test is not quite right, since xlc is allowed to
+ reject this program, as the initializer for xlcbug is
+ not one of the forms that C requires support for.
+ However, doing the test right would require a runtime
+ test, and that would make cross-compilation harder.
+ Let us hope that IBM fixes the xlc bug, and also adds
+ support for this kind of constant expression. In the
+ meantime, this test will reject xlc, which is OK, since
+ our stdbool.h substitute should suffice. We also test
+ this with GCC, where it should work, to detect more
+ quickly whether someone messes up the test in the
+ future. */
+ char digs[] = "0123456789";
+ int xlcbug = 1 / (&(digs + 5)[-2 + (bool) 1] == &digs[4] ? 1 : -1);
+# endif
+ /* Catch a bug in an HP-UX C compiler. See
+ http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html
+ http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html
+ */
+ _Bool q = true;
+ _Bool *pq = &q;
+
+int
+main ()
+{
+
+ *pq |= q;
+ *pq |= ! q;
+ /* Refer to every declared value, to avoid compiler optimizations. */
+ return (!a + !b + !c + !d + !e + !f + !g + !h + !i + !!j + !k + !!l
+ + !m + !n + !o + !p + !q + !pq);
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_header_stdbool_h=yes
+else
+ ac_cv_header_stdbool_h=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $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
+_ACEOF
+
+
+fi
+
+if test $ac_cv_header_stdbool_h = yes; then
+
+$as_echo "#define HAVE_STDBOOL_H 1" >>confdefs.h
+
+fi
+
+{ $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 confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <float.h>
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_header_stdc=yes
+else
+ 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 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 :
+
+else
+ ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+ # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
+ cat 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 :
+
+else
+ ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+ # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
+ if test "$cross_compiling" = yes; then :
+ :
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <ctype.h>
+#include <stdlib.h>
+#if ((' ' & 0x0FF) == 0x020)
+# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
+# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
+#else
+# define ISLOWER(c) \
+ (('a' <= (c) && (c) <= 'i') \
+ || ('j' <= (c) && (c) <= 'r') \
+ || ('s' <= (c) && (c) <= 'z'))
+# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
+#endif
+
+#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
+int
+main ()
+{
+ int i;
+ for (i = 0; i < 256; i++)
+ if (XOR (islower (i), ISLOWER (i))
+ || toupper (i) != TOUPPER (i))
+ return 2;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+
+else
+ ac_cv_header_stdc=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+ conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+fi
+fi
+{ $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
+
+$as_echo "#define STDC_HEADERS 1" >>confdefs.h
+
+fi
+
+{ $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 confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <sys/types.h>
+#include <sys/time.h>
+#include <time.h>
+
+int
+main ()
+{
+if ((struct tm *) 0)
+return 0;
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_header_time=yes
+else
+ ac_cv_header_time=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $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
+
+$as_echo "#define TIME_WITH_SYS_TIME 1" >>confdefs.h
+
+fi
+
+if test $ac_cv_c_compiler_gnu = yes; then
+ { $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 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 :
+ ac_cv_prog_gcc_traditional=yes
+else
+ ac_cv_prog_gcc_traditional=no
+fi
+rm -f conftest*
+
+
+ if test $ac_cv_prog_gcc_traditional = no; then
+ 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 :
+ ac_cv_prog_gcc_traditional=yes
+fi
+rm -f conftest*
+
+ fi
+fi
+{ $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
+fi
+
+case `pwd` in
+ *\ * | *\ *)
+ { $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.6b'
+macro_revision='1.3017'
+
+
+
+
+
+
+
+
+
+
+
+
+
+ltmain="$ac_aux_dir/ltmain.sh"
+
+# Make sure we can run config.sub.
+$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 ||
+ as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5
+
+{ $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 &&
+ 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` ||
+ as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5
+$as_echo "$ac_cv_build" >&6; }
+case $ac_cv_build in
+*-*-*) ;;
+*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5 ;;
+esac
+build=$ac_cv_build
+ac_save_IFS=$IFS; IFS='-'
+set x $ac_cv_build
+shift
+build_cpu=$1
+build_vendor=$2
+shift; shift
+# Remember, the first character of IFS is used to create $*,
+# except with old shells:
+build_os=$*
+IFS=$ac_save_IFS
+case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac
+
+
+{ $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` ||
+ as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5
+$as_echo "$ac_cv_host" >&6; }
+case $ac_cv_host in
+*-*-*) ;;
+*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5 ;;
+esac
+host=$ac_cv_host
+ac_save_IFS=$IFS; IFS='-'
+set x $ac_cv_host
+shift
+host_cpu=$1
+host_vendor=$2
+shift; shift
+# Remember, the first character of IFS is used to create $*,
+# except with old shells:
+host_os=$*
+IFS=$ac_save_IFS
+case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac
+
+
+{ $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" 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
+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.
+ # 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
+ $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"
+ $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
+ 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"
+ ac_path_SED_max=$ac_count
+ fi
+ # 10*(2^10) chars as input seems more than enough
+ test $ac_count -gt 10 && break
+ done
+ rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
+
+ $ac_path_SED_found && break 3
+ done
+ done
+ done
+IFS=$as_save_IFS
+ 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
+{ $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
+
+test -z "$SED" && SED=sed
+Xsed="$SED -e 1s/^X//"
+
+
+
+
+
+
+
+
+
+
+
+{ $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
+ 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
+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.
+ # 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
+ $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"
+ $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
+ 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"
+ ac_path_FGREP_max=$ac_count
+ fi
+ # 10*(2^10) chars as input seems more than enough
+ test $ac_count -gt 10 && break
+ done
+ rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
+
+ $ac_path_FGREP_found && break 3
+ done
+ done
+ done
+IFS=$as_save_IFS
+ 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
+{ $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"
+
+
+test -z "$GREP" && GREP=grep
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# Check whether --with-gnu-ld was given.
+if test "${with_gnu_ld+set}" = set; then :
+ withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes
+else
+ with_gnu_ld=no
+fi
+
+ac_prog=ld
+if test "$GCC" = yes; then
+ # Check if gcc -print-prog-name=ld gives a path.
+ { $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
+ ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
+ *)
+ ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
+ esac
+ case $ac_prog in
+ # Accept absolute paths.
+ [\\/]* | ?:[\\/]*)
+ re_direlt='/[^/][^/]*/\.\./'
+ # Canonicalize the pathname of ld
+ ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'`
+ while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do
+ ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"`
+ done
+ test -z "$LD" && LD="$ac_prog"
+ ;;
+ "")
+ # If it fails, then pretend we aren't using GCC.
+ ac_prog=ld
+ ;;
+ *)
+ # If it is relative, then search for the first ld in PATH.
+ with_gnu_ld=unknown
+ ;;
+ esac
+elif test "$with_gnu_ld" = yes; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5
+$as_echo_n "checking for GNU ld... " >&6; }
+else
+ { $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 :
+ $as_echo_n "(cached) " >&6
+else
+ if test -z "$LD"; then
+ lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+ for ac_dir in $PATH; do
+ IFS="$lt_save_ifs"
+ test -z "$ac_dir" && ac_dir=.
+ if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
+ lt_cv_path_LD="$ac_dir/$ac_prog"
+ # Check to see if the program is GNU ld. I'd rather use --version,
+ # but apparently some variants of GNU ld only accept -v.
+ # Break only if it was the GNU/non-GNU ld that we prefer.
+ case `"$lt_cv_path_LD" -v 2>&1 </dev/null` in
+ *GNU* | *'with BFD'*)
+ test "$with_gnu_ld" != no && break
+ ;;
+ *)
+ test "$with_gnu_ld" != yes && break
+ ;;
+ esac
+ fi
+ done
+ IFS="$lt_save_ifs"
+else
+ lt_cv_path_LD="$LD" # Let the user override the test with a path.
+fi
+fi
+
+LD="$lt_cv_path_LD"
+if test -n "$LD"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LD" >&5
+$as_echo "$LD" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+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
+*GNU* | *'with BFD'*)
+ lt_cv_prog_gnu_ld=yes
+ ;;
+*)
+ lt_cv_prog_gnu_ld=no
+ ;;
+esac
+fi
+{ $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
+
+
+
+
+
+
+
+
+
+{ $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.
+ lt_cv_path_NM="$NM"
+else
+ lt_nm_to_check="${ac_tool_prefix}nm"
+ if test -n "$ac_tool_prefix" && test "$build" = "$host"; then
+ lt_nm_to_check="$lt_nm_to_check nm"
+ fi
+ for lt_tmp_nm in $lt_nm_to_check; do
+ lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+ for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do
+ IFS="$lt_save_ifs"
+ test -z "$ac_dir" && ac_dir=.
+ tmp_nm="$ac_dir/$lt_tmp_nm"
+ if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then
+ # Check to see if the nm accepts a BSD-compat flag.
+ # Adding the `sed 1q' prevents false positives on HP-UX, which says:
+ # nm: unknown option "B" ignored
+ # Tru64's nm complains that /dev/null is an invalid object file
+ case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in
+ */dev/null* | *'Invalid file or object type'*)
+ lt_cv_path_NM="$tmp_nm -B"
+ break
+ ;;
+ *)
+ case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in
+ */dev/null*)
+ lt_cv_path_NM="$tmp_nm -p"
+ break
+ ;;
+ *)
+ lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but
+ continue # so that we can try to find one that supports BSD flags
+ ;;
+ esac
+ ;;
+ esac
+ fi
+ done
+ IFS="$lt_save_ifs"
+ done
+ : ${lt_cv_path_NM=no}
+fi
+fi
+{ $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
+ # Didn't find any BSD compatible name lister, look for dumpbin.
+ if test -n "$ac_tool_prefix"; then
+ for ac_prog in "dumpbin -symbols" "link -dump -symbols"
+ 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
+{ $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.
+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_DUMPBIN="$ac_tool_prefix$ac_prog"
+ $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
+DUMPBIN=$ac_cv_prog_DUMPBIN
+if test -n "$DUMPBIN"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DUMPBIN" >&5
+$as_echo "$DUMPBIN" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$DUMPBIN" && break
+ done
+fi
+if test -z "$DUMPBIN"; then
+ ac_ct_DUMPBIN=$DUMPBIN
+ for ac_prog in "dumpbin -symbols" "link -dump -symbols"
+do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; 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_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.
+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_DUMPBIN="$ac_prog"
+ $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_DUMPBIN=$ac_cv_prog_ac_ct_DUMPBIN
+if test -n "$ac_ct_DUMPBIN"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DUMPBIN" >&5
+$as_echo "$ac_ct_DUMPBIN" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$ac_ct_DUMPBIN" && break
+done
+
+ if test "x$ac_ct_DUMPBIN" = x; then
+ DUMPBIN=":"
+ 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
+ DUMPBIN=$ac_ct_DUMPBIN
+ fi
+fi
+
+
+ if test "$DUMPBIN" != ":"; then
+ NM="$DUMPBIN"
+ fi
+fi
+test -z "$NM" && NM=nm
+
+
+
+
+
+
+{ $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:5730: $ac_compile\"" >&5)
+ (eval "$ac_compile" 2>conftest.err)
+ cat conftest.err >&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: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
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_nm_interface" >&5
+$as_echo "$lt_cv_nm_interface" >&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
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+else
+ { $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
+{ $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"
+
+ case $build_os in
+ msdosdjgpp*)
+ # On DJGPP, this test can blow up pretty badly due to problems in libc
+ # (any single argument exceeding 2000 bytes causes a buffer overrun
+ # during glob expansion). Even if it were fixed, the result of this
+ # check would be larger than it should be.
+ lt_cv_sys_max_cmd_len=12288; # 12K is about right
+ ;;
+
+ gnu*)
+ # Under GNU Hurd, this test is not required because there is
+ # no limit to the length of command line arguments.
+ # Libtool will interpret -1 as no limit whatsoever
+ lt_cv_sys_max_cmd_len=-1;
+ ;;
+
+ cygwin* | mingw* | 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,
+ # you end up with a "frozen" computer, even though with patience
+ # the test eventually succeeds (with a max line length of 256k).
+ # Instead, let's just punt: use the minimum linelength reported by
+ # all of the supported platforms: 8192 (on NT/2K/XP).
+ lt_cv_sys_max_cmd_len=8192;
+ ;;
+
+ amigaos*)
+ # On AmigaOS with pdksh, this test takes hours, literally.
+ # So we just punt and use a minimum line length of 8192.
+ lt_cv_sys_max_cmd_len=8192;
+ ;;
+
+ netbsd* | freebsd* | openbsd* | darwin* | dragonfly*)
+ # This has been around since 386BSD, at least. Likely further.
+ if test -x /sbin/sysctl; then
+ lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax`
+ elif test -x /usr/sbin/sysctl; then
+ lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax`
+ else
+ lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs
+ fi
+ # And add a safety zone
+ lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
+ lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3`
+ ;;
+
+ interix*)
+ # We know the value 262144 and hardcode it with a safety zone (like BSD)
+ lt_cv_sys_max_cmd_len=196608
+ ;;
+
+ osf*)
+ # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure
+ # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not
+ # nice to cause kernel panics so lets avoid the loop below.
+ # First set a reasonable default.
+ lt_cv_sys_max_cmd_len=16384
+ #
+ if test -x /sbin/sysconfig; then
+ case `/sbin/sysconfig -q proc exec_disable_arg_limit` in
+ *1*) lt_cv_sys_max_cmd_len=-1 ;;
+ esac
+ fi
+ ;;
+ sco3.2v5*)
+ lt_cv_sys_max_cmd_len=102400
+ ;;
+ sysv5* | sco5v6* | sysv4.2uw2*)
+ kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null`
+ if test -n "$kargmax"; then
+ lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[ ]//'`
+ else
+ lt_cv_sys_max_cmd_len=32768
+ fi
+ ;;
+ *)
+ lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null`
+ if test -n "$lt_cv_sys_max_cmd_len"; then
+ lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
+ lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3`
+ else
+ # Make teststring a little bigger before we do anything with it.
+ # a 1K string should be a reasonable start.
+ for i in 1 2 3 4 5 6 7 8 ; do
+ teststring=$teststring$teststring
+ done
+ SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}}
+ # If test is not a shell built-in, we'll probably end up computing a
+ # maximum length that is only half of the actual maximum length, but
+ # we can't tell.
+ while { test "X"`$SHELL $0 --fallback-echo "X$teststring$teststring" 2>/dev/null` \
+ = "XX$teststring$teststring"; } >/dev/null 2>&1 &&
+ test $i != 17 # 1/2 MB should be enough
+ do
+ i=`expr $i + 1`
+ teststring=$teststring$teststring
+ done
+ # Only check the string length outside the loop.
+ lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1`
+ teststring=
+ # Add a significant safety factor because C++ compilers can tack on
+ # massive amounts of additional arguments before passing them to the
+ # linker. It appears as though 1/2 is a usable value.
+ lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2`
+ fi
+ ;;
+ esac
+
+fi
+
+if test -n $lt_cv_sys_max_cmd_len ; then
+ { $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
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: none" >&5
+$as_echo "none" >&6; }
+fi
+max_cmd_len=$lt_cv_sys_max_cmd_len
+
+
+
+
+
+
+: ${CP="cp -f"}
+: ${MV="mv -f"}
+: ${RM="rm -f"}
+
+{ $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"
+ test "${_lt_dummy##*/},${_lt_dummy%/*},"${_lt_dummy%"$_lt_dummy"}, \
+ = c,a/b,, \
+ && eval 'test $(( 1 + 1 )) -eq 2 \
+ && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \
+ && xsi_shell=yes
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $xsi_shell" >&5
+$as_echo "$xsi_shell" >&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
+{ $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
+ lt_unset=unset
+else
+ lt_unset=false
+fi
+
+
+
+
+
+# test EBCDIC or ASCII
+case `echo X|tr X '\101'` in
+ A) # ASCII based system
+ # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr
+ lt_SP2NL='tr \040 \012'
+ lt_NL2SP='tr \015\012 \040\040'
+ ;;
+ *) # EBCDIC based system
+ lt_SP2NL='tr \100 \n'
+ lt_NL2SP='tr \r\n \100\100'
+ ;;
+esac
+
+
+
+
+
+
+
+
+
+{ $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
+{ $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
+"" | " "*) ;;
+*) reload_flag=" $reload_flag" ;;
+esac
+reload_cmds='$LD$reload_flag -o $output$reload_objs'
+case $host_os in
+ darwin*)
+ if test "$GCC" = yes; then
+ reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs'
+ else
+ reload_cmds='$LD$reload_flag -o $output$reload_objs'
+ fi
+ ;;
+esac
+
+
+
+
+
+
+
+
+
+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
+
+
+
+
+
+
+
+
+
+{ $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=
+lt_cv_deplibs_check_method='unknown'
+# Need to set the preceding variable on all platforms that support
+# interlibrary dependencies.
+# 'none' -- dependencies not supported.
+# `unknown' -- same as none, but documents that we really don't know.
+# 'pass_all' -- all dependencies passed with no checks.
+# 'test_compile' -- check by making test program.
+# 'file_magic [[regex]]' -- check by looking for files in library path
+# which responds to the $file_magic_cmd with a given extended regex.
+# If you have `file' or equivalent on your system and you're not sure
+# whether `pass_all' will *always* work, you probably want this one.
+
+case $host_os in
+aix[4-9]*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+beos*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+bsdi[45]*)
+ lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)'
+ lt_cv_file_magic_cmd='/usr/bin/file -L'
+ lt_cv_file_magic_test_file=/shlib/libc.so
+ ;;
+
+cygwin*)
+ # func_win32_libid is a shell function defined in ltmain.sh
+ lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
+ lt_cv_file_magic_cmd='func_win32_libid'
+ ;;
+
+mingw* | pw32*)
+ # Base MSYS/MinGW do not provide the 'file' command needed by
+ # func_win32_libid shell function, so use a weaker test based on 'objdump',
+ # unless we find 'file', for example because we are cross-compiling.
+ if ( file / ) >/dev/null 2>&1; then
+ lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
+ lt_cv_file_magic_cmd='func_win32_libid'
+ else
+ lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?'
+ lt_cv_file_magic_cmd='$OBJDUMP -f'
+ 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
+ ;;
+
+freebsd* | dragonfly*)
+ if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then
+ case $host_cpu in
+ i*86 )
+ # Not sure whether the presence of OpenBSD here was a mistake.
+ # Let's accept both of them until this is cleared up.
+ lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[3-9]86 (compact )?demand paged shared library'
+ lt_cv_file_magic_cmd=/usr/bin/file
+ lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*`
+ ;;
+ esac
+ else
+ lt_cv_deplibs_check_method=pass_all
+ fi
+ ;;
+
+gnu*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+hpux10.20* | hpux11*)
+ lt_cv_file_magic_cmd=/usr/bin/file
+ case $host_cpu in
+ ia64*)
+ lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64'
+ lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so
+ ;;
+ hppa*64*)
+ lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - PA-RISC [0-9].[0-9]'
+ lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl
+ ;;
+ *)
+ lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9].[0-9]) shared library'
+ lt_cv_file_magic_test_file=/usr/lib/libc.sl
+ ;;
+ esac
+ ;;
+
+interix[3-9]*)
+ # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here
+ lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|\.a)$'
+ ;;
+
+irix5* | irix6* | nonstopux*)
+ case $LD in
+ *-32|*"-32 ") libmagic=32-bit;;
+ *-n32|*"-n32 ") libmagic=N32;;
+ *-64|*"-64 ") libmagic=64-bit;;
+ *) libmagic=never-match;;
+ esac
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+# This must be Linux ELF.
+linux* | k*bsd*-gnu | kopensolaris*-gnu)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+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
+ lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|_pic\.a)$'
+ fi
+ ;;
+
+newos6*)
+ lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)'
+ lt_cv_file_magic_cmd=/usr/bin/file
+ lt_cv_file_magic_test_file=/usr/lib/libnls.so
+ ;;
+
+*nto* | *qnx*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+openbsd*)
+ if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+ lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|\.so|_pic\.a)$'
+ else
+ lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$'
+ fi
+ ;;
+
+osf3* | osf4* | osf5*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+rdos*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+solaris*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+sysv4 | sysv4.3*)
+ case $host_vendor in
+ motorola)
+ lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]'
+ lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*`
+ ;;
+ ncr)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+ sequent)
+ lt_cv_file_magic_cmd='/bin/file'
+ lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )'
+ ;;
+ sni)
+ lt_cv_file_magic_cmd='/bin/file'
+ lt_cv_deplibs_check_method="file_magic ELF [0-9][0-9]*-bit [LM]SB dynamic lib"
+ lt_cv_file_magic_test_file=/lib/libc.so
+ ;;
+ siemens)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+ pc)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+ esac
+ ;;
+
+tpf*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+esac
+
+fi
+{ $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
+
+
+
+
+
+
+
+
+
+
+
+
+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
+{ $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.
+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_AR="${ac_tool_prefix}ar"
+ $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
+AR=$ac_cv_prog_AR
+if test -n "$AR"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5
+$as_echo "$AR" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_AR"; then
+ ac_ct_AR=$AR
+ # Extract the first word of "ar", so it can be a program name with args.
+set dummy ar; ac_word=$2
+{ $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.
+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_AR="ar"
+ $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_AR=$ac_cv_prog_ac_ct_AR
+if test -n "$ac_ct_AR"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5
+$as_echo "$ac_ct_AR" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_AR" = x; then
+ AR="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
+ AR=$ac_ct_AR
+ fi
+else
+ AR="$ac_cv_prog_AR"
+fi
+
+test -z "$AR" && AR=ar
+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
+{ $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.
+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"
+ $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
+
+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
+{ $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.
+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_RANLIB="${ac_tool_prefix}ranlib"
+ $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
+RANLIB=$ac_cv_prog_RANLIB
+if test -n "$RANLIB"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5
+$as_echo "$RANLIB" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_RANLIB"; then
+ ac_ct_RANLIB=$RANLIB
+ # Extract the first word of "ranlib", so it can be a program name with args.
+set dummy ranlib; ac_word=$2
+{ $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.
+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_RANLIB="ranlib"
+ $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_RANLIB=$ac_cv_prog_ac_ct_RANLIB
+if test -n "$ac_ct_RANLIB"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5
+$as_echo "$ac_ct_RANLIB" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_RANLIB" = x; then
+ RANLIB=":"
+ 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
+ RANLIB=$ac_ct_RANLIB
+ fi
+else
+ RANLIB="$ac_cv_prog_RANLIB"
+fi
+
+test -z "$RANLIB" && RANLIB=:
+
+
+
+
+
+
+# Determine commands to create old-style static archives.
+old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs'
+old_postinstall_cmds='chmod 644 $oldlib'
+old_postuninstall_cmds=
+
+if test -n "$RANLIB"; then
+ case $host_os in
+ openbsd*)
+ old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$oldlib"
+ ;;
+ *)
+ old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$oldlib"
+ ;;
+ esac
+ old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib"
+fi
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# If no C compiler was specified, use CC.
+LTCC=${LTCC-"$CC"}
+
+# If no C compiler flags were specified, use CFLAGS.
+LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
+
+# Allow CC to be a program name with arguments.
+compiler=$CC
+
+
+# Check for command to grab the raw symbol name followed by C symbol from nm.
+{ $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.
+# [They come from Ultrix. What could be older than Ultrix?!! ;)]
+
+# Character class describing NM global symbol codes.
+symcode='[BCDEGRST]'
+
+# Regexp to match symbols that can be accessed directly from C.
+sympat='\([_A-Za-z][_A-Za-z0-9]*\)'
+
+# Define system-specific variables.
+case $host_os in
+aix*)
+ symcode='[BCDT]'
+ ;;
+cygwin* | mingw* | pw32* | cegcc*)
+ symcode='[ABCDGISTW]'
+ ;;
+hpux*)
+ if test "$host_cpu" = ia64; then
+ symcode='[ABCDEGRST]'
+ fi
+ ;;
+irix* | nonstopux*)
+ symcode='[BCDEGRST]'
+ ;;
+osf*)
+ symcode='[BCDEGQRST]'
+ ;;
+solaris*)
+ symcode='[BDRT]'
+ ;;
+sco3.2v5*)
+ symcode='[DT]'
+ ;;
+sysv4.2uw2*)
+ symcode='[DT]'
+ ;;
+sysv5* | sco5v6* | unixware* | OpenUNIX*)
+ symcode='[ABDT]'
+ ;;
+sysv4)
+ symcode='[DFNSTU]'
+ ;;
+esac
+
+# If we're using GNU nm, then use its standard symbol codes.
+case `$NM -V 2>&1` in
+*GNU* | *'with BFD'*)
+ symcode='[ABCDGIRSTW]' ;;
+esac
+
+# Transform an extracted symbol line into a proper C declaration.
+# Some systems (esp. on ia64) link data and code symbols differently,
+# so use this general approach.
+lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'"
+
+# Transform an extracted symbol line into symbol name and symbol address
+lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (void *) \&\2},/p'"
+lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \(lib[^ ]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"lib\2\", (void *) \&\2},/p'"
+
+# Handle CRLF in mingw tool chain
+opt_cr=
+case $build_os in
+mingw*)
+ opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp
+ ;;
+esac
+
+# Try without a prefix underscore, then with it.
+for ac_symprfx in "" "_"; do
+
+ # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol.
+ symxfrm="\\1 $ac_symprfx\\2 \\2"
+
+ # Write the raw and C identifiers.
+ if test "$lt_cv_nm_interface" = "MS dumpbin"; then
+ # Fake it for dumpbin and say T for any non-static function
+ # and D for any global variable.
+ # Also find C++ and __fastcall symbols from MSVC++,
+ # which start with @ or ?.
+ lt_cv_sys_global_symbol_pipe="$AWK '"\
+" {last_section=section; section=\$ 3};"\
+" /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\
+" \$ 0!~/External *\|/{next};"\
+" / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\
+" {if(hide[section]) next};"\
+" {f=0}; \$ 0~/\(\).*\|/{f=1}; {printf f ? \"T \" : \"D \"};"\
+" {split(\$ 0, a, /\||\r/); split(a[2], s)};"\
+" s[1]~/^[@?]/{print s[1], s[1]; next};"\
+" s[1]~prfx {split(s[1],t,\"@\"); print t[1], substr(t[1],length(prfx))}"\
+" ' prfx=^$ac_symprfx"
+ else
+ lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'"
+ fi
+
+ # Check to see that the pipe works correctly.
+ pipe_works=no
+
+ rm -f conftest*
+ cat > conftest.$ac_ext <<_LT_EOF
+#ifdef __cplusplus
+extern "C" {
+#endif
+char nm_test_var;
+void nm_test_func(void);
+void nm_test_func(void){}
+#ifdef __cplusplus
+}
+#endif
+int main(){nm_test_var='a';nm_test_func();return(0);}
+_LT_EOF
+
+ if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ $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\":${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=$?
+ $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"
+ else
+ rm -f "$nlist"T
+ fi
+
+ # Make sure that we snagged all the symbols we need.
+ if $GREP ' nm_test_var$' "$nlist" >/dev/null; then
+ if $GREP ' nm_test_func$' "$nlist" >/dev/null; then
+ cat <<_LT_EOF > conftest.$ac_ext
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+_LT_EOF
+ # Now generate the symbol file.
+ eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext'
+
+ cat <<_LT_EOF >> conftest.$ac_ext
+
+/* The mapping between symbol names and symbols. */
+const struct {
+ const char *name;
+ void *address;
+}
+lt__PROGRAM__LTX_preloaded_symbols[] =
+{
+ { "@PROGRAM@", (void *) 0 },
+_LT_EOF
+ $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (void *) \&\2},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext
+ cat <<\_LT_EOF >> conftest.$ac_ext
+ {0, (void *) 0}
+};
+
+/* This works around a problem in FreeBSD linker */
+#ifdef FREEBSD_WORKAROUND
+static const void *lt_preloaded_setup() {
+ return lt__PROGRAM__LTX_preloaded_symbols;
+}
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+_LT_EOF
+ # Now try linking the two files.
+ mv conftest.$ac_objext conftstm.$ac_objext
+ lt_save_LIBS="$LIBS"
+ lt_save_CFLAGS="$CFLAGS"
+ LIBS="conftstm.$ac_objext"
+ CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag"
+ if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ $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"
+ CFLAGS="$lt_save_CFLAGS"
+ else
+ echo "cannot find nm_test_func in $nlist" >&5
+ fi
+ else
+ echo "cannot find nm_test_var in $nlist" >&5
+ fi
+ else
+ echo "cannot run $lt_cv_sys_global_symbol_pipe" >&5
+ fi
+ else
+ echo "$progname: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ fi
+ rm -rf conftest* conftst*
+
+ # Do not use the global_symbol_pipe unless it works.
+ if test "$pipe_works" = yes; then
+ break
+ else
+ lt_cv_sys_global_symbol_pipe=
+ fi
+done
+
+fi
+
+if test -z "$lt_cv_sys_global_symbol_pipe"; then
+ lt_cv_sys_global_symbol_to_cdecl=
+fi
+if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: failed" >&5
+$as_echo "failed" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5
+$as_echo "ok" >&6; }
+fi
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# Check whether --enable-libtool-lock was given.
+if test "${enable_libtool_lock+set}" = set; then :
+ enableval=$enable_libtool_lock;
+fi
+
+test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes
+
+# Some flags need to be propagated to the compiler or linker for good
+# libtool support.
+case $host in
+ia64-*-hpux*)
+ # Find out which ABI we are using.
+ echo 'int i;' > conftest.$ac_ext
+ if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ $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"
+ ;;
+ *ELF-64*)
+ HPUX_IA64_MODE="64"
+ ;;
+ esac
+ fi
+ rm -rf conftest*
+ ;;
+*-*-irix6*)
+ # Find out which ABI we are using.
+ 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=$?
+ $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*)
+ LD="${LD-ld} -melf32bsmip"
+ ;;
+ *N32*)
+ LD="${LD-ld} -melf32bmipn32"
+ ;;
+ *64-bit*)
+ LD="${LD-ld} -melf64bmip"
+ ;;
+ esac
+ else
+ case `/usr/bin/file conftest.$ac_objext` in
+ *32-bit*)
+ LD="${LD-ld} -32"
+ ;;
+ *N32*)
+ LD="${LD-ld} -n32"
+ ;;
+ *64-bit*)
+ LD="${LD-ld} -64"
+ ;;
+ esac
+ fi
+ fi
+ rm -rf conftest*
+ ;;
+
+x86_64-*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\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ $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
+ x86_64-*kfreebsd*-gnu)
+ LD="${LD-ld} -m elf_i386_fbsd"
+ ;;
+ x86_64-*linux*)
+ LD="${LD-ld} -m elf_i386"
+ ;;
+ ppc64-*linux*|powerpc64-*linux*)
+ LD="${LD-ld} -m elf32ppclinux"
+ ;;
+ s390x-*linux*)
+ LD="${LD-ld} -m elf_s390"
+ ;;
+ sparc64-*linux*)
+ LD="${LD-ld} -m elf32_sparc"
+ ;;
+ esac
+ ;;
+ *64-bit*)
+ case $host in
+ x86_64-*kfreebsd*-gnu)
+ LD="${LD-ld} -m elf_x86_64_fbsd"
+ ;;
+ x86_64-*linux*)
+ LD="${LD-ld} -m elf_x86_64"
+ ;;
+ ppc*-*linux*|powerpc*-*linux*)
+ LD="${LD-ld} -m elf64ppc"
+ ;;
+ s390*-*linux*|s390*-*tpf*)
+ LD="${LD-ld} -m elf64_s390"
+ ;;
+ sparc*-*linux*)
+ LD="${LD-ld} -m elf64_sparc"
+ ;;
+ esac
+ ;;
+ esac
+ fi
+ rm -rf conftest*
+ ;;
+
+*-*-sco3.2v5*)
+ # On SCO OpenServer 5, we need -belf to get full-featured binaries.
+ SAVE_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -belf"
+ { $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'
+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 confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ lt_cv_cc_needs_belf=yes
+else
+ lt_cv_cc_needs_belf=no
+fi
+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'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+fi
+{ $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"
+ fi
+ ;;
+sparc*-*solaris*)
+ # Find out which ABI we are using.
+ echo 'int i;' > conftest.$ac_ext
+ if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ $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
+ yes*) LD="${LD-ld} -m elf64_sparc" ;;
+ *)
+ if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then
+ LD="${LD-ld} -64"
+ fi
+ ;;
+ esac
+ ;;
+ esac
+ fi
+ rm -rf conftest*
+ ;;
+esac
+
+need_locks="$enable_libtool_lock"
+
+
+ case $host_os in
+ rhapsody* | darwin*)
+ 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
+{ $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.
+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_DSYMUTIL="${ac_tool_prefix}dsymutil"
+ $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
+DSYMUTIL=$ac_cv_prog_DSYMUTIL
+if test -n "$DSYMUTIL"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DSYMUTIL" >&5
+$as_echo "$DSYMUTIL" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+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
+{ $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.
+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_DSYMUTIL="dsymutil"
+ $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_DSYMUTIL=$ac_cv_prog_ac_ct_DSYMUTIL
+if test -n "$ac_ct_DSYMUTIL"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DSYMUTIL" >&5
+$as_echo "$ac_ct_DSYMUTIL" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_DSYMUTIL" = x; then
+ DSYMUTIL=":"
+ 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
+ DSYMUTIL=$ac_ct_DSYMUTIL
+ fi
+else
+ DSYMUTIL="$ac_cv_prog_DSYMUTIL"
+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
+{ $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.
+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_NMEDIT="${ac_tool_prefix}nmedit"
+ $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
+NMEDIT=$ac_cv_prog_NMEDIT
+if test -n "$NMEDIT"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $NMEDIT" >&5
+$as_echo "$NMEDIT" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+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
+{ $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.
+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_NMEDIT="nmedit"
+ $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_NMEDIT=$ac_cv_prog_ac_ct_NMEDIT
+if test -n "$ac_ct_NMEDIT"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_NMEDIT" >&5
+$as_echo "$ac_ct_NMEDIT" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_NMEDIT" = x; then
+ NMEDIT=":"
+ 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
+ NMEDIT=$ac_ct_NMEDIT
+ fi
+else
+ NMEDIT="$ac_cv_prog_NMEDIT"
+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
+{ $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.
+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_LIPO="${ac_tool_prefix}lipo"
+ $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
+LIPO=$ac_cv_prog_LIPO
+if test -n "$LIPO"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIPO" >&5
+$as_echo "$LIPO" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+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
+{ $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.
+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_LIPO="lipo"
+ $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_LIPO=$ac_cv_prog_ac_ct_LIPO
+if test -n "$ac_ct_LIPO"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_LIPO" >&5
+$as_echo "$ac_ct_LIPO" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_LIPO" = x; then
+ LIPO=":"
+ 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
+ LIPO=$ac_ct_LIPO
+ fi
+else
+ LIPO="$ac_cv_prog_LIPO"
+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
+{ $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.
+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_OTOOL="${ac_tool_prefix}otool"
+ $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
+OTOOL=$ac_cv_prog_OTOOL
+if test -n "$OTOOL"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL" >&5
+$as_echo "$OTOOL" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+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
+{ $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.
+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_OTOOL="otool"
+ $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_OTOOL=$ac_cv_prog_ac_ct_OTOOL
+if test -n "$ac_ct_OTOOL"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL" >&5
+$as_echo "$ac_ct_OTOOL" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_OTOOL" = x; then
+ OTOOL=":"
+ 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
+ OTOOL=$ac_ct_OTOOL
+ fi
+else
+ OTOOL="$ac_cv_prog_OTOOL"
+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
+{ $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.
+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_OTOOL64="${ac_tool_prefix}otool64"
+ $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
+OTOOL64=$ac_cv_prog_OTOOL64
+if test -n "$OTOOL64"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL64" >&5
+$as_echo "$OTOOL64" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+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
+{ $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.
+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_OTOOL64="otool64"
+ $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_OTOOL64=$ac_cv_prog_ac_ct_OTOOL64
+if test -n "$ac_ct_OTOOL64"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL64" >&5
+$as_echo "$ac_ct_OTOOL64" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_OTOOL64" = x; then
+ OTOOL64=":"
+ 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
+ OTOOL64=$ac_ct_OTOOL64
+ fi
+else
+ OTOOL64="$ac_cv_prog_OTOOL64"
+fi
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ { $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
+ # By default we will add the -single_module flag. You can override
+ # by either setting the environment variable LT_MULTI_MODULE
+ # non-empty at configure time, or by adding -multi_module to the
+ # link flags.
+ rm -rf libconftest.dylib*
+ echo "int foo(void){return 1;}" > conftest.c
+ echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \
+-dynamiclib -Wl,-single_module conftest.c" >&5
+ $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \
+ -dynamiclib -Wl,-single_module conftest.c 2>conftest.err
+ _lt_result=$?
+ if test -f libconftest.dylib && test ! -s conftest.err && test $_lt_result = 0; then
+ lt_cv_apple_cc_single_mod=yes
+ else
+ cat conftest.err >&5
+ fi
+ rm -rf libconftest.dylib*
+ rm -f conftest.*
+ fi
+fi
+{ $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 confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ lt_cv_ld_exported_symbols_list=yes
+else
+ lt_cv_ld_exported_symbols_list=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+ LDFLAGS="$save_LDFLAGS"
+
+fi
+{ $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' ;;
+ darwin1.*)
+ _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
+ darwin*) # darwin 5.x on
+ # if running on 10.5 or later, the deployment target defaults
+ # to the OS version, if on x86, and 10.4, the deployment
+ # target defaults to 10.4. Don't you love it?
+ case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in
+ 10.0,*86*-darwin8*|10.0,*-darwin[91]*)
+ _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
+ 10.[012]*)
+ _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
+ 10.*)
+ _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
+ esac
+ ;;
+ esac
+ if test "$lt_cv_apple_cc_single_mod" = "yes"; then
+ _lt_dar_single_mod='$single_module'
+ fi
+ if test "$lt_cv_ld_exported_symbols_list" = "yes"; then
+ _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym'
+ else
+ _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}'
+ fi
+ if test "$DSYMUTIL" != ":"; then
+ _lt_dsymutil='~$DSYMUTIL $lib || :'
+ else
+ _lt_dsymutil=
+ fi
+ ;;
+ esac
+
+for ac_header in dlfcn.h
+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 HAVE_DLFCN_H 1
+_ACEOF
+
+fi
+
+done
+
+
+
+# Set options
+
+
+
+ enable_dlopen=no
+
+
+ enable_win32_dll=no
+
+
+ # Check whether --enable-shared was given.
+if test "${enable_shared+set}" = set; then :
+ enableval=$enable_shared; p=${PACKAGE-default}
+ case $enableval in
+ yes) enable_shared=yes ;;
+ no) enable_shared=no ;;
+ *)
+ enable_shared=no
+ # Look at the argument we got. We use all the common list separators.
+ lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+ for pkg in $enableval; do
+ IFS="$lt_save_ifs"
+ if test "X$pkg" = "X$p"; then
+ enable_shared=yes
+ fi
+ done
+ IFS="$lt_save_ifs"
+ ;;
+ esac
+else
+ enable_shared=yes
+fi
+
+
+
+
+
+
+
+
+
+ # Check whether --enable-static was given.
+if test "${enable_static+set}" = set; then :
+ enableval=$enable_static; p=${PACKAGE-default}
+ case $enableval in
+ yes) enable_static=yes ;;
+ no) enable_static=no ;;
+ *)
+ enable_static=no
+ # Look at the argument we got. We use all the common list separators.
+ lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+ for pkg in $enableval; do
+ IFS="$lt_save_ifs"
+ if test "X$pkg" = "X$p"; then
+ enable_static=yes
+ fi
+ done
+ IFS="$lt_save_ifs"
+ ;;
+ esac
+else
+ enable_static=yes
+fi
+
+
+
+
+
+
+
+
+
+
+# Check whether --with-pic was given.
+if test "${with_pic+set}" = set; then :
+ withval=$with_pic; pic_mode="$withval"
+else
+ pic_mode=default
+fi
+
+
+test -z "$pic_mode" && pic_mode=default
+
+
+
+
+
+
+
+ # Check whether --enable-fast-install was given.
+if test "${enable_fast_install+set}" = set; then :
+ enableval=$enable_fast_install; p=${PACKAGE-default}
+ case $enableval in
+ yes) enable_fast_install=yes ;;
+ no) enable_fast_install=no ;;
+ *)
+ enable_fast_install=no
+ # Look at the argument we got. We use all the common list separators.
+ lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+ for pkg in $enableval; do
+ IFS="$lt_save_ifs"
+ if test "X$pkg" = "X$p"; then
+ enable_fast_install=yes
+ fi
+ done
+ IFS="$lt_save_ifs"
+ ;;
+ esac
+else
+ enable_fast_install=yes
+fi
+
+
+
+
+
+
+
+
+
+
+
+# This can be used to rebuild libtool when needed
+LIBTOOL_DEPS="$ltmain"
+
+# Always use our own libtool.
+LIBTOOL='$(SHELL) $(top_builddir)/libtool'
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+test -z "$LN_S" && LN_S="ln -s"
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+if test -n "${ZSH_VERSION+set}" ; then
+ setopt NO_GLOB_SUBST
+fi
+
+{ $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
+if test -d .libs; then
+ lt_cv_objdir=.libs
+else
+ # MS-DOS does not allow filenames that begin with a dot.
+ lt_cv_objdir=_libs
+fi
+rmdir .libs 2>/dev/null
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_objdir" >&5
+$as_echo "$lt_cv_objdir" >&6; }
+objdir=$lt_cv_objdir
+
+
+
+
+
+cat >>confdefs.h <<_ACEOF
+#define LT_OBJDIR "$lt_cv_objdir/"
+_ACEOF
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+case $host_os in
+aix3*)
+ # AIX sometimes has problems with the GCC collect2 program. For some
+ # reason, if we set the COLLECT_NAMES environment variable, the problems
+ # vanish in a puff of smoke.
+ if test "X${COLLECT_NAMES+set}" != Xset; then
+ COLLECT_NAMES=
+ export COLLECT_NAMES
+ fi
+ ;;
+esac
+
+# Sed substitution that helps us do robust quoting. It backslashifies
+# metacharacters that are still active within double-quoted strings.
+sed_quote_subst='s/\(["`$\\]\)/\\\1/g'
+
+# Same as above, but do not quote variable references.
+double_quote_subst='s/\(["`\\]\)/\\\1/g'
+
+# Sed substitution to delay expansion of an escaped shell variable in a
+# double_quote_subst'ed string.
+delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g'
+
+# Sed substitution to delay expansion of an escaped single quote.
+delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g'
+
+# Sed substitution to avoid accidental globbing in evaled expressions
+no_glob_subst='s/\*/\\\*/g'
+
+# Global variables:
+ofile=libtool
+can_build_shared=yes
+
+# All known linkers require a `.a' archive for static linking (except MSVC,
+# which needs '.lib').
+libext=a
+
+with_gnu_ld="$lt_cv_prog_gnu_ld"
+
+old_CC="$CC"
+old_CFLAGS="$CFLAGS"
+
+# Set sane defaults for various variables
+test -z "$CC" && CC=cc
+test -z "$LTCC" && LTCC=$CC
+test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS
+test -z "$LD" && LD=ld
+test -z "$ac_objext" && ac_objext=o
+
+for cc_temp in $compiler""; do
+ case $cc_temp in
+ compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
+ distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
+ \-*) ;;
+ *) break;;
+ esac
+done
+cc_basename=`$ECHO "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"`
+
+
+# Only perform the check for file, if the check method requires it
+test -z "$MAGIC_CMD" && MAGIC_CMD=file
+case $deplibs_check_method in
+file_magic*)
+ if test "$file_magic_cmd" = '$MAGIC_CMD'; then
+ { $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
+[\\/*] | ?:[\\/]*)
+ lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path.
+ ;;
+*)
+ lt_save_MAGIC_CMD="$MAGIC_CMD"
+ lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+ ac_dummy="/usr/bin$PATH_SEPARATOR$PATH"
+ for ac_dir in $ac_dummy; do
+ IFS="$lt_save_ifs"
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/${ac_tool_prefix}file; then
+ lt_cv_path_MAGIC_CMD="$ac_dir/${ac_tool_prefix}file"
+ if test -n "$file_magic_test_file"; then
+ case $deplibs_check_method in
+ "file_magic "*)
+ file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"`
+ MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+ if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
+ $EGREP "$file_magic_regex" > /dev/null; then
+ :
+ else
+ cat <<_LT_EOF 1>&2
+
+*** Warning: the command libtool uses to detect shared libraries,
+*** $file_magic_cmd, produces output that libtool cannot recognize.
+*** The result is that libtool may fail to recognize shared libraries
+*** as such. This will affect the creation of libtool libraries that
+*** depend on shared libraries, but programs linked with such libtool
+*** libraries will work regardless of this problem. Nevertheless, you
+*** may want to report the problem to your system manager and/or to
+*** bug-libtool@gnu.org
+
+_LT_EOF
+ fi ;;
+ esac
+ fi
+ break
+ fi
+ done
+ IFS="$lt_save_ifs"
+ MAGIC_CMD="$lt_save_MAGIC_CMD"
+ ;;
+esac
+fi
+
+MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+if test -n "$MAGIC_CMD"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5
+$as_echo "$MAGIC_CMD" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+
+
+
+if test -z "$lt_cv_path_MAGIC_CMD"; then
+ if test -n "$ac_tool_prefix"; then
+ { $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
+[\\/*] | ?:[\\/]*)
+ lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path.
+ ;;
+*)
+ lt_save_MAGIC_CMD="$MAGIC_CMD"
+ lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+ ac_dummy="/usr/bin$PATH_SEPARATOR$PATH"
+ for ac_dir in $ac_dummy; do
+ IFS="$lt_save_ifs"
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/file; then
+ lt_cv_path_MAGIC_CMD="$ac_dir/file"
+ if test -n "$file_magic_test_file"; then
+ case $deplibs_check_method in
+ "file_magic "*)
+ file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"`
+ MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+ if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
+ $EGREP "$file_magic_regex" > /dev/null; then
+ :
+ else
+ cat <<_LT_EOF 1>&2
+
+*** Warning: the command libtool uses to detect shared libraries,
+*** $file_magic_cmd, produces output that libtool cannot recognize.
+*** The result is that libtool may fail to recognize shared libraries
+*** as such. This will affect the creation of libtool libraries that
+*** depend on shared libraries, but programs linked with such libtool
+*** libraries will work regardless of this problem. Nevertheless, you
+*** may want to report the problem to your system manager and/or to
+*** bug-libtool@gnu.org
+
+_LT_EOF
+ fi ;;
+ esac
+ fi
+ break
+ fi
+ done
+ IFS="$lt_save_ifs"
+ MAGIC_CMD="$lt_save_MAGIC_CMD"
+ ;;
+esac
+fi
+
+MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+if test -n "$MAGIC_CMD"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5
+$as_echo "$MAGIC_CMD" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ else
+ MAGIC_CMD=:
+ fi
+fi
+
+ fi
+ ;;
+esac
+
+# Use C for the default configuration in the libtool script
+
+lt_save_CC="$CC"
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+# Source file extension for C test sources.
+ac_ext=c
+
+# Object file extension for compiled C test sources.
+objext=o
+objext=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="int some_variable = 0;"
+
+# Code to be used in simple link tests
+lt_simple_link_test_code='int main(){return(0);}'
+
+
+
+
+
+
+
+# If no C compiler was specified, use CC.
+LTCC=${LTCC-"$CC"}
+
+# If no C compiler flags were specified, use CFLAGS.
+LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
+
+# Allow CC to be a program name with arguments.
+compiler=$CC
+
+# Save the default compiler, since it gets overwritten when the other
+# tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP.
+compiler_DEFAULT=$CC
+
+# save warnings/boilerplate of simple test code
+ac_outfile=conftest.$ac_objext
+echo "$lt_simple_compile_test_code" >conftest.$ac_ext
+eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_compiler_boilerplate=`cat conftest.err`
+$RM conftest*
+
+ac_outfile=conftest.$ac_objext
+echo "$lt_simple_link_test_code" >conftest.$ac_ext
+eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_linker_boilerplate=`cat conftest.err`
+$RM -r conftest*
+
+
+if test -n "$compiler"; then
+
+lt_prog_compiler_no_builtin_flag=
+
+if test "$GCC" = yes; then
+ lt_prog_compiler_no_builtin_flag=' -fno-builtin'
+
+ { $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
+ echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+ lt_compiler_flag="-fno-rtti -fno-exceptions"
+ # Insert the option either (1) after the last *FLAGS variable, or
+ # (2) before a word containing "conftest.", or (3) at the end.
+ # Note that $ac_compile itself does not contain backslashes and begins
+ # with a dollar sign (not a hyphen), so the echo should work correctly.
+ # The option is referenced via a variable to avoid confusing sed.
+ lt_compile=`echo "$ac_compile" | $SED \
+ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+ -e 's:$: $lt_compiler_flag:'`
+ (eval echo "\"\$as_me:8199: $lt_compile\"" >&5)
+ (eval "$lt_compile" 2>conftest.err)
+ ac_status=$?
+ cat conftest.err >&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.
+ $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp
+ $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+ if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
+ lt_cv_prog_compiler_rtti_exceptions=yes
+ fi
+ fi
+ $RM conftest*
+
+fi
+{ $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"
+else
+ :
+fi
+
+fi
+
+
+
+
+
+
+ lt_prog_compiler_wl=
+lt_prog_compiler_pic=
+lt_prog_compiler_static=
+
+{ $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,'
+ lt_prog_compiler_static='-static'
+
+ case $host_os in
+ aix*)
+ # All AIX code is PIC.
+ if test "$host_cpu" = ia64; then
+ # AIX 5 now supports IA64 processor
+ lt_prog_compiler_static='-Bstatic'
+ fi
+ ;;
+
+ amigaos*)
+ case $host_cpu in
+ powerpc)
+ # see comment about AmigaOS4 .so support
+ lt_prog_compiler_pic='-fPIC'
+ ;;
+ m68k)
+ # FIXME: we need at least 68020 code to build shared libraries, but
+ # adding the `-m68020' flag to GCC prevents building anything better,
+ # like `-m68040'.
+ lt_prog_compiler_pic='-m68020 -resident32 -malways-restore-a4'
+ ;;
+ esac
+ ;;
+
+ beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
+ # PIC is the default for these OSes.
+ ;;
+
+ 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
+ # (--disable-auto-import) libraries
+ lt_prog_compiler_pic='-DDLL_EXPORT'
+ ;;
+
+ darwin* | rhapsody*)
+ # PIC is the default on this platform
+ # Common symbols not allowed in MH_DYLIB files
+ lt_prog_compiler_pic='-fno-common'
+ ;;
+
+ hpux*)
+ # 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*)
+ # +Z the default
+ ;;
+ *)
+ lt_prog_compiler_pic='-fPIC'
+ ;;
+ esac
+ ;;
+
+ interix[3-9]*)
+ # Interix 3.x gcc -fpic/-fPIC options generate broken code.
+ # Instead, we relocate shared libraries at runtime.
+ ;;
+
+ msdosdjgpp*)
+ # Just because we use GCC doesn't mean we suddenly get shared libraries
+ # on systems that don't support them.
+ lt_prog_compiler_can_build_shared=no
+ enable_shared=no
+ ;;
+
+ *nto* | *qnx*)
+ # QNX uses GNU C++, but need to define -shared option too, otherwise
+ # it will coredump.
+ lt_prog_compiler_pic='-fPIC -shared'
+ ;;
+
+ sysv4*MP*)
+ if test -d /usr/nec; then
+ lt_prog_compiler_pic=-Kconform_pic
+ fi
+ ;;
+
+ *)
+ lt_prog_compiler_pic='-fPIC'
+ ;;
+ esac
+ else
+ # PORTME Check for flag to pass linker flags through the system compiler.
+ case $host_os in
+ aix*)
+ lt_prog_compiler_wl='-Wl,'
+ if test "$host_cpu" = ia64; then
+ # AIX 5 now supports IA64 processor
+ lt_prog_compiler_static='-Bstatic'
+ else
+ lt_prog_compiler_static='-bnso -bI:/lib/syscalls.exp'
+ fi
+ ;;
+
+ 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'
+ ;;
+
+ hpux9* | hpux10* | hpux11*)
+ lt_prog_compiler_wl='-Wl,'
+ # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
+ # not for PA HP-UX.
+ case $host_cpu in
+ hppa*64*|ia64*)
+ # +Z the default
+ ;;
+ *)
+ lt_prog_compiler_pic='+Z'
+ ;;
+ esac
+ # Is there a better lt_prog_compiler_static that works with the bundled CC?
+ lt_prog_compiler_static='${wl}-a ${wl}archive'
+ ;;
+
+ irix5* | irix6* | nonstopux*)
+ lt_prog_compiler_wl='-Wl,'
+ # PIC (with -KPIC) is the default.
+ lt_prog_compiler_static='-non_shared'
+ ;;
+
+ linux* | k*bsd*-gnu | kopensolaris*-gnu)
+ case $cc_basename in
+ # 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)
+ lt_prog_compiler_wl='-Wl,'
+ lt_prog_compiler_pic='-fpic'
+ lt_prog_compiler_static='-Bstatic'
+ ;;
+ ccc*)
+ lt_prog_compiler_wl='-Wl,'
+ # All Alpha code is PIC.
+ lt_prog_compiler_static='-non_shared'
+ ;;
+ xl*)
+ # IBM XL C 8.0/Fortran 10.1 on PPC
+ lt_prog_compiler_wl='-Wl,'
+ lt_prog_compiler_pic='-qpic'
+ lt_prog_compiler_static='-qstaticlink'
+ ;;
+ *)
+ case `$CC -V 2>&1 | sed 5q` in
+ *Sun\ C*)
+ # Sun C 5.9
+ lt_prog_compiler_pic='-KPIC'
+ lt_prog_compiler_static='-Bstatic'
+ lt_prog_compiler_wl='-Wl,'
+ ;;
+ *Sun\ F*)
+ # Sun Fortran 8.3 passes all unrecognized flags to the linker
+ lt_prog_compiler_pic='-KPIC'
+ lt_prog_compiler_static='-Bstatic'
+ lt_prog_compiler_wl=''
+ ;;
+ esac
+ ;;
+ esac
+ ;;
+
+ newsos6)
+ lt_prog_compiler_pic='-KPIC'
+ lt_prog_compiler_static='-Bstatic'
+ ;;
+
+ *nto* | *qnx*)
+ # QNX uses GNU C++, but need to define -shared option too, otherwise
+ # it will coredump.
+ lt_prog_compiler_pic='-fPIC -shared'
+ ;;
+
+ osf3* | osf4* | osf5*)
+ lt_prog_compiler_wl='-Wl,'
+ # All OSF/1 code is PIC.
+ lt_prog_compiler_static='-non_shared'
+ ;;
+
+ rdos*)
+ lt_prog_compiler_static='-non_shared'
+ ;;
+
+ solaris*)
+ lt_prog_compiler_pic='-KPIC'
+ lt_prog_compiler_static='-Bstatic'
+ case $cc_basename in
+ f77* | f90* | f95*)
+ lt_prog_compiler_wl='-Qoption ld ';;
+ *)
+ lt_prog_compiler_wl='-Wl,';;
+ esac
+ ;;
+
+ sunos4*)
+ lt_prog_compiler_wl='-Qoption ld '
+ lt_prog_compiler_pic='-PIC'
+ lt_prog_compiler_static='-Bstatic'
+ ;;
+
+ sysv4 | sysv4.2uw2* | sysv4.3*)
+ lt_prog_compiler_wl='-Wl,'
+ lt_prog_compiler_pic='-KPIC'
+ lt_prog_compiler_static='-Bstatic'
+ ;;
+
+ sysv4*MP*)
+ if test -d /usr/nec ;then
+ lt_prog_compiler_pic='-Kconform_pic'
+ lt_prog_compiler_static='-Bstatic'
+ fi
+ ;;
+
+ sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
+ lt_prog_compiler_wl='-Wl,'
+ lt_prog_compiler_pic='-KPIC'
+ lt_prog_compiler_static='-Bstatic'
+ ;;
+
+ unicos*)
+ lt_prog_compiler_wl='-Wl,'
+ lt_prog_compiler_can_build_shared=no
+ ;;
+
+ uts4*)
+ lt_prog_compiler_pic='-pic'
+ lt_prog_compiler_static='-Bstatic'
+ ;;
+
+ *)
+ lt_prog_compiler_can_build_shared=no
+ ;;
+ esac
+ fi
+
+case $host_os in
+ # For platforms which do not support PIC, -DPIC is meaningless:
+ *djgpp*)
+ lt_prog_compiler_pic=
+ ;;
+ *)
+ lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC"
+ ;;
+esac
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_prog_compiler_pic" >&5
+$as_echo "$lt_prog_compiler_pic" >&6; }
+
+
+
+
+
+
+#
+# Check to make sure the PIC flag actually works.
+#
+if test -n "$lt_prog_compiler_pic"; then
+ { $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
+ echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+ lt_compiler_flag="$lt_prog_compiler_pic -DPIC"
+ # Insert the option either (1) after the last *FLAGS variable, or
+ # (2) before a word containing "conftest.", or (3) at the end.
+ # Note that $ac_compile itself does not contain backslashes and begins
+ # with a dollar sign (not a hyphen), so the echo should work correctly.
+ # The option is referenced via a variable to avoid confusing sed.
+ lt_compile=`echo "$ac_compile" | $SED \
+ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+ -e 's:$: $lt_compiler_flag:'`
+ (eval echo "\"\$as_me:8538: $lt_compile\"" >&5)
+ (eval "$lt_compile" 2>conftest.err)
+ ac_status=$?
+ cat conftest.err >&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.
+ $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp
+ $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+ if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
+ lt_cv_prog_compiler_pic_works=yes
+ fi
+ fi
+ $RM conftest*
+
+fi
+{ $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
+ "" | " "*) ;;
+ *) lt_prog_compiler_pic=" $lt_prog_compiler_pic" ;;
+ esac
+else
+ lt_prog_compiler_pic=
+ lt_prog_compiler_can_build_shared=no
+fi
+
+fi
+
+
+
+
+
+
+#
+# Check to make sure the static flag actually works.
+#
+wl=$lt_prog_compiler_wl eval lt_tmp_static_flag=\"$lt_prog_compiler_static\"
+{ $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"
+ LDFLAGS="$LDFLAGS $lt_tmp_static_flag"
+ echo "$lt_simple_link_test_code" > conftest.$ac_ext
+ if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
+ # The linker can only warn and ignore the option if not recognized
+ # So say no if there are warnings
+ if test -s conftest.err; then
+ # Append any errors to the config.log.
+ cat conftest.err 1>&5
+ $ECHO "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp
+ $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+ if diff conftest.exp conftest.er2 >/dev/null; then
+ lt_cv_prog_compiler_static_works=yes
+ fi
+ else
+ lt_cv_prog_compiler_static_works=yes
+ fi
+ fi
+ $RM -r conftest*
+ LDFLAGS="$save_LDFLAGS"
+
+fi
+{ $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
+ :
+else
+ lt_prog_compiler_static=
+fi
+
+
+
+
+
+
+
+ { $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
+ mkdir conftest
+ cd conftest
+ mkdir out
+ echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+ lt_compiler_flag="-o out/conftest2.$ac_objext"
+ # Insert the option either (1) after the last *FLAGS variable, or
+ # (2) before a word containing "conftest.", or (3) at the end.
+ # Note that $ac_compile itself does not contain backslashes and begins
+ # with a dollar sign (not a hyphen), so the echo should work correctly.
+ lt_compile=`echo "$ac_compile" | $SED \
+ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+ -e 's:$: $lt_compiler_flag:'`
+ (eval echo "\"\$as_me:8643: $lt_compile\"" >&5)
+ (eval "$lt_compile" 2>out/conftest.err)
+ ac_status=$?
+ cat out/conftest.err >&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
+ # So say no if there are warnings
+ $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp
+ $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
+ if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
+ lt_cv_prog_compiler_c_o=yes
+ fi
+ fi
+ chmod u+w . 2>&5
+ $RM conftest*
+ # SGI C++ compiler will create directory out/ii_files/ for
+ # template instantiation
+ test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files
+ $RM out/* && rmdir out
+ cd ..
+ $RM -r conftest
+ $RM conftest*
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5
+$as_echo "$lt_cv_prog_compiler_c_o" >&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
+ mkdir conftest
+ cd conftest
+ mkdir out
+ echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+ lt_compiler_flag="-o out/conftest2.$ac_objext"
+ # Insert the option either (1) after the last *FLAGS variable, or
+ # (2) before a word containing "conftest.", or (3) at the end.
+ # Note that $ac_compile itself does not contain backslashes and begins
+ # with a dollar sign (not a hyphen), so the echo should work correctly.
+ lt_compile=`echo "$ac_compile" | $SED \
+ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+ -e 's:$: $lt_compiler_flag:'`
+ (eval echo "\"\$as_me:8698: $lt_compile\"" >&5)
+ (eval "$lt_compile" 2>out/conftest.err)
+ ac_status=$?
+ cat out/conftest.err >&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
+ # So say no if there are warnings
+ $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp
+ $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
+ if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
+ lt_cv_prog_compiler_c_o=yes
+ fi
+ fi
+ chmod u+w . 2>&5
+ $RM conftest*
+ # SGI C++ compiler will create directory out/ii_files/ for
+ # template instantiation
+ test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files
+ $RM out/* && rmdir out
+ cd ..
+ $RM -r conftest
+ $RM conftest*
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5
+$as_echo "$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
+ { $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
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5
+$as_echo "$hard_links" >&6; }
+ if test "$hard_links" = no; then
+ { $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
+ need_locks=no
+fi
+
+
+
+
+
+
+ { $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=
+ always_export_symbols=no
+ archive_cmds=
+ archive_expsym_cmds=
+ compiler_needs_object=no
+ enable_shared_with_static_runtimes=no
+ export_dynamic_flag_spec=
+ export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+ hardcode_automatic=no
+ hardcode_direct=no
+ hardcode_direct_absolute=no
+ hardcode_libdir_flag_spec=
+ hardcode_libdir_flag_spec_ld=
+ hardcode_libdir_separator=
+ hardcode_minus_L=no
+ hardcode_shlibpath_var=unsupported
+ inherit_rpath=no
+ link_all_deplibs=unknown
+ module_cmds=
+ module_expsym_cmds=
+ old_archive_from_new_cmds=
+ old_archive_from_expsyms_cmds=
+ thread_safe_flag_spec=
+ whole_archive_flag_spec=
+ # include_expsyms should be a list of space-separated symbols to be *always*
+ # included in the symbol list
+ include_expsyms=
+ # exclude_expsyms can be an extended regexp of symbols to exclude
+ # it will be wrapped by ` (' and `)$', so one must not match beginning or
+ # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc',
+ # as well as any symbol that contains `d'.
+ exclude_expsyms='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'
+ # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out
+ # platforms (ab)use it in PIC code, but their linkers get confused if
+ # the symbol is explicitly referenced. Since portable code cannot
+ # rely on this symbol name, it's probably fine to never include it in
+ # preloaded symbol tables.
+ # Exclude shared library initialization/finalization symbols.
+ extract_expsyms_cmds=
+
+ case $host_os in
+ 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++.
+ if test "$GCC" != yes; then
+ with_gnu_ld=no
+ fi
+ ;;
+ interix*)
+ # we just hope/assume this is gcc and not c89 (= MSVC++)
+ with_gnu_ld=yes
+ ;;
+ openbsd*)
+ with_gnu_ld=no
+ ;;
+ linux* | k*bsd*-gnu)
+ link_all_deplibs=no
+ ;;
+ esac
+
+ ld_shlibs=yes
+ if test "$with_gnu_ld" = yes; then
+ # If archive_cmds runs LD, not CC, wlarc should be empty
+ wlarc='${wl}'
+
+ # Set some defaults for GNU ld with shared library support. These
+ # are reset later if shared libraries are not supported. Putting them
+ # here allows them to be overridden if necessary.
+ runpath_var=LD_RUN_PATH
+ hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+ export_dynamic_flag_spec='${wl}--export-dynamic'
+ # ancient GNU ld didn't support --whole-archive et. al.
+ if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then
+ whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+ else
+ whole_archive_flag_spec=
+ fi
+ supports_anon_versioning=no
+ case `$LD -v 2>&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 ...
+ *\ 2.11.*) ;; # other 2.11 versions
+ *) supports_anon_versioning=yes ;;
+ esac
+
+ # See if GNU ld supports shared libraries.
+ case $host_os in
+ aix[3-9]*)
+ # On AIX/PPC, the GNU linker is very broken
+ if test "$host_cpu" != ia64; then
+ ld_shlibs=no
+ cat <<_LT_EOF 1>&2
+
+*** Warning: the GNU linker, at least up to release 2.9.1, is reported
+*** to be unable to reliably create shared libraries on AIX.
+*** Therefore, libtool is disabling shared libraries support. If you
+*** really care for shared libraries, you may want to modify your PATH
+*** so that a non-GNU linker is found, and then restart.
+
+_LT_EOF
+ fi
+ ;;
+
+ amigaos*)
+ case $host_cpu in
+ powerpc)
+ # see comment about AmigaOS4 .so support
+ archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ archive_expsym_cmds=''
+ ;;
+ m68k)
+ archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_minus_L=yes
+ ;;
+ esac
+ ;;
+
+ beos*)
+ if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+ allow_undefined_flag=unsupported
+ # Joseph Beckenbach <jrb3@best.com> says some releases of gcc
+ # support --undefined. This deserves some investigation. FIXME
+ archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ else
+ ld_shlibs=no
+ fi
+ ;;
+
+ cygwin* | mingw* | pw32* | cegcc*)
+ # _LT_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless,
+ # as there is no search path for DLLs.
+ hardcode_libdir_flag_spec='-L$libdir'
+ allow_undefined_flag=unsupported
+ always_export_symbols=no
+ enable_shared_with_static_runtimes=yes
+ export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols'
+
+ if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then
+ archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+ # If the export-symbols file already is a .def file (1st line
+ # is EXPORTS), use it as is; otherwise, prepend...
+ archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+ cp $export_symbols $output_objdir/$soname.def;
+ else
+ echo EXPORTS > $output_objdir/$soname.def;
+ cat $export_symbols >> $output_objdir/$soname.def;
+ fi~
+ $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+ else
+ ld_shlibs=no
+ fi
+ ;;
+
+ interix[3-9]*)
+ hardcode_direct=no
+ hardcode_shlibpath_var=no
+ hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
+ export_dynamic_flag_spec='${wl}-E'
+ # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
+ # Instead, shared libraries are loaded at an image base (0x10000000 by
+ # default) and relocated if they conflict, which is a slow very memory
+ # consuming and fragmenting process. To avoid this, we pick a random,
+ # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
+ # time. Moving up from 0x10000000 also allows more sbrk(2) space.
+ archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+ archive_expsym_cmds='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+ ;;
+
+ gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu)
+ tmp_diet=no
+ if test "$host_os" = linux-dietlibc; then
+ case $cc_basename in
+ diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn)
+ esac
+ fi
+ if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \
+ && test "$tmp_diet" = no
+ then
+ tmp_addflag=
+ tmp_sharedflag='-shared'
+ case $cc_basename,$host_cpu in
+ pgcc*) # Portland Group C compiler
+ whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive'
+ tmp_addflag=' $pic_flag'
+ ;;
+ pgf77* | pgf90* | pgf95*) # Portland Group f77 and f90 compilers
+ whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive'
+ tmp_addflag=' $pic_flag -Mnomain' ;;
+ ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64
+ tmp_addflag=' -i_dynamic' ;;
+ efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64
+ tmp_addflag=' -i_dynamic -nofor_main' ;;
+ ifc* | ifort*) # Intel Fortran compiler
+ tmp_addflag=' -nofor_main' ;;
+ 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= ;;
+ esac
+ case `$CC -V 2>&1 | sed 5q` in
+ *Sun\ C*) # Sun C 5.9
+ whole_archive_flag_spec='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive'
+ compiler_needs_object=yes
+ tmp_sharedflag='-G' ;;
+ *Sun\ F*) # Sun Fortran 8.3
+ tmp_sharedflag='-G' ;;
+ esac
+ archive_cmds='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+
+ if test "x$supports_anon_versioning" = xyes; then
+ archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~
+ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
+ echo "local: *; };" >> $output_objdir/$libname.ver~
+ $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
+ fi
+
+ case $cc_basename in
+ xlf*)
+ # IBM XL Fortran 10.1 on PPC cannot create shared libs itself
+ whole_archive_flag_spec='--whole-archive$convenience --no-whole-archive'
+ hardcode_libdir_flag_spec=
+ hardcode_libdir_flag_spec_ld='-rpath $libdir'
+ archive_cmds='$LD -shared $libobjs $deplibs $compiler_flags -soname $soname -o $lib'
+ if test "x$supports_anon_versioning" = xyes; then
+ archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~
+ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
+ echo "local: *; };" >> $output_objdir/$libname.ver~
+ $LD -shared $libobjs $deplibs $compiler_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib'
+ fi
+ ;;
+ esac
+ else
+ ld_shlibs=no
+ fi
+ ;;
+
+ netbsd* | netbsdelf*-gnu)
+ if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
+ archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
+ wlarc=
+ else
+ archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ fi
+ ;;
+
+ solaris*)
+ if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then
+ ld_shlibs=no
+ cat <<_LT_EOF 1>&2
+
+*** Warning: The releases 2.8.* of the GNU linker cannot reliably
+*** create shared libraries on Solaris systems. Therefore, libtool
+*** is disabling shared libraries support. We urge you to upgrade GNU
+*** binutils to release 2.9.1 or newer. Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
+
+_LT_EOF
+ elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+ archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ else
+ ld_shlibs=no
+ fi
+ ;;
+
+ sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*)
+ case `$LD -v 2>&1` in
+ *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*)
+ ld_shlibs=no
+ cat <<_LT_EOF 1>&2
+
+*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not
+*** reliably create shared libraries on SCO systems. Therefore, libtool
+*** is disabling shared libraries support. We urge you to upgrade GNU
+*** binutils to release 2.16.91.0.3 or newer. Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
+
+_LT_EOF
+ ;;
+ *)
+ # For security reasons, it is highly recommended that you always
+ # use absolute paths for naming shared libraries, and exclude the
+ # DT_RUNPATH tag from executables and libraries. But doing so
+ # requires that you compile everything twice, which is a pain.
+ if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+ hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+ archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ else
+ ld_shlibs=no
+ fi
+ ;;
+ esac
+ ;;
+
+ sunos4*)
+ archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+ wlarc=
+ hardcode_direct=yes
+ hardcode_shlibpath_var=no
+ ;;
+
+ *)
+ if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+ archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ else
+ ld_shlibs=no
+ fi
+ ;;
+ esac
+
+ if test "$ld_shlibs" = no; then
+ runpath_var=
+ hardcode_libdir_flag_spec=
+ export_dynamic_flag_spec=
+ whole_archive_flag_spec=
+ fi
+ else
+ # PORTME fill in a description of your system's linker (not GNU ld)
+ case $host_os in
+ aix3*)
+ allow_undefined_flag=unsupported
+ always_export_symbols=yes
+ archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname'
+ # Note: this linker hardcodes the directories in LIBPATH if there
+ # are no directories specified by -L.
+ hardcode_minus_L=yes
+ if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then
+ # Neither direct hardcoding nor static linking is supported with a
+ # broken collect2.
+ hardcode_direct=unsupported
+ fi
+ ;;
+
+ aix[4-9]*)
+ if test "$host_cpu" = ia64; then
+ # On IA64, the linker does run time linking by default, so we don't
+ # have to do anything special.
+ aix_use_runtimelinking=no
+ exp_sym_flag='-Bexport'
+ no_entry_flag=""
+ else
+ # If we're using GNU nm, then we don't want the "-C" option.
+ # -C means demangle to AIX nm, but means don't demangle with GNU nm
+ if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then
+ export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+ else
+ export_symbols_cmds='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+ fi
+ aix_use_runtimelinking=no
+
+ # Test if we are trying to use run time linking or normal
+ # AIX style linking. If -brtl is somewhere in LDFLAGS, we
+ # need to do runtime linking.
+ case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*)
+ for ld_flag in $LDFLAGS; do
+ if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
+ aix_use_runtimelinking=yes
+ break
+ fi
+ done
+ ;;
+ esac
+
+ exp_sym_flag='-bexport'
+ no_entry_flag='-bnoentry'
+ fi
+
+ # When large executables or shared objects are built, AIX ld can
+ # have problems creating the table of contents. If linking a library
+ # or program results in "error TOC overflow" add -mminimal-toc to
+ # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not
+ # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
+
+ archive_cmds=''
+ hardcode_direct=yes
+ hardcode_direct_absolute=yes
+ hardcode_libdir_separator=':'
+ link_all_deplibs=yes
+ file_list_spec='${wl}-f,'
+
+ if test "$GCC" = yes; then
+ case $host_os in aix4.[012]|aix4.[012].*)
+ # We only want to do this on AIX 4.2 and lower, the check
+ # below for broken collect2 doesn't work under 4.3+
+ collect2name=`${CC} -print-prog-name=collect2`
+ if test -f "$collect2name" &&
+ strings "$collect2name" | $GREP resolve_lib_name >/dev/null
+ then
+ # We have reworked collect2
+ :
+ else
+ # We have old collect2
+ hardcode_direct=unsupported
+ # It fails to find uninstalled libraries when the uninstalled
+ # path is not listed in the libpath. Setting hardcode_minus_L
+ # to unsupported forces relinking
+ hardcode_minus_L=yes
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_libdir_separator=
+ fi
+ ;;
+ esac
+ shared_flag='-shared'
+ if test "$aix_use_runtimelinking" = yes; then
+ shared_flag="$shared_flag "'${wl}-G'
+ fi
+ link_all_deplibs=no
+ else
+ # not using gcc
+ if test "$host_cpu" = ia64; then
+ # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
+ # chokes on -Wl,-G. The following line is correct:
+ shared_flag='-G'
+ else
+ if test "$aix_use_runtimelinking" = yes; then
+ shared_flag='${wl}-G'
+ else
+ shared_flag='${wl}-bM:SRE'
+ fi
+ fi
+ fi
+
+ 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
+ if test "$aix_use_runtimelinking" = yes; then
+ # Warning - without using the other runtime loading flags (-brtl),
+ # -berok will link without error, but may produce a broken library.
+ allow_undefined_flag='-berok'
+ # Determine the default libpath from the value encoded in an
+ # empty executable.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+
+lt_aix_libpath_sed='
+ /Import File Strings/,/^$/ {
+ /^0/ {
+ s/^0 *\(.*\)$/\1/
+ p
+ }
+ }'
+aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+# Check for a 64-bit object if we didn't find anything.
+if test -z "$aix_libpath"; then
+ aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+fi
+fi
+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"
+ archive_expsym_cmds='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then $ECHO "X${wl}${allow_undefined_flag}" | $Xsed; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+ else
+ if test "$host_cpu" = ia64; then
+ hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib'
+ allow_undefined_flag="-z nodefs"
+ archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols"
+ else
+ # Determine the default libpath from the value encoded in an
+ # empty executable.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+
+lt_aix_libpath_sed='
+ /Import File Strings/,/^$/ {
+ /^0/ {
+ s/^0 *\(.*\)$/\1/
+ p
+ }
+ }'
+aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+# Check for a 64-bit object if we didn't find anything.
+if test -z "$aix_libpath"; then
+ aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+fi
+fi
+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"
+ # Warning - without using the other run time loading flags,
+ # -berok will link without error, but may produce a broken library.
+ no_undefined_flag=' ${wl}-bernotok'
+ allow_undefined_flag=' ${wl}-berok'
+ # Exported symbols can be pulled into shared objects from archives
+ whole_archive_flag_spec='$convenience'
+ archive_cmds_need_lc=yes
+ # This is similar to how AIX traditionally builds its shared libraries.
+ archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
+ fi
+ fi
+ ;;
+
+ amigaos*)
+ case $host_cpu in
+ powerpc)
+ # see comment about AmigaOS4 .so support
+ archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ archive_expsym_cmds=''
+ ;;
+ m68k)
+ archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_minus_L=yes
+ ;;
+ esac
+ ;;
+
+ bsdi[45]*)
+ export_dynamic_flag_spec=-rdynamic
+ ;;
+
+ 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
+ # no search path for DLLs.
+ hardcode_libdir_flag_spec=' '
+ allow_undefined_flag=unsupported
+ # Tell ltmain to make .lib files, not .a files.
+ libext=lib
+ # Tell ltmain to make .dll files, not .so files.
+ shrext_cmds=".dll"
+ # FIXME: Setting linknames here is a bad hack.
+ archive_cmds='$CC -o $lib $libobjs $compiler_flags `$ECHO "X$deplibs" | $Xsed -e '\''s/ -lc$//'\''` -link -dll~linknames='
+ # The linker will automatically build a .lib file if we build a DLL.
+ old_archive_from_new_cmds='true'
+ # FIXME: Should let the user specify the lib program.
+ old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs'
+ fix_srcfile_path='`cygpath -w "$srcfile"`'
+ enable_shared_with_static_runtimes=yes
+ ;;
+
+ darwin* | rhapsody*)
+
+
+ archive_cmds_need_lc=no
+ hardcode_direct=no
+ hardcode_automatic=yes
+ hardcode_shlibpath_var=unsupported
+ whole_archive_flag_spec=''
+ link_all_deplibs=yes
+ allow_undefined_flag="$_lt_dar_allow_undefined"
+ 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}"
+ archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
+
+ else
+ ld_shlibs=no
+ fi
+
+ ;;
+
+ dgux*)
+ archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_shlibpath_var=no
+ ;;
+
+ freebsd1*)
+ ld_shlibs=no
+ ;;
+
+ # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor
+ # support. Future versions do this automatically, but an explicit c++rt0.o
+ # does not break anything, and helps significantly (at the cost of a little
+ # extra space).
+ freebsd2.2*)
+ archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o'
+ hardcode_libdir_flag_spec='-R$libdir'
+ hardcode_direct=yes
+ hardcode_shlibpath_var=no
+ ;;
+
+ # Unfortunately, older versions of FreeBSD 2 do not have this feature.
+ freebsd2*)
+ archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_direct=yes
+ hardcode_minus_L=yes
+ hardcode_shlibpath_var=no
+ ;;
+
+ # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
+ freebsd* | dragonfly*)
+ archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags'
+ hardcode_libdir_flag_spec='-R$libdir'
+ hardcode_direct=yes
+ hardcode_shlibpath_var=no
+ ;;
+
+ hpux9*)
+ if test "$GCC" = yes; then
+ archive_cmds='$RM $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+ else
+ archive_cmds='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+ fi
+ hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+ hardcode_libdir_separator=:
+ hardcode_direct=yes
+
+ # hardcode_minus_L: Not really in the search PATH,
+ # but as the default location of the library.
+ hardcode_minus_L=yes
+ export_dynamic_flag_spec='${wl}-E'
+ ;;
+
+ hpux10*)
+ if test "$GCC" = yes -a "$with_gnu_ld" = no; then
+ archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+ else
+ archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
+ fi
+ if test "$with_gnu_ld" = no; then
+ hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+ hardcode_libdir_flag_spec_ld='+b $libdir'
+ hardcode_libdir_separator=:
+ hardcode_direct=yes
+ hardcode_direct_absolute=yes
+ export_dynamic_flag_spec='${wl}-E'
+ # hardcode_minus_L: Not really in the search PATH,
+ # but as the default location of the library.
+ hardcode_minus_L=yes
+ fi
+ ;;
+
+ hpux11*)
+ if test "$GCC" = yes -a "$with_gnu_ld" = no; then
+ case $host_cpu in
+ hppa*64*)
+ archive_cmds='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ ia64*)
+ archive_cmds='$CC -shared -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'
+ ;;
+ esac
+ else
+ case $host_cpu in
+ hppa*64*)
+ archive_cmds='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ ia64*)
+ archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ *)
+ archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ esac
+ fi
+ if test "$with_gnu_ld" = no; then
+ hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+ hardcode_libdir_separator=:
+
+ case $host_cpu in
+ hppa*64*|ia64*)
+ hardcode_direct=no
+ hardcode_shlibpath_var=no
+ ;;
+ *)
+ hardcode_direct=yes
+ hardcode_direct_absolute=yes
+ export_dynamic_flag_spec='${wl}-E'
+
+ # hardcode_minus_L: Not really in the search PATH,
+ # but as the default location of the library.
+ hardcode_minus_L=yes
+ ;;
+ esac
+ fi
+ ;;
+
+ irix5* | irix6* | nonstopux*)
+ if test "$GCC" = yes; then
+ archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+ # Try to use the -exported_symbol ld option, if it does not
+ # work, assume that -exports_file does not work either and
+ # implicitly export all symbols.
+ save_LDFLAGS="$LDFLAGS"
+ LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+int foo(void) {}
+_ACEOF
+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'
+
+fi
+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'
+ archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib'
+ fi
+ archive_cmds_need_lc='no'
+ hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+ hardcode_libdir_separator=:
+ inherit_rpath=yes
+ link_all_deplibs=yes
+ ;;
+
+ 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
+ archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF
+ fi
+ hardcode_libdir_flag_spec='-R$libdir'
+ hardcode_direct=yes
+ hardcode_shlibpath_var=no
+ ;;
+
+ newsos6)
+ archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_direct=yes
+ hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+ hardcode_libdir_separator=:
+ hardcode_shlibpath_var=no
+ ;;
+
+ *nto* | *qnx*)
+ ;;
+
+ openbsd*)
+ if test -f /usr/libexec/ld.so; then
+ hardcode_direct=yes
+ hardcode_shlibpath_var=no
+ hardcode_direct_absolute=yes
+ if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+ archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+ archive_expsym_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols'
+ hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
+ export_dynamic_flag_spec='${wl}-E'
+ else
+ case $host_os in
+ openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*)
+ archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_libdir_flag_spec='-R$libdir'
+ ;;
+ *)
+ archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+ hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
+ ;;
+ esac
+ fi
+ else
+ ld_shlibs=no
+ fi
+ ;;
+
+ os2*)
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_minus_L=yes
+ allow_undefined_flag=unsupported
+ archive_cmds='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$ECHO DATA >> $output_objdir/$libname.def~$ECHO " SINGLE NONSHARED" >> $output_objdir/$libname.def~$ECHO EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def'
+ old_archive_from_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def'
+ ;;
+
+ osf3*)
+ if test "$GCC" = yes; then
+ allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
+ archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+ else
+ allow_undefined_flag=' -expect_unresolved \*'
+ archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'
+ fi
+ archive_cmds_need_lc='no'
+ hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+ hardcode_libdir_separator=:
+ ;;
+
+ osf4* | osf5*) # as osf3* with the addition of -msym flag
+ if test "$GCC" = yes; then
+ allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
+ archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+ hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+ else
+ allow_undefined_flag=' -expect_unresolved \*'
+ archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'
+ archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~
+ $CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp'
+
+ # Both c and cxx compiler support -rpath directly
+ hardcode_libdir_flag_spec='-rpath $libdir'
+ fi
+ archive_cmds_need_lc='no'
+ hardcode_libdir_separator=:
+ ;;
+
+ solaris*)
+ no_undefined_flag=' -z defs'
+ if test "$GCC" = yes; then
+ wlarc='${wl}'
+ archive_cmds='$CC -shared ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+ $CC -shared ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
+ else
+ case `$CC -V 2>&1` in
+ *"Compilers 5.0"*)
+ wlarc=''
+ archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp'
+ ;;
+ *)
+ wlarc='${wl}'
+ archive_cmds='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags'
+ archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+ $CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
+ ;;
+ esac
+ fi
+ hardcode_libdir_flag_spec='-R$libdir'
+ hardcode_shlibpath_var=no
+ case $host_os in
+ solaris2.[0-5] | solaris2.[0-5].*) ;;
+ *)
+ # The compiler driver will combine and reorder linker options,
+ # but understands `-z linker_flag'. GCC discards it without `$wl',
+ # but is careful enough not to reorder.
+ # Supported since Solaris 2.6 (maybe 2.5.1?)
+ if test "$GCC" = yes; then
+ whole_archive_flag_spec='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
+ else
+ whole_archive_flag_spec='-z allextract$convenience -z defaultextract'
+ fi
+ ;;
+ esac
+ link_all_deplibs=yes
+ ;;
+
+ sunos4*)
+ if test "x$host_vendor" = xsequent; then
+ # Use $CC to link under sequent, because it throws in some extra .o
+ # files that make .init and .fini sections work.
+ archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags'
+ else
+ archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags'
+ fi
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_direct=yes
+ hardcode_minus_L=yes
+ hardcode_shlibpath_var=no
+ ;;
+
+ sysv4)
+ case $host_vendor in
+ sni)
+ archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_direct=yes # is this really true???
+ ;;
+ siemens)
+ ## LD is ld it makes a PLAMLIB
+ ## CC just makes a GrossModule.
+ archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags'
+ reload_cmds='$CC -r -o $output$reload_objs'
+ hardcode_direct=no
+ ;;
+ motorola)
+ archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_direct=no #Motorola manual says yes, but my tests say they lie
+ ;;
+ esac
+ runpath_var='LD_RUN_PATH'
+ hardcode_shlibpath_var=no
+ ;;
+
+ sysv4.3*)
+ archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_shlibpath_var=no
+ export_dynamic_flag_spec='-Bexport'
+ ;;
+
+ sysv4*MP*)
+ if test -d /usr/nec; then
+ archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_shlibpath_var=no
+ runpath_var=LD_RUN_PATH
+ hardcode_runpath_var=yes
+ ld_shlibs=yes
+ fi
+ ;;
+
+ sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*)
+ no_undefined_flag='${wl}-z,text'
+ archive_cmds_need_lc=no
+ hardcode_shlibpath_var=no
+ runpath_var='LD_RUN_PATH'
+
+ if test "$GCC" = yes; then
+ archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ else
+ archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ fi
+ ;;
+
+ sysv5* | sco3.2v5* | sco5v6*)
+ # Note: We can NOT use -z defs as we might desire, because we do not
+ # link with -lc, and that would cause any symbols used from libc to
+ # always be unresolved, which means just about no library would
+ # ever link correctly. If we're not using GNU ld we use -z text
+ # though, which does catch some bad symbols but isn't as heavy-handed
+ # as -z defs.
+ no_undefined_flag='${wl}-z,text'
+ allow_undefined_flag='${wl}-z,nodefs'
+ archive_cmds_need_lc=no
+ hardcode_shlibpath_var=no
+ hardcode_libdir_flag_spec='${wl}-R,$libdir'
+ hardcode_libdir_separator=':'
+ link_all_deplibs=yes
+ export_dynamic_flag_spec='${wl}-Bexport'
+ runpath_var='LD_RUN_PATH'
+
+ if test "$GCC" = yes; then
+ archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ else
+ archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ fi
+ ;;
+
+ uts4*)
+ archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_shlibpath_var=no
+ ;;
+
+ *)
+ ld_shlibs=no
+ ;;
+ esac
+
+ if test x$host_vendor = xsni; then
+ case $host in
+ sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
+ export_dynamic_flag_spec='${wl}-Blargedynsym'
+ ;;
+ esac
+ fi
+ fi
+
+{ $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
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+#
+# Do we need to explicitly link libc?
+#
+case "x$archive_cmds_need_lc" in
+x|xyes)
+ # Assume -lc should be added
+ archive_cmds_need_lc=yes
+
+ if test "$enable_shared" = yes && test "$GCC" = yes; then
+ case $archive_cmds in
+ *'~'*)
+ # FIXME: we may have to deal with multi-command sequences.
+ ;;
+ '$CC '*)
+ # Test whether the compiler implicitly links with -lc since on some
+ # systems, -lgcc has to come before -lc. If gcc already passes -lc
+ # to ld, don't add -lc before -lgcc.
+ { $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\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ $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
+ deplibs=
+ wl=$lt_prog_compiler_wl
+ pic_flag=$lt_prog_compiler_pic
+ compiler_flags=-v
+ linker_flags=-v
+ verstring=
+ output_objdir=.
+ libname=conftest
+ lt_save_allow_undefined_flag=$allow_undefined_flag
+ allow_undefined_flag=
+ if { { eval echo "\"\$as_me\":${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=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }
+ then
+ archive_cmds_need_lc=no
+ else
+ archive_cmds_need_lc=yes
+ fi
+ allow_undefined_flag=$lt_save_allow_undefined_flag
+ else
+ cat conftest.err 1>&5
+ fi
+ $RM conftest*
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $archive_cmds_need_lc" >&5
+$as_echo "$archive_cmds_need_lc" >&6; }
+ ;;
+ esac
+ fi
+ ;;
+esac
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ { $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
+ darwin*) lt_awk_arg="/^libraries:/,/LR/" ;;
+ *) lt_awk_arg="/^libraries:/" ;;
+ esac
+ lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e "s,=/,/,g"`
+ if $ECHO "$lt_search_path_spec" | $GREP ';' >/dev/null ; then
+ # if the path contains ";" then we assume it to be the separator
+ # otherwise default to the standard path separator (i.e. ":") - it is
+ # assumed that no part of a normal pathname contains ";" but that should
+ # okay in the real world where ";" in dirpaths is itself problematic.
+ lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED -e 's/;/ /g'`
+ else
+ lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
+ fi
+ # Ok, now we have the path, separated by spaces, we can step through it
+ # and add multilib dir if necessary.
+ lt_tmp_lt_search_path_spec=
+ lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null`
+ for lt_sys_path in $lt_search_path_spec; do
+ if test -d "$lt_sys_path/$lt_multi_os_dir"; then
+ lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir"
+ else
+ test -d "$lt_sys_path" && \
+ lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path"
+ fi
+ done
+ lt_search_path_spec=`$ECHO $lt_tmp_lt_search_path_spec | awk '
+BEGIN {RS=" "; FS="/|\n";} {
+ lt_foo="";
+ lt_count=0;
+ for (lt_i = NF; lt_i > 0; lt_i--) {
+ if ($lt_i != "" && $lt_i != ".") {
+ if ($lt_i == "..") {
+ lt_count++;
+ } else {
+ if (lt_count == 0) {
+ lt_foo="/" $lt_i lt_foo;
+ } else {
+ lt_count--;
+ }
+ }
+ }
+ }
+ if (lt_foo != "") { lt_freq[lt_foo]++; }
+ if (lt_freq[lt_foo] == 1) { print lt_foo; }
+}'`
+ sys_lib_search_path_spec=`$ECHO $lt_search_path_spec`
+else
+ sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
+fi
+library_names_spec=
+libname_spec='lib$name'
+soname_spec=
+shrext_cmds=".so"
+postinstall_cmds=
+postuninstall_cmds=
+finish_cmds=
+finish_eval=
+shlibpath_var=
+shlibpath_overrides_runpath=unknown
+version_type=none
+dynamic_linker="$host_os ld.so"
+sys_lib_dlsearch_path_spec="/lib /usr/lib"
+need_lib_prefix=unknown
+hardcode_into_libs=no
+
+# when you set need_version to no, make sure it does not cause -set_version
+# flags to be left without arguments
+need_version=unknown
+
+case $host_os in
+aix3*)
+ version_type=linux
+ library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a'
+ shlibpath_var=LIBPATH
+
+ # AIX 3 has no versioning support, so we append a major version to the name.
+ soname_spec='${libname}${release}${shared_ext}$major'
+ ;;
+
+aix[4-9]*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ hardcode_into_libs=yes
+ if test "$host_cpu" = ia64; then
+ # AIX 5 supports IA64
+ library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}'
+ shlibpath_var=LD_LIBRARY_PATH
+ else
+ # With GCC up to 2.95.x, collect2 would create an import file
+ # for dependence libraries. The import file would start with
+ # the line `#! .'. This would cause the generated library to
+ # depend on `.', always an invalid library. This was fixed in
+ # development snapshots of GCC prior to 3.0.
+ case $host_os in
+ aix4 | aix4.[01] | aix4.[01].*)
+ if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)'
+ echo ' yes '
+ echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then
+ :
+ else
+ can_build_shared=no
+ fi
+ ;;
+ esac
+ # AIX (on Power*) has no versioning support, so currently we can not hardcode correct
+ # soname into executable. Probably we can add versioning support to
+ # collect2, so additional links can be useful in future.
+ if test "$aix_use_runtimelinking" = yes; then
+ # If using run time linking (on AIX 4.2 or later) use lib<name>.so
+ # instead of lib<name>.a to let people know that these are not
+ # typical AIX shared libraries.
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ else
+ # We preserve .a as extension for shared libraries through AIX4.2
+ # and later when we are not doing run time linking.
+ library_names_spec='${libname}${release}.a $libname.a'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ fi
+ shlibpath_var=LIBPATH
+ fi
+ ;;
+
+amigaos*)
+ case $host_cpu in
+ powerpc)
+ # Since July 2007 AmigaOS4 officially supports .so libraries.
+ # When compiling the executable, add -use-dynld -Lsobjs: to the compileline.
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ ;;
+ m68k)
+ library_names_spec='$libname.ixlibrary $libname.a'
+ # Create ${libname}_ixlibrary.a entries in /sys/libs.
+ finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$ECHO "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'
+ ;;
+ esac
+ ;;
+
+beos*)
+ library_names_spec='${libname}${shared_ext}'
+ dynamic_linker="$host_os ld.so"
+ shlibpath_var=LIBRARY_PATH
+ ;;
+
+bsdi[45]*)
+ version_type=linux
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir'
+ shlibpath_var=LD_LIBRARY_PATH
+ sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib"
+ sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib"
+ # the default ld.so.conf also contains /usr/contrib/lib and
+ # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow
+ # libtool to hard-code these into programs
+ ;;
+
+cygwin* | mingw* | pw32* | 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,cegcc*)
+ library_names_spec='$libname.dll.a'
+ # DLL is installed to $(libdir)/../bin by postinstall_cmds
+ postinstall_cmds='base_file=`basename \${file}`~
+ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
+ dldir=$destdir/`dirname \$dlpath`~
+ test -d \$dldir || mkdir -p \$dldir~
+ $install_prog $dir/$dlname \$dldir/$dlname~
+ chmod a+x \$dldir/$dlname~
+ if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
+ eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
+ fi'
+ postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
+ dlpath=$dir/\$dldll~
+ $RM \$dlpath'
+ shlibpath_overrides_runpath=yes
+
+ case $host_os in
+ cygwin*)
+ # Cygwin DLLs use 'cyg' prefix rather than 'lib'
+ soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+ sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib"
+ ;;
+ mingw* | 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"`
+ if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then
+ # It is most probably a Windows format PATH printed by
+ # mingw gcc, but we are running on Cygwin. Gcc prints its search
+ # path with ; separators, and with drive letters. We can handle the
+ # drive letters (cygwin fileutils understands them), so leave them,
+ # especially as we might pass files found there to a mingw objdump,
+ # which wouldn't understand a cygwinified path. Ahh.
+ sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
+ else
+ sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
+ fi
+ ;;
+ pw32*)
+ # pw32 DLLs use 'pw' prefix rather than 'lib'
+ library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+ ;;
+ esac
+ ;;
+
+ *)
+ library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib'
+ ;;
+ esac
+ dynamic_linker='Win32 ld.exe'
+ # FIXME: first we should search . and the directory the executable is in
+ shlibpath_var=PATH
+ ;;
+
+darwin* | rhapsody*)
+ dynamic_linker="$host_os dyld"
+ version_type=darwin
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext'
+ soname_spec='${libname}${release}${major}$shared_ext'
+ shlibpath_overrides_runpath=yes
+ shlibpath_var=DYLD_LIBRARY_PATH
+ shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`'
+
+ sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib"
+ sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib'
+ ;;
+
+dgux*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ ;;
+
+freebsd1*)
+ dynamic_linker=no
+ ;;
+
+freebsd* | dragonfly*)
+ # DragonFly does not have aout. When/if they implement a new
+ # versioning mechanism, adjust this.
+ if test -x /usr/bin/objformat; then
+ objformat=`/usr/bin/objformat`
+ else
+ case $host_os in
+ freebsd[123]*) objformat=aout ;;
+ *) objformat=elf ;;
+ esac
+ fi
+ version_type=freebsd-$objformat
+ case $version_type in
+ freebsd-elf*)
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+ need_version=no
+ need_lib_prefix=no
+ ;;
+ freebsd-*)
+ library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix'
+ need_version=yes
+ ;;
+ esac
+ shlibpath_var=LD_LIBRARY_PATH
+ case $host_os in
+ freebsd2*)
+ shlibpath_overrides_runpath=yes
+ ;;
+ freebsd3.[01]* | freebsdelf3.[01]*)
+ shlibpath_overrides_runpath=yes
+ hardcode_into_libs=yes
+ ;;
+ freebsd3.[2-9]* | freebsdelf3.[2-9]* | \
+ freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1)
+ shlibpath_overrides_runpath=no
+ hardcode_into_libs=yes
+ ;;
+ *) # from 4.6 on, and DragonFly
+ shlibpath_overrides_runpath=yes
+ hardcode_into_libs=yes
+ ;;
+ esac
+ ;;
+
+gnu*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ hardcode_into_libs=yes
+ ;;
+
+hpux9* | hpux10* | hpux11*)
+ # Give a soname corresponding to the major version so that dld.sl refuses to
+ # link against other versions.
+ version_type=sunos
+ need_lib_prefix=no
+ need_version=no
+ case $host_cpu in
+ ia64*)
+ shrext_cmds='.so'
+ hardcode_into_libs=yes
+ dynamic_linker="$host_os dld.so"
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ if test "X$HPUX_IA64_MODE" = X32; then
+ sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib"
+ else
+ sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64"
+ fi
+ sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+ ;;
+ hppa*64*)
+ shrext_cmds='.sl'
+ hardcode_into_libs=yes
+ dynamic_linker="$host_os dld.sl"
+ shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH
+ shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64"
+ sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+ ;;
+ *)
+ shrext_cmds='.sl'
+ dynamic_linker="$host_os dld.sl"
+ shlibpath_var=SHLIB_PATH
+ shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ ;;
+ esac
+ # HP-UX runs *really* slowly unless shared libraries are mode 555.
+ postinstall_cmds='chmod 555 $lib'
+ ;;
+
+interix[3-9]*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=no
+ hardcode_into_libs=yes
+ ;;
+
+irix5* | irix6* | nonstopux*)
+ case $host_os in
+ nonstopux*) version_type=nonstopux ;;
+ *)
+ if test "$lt_cv_prog_gnu_ld" = yes; then
+ version_type=linux
+ else
+ version_type=irix
+ fi ;;
+ esac
+ need_lib_prefix=no
+ need_version=no
+ soname_spec='${libname}${release}${shared_ext}$major'
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}'
+ case $host_os in
+ irix5* | nonstopux*)
+ libsuff= shlibsuff=
+ ;;
+ *)
+ case $LD in # libtool.m4 will add one of these switches to LD
+ *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ")
+ libsuff= shlibsuff= libmagic=32-bit;;
+ *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ")
+ libsuff=32 shlibsuff=N32 libmagic=N32;;
+ *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ")
+ libsuff=64 shlibsuff=64 libmagic=64-bit;;
+ *) libsuff= shlibsuff= libmagic=never-match;;
+ esac
+ ;;
+ esac
+ shlibpath_var=LD_LIBRARY${shlibsuff}_PATH
+ shlibpath_overrides_runpath=no
+ sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}"
+ sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}"
+ hardcode_into_libs=yes
+ ;;
+
+# No shared lib support for Linux oldld, aout, or coff.
+linux*oldld* | linux*aout* | linux*coff*)
+ dynamic_linker=no
+ ;;
+
+# This must be Linux ELF.
+linux* | k*bsd*-gnu | kopensolaris*-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'
+ finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=no
+ # Some binutils ld are patched to set DT_RUNPATH
+ save_LDFLAGS=$LDFLAGS
+ save_libdir=$libdir
+ eval "libdir=/foo; wl=\"$lt_prog_compiler_wl\"; \
+ LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec\""
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+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
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+ LDFLAGS=$save_LDFLAGS
+ libdir=$save_libdir
+
+ # This implies no fast_install, which is unacceptable.
+ # Some rework will be needed to allow for fast_install
+ # before this can be enabled.
+ hardcode_into_libs=yes
+
+ # Append ld.so.conf contents to the search path
+ if test -f /etc/ld.so.conf; then
+ lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '`
+ sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra"
+ fi
+
+ # We used to test for /lib/ld.so.1 and disable shared libraries on
+ # powerpc, because MkLinux only supported shared libraries with the
+ # GNU dynamic linker. Since this was broken with cross compilers,
+ # most powerpc-linux boxes support dynamic linking these days and
+ # people can always --disable-shared, the test was removed, and we
+ # assume the GNU/Linux dynamic linker is in use.
+ dynamic_linker='GNU/Linux ld.so'
+ ;;
+
+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
+ need_version=no
+ if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+ finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+ dynamic_linker='NetBSD (a.out) ld.so'
+ else
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ dynamic_linker='NetBSD ld.elf_so'
+ fi
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ hardcode_into_libs=yes
+ ;;
+
+newsos6)
+ version_type=linux
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ ;;
+
+*nto* | *qnx*)
+ version_type=qnx
+ 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='ldqnx.so'
+ ;;
+
+openbsd*)
+ version_type=sunos
+ sys_lib_dlsearch_path_spec="/usr/lib"
+ need_lib_prefix=no
+ # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs.
+ case $host_os in
+ openbsd3.3 | openbsd3.3.*) need_version=yes ;;
+ *) need_version=no ;;
+ esac
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+ finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+ shlibpath_var=LD_LIBRARY_PATH
+ if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+ case $host_os in
+ openbsd2.[89] | openbsd2.[89].*)
+ shlibpath_overrides_runpath=no
+ ;;
+ *)
+ shlibpath_overrides_runpath=yes
+ ;;
+ esac
+ else
+ shlibpath_overrides_runpath=yes
+ fi
+ ;;
+
+os2*)
+ libname_spec='$name'
+ shrext_cmds=".dll"
+ need_lib_prefix=no
+ library_names_spec='$libname${shared_ext} $libname.a'
+ dynamic_linker='OS/2 ld.exe'
+ shlibpath_var=LIBPATH
+ ;;
+
+osf3* | osf4* | osf5*)
+ version_type=osf
+ need_lib_prefix=no
+ need_version=no
+ soname_spec='${libname}${release}${shared_ext}$major'
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ shlibpath_var=LD_LIBRARY_PATH
+ sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib"
+ sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
+ ;;
+
+rdos*)
+ dynamic_linker=no
+ ;;
+
+solaris*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ hardcode_into_libs=yes
+ # ldd complains unless libraries are executable
+ postinstall_cmds='chmod +x $lib'
+ ;;
+
+sunos4*)
+ version_type=sunos
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+ finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ if test "$with_gnu_ld" = yes; then
+ need_lib_prefix=no
+ fi
+ need_version=yes
+ ;;
+
+sysv4 | sysv4.3*)
+ version_type=linux
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ case $host_vendor in
+ sni)
+ shlibpath_overrides_runpath=no
+ need_lib_prefix=no
+ runpath_var=LD_RUN_PATH
+ ;;
+ siemens)
+ need_lib_prefix=no
+ ;;
+ motorola)
+ need_lib_prefix=no
+ need_version=no
+ shlibpath_overrides_runpath=no
+ sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib'
+ ;;
+ esac
+ ;;
+
+sysv4*MP*)
+ if test -d /usr/nec ;then
+ version_type=linux
+ library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}'
+ soname_spec='$libname${shared_ext}.$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ fi
+ ;;
+
+sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
+ version_type=freebsd-elf
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ hardcode_into_libs=yes
+ if test "$with_gnu_ld" = yes; then
+ sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib'
+ else
+ sys_lib_search_path_spec='/usr/ccs/lib /usr/lib'
+ case $host_os in
+ sco3.2v5*)
+ sys_lib_search_path_spec="$sys_lib_search_path_spec /lib"
+ ;;
+ esac
+ fi
+ sys_lib_dlsearch_path_spec='/usr/lib'
+ ;;
+
+tpf*)
+ # TPF is a cross-target only. Preferred cross-host = GNU/Linux.
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=no
+ hardcode_into_libs=yes
+ ;;
+
+uts4*)
+ version_type=linux
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ ;;
+
+*)
+ dynamic_linker=no
+ ;;
+esac
+{ $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"
+if test "$GCC" = yes; then
+ variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
+fi
+
+if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then
+ sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec"
+fi
+if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then
+ sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec"
+fi
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ { $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" ||
+ test "X$hardcode_automatic" = "Xyes" ; then
+
+ # We can hardcode non-existent directories.
+ if test "$hardcode_direct" != no &&
+ # If the only mechanism to avoid hardcoding is shlibpath_var, we
+ # have to relink, otherwise we might link with an installed library
+ # when we should be linking with a yet-to-be-installed one
+ ## test "$_LT_TAGVAR(hardcode_shlibpath_var, )" != no &&
+ test "$hardcode_minus_L" != no; then
+ # Linking always hardcodes the temporary library directory.
+ hardcode_action=relink
+ else
+ # We can link without hardcoding, and we can hardcode nonexisting dirs.
+ hardcode_action=immediate
+ fi
+else
+ # We cannot hardcode anything, or else we can only hardcode existing
+ # directories.
+ hardcode_action=unsupported
+fi
+{ $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
+ # Fast installation is not supported
+ enable_fast_install=no
+elif test "$shlibpath_overrides_runpath" = yes ||
+ test "$enable_shared" = no; then
+ # Fast installation is not necessary
+ enable_fast_install=needless
+fi
+
+
+
+
+
+
+ if test "x$enable_dlopen" != xyes; then
+ enable_dlopen=unknown
+ enable_dlopen_self=unknown
+ enable_dlopen_self_static=unknown
+else
+ lt_cv_dlopen=no
+ lt_cv_dlopen_libs=
+
+ case $host_os in
+ beos*)
+ lt_cv_dlopen="load_add_on"
+ lt_cv_dlopen_libs=
+ lt_cv_dlopen_self=yes
+ ;;
+
+ mingw* | pw32* | cegcc*)
+ lt_cv_dlopen="LoadLibrary"
+ lt_cv_dlopen_libs=
+ ;;
+
+ cygwin*)
+ lt_cv_dlopen="dlopen"
+ lt_cv_dlopen_libs=
+ ;;
+
+ darwin*)
+ # if libdl is installed we need to link against it
+ { $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 confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* 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 ();
+int
+main ()
+{
+return dlopen ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_dl_dlopen=yes
+else
+ ac_cv_lib_dl_dlopen=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $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
+
+ lt_cv_dlopen="dyld"
+ lt_cv_dlopen_libs=
+ lt_cv_dlopen_self=yes
+
+fi
+
+ ;;
+
+ *)
+ 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
+ { $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 confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* 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 ();
+int
+main ()
+{
+return shl_load ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_dld_shl_load=yes
+else
+ ac_cv_lib_dld_shl_load=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $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
+ 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
+ { $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 confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* 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 ();
+int
+main ()
+{
+return dlopen ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_dl_dlopen=yes
+else
+ ac_cv_lib_dl_dlopen=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $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
+ { $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 confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* 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 ();
+int
+main ()
+{
+return dlopen ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_svld_dlopen=yes
+else
+ ac_cv_lib_svld_dlopen=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $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
+ { $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 confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* 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 dld_link ();
+int
+main ()
+{
+return dld_link ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_dld_dld_link=yes
+else
+ ac_cv_lib_dld_dld_link=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $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
+
+
+fi
+
+
+fi
+
+
+fi
+
+
+fi
+
+
+fi
+
+ ;;
+ esac
+
+ if test "x$lt_cv_dlopen" != xno; then
+ enable_dlopen=yes
+ else
+ enable_dlopen=no
+ fi
+
+ case $lt_cv_dlopen in
+ dlopen)
+ save_CPPFLAGS="$CPPFLAGS"
+ test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H"
+
+ save_LDFLAGS="$LDFLAGS"
+ wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\"
+
+ save_LIBS="$LIBS"
+ LIBS="$lt_cv_dlopen_libs $LIBS"
+
+ { $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
+else
+ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+ lt_status=$lt_dlunknown
+ cat > conftest.$ac_ext <<_LT_EOF
+#line 11082 "configure"
+#include "confdefs.h"
+
+#if HAVE_DLFCN_H
+#include <dlfcn.h>
+#endif
+
+#include <stdio.h>
+
+#ifdef RTLD_GLOBAL
+# define LT_DLGLOBAL RTLD_GLOBAL
+#else
+# ifdef DL_GLOBAL
+# define LT_DLGLOBAL DL_GLOBAL
+# else
+# define LT_DLGLOBAL 0
+# endif
+#endif
+
+/* We may have to define LT_DLLAZY_OR_NOW in the command line if we
+ find out it does not work in some platform. */
+#ifndef LT_DLLAZY_OR_NOW
+# ifdef RTLD_LAZY
+# define LT_DLLAZY_OR_NOW RTLD_LAZY
+# else
+# ifdef DL_LAZY
+# define LT_DLLAZY_OR_NOW DL_LAZY
+# else
+# ifdef RTLD_NOW
+# define LT_DLLAZY_OR_NOW RTLD_NOW
+# else
+# ifdef DL_NOW
+# define LT_DLLAZY_OR_NOW DL_NOW
+# else
+# define LT_DLLAZY_OR_NOW 0
+# endif
+# endif
+# endif
+# endif
+#endif
+
+void fnord() { int i=42;}
+int main ()
+{
+ void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
+ int status = $lt_dlunknown;
+
+ if (self)
+ {
+ if (dlsym (self,"fnord")) status = $lt_dlno_uscore;
+ else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore;
+ /* dlclose (self); */
+ }
+ else
+ puts (dlerror ());
+
+ return status;
+}
+_LT_EOF
+ if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ $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
+ x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;;
+ x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;;
+ x$lt_dlunknown|x*) lt_cv_dlopen_self=no ;;
+ esac
+ else :
+ # compilation failed
+ lt_cv_dlopen_self=no
+ fi
+fi
+rm -fr conftest*
+
+
+fi
+{ $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\"
+ { $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
+else
+ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+ lt_status=$lt_dlunknown
+ cat > conftest.$ac_ext <<_LT_EOF
+#line 11178 "configure"
+#include "confdefs.h"
+
+#if HAVE_DLFCN_H
+#include <dlfcn.h>
+#endif
+
+#include <stdio.h>
+
+#ifdef RTLD_GLOBAL
+# define LT_DLGLOBAL RTLD_GLOBAL
+#else
+# ifdef DL_GLOBAL
+# define LT_DLGLOBAL DL_GLOBAL
+# else
+# define LT_DLGLOBAL 0
+# endif
+#endif
+
+/* We may have to define LT_DLLAZY_OR_NOW in the command line if we
+ find out it does not work in some platform. */
+#ifndef LT_DLLAZY_OR_NOW
+# ifdef RTLD_LAZY
+# define LT_DLLAZY_OR_NOW RTLD_LAZY
+# else
+# ifdef DL_LAZY
+# define LT_DLLAZY_OR_NOW DL_LAZY
+# else
+# ifdef RTLD_NOW
+# define LT_DLLAZY_OR_NOW RTLD_NOW
+# else
+# ifdef DL_NOW
+# define LT_DLLAZY_OR_NOW DL_NOW
+# else
+# define LT_DLLAZY_OR_NOW 0
+# endif
+# endif
+# endif
+# endif
+#endif
+
+void fnord() { int i=42;}
+int main ()
+{
+ void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
+ int status = $lt_dlunknown;
+
+ if (self)
+ {
+ if (dlsym (self,"fnord")) status = $lt_dlno_uscore;
+ else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore;
+ /* dlclose (self); */
+ }
+ else
+ puts (dlerror ());
+
+ return status;
+}
+_LT_EOF
+ if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ $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
+ x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;;
+ x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;;
+ x$lt_dlunknown|x*) lt_cv_dlopen_self_static=no ;;
+ esac
+ else :
+ # compilation failed
+ lt_cv_dlopen_self_static=no
+ fi
+fi
+rm -fr conftest*
+
+
+fi
+{ $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"
+ LDFLAGS="$save_LDFLAGS"
+ LIBS="$save_LIBS"
+ ;;
+ esac
+
+ case $lt_cv_dlopen_self in
+ yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;;
+ *) enable_dlopen_self=unknown ;;
+ esac
+
+ case $lt_cv_dlopen_self_static in
+ yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;;
+ *) enable_dlopen_self_static=unknown ;;
+ esac
+fi
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+striplib=
+old_striplib=
+{ $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"
+ { $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
+ darwin*)
+ if test -n "$STRIP" ; then
+ striplib="$STRIP -x"
+ old_striplib="$STRIP -S"
+ { $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; }
+ fi
+ ;;
+ *)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+ ;;
+ esac
+fi
+
+
+
+
+
+
+
+
+
+
+
+
+ # Report which library types will actually be built
+ { $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; }
+
+ { $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
+ # are all built from PIC.
+ case $host_os in
+ aix3*)
+ test "$enable_shared" = yes && enable_static=no
+ if test -n "$RANLIB"; then
+ archive_cmds="$archive_cmds~\$RANLIB \$lib"
+ postinstall_cmds='$RANLIB $lib'
+ fi
+ ;;
+
+ aix[4-9]*)
+ if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
+ test "$enable_shared" = yes && enable_static=no
+ fi
+ ;;
+ esac
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_shared" >&5
+$as_echo "$enable_shared" >&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
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_static" >&5
+$as_echo "$enable_static" >&6; }
+
+
+
+
+fi
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+CC="$lt_save_CC"
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ac_config_commands="$ac_config_commands libtool"
+
+
+
+
+# Only expand once:
+
+
+
+# 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
+
+else
+ 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
+
+
+# Checks for libraries.
+
+
+
+
+
+
+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
+
+
+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
+
+ ;;
+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
+
+ 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
+
+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
+
+
+
+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
+ 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
+
+ as_fn_error $? "Package requirements (avsysaudio) were not met:
+
+$AVSYSTEM_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." "$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 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://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; }
+
+fi
+
+
+
+
+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
+
+
+
+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
+ 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
+
+ as_fn_error $? "Package requirements (mm-common) were not met:
+
+$MMCOMMON_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." "$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 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
+
+
+
+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
+ 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 $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
+
+
+
+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
+ 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:
+
+$AUDIOSESSIONMGR_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 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.
+
+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.
+
+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
+
+
+
+
+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
+ pkg_failed=yes
+fi
+ 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
+ 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
+ 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:
+
+$GLIB2_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 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.
+
+To get pkg-config, see <http://pkg-config.freedesktop.org/>.
+See \`config.log' for more details" "$LINENO" 5 ; }
+else
+ 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; }
+
+fi
+
+
+
+
+pkg_failed=no
+{ $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=$?
+ $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
+ else
+ pkg_failed=untried
+fi
+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=$?
+ $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
+ 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
+ VCONF_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "vconf" 2>&1`
+ else
+ VCONF_PKG_ERRORS=`$PKG_CONFIG --print-errors "vconf" 2>&1`
+ fi
+ # Put the nasty error message in config.log where it belongs
+ echo "$VCONF_PKG_ERRORS" >&5
+
+ as_fn_error $? "Package requirements (vconf) were not met:
+
+$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 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
+ { $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 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://pkg-config.freedesktop.org/>.
+See \`config.log' for more details" "$LINENO" 5 ; }
+else
+ 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
+{ $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=$?
+ $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
+ else
+ pkg_failed=untried
+fi
+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=$?
+ $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
+ 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
+ HEYNOTI_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "heynoti" 2>&1`
+ else
+ HEYNOTI_PKG_ERRORS=`$PKG_CONFIG --print-errors "heynoti" 2>&1`
+ fi
+ # Put the nasty error message in config.log where it belongs
+ echo "$HEYNOTI_PKG_ERRORS" >&5
+
+ as_fn_error $? "Package requirements (heynoti) were not met:
+
+$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 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
+ { $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 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://pkg-config.freedesktop.org/>.
+See \`config.log' for more details" "$LINENO" 5 ; }
+else
+ 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
+
+
+
+
+# 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
+
+if test "x$USE_PULSE" = "xyes"; then
+
+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=$?
+ $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
+ else
+ pkg_failed=untried
+fi
+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=$?
+ $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
+ 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
+ PULSE_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "libpulse" 2>&1`
+ else
+ PULSE_PKG_ERRORS=`$PKG_CONFIG --print-errors "libpulse" 2>&1`
+ fi
+ # Put the nasty error message in config.log where it belongs
+ echo "$PULSE_PKG_ERRORS" >&5
+
+ as_fn_error $? "Package requirements (libpulse) were not met:
+
+$PULSE_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 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 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://pkg-config.freedesktop.org/>.
+See \`config.log' for more details" "$LINENO" 5 ; }
+else
+ 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.
+{ $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 confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <float.h>
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_header_stdc=yes
+else
+ 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 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 :
+
+else
+ ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+ # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
+ cat 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 :
+
+else
+ ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+ # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
+ if test "$cross_compiling" = yes; then :
+ :
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <ctype.h>
+#include <stdlib.h>
+#if ((' ' & 0x0FF) == 0x020)
+# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
+# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
+#else
+# define ISLOWER(c) \
+ (('a' <= (c) && (c) <= 'i') \
+ || ('j' <= (c) && (c) <= 'r') \
+ || ('s' <= (c) && (c) <= 'z'))
+# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
+#endif
+
+#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
+int
+main ()
+{
+ int i;
+ for (i = 0; i < 256; i++)
+ if (XOR (islower (i), ISLOWER (i))
+ || toupper (i) != TOUPPER (i))
+ return 2;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+
+else
+ ac_cv_header_stdc=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+ conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+fi
+fi
+{ $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
+
+$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=`$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
+
+
+# Checks for typedefs, structures, and compiler characteristics.
+{ $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 confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+/* FIXME: Include the comments suggested by Paul. */
+#ifndef __cplusplus
+ /* Ultrix mips cc rejects this. */
+ typedef int charset[2];
+ const charset cs;
+ /* SunOS 4.1.1 cc rejects this. */
+ char const *const *pcpcc;
+ char **ppc;
+ /* NEC SVR4.0.2 mips cc rejects this. */
+ struct point {int x, y;};
+ static struct point const zero = {0,0};
+ /* AIX XL C 1.02.0.0 rejects this.
+ It does not let you subtract one const X* pointer from another in
+ an arm of an if-expression whose if-part is not a constant
+ expression */
+ const char *g = "string";
+ pcpcc = &g + (g ? g-g : 0);
+ /* HPUX 7.0 cc rejects these. */
+ ++pcpcc;
+ ppc = (char**) pcpcc;
+ pcpcc = (char const *const *) ppc;
+ { /* SCO 3.2v4 cc rejects this. */
+ char *t;
+ char const *s = 0 ? (char *) 0 : (char const *) 0;
+
+ *t++ = 0;
+ if (s) return 0;
+ }
+ { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */
+ int x[] = {25, 17};
+ const int *foo = &x[0];
+ ++foo;
+ }
+ { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */
+ typedef const int *iptr;
+ iptr p = 0;
+ ++p;
+ }
+ { /* AIX XL C 1.02.0.0 rejects this saying
+ "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */
+ struct s { int j; const int *ap[3]; };
+ struct s *b; b->j = 5;
+ }
+ { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */
+ const int foo = 10;
+ if (!foo) return 0;
+ }
+ return !cs[0] && !zero.x;
+#endif
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_c_const=yes
+else
+ ac_cv_c_const=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $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
+
+$as_echo "#define const /**/" >>confdefs.h
+
+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 :
+
+else
+
+cat >>confdefs.h <<_ACEOF
+#define pid_t int
+_ACEOF
+
+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 :
+
+else
+
+cat >>confdefs.h <<_ACEOF
+#define size_t unsigned int
+_ACEOF
+
+fi
+
+
+# Checks for library functions.
+# The Ultrix 4.2 mips builtin alloca declared by alloca.h only works
+# for constant arguments. Useless!
+{ $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 confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <alloca.h>
+int
+main ()
+{
+char *p = (char *) alloca (2 * sizeof (int));
+ if (p) return 0;
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_working_alloca_h=yes
+else
+ ac_cv_working_alloca_h=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+{ $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
+
+$as_echo "#define HAVE_ALLOCA_H 1" >>confdefs.h
+
+fi
+
+{ $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 confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#ifdef __GNUC__
+# define alloca __builtin_alloca
+#else
+# ifdef _MSC_VER
+# include <malloc.h>
+# define alloca _alloca
+# else
+# ifdef HAVE_ALLOCA_H
+# include <alloca.h>
+# else
+# ifdef _AIX
+ #pragma alloca
+# else
+# ifndef alloca /* predefined by HP cc +Olibcalls */
+char *alloca ();
+# endif
+# endif
+# endif
+# endif
+#endif
+
+int
+main ()
+{
+char *p = (char *) alloca (1);
+ if (p) return 0;
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_func_alloca_works=yes
+else
+ ac_cv_func_alloca_works=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+{ $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
+
+$as_echo "#define HAVE_ALLOCA 1" >>confdefs.h
+
+else
+ # The SVR3 libPW and SVR4 libucb both contain incompatible functions
+# that cause trouble. Some versions do not even contain alloca or
+# contain a buggy version. If you still want to use their alloca,
+# use ar to extract alloca.o from them instead of compiling alloca.c.
+
+ALLOCA=\${LIBOBJDIR}alloca.$ac_objext
+
+$as_echo "#define C_ALLOCA 1" >>confdefs.h
+
+
+{ $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 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
+{ $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
+_ACEOF
+
+ break
+fi
+
+ done
+fi
+
+{ $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 :
+ ac_cv_c_stack_direction=0
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$ac_includes_default
+int
+find_stack_direction ()
+{
+ static char *addr = 0;
+ auto char dummy;
+ if (addr == 0)
+ {
+ addr = &dummy;
+ return find_stack_direction ();
+ }
+ else
+ return (&dummy > addr) ? 1 : -1;
+}
+
+int
+main ()
+{
+ return find_stack_direction () < 0;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+ ac_cv_c_stack_direction=1
+else
+ ac_cv_c_stack_direction=-1
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+ conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+fi
+{ $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
+
+
+fi
+
+for ac_header in vfork.h
+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 HAVE_VFORK_H 1
+_ACEOF
+
+fi
+
+done
+
+for ac_func in fork vfork
+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 `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+done
+
+if test "x$ac_cv_func_fork" = xyes; then
+ { $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 :
+ ac_cv_func_fork_works=cross
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+
+ /* By Ruediger Kuhlmann. */
+ return fork () < 0;
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+ ac_cv_func_fork_works=yes
+else
+ ac_cv_func_fork_works=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+ conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+fi
+{ $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
+fi
+if test "x$ac_cv_func_fork_works" = xcross; then
+ case $host in
+ *-*-amigaos* | *-*-msdosdjgpp*)
+ # Override, as these systems have only a dummy fork() stub
+ ac_cv_func_fork_works=no
+ ;;
+ *)
+ ac_cv_func_fork_works=yes
+ ;;
+ esac
+ { $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
+ { $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 :
+ ac_cv_func_vfork_works=cross
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+/* Thanks to Paul Eggert for this test. */
+$ac_includes_default
+#include <sys/wait.h>
+#ifdef HAVE_VFORK_H
+# include <vfork.h>
+#endif
+/* On some sparc systems, changes by the child to local and incoming
+ argument registers are propagated back to the parent. The compiler
+ is told about this with #include <vfork.h>, but some compilers
+ (e.g. gcc -O) don't grok <vfork.h>. Test for this by using a
+ static variable whose address is put into a register that is
+ clobbered by the vfork. */
+static void
+#ifdef __cplusplus
+sparc_address_test (int arg)
+# else
+sparc_address_test (arg) int arg;
+#endif
+{
+ static pid_t child;
+ if (!child) {
+ child = vfork ();
+ if (child < 0) {
+ perror ("vfork");
+ _exit(2);
+ }
+ if (!child) {
+ arg = getpid();
+ write(-1, "", 0);
+ _exit (arg);
+ }
+ }
+}
+
+int
+main ()
+{
+ pid_t parent = getpid ();
+ pid_t child;
+
+ sparc_address_test (0);
+
+ child = vfork ();
+
+ if (child == 0) {
+ /* Here is another test for sparc vfork register problems. This
+ test uses lots of local variables, at least as many local
+ variables as main has allocated so far including compiler
+ temporaries. 4 locals are enough for gcc 1.40.3 on a Solaris
+ 4.1.3 sparc, but we use 8 to be safe. A buggy compiler should
+ reuse the register of parent for one of the local variables,
+ since it will think that parent can't possibly be used any more
+ in this routine. Assigning to the local variable will thus
+ munge parent in the parent process. */
+ pid_t
+ p = getpid(), p1 = getpid(), p2 = getpid(), p3 = getpid(),
+ p4 = getpid(), p5 = getpid(), p6 = getpid(), p7 = getpid();
+ /* Convince the compiler that p..p7 are live; otherwise, it might
+ use the same hardware register for all 8 local variables. */
+ if (p != p1 || p != p2 || p != p3 || p != p4
+ || p != p5 || p != p6 || p != p7)
+ _exit(1);
+
+ /* On some systems (e.g. IRIX 3.3), vfork doesn't separate parent
+ from child file descriptors. If the child closes a descriptor
+ before it execs or exits, this munges the parent's descriptor
+ as well. Test for this by closing stdout in the child. */
+ _exit(close(fileno(stdout)) != 0);
+ } else {
+ int status;
+ struct stat st;
+
+ while (wait(&status) != child)
+ ;
+ return (
+ /* Was there some problem with vforking? */
+ child < 0
+
+ /* Did the child fail? (This shouldn't happen.) */
+ || status
+
+ /* Did the vfork/compiler bug occur? */
+ || parent != getpid()
+
+ /* Did the file descriptor bug occur? */
+ || fstat(fileno(stdout), &st) != 0
+ );
+ }
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+ ac_cv_func_vfork_works=yes
+else
+ ac_cv_func_vfork_works=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+ conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+fi
+{ $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
+ { $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
+
+$as_echo "#define HAVE_WORKING_VFORK 1" >>confdefs.h
+
+else
+
+$as_echo "#define vfork fork" >>confdefs.h
+
+fi
+if test "x$ac_cv_func_fork_works" = xyes; then
+
+$as_echo "#define HAVE_WORKING_FORK 1" >>confdefs.h
+
+fi
+
+for ac_header in stdlib.h
+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 HAVE_STDLIB_H 1
+_ACEOF
+
+fi
+
+done
+
+{ $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 :
+ ac_cv_func_malloc_0_nonnull=no
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#if defined STDC_HEADERS || defined HAVE_STDLIB_H
+# include <stdlib.h>
+#else
+char *malloc ();
+#endif
+
+int
+main ()
+{
+return ! malloc (0);
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+ ac_cv_func_malloc_0_nonnull=yes
+else
+ 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.beam conftest.$ac_ext
+fi
+
+fi
+{ $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 :
+
+$as_echo "#define HAVE_MALLOC 1" >>confdefs.h
+
+else
+ $as_echo "#define HAVE_MALLOC 0" >>confdefs.h
+
+ case " $LIBOBJS " in
+ *" malloc.$ac_objext "* ) ;;
+ *) LIBOBJS="$LIBOBJS malloc.$ac_objext"
+ ;;
+esac
+
+
+$as_echo "#define malloc rpl_malloc" >>confdefs.h
+
+fi
+
+
+{ $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 :
+ ac_cv_func_memcmp_working=no
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+
+ /* Some versions of memcmp are not 8-bit clean. */
+ char c0 = '\100', c1 = '\200', c2 = '\201';
+ if (memcmp(&c0, &c2, 1) >= 0 || memcmp(&c1, &c2, 1) >= 0)
+ return 1;
+
+ /* The Next x86 OpenStep bug shows up only when comparing 16 bytes
+ or more and with at least one buffer not starting on a 4-byte boundary.
+ William Lewis provided this test program. */
+ {
+ char foo[21];
+ char bar[21];
+ int i;
+ for (i = 0; i < 4; i++)
+ {
+ char *a = foo + i;
+ char *b = bar + i;
+ strcpy (a, "--------01111111");
+ strcpy (b, "--------10000000");
+ if (memcmp (a, b, 16) >= 0)
+ return 1;
+ }
+ return 0;
+ }
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+ ac_cv_func_memcmp_working=yes
+else
+ ac_cv_func_memcmp_working=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+ conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+fi
+{ $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"
+ ;;
+esac
+
+
+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
+
+{ $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 confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* 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
+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
+ done
+ done
+done
+# Provide a safe default value.
+: ${ac_cv_func_select_args='int,int *,struct timeval *'}
+
+fi
+{ $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
+shift
+
+cat >>confdefs.h <<_ACEOF
+#define SELECT_TYPE_ARG1 $1
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define SELECT_TYPE_ARG234 ($2)
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define SELECT_TYPE_ARG5 ($3)
+_ACEOF
+
+rm -f conftest*
+
+{ $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 confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <sys/types.h>
+#include <signal.h>
+
+int
+main ()
+{
+return *(signal (0, 0)) (0) == 1;
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_type_signal=int
+else
+ ac_cv_type_signal=void
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $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=`$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 `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+done
+
+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
+# tests run on this system so they can be shared between configure
+# scripts and configure runs, see configure's option --config-cache.
+# It is not useful on other systems. If it contains results you don't
+# want to keep, you may remove or edit it.
+#
+# config.status only pays attention to the cache file if you give it
+# the --recheck option to rerun configure.
+#
+# `ac_cv_env_foo' variables (set or unset) will be overridden when
+# loading this file, other *unset* `ac_cv_foo' will be assigned the
+# following values.
+
+_ACEOF
+
+# The following way of writing the cache mishandles newlines in values,
+# but we know of no workaround that is simple, portable, and efficient.
+# So, we kill variables containing newlines.
+# Ultrix sh set writes to stderr and can't be redirected directly,
+# and sets the high bit in the cache file unless we assign to the vars.
+(
+ for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do
+ eval ac_val=\$$ac_var
+ case $ac_val in #(
+ *${as_nl}*)
+ case $ac_var in #(
+ *_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) ;; #(
+ BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #(
+ *) { eval $ac_var=; unset $ac_var;} ;;
+ esac ;;
+ esac
+ done
+
+ (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 \.
+ sed -n \
+ "s/'/'\\\\''/g;
+ s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p"
+ ;; #(
+ *)
+ # `set' quotes correctly as required by POSIX, so do not add quotes.
+ sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
+ ;;
+ esac |
+ sort
+) |
+ sed '
+ /^ac_cv_env_/b end
+ t clear
+ :clear
+ s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/
+ t end
+ s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/
+ :end' >>confcache
+if diff "$cache_file" confcache >/dev/null 2>&1; then :; else
+ if test -w "$cache_file"; then
+ test "x$cache_file" != "x/dev/null" &&
+ { $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
+ { $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
+
+test "x$prefix" = xNONE && prefix=$ac_default_prefix
+# Let make expand exec_prefix.
+test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
+
+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=`$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.
+ 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
+ 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
+ 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
+ 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"
+{ $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.
+# Compiler output produced by configure, useful for debugging
+# configure, is in config.log if it exists.
+
+debug=false
+ac_cs_recheck=false
+ac_cs_silent=false
+
+SHELL=\${CONFIG_SHELL-$SHELL}
+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 :
+ 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_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
+ 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
+ export as_echo_body
+ as_echo='sh -c $as_echo_body as_echo'
+fi
+
+# 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
+
+
+# IFS
+# We need space, tab and new line, in precisely that order. Quoting is
+# 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.)
+IFS=" "" $as_nl"
+
+# Find who we are. Look in the path if we contain no directory separator.
+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
+IFS=$as_save_IFS
+
+ ;;
+esac
+# We did not find ourselves, most probably we were run as `sh COMMAND'
+# in which case we are not to be found in the path.
+if test "x$as_myself" = x; then
+ as_myself=$0
+fi
+if test ! -f "$as_myself"; then
+ $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
+ exit 1
+fi
+
+# 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.
+LC_ALL=C
+export LC_ALL
+LANGUAGE=C
+export LANGUAGE
+
+# 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_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_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
+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 #(((((
+-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
+
+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
+ 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='mkdir -p "$as_dir"'
+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'"
+
+
+exec 6>&1
+## ----------------------------------- ##
+## Main body of $CONFIG_STATUS script. ##
+## ----------------------------------- ##
+_ASEOF
+test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1
+
+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.67. Invocation command line was
+
+ CONFIG_FILES = $CONFIG_FILES
+ CONFIG_HEADERS = $CONFIG_HEADERS
+ CONFIG_LINKS = $CONFIG_LINKS
+ CONFIG_COMMANDS = $CONFIG_COMMANDS
+ $ $0 $@
+
+on `(hostname || uname -n) 2>/dev/null | sed 1q`
+"
+
+_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"
+config_commands="$ac_config_commands"
+
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+ac_cs_usage="\
+\`$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 [OPTION]... [TAG]...
+
+ -h, --help print this help, then exit
+ -V, --version print version number and configuration settings, then exit
+ --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
+
+Configuration files:
+$config_files
+
+Configuration headers:
+$config_headers
+
+Configuration commands:
+$config_commands
+
+Report bugs to the package provider."
+
+_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.67,
+ with options \\"\$ac_cs_config\\"
+
+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."
+
+ac_pwd='$ac_pwd'
+srcdir='$srcdir'
+INSTALL='$INSTALL'
+MKDIR_P='$MKDIR_P'
+AWK='$AWK'
+test -n "\$AWK" || AWK=awk
+_ACEOF
+
+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
+ ac_shift=shift
+ ;;
+ esac
+
+ case $ac_option in
+ # Handling of the options.
+ -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
+ ac_cs_recheck=: ;;
+ --version | --versio | --versi | --vers | --ver | --ve | --v | -V )
+ $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
+ 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
+ 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
+ as_fn_error $? "ambiguous option: \`$1'
+Try \`$0 --help' for more information.";;
+ --help | --hel | -h )
+ $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.
+ -*) as_fn_error $? "unrecognized option: \`$1'
+Try \`$0 --help' for more information." ;;
+
+ *) as_fn_append ac_config_targets " $1"
+ ac_need_defaults=false ;;
+
+ esac
+ shift
+done
+
+ac_configure_extra_args=
+
+if $ac_cs_silent; then
+ exec 6>/dev/null
+ ac_configure_extra_args="$ac_configure_extra_args --silent"
+fi
+
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+if \$ac_cs_recheck; then
+ 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 "\$@"
+fi
+
+_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
+ $as_echo "$ac_log"
+} >&5
+
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+#
+# INIT-COMMANDS
+#
+AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"
+
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+sed_quote_subst='$sed_quote_subst'
+double_quote_subst='$double_quote_subst'
+delay_variable_subst='$delay_variable_subst'
+macro_version='`$ECHO "X$macro_version" | $Xsed -e "$delay_single_quote_subst"`'
+macro_revision='`$ECHO "X$macro_revision" | $Xsed -e "$delay_single_quote_subst"`'
+enable_shared='`$ECHO "X$enable_shared" | $Xsed -e "$delay_single_quote_subst"`'
+enable_static='`$ECHO "X$enable_static" | $Xsed -e "$delay_single_quote_subst"`'
+pic_mode='`$ECHO "X$pic_mode" | $Xsed -e "$delay_single_quote_subst"`'
+enable_fast_install='`$ECHO "X$enable_fast_install" | $Xsed -e "$delay_single_quote_subst"`'
+host_alias='`$ECHO "X$host_alias" | $Xsed -e "$delay_single_quote_subst"`'
+host='`$ECHO "X$host" | $Xsed -e "$delay_single_quote_subst"`'
+host_os='`$ECHO "X$host_os" | $Xsed -e "$delay_single_quote_subst"`'
+build_alias='`$ECHO "X$build_alias" | $Xsed -e "$delay_single_quote_subst"`'
+build='`$ECHO "X$build" | $Xsed -e "$delay_single_quote_subst"`'
+build_os='`$ECHO "X$build_os" | $Xsed -e "$delay_single_quote_subst"`'
+SED='`$ECHO "X$SED" | $Xsed -e "$delay_single_quote_subst"`'
+Xsed='`$ECHO "X$Xsed" | $Xsed -e "$delay_single_quote_subst"`'
+GREP='`$ECHO "X$GREP" | $Xsed -e "$delay_single_quote_subst"`'
+EGREP='`$ECHO "X$EGREP" | $Xsed -e "$delay_single_quote_subst"`'
+FGREP='`$ECHO "X$FGREP" | $Xsed -e "$delay_single_quote_subst"`'
+LD='`$ECHO "X$LD" | $Xsed -e "$delay_single_quote_subst"`'
+NM='`$ECHO "X$NM" | $Xsed -e "$delay_single_quote_subst"`'
+LN_S='`$ECHO "X$LN_S" | $Xsed -e "$delay_single_quote_subst"`'
+max_cmd_len='`$ECHO "X$max_cmd_len" | $Xsed -e "$delay_single_quote_subst"`'
+ac_objext='`$ECHO "X$ac_objext" | $Xsed -e "$delay_single_quote_subst"`'
+exeext='`$ECHO "X$exeext" | $Xsed -e "$delay_single_quote_subst"`'
+lt_unset='`$ECHO "X$lt_unset" | $Xsed -e "$delay_single_quote_subst"`'
+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"`'
+AR_FLAGS='`$ECHO "X$AR_FLAGS" | $Xsed -e "$delay_single_quote_subst"`'
+STRIP='`$ECHO "X$STRIP" | $Xsed -e "$delay_single_quote_subst"`'
+RANLIB='`$ECHO "X$RANLIB" | $Xsed -e "$delay_single_quote_subst"`'
+old_postinstall_cmds='`$ECHO "X$old_postinstall_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+old_postuninstall_cmds='`$ECHO "X$old_postuninstall_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+old_archive_cmds='`$ECHO "X$old_archive_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+CC='`$ECHO "X$CC" | $Xsed -e "$delay_single_quote_subst"`'
+CFLAGS='`$ECHO "X$CFLAGS" | $Xsed -e "$delay_single_quote_subst"`'
+compiler='`$ECHO "X$compiler" | $Xsed -e "$delay_single_quote_subst"`'
+GCC='`$ECHO "X$GCC" | $Xsed -e "$delay_single_quote_subst"`'
+lt_cv_sys_global_symbol_pipe='`$ECHO "X$lt_cv_sys_global_symbol_pipe" | $Xsed -e "$delay_single_quote_subst"`'
+lt_cv_sys_global_symbol_to_cdecl='`$ECHO "X$lt_cv_sys_global_symbol_to_cdecl" | $Xsed -e "$delay_single_quote_subst"`'
+lt_cv_sys_global_symbol_to_c_name_address='`$ECHO "X$lt_cv_sys_global_symbol_to_c_name_address" | $Xsed -e "$delay_single_quote_subst"`'
+lt_cv_sys_global_symbol_to_c_name_address_lib_prefix='`$ECHO "X$lt_cv_sys_global_symbol_to_c_name_address_lib_prefix" | $Xsed -e "$delay_single_quote_subst"`'
+objdir='`$ECHO "X$objdir" | $Xsed -e "$delay_single_quote_subst"`'
+SHELL='`$ECHO "X$SHELL" | $Xsed -e "$delay_single_quote_subst"`'
+ECHO='`$ECHO "X$ECHO" | $Xsed -e "$delay_single_quote_subst"`'
+MAGIC_CMD='`$ECHO "X$MAGIC_CMD" | $Xsed -e "$delay_single_quote_subst"`'
+lt_prog_compiler_no_builtin_flag='`$ECHO "X$lt_prog_compiler_no_builtin_flag" | $Xsed -e "$delay_single_quote_subst"`'
+lt_prog_compiler_wl='`$ECHO "X$lt_prog_compiler_wl" | $Xsed -e "$delay_single_quote_subst"`'
+lt_prog_compiler_pic='`$ECHO "X$lt_prog_compiler_pic" | $Xsed -e "$delay_single_quote_subst"`'
+lt_prog_compiler_static='`$ECHO "X$lt_prog_compiler_static" | $Xsed -e "$delay_single_quote_subst"`'
+lt_cv_prog_compiler_c_o='`$ECHO "X$lt_cv_prog_compiler_c_o" | $Xsed -e "$delay_single_quote_subst"`'
+need_locks='`$ECHO "X$need_locks" | $Xsed -e "$delay_single_quote_subst"`'
+DSYMUTIL='`$ECHO "X$DSYMUTIL" | $Xsed -e "$delay_single_quote_subst"`'
+NMEDIT='`$ECHO "X$NMEDIT" | $Xsed -e "$delay_single_quote_subst"`'
+LIPO='`$ECHO "X$LIPO" | $Xsed -e "$delay_single_quote_subst"`'
+OTOOL='`$ECHO "X$OTOOL" | $Xsed -e "$delay_single_quote_subst"`'
+OTOOL64='`$ECHO "X$OTOOL64" | $Xsed -e "$delay_single_quote_subst"`'
+libext='`$ECHO "X$libext" | $Xsed -e "$delay_single_quote_subst"`'
+shrext_cmds='`$ECHO "X$shrext_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+extract_expsyms_cmds='`$ECHO "X$extract_expsyms_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+archive_cmds_need_lc='`$ECHO "X$archive_cmds_need_lc" | $Xsed -e "$delay_single_quote_subst"`'
+enable_shared_with_static_runtimes='`$ECHO "X$enable_shared_with_static_runtimes" | $Xsed -e "$delay_single_quote_subst"`'
+export_dynamic_flag_spec='`$ECHO "X$export_dynamic_flag_spec" | $Xsed -e "$delay_single_quote_subst"`'
+whole_archive_flag_spec='`$ECHO "X$whole_archive_flag_spec" | $Xsed -e "$delay_single_quote_subst"`'
+compiler_needs_object='`$ECHO "X$compiler_needs_object" | $Xsed -e "$delay_single_quote_subst"`'
+old_archive_from_new_cmds='`$ECHO "X$old_archive_from_new_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+old_archive_from_expsyms_cmds='`$ECHO "X$old_archive_from_expsyms_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+archive_cmds='`$ECHO "X$archive_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+archive_expsym_cmds='`$ECHO "X$archive_expsym_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+module_cmds='`$ECHO "X$module_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+module_expsym_cmds='`$ECHO "X$module_expsym_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+with_gnu_ld='`$ECHO "X$with_gnu_ld" | $Xsed -e "$delay_single_quote_subst"`'
+allow_undefined_flag='`$ECHO "X$allow_undefined_flag" | $Xsed -e "$delay_single_quote_subst"`'
+no_undefined_flag='`$ECHO "X$no_undefined_flag" | $Xsed -e "$delay_single_quote_subst"`'
+hardcode_libdir_flag_spec='`$ECHO "X$hardcode_libdir_flag_spec" | $Xsed -e "$delay_single_quote_subst"`'
+hardcode_libdir_flag_spec_ld='`$ECHO "X$hardcode_libdir_flag_spec_ld" | $Xsed -e "$delay_single_quote_subst"`'
+hardcode_libdir_separator='`$ECHO "X$hardcode_libdir_separator" | $Xsed -e "$delay_single_quote_subst"`'
+hardcode_direct='`$ECHO "X$hardcode_direct" | $Xsed -e "$delay_single_quote_subst"`'
+hardcode_direct_absolute='`$ECHO "X$hardcode_direct_absolute" | $Xsed -e "$delay_single_quote_subst"`'
+hardcode_minus_L='`$ECHO "X$hardcode_minus_L" | $Xsed -e "$delay_single_quote_subst"`'
+hardcode_shlibpath_var='`$ECHO "X$hardcode_shlibpath_var" | $Xsed -e "$delay_single_quote_subst"`'
+hardcode_automatic='`$ECHO "X$hardcode_automatic" | $Xsed -e "$delay_single_quote_subst"`'
+inherit_rpath='`$ECHO "X$inherit_rpath" | $Xsed -e "$delay_single_quote_subst"`'
+link_all_deplibs='`$ECHO "X$link_all_deplibs" | $Xsed -e "$delay_single_quote_subst"`'
+fix_srcfile_path='`$ECHO "X$fix_srcfile_path" | $Xsed -e "$delay_single_quote_subst"`'
+always_export_symbols='`$ECHO "X$always_export_symbols" | $Xsed -e "$delay_single_quote_subst"`'
+export_symbols_cmds='`$ECHO "X$export_symbols_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+exclude_expsyms='`$ECHO "X$exclude_expsyms" | $Xsed -e "$delay_single_quote_subst"`'
+include_expsyms='`$ECHO "X$include_expsyms" | $Xsed -e "$delay_single_quote_subst"`'
+prelink_cmds='`$ECHO "X$prelink_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+file_list_spec='`$ECHO "X$file_list_spec" | $Xsed -e "$delay_single_quote_subst"`'
+variables_saved_for_relink='`$ECHO "X$variables_saved_for_relink" | $Xsed -e "$delay_single_quote_subst"`'
+need_lib_prefix='`$ECHO "X$need_lib_prefix" | $Xsed -e "$delay_single_quote_subst"`'
+need_version='`$ECHO "X$need_version" | $Xsed -e "$delay_single_quote_subst"`'
+version_type='`$ECHO "X$version_type" | $Xsed -e "$delay_single_quote_subst"`'
+runpath_var='`$ECHO "X$runpath_var" | $Xsed -e "$delay_single_quote_subst"`'
+shlibpath_var='`$ECHO "X$shlibpath_var" | $Xsed -e "$delay_single_quote_subst"`'
+shlibpath_overrides_runpath='`$ECHO "X$shlibpath_overrides_runpath" | $Xsed -e "$delay_single_quote_subst"`'
+libname_spec='`$ECHO "X$libname_spec" | $Xsed -e "$delay_single_quote_subst"`'
+library_names_spec='`$ECHO "X$library_names_spec" | $Xsed -e "$delay_single_quote_subst"`'
+soname_spec='`$ECHO "X$soname_spec" | $Xsed -e "$delay_single_quote_subst"`'
+postinstall_cmds='`$ECHO "X$postinstall_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+postuninstall_cmds='`$ECHO "X$postuninstall_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+finish_cmds='`$ECHO "X$finish_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+finish_eval='`$ECHO "X$finish_eval" | $Xsed -e "$delay_single_quote_subst"`'
+hardcode_into_libs='`$ECHO "X$hardcode_into_libs" | $Xsed -e "$delay_single_quote_subst"`'
+sys_lib_search_path_spec='`$ECHO "X$sys_lib_search_path_spec" | $Xsed -e "$delay_single_quote_subst"`'
+sys_lib_dlsearch_path_spec='`$ECHO "X$sys_lib_dlsearch_path_spec" | $Xsed -e "$delay_single_quote_subst"`'
+hardcode_action='`$ECHO "X$hardcode_action" | $Xsed -e "$delay_single_quote_subst"`'
+enable_dlopen='`$ECHO "X$enable_dlopen" | $Xsed -e "$delay_single_quote_subst"`'
+enable_dlopen_self='`$ECHO "X$enable_dlopen_self" | $Xsed -e "$delay_single_quote_subst"`'
+enable_dlopen_self_static='`$ECHO "X$enable_dlopen_self_static" | $Xsed -e "$delay_single_quote_subst"`'
+old_striplib='`$ECHO "X$old_striplib" | $Xsed -e "$delay_single_quote_subst"`'
+striplib='`$ECHO "X$striplib" | $Xsed -e "$delay_single_quote_subst"`'
+
+LTCC='$LTCC'
+LTCFLAGS='$LTCFLAGS'
+compiler='$compiler_DEFAULT'
+
+# Quote evaled strings.
+for var in SED \
+GREP \
+EGREP \
+FGREP \
+LD \
+NM \
+LN_S \
+lt_SP2NL \
+lt_NL2SP \
+reload_flag \
+OBJDUMP \
+deplibs_check_method \
+file_magic_cmd \
+AR \
+AR_FLAGS \
+STRIP \
+RANLIB \
+CC \
+CFLAGS \
+compiler \
+lt_cv_sys_global_symbol_pipe \
+lt_cv_sys_global_symbol_to_cdecl \
+lt_cv_sys_global_symbol_to_c_name_address \
+lt_cv_sys_global_symbol_to_c_name_address_lib_prefix \
+SHELL \
+ECHO \
+lt_prog_compiler_no_builtin_flag \
+lt_prog_compiler_wl \
+lt_prog_compiler_pic \
+lt_prog_compiler_static \
+lt_cv_prog_compiler_c_o \
+need_locks \
+DSYMUTIL \
+NMEDIT \
+LIPO \
+OTOOL \
+OTOOL64 \
+shrext_cmds \
+export_dynamic_flag_spec \
+whole_archive_flag_spec \
+compiler_needs_object \
+with_gnu_ld \
+allow_undefined_flag \
+no_undefined_flag \
+hardcode_libdir_flag_spec \
+hardcode_libdir_flag_spec_ld \
+hardcode_libdir_separator \
+fix_srcfile_path \
+exclude_expsyms \
+include_expsyms \
+file_list_spec \
+variables_saved_for_relink \
+libname_spec \
+library_names_spec \
+soname_spec \
+finish_eval \
+old_striplib \
+striplib; do
+ case \`eval \\\\\$ECHO "X\\\\\$\$var"\` in
+ *[\\\\\\\`\\"\\\$]*)
+ eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"X\\\$\$var\\" | \\\$Xsed -e \\"\\\$sed_quote_subst\\"\\\`\\\\\\""
+ ;;
+ *)
+ eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\""
+ ;;
+ esac
+done
+
+# Double-quote double-evaled strings.
+for var in reload_cmds \
+old_postinstall_cmds \
+old_postuninstall_cmds \
+old_archive_cmds \
+extract_expsyms_cmds \
+old_archive_from_new_cmds \
+old_archive_from_expsyms_cmds \
+archive_cmds \
+archive_expsym_cmds \
+module_cmds \
+module_expsym_cmds \
+export_symbols_cmds \
+prelink_cmds \
+postinstall_cmds \
+postuninstall_cmds \
+finish_cmds \
+sys_lib_search_path_spec \
+sys_lib_dlsearch_path_spec; do
+ case \`eval \\\\\$ECHO "X\\\\\$\$var"\` in
+ *[\\\\\\\`\\"\\\$]*)
+ eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"X\\\$\$var\\" | \\\$Xsed -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\""
+ ;;
+ *)
+ eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\""
+ ;;
+ esac
+done
+
+# Fix-up fallback echo if it was mangled by the above quoting rules.
+case \$lt_ECHO in
+*'\\\$0 --fallback-echo"') lt_ECHO=\`\$ECHO "X\$lt_ECHO" | \$Xsed -e 's/\\\\\\\\\\\\\\\$0 --fallback-echo"\$/\$0 --fallback-echo"/'\`
+ ;;
+esac
+
+ac_aux_dir='$ac_aux_dir'
+xsi_shell='$xsi_shell'
+lt_shell_append='$lt_shell_append'
+
+# See if we are running on zsh, and set the options which allow our
+# commands through without removal of \ escapes INIT.
+if test -n "\${ZSH_VERSION+set}" ; then
+ setopt NO_GLOB_SUBST
+fi
+
+
+ PACKAGE='$PACKAGE'
+ VERSION='$VERSION'
+ TIMESTAMP='$TIMESTAMP'
+ RM='$RM'
+ ofile='$ofile'
+
+
+
+
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+
+# Handling of arguments.
+for ac_config_target in $ac_config_targets
+do
+ case $ac_config_target in
+ "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/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" ;;
+
+ *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5 ;;
+ esac
+done
+
+
+# If the user did not use the arguments to specify the items to instantiate,
+# then the envvar interface is used. Set only those that are not.
+# We use the long form for the default assignment because of an extremely
+# bizarre bug on SunOS 4.1.3.
+if $ac_need_defaults; then
+ test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files
+ test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers
+ test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands
+fi
+
+# Have a temporary directory for convenience. Make it in the build tree
+# simply because there is no reason against having it here, and in addition,
+# creating and moving files from /tmp can sometimes cause problems.
+# Hook for its removal unless debugging.
+# Note that there is a small window in which the directory will not be cleaned:
+# after its creation but before its name has been assigned to `$tmp'.
+$debug ||
+{
+ tmp=
+ trap 'exit_status=$?
+ { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status
+' 0
+ trap 'as_fn_exit 1' 1 2 13 15
+}
+# Create a (secure) tmp directory for tmp files.
+
+{
+ tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` &&
+ test -n "$tmp" && test -d "$tmp"
+} ||
+{
+ tmp=./conf$$-$RANDOM
+ (umask 077 && mkdir "$tmp")
+} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5
+
+# 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
+
+
+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
+
+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
+ . ./conf$$subs.sh ||
+ as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
+
+ 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
+ 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"
+
+}
+{
+ 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
+}
+
+_ACAWK
+_ACEOF
+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 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[ ]*=[ ]*/{
+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 || 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"
+
+
+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*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5 ;;
+ :[FH]-) ac_tag=-:-;;
+ :[FH]*) ac_tag=$ac_tag:$ac_tag.in;;
+ esac
+ ac_save_IFS=$IFS
+ IFS=:
+ set x $ac_tag
+ IFS=$ac_save_IFS
+ shift
+ ac_file=$1
+ shift
+
+ case $ac_mode in
+ :L) ac_source=$1;;
+ :[FH])
+ ac_file_inputs=
+ for ac_f
+ do
+ case $ac_f in
+ -) ac_f="$tmp/stdin";;
+ *) # Look for the file first in the build tree, then in the source tree
+ # (if the path is not absolute). The absolute path cannot be DOS-style,
+ # because $ac_f cannot contain `:'.
+ test -f "$ac_f" ||
+ case $ac_f in
+ [\\/$]*) false;;
+ *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";;
+ esac ||
+ as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5 ;;
+ esac
+ 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 '`
+ $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g'
+ `' by configure.'
+ if test x"$ac_file" != x-; then
+ configure_input="$ac_file. $configure_input"
+ { $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" \
+ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;;
+ esac
+ ;;
+ esac
+
+ ac_dir=`$as_dirname -- "$ac_file" ||
+$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$ac_file" : 'X\(//\)[^/]' \| \
+ X"$ac_file" : 'X\(//\)$' \| \
+ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null ||
+$as_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"; as_fn_mkdir_p
+ ac_builddir=.
+
+case "$ac_dir" in
+.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
+*)
+ ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'`
+ # A ".." for each directory in $ac_dir_suffix.
+ 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/ ;;
+ esac ;;
+esac
+ac_abs_top_builddir=$ac_pwd
+ac_abs_builddir=$ac_pwd$ac_dir_suffix
+# for backward compatibility:
+ac_top_builddir=$ac_top_build_prefix
+
+case $srcdir in
+ .) # We are building in place.
+ ac_srcdir=.
+ ac_top_srcdir=$ac_top_builddir_sub
+ ac_abs_top_srcdir=$ac_pwd ;;
+ [\\/]* | ?:[\\/]* ) # Absolute name.
+ ac_srcdir=$srcdir$ac_dir_suffix;
+ ac_top_srcdir=$srcdir
+ ac_abs_top_srcdir=$srcdir ;;
+ *) # Relative name.
+ ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
+ ac_top_srcdir=$ac_top_build_prefix$srcdir
+ ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
+esac
+ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
+
+
+ case $ac_mode in
+ :F)
+ #
+ # CONFIG_FILE
+ #
+
+ case $INSTALL in
+ [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;;
+ *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;;
+ esac
+ ac_MKDIR_P=$MKDIR_P
+ case $MKDIR_P in
+ [\\/$]* | ?:[\\/]* ) ;;
+ */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;;
+ esac
+_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=
+ac_sed_dataroot='
+/datarootdir/ {
+ p
+ q
+}
+/@datadir@/p
+/@docdir@/p
+/@infodir@/p
+/@localedir@/p
+/@mandir@/p'
+case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in
+*datarootdir*) ac_datarootdir_seen=yes;;
+*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*)
+ { $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 || 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' ;;
+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 || ac_write_fail=1
+ac_sed_extra="$ac_vpsub
+$extrasub
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+:t
+/@[a-zA-Z_][a-zA-Z_0-9]*@/!b
+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
+s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t
+s&@builddir@&$ac_builddir&;t t
+s&@abs_builddir@&$ac_abs_builddir&;t t
+s&@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
+"
+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"; } &&
+ { $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 \
+ || as_fn_error $? "could not create $ac_file" "$LINENO" 5
+ ;;
+ :H)
+ #
+ # CONFIG_HEADER
+ #
+ if test x"$ac_file" != x-; then
+ {
+ $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" \
+ || as_fn_error $? "could not create $ac_file" "$LINENO" 5
+ fi
+ else
+ $as_echo "/* $configure_input */" \
+ && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" \
+ || as_fn_error $? "could not create -" "$LINENO" 5
+ fi
+# 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
+ $_am_arg | $_am_arg:* )
+ break ;;
+ * )
+ _am_stamp_count=`expr $_am_stamp_count + 1` ;;
+ esac
+done
+echo "timestamp for $_am_arg" >`$as_dirname -- "$_am_arg" ||
+$as_expr X"$_am_arg" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$_am_arg" : 'X\(//\)[^/]' \| \
+ X"$_am_arg" : 'X\(//\)$' \| \
+ X"$_am_arg" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$_am_arg" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`/stamp-h$_am_stamp_count
+ ;;
+
+ :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" ||
+$as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$mf" : 'X\(//\)[^/]' \| \
+ X"$mf" : 'X\(//\)$' \| \
+ X"$mf" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$mf" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ else
+ continue
+ fi
+ # Extract the definition of DEPDIR, am__include, and am__quote
+ # from the Makefile without running `make'.
+ DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
+ test -z "$DEPDIR" && continue
+ am__include=`sed -n 's/^am__include = //p' < "$mf"`
+ test -z "am__include" && continue
+ am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
+ # When using ansi2knr, U may be empty or an underscore; expand it
+ U=`sed -n 's/^U = //p' < "$mf"`
+ # Find all dependency output files, they are included files with
+ # $(DEPDIR) in their names. We invoke sed twice because it is the
+ # simplest approach to changing $(DEPDIR) to its actual value in the
+ # expansion.
+ for file in `sed -n "
+ s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
+ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
+ # Make sure the directory exists.
+ test -f "$dirpart/$file" && continue
+ fdir=`$as_dirname -- "$file" ||
+$as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$file" : 'X\(//\)[^/]' \| \
+ X"$file" : 'X\(//\)$' \| \
+ X"$file" : 'X\(/\)' \| . 2>/dev/null ||
+$as_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; as_fn_mkdir_p
+ # echo "creating $dirpart/$file"
+ echo '# dummy' > "$dirpart/$file"
+ done
+ done
+}
+ ;;
+ "libtool":C)
+
+ # See if we are running on zsh, and set the options which allow our
+ # commands through without removal of \ escapes.
+ if test -n "${ZSH_VERSION+set}" ; then
+ setopt NO_GLOB_SUBST
+ fi
+
+ cfgfile="${ofile}T"
+ trap "$RM \"$cfgfile\"; exit 1" 1 2 15
+ $RM "$cfgfile"
+
+ cat <<_LT_EOF >> "$cfgfile"
+#! $SHELL
+
+# `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services.
+# Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION
+# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
+# NOTE: Changes made to this file will be lost: look at ltmain.sh.
+#
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
+# 2006, 2007, 2008 Free Software Foundation, Inc.
+# Written by Gordon Matzigkeit, 1996
+#
+# This file is part of GNU Libtool.
+#
+# GNU Libtool 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.
+#
+# As a special exception to the GNU General Public License,
+# if you distribute this file as part of a program or library that
+# is built using GNU Libtool, you may include this file under the
+# same distribution terms that you use for the rest of that program.
+#
+# GNU Libtool 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 GNU Libtool; see the file COPYING. If not, a copy
+# can be downloaded from http://www.gnu.org/licenses/gpl.html, or
+# obtained by writing to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+
+# The names of the tagged configurations supported by this script.
+available_tags=""
+
+# ### BEGIN LIBTOOL CONFIG
+
+# Which release of libtool.m4 was used?
+macro_version=$macro_version
+macro_revision=$macro_revision
+
+# Whether or not to build shared libraries.
+build_libtool_libs=$enable_shared
+
+# Whether or not to build static libraries.
+build_old_libs=$enable_static
+
+# What type of objects to build.
+pic_mode=$pic_mode
+
+# Whether or not to optimize for fast installation.
+fast_install=$enable_fast_install
+
+# The host system.
+host_alias=$host_alias
+host=$host
+host_os=$host_os
+
+# The build system.
+build_alias=$build_alias
+build=$build
+build_os=$build_os
+
+# A sed program that does not truncate output.
+SED=$lt_SED
+
+# Sed that helps us avoid accidentally triggering echo(1) options like -n.
+Xsed="\$SED -e 1s/^X//"
+
+# A grep program that handles long lines.
+GREP=$lt_GREP
+
+# An ERE matcher.
+EGREP=$lt_EGREP
+
+# A literal string matcher.
+FGREP=$lt_FGREP
+
+# A BSD- or MS-compatible name lister.
+NM=$lt_NM
+
+# Whether we need soft or hard links.
+LN_S=$lt_LN_S
+
+# What is the maximum length of a command?
+max_cmd_len=$max_cmd_len
+
+# Object file suffix (normally "o").
+objext=$ac_objext
+
+# Executable file suffix (normally "").
+exeext=$exeext
+
+# whether the shell understands "unset".
+lt_unset=$lt_unset
+
+# turn spaces into newlines.
+SP2NL=$lt_lt_SP2NL
+
+# turn newlines into spaces.
+NL2SP=$lt_lt_NL2SP
+
+# How to create reloadable object files.
+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
+
+# Command to use when deplibs_check_method == "file_magic".
+file_magic_cmd=$lt_file_magic_cmd
+
+# The archiver.
+AR=$lt_AR
+AR_FLAGS=$lt_AR_FLAGS
+
+# A symbol stripping program.
+STRIP=$lt_STRIP
+
+# Commands used to install an old-style archive.
+RANLIB=$lt_RANLIB
+old_postinstall_cmds=$lt_old_postinstall_cmds
+old_postuninstall_cmds=$lt_old_postuninstall_cmds
+
+# A C compiler.
+LTCC=$lt_CC
+
+# LTCC compiler flags.
+LTCFLAGS=$lt_CFLAGS
+
+# Take the output of nm and produce a listing of raw symbols and C names.
+global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe
+
+# Transform the output of nm in a proper C declaration.
+global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl
+
+# Transform the output of nm in a C name address pair.
+global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address
+
+# Transform the output of nm in a C name address pair when lib prefix is needed.
+global_symbol_to_c_name_address_lib_prefix=$lt_lt_cv_sys_global_symbol_to_c_name_address_lib_prefix
+
+# The name of the directory that contains temporary libtool files.
+objdir=$objdir
+
+# Shell to use when invoking shell scripts.
+SHELL=$lt_SHELL
+
+# An echo program that does not interpret backslashes.
+ECHO=$lt_ECHO
+
+# Used to examine libraries when file_magic_cmd begins with "file".
+MAGIC_CMD=$MAGIC_CMD
+
+# Must we lock files when doing compilation?
+need_locks=$lt_need_locks
+
+# Tool to manipulate archived DWARF debug symbol files on Mac OS X.
+DSYMUTIL=$lt_DSYMUTIL
+
+# Tool to change global to local symbols on Mac OS X.
+NMEDIT=$lt_NMEDIT
+
+# Tool to manipulate fat objects and archives on Mac OS X.
+LIPO=$lt_LIPO
+
+# ldd/readelf like tool for Mach-O binaries on Mac OS X.
+OTOOL=$lt_OTOOL
+
+# ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4.
+OTOOL64=$lt_OTOOL64
+
+# Old archive suffix (normally "a").
+libext=$libext
+
+# Shared library suffix (normally ".so").
+shrext_cmds=$lt_shrext_cmds
+
+# The commands to extract the exported symbol list from a shared archive.
+extract_expsyms_cmds=$lt_extract_expsyms_cmds
+
+# Variables whose values should be saved in libtool wrapper scripts and
+# restored at link time.
+variables_saved_for_relink=$lt_variables_saved_for_relink
+
+# Do we need the "lib" prefix for modules?
+need_lib_prefix=$need_lib_prefix
+
+# Do we need a version for libraries?
+need_version=$need_version
+
+# Library versioning type.
+version_type=$version_type
+
+# Shared library runtime path variable.
+runpath_var=$runpath_var
+
+# Shared library path variable.
+shlibpath_var=$shlibpath_var
+
+# Is shlibpath searched before the hard-coded library search path?
+shlibpath_overrides_runpath=$shlibpath_overrides_runpath
+
+# Format of library name prefix.
+libname_spec=$lt_libname_spec
+
+# List of archive names. First name is the real one, the rest are links.
+# The last name is the one that the linker finds with -lNAME
+library_names_spec=$lt_library_names_spec
+
+# The coded name of the library, if different from the real name.
+soname_spec=$lt_soname_spec
+
+# Command to use after installation of a shared archive.
+postinstall_cmds=$lt_postinstall_cmds
+
+# Command to use after uninstallation of a shared archive.
+postuninstall_cmds=$lt_postuninstall_cmds
+
+# Commands used to finish a libtool library installation in a directory.
+finish_cmds=$lt_finish_cmds
+
+# As "finish_cmds", except a single script fragment to be evaled but
+# not shown.
+finish_eval=$lt_finish_eval
+
+# Whether we should hardcode library paths into libraries.
+hardcode_into_libs=$hardcode_into_libs
+
+# Compile-time system search path for libraries.
+sys_lib_search_path_spec=$lt_sys_lib_search_path_spec
+
+# Run-time system search path for libraries.
+sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec
+
+# Whether dlopen is supported.
+dlopen_support=$enable_dlopen
+
+# Whether dlopen of programs is supported.
+dlopen_self=$enable_dlopen_self
+
+# Whether dlopen of statically linked programs is supported.
+dlopen_self_static=$enable_dlopen_self_static
+
+# Commands to strip libraries.
+old_striplib=$lt_old_striplib
+striplib=$lt_striplib
+
+
+# The linker used to build libraries.
+LD=$lt_LD
+
+# Commands used to build an old-style archive.
+old_archive_cmds=$lt_old_archive_cmds
+
+# A language specific compiler.
+CC=$lt_compiler
+
+# Is the compiler the GNU compiler?
+with_gcc=$GCC
+
+# Compiler flag to turn off builtin functions.
+no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag
+
+# How to pass a linker flag through the compiler.
+wl=$lt_lt_prog_compiler_wl
+
+# Additional compiler flags for building library objects.
+pic_flag=$lt_lt_prog_compiler_pic
+
+# Compiler flag to prevent dynamic linking.
+link_static_flag=$lt_lt_prog_compiler_static
+
+# Does compiler simultaneously support -c and -o options?
+compiler_c_o=$lt_lt_cv_prog_compiler_c_o
+
+# Whether or not to add -lc for building shared libraries.
+build_libtool_need_lc=$archive_cmds_need_lc
+
+# Whether or not to disallow shared libs when runtime libs are static.
+allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes
+
+# Compiler flag to allow reflexive dlopens.
+export_dynamic_flag_spec=$lt_export_dynamic_flag_spec
+
+# Compiler flag to generate shared objects directly from archives.
+whole_archive_flag_spec=$lt_whole_archive_flag_spec
+
+# Whether the compiler copes with passing no objects directly.
+compiler_needs_object=$lt_compiler_needs_object
+
+# Create an old-style archive from a shared archive.
+old_archive_from_new_cmds=$lt_old_archive_from_new_cmds
+
+# Create a temporary old-style archive to link instead of a shared archive.
+old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds
+
+# Commands used to build a shared archive.
+archive_cmds=$lt_archive_cmds
+archive_expsym_cmds=$lt_archive_expsym_cmds
+
+# Commands used to build a loadable module if different from building
+# a shared archive.
+module_cmds=$lt_module_cmds
+module_expsym_cmds=$lt_module_expsym_cmds
+
+# Whether we are building with GNU ld or not.
+with_gnu_ld=$lt_with_gnu_ld
+
+# Flag that allows shared libraries with undefined symbols to be built.
+allow_undefined_flag=$lt_allow_undefined_flag
+
+# Flag that enforces no undefined symbols.
+no_undefined_flag=$lt_no_undefined_flag
+
+# Flag to hardcode \$libdir into a binary during linking.
+# This must work even if \$libdir does not exist
+hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec
+
+# If ld is used when linking, flag to hardcode \$libdir into a binary
+# during linking. This must work even if \$libdir does not exist.
+hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld
+
+# Whether we need a single "-rpath" flag with a separated argument.
+hardcode_libdir_separator=$lt_hardcode_libdir_separator
+
+# Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes
+# DIR into the resulting binary.
+hardcode_direct=$hardcode_direct
+
+# Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes
+# DIR into the resulting binary and the resulting library dependency is
+# "absolute",i.e impossible to change by setting \${shlibpath_var} if the
+# library is relocated.
+hardcode_direct_absolute=$hardcode_direct_absolute
+
+# Set to "yes" if using the -LDIR flag during linking hardcodes DIR
+# into the resulting binary.
+hardcode_minus_L=$hardcode_minus_L
+
+# Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR
+# into the resulting binary.
+hardcode_shlibpath_var=$hardcode_shlibpath_var
+
+# Set to "yes" if building a shared library automatically hardcodes DIR
+# into the library and all subsequent libraries and executables linked
+# against it.
+hardcode_automatic=$hardcode_automatic
+
+# Set to yes if linker adds runtime paths of dependent libraries
+# to runtime path list.
+inherit_rpath=$inherit_rpath
+
+# Whether libtool must link a program against all its dependency libraries.
+link_all_deplibs=$link_all_deplibs
+
+# Fix the shell variable \$srcfile for the compiler.
+fix_srcfile_path=$lt_fix_srcfile_path
+
+# Set to "yes" if exported symbols are required.
+always_export_symbols=$always_export_symbols
+
+# The commands to list exported symbols.
+export_symbols_cmds=$lt_export_symbols_cmds
+
+# Symbols that should not be listed in the preloaded symbols.
+exclude_expsyms=$lt_exclude_expsyms
+
+# Symbols that must always be exported.
+include_expsyms=$lt_include_expsyms
+
+# Commands necessary for linking programs (against libraries) with templates.
+prelink_cmds=$lt_prelink_cmds
+
+# Specify filename containing input files.
+file_list_spec=$lt_file_list_spec
+
+# How to hardcode a shared library path into an executable.
+hardcode_action=$hardcode_action
+
+# ### END LIBTOOL CONFIG
+
+_LT_EOF
+
+ case $host_os in
+ aix3*)
+ cat <<\_LT_EOF >> "$cfgfile"
+# AIX sometimes has problems with the GCC collect2 program. For some
+# reason, if we set the COLLECT_NAMES environment variable, the problems
+# vanish in a puff of smoke.
+if test "X${COLLECT_NAMES+set}" != Xset; then
+ COLLECT_NAMES=
+ export COLLECT_NAMES
+fi
+_LT_EOF
+ ;;
+ esac
+
+
+ltmain="$ac_aux_dir/ltmain.sh"
+
+
+ # We use sed instead of cat because bash on DJGPP gets confused if
+ # if finds mixed CR/LF and LF-only lines. Since sed operates in
+ # text mode, it properly converts lines to CR/LF. This bash problem
+ # is reportedly fixed, but why not run on old versions too?
+ sed '/^# Generated shell functions inserted here/q' "$ltmain" >> "$cfgfile" \
+ || (rm -f "$cfgfile"; exit 1)
+
+ case $xsi_shell in
+ yes)
+ cat << \_LT_EOF >> "$cfgfile"
+
+# func_dirname file append nondir_replacement
+# Compute the dirname of FILE. If nonempty, add APPEND to the result,
+# otherwise set result to NONDIR_REPLACEMENT.
+func_dirname ()
+{
+ case ${1} in
+ */*) func_dirname_result="${1%/*}${2}" ;;
+ * ) func_dirname_result="${3}" ;;
+ esac
+}
+
+# func_basename file
+func_basename ()
+{
+ func_basename_result="${1##*/}"
+}
+
+# func_dirname_and_basename file append nondir_replacement
+# perform func_basename and func_dirname in a single function
+# call:
+# dirname: Compute the dirname of FILE. If nonempty,
+# add APPEND to the result, otherwise set result
+# to NONDIR_REPLACEMENT.
+# value returned in "$func_dirname_result"
+# basename: Compute filename of FILE.
+# value retuned in "$func_basename_result"
+# Implementation must be kept synchronized with func_dirname
+# and func_basename. For efficiency, we do not delegate to
+# those functions but instead duplicate the functionality here.
+func_dirname_and_basename ()
+{
+ case ${1} in
+ */*) func_dirname_result="${1%/*}${2}" ;;
+ * ) func_dirname_result="${3}" ;;
+ esac
+ func_basename_result="${1##*/}"
+}
+
+# func_stripname prefix suffix name
+# strip PREFIX and SUFFIX off of NAME.
+# PREFIX and SUFFIX must not contain globbing or regex special
+# characters, hashes, percent signs, but SUFFIX may contain a leading
+# dot (in which case that matches only a dot).
+func_stripname ()
+{
+ # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are
+ # positional parameters, so assign one to ordinary parameter first.
+ func_stripname_result=${3}
+ func_stripname_result=${func_stripname_result#"${1}"}
+ func_stripname_result=${func_stripname_result%"${2}"}
+}
+
+# func_opt_split
+func_opt_split ()
+{
+ func_opt_split_opt=${1%%=*}
+ func_opt_split_arg=${1#*=}
+}
+
+# func_lo2o object
+func_lo2o ()
+{
+ case ${1} in
+ *.lo) func_lo2o_result=${1%.lo}.${objext} ;;
+ *) func_lo2o_result=${1} ;;
+ esac
+}
+
+# func_xform libobj-or-source
+func_xform ()
+{
+ func_xform_result=${1%.*}.lo
+}
+
+# func_arith arithmetic-term...
+func_arith ()
+{
+ func_arith_result=$(( $* ))
+}
+
+# func_len string
+# STRING may not start with a hyphen.
+func_len ()
+{
+ func_len_result=${#1}
+}
+
+_LT_EOF
+ ;;
+ *) # Bourne compatible functions.
+ cat << \_LT_EOF >> "$cfgfile"
+
+# func_dirname file append nondir_replacement
+# Compute the dirname of FILE. If nonempty, add APPEND to the result,
+# otherwise set result to NONDIR_REPLACEMENT.
+func_dirname ()
+{
+ # Extract subdirectory from the argument.
+ func_dirname_result=`$ECHO "X${1}" | $Xsed -e "$dirname"`
+ if test "X$func_dirname_result" = "X${1}"; then
+ func_dirname_result="${3}"
+ else
+ func_dirname_result="$func_dirname_result${2}"
+ fi
+}
+
+# func_basename file
+func_basename ()
+{
+ func_basename_result=`$ECHO "X${1}" | $Xsed -e "$basename"`
+}
+
+
+# func_stripname prefix suffix name
+# strip PREFIX and SUFFIX off of NAME.
+# PREFIX and SUFFIX must not contain globbing or regex special
+# characters, hashes, percent signs, but SUFFIX may contain a leading
+# dot (in which case that matches only a dot).
+# func_strip_suffix prefix name
+func_stripname ()
+{
+ case ${2} in
+ .*) func_stripname_result=`$ECHO "X${3}" \
+ | $Xsed -e "s%^${1}%%" -e "s%\\\\${2}\$%%"`;;
+ *) func_stripname_result=`$ECHO "X${3}" \
+ | $Xsed -e "s%^${1}%%" -e "s%${2}\$%%"`;;
+ esac
+}
+
+# sed scripts:
+my_sed_long_opt='1s/^\(-[^=]*\)=.*/\1/;q'
+my_sed_long_arg='1s/^-[^=]*=//'
+
+# func_opt_split
+func_opt_split ()
+{
+ func_opt_split_opt=`$ECHO "X${1}" | $Xsed -e "$my_sed_long_opt"`
+ func_opt_split_arg=`$ECHO "X${1}" | $Xsed -e "$my_sed_long_arg"`
+}
+
+# func_lo2o object
+func_lo2o ()
+{
+ func_lo2o_result=`$ECHO "X${1}" | $Xsed -e "$lo2o"`
+}
+
+# func_xform libobj-or-source
+func_xform ()
+{
+ func_xform_result=`$ECHO "X${1}" | $Xsed -e 's/\.[^.]*$/.lo/'`
+}
+
+# func_arith arithmetic-term...
+func_arith ()
+{
+ func_arith_result=`expr "$@"`
+}
+
+# func_len string
+# STRING may not start with a hyphen.
+func_len ()
+{
+ func_len_result=`expr "$1" : ".*" 2>/dev/null || echo $max_cmd_len`
+}
+
+_LT_EOF
+esac
+
+case $lt_shell_append in
+ yes)
+ cat << \_LT_EOF >> "$cfgfile"
+
+# func_append var value
+# Append VALUE to the end of shell variable VAR.
+func_append ()
+{
+ eval "$1+=\$2"
+}
+_LT_EOF
+ ;;
+ *)
+ cat << \_LT_EOF >> "$cfgfile"
+
+# func_append var value
+# Append VALUE to the end of shell variable VAR.
+func_append ()
+{
+ eval "$1=\$$1\$2"
+}
+
+_LT_EOF
+ ;;
+ esac
+
+
+ sed -n '/^# Generated shell functions inserted here/,$p' "$ltmain" >> "$cfgfile" \
+ || (rm -f "$cfgfile"; exit 1)
+
+ mv -f "$cfgfile" "$ofile" ||
+ (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile")
+ chmod +x "$ofile"
+
+ ;;
+
+ esac
+done # for ac_tag
+
+
+as_fn_exit 0
+_ACEOF
+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.
+# Unfortunately, on DOS this fails, as config.log is still kept open
+# by configure, so config.status won't be able to write to it; its
+# output is simply discarded. So we exec the FD to /dev/null,
+# effectively closing config.log, so it can be properly (re)opened and
+# appended to by config.status. When coming back to configure, we
+# need to make the FD available again.
+if test "$no_create" != yes; then
+ ac_cs_success=:
+ ac_config_status_args=
+ test "$silent" = yes &&
+ ac_config_status_args="$ac_config_status_args --quiet"
+ exec 5>/dev/null
+ $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false
+ exec 5>>config.log
+ # Use ||, not &&, to avoid exiting from the if with $? = 1, which
+ # would make configure fail if this is the last instruction.
+ $ac_cs_success || 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
+
--- /dev/null
+AC_PREREQ(2.52)
+
+AC_INIT([avsystem], [1.0])
+AM_INIT_AUTOMAKE([-Wall -Werror foreign])
+AC_CONFIG_HEADERS([config.h:config.hin])
+
+AC_CONFIG_MACRO_DIR([m4])
+
+# Checks for programs.
+AC_PROG_CC
+AC_C_CONST
+dnl AC_FUNC_MALLOC
+AC_FUNC_MMAP
+AC_FUNC_REALLOC
+AC_FUNC_SELECT_ARGTYPES
+AC_FUNC_STAT
+AC_FUNC_VPRINTF
+AC_HEADER_STDBOOL
+AC_HEADER_STDC
+AC_HEADER_TIME
+AC_PROG_GCC_TRADITIONAL
+AC_PROG_LIBTOOL
+
+# Checks for libraries.
+PKG_CHECK_MODULES(AVSYSTEM, avsysaudio)
+AC_SUBST(AVSYSTEM_CFLAGS)
+AC_SUBST(AVSYSTEM_LIBS)
+
+PKG_CHECK_MODULES(MMCOMMON, mm-common)
+AC_SUBST(MMCOMMON_CFLAGS)
+AC_SUBST(MMCOMMON_LIBS)
+
+if [test "x$IS_SDK" = "xyes"];
+then
+echo "SDK build does not use mm-log"
+else
+PKG_CHECK_MODULES(MMLOG, mm-log)
+AC_SUBST(MMLOG_CFLAGS)
+AC_SUBST(MMLOG_LIBS)
+fi
+
+PKG_CHECK_MODULES(MMSESSION, mm-session)
+AC_SUBST(MMSESSION_CFLAGS)
+AC_SUBST(MMSESSION_LIBS)
+
+PKG_CHECK_MODULES(AUDIOSESSIONMGR, audio-session-mgr)
+AC_SUBST(AUDIOSESSIONMGR_CFLAGS)
+AC_SUBST(AUDIOSESSIONMGR_LIBS)
+
+PKG_CHECK_MODULES(GLIB2, glib-2.0 gthread-2.0)
+AC_SUBST(GLIB2_CFLAGS)
+AC_SUBST(GLIB2_LIBS)
+
+PKG_CHECK_MODULES(VCONF, vconf)
+AC_SUBST(VCONF_CFLAGS)
+AC_SUBST(VCONF_LIBS)
+
+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
+ yes) USE_PULSE=yes ;;
+ no) USE_PULSE=no ;;
+ *) AC_MSG_ERROR(bad value ${enableval} for --enable-pulse) ;;
+ esac
+ ],[USE_PULSE=no])
+if test "x$USE_PULSE" = "xyes"; then
+PKG_CHECK_MODULES(PULSE, libpulse)
+AC_SUBST(PULSE_CFLAGS)
+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
+AC_CHECK_HEADERS([fcntl.h memory.h stdlib.h string.h sys/time.h unistd.h errno.h sys/types.h sys/stat.h])
+
+# Checks for typedefs, structures, and compiler characteristics.
+AC_C_CONST
+AC_TYPE_PID_T
+AC_TYPE_SIZE_T
+
+# Checks for library functions.
+AC_FUNC_ALLOCA
+AC_FUNC_FORK
+AC_FUNC_MALLOC
+AC_FUNC_MEMCMP
+AC_FUNC_SELECT_ARGTYPES
+AC_TYPE_SIGNAL
+AC_CHECK_FUNCS([memset select])
+AC_CONFIG_FILES([
+common/Makefile
+Makefile
+server/Makefile
+server/plugin/Makefile
+server/plugin/wav/Makefile
+server/plugin/keytone/Makefile
+server/plugin/tone/Makefile
+pkgconfig/Makefile
+pkgconfig/mm-sound.pc
+pkgconfig/mm-keysound.pc
+testsuite/Makefile
+init/Makefile
+])
+AC_OUTPUT
--- /dev/null
+#! /bin/sh
+# depcomp - compile a program generating dependencies as side-effects
+
+scriptversion=2007-03-29.01
+
+# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007 Free Software
+# Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+# 02110-1301, USA.
+
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
+
+case $1 in
+ '')
+ echo "$0: No command. Try \`$0 --help' for more information." 1>&2
+ exit 1;
+ ;;
+ -h | --h*)
+ cat <<\EOF
+Usage: depcomp [--help] [--version] PROGRAM [ARGS]
+
+Run PROGRAMS ARGS to compile a file, generating dependencies
+as side-effects.
+
+Environment variables:
+ depmode Dependency tracking mode.
+ source Source file read by `PROGRAMS ARGS'.
+ object Object file output by `PROGRAMS ARGS'.
+ DEPDIR directory where to store dependencies.
+ depfile Dependency file to output.
+ tmpdepfile Temporary file to use when outputing dependencies.
+ libtool Whether libtool is used (yes/no).
+
+Report bugs to <bug-automake@gnu.org>.
+EOF
+ exit $?
+ ;;
+ -v | --v*)
+ echo "depcomp $scriptversion"
+ exit $?
+ ;;
+esac
+
+if test -z "$depmode" || test -z "$source" || test -z "$object"; then
+ echo "depcomp: Variables source, object and depmode must be set" 1>&2
+ exit 1
+fi
+
+# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po.
+depfile=${depfile-`echo "$object" |
+ sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`}
+tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
+
+rm -f "$tmpdepfile"
+
+# Some modes work just like other modes, but use different flags. We
+# parameterize here, but still list the modes in the big case below,
+# to make depend.m4 easier to write. Note that we *cannot* use a case
+# here, because this file can only contain one case statement.
+if test "$depmode" = hp; then
+ # HP compiler uses -M and no extra arg.
+ gccflag=-M
+ depmode=gcc
+fi
+
+if test "$depmode" = dashXmstdout; then
+ # This is just like dashmstdout with a different argument.
+ dashmflag=-xM
+ depmode=dashmstdout
+fi
+
+case "$depmode" in
+gcc3)
+## gcc 3 implements dependency tracking that does exactly what
+## we want. Yay! Note: for some reason libtool 1.4 doesn't like
+## it if -MD -MP comes after the -MF stuff. Hmm.
+## Unfortunately, FreeBSD c89 acceptance of flags depends upon
+## the command line argument order; so add the flags where they
+## appear in depend2.am. Note that the slowdown incurred here
+## affects only configure: in makefiles, %FASTDEP% shortcuts this.
+ for arg
+ do
+ case $arg in
+ -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;;
+ *) set fnord "$@" "$arg" ;;
+ esac
+ shift # fnord
+ shift # $arg
+ done
+ "$@"
+ stat=$?
+ if test $stat -eq 0; then :
+ else
+ rm -f "$tmpdepfile"
+ exit $stat
+ fi
+ mv "$tmpdepfile" "$depfile"
+ ;;
+
+gcc)
+## There are various ways to get dependency output from gcc. Here's
+## why we pick this rather obscure method:
+## - Don't want to use -MD because we'd like the dependencies to end
+## up in a subdir. Having to rename by hand is ugly.
+## (We might end up doing this anyway to support other compilers.)
+## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
+## -MM, not -M (despite what the docs say).
+## - Using -M directly means running the compiler twice (even worse
+## than renaming).
+ if test -z "$gccflag"; then
+ gccflag=-MD,
+ fi
+ "$@" -Wp,"$gccflag$tmpdepfile"
+ stat=$?
+ if test $stat -eq 0; then :
+ else
+ rm -f "$tmpdepfile"
+ exit $stat
+ fi
+ rm -f "$depfile"
+ echo "$object : \\" > "$depfile"
+ alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
+## The second -e expression handles DOS-style file names with drive letters.
+ sed -e 's/^[^:]*: / /' \
+ -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
+## This next piece of magic avoids the `deleted header file' problem.
+## The problem is that when a header file which appears in a .P file
+## is deleted, the dependency causes make to die (because there is
+## typically no way to rebuild the header). We avoid this by adding
+## dummy dependencies for each header file. Too bad gcc doesn't do
+## this for us directly.
+ tr ' ' '
+' < "$tmpdepfile" |
+## Some versions of gcc put a space before the `:'. On the theory
+## that the space means something, we add a space to the output as
+## well.
+## Some versions of the HPUX 10.20 sed can't process this invocation
+## correctly. Breaking it into two sed invocations is a workaround.
+ sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
+ rm -f "$tmpdepfile"
+ ;;
+
+hp)
+ # This case exists only to let depend.m4 do its work. It works by
+ # looking at the text of this script. This case will never be run,
+ # since it is checked for above.
+ exit 1
+ ;;
+
+sgi)
+ if test "$libtool" = yes; then
+ "$@" "-Wp,-MDupdate,$tmpdepfile"
+ else
+ "$@" -MDupdate "$tmpdepfile"
+ fi
+ stat=$?
+ if test $stat -eq 0; then :
+ else
+ rm -f "$tmpdepfile"
+ exit $stat
+ fi
+ rm -f "$depfile"
+
+ if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files
+ echo "$object : \\" > "$depfile"
+
+ # Clip off the initial element (the dependent). Don't try to be
+ # clever and replace this with sed code, as IRIX sed won't handle
+ # lines with more than a fixed number of characters (4096 in
+ # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines;
+ # the IRIX cc adds comments like `#:fec' to the end of the
+ # dependency line.
+ tr ' ' '
+' < "$tmpdepfile" \
+ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
+ tr '
+' ' ' >> $depfile
+ echo >> $depfile
+
+ # The second pass generates a dummy entry for each header file.
+ tr ' ' '
+' < "$tmpdepfile" \
+ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
+ >> $depfile
+ else
+ # The sourcefile does not contain any dependencies, so just
+ # store a dummy comment line, to avoid errors with the Makefile
+ # "include basename.Plo" scheme.
+ echo "#dummy" > "$depfile"
+ fi
+ rm -f "$tmpdepfile"
+ ;;
+
+aix)
+ # The C for AIX Compiler uses -M and outputs the dependencies
+ # in a .u file. In older versions, this file always lives in the
+ # current directory. Also, the AIX compiler puts `$object:' at the
+ # start of each line; $object doesn't have directory information.
+ # Version 6 uses the directory in both cases.
+ dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
+ test "x$dir" = "x$object" && dir=
+ base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
+ if test "$libtool" = yes; then
+ tmpdepfile1=$dir$base.u
+ tmpdepfile2=$base.u
+ tmpdepfile3=$dir.libs/$base.u
+ "$@" -Wc,-M
+ else
+ tmpdepfile1=$dir$base.u
+ tmpdepfile2=$dir$base.u
+ tmpdepfile3=$dir$base.u
+ "$@" -M
+ fi
+ stat=$?
+
+ if test $stat -eq 0; then :
+ else
+ rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
+ exit $stat
+ fi
+
+ for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
+ do
+ test -f "$tmpdepfile" && break
+ done
+ if test -f "$tmpdepfile"; then
+ # Each line is of the form `foo.o: dependent.h'.
+ # Do two passes, one to just change these to
+ # `$object: dependent.h' and one to simply `dependent.h:'.
+ sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
+ # That's a tab and a space in the [].
+ sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
+ else
+ # The sourcefile does not contain any dependencies, so just
+ # store a dummy comment line, to avoid errors with the Makefile
+ # "include basename.Plo" scheme.
+ echo "#dummy" > "$depfile"
+ fi
+ rm -f "$tmpdepfile"
+ ;;
+
+icc)
+ # Intel's C compiler understands `-MD -MF file'. However on
+ # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c
+ # ICC 7.0 will fill foo.d with something like
+ # foo.o: sub/foo.c
+ # foo.o: sub/foo.h
+ # which is wrong. We want:
+ # sub/foo.o: sub/foo.c
+ # sub/foo.o: sub/foo.h
+ # sub/foo.c:
+ # sub/foo.h:
+ # ICC 7.1 will output
+ # foo.o: sub/foo.c sub/foo.h
+ # and will wrap long lines using \ :
+ # foo.o: sub/foo.c ... \
+ # sub/foo.h ... \
+ # ...
+
+ "$@" -MD -MF "$tmpdepfile"
+ stat=$?
+ if test $stat -eq 0; then :
+ else
+ rm -f "$tmpdepfile"
+ exit $stat
+ fi
+ rm -f "$depfile"
+ # Each line is of the form `foo.o: dependent.h',
+ # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
+ # Do two passes, one to just change these to
+ # `$object: dependent.h' and one to simply `dependent.h:'.
+ sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
+ # Some versions of the HPUX 10.20 sed can't process this invocation
+ # correctly. Breaking it into two sed invocations is a workaround.
+ sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" |
+ sed -e 's/$/ :/' >> "$depfile"
+ rm -f "$tmpdepfile"
+ ;;
+
+hp2)
+ # The "hp" stanza above does not work with aCC (C++) and HP's ia64
+ # compilers, which have integrated preprocessors. The correct option
+ # to use with these is +Maked; it writes dependencies to a file named
+ # 'foo.d', which lands next to the object file, wherever that
+ # happens to be.
+ # Much of this is similar to the tru64 case; see comments there.
+ dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
+ test "x$dir" = "x$object" && dir=
+ base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
+ if test "$libtool" = yes; then
+ tmpdepfile1=$dir$base.d
+ tmpdepfile2=$dir.libs/$base.d
+ "$@" -Wc,+Maked
+ else
+ tmpdepfile1=$dir$base.d
+ tmpdepfile2=$dir$base.d
+ "$@" +Maked
+ fi
+ stat=$?
+ if test $stat -eq 0; then :
+ else
+ rm -f "$tmpdepfile1" "$tmpdepfile2"
+ exit $stat
+ fi
+
+ for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2"
+ do
+ test -f "$tmpdepfile" && break
+ done
+ if test -f "$tmpdepfile"; then
+ sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile"
+ # Add `dependent.h:' lines.
+ sed -ne '2,${; s/^ *//; s/ \\*$//; s/$/:/; p;}' "$tmpdepfile" >> "$depfile"
+ else
+ echo "#dummy" > "$depfile"
+ fi
+ rm -f "$tmpdepfile" "$tmpdepfile2"
+ ;;
+
+tru64)
+ # The Tru64 compiler uses -MD to generate dependencies as a side
+ # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
+ # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
+ # dependencies in `foo.d' instead, so we check for that too.
+ # Subdirectories are respected.
+ dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
+ test "x$dir" = "x$object" && dir=
+ base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
+
+ if test "$libtool" = yes; then
+ # With Tru64 cc, shared objects can also be used to make a
+ # static library. This mechanism is used in libtool 1.4 series to
+ # handle both shared and static libraries in a single compilation.
+ # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d.
+ #
+ # With libtool 1.5 this exception was removed, and libtool now
+ # generates 2 separate objects for the 2 libraries. These two
+ # compilations output dependencies in $dir.libs/$base.o.d and
+ # in $dir$base.o.d. We have to check for both files, because
+ # one of the two compilations can be disabled. We should prefer
+ # $dir$base.o.d over $dir.libs/$base.o.d because the latter is
+ # automatically cleaned when .libs/ is deleted, while ignoring
+ # the former would cause a distcleancheck panic.
+ tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4
+ tmpdepfile2=$dir$base.o.d # libtool 1.5
+ tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5
+ tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504
+ "$@" -Wc,-MD
+ else
+ tmpdepfile1=$dir$base.o.d
+ tmpdepfile2=$dir$base.d
+ tmpdepfile3=$dir$base.d
+ tmpdepfile4=$dir$base.d
+ "$@" -MD
+ fi
+
+ stat=$?
+ if test $stat -eq 0; then :
+ else
+ rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
+ exit $stat
+ fi
+
+ for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
+ do
+ test -f "$tmpdepfile" && break
+ done
+ if test -f "$tmpdepfile"; then
+ sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
+ # That's a tab and a space in the [].
+ sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
+ else
+ echo "#dummy" > "$depfile"
+ fi
+ rm -f "$tmpdepfile"
+ ;;
+
+#nosideeffect)
+ # This comment above is used by automake to tell side-effect
+ # dependency tracking mechanisms from slower ones.
+
+dashmstdout)
+ # Important note: in order to support this mode, a compiler *must*
+ # always write the preprocessed file to stdout, regardless of -o.
+ "$@" || exit $?
+
+ # Remove the call to Libtool.
+ if test "$libtool" = yes; then
+ while test $1 != '--mode=compile'; do
+ shift
+ done
+ shift
+ fi
+
+ # Remove `-o $object'.
+ IFS=" "
+ for arg
+ do
+ case $arg in
+ -o)
+ shift
+ ;;
+ $object)
+ shift
+ ;;
+ *)
+ set fnord "$@" "$arg"
+ shift # fnord
+ shift # $arg
+ ;;
+ esac
+ done
+
+ test -z "$dashmflag" && dashmflag=-M
+ # Require at least two characters before searching for `:'
+ # in the target name. This is to cope with DOS-style filenames:
+ # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise.
+ "$@" $dashmflag |
+ sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile"
+ rm -f "$depfile"
+ cat < "$tmpdepfile" > "$depfile"
+ tr ' ' '
+' < "$tmpdepfile" | \
+## Some versions of the HPUX 10.20 sed can't process this invocation
+## correctly. Breaking it into two sed invocations is a workaround.
+ sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
+ rm -f "$tmpdepfile"
+ ;;
+
+dashXmstdout)
+ # This case only exists to satisfy depend.m4. It is never actually
+ # run, as this mode is specially recognized in the preamble.
+ exit 1
+ ;;
+
+makedepend)
+ "$@" || exit $?
+ # Remove any Libtool call
+ if test "$libtool" = yes; then
+ while test $1 != '--mode=compile'; do
+ shift
+ done
+ shift
+ fi
+ # X makedepend
+ shift
+ cleared=no
+ for arg in "$@"; do
+ case $cleared in
+ no)
+ set ""; shift
+ cleared=yes ;;
+ esac
+ case "$arg" in
+ -D*|-I*)
+ set fnord "$@" "$arg"; shift ;;
+ # Strip any option that makedepend may not understand. Remove
+ # the object too, otherwise makedepend will parse it as a source file.
+ -*|$object)
+ ;;
+ *)
+ set fnord "$@" "$arg"; shift ;;
+ esac
+ done
+ obj_suffix="`echo $object | sed 's/^.*\././'`"
+ touch "$tmpdepfile"
+ ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
+ rm -f "$depfile"
+ cat < "$tmpdepfile" > "$depfile"
+ sed '1,2d' "$tmpdepfile" | tr ' ' '
+' | \
+## Some versions of the HPUX 10.20 sed can't process this invocation
+## correctly. Breaking it into two sed invocations is a workaround.
+ sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
+ rm -f "$tmpdepfile" "$tmpdepfile".bak
+ ;;
+
+cpp)
+ # Important note: in order to support this mode, a compiler *must*
+ # always write the preprocessed file to stdout.
+ "$@" || exit $?
+
+ # Remove the call to Libtool.
+ if test "$libtool" = yes; then
+ while test $1 != '--mode=compile'; do
+ shift
+ done
+ shift
+ fi
+
+ # Remove `-o $object'.
+ IFS=" "
+ for arg
+ do
+ case $arg in
+ -o)
+ shift
+ ;;
+ $object)
+ shift
+ ;;
+ *)
+ set fnord "$@" "$arg"
+ shift # fnord
+ shift # $arg
+ ;;
+ esac
+ done
+
+ "$@" -E |
+ sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
+ -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
+ sed '$ s: \\$::' > "$tmpdepfile"
+ rm -f "$depfile"
+ echo "$object : \\" > "$depfile"
+ cat < "$tmpdepfile" >> "$depfile"
+ sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
+ rm -f "$tmpdepfile"
+ ;;
+
+msvisualcpp)
+ # Important note: in order to support this mode, a compiler *must*
+ # always write the preprocessed file to stdout, regardless of -o,
+ # because we must use -o when running libtool.
+ "$@" || exit $?
+ IFS=" "
+ for arg
+ do
+ case "$arg" in
+ "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
+ set fnord "$@"
+ shift
+ shift
+ ;;
+ *)
+ set fnord "$@" "$arg"
+ shift
+ shift
+ ;;
+ esac
+ done
+ "$@" -E |
+ sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile"
+ rm -f "$depfile"
+ echo "$object : \\" > "$depfile"
+ . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile"
+ echo " " >> "$depfile"
+ . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile"
+ rm -f "$tmpdepfile"
+ ;;
+
+none)
+ exec "$@"
+ ;;
+
+*)
+ echo "Unknown depmode $depmode" 1>&2
+ exit 1
+ ;;
+esac
+
+exit 0
+
+# Local Variables:
+# mode: shell-script
+# sh-indentation: 2
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-end: "$"
+# End:
--- /dev/null
+/*
+ * 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_IPC_H__
+#define __MM_SOUND_IPC_H__
+
+#include <stdio.h>
+#include <unistd.h>
+
+#include "mm_sound.h"
+
+#define FILE_PATH 512
+
+typedef enum {
+ MM_IPC_SUCCESS,
+ MM_IPC_WARNING,
+ MM_IPC_ERROR,
+ MM_IPC_PROCESS,
+} mm_ipc_async_state;
+
+typedef struct
+{
+ /* Recieve data */
+ int msgid;
+ int msgtype;
+ int code;
+
+ /* Send data */
+ int keytone;
+ int repeat;
+ int tone;
+ double volume;
+ int memptr;
+ int memsize;
+ 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;
+ void *cbdata;
+ int samplerate;
+ int channels;
+ int volume_config;
+ int session_type;
+ int priority;
+ int handle_route;
+} mmsound_ipc_t;
+
+typedef struct
+{
+ long msg_type;
+ mmsound_ipc_t sound_msg;
+} mm_ipc_msg_t;
+
+typedef void (*mm_ipc_callback_t)(int code, int size);
+
+int MMSoundGetTime(char *position);
+int MMIpcCreate(const int key);
+int MMIpcDestroy(const int key);
+int MMIpcSendMsg(const int key, mm_ipc_msg_t *msg);
+int MMIpcRecvMsg(const int key, mm_ipc_msg_t *msg);
+
+int MMIpcSendMsgAsync(const char *ipcname, mm_ipc_msg_t *msg, mm_ipc_callback_t callback);
+int MMIpcRecvMsgAsync(const char *ipcname, mm_ipc_msg_t **msg, mm_ipc_callback_t callback);
+int MMIpcRecvData(const char *ipcname, void *data, int *size);
+int MMIpcSendDataAsync(const char *ipcname, void *data, int size, mm_ipc_callback_t callback);
+int __mm_sound_lock(void);
+int __mm_sound_unlock(void);
+
+#endif /* __MM_SOUND_IPC_H__ */
+
--- /dev/null
+/*
+ * 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.h
+ * @brief Application interface library for sound module.
+ * @date
+ * @version Release
+ *
+ * Application interface library for sound module.
+ */
+
+#ifndef __MM_SOUND_H__
+#define __MM_SOUND_H__
+
+#include <mm_types.h>
+#include <mm_error.h>
+#include <mm_message.h>
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+/**
+ @addtogroup SOUND
+ @{
+ @par
+ This part is describes the sound module of multimedia framework. Sound
+ module provides APIs to implement play wav file with simple api, to handle volume information,
+ to handle audio route policy.
+
+ @par
+ There is six different volume type for normal usage. application should set proper volume type to multimedia playback APIs.
+ <div> <table>
+ <tr>
+ <td><B>Type</B></td>
+ <td><B>Description</B></td>
+ </tr>
+ <tr>
+ <td>VOLUME_TYPE_SYSTEM</td>
+ <td>volume for normal system sound (e.g. keysound, camera shutter)</td>
+ </tr>
+ <tr>
+ <td>VOLUME_TYPE_NOTIFICATION</td>
+ <td>volume for notification (e.g. message, email notification)</td>
+ </tr>
+ <tr>
+ <td>VOLUME_TYPE_RINGTONE</td>
+ <td>volume for incoming call ring</td>
+ </tr>
+ <tr>
+ <td>VOLUME_TYPE_MEDIA</td>
+ <td>volume for media playback (e.g. music, video playback)</td>
+ </tr>
+ <tr>
+ <td>VOLUME_TYPE_CALL</td>
+ <td>volume for call</td>
+ </tr>
+ </table> </div>
+
+ @par
+ application can change audio route policy with mm-sound API.
+ Audio route is input and output of audio stream.
+
+ @par
+ @image html audio_device.png "Figure1. Audio Devices of mobile phone" width=12cm
+ @image latex audio_device.png "Figure1. Audio Devices of mobile phone" width=12cm
+
+ @par
+ Default audio route policy is like follows
+ @par
+ for playback
+ <div><table>
+ <tr>
+ <td><B>Bluetooth headset</B></td>
+ <td><B>Wired headset</B></td>
+ <td><B>Playback Device</B></td>
+ </tr>
+ <tr>
+ <td>connected</td>
+ <td>plugged</td>
+ <td>Bluetooth headset</td>
+ </tr>
+ <tr>
+ <td>connected</td>
+ <td>unplugged</td>
+ <td>Bluetooth headset</td>
+ </tr>
+ <tr>
+ <td>disconnected</td>
+ <td>plugged</td>
+ <td>Wired headset</td>
+ </tr>
+ <tr>
+ <td>disconnected</td>
+ <td>unplugged</td>
+ <td>Loud speaker</td>
+ </tr>
+ </table></div>
+
+ @par
+ for capture (bluetooth headset mic used only in call mode)
+ <div><table>
+ <tr>
+ <td><B>Bluetooth headset mic</B></td>
+ <td><B>Wired headset mic</B></td>
+ <td><B>Capture Device</B></td>
+ </tr>
+ <tr>
+ <td>connected</td>
+ <td>plugged</td>
+ <td>Wired headset mic</td>
+ </tr>
+ <tr>
+ <td>connected</td>
+ <td>unplugged</td>
+ <td>microphone</td>
+ </tr>
+ <tr>
+ <td>disconnected</td>
+ <td>plugged</td>
+ <td>Wired headset mic</td>
+ </tr>
+ <tr>
+ <td>disconnected</td>
+ <td>unplugged</td>
+ <td>Wired headset mic</td>
+ </tr>
+ </table></div>
+
+ @par
+ If application changes routing policy to SYSTEM_AUDIO_ROUTE_POLICY_IGNORE_A2DP with mm_sound_route_set_system_policy
+ audio routing policy has changed to ignore bluetooth headset connection.
+ @par
+ for playback
+ <div><table>
+ <tr>
+ <td><B>Bluetooth headset</B></td>
+ <td><B>Wired headset</B></td>
+ <td><B>Playback Device</B></td>
+ </tr>
+ <tr>
+ <td>connected</td>
+ <td>plugged</td>
+ <td>Wired headset</td>
+ </tr>
+ <tr>
+ <td>connected</td>
+ <td>unplugged</td>
+ <td>Loud speaker</td>
+ </tr>
+ <tr>
+ <td>disconnected</td>
+ <td>plugged</td>
+ <td>Wired headset</td>
+ </tr>
+ <tr>
+ <td>disconnected</td>
+ <td>unplugged</td>
+ <td>Loud speaker</td>
+ </tr>
+ </table></div>
+
+ @par
+ for capture (bluetooth headset mic used only in call mode)
+ <div><table>
+ <tr>
+ <td><B>Bluetooth headset mic</B></td>
+ <td><B>Wired headset mic</B></td>
+ <td><B>Capture Device</B></td>
+ </tr>
+ <tr>
+ <td>connected</td>
+ <td>plugged</td>
+ <td>Wired headset mic</td>
+ </tr>
+ <tr>
+ <td>connected</td>
+ <td>unplugged</td>
+ <td>microphone</td>
+ </tr>
+ <tr>
+ <td>disconnected</td>
+ <td>plugged</td>
+ <td>Wired headset mic</td>
+ </tr>
+ <tr>
+ <td>disconnected</td>
+ <td>unplugged</td>
+ <td>Wired headset mic</td>
+ </tr>
+ </table></div>
+
+ @par
+ If application changes routing policy to SYSTEM_AUDIO_ROUTE_POLICY_HANDSET_ONLY with mm_sound_route_set_system_policy
+ audio routing policy has changed to use only loud speaker and microphone.
+ @par
+ for playback
+ <div><table>
+ <tr>
+ <td><B>Bluetooth headset</B></td>
+ <td><B>Wired headset</B></td>
+ <td><B>Playback Device</B></td>
+ </tr>
+ <tr>
+ <td>connected</td>
+ <td>plugged</td>
+ <td>Loud speaker</td>
+ </tr>
+ <tr>
+ <td>connected</td>
+ <td>unplugged</td>
+ <td>Loud speaker</td>
+ </tr>
+ <tr>
+ <td>disconnected</td>
+ <td>plugged</td>
+ <td>Loud speaker</td>
+ </tr>
+ <tr>
+ <td>disconnected</td>
+ <td>unplugged</td>
+ <td>Loud speaker</td>
+ </tr>
+ </table></div>
+
+ @par
+ for capture (bluetooth headset mic used only in call mode)
+ <div><table>
+ <tr>
+ <td><B>Bluetooth headset mic</B></td>
+ <td><B>Wired headset mic</B></td>
+ <td><B>Capture Device</B></td>
+ </tr>
+ <tr>
+ <td>connected</td>
+ <td>plugged</td>
+ <td>microphone</td>
+ </tr>
+ <tr>
+ <td>connected</td>
+ <td>unplugged</td>
+ <td>microphone</td>
+ </tr>
+ <tr>
+ <td>disconnected</td>
+ <td>plugged</td>
+ <td>microphone</td>
+ </tr>
+ <tr>
+ <td>disconnected</td>
+ <td>unplugged</td>
+ <td>microphone</td>
+ </tr>
+ </table></div>
+
+ */
+
+/*
+ * MMSound Volume APIs
+ */
+
+/**
+ * Enumerations of Volume type.
+ */
+
+typedef enum {
+ VOLUME_TYPE_SYSTEM, /**< System volume type */
+ VOLUME_TYPE_NOTIFICATION, /**< Notification volume type */
+ VOLUME_TYPE_ALARM, /**< Alarm volume type */
+ VOLUME_TYPE_RINGTONE, /**< Ringtone volume type */
+ VOLUME_TYPE_MEDIA, /**< Media volume type */
+ VOLUME_TYPE_CALL, /**< Call volume type */
+ VOLUME_TYPE_VOIP, /**< VOIP volume type */
+ VOLUME_TYPE_FIXED, /**< Volume type for fixed acoustic level */
+ VOLUME_TYPE_EXT_JAVA, /**< External system volume for Java */
+ VOLUME_TYPE_MAX, /**< Volume type count */
+ VOLUME_TYPE_EXT_ANDROID = VOLUME_TYPE_FIXED, /**< External system volume for Android */
+} volume_type_t;
+
+typedef enum {
+ VOLUME_GAIN_DEFAULT = 0,
+ VOLUME_GAIN_DIALER = 1<<8,
+ VOLUME_GAIN_TOUCH = 2<<8,
+ VOLUME_GAIN_AF = 3<<8,
+ VOLUME_GAIN_SHUTTER1 = 4<<8,
+ VOLUME_GAIN_SHUTTER2 = 5<<8,
+ VOLUME_GAIN_CAMCORDING = 6<<8,
+ VOLUME_GAIN_MIDI = 7<<8,
+ VOLUME_GAIN_BOOTING = 8<<8,
+ VOLUME_GAIN_VIDEO = 9<<8,
+ VOLUME_GAIN_VIDEO_HDMI = 10<<8,
+} volume_gain_t;
+
+/**
+ * Volume change callback function type.
+ *
+ * @param user_data [in] Argument passed when callback has called
+ *
+ * @return No return value
+ * @remark None.
+ * @see mm_sound_volume_add_callback mm_sound_volume_remove_callback
+ */
+typedef void (*volume_callback_fn)(void* user_data);
+
+/**
+ * This function is to retrieve number of volume level.
+ *
+ * @param type [in] volume type to query
+ * @param step [out] number of volume steps
+ *
+ * @return This function returns MM_ERROR_NONE on success, or negative value
+ * with error code.
+ * @remark step means number of steps. so actual volume step can be 0 ~ step-1
+ * @see volume_type_t
+ * @pre None.
+ * @post None.
+ * @par Example
+ * @code
+int step = 0;
+int ret = 0;
+int max = 0;
+
+ret = mm_sound_volume_get_step(VOLUME_TYPE_SYSTEM, &step);
+if(ret < 0)
+{
+ printf("Can not get volume step\n");
+}
+else
+{
+ max = step - 1;
+ //set system volume to max value
+ mm_sound_volume_set_value(VOLUME_TYPE_SYSTEM, max);
+}
+ * @endcode
+ */
+int mm_sound_volume_get_step(volume_type_t type, int *step);
+
+
+/**
+ * This function is to add volume changed callback.
+ *
+ * @param type [in] volume type to set change callback function
+ * @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 Only one callback function per volume type will be registered.
+ * if you want to change callback function for certain volume type,
+ * remove callback first via mm_sound_volume_remove_callback().
+ * @see volume_type_t volume_callback_fn
+ * @pre There should be not be pre-registered callback fuction to given volume type.
+ * @post Callback function will be registered to given volume type
+ * @par Example
+ * @code
+volume_type_t g_vol_type = VOLUME_TYPE_MEDIA;
+
+void _volume_callback(void *data)
+{
+ unsigned int value = 0;
+ int result = 0;
+ volume_type_t *type = (volume_type_t*)data;
+
+ result = mm_sound_volume_get_value(*type, &value);
+ if(result == MM_ERROR_NONE)
+ {
+ printf("Current volume value is %d\n", value);
+ }
+ else
+ {
+ printf("Can not get volume\n");
+ }
+}
+
+int volume_control()
+{
+ int ret = 0;
+
+ ret = mm_sound_volume_add_callback(g_vol_type, _volume_callback, (void*)&g_vol_type);
+ if ( MM_ERROR_NONE != ret)
+ {
+ printf("Can not add callback\n");
+ }
+ else
+ {
+ printf("Add callback success\n");
+ }
+
+ return 0;
+}
+
+ * @endcode
+ */
+int mm_sound_volume_add_callback(volume_type_t type, volume_callback_fn func, void* user_data);
+
+
+/**
+ * This function is to remove volume changed callback.
+ *
+ * @param type [in] volume type to set change callback function
+ *
+ * @return This function returns MM_ERROR_NONE on success, or negative value
+ * with error code.
+ * @remark None.
+ * @pre Callback function should be registered previously for given volume type.
+ * @post Callback function will not be called anymore.
+ * @see volume_type_t
+ * @par Example
+ * @code
+void _volume_callback(void *data)
+{
+ printf("Callback function\n");
+}
+
+int volume_callback()
+{
+ int ret = 0;
+ int vol_type = VOLUME_TYPE_MEDIA;
+
+ mm_sound_volume_add_callback(vol_type, _volume_callback, NULL);
+
+ ret = mm_sound_volume_remove_callback(vol_type);
+ if ( MM_ERROR_NONE == ret)
+ {
+ printf("Remove callback success\n");
+ }
+ else
+ {
+ printf("Remove callback failed\n");
+ }
+
+ return ret;
+}
+
+ * @endcode
+ */
+int mm_sound_volume_remove_callback(volume_type_t type);
+
+
+/**
+ * This function is to set volume level of certain volume type.
+ *
+ * @param type [in] volume type to set value.
+ * @param value [in] volume value.
+ *
+ * @return This function returns MM_ERROR_NONE on success, or negative value
+ * with error code.
+ * @remark value should be 0 ~ mm_sound_volume_get_step() -1
+ * @see mm_sound_volume_get_step, mm_sound_volume_get_value volume_type_t
+ * @pre None.
+ * @post Volume value will be changed to given value for given volume type.
+ * @par Example
+ * @code
+int step = 0;
+int ret = 0;
+int max = 0;
+
+ret = mm_sound_volume_get_step(VOLUME_TYPE_SYSTEM, &step);
+if(ret < 0)
+{
+ printf("Can not get volume step\n");
+}
+else
+{
+ max = step - 1;
+ //set system volume to max value
+ ret = mm_sound_volume_set_value(VOLUME_TYPE_SYSTEM, max);
+ if(ret < 0)
+ {
+ printf("Can not set volume value\n");
+ }
+}
+ * @endcode
+ */
+int mm_sound_volume_set_value(volume_type_t type, const unsigned int value);
+
+
+
+/**
+ * This function is to get volume level of certain volume type.
+ *
+ * @param type [in] volume type to get value.
+ * @param value [out] volume value.
+ *
+ * @return This function returns MM_ERROR_NONE on success, or negative value
+ * with error code.
+ * @remark None.
+ * @pre None.
+ * @post None.
+ * @see volume_type_t mm_sound_volume_set_value
+ * @par Example
+ * @code
+int value = 0;
+int ret = 0;
+
+ret = mm_sound_volume_get_value(VOLUME_TYPE_SYSTEM, &value);
+if(ret < 0)
+{
+ printf("Can not get volume\n");
+}
+else
+{
+ printf("System type volume is %d\n", value);
+}
+ * @endcode
+ * @see mm_sound_volume_set_value
+ */
+int mm_sound_volume_get_value(volume_type_t type, unsigned int *value);
+
+
+
+/**
+ * This function is to set primary volume type.
+ *
+ * @param type [in] volume type to set as primary volume type.
+ *
+ * @return This function returns MM_ERROR_NONE on success, or negative value
+ * with error code.
+ * @remark Application should use this function during foreground.
+ * Application should clear primary volume type by mm_sound_volume_primary_type_clear() when it goes background.
+ * @pre None.
+ * @post Volume app. will be update given volume type when H/W volume control key pressed.
+ * @see mm_sound_volume_primary_type_clear volume_type_t
+ * @par Example
+ * @code
+static int _resume(void *data)
+{
+ int ret = 0;
+
+ ret = mm_sound_volume_primary_type_set(VOLUME_TYPE_MEDIA);
+ if(ret < 0)
+ {
+ printf("Can not set primary volume type\n");
+ }
+ ...
+}
+
+static int _pause(void* data)
+{
+ int ret = 0;
+
+ ret = mm_sound_volume_primary_type_clear();
+ if(ret < 0)
+ {
+ printf("Can not clear primary volume type\n");
+ }
+ ...
+}
+
+int main()
+{
+ ...
+ struct appcore_ops ops = {
+ .create = _create,
+ .terminate = _terminate,
+ .pause = _pause,
+ .resume = _resume,
+ .reset = _reset,
+ };
+ ...
+ return appcore_efl_main(PACKAGE, ..., &ops);
+}
+ * @endcode
+ */
+int mm_sound_volume_primary_type_set(volume_type_t type);
+
+
+
+/**
+ * This function is to clear primary volume type.
+ *
+ *
+ * @return This function returns MM_ERROR_NONE on success, or negative value
+ * with error code.
+ * @remark mm_sound_volume_primary_type_set() and mm_sound_volume_primary_type_clear() should be used as pair
+ * @see mm_sound_volume_primary_type_set
+ * @pre primary volume should be set at same process.
+ * @post primary volume will be cleared.
+ * @par Example
+ * @code
+static int _resume(void *data)
+{
+ int ret = 0;
+
+ ret = mm_sound_volume_primary_type_set(VOLUME_TYPE_MEDIA);
+ if(ret < 0)
+ {
+ printf("Can not set primary volume type\n");
+ }
+ ...
+}
+
+static int _pause(void* data)
+{
+ int ret = 0;
+
+ ret = mm_sound_volume_primary_type_clear();
+ if(ret < 0)
+ {
+ printf("Can not clear primary volume type\n");
+ }
+ ...
+}
+
+int main()
+{
+ ...
+ struct appcore_ops ops = {
+ .create = _create,
+ .terminate = _terminate,
+ .pause = _pause,
+ .resume = _resume,
+ .reset = _reset,
+ };
+ ...
+ return appcore_efl_main(PACKAGE, ..., &ops);
+}
+ * @endcode
+ */
+int mm_sound_volume_primary_type_clear();
+
+
+
+/**
+ * This function is to get current playing volume type
+ *
+ * @param type [out] current playing volume type
+ *
+ * @return This function returns MM_ERROR_NONE on success,
+ * or MM_ERROR_SOUND_VOLUME_NO_INSTANCE when there is no existing playing instance,
+ * or MM_ERROR_SOUND_VOLUME_CAPTURE_ONLY when only capture audio instances are exist.
+ * or negative value with error code for other errors.
+ * @remark None.
+ * @pre None.
+ * @post None.
+ * @see mm_sound_volume_get_value, mm_sound_volume_set_value
+ * @par Example
+ * @code
+int ret=0;
+volume_type_t type = 0;
+
+ret = mm_sound_volume_get_current_playing_type(&type);
+switch(ret)
+{
+case MM_ERROR_NONE:
+ printf("Current playing is %d\n", type);
+ break;
+case MM_ERROR_SOUND_VOLUME_NO_INSTANCE:
+ printf("No sound instance\n");
+ break;
+case MM_ERROR_SOUND_VOLUME_CAPTURE_ONLY:
+ printf("Only sound capture instances are exist\n");
+ break;
+default:
+ printf("Error\n");
+ break;
+}
+
+ * @endcode
+ */
+int mm_sound_volume_get_current_playing_type(volume_type_t *type);
+
+
+/*
+ * MMSound PCM APIs
+ */
+typedef void* MMSoundPcmHandle_t; /**< MMsound PCM handle type */
+
+/**
+ * Enumerations of Format used in MMSoundPcm operation.
+ */
+typedef enum {
+ MMSOUND_PCM_U8 = 0x70, /**< unsigned 8bit audio */
+ MMSOUND_PCM_S16_LE, /**< signed 16bit audio */
+} MMSoundPcmFormat_t;
+
+/**
+ * Enumerations of Channel count used in MMSoundPcm operation.
+ */
+typedef enum {
+ MMSOUND_PCM_MONO = 0x80, /**< Mono channel */
+ MMSOUND_PCM_STEREO, /**< Stereo channel */
+}MMSoundPcmChannel_t;
+
+
+/**
+ * This function is to create handle for PCM playback.
+ *
+ * @param handle [out] handle to play pcm data
+ * @param rate [in] sample rate (8000Hz ~ 44100Hz)
+ * @param channel [in] number of channels (mono or stereo)
+ * @param format [in] S8 or S16LE
+ * @param volume [in] volume type
+ *
+ * @return This function returns suggested buffer size (in bytes) on success, or negative value
+ * with error code.
+ * @remark use mm_sound_volume_set_value() function to change volume
+ * @see mm_sound_pcm_play_write, mm_sound_pcm_play_close, mm_sound_volume_set_value, MMSoundPcmFormat_t, MMSoundPcmChannel_t volume_type_t
+ * @pre None.
+ * @post PCM play handle will be created.
+ * @par Example
+ * @code
+#include <mm_sound.h>
+#include <stdio.h>
+#include <alloca.h>
+
+int main(int argc, char* argv[])
+{
+ FILE *fp = NULL;
+ char *buffer = NULL;
+ int ret = 0;
+ int size = 0;
+ int readed = 0;
+ MMSoundPcmHandle_t handle;
+ char *filename = NULL;
+
+ if(argc !=2 )
+ {
+ printf("Usage) %s filename\n", argv[0]);
+ return -1;
+ }
+ filename = argv[1];
+
+ fp = fopen(filename,"r");
+ if(fp ==NULL)
+ {
+ printf("Can not open file %s\n", filename);
+ return -1;
+ }
+
+ size = mm_sound_pcm_play_open(&handle, 44100, MMSOUND_PCM_STEREO, MMSOUND_PCM_S16_LE, VOLUME_TYPE_SYSTEM);
+ if(size < 0)
+ {
+ printf("Can not open playback handle\n");
+ return -2;
+ }
+
+ buffer = alloca(size);
+ while((readed = fread(buffer, size, sizeof(char), fp)) > 0 )
+ {
+ ret = mm_sound_pcm_play_write(handle, (void*)buffer, readed);
+ if(ret < 0)
+ {
+ printf("write fail\n");
+ break;
+ }
+ memset(buffer, '\0', sizeof(buffer));
+ }
+
+ fclose(fp);
+ mm_sound_pcm_play_close(handle);
+ return 0;
+}
+ * @endcode
+ */
+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
+ * @param ptr [in] pcm buffer address
+ * @param length_byte [in] size of pcm buffer (in bytes)
+ *
+ * @return This function returns written data size on success, or negative value
+ * with error code.
+ * @remark Make pcm buffer size with returned value of mm_sound_pcm_play_open()
+ * @see mm_sound_pcm_play_open, mm_sound_pcm_play_close
+ * @pre PCM play handle should be created.
+ * @post Sound will be generated with given PCM buffer data.
+ * @par Example
+ * @code
+#include <mm_sound.h>
+#include <stdio.h>
+#include <alloca.h>
+
+int main(int argc, char* argv[])
+{
+ FILE *fp = NULL;
+ char *buffer = NULL;
+ int ret = 0;
+ int size = 0;
+ int readed = 0;
+ MMSoundPcmHandle_t handle;
+ char *filename = NULL;
+
+ if(argc !=2 )
+ {
+ printf("Usage) %s filename\n", argv[0]);
+ return -1;
+ }
+ filename = argv[1];
+
+ fp = fopen(filename,"r");
+ if(fp ==NULL)
+ {
+ printf("Can not open file %s\n", filename);
+ return -1;
+ }
+
+ size = mm_sound_pcm_play_open(&handle, 44100, MMSOUND_PCM_STEREO, MMSOUND_PCM_S16_LE, VOLUME_TYPE_SYSTEM);
+ if(size < 0)
+ {
+ printf("Can not open playback handle\n");
+ return -2;
+ }
+
+ buffer = alloca(size);
+ while((readed = fread(buffer, size, sizeof(char), fp)) > 0 )
+ {
+ ret = mm_sound_pcm_play_write(handle, (void*)buffer, readed);
+ if(ret < 0)
+ {
+ printf("write fail\n");
+ break;
+ }
+ memset(buffer, '\0', sizeof(buffer));
+ }
+
+ fclose(fp);
+ mm_sound_pcm_play_close(handle);
+ return 0;
+}
+ * @endcode
+ */
+int mm_sound_pcm_play_write(MMSoundPcmHandle_t handle, void* ptr, unsigned int length_byte);
+
+
+
+/**
+ * This function is to close PCM memory playback handle
+ *
+ * @param handle [in] handle to play pcm data
+ *
+ * @return This function returns MM_ERROR_NONE on success, or negative value
+ * with error code.
+ * @remark None
+ * @see mm_sound_pcm_play_open, mm_sound_pcm_play_write
+ * @pre PCM play handle should be created
+ * @post PCM play handle will be terminated.
+ * @par Example
+ * @code
+#include <mm_sound.h>
+#include <stdio.h>
+#include <alloca.h>
+
+int main(int argc, char* argv[])
+{
+ FILE *fp = NULL;
+ char *buffer = NULL;
+ int ret = 0;
+ int size = 0;
+ int readed = 0;
+ MMSoundPcmHandle_t handle;
+ char *filename = NULL;
+
+ if(argc !=2 )
+ {
+ printf("Usage) %s filename\n", argv[0]);
+ return -1;
+ }
+ filename = argv[1];
+
+ fp = fopen(filename,"r");
+ if(fp ==NULL)
+ {
+ printf("Can not open file %s\n", filename);
+ return -1;
+ }
+
+ size = mm_sound_pcm_play_open(&handle, 44100, MMSOUND_PCM_STEREO, MMSOUND_PCM_S16_LE, VOLUME_TYPE_SYSTEM);
+ if(size < 0)
+ {
+ printf("Can not open playback handle\n");
+ return -2;
+ }
+
+ buffer = alloca(size);
+ while((readed = fread(buffer, size, sizeof(char), fp)) > 0 )
+ {
+ ret = mm_sound_pcm_play_write(handle, (void*)buffer, readed);
+ if(ret < 0)
+ {
+ printf("write fail\n");
+ break;
+ }
+ memset(buffer, '\0', sizeof(buffer));
+ }
+
+ fclose(fp);
+ mm_sound_pcm_play_close(handle);
+ return 0;
+}
+ * @endcode
+ */
+int mm_sound_pcm_play_close(MMSoundPcmHandle_t handle);
+
+
+
+/**
+ * This function is to create handle for PCM capture.
+ *
+ * @param handle [out] handle to capture pcm data
+ * @param rate [in] sample rate (8000Hz ~ 44100Hz)
+ * @param channel [in] number of channels (mono or stereo)
+ * @param format [in] S8 or S16LE
+ *
+ * @return This function returns suggested buffer size (in bytes) on success, or negative value
+ * with error code.
+ * @remark only mono channel is valid for now.
+ * @see mm_sound_pcm_capture_read, mm_sound_pcm_capture_close, MMSoundPcmFormat_t, MMSoundPcmChannel_t
+ * @pre None.
+ * @post PCM capture handle will be allocated.
+ * @par Example
+ * @code
+#include <mm_sound.h>
+#include <stdio.h>
+#include <alloca.h>
+
+int main(int argc, char* argv[])
+{
+ FILE *fp = NULL;
+ char *buffer = NULL;
+ int ret = 0;
+ int size = 0;
+ int count = 0;
+ MMSoundPcmHandle_t handle;
+ char *filename = NULL;
+
+ if(argc !=2 )
+ {
+ printf("Usage) %s filename\n", argv[0]);
+ return -1;
+ }
+ filename = argv[1];
+
+ fp = fopen(filename,"w");
+ if(fp ==NULL)
+ {
+ printf("Can not open file %s\n", filename);
+ return -1;
+ }
+
+ size = mm_sound_pcm_capture_open(&handle, 44100, MMSOUND_PCM_MONO, MMSOUND_PCM_S16_LE);
+ if(size < 0)
+ {
+ printf("Can not open capture handle\n");
+ return -2;
+ }
+
+ buffer = alloca(size);
+ while(1)
+ {
+ ret = mm_sound_pcm_capture_read(handle, (void*)buffer, size);
+ if(ret < 0)
+ {
+ printf("read fail\n");
+ break;
+ }
+ fwrite(buffer, ret, sizeof(char), fp);
+ if(count++ > 20) {
+ break;
+ }
+ }
+
+ fclose(fp);
+ mm_sound_pcm_capture_close(handle);
+ return 0;
+}
+
+ * @endcode
+ */
+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
+ * @param buffer [in] pcm buffer address
+ * @param length [in] size of pcm buffer (in bytes)
+ *
+ * @return This function returns read data size on success, or negative value
+ * with error code.
+ * @remark Make pcm buffer size with returned value of mm_sound_pcm_capture_open()
+ * @see mm_sound_pcm_capture_open, mm_sound_pcm_capture_close
+ * @pre PCM capture handle should be allcated.
+ * @post PCM data will be filled to given memory pointer.
+ * @par Example
+ * @code
+#include <mm_sound.h>
+#include <stdio.h>
+#include <alloca.h>
+
+int main(int argc, char* argv[])
+{
+ FILE *fp = NULL;
+ char *buffer = NULL;
+ int ret = 0;
+ int size = 0;
+ int count = 0;
+ MMSoundPcmHandle_t handle;
+ char *filename = NULL;
+
+ if(argc !=2 )
+ {
+ printf("Usage) %s filename\n", argv[0]);
+ return -1;
+ }
+ filename = argv[1];
+
+ fp = fopen(filename,"w");
+ if(fp ==NULL)
+ {
+ printf("Can not open file %s\n", filename);
+ return -1;
+ }
+
+ size = mm_sound_pcm_capture_open(&handle, 44100, MMSOUND_PCM_MONO, MMSOUND_PCM_S16_LE);
+ if(size < 0)
+ {
+ printf("Can not open capture handle\n");
+ return -2;
+ }
+
+ buffer = alloca(size);
+ while(1)
+ {
+ ret = mm_sound_pcm_capture_read(handle, (void*)buffer, size);
+ if(ret < 0)
+ {
+ printf("read fail\n");
+ break;
+ }
+ fwrite(buffer, ret, sizeof(char), fp);
+ if(count++ > 20) {
+ break;
+ }
+ }
+
+ fclose(fp);
+ mm_sound_pcm_capture_close(handle);
+ return 0;
+}
+
+ * @endcode
+ */
+int mm_sound_pcm_capture_read(MMSoundPcmHandle_t handle, void *buffer, const unsigned int length );
+
+/**
+ * This function captures PCM memory to memory buffer (Samsung extension)
+ *
+ * @param handle [in] handle to capture pcm data
+ *
+ * @return This function returns MM_ERROR_NONE on success, or negative value
+ * with error code.
+ * @remark None.
+ * @see mm_sound_pcm_capture_open, mm_sound_pcm_capture_read
+ * @pre PCM capture handle should be opend.
+ * @post PCM capture handle will be freed.
+ * @par Example
+ * @code
+#include <mm_sound.h>
+#include <stdio.h>
+#include <alloca.h>
+
+int main(int argc, char* argv[])
+{
+ FILE *fp = NULL;
+ char *buffer = NULL;
+ int ret = 0;
+ int size = 0;
+ int count = 0;
+ MMSoundPcmHandle_t handle;
+ char *filename = NULL;
+
+ if(argc !=2 )
+ {
+ printf("Usage) %s filename\n", argv[0]);
+ return -1;
+ }
+ filename = argv[1];
+
+ fp = fopen(filename,"w");
+ if(fp ==NULL)
+ {
+ printf("Can not open file %s\n", filename);
+ return -1;
+ }
+
+ size = mm_sound_pcm_capture_open(&handle, 44100, MMSOUND_PCM_MONO, MMSOUND_PCM_S16_LE);
+ if(size < 0)
+ {
+ printf("Can not open capture handle\n");
+ return -2;
+ }
+
+ buffer = alloca(size);
+ while(1)
+ {
+ ret = mm_sound_pcm_capture_read(handle, (void*)buffer, size);
+ if(ret < 0)
+ {
+ printf("read fail\n");
+ break;
+ }
+ fwrite(buffer, ret, sizeof(char), fp);
+ if(count++ > 20) {
+ break;
+ }
+ }
+
+ fclose(fp);
+ mm_sound_pcm_capture_close(handle);
+ return 0;
+}
+
+ * @endcode
+ */
+int mm_sound_pcm_capture_close(MMSoundPcmHandle_t handle);
+
+/**
+ * This function sets callback function for receiving messages from pcm API.
+ *
+ * @param handle [in] Handle of pcm.
+ * @param callback [in] Message callback function.
+ * @param user_param [in] User parameter which is passed to callback function.
+ *
+ * @return This function returns MM_ERROR_NONE on success, or negative value with error code.
+ * @see MMMessageCallback
+ * @remark None
+ * @par Example
+ * @code
+int msg_callback(int message, MMMessageParamType *param, void *user_param)
+{
+ switch (message)
+ {
+ case MM_MESSAGE_SOUND_PCM_CAPTURE_RESTRICTED:
+ //do something
+ break;
+
+ case MM_MESSAGE_SOUND_PCM_INTERRUPTED:
+ //do something
+ break;
+
+ default:
+ break;
+ }
+ return TRUE;
+}
+
+mm_sound_pcm_set_message_callback(pcmHandle, msg_callback, (void *)pcmHandle);
+ * @endcode
+ */
+int mm_sound_pcm_set_message_callback (MMSoundPcmHandle_t handle, MMMessageCallback callback, void *user_param);
+
+/**
+ * Terminate callback function type.
+ *
+ * @param param [in] Argument passed when callback was set
+ *
+ * @return No return value
+ * @remark It is not allowed to call MMSound API recursively or do time-consuming
+ * task in this callback because this callback is called synchronously.
+ * @see mm_sound_play_sound
+ */
+typedef void (*mm_sound_stop_callback_func) (void *data);
+
+/*
+ * MMSound Play APIs
+ */
+
+/**
+ * This function is to play system sound.
+ *
+ * @param filename [in] Sound filename to play
+ * @param volume config [in] Volume type & volume gain
+ * @param callback [in] Callback function pointer when playing is terminated.
+ * @param data [in] Pointer to user data when callback is called.
+ * @param handle [out] Handle of sound play.
+ *
+ * @return This function returns MM_ERROR_NONE on success, or negative value
+ * with error code.
+ * @remark When the stop callback is set, it will be called when system sound is
+ * terminated. If mm_sound_stop_sound() is called apparently before
+ * system sound is terminated, stop_callback will not be called.
+ * @see mm_sound_stop_sound mm_sound_stop_callback_func volume_type_t volume_gain_t
+ * @pre None.
+ * @post Sound will be generated with given filename.
+ * @par Example
+ * @code
+int g_stop=0;
+void _stop_callback(void* data)
+{
+ printf("Stop callback\n");
+ g_stop = 1;
+}
+
+int play_file()
+{
+ char filename[] ="/opt/media/Sound/testfile.wav";
+ volume_type_t volume = VOLUME_TYPE_SYSTEM;
+ int ret = 0;
+ int handle = -1;
+
+ ret = mm_sound_play_sound(filename, volume, _stop_callback, NULL, &handle);
+ if(ret < 0)
+ {
+ printf("play file failed\n");
+ }
+ else
+ {
+ printf("play file success\n");
+ }
+ while(g_stop == 0)
+ {
+ sleep(1);
+ }
+ printf("play stopped\n");
+ return 0;
+}
+ * @endcode
+ */
+int mm_sound_play_sound(const char *filename, int volume_config, mm_sound_stop_callback_func callback, void *data, int *handle);
+
+/**
+ * This function is to play system sound. And other audio stream will be mute during playing time
+ *
+ * @param filename [in] Sound filename to play
+ * @param volume config [in] Volume type & volume gain
+ * @param callback [in] Callback function pointer when playing is terminated.
+ * @param data [in] Pointer to user data when callback is called.
+ * @param handle [out] Handle of sound play.
+ *
+ * @return This function returns MM_ERROR_NONE on success, or negative value
+ * with error code.
+ * @remark This function is almost same with mm_sound_play_sound,
+ * but this make other audio playback stream to mute during playing time.
+ * @see mm_sound_stop_sound mm_sound_stop_callback_func volume_type_t volume_gain_t
+ * @pre None.
+ * @post Sound will be generated with given filename.
+ * @par Example
+ * @code
+int g_stop=0;
+void _stop_callback(void* data)
+{
+ printf("Stop callback\n");
+ g_stop = 1;
+}
+
+int play_file()
+{
+ char filename[] ="/opt/media/Sound/testfile.wav";
+ volume_type_t volume = VOLUME_TYPE_SYSTEM;
+ int ret = 0;
+ int handle = -1;
+
+ ret = mm_sound_play_loud_solo_sound(filename, volume, _stop_callback, NULL, &handle);
+ if(ret < 0)
+ {
+ printf("play file failed\n");
+ }
+ else
+ {
+ printf("play file success\n");
+ }
+ while(g_stop == 0)
+ {
+ sleep(1);
+ }
+ printf("play stopped\n");
+ return 0;
+}
+ * @endcode
+ */
+int mm_sound_play_loud_solo_sound(const char *filename, int volume_config, mm_sound_stop_callback_func callback, void *data, int *handle);
+
+int mm_sound_play_loud_solo_sound_no_restore(const char *filename, int volume_config, mm_sound_stop_callback_func callback, void *data, int *handle);
+
+/**
+ * This function is to stop playing system sound.
+ *
+ * @param handle [in] Handle of mm_sound_play_sound
+ *
+ * @return This function returns MM_ERROR_NONE on success, or negative value
+ * with error code.
+ *
+ * @remark When system sound is terminated with this function call, it does not
+ * call stop callback which was set when start playing system sound.
+ * @see mm_sound_play_sound
+ * @pre An sound play handle should be valid.
+ * @post Playing sound file will be stopped.
+ * @par Example
+ * @code
+int g_stop=0;
+void _stop_callback(void* data)
+{
+ printf("Stop callback\n");
+ g_stop = 1;
+}
+
+int play_file_one_second()
+{
+ char filename[] ="/opt/media/Sound/testfile.wav";
+ volume_type_t volume = VOLUME_TYPE_SYSTEM;
+ int ret = 0;
+ int handle = -1;
+
+ ret = mm_sound_play_sound(filename, volume, _stop_callback, NULL, &handle);
+ if(ret < 0)
+ {
+ printf("play file failed\n");
+ }
+ else
+ {
+ printf("play file success\n");
+ }
+
+ sleep(1); //wait 1 second
+
+ ret = mm_sound_stop_sound(handle);
+ if(ret < 0)
+ {
+ printf("stop failed\n");
+ }
+ else
+ {
+ printf("play stopped\n");
+ }
+ return 0;
+}
+ * @endcode
+ */
+int mm_sound_stop_sound(int handle);
+
+
+/**
+ * Enumerations for TONE
+ */
+
+typedef enum {
+ MM_SOUND_TONE_DTMF_0 = 0, /**< Predefined DTMF 0 */
+ MM_SOUND_TONE_DTMF_1, /**< Predefined DTMF 1 */
+ MM_SOUND_TONE_DTMF_2, /**< Predefined DTMF 2 */
+ MM_SOUND_TONE_DTMF_3, /**< Predefined DTMF 3 */
+ MM_SOUND_TONE_DTMF_4, /**< Predefined DTMF 4 */
+ MM_SOUND_TONE_DTMF_5, /**< Predefined DTMF 5 */
+ MM_SOUND_TONE_DTMF_6, /**< Predefined DTMF 6 */
+ MM_SOUND_TONE_DTMF_7, /**< Predefined DTMF 7 */
+ MM_SOUND_TONE_DTMF_8, /**< Predefined DTMF 8 */
+ MM_SOUND_TONE_DTMF_9, /**< Predefined DTMF 9 */
+ MM_SOUND_TONE_DTMF_S, /**< Predefined DTMF Star - Asterisk (*) */
+ MM_SOUND_TONE_DTMF_P, /**< Predefined DTMF sharP (#) */
+ MM_SOUND_TONE_DTMF_A, /**< Predefined DTMF A (A) */
+ MM_SOUND_TONE_DTMF_B, /**< Predefined DTMF B (B) */
+ MM_SOUND_TONE_DTMF_C, /**< Predefined DTMF C (C) */
+ MM_SOUND_TONE_DTMF_D, /**< Predefined DTMF D (D) */
+
+ /**< Pre-defined TONE */
+ MM_SOUND_TONE_SUP_DIAL, /**Call supervisory tone, Dial tone: CEPT: 425Hz, continuous */
+ MM_SOUND_TONE_ANSI_DIAL, /**Call supervisory tone, Dial tone: ANSI (IS-95): 350Hz+440Hz, continuous */
+ MM_SOUND_TONE_JAPAN_DIAL, /**Call supervisory tone, Dial tone: JAPAN: 400Hz, continuous*/
+ MM_SOUND_TONE_SUP_BUSY, /**Call supervisory tone, Busy: CEPT: 425Hz, 500ms ON, 500ms OFF... */
+ MM_SOUND_TONE_ANSI_BUSY, /**Call supervisory tone, Busy: ANSI (IS-95): 480Hz+620Hz, 500ms ON, 500ms OFF... */
+ MM_SOUND_TONE_JAPAN_BUSY, /**Call supervisory tone, Busy: JAPAN: 400Hz, 500ms ON, 500ms OFF...*/
+ MM_SOUND_TONE_SUP_CONGESTION, /**Call supervisory tone, Congestion: CEPT, JAPAN: 425Hz, 200ms ON, 200ms OFF */
+ MM_SOUND_TONE_ANSI_CONGESTION, /**Call supervisory tone, Congestion: ANSI (IS-95): 480Hz+620Hz, 250ms ON, 250ms OFF... */
+ MM_SOUND_TONE_SUP_RADIO_ACK, /**Call supervisory tone, Radio path acknowlegment : CEPT, ANSI: 425Hz, 200ms ON */
+ MM_SOUND_TONE_JAPAN_RADIO_ACK, /**Call supervisory tone, Radio path acknowlegment : JAPAN: 400Hz, 1s ON, 2s OFF...*/
+ MM_SOUND_TONE_SUP_RADIO_NOTAVAIL, /**Call supervisory tone, Radio path not available: 425Hz, 200ms ON, 200 OFF 3 bursts */
+ MM_SOUND_TONE_SUP_ERROR, /**Call supervisory tone, Error/Special info: 950Hz+1400Hz+1800Hz, 330ms ON, 1s OFF... */
+ MM_SOUND_TONE_SUP_CALL_WAITING, /**Call supervisory tone, Call Waiting: CEPT, JAPAN: 425Hz, 200ms ON, 600ms OFF, 200ms ON, 3s OFF... */
+ MM_SOUND_TONE_ANSI_CALL_WAITING, /**Call supervisory tone, Call Waiting: ANSI (IS-95): 440 Hz, 300 ms ON, 9.7 s OFF, (100 ms ON, 100 ms OFF, 100 ms ON, 9.7s OFF ...) */
+ MM_SOUND_TONE_SUP_RINGTONE, /**Call supervisory tone, Ring Tone: CEPT, JAPAN: 425Hz, 1s ON, 4s OFF... */
+ MM_SOUND_TONE_ANSI_RINGTONE, /**Call supervisory tone, Ring Tone: ANSI (IS-95): 440Hz + 480Hz, 2s ON, 4s OFF... */
+ MM_SOUND_TONE_PROP_BEEP, /**General beep: 400Hz+1200Hz, 35ms ON */
+ MM_SOUND_TONE_PROP_ACK, /**Proprietary tone, positive acknowlegement: 1200Hz, 100ms ON, 100ms OFF 2 bursts */
+ MM_SOUND_TONE_PROP_NACK, /**Proprietary tone, negative acknowlegement: 300Hz+400Hz+500Hz, 400ms ON */
+ MM_SOUND_TONE_PROP_PROMPT, /**Proprietary tone, prompt tone: 400Hz+1200Hz, 200ms ON */
+ MM_SOUND_TONE_PROP_BEEP2, /**Proprietary tone, general double beep: twice 400Hz+1200Hz, 35ms ON, 200ms OFF, 35ms ON */
+ MM_SOUND_TONE_SUP_INTERCEPT, /**Call supervisory tone (IS-95), intercept tone: alternating 440 Hz and 620 Hz tones, each on for 250 ms */
+ MM_SOUND_TONE_SUP_INTERCEPT_ABBREV, /**Call supervisory tone (IS-95), abbreviated intercept: intercept tone limited to 4 seconds */
+ MM_SOUND_TONE_SUP_CONGESTION_ABBREV, /**Call supervisory tone (IS-95), abbreviated congestion: congestion tone limited to 4 seconds */
+ MM_SOUND_TONE_SUP_CONFIRM, /**Call supervisory tone (IS-95), confirm tone: a 350 Hz tone added to a 440 Hz tone repeated 3 times in a 100 ms on, 100 ms off cycle */
+ MM_SOUND_TONE_SUP_PIP, /**Call supervisory tone (IS-95), pip tone: four bursts of 480 Hz tone (0.1 s on, 0.1 s off). */
+ MM_SOUND_TONE_CDMA_DIAL_TONE_LITE, /**425Hz continuous */
+ MM_SOUND_TONE_CDMA_NETWORK_USA_RINGBACK, /**CDMA USA Ringback: 440Hz+480Hz 2s ON, 4000 OFF ...*/
+ MM_SOUND_TONE_CDMA_INTERCEPT, /**CDMA Intercept tone: 440Hz 250ms ON, 620Hz 250ms ON ...*/
+ MM_SOUND_TONE_CDMA_ABBR_INTERCEPT, /**CDMA Abbr Intercept tone: 440Hz 250ms ON, 620Hz 250ms ON */
+ MM_SOUND_TONE_CDMA_REORDER, /**CDMA Reorder tone: 480Hz+620Hz 250ms ON, 250ms OFF... */
+ MM_SOUND_TONE_CDMA_ABBR_REORDER, /**CDMA Abbr Reorder tone: 480Hz+620Hz 250ms ON, 250ms OFF repeated for 8 times */
+ MM_SOUND_TONE_CDMA_NETWORK_BUSY, /**CDMA Network Busy tone: 480Hz+620Hz 500ms ON, 500ms OFF continuous */
+ MM_SOUND_TONE_CDMA_CONFIRM, /**CDMA Confirm tone: 350Hz+440Hz 100ms ON, 100ms OFF repeated for 3 times */
+ MM_SOUND_TONE_CDMA_ANSWER, /**CDMA answer tone: silent tone - defintion Frequency 0, 0ms ON, 0ms OFF */
+ MM_SOUND_TONE_CDMA_NETWORK_CALLWAITING, /**CDMA Network Callwaiting tone: 440Hz 300ms ON */
+ MM_SOUND_TONE_CDMA_PIP, /**CDMA PIP tone: 480Hz 100ms ON, 100ms OFF repeated for 4 times */
+ MM_SOUND_TONE_CDMA_CALL_SIGNAL_ISDN_NORMAL, /**ISDN Call Signal Normal tone: {2091Hz 32ms ON, 2556 64ms ON} 20 times, 2091 32ms ON, 2556 48ms ON, 4s OFF */
+ MM_SOUND_TONE_CDMA_CALL_SIGNAL_ISDN_INTERGROUP, /**ISDN Call Signal Intergroup tone: {2091Hz 32ms ON, 2556 64ms ON} 8 times, 2091Hz 32ms ON, 400ms OFF, {2091Hz 32ms ON, 2556Hz 64ms ON} 8times, 2091Hz 32ms ON, 4s OFF.*/
+ MM_SOUND_TONE_CDMA_CALL_SIGNAL_ISDN_SP_PRI, /**ISDN Call Signal SP PRI tone:{2091Hz 32ms ON, 2556 64ms ON} 4 times 2091Hz 16ms ON, 200ms OFF, {2091Hz 32ms ON, 2556Hz 64ms ON} 4 times, 2091Hz 16ms ON, 200ms OFF */
+ MM_SOUND_TONE_CDMA_CALL_SIGNAL_ISDN_PAT3, /**SDN Call sign PAT3 tone: silent tone */
+ MM_SOUND_TONE_CDMA_CALL_SIGNAL_ISDN_PING_RING, /**ISDN Ping Ring tone: {2091Hz 32ms ON, 2556Hz 64ms ON} 5 times 2091Hz 20ms ON */
+ MM_SOUND_TONE_CDMA_CALL_SIGNAL_ISDN_PAT5, /**ISDN Pat5 tone: silent tone */
+ MM_SOUND_TONE_CDMA_CALL_SIGNAL_ISDN_PAT6, /**ISDN Pat6 tone: silent tone */
+ MM_SOUND_TONE_CDMA_CALL_SIGNAL_ISDN_PAT7, /**ISDN Pat7 tone: silent tone */
+ MM_SOUND_TONE_CDMA_HIGH_L, /**TONE_CDMA_HIGH_L tone: {3700Hz 25ms, 4000Hz 25ms} 40 times 4000ms OFF, Repeat .... */
+ MM_SOUND_TONE_CDMA_MED_L, /**TONE_CDMA_MED_L tone: {2600Hz 25ms, 2900Hz 25ms} 40 times 4000ms OFF, Repeat .... */
+ MM_SOUND_TONE_CDMA_LOW_L, /**TONE_CDMA_LOW_L tone: {1300Hz 25ms, 1450Hz 25ms} 40 times, 4000ms OFF, Repeat .... */
+ MM_SOUND_TONE_CDMA_HIGH_SS, /**CDMA HIGH SS tone: {3700Hz 25ms, 4000Hz 25ms} repeat 16 times, 400ms OFF, repeat .... */
+ MM_SOUND_TONE_CDMA_MED_SS, /**CDMA MED SS tone: {2600Hz 25ms, 2900Hz 25ms} repeat 16 times, 400ms OFF, repeat .... */
+ MM_SOUND_TONE_CDMA_LOW_SS, /**CDMA LOW SS tone: {1300z 25ms, 1450Hz 25ms} repeat 16 times, 400ms OFF, repeat .... */
+ MM_SOUND_TONE_CDMA_HIGH_SSL, /**CDMA HIGH SSL tone: {3700Hz 25ms, 4000Hz 25ms} 8 times, 200ms OFF, {3700Hz 25ms, 4000Hz 25ms} repeat 8 times, 200ms OFF, {3700Hz 25ms, 4000Hz 25ms} repeat 16 times, 4000ms OFF, repeat ... */
+ MM_SOUND_TONE_CDMA_MED_SSL, /**CDMA MED SSL tone: {2600Hz 25ms, 2900Hz 25ms} 8 times, 200ms OFF, {2600Hz 25ms, 2900Hz 25ms} repeat 8 times, 200ms OFF, {2600Hz 25ms, 2900Hz 25ms} repeat 16 times, 4000ms OFF, repeat ... */
+ MM_SOUND_TONE_CDMA_LOW_SSL, /**CDMA LOW SSL tone: {1300Hz 25ms, 1450Hz 25ms} 8 times, 200ms OFF, {1300Hz 25ms, 1450Hz 25ms} repeat 8 times, 200ms OFF, {1300Hz 25ms, 1450Hz 25ms} repeat 16 times, 4000ms OFF, repeat ... */
+ MM_SOUND_TONE_CDMA_HIGH_SS_2, /**CDMA HIGH SS2 tone: {3700Hz 25ms, 4000Hz 25ms} 20 times, 1000ms OFF, {3700Hz 25ms, 4000Hz 25ms} 20 times, 3000ms OFF, repeat .... */
+ MM_SOUND_TONE_CDMA_MED_SS_2, /**CDMA MED SS2 tone: {2600Hz 25ms, 2900Hz 25ms} 20 times, 1000ms OFF, {2600Hz 25ms, 2900Hz 25ms} 20 times, 3000ms OFF, repeat .... */
+ MM_SOUND_TONE_CDMA_LOW_SS_2, /**CDMA LOW SS2 tone: {1300Hz 25ms, 1450Hz 25ms} 20 times, 1000ms OFF, {1300Hz 25ms, 1450Hz 25ms} 20 times, 3000ms OFF, repeat .... */
+ MM_SOUND_TONE_CDMA_HIGH_SLS, /**CDMA HIGH SLS tone: {3700Hz 25ms, 4000Hz 25ms} 10 times, 500ms OFF, {3700Hz 25ms, 4000Hz 25ms} 20 times, 500ms OFF, {3700Hz 25ms, 4000Hz 25ms} 10 times, 3000ms OFF, REPEAT */
+ MM_SOUND_TONE_CDMA_MED_SLS, /**CDMA MED SLS tone: {2600Hz 25ms, 2900Hz 25ms} 10 times, 500ms OFF, {2600Hz 25ms, 2900Hz 25ms} 20 times, 500ms OFF, {2600Hz 25ms, 2900Hz 25ms} 10 times, 3000ms OFF, REPEAT */
+ MM_SOUND_TONE_CDMA_LOW_SLS, /**CDMA LOW SLS tone: {1300Hz 25ms, 1450Hz 25ms} 10 times, 500ms OFF, {1300Hz 25ms, 1450Hz 25ms} 20 times, 500ms OFF, {1300Hz 25ms, 1450Hz 25ms} 10 times, 3000ms OFF, REPEAT */
+ MM_SOUND_TONE_CDMA_HIGH_S_X4, /**CDMA HIGH S X4 tone: {3700Hz 25ms, 4000Hz 25ms} 10 times, 500ms OFF, {3700Hz 25ms, 4000Hz 25ms} 10 times, 500ms OFF, {3700Hz 25ms, 4000Hz 25ms} 10 times, 500ms OFF, {3700Hz 25ms, 4000Hz 25ms} 10 times, 2500ms OFF, REPEAT.... */
+ MM_SOUND_TONE_CDMA_MED_S_X4, /**CDMA MED S X4 tone: {2600Hz 25ms, 2900Hz 25ms} 10 times, 500ms OFF, {2600Hz 25ms, 2900Hz 25ms} 10 times, 500ms OFF, {2600Hz 25ms, 2900Hz 25ms} 10 times, 500ms OFF, {2600Hz 25ms, 2900Hz 25ms} 10 times, 2500ms OFF, REPEAT.... */
+ MM_SOUND_TONE_CDMA_LOW_S_X4, /**CDMA LOW S X4 tone: {2600Hz 25ms, 2900Hz 25ms} 10 times, 500ms OFF, {2600Hz 25ms, 2900Hz 25ms} 10 times, 500ms OFF, {2600Hz 25ms, 2900Hz 25ms} 10 times, 500ms OFF, {2600Hz 25ms, 2900Hz 25ms} 10 times, 2500ms OFF, REPEAT....*/
+ MM_SOUND_TONE_CDMA_HIGH_PBX_L, /**CDMA HIGH PBX L: {3700Hz 25ms, 4000Hz 25ms}20 times, 2000ms OFF, REPEAT.... */
+ MM_SOUND_TONE_CDMA_MED_PBX_L, /**CDMA MED PBX L: {2600Hz 25ms, 2900Hz 25ms}20 times, 2000ms OFF, REPEAT.... */
+ MM_SOUND_TONE_CDMA_LOW_PBX_L, /**CDMA LOW PBX L: {1300Hz 25ms,1450Hz 25ms}20 times, 2000ms OFF, REPEAT.... */
+ MM_SOUND_TONE_CDMA_HIGH_PBX_SS, /**CDMA HIGH PBX SS tone: {3700Hz 25ms, 4000Hz 25ms} 8 times 200 ms OFF, {3700Hz 25ms 4000Hz 25ms}8 times, 2000ms OFF, REPEAT.... */
+ MM_SOUND_TONE_CDMA_MED_PBX_SS, /**CDMA MED PBX SS tone: {2600Hz 25ms, 2900Hz 25ms} 8 times 200 ms OFF, {2600Hz 25ms 2900Hz 25ms}8 times, 2000ms OFF, REPEAT.... */
+ MM_SOUND_TONE_CDMA_LOW_PBX_SS, /**CDMA LOW PBX SS tone: {1300Hz 25ms, 1450Hz 25ms} 8 times 200 ms OFF, {1300Hz 25ms 1450Hz 25ms}8 times, 2000ms OFF, REPEAT.... */
+ MM_SOUND_TONE_CDMA_HIGH_PBX_SSL, /**CDMA HIGH PBX SSL tone:{3700Hz 25ms, 4000Hz 25ms} 8 times 200ms OFF, {3700Hz 25ms, 4000Hz 25ms} 8 times, 200ms OFF, {3700Hz 25ms, 4000Hz 25ms} 16 times, 1000ms OFF, REPEAT.... */
+ MM_SOUND_TONE_CDMA_MED_PBX_SSL, /**CDMA MED PBX SSL tone:{2600Hz 25ms, 2900Hz 25ms} 8 times 200ms OFF, {2600Hz 25ms, 2900Hz 25ms} 8 times, 200ms OFF, {2600Hz 25ms, 2900Hz 25ms} 16 times, 1000ms OFF, REPEAT.... */
+ MM_SOUND_TONE_CDMA_LOW_PBX_SSL, /**CDMA LOW PBX SSL tone:{1300Hz 25ms, 1450Hz 25ms} 8 times 200ms OFF, {1300Hz 25ms, 1450Hz 25ms} 8 times, 200ms OFF, {1300Hz 25ms, 1450Hz 25ms} 16 times, 1000ms OFF, REPEAT.... */
+ MM_SOUND_TONE_CDMA_HIGH_PBX_SLS, /**CDMA HIGH PBX SLS tone:{3700Hz 25ms, 4000Hz 25ms} 8 times 200ms OFF, {3700Hz 25ms, 4000Hz 25ms} 16 times, 200ms OFF, {3700Hz 25ms, 4000Hz 25ms} 8 times, 1000ms OFF, REPEAT.... */
+ MM_SOUND_TONE_CDMA_MED_PBX_SLS, /**CDMA MED PBX SLS tone:{2600Hz 25ms, 2900Hz 25ms} 8 times 200ms OFF, {2600Hz 25ms, 2900Hz 25ms} 16 times, 200ms OFF, {2600Hz 25ms, 2900Hz 25ms} 8 times, 1000ms OFF, REPEAT.... */
+ MM_SOUND_TONE_CDMA_LOW_PBX_SLS, /**CDMA LOW PBX SLS tone:{1300Hz 25ms, 1450Hz 25ms} 8 times 200ms OFF, {1300Hz 25ms, 1450Hz 25ms} 16 times, 200ms OFF, {1300Hz 25ms, 1450Hz 25ms} 8 times, 1000ms OFF, REPEAT.... */
+ MM_SOUND_TONE_CDMA_HIGH_PBX_S_X4, /**CDMA HIGH PBX X S4 tone: {3700Hz 25ms 4000Hz 25ms} 8 times, 200ms OFF, {3700Hz 25ms 4000Hz 25ms} 8 times, 200ms OFF, {3700Hz 25ms 4000Hz 25ms} 8 times, 200ms OFF, {3700Hz 25ms 4000Hz 25ms} 8 times, 800ms OFF, REPEAT... */
+ MM_SOUND_TONE_CDMA_MED_PBX_S_X4, /**CDMA MED PBX X S4 tone: {2600Hz 25ms 2900Hz 25ms} 8 times, 200ms OFF, {2600Hz 25ms 2900Hz 25ms} 8 times, 200ms OFF, {2600Hz 25ms 2900Hz 25ms} 8 times, 200ms OFF, {2600Hz 25ms 2900Hz 25ms} 8 times, 800ms OFF, REPEAT... */
+ MM_SOUND_TONE_CDMA_LOW_PBX_S_X4, /**CDMA LOW PBX X S4 tone: {1300Hz 25ms 1450Hz 25ms} 8 times, 200ms OFF, {1300Hz 25ms 1450Hz 25ms} 8 times, 200ms OFF, {1300Hz 25ms 1450Hz 25ms} 8 times, 200ms OFF, {1300Hz 25ms 1450Hz 25ms} 8 times, 800ms OFF, REPEAT... */
+ MM_SOUND_TONE_CDMA_ALERT_NETWORK_LITE, /**CDMA Alert Network Lite tone: 1109Hz 62ms ON, 784Hz 62ms ON, 740Hz 62ms ON 622Hz 62ms ON, 1109Hz 62ms ON */
+ MM_SOUND_TONE_CDMA_ALERT_AUTOREDIAL_LITE, /**CDMA Alert Auto Redial tone: {1245Hz 62ms ON, 659Hz 62ms ON} 3 times, 1245 62ms ON */
+ MM_SOUND_TONE_CDMA_ONE_MIN_BEEP, /**CDMA One Min Beep tone: 1150Hz+770Hz 400ms ON */
+ MM_SOUND_TONE_CDMA_KEYPAD_VOLUME_KEY_LITE, /**CDMA KEYPAD Volume key lite tone: 941Hz+1477Hz 120ms ON */
+ MM_SOUND_TONE_CDMA_PRESSHOLDKEY_LITE, /**CDMA PRESSHOLDKEY LITE tone: 587Hz 375ms ON, 1175Hz 125ms ON */
+ MM_SOUND_TONE_CDMA_ALERT_INCALL_LITE, /**CDMA ALERT INCALL LITE tone: 587Hz 62ms, 784 62ms, 831Hz 62ms, 784Hz 62ms, 1109 62ms, 784Hz 62ms, 831Hz 62ms, 784Hz 62ms*/
+ MM_SOUND_TONE_CDMA_EMERGENCY_RINGBACK, /**CDMA EMERGENCY RINGBACK tone: {941Hz 125ms ON, 10ms OFF} 3times 4990ms OFF, REPEAT... */
+ MM_SOUND_TONE_CDMA_ALERT_CALL_GUARD, /**CDMA ALERT CALL GUARD tone: {1319Hz 125ms ON, 125ms OFF} 3 times */
+ MM_SOUND_TONE_CDMA_SOFT_ERROR_LITE, /**CDMA SOFT ERROR LITE tone: 1047Hz 125ms ON, 370Hz 125ms */
+ MM_SOUND_TONE_CDMA_CALLDROP_LITE, /**CDMA CALLDROP LITE tone: 1480Hz 125ms, 1397Hz 125ms, 784Hz 125ms */
+ MM_SOUND_TONE_CDMA_NETWORK_BUSY_ONE_SHOT, /**CDMA_NETWORK_BUSY_ONE_SHOT tone: 425Hz 500ms ON, 500ms OFF. */
+ MM_SOUND_TONE_CDMA_ABBR_ALERT, /**CDMA_ABBR_ALERT tone: 1150Hz+770Hz 400ms ON */
+ MM_SOUND_TONE_CDMA_SIGNAL_OFF, /**CDMA_SIGNAL_OFF - silent tone */
+ MM_SOUND_TONE_NUM,
+}MMSoundTone_t;
+
+typedef unsigned long sound_time_msec_t; /**< millisecond unit */
+
+/**
+ * This function is to play tone sound.
+ *
+ * @param num [in] predefined tone type (MMSoundTone_t)
+ * volume config [in] volume type & volume gain
+ * volume [in] volume ratio (0.0 ~1.0)
+ * duration [in] millisecond (-1 for infinite)
+ * handle [in] Handle of mm_sound_play_tone
+ *
+ * @return This function returns MM_ERROR_NONE on success, or negative value
+ * with error code.
+ *
+ * @remark It doesn't provide stop
+ * @see volume_type_t volume_gain_t MMSoundTone_t
+ * @pre None.
+ * @post TONE sound will be played.
+ * @par Example
+ * @code
+int ret = 0;
+
+ret = mm_sound_play_tone(MM_SOUND_TONE_DTMF_9, VOLUME_TYPE_SYSTEM, 1.0, 1000, &handle); //play 1 second with volume ratio 1.0
+if(ret < 0)
+{
+ printf("play tone failed\n");
+}
+else
+{
+ printf("play tone success\n");
+}
+ * @endcode
+ */
+int mm_sound_play_tone (MMSoundTone_t num, int volume_config, const double volume, const int duration, int *handle);
+
+/*
+ * Enumerations of System audio route policy
+ */
+typedef enum {
+ SYSTEM_AUDIO_ROUTE_POLICY_DEFAULT, /**< Play via a2dp headset if connected. or play via headset if connected. or play via speaker.
+ And capture via 4pole headset-mic if connected. or capture via mic */
+ SYSTEM_AUDIO_ROUTE_POLICY_IGNORE_A2DP, /**< Play via headset if connected. or play via speaker
+ And capture via 4pole headset-mic if connected. or capture via mic */
+ SYSTEM_AUDIO_ROUTE_POLICY_HANDSET_ONLY, /**< Play via speaker. and capture via mic */
+ SYSTEM_AUDIO_ROUTE_POLICY_MAX
+}system_audio_route_t;
+
+typedef enum {
+ SYSTEM_AUDIO_ROUTE_PLAYBACK_DEVICE_NONE, /**< Abnormal case */
+ SYSTEM_AUDIO_ROUTE_PLAYBACK_DEVICE_HANDSET, /**< Speaker or Headset or Earpiece */
+ SYSTEM_AUDIO_ROUTE_PLAYBACK_DEVICE_BLUETOOTH, /**< Bluetooth */
+ SYSTEM_AUDIO_ROUTE_PLAYBACK_DEVICE_EARPHONE, /**< Earphone */
+ SYSTEM_AUDIO_ROUTE_PLAYBACK_DEVICE_MAX,
+}system_audio_route_device_t;
+
+typedef enum {
+ SYSTEM_AUDIO_CAPTURE_NONE, /**< Capture device is not in use */
+ SYSTEM_AUDIO_CAPTURE_ACTIVE, /**< Capture device is in use */
+ SYSTEM_AUDIO_CAPTURE_MAX,
+}system_audio_capture_status_t;
+
+
+/**
+ * This function set system route policy.
+ *
+ * @param route [in] audio route type
+ *
+ * @return This function returns MM_ERROR_NONE on success, or negative value
+ * with error code.
+ * @remark If bluetooth has disconnected during SYSTEM_AUDIO_ROUTE_POLICY_IGNORE_A2DP policy,
+ * The audio route policy will be changed to SYSTEM_AUDIO_ROUTE_POLICY_DEFAULT.
+ * @see mm_sound_route_get_system_policy system_audio_route_t mm_sound_route_is_a2dp_on
+ * @pre None.
+ * @post Audio routing policy will be changed with given type. And route change callback function will be called if registered.
+ * @par Example
+ * @code
+int g_stop = 0;
+void _stop_callback()
+{
+ g_stop = 1;
+}
+
+int play_file_via_speaker()
+{
+ int ret = 0;
+ system_audio_route_t route, original_route;
+
+ //get backup current policy
+ ret = mm_sound_route_get_system_policy(&original_route);
+ if(ret < 0)
+ {
+ printf("Can not get system audio route policy\n");
+ }
+ else
+ {
+ //set route policy to ignore a2dp
+ route = SYSTEM_AUDIO_ROUTE_POLICY_IGNORE_A2DP;
+ ret = mm_sound_route_set_system_policy(route);
+ if(ret < 0)
+ {
+ printf("Ca not set route policy\n");
+ }
+ else
+ {
+ int handle;
+ //play wav file
+ ret = mm_sound_play_sound("/opt/media/Sound/alert.wav", VOLUME_TYPE_SYSTEM, NULL, NULL, &handle);
+ if(ret < 0)
+ {
+ printf("Can not play wav file\n");
+ }
+ else
+ {
+ while(g_stop == 0)
+ {
+ sleep(1);
+ }
+ //restore original policy
+ mm_sound_route_set_system_policy(original_route);
+ }
+ }
+ }
+ return 0;
+}
+ * @endcode
+ */
+int mm_sound_route_set_system_policy (system_audio_route_t route);
+
+/**
+ * This function get sysytem route policy.
+ *
+ * @param route [out] audio route type
+ *
+ * @return This function returns MM_ERROR_NONE on success, or negative value
+ * with error code.
+ * @remark None.
+ * @see mm_sound_route_set_system_policy system_audio_route_t mm_sound_route_is_a2dp_on
+ * @pre None.
+ * @post None.
+ * @par Example
+ * @code
+int g_stop = 0;
+void _stop_callback()
+{
+ g_stop = 1;
+}
+
+int play_file_via_speaker()
+{
+ int ret = 0;
+ system_audio_route_t route, original_route;
+
+ //get backup current policy
+ ret = mm_sound_route_get_system_policy(&original_route);
+ if(ret < 0)
+ {
+ printf("Can not get system audio route policy\n");
+ }
+ else
+ {
+ //set route policy to ignore a2dp
+ route = SYSTEM_AUDIO_ROUTE_POLICY_IGNORE_A2DP;
+ ret = mm_sound_route_set_system_policy(route);
+ if(ret < 0)
+ {
+ printf("Can not set route policy\n");
+ }
+ else
+ {
+ int handle;
+ //play wav file
+ ret = mm_sound_play_sound("/opt/media/Sound/alert.wav", VOLUME_TYPE_SYSTEM, NULL, NULL, &handle);
+ if(ret < 0)
+ {
+ printf("Can not play wav file\n");
+ }
+ else
+ {
+ while(g_stop == 0)
+ {
+ sleep(1);
+ }
+ //restore original policy
+ mm_sound_route_set_system_policy(original_route);
+ }
+ }
+ }
+ return 0;
+}
+ * @endcode
+ */
+int mm_sound_route_get_system_policy (system_audio_route_t *route);
+
+
+
+/**
+ * This function get a2dp activation information.
+ *
+ * @param connected [out] is Bluetooth A2DP connected (1:connected, 0:not connected)
+ * bt_name [out] Bluetooth A2DP connected device name (allocated by internal when connected=1 otherwise set to null)
+ *
+ *
+ * @return This function returns MM_ERROR_NONE on success, or negative value
+ * with error code.
+ * @remark This function allocation memory to given bt_name pointer internally.
+ * So application should free given memory pointer later after use.
+ * bt_name will be null if there's no a2dp device is connected (connected is 0)
+ * @see mm_sound_route_set_system_policy mm_sound_route_get_system_policy
+ * @pre None.
+ * @post memory buffer will be allocated and fill with bluetooth device name.
+ * @par Example
+ * @code
+int ret;
+int connected = 0;
+char* bt_name = NULL;
+ret = mm_sound_route_get_a2dp_status (&connected, &bt_name);
+
+if (ret == MM_ERROR_NONE) {
+ g_print ("### Is Bluetooth A2DP On Success : connected=[%d] name=[%s]\n", connected, bt_name);
+ if (bt_name)
+ free (bt_name);
+} else {
+ g_print ("### Is Bluetooth A2DP On Error : errno [%d]\n", ret);
+
+ * @endcode
+ */
+int mm_sound_route_get_a2dp_status (bool* connected, char** bt_name);
+
+
+/**
+ * This function get current playing device.
+ *
+ * @param dev [out] current playing device information
+ *
+ * @return This function returns MM_ERROR_NONE on success, or negative value
+ * with error code.
+ * @remark if there is no running instance in system,
+ * output parameter dev can be SYSTEM_AUDIO_ROUTE_PLAYING_DEVICE_NONE.
+ *
+ * @see system_audio_route_device_t
+ * @pre None.
+ * @post None.
+ * @par Example
+ * @code
+int ret = 0;
+system_audio_route_device_t dev;
+
+ret = mm_sound_route_get_playing_device (&dev);
+if(ret == MM_ERROR_NONE)
+{
+ switch(dev)
+ {
+ case SYSTEM_AUDIO_ROUTE_PLAYBACK_DEVICE_HANDSET:
+ printf("Handset is playing\n");
+ break;
+ case SYSTEM_AUDIO_ROUTE_PLAYBACK_DEVICE_BLUETOOTH:
+ printf("Bluetooth is playing\n");
+ break;
+ case SYSTEM_AUDIO_ROUTE_PLAYBACK_DEVICE_NONE:
+ default:
+ printf("Unexptected\n");
+ break;
+ }
+}
+else
+{
+ printf ("Can not get current running device\n");
+}
+
+ * @endcode
+ */
+int mm_sound_route_get_playing_device(system_audio_route_device_t *dev);
+
+
+/**
+ * Audio route policy change callback function type.
+ *
+ * @param user_data [in] Argument passed when callback has called
+ * @param policy [in] changed policy type
+ *
+ * @return No return value
+ * @remark
+ * @see mm_sound_volume_add_callback mm_sound_volume_remove_callback
+ */
+typedef void (*audio_route_policy_changed_callback_fn)(void* user_data, system_audio_route_t policy);
+
+/**
+ * This function set system audio policy changed callback function.
+ *
+ * @param func [in] callback function pointer
+ * @param user_data [in] user data will be called with func
+ *
+ * @return This function returns MM_ERROR_NONE on success, or negative value
+ * with error code.
+ * @remark None.
+ * @see mm_sound_route_remove_change_callback mm_sound_route_set_system_policy mm_sound_route_get_system_policy system_audio_route_t
+ * @pre None.
+ * @post None.
+ * @par Example
+ * @code
+void audio_route_policy_changed_callback(void* data, system_audio_route_t policy)
+{
+ int value = (int) data;
+ system_audio_route_t lv_policy;
+ char *str_route[SYSTEM_AUDIO_ROUTE_POLICY_MAX] = {
+ "DEFAULT","IGN_A2DP","HANDSET"
+ };
+ printf("Audio Route Policy has changed to [%s]\n", str_route[policy]);
+ printf("user data : %d\n", value);
+ if(0 > mm_sound_route_get_system_policy(&lv_policy)) {
+ printf("Can not get policy...in callback function\n");
+ }
+ else {
+ printf("readed policy [%s]\n", str_route[lv_policy]);
+ }
+}
+int make_callback()
+{
+ int ret = 0;
+ ret = mm_sound_route_add_change_callback(audio_route_policy_changed_callback, (void*)111);
+ if(ret < 0)
+ {
+ printf("Can not add callback\n");
+ }
+ return 0;
+}
+ * @endcode
+ */
+int mm_sound_route_add_change_callback(audio_route_policy_changed_callback_fn func, void* user_data);
+
+/**
+ * This function remove system audio policy changed callback function.
+ *
+ * @return This function returns MM_ERROR_NONE on success, or negative value
+ * with error code.
+ * @remark None.
+ * @see mm_sound_route_add_change_callback mm_sound_route_set_system_policy mm_sound_route_get_system_policy system_audio_route_t
+ * @pre Sound route change callback should be registered.
+ * @post Sound route change callback deregistered and does not be called anymore.
+ * @par Example
+ * @code
+void audio_route_policy_changed_callback(void* data, system_audio_route_t policy)
+{
+ int value = (int) data;
+ system_audio_route_t lv_policy;
+ char *str_route[SYSTEM_AUDIO_ROUTE_POLICY_MAX] = {
+ "DEFAULT","IGN_A2DP","HANDSET"
+ };
+ printf("Audio Route Policy has changed to [%s]\n", str_route[policy]);
+ printf("user data : %d\n", value);
+ if(0 > mm_sound_route_get_system_policy(&lv_policy)) {
+ printf("Can not get policy...in callback function\n");
+ }
+ else {
+ printf("readed policy [%s]\n", str_route[lv_policy]);
+ }
+}
+int make_callback()
+{
+ int ret = 0;
+ ret = mm_sound_route_add_change_callback(audio_route_policy_changed_callback, (void*)111);
+ if(ret < 0)
+ {
+ printf("Can not add callback\n");
+ }
+ else
+ {
+ ret = mm_sound_route_remove_change_callback();
+ if(ret < 0)
+ {
+ printf("Can not remove callback\n");
+ }
+ }
+ return 0;
+}
+ * @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 = 0x000,
+ MM_SOUND_DEVICE_OUT_SPEAKER = 0x001<<8, /**< Device builtin speaker */
+ MM_SOUND_DEVICE_OUT_RECEIVER = 0x002<<8, /**< Device builtin receiver */
+ MM_SOUND_DEVICE_OUT_WIRED_ACCESSORY = 0x004<<8, /**< Wired output devices such as headphone, headset, and so on. */
+ MM_SOUND_DEVICE_OUT_BT_SCO = 0x008<<8, /**< Bluetooth SCO device */
+ MM_SOUND_DEVICE_OUT_BT_A2DP = 0x010<<8, /**< Bluetooth A2DP device */
+ MM_SOUND_DEVICE_OUT_DOCK = 0x020<<8, /**< DOCK device */
+ MM_SOUND_DEVICE_OUT_HDMI = 0x040<<8, /**< HDMI device */
+ MM_SOUND_DEVICE_OUT_WFD = 0x080<<8, /**< WFD device */
+ MM_SOUND_DEVICE_OUT_USB_AUDIO = 0x100<<8, /**< USB Audio device */
+} mm_sound_device_out;
+
+#define MM_SOUND_ROUTE_NUM 14
+
+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_OUT_DOCK = MM_SOUND_DEVICE_OUT_DOCK, /**< Routing audio output to DOCK */
+ MM_SOUND_ROUTE_OUT_HDMI = MM_SOUND_DEVICE_OUT_HDMI, /**< Routing audio output to HDMI */
+ MM_SOUND_ROUTE_OUT_WFD = MM_SOUND_DEVICE_OUT_WFD, /**< Routing audio output to WFD */
+ MM_SOUND_ROUTE_OUT_USB_AUDIO = MM_SOUND_DEVICE_OUT_USB_AUDIO, /**< Routing audio output to USB Audio */
+ 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);
+/**
+ @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __MM_SOUND_H__ */
+
--- /dev/null
+/*
+ * 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_CLIENT_H__
+#define __MM_SOUND_CLIENT_H__
+
+#include "mm_sound_private.h"
+
+//#define MEMTYPE_TRANS_PER_MAX (1024 * 1024) /* 1MB */
+
+int MMSoundClientInit(void);
+int MMSoundClientCallbackFini(void);
+int MMSoundClientPlayTone(int number, int volume_config, double volume, int time, int *handle);
+int MMSoundClientPlaySound(MMSoundPlayParam *param, int tone, int keytone, int *handle);
+int MMSoundClientStopSound(int handle);
+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);
+#ifdef PULSE_CLIENT
+int MMSoundClientIsBtA2dpOn (bool *connected, char** bt_name);
+#endif
+
+#endif /* __MM_SOUND_CLIENT_H__ */
--- /dev/null
+/*\r
+ * libmm-sound\r
+ *\r
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.\r
+ *\r
+ * Contact: Seungbae Shin <seungbae.shin@samsung.com>\r
+ *\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ *\r
+ */\r
+\r
+#ifndef __MM_SOUND_COMMON_H__\r
+#define __MM_SOUND_COMMON_H__\r
+\r
+///////////////////////////////////\r
+//// MMSOUND VOLUME APIs\r
+///////////////////////////////////\r
+#define VCONF_KEY_VOLUME_PREFIX "file/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
+#define VCONF_KEY_VOLUME_TYPE_RINGTONE VCONF_KEY_VOLUME_PREFIX"/ringtone"\r
+#define VCONF_KEY_VOLUME_TYPE_MEDIA VCONF_KEY_VOLUME_PREFIX"/media"\r
+#define VCONF_KEY_VOLUME_TYPE_CALL VCONF_KEY_VOLUME_PREFIX"/call"\r
+#define VCONF_KEY_VOLUME_TYPE_VOIP VCONF_KEY_VOLUME_PREFIX"/voip"\r
+#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
+case EINVAL: \\r
+ debug_warning("try mutex init..\n"); \\r
+ if( 0 > pthread_mutex_init( x_mutex, NULL) ) { \\r
+ return; \\r
+ } else { \\r
+ break; \\r
+ } \\r
+ return; \\r
+case 0: \\r
+ break; \\r
+default: \\r
+ debug_error("mutex lock failed\n"); \\r
+ return; \\r
+}\r
+\r
+#define MMSOUND_ENTER_CRITICAL_SECTION_WITH_RETURN(x_mutex,x_return) \\r
+switch ( pthread_mutex_lock( x_mutex ) ) \\r
+{ \\r
+case EINVAL: \\r
+ debug_warning("try mutex init..\n"); \\r
+ if( 0 > pthread_mutex_init( x_mutex, NULL) ) { \\r
+ return x_return; \\r
+ } else { \\r
+ break; \\r
+ } \\r
+ return x_return; \\r
+case 0: \\r
+ break; \\r
+default: \\r
+ debug_error("mutex lock failed\n"); \\r
+ return x_return; \\r
+}\r
+\r
+#define MMSOUND_LEAVE_CRITICAL_SECTION(x_mutex) \\r
+if( pthread_mutex_unlock( x_mutex ) ) { \\r
+ debug_error("mutex unlock failed\n"); \\r
+}\r
+\r
+#endif /* __MM_SOUND_COMMON_H__ */\r
+\r
--- /dev/null
+/*
+ * 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_MSG_H__
+#define __MM_SOUND_MSG_H__
+
+#include <sys/time.h>
+#include <unistd.h>
+#include <mm_ipc.h>
+
+#define KEY_BASE_PATH "/tmp"
+#define RCV_MSG 0x21 /* rcv key */
+#define SND_MSG 0x24 /* snd key */
+#define CB_MSG 0x64 /* cb key */
+
+#define MEMTYPE_SUPPORT_MAX (1024 * 1024) /* 1MB */
+
+enum {
+ MM_SOUND_MSG_REQ_FILE = 1,
+ MM_SOUND_MSG_REQ_MEMORY = 2,
+ MM_SOUND_MSG_REQ_STOP = 3,
+ MM_SOUND_MSG_RES_FILE = 4,
+ MM_SOUND_MSG_RES_MEMORY = 5,
+ MM_SOUND_MSG_RES_STOP = 6,
+ MM_SOUND_MSG_INF_STOP_CB = 7,
+ MM_SOUND_MSG_RES_ERROR = 8,
+ MM_SOUND_MSG_INF_DESTROY_CB = 9,
+#ifdef PULSE_CLIENT
+ MM_SOUND_MSG_REQ_GET_AUDIO_ROUTE = 16,
+ 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,
+ 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 */
+
+#endif /* __MM_SOUND_MSG_H__ */
+
--- /dev/null
+/*
+ * 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.h
+ * @brief Application interface library for sound module.
+ * @date
+ * @version Release
+ *
+ * Application interface library for sound module.
+ */
+
+#ifndef __MM_SOUND_PRIVATE_H__
+#define __MM_SOUND_PRIVATE_H__
+
+#include <mm_types.h>
+#include <mm_error.h>
+#include <mm_sound.h>
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+/**
+ @internal
+ @addtogroup SOUND_PRIVATE
+ @{
+
+ */
+
+#define MM_SOUND_VOLUME_CONFIG_TYPE(vol) (vol && 0x00FF)
+#define MM_SOUND_VOLUME_CONFIG_GAIN(vol) (vol && 0xFF00)
+
+enum MMSoundGainType {
+ MM_SOUND_GAIN_KEYTONE = 0, /**< hw gain configuration for keytone play */
+ MM_SOUND_GAIN_RINGTONE, /**< hw gain configuration for ringtone play */
+ MM_SOUND_GAIN_ALARMTONE, /**< hw gain configuration for alarmtone play */
+ MM_SOUND_GAIN_CALLTONE, /**< hw gain configuration for calltone play */
+ MM_SOUND_GAIN_AUDIOPLAYER, /**< hw gain configuration for music play */
+ MM_SOUND_GAIN_VIDEOPLAYER, /**< hw gain configuration for video play */
+ MM_SOUND_GAIN_VOICECALL, /**< hw gain configuration for voice call */
+ MM_SOUND_GAIN_VIDEOCALL, /**< hw gain configuration for video call */
+ MM_SOUND_GAIN_FMRADIO, /**< hw gain configuration for fm radio play */
+ MM_SOUND_GAIN_VOICEREC, /**< hw gain configuration for voice recording */
+ MM_SOUND_GAIN_CAMCORDER, /**< hw gain configuration for camcording */
+ MM_SOUND_GAIN_CAMERA, /**< hw gain configuration for camera shutter sound */
+ MM_SOUND_GAIN_GAME, /**< hw gain configuration for game play */
+ MM_SOUND_GAIN_CNT, /**< hw gain configuration count */
+ MM_SOUND_GAIN_MUSIC = MM_SOUND_GAIN_AUDIOPLAYER, /**< remained for legacy application */
+ MM_SOUND_GAIN_VIDEO, /**< remained for legacy application */
+ MM_SOUND_GAIN_NONE = MM_SOUND_GAIN_KEYTONE, /**< remained for legacy application */
+};
+
+/**
+ * Enumerations for sound path
+ */
+enum MMSoundPathExType {
+ MM_SOUND_PATH_NONE = 0, /**< no route path */
+ MM_SOUND_PATH_SPK, /**< sound route to speaker */
+ MM_SOUND_PATH_RECV, /**< sound route to receiver */
+ MM_SOUND_PATH_HEADSET, /**< sound route to headset */
+ MM_SOUND_PATH_BTHEADSET, /**< sound route to bluetooth headset */
+ MM_SOUND_PATH_A2DP, /**< not used */
+ MM_SOUND_PATH_HANDSFREE, /**< not used */
+ MM_SOUND_PATH_HDMI, /**< not used */
+ MM_SOUND_PATH_OUTMAX, /**< output route count */
+ MM_SOUND_PATH_MIC = 1, /**< sound route from microphone */
+ MM_SOUND_PATH_HEADSETMIC, /**< sound route from headset microphone */
+ MM_SOUND_PATH_BTMIC, /**< sound route from bluetooth microphone */
+ MM_SOUND_PATH_FMINPUT, /**< sound route from FM radio module */
+ MM_SOUND_PATH_HANDSFREEMIC, /**< not used */
+ MM_SOUND_PATH_INMAX, /**< input route count */
+};
+
+/**
+ * Enumerations for sound path option
+ */
+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_VOICECALL_REC = 0x00000010, /**< voice call recording option */
+ MM_SOUND_PATH_OPTION_USE_SUB_MIC = 0x00000020, /**< use sub-mic on call and recording */
+};
+
+
+enum mm_sound_handle_route_t {
+ MM_SOUND_HANDLE_ROUTE_USING_CURRENT,
+ MM_SOUND_HANDLE_ROUTE_SPEAKER,
+ MM_SOUND_HANDLE_ROUTE_SPEAKER_NO_RESTORE
+};
+
+typedef struct {
+ const char *filename; /**< filename to play */
+ int volume; /**< relative volume level */
+ int loop; /**< loop count */
+ mm_sound_stop_callback_func callback; /**< callback function when playing is terminated */
+ void *data; /**< user data to callback */
+ void *mem_ptr; /**< memory buffer to play */
+ int mem_size; /**< size of memory buffer */
+ int handle_route; /**< 1 for speaker, 0 for current */
+ int volume_config; /**< volume type & volume gain */
+ int priority; /**< 0 or 1 */
+} MMSoundPlayParam;
+
+
+/**
+ * This function is to play system sound with specified parameters.
+ *
+ * @param param [in] Reference pointer to MMSoundPlayParam structure
+ * @param handle [out] Handle of sound play.
+ *
+ * @return This function returns MM_ERROR_NONE on success, or negative value
+ * with error code.
+ * @remark When the stop callback is set, it will be called when system sound is
+ * terminated. If mm_sound_stop_sound() is called apparently before
+ * system sound is terminated, stop_callback will not be called.
+ * This function can use various sound route path with mm_sound_set_path
+ * @see mm_sound_stop_sound mm_sound_set_path
+ * @since R1, 1.0
+ * @limo
+ */
+int mm_sound_play_sound_ex(MMSoundPlayParam *param, int *handle);
+
+
+/**
+ * This function is to play key sound.
+ *
+ * @param filename [in] keytone filename to play
+ * @param volume_config [in] Volume type & volume gain
+ *
+ * @return This function returns MM_ERROR_NONE on success, or negative value
+ * with error code.
+ *
+ * @remark This function provide low latency sound play (such as dialer keytone)
+ * using fixed spec of wave file (44100Hz, mono channel)
+ * @see volume_type_t volume_gain_t mm_sound_volume_set_value
+ */
+int mm_sound_play_keysound(const char *filename, int volume_config);
+
+
+/**
+ * This function is to set sound device path.
+ *
+ * @param gain [in] sound path gain
+ * @param output [in] sound path out device
+ * @param input [in] sound path in device
+ * @param option [in] Sound path option
+ * MM_SOUND_PATH_OPTION_NONE
+ * MM_SOUND_PATH_OPTION_AUTO_HEADSET_CONTROL
+ * MM_SOUND_PATH_OPTION_SPEAKER_WITH_HEADSET
+ *
+ * @return This function returns MM_ERROR_NONE on success, or negative value
+ * with error code.
+ * @remark
+ * @see mm_sound_get_path
+ * @since 1.0
+ */
+int mm_sound_set_path(int gain, int output, int input, int option);
+
+
+/**
+ * This function retreives current sound device path.
+ *
+ * @param gain [out] Sound device path
+ * @param output [out] Sound output device on/off
+ * @param input [out] Sound input device on/off
+ * @param option [out] Sound path option
+ * MM_SOUND_PATH_OPTION_NONE
+ * MM_SOUND_PATH_OPTION_AUTO_HEADSET_CONTROL
+ * MM_SOUND_PATH_OPTION_SPEAKER_WITH_HEADSET
+ *
+ * @return This function returns MM_ERROR_NONE on success, or negative value
+ * with error code.
+ * @remark
+ * @see mm_sound_set_path
+ */
+int mm_sound_get_path(int *gain, int *output, int *input, int *option);
+
+int mm_sound_pcm_play_open_ex (MMSoundPcmHandle_t *handle, const unsigned int rate, MMSoundPcmChannel_t channel, MMSoundPcmFormat_t format, int volume_config, int asm_event);
+
+int mm_sound_pcm_play_open_no_session(MMSoundPcmHandle_t *handle, const unsigned int rate, MMSoundPcmChannel_t channel, MMSoundPcmFormat_t format);
+
+/**
+ @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __MM_SOUND_H__ */
+
--- /dev/null
+/*
+ * 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);
+bool _mm_sound_check_hibernation (const char *path);
+int _mm_sound_volume_add_callback(volume_type_t type, void *func, void* user_data);
+int _mm_sound_volume_remove_callback(volume_type_t type, void *func);
+int _mm_sound_volume_get_value_by_type(volume_type_t type, unsigned int *value);
+int _mm_sound_volume_set_value_by_type(volume_type_t type, unsigned int value);
+int _mm_sound_volume_get_values_on_bootup(int *values);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __MM_SOUND_UTILS_H__ */
+
--- /dev/null
+/*
+ * 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_SOURCE_H__
+#define __MM_SOURCE_H__
+
+enum {
+ MM_SOURCE_NONE = 0,
+ MM_SOURCE_FILE,
+ MM_SOURCE_MEMORY,
+ MM_SOURCE_MEMORY_NOTALLOC,
+ MM_SOURCE_NUM,
+};
+
+enum {
+ MM_SOURCE_NOT_DRM_CONTENTS = 0,
+ MM_SOURCE_CHECK_DRM_CONTENTS
+};
+
+typedef struct {
+ int type; /**< source type (file or memory) */
+ void *ptr; /**< pointer to buffer */
+ unsigned int cur_size; /**< size of current memory */
+ unsigned int tot_size; /**< size of current memory */
+ int fd; /**< file descriptor for file */
+ unsigned int medOffset; /**Media Offset */
+} MMSourceType;
+
+#define MMSourceIsUnUsed(psource) \
+ ((psource)->type == MM_SOUND_SOURCE_NONE)
+
+#define MMSourceIsFile(psource) \
+ ((psource)->type == MM_SOUND_SOURCE_FILE)
+
+#define MMSourceIsMemory(psource) \
+ ((psource)->type == MM_SOUND_SOURCE_MEMORY)
+
+#define MMSourceGetPtr(psource) \
+ ((psource)->ptr)
+
+#define MMSourceGetCurSize(psource) \
+ ((psource)->cur_size)
+
+#define MMSourceGetTotSize(psource) \
+ ((psource)->tot_size)
+
+int mm_source_open_file(const char *filename, MMSourceType* source, int drmsupport);
+int mm_source_open_full_memory(const void *ptr, int totsize, int alloc, MMSourceType *source);
+int mm_source_open_memory(const void *ptr, int totsize, int size, MMSourceType *source);
+int mm_source_append_memory(const void *ptr, int size, MMSourceType *source);
+int mm_source_close(MMSourceType *source);
+
+#endif /* __MM_SOURCE_H__ */
+
--- /dev/null
+installinitscriptdir = /etc/rc.d/init.d
+installinitscript_SCRIPTS = $(srcdir)/soundserver
--- /dev/null
+#!/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 &
--- /dev/null
+#!/bin/sh
+#
+### BEGIN INIT INFO
+# Provides: soundserver
+# Default-Start: 2 3 4 5
+# Default-Stop: 0 1 6
+# Short-Description: start sound_server daemon
+### END INIT INFO
+
+if [ -x /usr/bin/sound_server ]; then
+ /usr/bin/sound_server -S&
+fi
--- /dev/null
+<manifest>
+ <define>
+ <domain name="sound_server"/>
+ </define>
+ <request>
+ <domain name="_"/>
+ </request>
+ <assign>
+ <filesystem path="/usr/bin/sound_server" label="sound_server" exec_label="sound_server"/>
+ <filesystem path="/etc/rc.d/init.d/soundserver" label="_" exec_label="none" />
+ <filesystem path="/etc/rc.d/rc3.d/S23soundserver" label="_" exec_label="none" />
+ <filesystem path="/etc/rc.d/rc4.d/S23soundserver" label="_" exec_label="none" />
+ </assign>
+</manifest>
--- /dev/null
+#! /bin/sh
+# Common stub for a few missing GNU programs while installing.
+
+scriptversion=2006-05-10.23
+
+# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006
+# Free Software Foundation, Inc.
+# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+# 02110-1301, USA.
+
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+if test $# -eq 0; then
+ echo 1>&2 "Try \`$0 --help' for more information"
+ exit 1
+fi
+
+run=:
+sed_output='s/.* --output[ =]\([^ ]*\).*/\1/p'
+sed_minuso='s/.* -o \([^ ]*\).*/\1/p'
+
+# In the cases where this matters, `missing' is being run in the
+# srcdir already.
+if test -f configure.ac; then
+ configure_ac=configure.ac
+else
+ configure_ac=configure.in
+fi
+
+msg="missing on your system"
+
+case $1 in
+--run)
+ # Try to run requested program, and just exit if it succeeds.
+ run=
+ shift
+ "$@" && exit 0
+ # Exit code 63 means version mismatch. This often happens
+ # when the user try to use an ancient version of a tool on
+ # a file that requires a minimum version. In this case we
+ # we should proceed has if the program had been absent, or
+ # if --run hadn't been passed.
+ if test $? = 63; then
+ run=:
+ msg="probably too old"
+ fi
+ ;;
+
+ -h|--h|--he|--hel|--help)
+ echo "\
+$0 [OPTION]... PROGRAM [ARGUMENT]...
+
+Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
+error status if there is no known handling for PROGRAM.
+
+Options:
+ -h, --help display this help and exit
+ -v, --version output version information and exit
+ --run try to run the given command, and emulate it if it fails
+
+Supported PROGRAM values:
+ aclocal touch file \`aclocal.m4'
+ autoconf touch file \`configure'
+ autoheader touch file \`config.h.in'
+ autom4te touch the output file, or create a stub one
+ automake touch all \`Makefile.in' files
+ bison create \`y.tab.[ch]', if possible, from existing .[ch]
+ flex create \`lex.yy.c', if possible, from existing .c
+ help2man touch the output file
+ lex create \`lex.yy.c', if possible, from existing .c
+ makeinfo touch the output file
+ tar try tar, gnutar, gtar, then tar without non-portable flags
+ yacc create \`y.tab.[ch]', if possible, from existing .[ch]
+
+Send bug reports to <bug-automake@gnu.org>."
+ exit $?
+ ;;
+
+ -v|--v|--ve|--ver|--vers|--versi|--versio|--version)
+ echo "missing $scriptversion (GNU Automake)"
+ exit $?
+ ;;
+
+ -*)
+ echo 1>&2 "$0: Unknown \`$1' option"
+ echo 1>&2 "Try \`$0 --help' for more information"
+ exit 1
+ ;;
+
+esac
+
+# Now exit if we have it, but it failed. Also exit now if we
+# don't have it and --version was passed (most likely to detect
+# the program).
+case $1 in
+ lex|yacc)
+ # Not GNU programs, they don't have --version.
+ ;;
+
+ tar)
+ if test -n "$run"; then
+ echo 1>&2 "ERROR: \`tar' requires --run"
+ exit 1
+ elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
+ exit 1
+ fi
+ ;;
+
+ *)
+ if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
+ # We have it, but it failed.
+ exit 1
+ elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
+ # Could not run --version or --help. This is probably someone
+ # running `$TOOL --version' or `$TOOL --help' to check whether
+ # $TOOL exists and not knowing $TOOL uses missing.
+ exit 1
+ fi
+ ;;
+esac
+
+# If it does not exist, or fails to run (possibly an outdated version),
+# try to emulate it.
+case $1 in
+ aclocal*)
+ echo 1>&2 "\
+WARNING: \`$1' is $msg. You should only need it if
+ you modified \`acinclude.m4' or \`${configure_ac}'. You might want
+ to install the \`Automake' and \`Perl' packages. Grab them from
+ any GNU archive site."
+ touch aclocal.m4
+ ;;
+
+ autoconf)
+ echo 1>&2 "\
+WARNING: \`$1' is $msg. You should only need it if
+ you modified \`${configure_ac}'. You might want to install the
+ \`Autoconf' and \`GNU m4' packages. Grab them from any GNU
+ archive site."
+ touch configure
+ ;;
+
+ autoheader)
+ echo 1>&2 "\
+WARNING: \`$1' is $msg. You should only need it if
+ you modified \`acconfig.h' or \`${configure_ac}'. You might want
+ to install the \`Autoconf' and \`GNU m4' packages. Grab them
+ from any GNU archive site."
+ files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
+ test -z "$files" && files="config.h"
+ touch_files=
+ for f in $files; do
+ case $f in
+ *:*) touch_files="$touch_files "`echo "$f" |
+ sed -e 's/^[^:]*://' -e 's/:.*//'`;;
+ *) touch_files="$touch_files $f.in";;
+ esac
+ done
+ touch $touch_files
+ ;;
+
+ automake*)
+ echo 1>&2 "\
+WARNING: \`$1' is $msg. You should only need it if
+ you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
+ You might want to install the \`Automake' and \`Perl' packages.
+ Grab them from any GNU archive site."
+ find . -type f -name Makefile.am -print |
+ sed 's/\.am$/.in/' |
+ while read f; do touch "$f"; done
+ ;;
+
+ autom4te)
+ echo 1>&2 "\
+WARNING: \`$1' is needed, but is $msg.
+ You might have modified some files without having the
+ proper tools for further handling them.
+ You can get \`$1' as part of \`Autoconf' from any GNU
+ archive site."
+
+ file=`echo "$*" | sed -n "$sed_output"`
+ test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
+ if test -f "$file"; then
+ touch $file
+ else
+ test -z "$file" || exec >$file
+ echo "#! /bin/sh"
+ echo "# Created by GNU Automake missing as a replacement of"
+ echo "# $ $@"
+ echo "exit 0"
+ chmod +x $file
+ exit 1
+ fi
+ ;;
+
+ bison|yacc)
+ echo 1>&2 "\
+WARNING: \`$1' $msg. You should only need it if
+ you modified a \`.y' file. You may need the \`Bison' package
+ in order for those modifications to take effect. You can get
+ \`Bison' from any GNU archive site."
+ rm -f y.tab.c y.tab.h
+ if test $# -ne 1; then
+ eval LASTARG="\${$#}"
+ case $LASTARG in
+ *.y)
+ SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
+ if test -f "$SRCFILE"; then
+ cp "$SRCFILE" y.tab.c
+ fi
+ SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
+ if test -f "$SRCFILE"; then
+ cp "$SRCFILE" y.tab.h
+ fi
+ ;;
+ esac
+ fi
+ if test ! -f y.tab.h; then
+ echo >y.tab.h
+ fi
+ if test ! -f y.tab.c; then
+ echo 'main() { return 0; }' >y.tab.c
+ fi
+ ;;
+
+ lex|flex)
+ echo 1>&2 "\
+WARNING: \`$1' is $msg. You should only need it if
+ you modified a \`.l' file. You may need the \`Flex' package
+ in order for those modifications to take effect. You can get
+ \`Flex' from any GNU archive site."
+ rm -f lex.yy.c
+ if test $# -ne 1; then
+ eval LASTARG="\${$#}"
+ case $LASTARG in
+ *.l)
+ SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
+ if test -f "$SRCFILE"; then
+ cp "$SRCFILE" lex.yy.c
+ fi
+ ;;
+ esac
+ fi
+ if test ! -f lex.yy.c; then
+ echo 'main() { return 0; }' >lex.yy.c
+ fi
+ ;;
+
+ help2man)
+ echo 1>&2 "\
+WARNING: \`$1' is $msg. You should only need it if
+ you modified a dependency of a manual page. You may need the
+ \`Help2man' package in order for those modifications to take
+ effect. You can get \`Help2man' from any GNU archive site."
+
+ file=`echo "$*" | sed -n "$sed_output"`
+ test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
+ if test -f "$file"; then
+ touch $file
+ else
+ test -z "$file" || exec >$file
+ echo ".ab help2man is required to generate this page"
+ exit 1
+ fi
+ ;;
+
+ makeinfo)
+ echo 1>&2 "\
+WARNING: \`$1' is $msg. You should only need it if
+ you modified a \`.texi' or \`.texinfo' file, or any other file
+ indirectly affecting the aspect of the manual. The spurious
+ call might also be the consequence of using a buggy \`make' (AIX,
+ DU, IRIX). You might want to install the \`Texinfo' package or
+ the \`GNU make' package. Grab either from any GNU archive site."
+ # The file to touch is that specified with -o ...
+ file=`echo "$*" | sed -n "$sed_output"`
+ test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
+ if test -z "$file"; then
+ # ... or it is the one specified with @setfilename ...
+ infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
+ file=`sed -n '
+ /^@setfilename/{
+ s/.* \([^ ]*\) *$/\1/
+ p
+ q
+ }' $infile`
+ # ... or it is derived from the source name (dir/f.texi becomes f.info)
+ test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info
+ fi
+ # If the file does not exist, the user really needs makeinfo;
+ # let's fail without touching anything.
+ test -f $file || exit 1
+ touch $file
+ ;;
+
+ tar)
+ shift
+
+ # We have already tried tar in the generic part.
+ # Look for gnutar/gtar before invocation to avoid ugly error
+ # messages.
+ if (gnutar --version > /dev/null 2>&1); then
+ gnutar "$@" && exit 0
+ fi
+ if (gtar --version > /dev/null 2>&1); then
+ gtar "$@" && exit 0
+ fi
+ firstarg="$1"
+ if shift; then
+ case $firstarg in
+ *o*)
+ firstarg=`echo "$firstarg" | sed s/o//`
+ tar "$firstarg" "$@" && exit 0
+ ;;
+ esac
+ case $firstarg in
+ *h*)
+ firstarg=`echo "$firstarg" | sed s/h//`
+ tar "$firstarg" "$@" && exit 0
+ ;;
+ esac
+ fi
+
+ echo 1>&2 "\
+WARNING: I can't seem to be able to run \`tar' with the given arguments.
+ You may want to install GNU tar or Free paxutils, or check the
+ command line arguments."
+ exit 1
+ ;;
+
+ *)
+ echo 1>&2 "\
+WARNING: \`$1' is needed, and is $msg.
+ You might have modified some files without having the
+ proper tools for further handling them. Check the \`README' file,
+ it often tells you about the needed prerequisites for installing
+ this package. You may also peek at any GNU archive site, in case
+ some other package would contain this missing \`$1' program."
+ exit 1
+ ;;
+esac
+
+exit 0
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-end: "$"
+# End:
--- /dev/null
+/*
+ * 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 <memory.h>
+#include <unistd.h>
+#include <pthread.h>
+#include <stdio.h>
+#include <sys/types.h>
+#include <fcntl.h>
+
+#include <sys/stat.h>
+#include <errno.h>
+#include <avsystem.h>
+
+#include <vconf.h>
+#include <mm_types.h>
+#include <mm_error.h>
+#include <mm_message.h>
+#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"
+
+
+#include <audio-session-manager.h>
+#include <mm_session.h>
+#include <mm_session_private.h>
+
+#define MAX_FILE_LENGTH 256
+#define MAX_MEMORY_SIZE 1048576 /* Max memory size 1024*1024 (1MB) */
+#define _MIN_SYSTEM_SAMPLERATE 8000
+#define _MAX_SYSTEM_SAMPLERATE 48000
+#define MIN_TONE_PLAY_TIME 300
+
+typedef struct {
+ volume_callback_fn func;
+ void* data;
+ volume_type_t type;
+}volume_cb_param;
+
+volume_cb_param g_volume_param[VOLUME_TYPE_MAX];
+
+static pthread_mutex_t _volume_mutex = PTHREAD_MUTEX_INITIALIZER;
+
+#define PCM_LOCK_INTERNAL(LOCK) do { pthread_mutex_lock(LOCK); } while (0)
+#define PCM_UNLOCK_INTERNAL(LOCK) do { pthread_mutex_unlock(LOCK); } while (0)
+#define PCM_LOCK_DESTROY_INTERNAL(LOCK) do { pthread_mutex_destroy(LOCK); } while (0)
+
+typedef struct {
+ avsys_handle_t audio_handle;
+ int asm_handle;
+ ASM_sound_events_t asm_event;
+
+ bool is_started;
+ bool is_playback;
+ bool skip_session;
+ pthread_mutex_t pcm_mutex_internal;
+ 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);
+
+static void __sound_pcm_send_message (mm_sound_pcm_t *pcmHandle, int message, int code);
+
+static int __validate_volume(volume_type_t type, int value)
+{
+ if (value < 0)
+ return -1;
+
+ switch (type)
+ {
+ case VOLUME_TYPE_CALL:
+ case VOLUME_TYPE_VOIP:
+ if (value >= AVSYS_AUDIO_VOLUME_MAX_BASIC) {
+ return -1;
+ }
+ 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:
+ if (value >= AVSYS_AUDIO_VOLUME_MAX_MULTIMEDIA) {
+ return -1;
+ }
+ break;
+ case VOLUME_TYPE_EXT_ANDROID:
+ if (value >= AVSYS_AUDIO_VOLUME_MAX_SINGLE) {
+ return -1;
+ }
+ break;
+ default:
+ return -1;
+ break;
+ }
+ return 0;
+}
+
+static void volume_changed_cb(keynode_t* node, void* data)
+{
+ volume_cb_param* param = (volume_cb_param*) data;
+
+ debug_msg("%s changed callback called\n",vconf_keynode_get_name(node));
+
+ MMSOUND_ENTER_CRITICAL_SECTION( &_volume_mutex )
+
+ if(param && (param->func != NULL)) {
+ debug_msg("funcion 0x%x\n", param->func);
+ ((volume_callback_fn)param->func)(param->data);
+ }
+
+ MMSOUND_LEAVE_CRITICAL_SECTION( &_volume_mutex )
+}
+
+EXPORT_API
+int mm_sound_volume_add_callback(volume_type_t type, volume_callback_fn func, void* user_data)
+{
+ debug_fenter();
+
+ /* Check input param */
+ if (type < 0 || type >= VOLUME_TYPE_MAX) {
+ return MM_ERROR_INVALID_ARGUMENT;
+ }
+ if (!func) {
+ debug_warning("callback function is null\n");
+ return MM_ERROR_INVALID_ARGUMENT;
+ }
+
+ MMSOUND_ENTER_CRITICAL_SECTION_WITH_RETURN( &_volume_mutex, MM_ERROR_SOUND_INTERNAL );
+
+ g_volume_param[type].func = func;
+ g_volume_param[type].data = user_data;
+ g_volume_param[type].type = type;
+
+ MMSOUND_LEAVE_CRITICAL_SECTION( &_volume_mutex );
+
+ return _mm_sound_volume_add_callback(type, volume_changed_cb, (void*)&g_volume_param[type]);
+}
+
+EXPORT_API
+int mm_sound_volume_remove_callback(volume_type_t type)
+{
+ debug_fenter();
+
+ if(type < 0 || type >=VOLUME_TYPE_MAX) {
+ return MM_ERROR_INVALID_ARGUMENT;
+ }
+
+ MMSOUND_ENTER_CRITICAL_SECTION_WITH_RETURN( &_volume_mutex, MM_ERROR_SOUND_INTERNAL );
+
+ g_volume_param[type].func = NULL;
+ g_volume_param[type].data = NULL;
+ g_volume_param[type].type = type;
+
+ MMSOUND_LEAVE_CRITICAL_SECTION( &_volume_mutex );
+
+ return _mm_sound_volume_remove_callback(type, volume_changed_cb);
+}
+
+EXPORT_API
+int mm_sound_get_volume_step(volume_type_t type, int *step)
+{
+ printf("\n**********\n\nTHIS FUNCTION HAS DEFPRECATED [%s]\n\n \
+ use mm_sound_volume_get_step() instead\n\n**********\n", __func__);
+ return mm_sound_volume_get_step(type, step);
+}
+
+EXPORT_API
+int mm_sound_volume_get_step(volume_type_t type, int *step)
+{
+ int err;
+
+ debug_fenter();
+
+ /* Check input param */
+ if (step == NULL) {
+ debug_error("second parameter is null\n");
+ return MM_ERROR_INVALID_ARGUMENT;
+ }
+ if (type < 0 || type >= VOLUME_TYPE_MAX) {
+ debug_error("Invalid type value %d\n", (int)type);
+ return MM_ERROR_INVALID_ARGUMENT;
+ }
+
+ err = avsys_audio_get_volume_max_ex((int)type, step);
+ if (AVSYS_FAIL(err)) {
+ err = MM_ERROR_INVALID_ARGUMENT;
+ }
+
+ debug_fleave();
+ return MM_ERROR_NONE;
+}
+
+EXPORT_API
+int mm_sound_volume_set_value(volume_type_t type, const unsigned int value)
+{
+ int ret = MM_ERROR_NONE;
+
+ debug_fenter();
+
+ /* Check input param */
+ if (0 > __validate_volume(type, (int)value)) {
+ debug_error("invalid volume type %d, value %u\n", type, value);
+ return MM_ERROR_INVALID_ARGUMENT;
+ }
+
+ ret = _mm_sound_volume_set_value_by_type(type, value);
+ if (ret == MM_ERROR_NONE) {
+ /* update shared memory value */
+ if (AVSYS_FAIL(avsys_audio_set_volume_by_type(type, (int)value))) {
+ debug_error("Can not set volume to shared memory 0x%x\n", ret);
+ }
+ }
+
+ debug_fleave();
+ return ret;
+}
+
+EXPORT_API
+int mm_sound_volume_get_value(volume_type_t type, unsigned int *value)
+{
+ int ret = MM_ERROR_NONE;
+
+ debug_fenter();
+
+ /* Check input param */
+ if (value == NULL)
+ return MM_ERROR_INVALID_ARGUMENT;
+ if (type < 0 || type >= VOLUME_TYPE_MAX) {
+ debug_error("invalid volume type value %d\n", type);
+ return MM_ERROR_INVALID_ARGUMENT;
+ }
+
+ ret = _mm_sound_volume_get_value_by_type(type, value);
+
+ debug_fleave();
+ return ret;
+}
+
+EXPORT_API
+int mm_sound_volume_primary_type_set(volume_type_t type)
+{
+ pid_t mypid;
+ int ret = MM_ERROR_NONE;
+
+ /* Check input param */
+ if(type < 0 || type >= VOLUME_TYPE_MAX)
+ return MM_ERROR_INVALID_ARGUMENT;
+
+ debug_fenter();
+
+ mypid = getpid();
+ if(AVSYS_FAIL(avsys_audio_set_primary_volume((int)mypid, type))) {
+ debug_error("Can not set primary volume [%d, %d]\n", mypid, type);
+ ret = MM_ERROR_SOUND_INTERNAL;
+ }
+
+ debug_fleave();
+ return ret;
+}
+
+EXPORT_API
+int mm_sound_volume_primary_type_clear()
+{
+ pid_t mypid;
+ int ret = MM_ERROR_NONE;
+
+ debug_fenter();
+
+ mypid = getpid();
+ if(AVSYS_FAIL(avsys_audio_clear_primary_volume((int)mypid))) {
+ debug_error("Can not clear primary volume [%d]\n", mypid);
+ ret = MM_ERROR_SOUND_INTERNAL;
+ }
+
+ debug_fleave();
+ return ret;
+}
+
+EXPORT_API
+int mm_sound_volume_get_current_playing_type(volume_type_t *type)
+{
+ int result = AVSYS_STATE_SUCCESS;
+ int voltype = AVSYS_AUDIO_VOLUME_TYPE_RINGTONE;
+ int ret = MM_ERROR_NONE;
+
+ debug_fenter();
+
+ /* Check input param */
+ if(type == NULL) {
+ return MM_ERROR_INVALID_ARGUMENT;
+ }
+
+ result = avsys_audio_get_current_playing_volume_type(&voltype);
+ switch (result)
+ {
+ case AVSYS_STATE_SUCCESS:
+ *type = voltype;
+ break;
+ case AVSYS_STATE_ERR_ALLOCATION:
+ ret = MM_ERROR_SOUND_VOLUME_NO_INSTANCE;
+ break;
+ case AVSYS_STATE_ERR_INVALID_MODE:
+ ret = MM_ERROR_SOUND_VOLUME_CAPTURE_ONLY;
+ break;
+ default:
+ ret = MM_ERROR_SOUND_INTERNAL;
+ break;
+ }
+ debug_log("avsys_audio_get_current_playing_volume_type() = %x, ret = %x, type = %d\n", result, ret, *type);
+
+ debug_fleave();
+ return ret;
+}
+
+///////////////////////////////////
+//// MMSOUND PCM APIs
+///////////////////////////////////
+
+
+int _get_asm_event_type(ASM_sound_events_t *type)
+{
+ int sessionType = MM_SESSION_TYPE_SHARE;
+ ASM_sound_events_t asm_event;
+
+ if(type == NULL)
+ return MM_ERROR_SOUND_INVALID_POINTER;
+
+ /* read session type */
+ if(_mm_session_util_read_type(-1, &sessionType) < 0) {
+ debug_log("Read Session Type failed. Set default \"Share\" type\n");
+ sessionType = MM_SESSION_TYPE_SHARE;
+ if(mm_session_init(sessionType) < 0) {
+ debug_error("mm_session_init() failed\n");
+ return MM_ERROR_SOUND_INTERNAL;
+ }
+ }
+
+ /* convert MM_SESSION_TYPE to ASM_EVENT_TYPE */
+ switch (sessionType)
+ {
+ case MM_SESSION_TYPE_SHARE:
+ asm_event = ASM_EVENT_SHARE_MMSOUND;
+ break;
+ case MM_SESSION_TYPE_EXCLUSIVE:
+ asm_event = ASM_EVENT_EXCLUSIVE_MMSOUND;
+ break;
+ case MM_SESSION_TYPE_NOTIFY:
+ asm_event = ASM_EVENT_NOTIFY;
+ break;
+ case MM_SESSION_TYPE_ALARM:
+ asm_event = ASM_EVENT_ALARM;
+ break;
+ case MM_SESSION_TYPE_CALL:
+ asm_event = ASM_EVENT_CALL;
+ break;
+ case MM_SESSION_TYPE_VIDEOCALL:
+ asm_event = ASM_EVENT_VIDEOCALL;
+ break;
+ case MM_SESSION_TYPE_RICH_CALL:
+ asm_event = ASM_EVENT_RICH_CALL;
+ break;
+ case MM_SESSION_TYPE_EMERGENCY:
+ asm_event = ASM_EVENT_EMERGENCY;
+ break;
+ default:
+ debug_error("Unexpected %d\n", sessionType);
+ return MM_ERROR_SOUND_INTERNAL;
+ }
+
+ *type = asm_event;
+ return MM_ERROR_NONE;
+}
+
+static void __sound_pcm_send_message (mm_sound_pcm_t *pcmHandle, int message, int code)
+{
+ int ret = 0;
+ if (pcmHandle->msg_cb) {
+ MMMessageParamType msg;
+ msg.union_type = MM_MSG_UNION_CODE;
+ msg.code = code;
+
+ debug_log ("calling msg callback(%p) with message(%d), code(%d), msg callback param(%p)\n",
+ pcmHandle->msg_cb, message, msg.code, pcmHandle->msg_cb_param);
+ ret = pcmHandle->msg_cb(message, &msg, pcmHandle->msg_cb_param);
+ debug_log ("msg callback returned (%d)\n", ret);
+ } else {
+ debug_log ("No pcm msg callback\n");
+ }
+}
+
+ASM_cb_result_t sound_pcm_asm_callback(int handle, ASM_event_sources_t event_src, ASM_sound_commands_t command, unsigned int sound_status, void *cb_data)
+{
+ mm_sound_pcm_t *pcmHandle = (mm_sound_pcm_t *)cb_data;
+ ASM_cb_result_t cb_res = ASM_CB_RES_IGNORE;
+
+ /* Check input param */
+ if(pcmHandle == NULL) {
+ debug_error("sound_pcm_asm_callback cb_data is null\n");
+ return cb_res;
+ }
+
+ debug_log ("command = %d, handle = %p, is_started = %d\n",command, pcmHandle, pcmHandle->is_started);
+ switch(command)
+ {
+ case ASM_COMMAND_STOP:
+ /* Do stop */
+ PCM_LOCK_INTERNAL(&pcmHandle->pcm_mutex_internal);
+ _pcm_sound_stop_internal (pcmHandle);
+ PCM_UNLOCK_INTERNAL(&pcmHandle->pcm_mutex_internal);
+ cb_res = ASM_CB_RES_PAUSE;
+ break;
+
+ case ASM_COMMAND_RESUME:
+ 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;
+ }
+
+ /* execute user callback if callback available */
+ __sound_pcm_send_message (pcmHandle, MM_MESSAGE_SOUND_PCM_INTERRUPTED, event_src);
+
+ return cb_res;
+}
+
+EXPORT_API
+int mm_sound_pcm_capture_open(MMSoundPcmHandle_t *handle, const unsigned int rate, MMSoundPcmChannel_t channel, MMSoundPcmFormat_t format)
+{
+ avsys_audio_param_t param;
+ mm_sound_pcm_t *pcmHandle = NULL;
+ int size = 0;
+ int result = AVSYS_STATE_SUCCESS;
+ int errorcode = 0;
+ int ret_mutex = 0;
+ debug_fenter();
+ memset(¶m, 0, sizeof(avsys_audio_param_t));
+
+
+ if (rate < _MIN_SYSTEM_SAMPLERATE || rate > _MAX_SYSTEM_SAMPLERATE) {
+ debug_error("unsupported sample rate %u", rate);
+ return MM_ERROR_SOUND_DEVICE_INVALID_SAMPLERATE;
+ } else {
+ param.samplerate = rate;
+ }
+
+ switch(channel)
+ {
+ case MMSOUND_PCM_MONO:
+ param.channels = 1;
+ break;
+ case MMSOUND_PCM_STEREO:
+ param.channels = 2;
+ break;
+
+ default:
+ debug_error("Unsupported channel type\n");
+ return MM_ERROR_SOUND_DEVICE_INVALID_CHANNEL;
+ }
+
+ switch(format)
+ {
+ case MMSOUND_PCM_U8:
+ param.format = AVSYS_AUDIO_FORMAT_8BIT;
+ break;
+ case MMSOUND_PCM_S16_LE:
+ param.format = AVSYS_AUDIO_FORMAT_16BIT;
+ break;
+ default:
+ debug_error("Unsupported format type\n");
+ return MM_ERROR_SOUND_DEVICE_INVALID_FORMAT;
+ }
+
+ pcmHandle = calloc(sizeof(mm_sound_pcm_t), 1);
+ if(pcmHandle == NULL)
+ return MM_ERROR_OUT_OF_MEMORY;
+
+ ret_mutex = pthread_mutex_init(&pcmHandle->pcm_mutex_internal, NULL);
+ if(ret_mutex != 0)
+ {
+ free(pcmHandle);
+ return MM_ERROR_OUT_OF_MEMORY;
+ }
+
+ /* Register ASM */
+ /* get session type */
+ if(MM_ERROR_NONE != _get_asm_event_type(&pcmHandle->asm_event)) {
+ PCM_LOCK_DESTROY_INTERNAL(&pcmHandle->pcm_mutex_internal);
+ free(pcmHandle);
+ return MM_ERROR_POLICY_INTERNAL;
+ }
+ /* 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 */ ASM_STATE_NONE, sound_pcm_asm_callback, (void*)pcmHandle, ASM_RESOURCE_NONE, &errorcode))
+ {
+ debug_error("ASM_register_sound() failed 0x%x\n", errorcode);
+ PCM_LOCK_DESTROY_INTERNAL(&pcmHandle->pcm_mutex_internal);
+ free(pcmHandle);
+ return MM_ERROR_POLICY_BLOCKED;
+ }
+ }
+
+ /* Open */
+ param.mode = AVSYS_AUDIO_MODE_INPUT;
+ param.vol_type = AVSYS_AUDIO_VOLUME_TYPE_SYSTEM; //dose not effect at capture mode
+ param.priority = AVSYS_AUDIO_PRIORITY_0; //This does not affect anymore.
+ result = avsys_audio_open(¶m, &pcmHandle->audio_handle, &size);
+ if(AVSYS_FAIL(result)) {
+ debug_error("Device Open Error 0x%x\n", result);
+ PCM_LOCK_DESTROY_INTERNAL(&pcmHandle->pcm_mutex_internal);
+ free(pcmHandle);
+ return MM_ERROR_SOUND_DEVICE_NOT_OPENED;
+ }
+
+ pcmHandle->is_playback = false;
+
+ /* Set handle to return */
+ *handle = (MMSoundPcmHandle_t)pcmHandle;
+ debug_fleave();
+ return size;
+}
+
+static int _pcm_sound_start (MMSoundPcmHandle_t handle)
+{
+ mm_sound_pcm_t *pcmHandle = (mm_sound_pcm_t*)handle;
+ int errorcode = 0;
+ int ret = 0;
+
+ debug_fenter();
+
+ /* Check input param */
+ if(pcmHandle == NULL) {
+ debug_error ("Handle is null, return Invalid Argument\n");
+ ret = MM_ERROR_INVALID_ARGUMENT;
+ goto NULL_HANDLE;
+ }
+
+ PCM_LOCK_INTERNAL(&pcmHandle->pcm_mutex_internal);
+
+ if (pcmHandle->skip_session == false) {
+ /* 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);
+ ret = MM_ERROR_POLICY_BLOCKED;
+ goto EXIT;
+ }
+ }
+
+ /* Update State */
+ pcmHandle->is_started = true;
+
+ /* Un-Cork */
+ ret = avsys_audio_cork(pcmHandle->audio_handle, 0);
+
+EXIT:
+ PCM_UNLOCK_INTERNAL(&pcmHandle->pcm_mutex_internal);
+
+NULL_HANDLE:
+ debug_fleave();
+ return ret;
+}
+
+
+EXPORT_API
+int mm_sound_pcm_capture_start(MMSoundPcmHandle_t handle)
+{
+ int ret = MM_ERROR_NONE;
+ debug_fenter();
+
+
+ ret = _pcm_sound_start (handle);
+ if (ret != MM_ERROR_NONE) {
+ debug_error ("_pcm_sound_start() failed (%x)\n", ret);
+ goto EXIT;
+ }
+
+EXIT:
+ debug_fleave();
+ return ret;
+}
+
+static int _pcm_sound_stop_internal (MMSoundPcmHandle_t handle)
+{
+ mm_sound_pcm_t *pcmHandle = (mm_sound_pcm_t*)handle;
+
+ /* Check input param */
+ if(pcmHandle == NULL)
+ return MM_ERROR_INVALID_ARGUMENT;
+
+ /* Check State */
+ if (pcmHandle->is_started == false) {
+ debug_warning ("Can't stop because not started\n");
+ return MM_ERROR_SOUND_INVALID_STATE;
+ }
+
+ /* Drain if playback mode */
+ if (pcmHandle->is_playback) {
+ if(AVSYS_FAIL(avsys_audio_drain(pcmHandle->audio_handle))) {
+ debug_error("drain failed\n");
+ }
+ }
+
+ /* Update State */
+ 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 = (mm_sound_pcm_t*)handle;
+ int errorcode = 0;
+ int ret = MM_ERROR_NONE;
+
+ debug_fenter();
+
+ /* Check input param */
+ if(pcmHandle == NULL) {
+ debug_error ("Handle is null, return Invalid Argument\n");
+ ret = MM_ERROR_INVALID_ARGUMENT;
+ goto NULL_HANDLE;
+ }
+
+ PCM_LOCK_INTERNAL(&pcmHandle->pcm_mutex_internal);
+
+ /* Do stop procedure */
+ ret = _pcm_sound_stop_internal(handle);
+ if (ret == MM_ERROR_NONE) {
+ /* Set ASM State to STOP */
+ if (pcmHandle->skip_session == false) {
+ 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);
+ ret = MM_ERROR_POLICY_BLOCKED;
+ goto EXIT;
+ }
+ }
+ }
+
+ debug_log ("pcm sound [%p] stopped success!!!\n", handle);
+
+EXIT:
+ PCM_UNLOCK_INTERNAL(&pcmHandle->pcm_mutex_internal);
+NULL_HANDLE:
+ debug_fleave();
+ return ret;
+}
+
+
+EXPORT_API
+int mm_sound_pcm_capture_stop(MMSoundPcmHandle_t handle)
+{
+ int ret = 0;
+ debug_fenter();
+
+ ret = _pcm_sound_stop(handle);
+
+ debug_fleave();
+ return ret;
+}
+
+
+EXPORT_API
+int mm_sound_pcm_capture_read(MMSoundPcmHandle_t handle, void *buffer, const unsigned int length )
+{
+ int ret = 0;
+ mm_sound_pcm_t *pcmHandle = (mm_sound_pcm_t*)handle;
+
+ /* Check input param */
+ if(pcmHandle == NULL) {
+ debug_error ("Handle is null, return Invalid Argument\n");
+ ret = MM_ERROR_INVALID_ARGUMENT;
+ goto NULL_HANDLE;
+ }
+ PCM_LOCK_INTERNAL(&pcmHandle->pcm_mutex_internal);
+
+ if(buffer == NULL) {
+ debug_error("Invalid buffer pointer\n");
+ ret = MM_ERROR_SOUND_INVALID_POINTER;
+ goto EXIT;
+ }
+ if(length == 0 ) {
+ debug_error ("length is 0, return 0\n");
+ ret = 0;
+ goto EXIT;
+ }
+
+ /* Check State : return fail if not started */
+ if (!pcmHandle->is_started) {
+ /* not started, return fail */
+ debug_error ("Not started yet, return Invalid State \n");
+ ret = MM_ERROR_SOUND_INVALID_STATE;
+ goto EXIT;
+ }
+
+ /* Read */
+ ret = avsys_audio_read(pcmHandle->audio_handle, buffer, length);
+
+EXIT:
+ PCM_UNLOCK_INTERNAL(&pcmHandle->pcm_mutex_internal);
+NULL_HANDLE:
+ return ret;
+}
+
+EXPORT_API
+int mm_sound_pcm_capture_close(MMSoundPcmHandle_t handle)
+{
+ int result = MM_ERROR_NONE;
+ mm_sound_pcm_t *pcmHandle = (mm_sound_pcm_t*)handle;
+ int errorcode = 0;
+
+ debug_fenter();
+ /* Check input param */
+ if(pcmHandle == NULL) {
+ debug_error ("Handle is null, return Invalid Argument\n");
+ result = MM_ERROR_INVALID_ARGUMENT;
+ goto NULL_HDL;
+ }
+ PCM_LOCK_INTERNAL(&pcmHandle->pcm_mutex_internal);
+ /* Close */
+ result = avsys_audio_close(pcmHandle->audio_handle);
+ if(AVSYS_FAIL(result)) {
+ debug_error("handle close failed 0x%X", result);
+ result = MM_ERROR_SOUND_INTERNAL;
+ goto EXIT;
+ }
+
+ /* Unregister ASM */
+ if(pcmHandle->asm_event != ASM_EVENT_CALL && pcmHandle->asm_event != ASM_EVENT_VIDEOCALL) {
+ if(!ASM_unregister_sound(pcmHandle->asm_handle, pcmHandle->asm_event, &errorcode)) {
+ debug_error("ASM_unregister failed in %s with 0x%x\n", __func__, errorcode);
+ result = MM_ERROR_SOUND_INTERNAL;
+ goto EXIT;
+ }
+ }
+
+ debug_log ("pcm capture sound [%p] closed success!!!\n", handle);
+
+EXIT:
+ PCM_UNLOCK_INTERNAL(&pcmHandle->pcm_mutex_internal);
+NULL_HDL:
+ /* Free handle */
+ if (pcmHandle) {
+ PCM_LOCK_DESTROY_INTERNAL(&pcmHandle->pcm_mutex_internal);
+ free(pcmHandle);
+ pcmHandle = NULL;
+ }
+ debug_fleave();
+ return result;
+}
+
+EXPORT_API
+int mm_sound_pcm_set_message_callback (MMSoundPcmHandle_t handle, MMMessageCallback callback, void *user_param)
+{
+ mm_sound_pcm_t *pcmHandle = (mm_sound_pcm_t*)handle;
+
+ if(pcmHandle == NULL || callback == NULL)
+ return MM_ERROR_INVALID_ARGUMENT;
+
+ pcmHandle->msg_cb = callback;
+ pcmHandle->msg_cb_param = user_param;
+
+ debug_log ("set pcm message callback (%p,%p)\n", callback, user_param);
+
+ return MM_ERROR_NONE;
+}
+
+
+EXPORT_API
+int mm_sound_pcm_play_open_ex (MMSoundPcmHandle_t *handle, const unsigned int rate, MMSoundPcmChannel_t channel, MMSoundPcmFormat_t format, int volume_config, ASM_sound_events_t asm_event)
+{
+ avsys_audio_param_t param;
+ mm_sound_pcm_t *pcmHandle = NULL;
+ int size = 0;
+ int result = AVSYS_STATE_SUCCESS;
+ int errorcode = 0;
+ int volume_type = MM_SOUND_VOLUME_CONFIG_TYPE(volume_config);
+ int ret_mutex = 0;
+
+ debug_fenter();
+ memset(¶m, 0, sizeof(avsys_audio_param_t));
+
+ /* Check input param */
+ if (volume_type < 0 || volume_type >= VOLUME_TYPE_MAX) {
+ debug_error("Volume type is invalid %d\n", volume_type);
+ return MM_ERROR_INVALID_ARGUMENT;
+ }
+ if (rate < _MIN_SYSTEM_SAMPLERATE || rate > _MAX_SYSTEM_SAMPLERATE) {
+ debug_error("unsupported sample rate %u", rate);
+ return MM_ERROR_SOUND_DEVICE_INVALID_SAMPLERATE;
+ } else {
+ param.samplerate = rate;
+ }
+
+ switch(channel)
+ {
+ case MMSOUND_PCM_MONO:
+ param.channels = 1;
+ break;
+ case MMSOUND_PCM_STEREO:
+ param.channels = 2;
+ break;
+ default:
+ debug_error("Unsupported channel type\n");
+ return MM_ERROR_SOUND_DEVICE_INVALID_CHANNEL;
+ }
+
+ switch(format)
+ {
+ case MMSOUND_PCM_U8:
+ param.format = AVSYS_AUDIO_FORMAT_8BIT;
+ break;
+ case MMSOUND_PCM_S16_LE:
+ param.format = AVSYS_AUDIO_FORMAT_16BIT;
+ break;
+ default:
+ debug_error("Unsupported format type\n");
+ return MM_ERROR_SOUND_DEVICE_INVALID_FORMAT;
+ }
+
+ pcmHandle = calloc(sizeof(mm_sound_pcm_t),1);
+ if(pcmHandle == NULL)
+ return MM_ERROR_OUT_OF_MEMORY;
+
+ ret_mutex = pthread_mutex_init(&pcmHandle->pcm_mutex_internal, NULL);
+ if(ret_mutex != 0)
+ {
+ free(pcmHandle);
+ return MM_ERROR_OUT_OF_MEMORY;
+ }
+
+ /* Register ASM */
+ debug_log ("session start : input asm_event = %d-------------\n", asm_event);
+ if (asm_event == ASM_EVENT_MONITOR) {
+ debug_log ("Skip SESSION for event (%d)\n", asm_event);
+ pcmHandle->skip_session = true;
+ } else if (asm_event == ASM_EVENT_NONE) {
+ /* get session type */
+ if(MM_ERROR_NONE != _get_asm_event_type(&pcmHandle->asm_event)) {
+ debug_error ("_get_asm_event_type failed....\n");
+ PCM_LOCK_DESTROY_INTERNAL(&pcmHandle->pcm_mutex_internal);
+ free(pcmHandle);
+ return MM_ERROR_POLICY_INTERNAL;
+ }
+
+ if(pcmHandle->asm_event != ASM_EVENT_CALL && pcmHandle->asm_event != ASM_EVENT_VIDEOCALL) {
+ /* register asm */
+ if(!ASM_register_sound(-1, &pcmHandle->asm_handle, pcmHandle->asm_event,
+ ASM_STATE_NONE, sound_pcm_asm_callback, (void*)pcmHandle, ASM_RESOURCE_NONE, &errorcode)) {
+ debug_error("ASM_register_sound() failed 0x%x\n", errorcode);
+ PCM_LOCK_DESTROY_INTERNAL(&pcmHandle->pcm_mutex_internal);
+ 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_NONE, NULL, (void*)pcmHandle, ASM_RESOURCE_NONE, &errorcode)) {
+ debug_error("ASM_register_sound() failed 0x%x\n", errorcode);
+ PCM_LOCK_DESTROY_INTERNAL(&pcmHandle->pcm_mutex_internal);
+ free(pcmHandle);
+ return MM_ERROR_POLICY_BLOCKED;
+ }
+ }
+
+ param.mode = AVSYS_AUDIO_MODE_OUTPUT;
+ param.vol_type = volume_config;
+ param.priority = AVSYS_AUDIO_PRIORITY_0;
+
+// avsys_audio_ampon();
+
+ /* Open */
+ debug_log ("avsys open -------------\n");
+ result = avsys_audio_open(¶m, &pcmHandle->audio_handle, &size);
+ if(AVSYS_FAIL(result)) {
+ debug_error("Device Open Error 0x%x\n", result);
+ PCM_LOCK_DESTROY_INTERNAL(&pcmHandle->pcm_mutex_internal);
+ free(pcmHandle);
+ return MM_ERROR_SOUND_DEVICE_NOT_OPENED;
+ }
+
+ pcmHandle->is_playback = true;
+
+ /* Set handle to return */
+ *handle = (MMSoundPcmHandle_t)pcmHandle;
+ debug_fleave();
+ return size;
+}
+
+EXPORT_API
+int mm_sound_pcm_play_open_no_session(MMSoundPcmHandle_t *handle, const unsigned int rate, MMSoundPcmChannel_t channel, MMSoundPcmFormat_t format)
+{
+ return mm_sound_pcm_play_open_ex (handle, rate, channel, format, VOLUME_TYPE_SYSTEM, ASM_EVENT_MONITOR);
+}
+
+EXPORT_API
+int mm_sound_pcm_play_open(MMSoundPcmHandle_t *handle, const unsigned int rate, MMSoundPcmChannel_t channel, MMSoundPcmFormat_t format, const volume_type_t vol_type)
+{
+ return mm_sound_pcm_play_open_ex (handle, rate, channel, format, vol_type, ASM_EVENT_NONE);
+}
+
+EXPORT_API
+int mm_sound_pcm_play_start(MMSoundPcmHandle_t handle)
+{
+ int ret = 0;
+ debug_fenter();
+
+ ret = _pcm_sound_start (handle);
+
+ debug_fleave();
+ return ret;
+
+}
+
+
+EXPORT_API
+int mm_sound_pcm_play_stop(MMSoundPcmHandle_t handle)
+{
+ int ret = 0;
+ debug_fenter();
+
+ ret = _pcm_sound_stop(handle);
+
+ debug_fleave();
+ return ret;
+}
+
+
+EXPORT_API
+int mm_sound_pcm_play_write(MMSoundPcmHandle_t handle, void* ptr, unsigned int length_byte)
+{
+ int ret = 0;
+ mm_sound_pcm_t *pcmHandle = (mm_sound_pcm_t*)handle;
+
+ /* Check input param */
+ if(pcmHandle == NULL) {
+ debug_error ("Handle is null, return Invalid Argument\n");
+ ret = MM_ERROR_INVALID_ARGUMENT;
+ goto NULL_HANDLE;
+ }
+
+ PCM_LOCK_INTERNAL(&pcmHandle->pcm_mutex_internal);
+
+ if(ptr == NULL) {
+ debug_error("Invalid buffer pointer\n");
+ ret = MM_ERROR_SOUND_INVALID_POINTER;
+ goto EXIT;
+ }
+ if(length_byte == 0 ) {
+ debug_error ("length is 0, return 0\n");
+ ret = 0;
+ goto EXIT;
+ }
+
+ /* Check State : return fail if not started */
+ if (!pcmHandle->is_started) {
+ /* not started, return fail */
+ debug_error ("Not started yet, return Invalid State \n");
+ ret = MM_ERROR_SOUND_INVALID_STATE;
+ goto EXIT;
+ }
+
+ /* Write */
+ ret = avsys_audio_write(pcmHandle->audio_handle, ptr, length_byte);
+
+EXIT:
+ PCM_UNLOCK_INTERNAL(&pcmHandle->pcm_mutex_internal);
+NULL_HANDLE:
+ return ret;
+}
+
+EXPORT_API
+int mm_sound_pcm_play_close(MMSoundPcmHandle_t handle)
+{
+ int result = MM_ERROR_NONE;
+ mm_sound_pcm_t *pcmHandle = (mm_sound_pcm_t*)handle;
+ int errorcode = 0;
+
+ debug_fenter();
+ /* Check input param */
+ if(pcmHandle == NULL) {
+ debug_error ("Handle is null, return Invalid Argument\n");
+ result = MM_ERROR_INVALID_ARGUMENT;
+ goto NULL_HANDLE;
+ }
+ PCM_LOCK_INTERNAL(&pcmHandle->pcm_mutex_internal);
+ /* Drain if needed */
+ if (pcmHandle->is_started) {
+ /* stop() is not called before close(), drain is needed */
+ if(AVSYS_FAIL(avsys_audio_drain(pcmHandle->audio_handle))) {
+ debug_error("drain failed\n");
+ result = MM_ERROR_SOUND_INTERNAL;
+ goto EXIT;
+ }
+ }
+ pcmHandle->is_started = false;
+ /* Close */
+ result = avsys_audio_close(pcmHandle->audio_handle);
+ if(AVSYS_FAIL(result)) {
+ debug_error("handle close failed 0x%X", result);
+ result = MM_ERROR_SOUND_INTERNAL;
+ goto EXIT;
+ }
+
+ if (pcmHandle->skip_session == false) {
+ /* Unregister ASM */
+ if(pcmHandle->asm_event != ASM_EVENT_CALL && pcmHandle->asm_event != ASM_EVENT_VIDEOCALL) {
+ if(!ASM_unregister_sound(pcmHandle->asm_handle, pcmHandle->asm_event, &errorcode)) {
+ debug_error("ASM_unregister failed in %s with 0x%x\n",__func__, errorcode);
+ result = MM_ERROR_SOUND_INTERNAL;
+ goto EXIT;
+ }
+ }
+ }
+
+ debug_log ("pcm play sound [%p] closed success!!!\n", handle);
+
+
+EXIT:
+ PCM_UNLOCK_INTERNAL(&pcmHandle->pcm_mutex_internal);
+NULL_HANDLE:
+ if (pcmHandle) {
+ /* Free handle */
+ PCM_LOCK_DESTROY_INTERNAL(&pcmHandle->pcm_mutex_internal);
+ free(pcmHandle);
+ pcmHandle= NULL;
+ }
+ debug_fleave();
+ return result;
+}
+
+///////////////////////////////////
+//// MMSOUND PLAY APIs
+///////////////////////////////////
+static inline void _mm_sound_fill_play_param(MMSoundPlayParam *param, const char *filename, int volume_config, mm_sound_stop_callback_func callback, void *data, int priority, int handle_route)
+{
+ param->filename = filename;
+ param->volume = 0; //volume value dose not effect anymore
+ param->callback = callback;
+ param->data = data;
+ param->loop = 1;
+ param->volume_config = volume_config;
+ param->priority = priority;
+ param->handle_route = handle_route;
+}
+
+EXPORT_API
+int mm_sound_play_loud_solo_sound_no_restore(const char *filename, int volume_config, mm_sound_stop_callback_func callback, void *data, int *handle)
+{
+ MMSoundPlayParam param = { 0, };
+
+ _mm_sound_fill_play_param(¶m, filename, volume_config, callback, data, AVSYS_AUDIO_PRIORITY_SOLO, MM_SOUND_HANDLE_ROUTE_SPEAKER_NO_RESTORE);
+ return mm_sound_play_sound_ex(¶m, handle);
+}
+
+EXPORT_API
+int mm_sound_play_loud_solo_sound(const char *filename, int volume_config, mm_sound_stop_callback_func callback, void *data, int *handle)
+{
+ MMSoundPlayParam param = { 0, };
+
+ _mm_sound_fill_play_param(¶m, filename, volume_config, callback, data, AVSYS_AUDIO_PRIORITY_SOLO, MM_SOUND_HANDLE_ROUTE_SPEAKER);
+ return mm_sound_play_sound_ex(¶m, handle);
+}
+
+EXPORT_API
+int mm_sound_play_solo_sound(const char *filename, int volume_config, mm_sound_stop_callback_func callback, void *data, int *handle)
+{
+ MMSoundPlayParam param = { 0, };
+
+ _mm_sound_fill_play_param(¶m, filename, volume_config, callback, data, AVSYS_AUDIO_PRIORITY_SOLO, MM_SOUND_HANDLE_ROUTE_USING_CURRENT);
+ return mm_sound_play_sound_ex(¶m, handle);
+}
+
+EXPORT_API
+int mm_sound_play_sound(const char *filename, int volume_config, mm_sound_stop_callback_func callback, void *data, int *handle)
+{
+ MMSoundPlayParam param = { 0, };
+
+ _mm_sound_fill_play_param(¶m, filename, volume_config, callback, data, AVSYS_AUDIO_PRIORITY_NORMAL, MM_SOUND_HANDLE_ROUTE_USING_CURRENT);
+ return mm_sound_play_sound_ex(¶m, handle);
+}
+
+EXPORT_API
+int mm_sound_play_sound_ex(MMSoundPlayParam *param, int *handle)
+{
+ int err;
+ int lhandle = -1;
+ int volume_type = MM_SOUND_VOLUME_CONFIG_TYPE(param->volume_config);
+
+ debug_fenter();
+
+ /* Check input param */
+ if (param == NULL) {
+ debug_error("param is null\n");
+ return MM_ERROR_INVALID_ARGUMENT;
+ }
+ if (param->filename == NULL) {
+ debug_error("filename is NULL\n");
+ return MM_ERROR_SOUND_FILE_NOT_FOUND;
+ }
+ if (volume_type < 0 || volume_type >= VOLUME_TYPE_MAX) {
+ debug_error("Volume type is invalid %d\n", volume_type);
+ return MM_ERROR_INVALID_ARGUMENT;
+ }
+
+ /* Play sound */
+ err = MMSoundClientPlaySound(param, 0, 0, &lhandle);
+ if (err < 0) {
+ debug_error("Failed to play sound\n");
+ return err;
+ }
+
+ /* Set handle to return */
+ if (handle) {
+ *handle = lhandle;
+ } else {
+ debug_critical("The sound hadle cannot be get [%d]\n", lhandle);
+ }
+
+ debug_fleave();
+ return MM_ERROR_NONE;
+}
+
+
+EXPORT_API
+int mm_sound_stop_sound(int handle)
+{
+ int err;
+
+ debug_fenter();
+
+ /* Stop sound */
+ err = MMSoundClientStopSound(handle);
+ if (err < 0) {
+ debug_error("Fail to stop sound\n");
+ return err;
+ }
+
+ debug_fleave();
+ return MM_ERROR_NONE;
+}
+
+///////////////////////////////////
+//// MMSOUND TONE APIs
+///////////////////////////////////
+EXPORT_API
+int mm_sound_play_tone (MMSoundTone_t num, int volume_config, const double volume, const int duration, int *handle)
+{
+ int lhandle = -1;
+ int err = MM_ERROR_NONE;
+ int volume_type = MM_SOUND_VOLUME_CONFIG_TYPE(volume_config);
+
+ debug_fenter();
+
+ /* Check input param */
+ if (duration < -1) {
+ debug_error("number is invalid %d\n", duration);
+ return MM_ERROR_INVALID_ARGUMENT;
+ }
+ if (num < MM_SOUND_TONE_DTMF_0 || num >= MM_SOUND_TONE_NUM) {
+ debug_error("TONE Value is invalid %d\n", num);
+ return MM_ERROR_INVALID_ARGUMENT;
+ }
+ if (volume_type < 0 || volume_type >= VOLUME_TYPE_MAX) {
+ debug_error("Volume type is invalid %d\n", volume_type);
+ return MM_ERROR_INVALID_ARGUMENT;
+ }
+ if (volume < 0.0 || volume > 1.0) {
+ debug_error("Volume Value is invalid %d\n", volume);
+ return MM_ERROR_INVALID_ARGUMENT;
+ }
+
+ /* Play tone */
+ debug_msg("Call MMSoundClientPlayTone\n");
+ err = MMSoundClientPlayTone(num, volume_config, volume, duration, &lhandle);
+ if (err < 0) {
+ debug_error("Failed to play sound\n");
+ return err;
+ }
+
+ /* Set handle to return */
+ if (handle)
+ *handle = lhandle;
+ else
+ debug_critical("The sound handle cannot be get [%d]\n", lhandle);
+
+ debug_fleave();
+ return MM_ERROR_NONE;
+}
+
+///////////////////////////////////
+//// MMSOUND ROUTING APIs
+///////////////////////////////////
+EXPORT_API
+int mm_sound_set_path(int gain, int output, int input, int option)
+{
+ int err;
+
+ debug_fenter();
+
+ debug_msg("gain: 0x%02X, output: %d, input: %d, option: 0x%x\n", gain, output, input, option);
+
+ err = avsys_audio_set_path_ex( gain, output, input, option);
+ if (err < 0) {
+ debug_error("avsys_audio_set_path() failed\n");
+ return MM_ERROR_SOUND_INTERNAL;
+ }
+
+ debug_fleave();
+ return MM_ERROR_NONE;
+}
+
+EXPORT_API
+int mm_sound_get_path(int *gain, int *output, int *input, int *option)
+{
+ int err;
+
+ debug_fenter();
+
+ err = avsys_audio_get_path_ex( gain, output, input, option);
+ if (err < 0) {
+ debug_error("SoundCtlPathGet() failed\n");
+ return MM_ERROR_SOUND_INTERNAL;
+ }
+
+ debug_msg("gain: 0x%02X, output: %d, input: %d, option: 0x%x\n", *gain, *output, *input, *option);
+
+ debug_fleave();
+ return MM_ERROR_NONE;
+}
+
+#ifdef PULSE_CLIENT
+enum {
+ USE_PA_SINK_ALSA = 0,
+ USE_PA_SINK_A2DP,
+};
+EXPORT_API
+int mm_sound_route_set_system_policy (system_audio_route_t route)
+{
+ return MM_ERROR_NONE;
+}
+
+
+EXPORT_API
+int mm_sound_route_get_system_policy (system_audio_route_t *route)
+{
+ return MM_ERROR_NONE;
+}
+
+
+EXPORT_API
+int mm_sound_route_get_a2dp_status (bool *connected, char **bt_name)
+{
+ int ret = MM_ERROR_NONE;
+
+ debug_fenter();
+
+ if (connected == NULL || bt_name == NULL) {
+ debug_error ("argument is not valid\n");
+ return MM_ERROR_INVALID_ARGUMENT;
+ }
+
+ ret = MMSoundClientIsBtA2dpOn (connected, bt_name);
+ debug_msg ("connected=[%d] bt_name[%s]\n", *connected, *bt_name);
+ if (ret < 0) {
+ 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)
+{
+ 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(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(device_out)
+ {
+ case MM_SOUND_DEVICE_OUT_SPEAKER:
+ *dev = SYSTEM_AUDIO_ROUTE_PLAYBACK_DEVICE_HANDSET;
+ break;
+ case MM_SOUND_DEVICE_OUT_BT_A2DP:
+ *dev = SYSTEM_AUDIO_ROUTE_PLAYBACK_DEVICE_BLUETOOTH;
+ break;
+ case MM_SOUND_DEVICE_OUT_WIRED_ACCESSORY:
+ *dev = SYSTEM_AUDIO_ROUTE_PLAYBACK_DEVICE_EARPHONE;
+ break;
+ default:
+ *dev = SYSTEM_AUDIO_ROUTE_PLAYBACK_DEVICE_NONE;
+ break;
+ }
+
+ 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;
+}
+
+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;
+
+ 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;
+ }
+
+ 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;
+
+ 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;
+ }
+
+ ret = _mm_sound_client_is_route_available(route, is_available);
+ if (ret < 0) {
+ debug_error("Can not check given route is available\n");
+ }
+
+ debug_fleave();
+ return ret;
+}
+
+EXPORT_API
+int mm_sound_foreach_available_route_cb(mm_sound_available_route_cb available_route_cb, void *user_data)
+{
+ int ret = MM_ERROR_NONE;
+
+ debug_fenter();
+
+ 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_set_active_route(mm_sound_route route)
+{
+ int ret = MM_ERROR_NONE;
+
+ debug_fenter();
+
+ 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;
+}
+
+
+EXPORT_API
+int mm_sound_get_active_device(mm_sound_device_in *device_in, mm_sound_device_out *device_out)
+{
+ int ret = MM_ERROR_NONE;
+
+ debug_fenter();
+
+ if (device_in == NULL || device_out == NULL) {
+ debug_error("argument is not valid\n");
+ return MM_ERROR_INVALID_ARGUMENT;
+ }
+
+ ret = _mm_sound_client_get_active_device(device_in, device_out);
+ if (ret < 0) {
+ debug_error("Can not add active device callback\n");
+ }
+
+ debug_fleave();
+ return ret;
+}
+
+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))
+void __mmfsnd_finalize(void)
+{
+ debug_fenter();
+
+ MMSoundClientCallbackFini();
+
+ debug_fleave();
+}
+
+__attribute__ ((constructor))
+void __mmfsnd_initialize(void)
+{
+ /* Will be Fixed */
+}
--- /dev/null
+/*
+ * 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 <sys/shm.h>
+#include <sys/mman.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <sys/msg.h>
+#include <assert.h>
+#include <errno.h>
+
+#include <pthread.h>
+#include <semaphore.h>
+
+#include <mm_error.h>
+#include <mm_debug.h>
+
+#include "include/mm_sound.h"
+#include "include/mm_sound_msg.h"
+#include "include/mm_sound_client.h"
+
+#include <mm_session.h>
+#include <mm_session_private.h>
+
+#define __DIRECT_CALLBACK__
+//#define __GIDLE_CALLBACK__
+
+#include <glib.h>
+#if defined(__GSOURCE_CALLBACK__)
+#include <sys/poll.h>
+#endif
+
+#define MEMTYPE_SUPPORT_MAX (1024 * 1024) /* 1MB */
+#define MEMTYPE_TRANS_PER_MAX (128 * 1024) /* 128K */
+
+
+int g_msg_scsnd; /* global msg queue id sound client snd */
+int g_msg_scrcv; /* global msg queue id sound client rcv */
+int g_msg_sccb; /* global msg queue id sound client callback */
+
+/* callback */
+struct __callback_param
+{
+ mm_sound_stop_callback_func callback;
+ void *data;
+};
+
+pthread_t g_thread;
+static int g_exit_thread = 0;
+int g_thread_id = -1;
+int g_mutex_initted = -1;
+pthread_mutex_t g_thread_mutex;
+
+static void* callbackfunc(void *param);
+
+/* manage IPC (msg contorl) */
+static int __MMIpcCBSndMsg(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 __MMIpcCBRecvMsg(int msgtype, mm_ipc_msg_t *msg);
+static int __MMSoundGetMsg(void);
+
+int MMSoundClientInit(void)
+{
+ int ret = MM_ERROR_NONE;
+ debug_fenter();
+
+ debug_fleave();
+ return ret;
+}
+
+int MMSoundClientCallbackFini(void)
+{
+ mm_ipc_msg_t msgsnd={0,};
+ int ret = MM_ERROR_NONE;
+
+ debug_fenter();
+
+ /* When the the callback thread is not created, do not wait destory thread */
+ /* g_thread_id is initialized : -1 */
+ /* g_thread_id is set to 0, when the callback thread is created */
+ if (g_thread_id != -1)
+ {
+ msgsnd.sound_msg.msgtype = MM_SOUND_MSG_INF_DESTROY_CB;
+ msgsnd.sound_msg.msgid = getpid();
+ ret = __MMIpcCBSndMsg(&msgsnd);
+ if (ret != MM_ERROR_NONE)
+ {
+ debug_critical("[Client] Fail to send message\n");
+ }
+ /* wait for leave callback thread */
+ while (g_exit_thread == 0)
+ usleep(30000);
+ g_exit_thread = 0;
+ }
+
+ if (g_mutex_initted != -1)
+ {
+ pthread_mutex_destroy(&g_thread_mutex);
+ g_mutex_initted = -1;
+ }
+ debug_fleave();
+ return MM_ERROR_NONE;
+}
+
+#if defined(__GSOURCE_CALLBACK__)
+gboolean sndcb_fd_check(GSource * source)
+{
+ GSList *fd_list;
+ fd_list = source->poll_fds;
+ GPollFD* temp;
+
+ do
+ {
+ temp = (GPollFD*)fd_list->data;
+ if (temp->revents & (POLLIN|POLLPRI))
+ return TRUE;
+ fd_list = fd_list->next;
+ }while(fd_list);
+
+ return FALSE; /* there is no change in any fd state */
+}
+
+gboolean sndcb_fd_prepare(GSource *source, gint *timeout)
+{
+ return FALSE;
+}
+
+gboolean sndcb_fd_dispatch(GSource *source, GSourceFunc callback, gpointer user_data)
+{
+ callback(user_data);
+ return TRUE;
+}
+#endif
+gboolean RunCallback(gpointer *data)
+{
+ mm_ipc_msg_t* msg = NULL;
+
+ debug_msg("[Client] execute mm_sound stop callback function\n");
+
+ msg = (mm_ipc_msg_t*)data;
+ ((mm_sound_stop_callback_func)msg->sound_msg.callback)(msg->sound_msg.cbdata);
+
+ return FALSE;
+}
+
+static void* callbackfunc(void *param)
+{
+ int ret = MM_ERROR_SOUND_INTERNAL;
+ mm_ipc_msg_t *msgrcv = NULL;
+ int run = 1;
+ int instance;
+
+ 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)
+ {
+ debug_critical("[Client] Failed to memory allocation\n");
+ return NULL;
+ }
+
+ while(run)
+ {
+#if defined(__GSOURCE_CALLBACK__)
+ int eventFd = 0;
+ gchar* eventFile = NULL;
+ GSource* cmd_fd_gsrc = NULL;
+ GSourceFuncs *src_funcs = NULL; // handler function
+ guint gsource_handle;
+ GPollFD *g_fd_cmd = NULL; // file descriptor
+#endif
+
+ 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:
+ 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)
+ {
+#if defined(__DIRECT_CALLBACK__)
+ ((mm_sound_stop_callback_func)msgrcv->sound_msg.callback)(msgrcv->sound_msg.cbdata);
+#elif defined(__GIDLE_CALLBACK__)
+ guint eventid = 0;
+ eventid = g_idle_add((GSourceFunc)RunCallback, (gpointer)msgrcv);
+ debug_msg("[Client] Event Source ID : %d\n", eventid);
+
+#elif defined(__GSOURCE_CALLBACK__)
+ char eventBuf[3]="OK";
+ ////////////////////////
+ // 0. Make event source
+ eventFile = g_strdup_printf("/tmp/%d_0x%08x_0x%08x", instance, (unsigned int)msgrcv->sound_msg.callback, (unsigned int)msgrcv->sound_msg.cbdata);
+ eventFd = open(eventFile, O_RDWR|O_CREAT);
+ if(eventFd == -1)
+ {
+ debug_critical("Event File creation failed\n");
+ break;
+ }
+
+ // 1. make GSource Object
+ src_funcs = (GSourceFuncs *)g_malloc(sizeof(GSourceFuncs));
+ if(!src_funcs){
+ debug_error("MMSoundCallback : g_malloc failed on g_src_funcs");
+ break;
+ }
+ src_funcs->prepare = sndcb_fd_prepare;
+ src_funcs->check = sndcb_fd_check;
+ src_funcs->dispatch = sndcb_fd_dispatch;
+ src_funcs->finalize = NULL;
+ cmd_fd_gsrc = g_source_new(src_funcs,sizeof(GSource));
+ if(!cmd_fd_gsrc){
+ debug_error("MMSoundCallback : g_malloc failed on m_readfd");
+ break;
+ }
+
+ // 2. add file description which used in g_loop()
+ g_fd_cmd = (GPollFD*)g_malloc(sizeof(GPollFD));
+ g_fd_cmd->fd = eventFd;
+ g_fd_cmd->events = POLLIN|POLLPRI;
+
+ // 3. combine g_source object and file descriptor
+ g_source_add_poll(cmd_fd_gsrc,g_fd_cmd);
+ gsource_handle = g_source_attach(cmd_fd_gsrc, NULL);
+ if(!gsource_handle){
+ debug_error("MMSoundCallback : Error: Failed to attach the source to context");
+ break;
+ }
+
+ // 4. set callback
+ g_source_set_callback(cmd_fd_gsrc,RunCallback,(gpointer)g_fd_cmd,NULL);
+ debug_msg("MMSoundCallback : g_source_set_callback() done\n")
+
+ // 5. Set Event
+ write(eventFd, eventBuf, sizeof(eventBuf));
+ sleep(1);
+ // 6. Cleanup
+ close(eventFd);
+ unlink(eventFile);
+ g_source_remove_poll(cmd_fd_gsrc, g_fd_cmd);
+ g_source_remove(gsource_handle);
+ if(g_fd_cmd)
+ free(g_fd_cmd);
+ if(src_funcs)
+ free(src_funcs);
+ if(eventFile)
+ g_free(eventFile);
+ ////////////////////////
+#endif
+ }
+ break;
+ 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_fleave();
+ return NULL;
+}
+
+static int __mm_sound_client_get_msg_queue(void)
+{
+ int ret = MM_ERROR_NONE;
+
+ 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;
+}
+
+int MMSoundClientPlayTone(int number, int volume_config, 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))
+ {
+ debug_warning("[Client] Read MMSession Type failed. use default \"share\" type\n");
+ sessionType = MM_SESSION_TYPE_SHARE;
+
+ if(MM_ERROR_NONE != mm_session_init(sessionType))
+ {
+ debug_critical("[Client] MMSessionInit() failed\n");
+ return MM_ERROR_POLICY_INTERNAL;
+ }
+ }
+
+ instance = getpid();
+ debug_msg("[Client] pid for client ::: [%d]\n", instance);
+
+ pthread_mutex_lock(&g_thread_mutex);
+
+ /* Send msg */
+ debug_msg("[Client] Input number : %d\n", number);
+ /* Send req memory */
+ msgsnd.sound_msg.msgtype = MM_SOUND_MSG_REQ_DTMF;
+ msgsnd.sound_msg.msgid = instance;
+ msgsnd.sound_msg.session_type = sessionType;//asm_session_type;
+ msgsnd.sound_msg.volume = volume;//This does not effect anymore
+ msgsnd.sound_msg.volume_config = volume_config;
+ msgsnd.sound_msg.tone = number;
+ msgsnd.sound_msg.handle = -1;
+ msgsnd.sound_msg.repeat = time;
+
+ ret = __MMIpcSndMsg(&msgsnd);
+ if (ret != MM_ERROR_NONE)
+ {
+ debug_error("[Client] Fail to send msg\n");
+ goto cleanup;
+ }
+
+ /* Receive */
+ ret = __MMIpcRecvMsg(instance, &msgrcv);
+ if (ret != MM_ERROR_NONE)
+ {
+ debug_error("[Client] Fail to recieve msg\n");
+ goto cleanup;
+ }
+
+ switch (msgrcv.sound_msg.msgtype)
+ {
+ case MM_SOUND_MSG_RES_DTMF:
+ *handle = msgrcv.sound_msg.handle;
+ if(*handle == -1)
+ debug_error("[Client] The handle is not get\n");
+
+ debug_msg("[Client] Success to play sound sound handle : [%d]\n", *handle);
+ 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 MMSoundClientPlaySound(MMSoundPlayParam *param, int tone, int keytone, int *handle)
+{
+ mm_ipc_msg_t msgrcv = {0,};
+ mm_ipc_msg_t msgsnd = {0,};
+ unsigned char* sharedmem = NULL;
+
+ int ret = MM_ERROR_NONE;
+ int instance = -1; /* instance is unique to communicate with server : client message queue filter type */
+
+ char shm_name[512];
+ void *mmap_buf = NULL;
+ static int keybase = 0;
+ int shm_fd = -1;
+
+ debug_fenter();
+ memset(shm_name, 0, sizeof(shm_name));
+
+ ret = __mm_sound_client_get_msg_queue();
+ if (ret != 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))
+ {
+ debug_warning("[Client] Read MMSession Type failed. use default \"share\" type\n");
+ sessionType = MM_SESSION_TYPE_SHARE;
+
+ if(MM_ERROR_NONE != mm_session_init(sessionType))
+ {
+ debug_critical("[Client] MMSessionInit() failed\n");
+ return MM_ERROR_POLICY_INTERNAL;
+ }
+ }
+
+
+ instance = getpid();
+ debug_msg("[Client] pid for client ::: [%d]\n", instance);
+
+ /* callback */
+ /* callback thread is created just once & when the callback is exist */
+ if (param->callback)
+ {
+ if (g_thread_id == -1)
+ {
+ 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));
+ return MM_ERROR_SOUND_INTERNAL;
+ }
+ }
+ }
+
+ pthread_mutex_lock(&g_thread_mutex);
+
+ /* Send msg */
+ if ((param->mem_ptr && param->mem_size))
+ {
+ debug_msg("The memptr : [%p]\n", param->mem_ptr);
+ debug_msg("The memptr : [%d]\n", param->mem_size);
+ /* Limitted memory size */
+ if (param->mem_ptr && param->mem_size > MEMTYPE_SUPPORT_MAX)
+ {
+ debug_msg("[Client] Memory size is too big. We support size of media to 1MB\n");
+ goto cleanup;
+ }
+
+ debug_msg("[Client] memory size : %d\n", param->mem_size);
+ snprintf(shm_name, sizeof(shm_name)-1, "%d_%d", instance, keybase);
+ debug_msg("[Client] The shm_path : [%s]\n", shm_name);
+ keybase++;
+
+ shm_fd = shm_open(shm_name, O_RDWR |O_CREAT, 0666);
+ if(shm_fd < 0)
+ {
+ perror("[Client] Fail create shm_open\n");
+ debug_error("[Client] Fail to create shm_open\n");
+ goto cleanup;
+ }
+
+ if(ftruncate(shm_fd, param->mem_size) == -1)
+ {
+ debug_error("[Client] Fail to ftruncate\n");
+ goto cleanup;
+ }
+
+ mmap_buf = mmap (0, MEMTYPE_SUPPORT_MAX, PROT_READ | PROT_WRITE, MAP_SHARED, shm_fd, 0);
+ if (mmap_buf == MAP_FAILED)
+ {
+ debug_error("[Client] MMAP failed \n");
+ goto cleanup;
+ }
+
+ sharedmem = mmap_buf;
+
+ if(ret != MM_ERROR_NONE)
+ {
+ debug_error("[Client] Not allocated shared memory");
+ goto cleanup;
+ }
+ debug_msg("[Client] Sheared mem ptr : %p\n", sharedmem);
+ debug_msg("[Client] Sheared key : [%d]\n", 1);
+ /* Send req memory */
+ msgsnd.sound_msg.msgtype = MM_SOUND_MSG_REQ_MEMORY;
+ msgsnd.sound_msg.msgid = instance;
+ msgsnd.sound_msg.callback = (void*)(param->callback);
+ msgsnd.sound_msg.cbdata = (void*)(param->data);
+ msgsnd.sound_msg.memptr = (int)sharedmem;
+ msgsnd.sound_msg.sharedkey = 1; /* In case of shared memory file name */
+ msgsnd.sound_msg.session_type = sessionType;//asm_session_type;
+ msgsnd.sound_msg.priority = param->priority;
+
+
+ strncpy(msgsnd.sound_msg.filename, shm_name, 512);
+ debug_msg("[Client] shm_name : %s\n", msgsnd.sound_msg.filename);
+
+ msgsnd.sound_msg.memsize = param->mem_size;
+ msgsnd.sound_msg.volume = param->volume;
+ msgsnd.sound_msg.tone = tone;
+ msgsnd.sound_msg.handle = -1;
+ msgsnd.sound_msg.repeat = param->loop;
+ msgsnd.sound_msg.volume_config = param->volume_config;
+ msgsnd.sound_msg.keytone = keytone;
+ 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);
+ memcpy(sharedmem, param->mem_ptr, param->mem_size);
+
+
+ if (close(shm_fd) == -1)
+ {
+ debug_error("[Client] Fail to close file\n");
+ ret = MM_ERROR_SOUND_INTERNAL;
+ goto cleanup;
+ }
+
+ ret = __MMIpcSndMsg(&msgsnd);
+ if (ret != MM_ERROR_NONE)
+ {
+ debug_error("[Client] Fail to send msg\n");
+ goto cleanup;
+ }
+ }
+ else
+ {
+ /* File type set for send msg */
+ msgsnd.sound_msg.msgtype = MM_SOUND_MSG_REQ_FILE;
+ msgsnd.sound_msg.msgid = instance;
+ msgsnd.sound_msg.callback = (void*)(param->callback);
+ msgsnd.sound_msg.cbdata = (void*)(param->data);
+ msgsnd.sound_msg.volume = param->volume;
+ msgsnd.sound_msg.tone = tone;
+ msgsnd.sound_msg.handle = -1;
+ msgsnd.sound_msg.repeat = param->loop;
+ msgsnd.sound_msg.volume_config = param->volume_config;
+ msgsnd.sound_msg.session_type = sessionType;//asm_session_type;
+ msgsnd.sound_msg.priority = param->priority;
+ msgsnd.sound_msg.handle_route = param->handle_route;
+
+ if((strlen(param->filename)) < FILE_PATH)
+ {
+ strncpy(msgsnd.sound_msg.filename, param->filename, sizeof(msgsnd.sound_msg.filename)-1);
+ }
+ else
+ {
+ debug_error("File name is over count\n");
+ ret = MM_ERROR_SOUND_INVALID_PATH;
+ }
+
+ msgsnd.sound_msg.keytone = keytone;
+
+ debug_msg("[Client] callback : %p\n", msgsnd.sound_msg.callback);
+ debug_msg("[Client] cbdata : %p\n", msgsnd.sound_msg.cbdata);
+
+ ret = __MMIpcSndMsg(&msgsnd);
+ if (ret != MM_ERROR_NONE)
+ {
+ debug_error("[Client] Fail to send msg\n");
+ goto cleanup;
+ }
+ }
+
+
+ /* Receive */
+ ret = __MMIpcRecvMsg(instance, &msgrcv);
+ if (ret != MM_ERROR_NONE)
+ {
+ debug_error("[Client] Fail to recieve msg\n");
+ goto cleanup;
+ }
+
+ switch (msgrcv.sound_msg.msgtype)
+ {
+ case MM_SOUND_MSG_RES_FILE:
+ *handle = msgrcv.sound_msg.handle;
+ debug_msg("[Client] Success to play sound sound handle : [%d]\n", *handle);
+ break;
+ case MM_SOUND_MSG_RES_MEMORY:
+ *handle = msgrcv.sound_msg.handle;
+ if(*handle == -1)
+ debug_error("[Client] The handle is not get\n");
+
+ shm_unlink(shm_name);
+ if (ret != MM_ERROR_NONE)
+ {
+ debug_critical("[Client] Fail to remove shared memory, must be checked\n");
+ goto cleanup;
+ }
+ debug_msg("[Client] Success to play sound sound handle : [%d]\n", *handle);
+ 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 MMSoundClientStopSound(int handle)
+{
+ mm_ipc_msg_t msgrcv = {0,};
+ mm_ipc_msg_t msgsnd = {0,};
+ int ret = MM_ERROR_NONE;
+ int instance;
+
+ debug_fenter();
+ debug_msg("[Client] The stop audio handle ::: [%d]\n", handle);
+
+ instance = getpid();
+
+ if (handle < 0)
+ {
+ ret = MM_ERROR_INVALID_ARGUMENT;
+ return ret;
+ }
+
+ 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_STOP;
+ msgsnd.sound_msg.msgid = instance;
+ msgsnd.sound_msg.handle = handle; /* handle means audio handle slot id */
+
+ ret = __MMIpcSndMsg(&msgsnd);
+ if (ret != MM_ERROR_NONE)
+ {
+ debug_error("Fail to send msg\n");
+ goto cleanup;
+ }
+
+ /* Recieve */
+ ret = __MMIpcRecvMsg(instance, &msgrcv);
+ if (ret != MM_ERROR_NONE)
+ {
+ debug_error("[Client] Fail to recieve msg\n");
+ goto cleanup;
+ }
+ switch (msgrcv.sound_msg.msgtype)
+ {
+ case MM_SOUND_MSG_RES_STOP:
+ debug_msg("[Client] Success to stop sound\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);
+
+
+ debug_fleave();
+ return ret;
+}
+
+int _mm_sound_client_is_route_available(mm_sound_route route, bool *is_available)
+{
+ 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)
+ {
+ 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;
+ }
+
+cleanup:
+ pthread_mutex_unlock(&g_thread_mutex);
+
+ debug_fleave();
+ return ret;
+}
+
+static int _handle_foreach_callback(mm_ipc_msg_t *msg)
+{
+ int route_index;
+ mm_sound_route route;
+
+ 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 < MM_SOUND_ROUTE_NUM; 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;
+}
+
+int _mm_sound_client_foreach_available_route_cb(mm_sound_available_route_cb available_route_cb, void *user_data)
+{
+ 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_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;
+ }
+
+cleanup:
+ pthread_mutex_unlock(&g_thread_mutex);
+
+ debug_fleave();
+ return ret;
+}
+
+int _mm_sound_client_set_active_route(mm_sound_route route)
+{
+ 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_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;
+ }
+
+cleanup:
+ pthread_mutex_unlock(&g_thread_mutex);
+
+ debug_fleave();
+ return ret;
+}
+
+int _mm_sound_client_get_active_device(mm_sound_device_in *device_in, mm_sound_device_out *device_out)
+{
+ 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;
+
+ switch (msgrcv.sound_msg.msgtype)
+ {
+ 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;
+ }
+
+cleanup:
+ pthread_mutex_unlock(&g_thread_mutex);
+
+ debug_fleave();
+ return ret;
+}
+
+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_fenter();
+
+ if (__mm_sound_client_get_msg_queue() != MM_ERROR_NONE)
+ return ret;
+
+ pthread_mutex_lock(&g_thread_mutex);
+
+ 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)
+ {
+ 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);
+
+ 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;
+
+ 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_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");
+ 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_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_fenter();
+
+ if (__mm_sound_client_get_msg_queue() != MM_ERROR_NONE)
+ return ret;
+
+ pthread_mutex_lock(&g_thread_mutex);
+
+ 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)
+ {
+ 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);
+
+ 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;
+
+ 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_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);
+
+ 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 (bool *connected, char** bt_name)
+{
+ mm_ipc_msg_t msgrcv = {0,};
+ mm_ipc_msg_t msgsnd = {0,};
+ int ret = MM_ERROR_NONE;
+ int instance;
+
+ debug_fenter();
+
+ instance = getpid();
+
+ if (__mm_sound_client_get_msg_queue() != MM_ERROR_NONE)
+ return ret;
+
+ pthread_mutex_lock(&g_thread_mutex);
+
+ /* Send req */
+ msgsnd.sound_msg.msgtype = MM_SOUND_MSG_REQ_IS_BT_A2DP_ON;
+ msgsnd.sound_msg.msgid = instance;
+
+ ret = __MMIpcSndMsg(&msgsnd);
+ if (ret != MM_ERROR_NONE)
+ {
+ debug_error("Fail to send msg\n");
+ goto cleanup;
+ }
+
+ /* Recieve */
+ ret = __MMIpcRecvMsg(instance, &msgrcv);
+ if (ret != MM_ERROR_NONE)
+ {
+ debug_error("Fail to recieve msg\n");
+ goto cleanup;
+ }
+ switch (msgrcv.sound_msg.msgtype)
+ {
+ case MM_SOUND_MSG_RES_IS_BT_A2DP_ON:
+ debug_msg("Success to get IS_BT_A2DP_ON [%d][%s]\n", msgrcv.sound_msg.code, msgrcv.sound_msg.filename);
+ *connected = (bool)msgrcv.sound_msg.code;
+ if (*connected)
+ *bt_name = strdup (msgrcv.sound_msg.filename);
+ else
+ *bt_name = NULL;
+ 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;
+ }
+
+cleanup:
+ pthread_mutex_unlock(&g_thread_mutex);
+
+ debug_fleave();
+ return ret;
+}
+
+#endif // PULSE_CLIENT
--- /dev/null
+/*
+ * 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 <memory.h>
+#include <unistd.h>
+#include <pthread.h>
+#include <stdio.h>
+#include <sys/types.h>
+#include <fcntl.h>
+
+#include <sys/stat.h>
+#include <errno.h>
+
+#include <mm_types.h>
+#include <mm_error.h>
+#include <mm_message.h>
+#include <mm_debug.h>
+#include <mm_sound.h>
+#include <mm_sound_private.h>
+
+#define KEYTONE_PATH "/tmp/keytone" /* Keytone pipe path */
+#define FILE_FULL_PATH 1024 /* File path lenth */
+
+typedef struct {
+ char filename[FILE_FULL_PATH];
+ int volume_config;
+} ipc_t;
+
+EXPORT_API
+int mm_sound_play_keysound(const char *filename, int volume_config)
+{
+ int err = MM_ERROR_NONE;
+ int fd = -1;
+ int size = 0;
+ ipc_t data = {{0,},};
+
+ debug_fenter();
+
+ if (!filename)
+ return MM_ERROR_SOUND_INVALID_FILE;
+
+ /* Check whether file exists */
+ fd = open(filename, O_RDONLY);
+ if (fd == -1) {
+ debug_error("file open failed with [%s][%d]\n", strerror(errno), errno);
+ switch (errno) {
+ case ENOENT:
+ return MM_ERROR_SOUND_FILE_NOT_FOUND;
+ default:
+ return MM_ERROR_SOUND_INTERNAL;
+ }
+ }
+ close(fd);
+ fd = -1;
+
+ /* Open PIPE */
+ fd = open(KEYTONE_PATH, O_WRONLY | O_NONBLOCK);
+ if (fd == -1) {
+ debug_error("Fail to open pipe\n");
+ return MM_ERROR_SOUND_FILE_NOT_FOUND;
+ }
+ data.volume_config = volume_config;
+ strncpy(data.filename, filename, FILE_FULL_PATH);
+ debug_msg("The file name [%s]\n", data.filename);
+ size = sizeof(ipc_t);
+
+ /* Write to PIPE */
+ err = write(fd, &data, size);
+ if (err < 0) {
+ debug_error("Fail to write data: %s\n", strerror(err));
+ close(fd);
+ return MM_ERROR_SOUND_INTERNAL;
+ }
+ /* Close PIPE */
+ close(fd);
+
+ debug_fleave();
+ return MM_ERROR_NONE;
+}
+
+
--- /dev/null
+* Thu Dec 6 2012 Vivian Zhang <vivian.zhang@intel.com> - 0.6.0
+- Support the case that speaker and wired_accessory are 2 separate alsa sinks in pulseaudio for IA build
--- /dev/null
+Name: libmm-sound
+Summary: MMSound Package contains client lib and sound_server binary
+Version: 0.7.1
+Release: 1
+Group: System/Libraries
+License: Apache-2.0
+Source0: %{name}-%{version}.tar.gz
+Source1: sound-server.service
+Requires(pre): /bin/pidof
+Requires(post): /sbin/ldconfig
+Requires(post): /usr/bin/vconftool
+Requires(postun): /sbin/ldconfig
+BuildRequires: pkgconfig(mm-common)
+BuildRequires: pkgconfig(avsystem)
+BuildRequires: pkgconfig(mm-log)
+BuildRequires: pkgconfig(mm-session)
+BuildRequires: pkgconfig(audio-session-mgr)
+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
+
+
+%package devel
+Summary: MMSound development package
+Group: Development/Libraries
+Requires: %{name} = %{version}-%{release}
+
+%description devel
+MMSound development package for sound system
+
+%package sdk-devel
+Summary: MMSound development package
+Group: Development/Libraries
+Requires: %{name}-devel = %{version}-%{release}
+
+%description sdk-devel
+MMSound development package for sound system
+
+%package tool
+Summary: MMSound utility package - contians mm_sound_testsuite, sound_check
+Group: TO_BE/FILLED_IN
+Requires: %{name} = %{version}-%{release}
+
+%description tool
+MMSound utility package - contians mm_sound_testsuite, sound_check for sound system
+
+
+
+%prep
+%setup -q
+
+
+%build
+./autogen.sh
+%ifarch %{arm}
+CFLAGS="%{optflags} -fvisibility=hidden -DMM_DEBUG_FLAG -DEXPORT_API=\"__attribute__((visibility(\\\"default\\\")))\""; export CFLAGS
+%else
+%if 0%{?simulator}
+CFLAGS="%{optflags} -fvisibility=hidden -DMM_DEBUG_FLAG -DEXPORT_API=\"__attribute__((visibility(\\\"default\\\")))\""; export CFLAGS
+%else
+CFLAGS="%{optflags} -fvisibility=hidden -DMM_DEBUG_FLAG -DSEPARATE_SPEAKER_AND_WIRED_ACCESSORY -DEXPORT_API=\"__attribute__((visibility(\\\"default\\\")))\""; export CFLAGS
+%endif
+%endif
+%configure --prefix=/usr --enable-pulse --enable-security
+make %{?_smp_mflags}
+
+%install
+%make_install
+install -d %{buildroot}%{_libdir}/systemd/user/tizen-middleware.target.wants
+install -m0644 %{SOURCE1} %{buildroot}%{_libdir}/systemd/user/
+ln -sf ../sound-server.service %{buildroot}%{_libdir}/systemd/user/tizen-middleware.target.wants/sound-server.service
+
+# FIXME: remove after systemd is in
+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 memory/Sound/ASMReady 0 -g 29 -f -i
+
+/usr/bin/vconftool set -t int file/private/sound/volume/system 5 -g 29 -f
+/usr/bin/vconftool set -t int file/private/sound/volume/notification 7 -g 29 -f
+/usr/bin/vconftool set -t int file/private/sound/volume/alarm 7 -g 29 -f
+/usr/bin/vconftool set -t int file/private/sound/volume/ringtone 13 -g 29 -f
+/usr/bin/vconftool set -t int file/private/sound/volume/media 7 -g 29 -f
+/usr/bin/vconftool set -t int file/private/sound/volume/call 7 -g 29 -f
+/usr/bin/vconftool set -t int file/private/sound/volume/voip 7 -g 29 -f
+/usr/bin/vconftool set -t int file/private/sound/volume/fixed 0 -g 29 -f
+/usr/bin/vconftool set -t int file/private/sound/volume/java 11 -g 29 -f
+
+%postun -p /sbin/ldconfig
+
+
+%files
+%manifest libmm-sound.manifest
+%defattr(-,root,root,-)
+%{_bindir}/sound_server
+%{_libdir}/libmmfsound.so.*
+%{_libdir}/libmmfsoundcommon.so.*
+%{_libdir}/libmmfkeysound.so.*
+%{_libdir}/libsoundplugintone.so*
+%{_libdir}/libsoundpluginwave.so*
+%{_libdir}/libsoundpluginkeytone.so*
+%{_libdir}/soundplugins/libsoundplugintone.so
+%{_libdir}/soundplugins/libsoundpluginwave.so
+%{_libdir}/soundplugins/libsoundpluginkeytone.so
+%attr(0755,root,root) %{_sysconfdir}/rc.d/init.d/soundserver
+%{_sysconfdir}/rc.d/rc3.d/S23soundserver
+%{_sysconfdir}/rc.d/rc4.d/S23soundserver
+%{_libdir}/systemd/user/tizen-middleware.target.wants/sound-server.service
+%{_libdir}/systemd/user/sound-server.service
+/usr/share/sounds/sound-server/*
+
+%files devel
+%defattr(-,root,root,-)
+%{_libdir}/libmmfkeysound.so
+%{_libdir}/libmmfsound.so
+%{_libdir}/libmmfsoundcommon.so
+%{_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 tool
+%defattr(-,root,root,-)
+%{_bindir}/mm_sound_testsuite
--- /dev/null
+[Unit]
+Description=Start the sound profile service
+
+[Service]
+ExecStart=/usr/bin/sound_server -S
+Nice=5
+OOMScoreAdjust=-100
+Restart=always
+RestartSec=2
+
+[Install]
+WantedBy=tizen-middleware.target
--- /dev/null
+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)
+
--- /dev/null
+prefix = @prefix@
+exec_prefix= @exec_prefix@
+libdir = @libdir@
+includedir = @includedir@
+
+Name : mmfkeysound
+Description : Multimedia Framework Key Sound Library
+Requires : mm-common mm-log
+Version : @VERSION@
+Libs : -L${libdir} -lmmfkeysound
+Cflags : -I${includedir}/mmf
--- /dev/null
+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
--- /dev/null
+SUBDIRS = plugin
+
+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_dock.c \
+ mm_sound_mgr_hdmi.c \
+ mm_sound_mgr_wfd.c \
+ mm_sound_mgr_session.c \
+ mm_sound_mgr_run.c \
+ mm_sound_plugin.c \
+ mm_sound_server.c \
+ mm_sound_thread_pool.c
+
+sound_server_CFLAGS = -I$(srcdir)/../include \
+ -I$(srcdir)/include \
+ $(MMCOMMON_CFLAGS) \
+ $(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) \
+ $(VCONF_CFLAGS) \
+ $(GLIB2_CFLAGS) \
+ $(HEYNOTI_CFLAGS)
+
+sound_server_LDADD = $(MMLOGSVR_LIBS) \
+ -ldl \
+ $(MMCOMMON_LIBS) \
+ $(MMSESSION_LIBS) \
+ $(AVSYSTEM_LIBS) \
+ $(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
+
+installdocksounddir = $(prefix)/share/sounds/sound-server
+installdocksound_DATA = sounds/dock.wav sounds/undock.wav
--- /dev/null
+/*
+ * 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 (void *asm_rcv_msg, void *asm_ret_msg);
+
+
+#endif /* __MM_SOUND_MGR_ASM_H__ */
+
--- /dev/null
+/*
+ * 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_CODEC_H__
+#define __MM_SOUND_MGR_CODEC_H__
+
+#include <mm_source.h>
+
+typedef struct {
+ int tone;
+ int repeat_count;
+ double volume;
+ int session_type;
+ int session_handle;
+ int keytone;
+ void *stopcb;
+ int (*callback)(int, void *, void *);
+ void *msgcallback; /* Client callback function */
+ void *msgdata; /* Client callback data */
+ void *param;
+ MMSourceType *source; /* Will free plugin */
+ int samplerate;
+ int channels;
+ int volume_config;
+ int priority;
+ int handle_route;
+} mmsound_mgr_codec_param_t;
+
+enum
+{
+ MM_SOUND_CODEC_OP_KEYTONE = 0,
+ MM_SOUND_CODEC_OP_SOUND,
+};
+
+int MMSoundMgrCodecInit(const char *targetdir);
+int MMSoundMgrCodecFini(void);
+
+int MMSoundMgrCodecPlay(int *slotid, const mmsound_mgr_codec_param_t *param);
+int MMSoundMgrCodecStop(const int slotid);
+int MMSoundMgrCodecCreate(int *slotid, const mmsound_mgr_codec_param_t *param);
+int MMSoundMgrCodecPlayWave(int slotid, const mmsound_mgr_codec_param_t *param);
+int MMSoundMgrCodecPlayDtmf(int *slotid, const mmsound_mgr_codec_param_t *param);
+int MMSoundMgrCodecDestroy(const int slotid);
+
+
+#endif /* __MM_SOUND_MGR_CODEC_H__ */
+
--- /dev/null
+/*
+ * 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_COMMON_H__
+#define __MM_SOUND_MGR_COMMON_H__
+
+#define MANAGER_HANDLE_MAX 256 //30
+
+#include <mm_session.h>
+#include <mm_session_private.h>
+#include <audio-session-manager.h>
+
+#endif /* __MM_SOUND_MGR_COMMON_H__ */
+
--- /dev/null
+/*
+ * 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__ */
+
--- /dev/null
+/*
+ * 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_DOCK_H__
+#define __MM_SOUND_MGR_DOCK_H__
+
+#include "../../include/mm_ipc.h"
+
+int MMSoundMgrDockInit(void);
+int MMSoundMgrDockFini(void);
+
+
+#endif /* __MM_SOUND_MGR_DOCK_H__ */
+
--- /dev/null
+/*
+ * 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_HDMI_H__
+#define __MM_SOUND_MGR_HDMI_H__
+
+int MMSoundMgrHdmiInit(void);
+int MMSoundMgrHdmiFini(void);
+
+
+#endif /* __MM_SOUND_MGR_HDMI_H__ */
+
--- /dev/null
+/*
+ * 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__ */
+
--- /dev/null
+/*
+ * 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_IPC_H__
+#define __MM_SOUND_MGR_IPC_H__
+
+#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__ */
+
--- /dev/null
+/*
+ * 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_PULSE_H__
+#define __MM_SOUND_MGR_PULSE_H__
+
+
+#include "../../include/mm_ipc.h"
+
+void* MMSoundMgrPulseInit(void);
+int MMSoundMgrPulseFini(void* handle);
+
+void MMSoundMgrPulseSetDefaultSink (char* device_api_name, char* device_bus_name);
+
+int MMSoundMgrPulseHandleRegisterMonoAudio (void* pinfo);
+int MMSoundMgrPulseHandleRegisterBluetoothStatus (void* pinfo);
+
+int MMSoundMgrPulseHandleIsBtA2DPOnReq (mm_ipc_msg_t *msg, int (*sendfunc)(mm_ipc_msg_t*));
+void MMSoundMgrPulseGetInitialBTStatus (bool *a2dp, bool *sco);
+
+#endif /* __MM_SOUND_MGR_PULSE_H__ */
+
--- /dev/null
+/*
+ * 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_RUN_H__
+#define __MM_SOUND_MGR_RUN_H__
+
+int MMSoundMgrRunInit(const char *targetdir);
+int MMSoundMgrRunFini(void);
+int MMSoundMgrRunRunAll(void);
+int MMSoundMgrRunStopAll(void);
+
+#endif /* __MM_SOUND_MGR_RUN_H__ */
--- /dev/null
+/*
+ * 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_EMERGENCY,
+ 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_HDMI,
+ DEVICE_WFD,
+ DEVICE_USB_AUDIO,
+} 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__ */
+
--- /dev/null
+/*
+ * 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_WFD_H__
+#define __MM_SOUND_MGR_WFD_H__
+
+int MMSoundMgrWfdInit(void);
+int MMSoundMgrWfdFini(void);
+
+
+#endif /* __MM_SOUND_MGR_WFD_H__ */
+
--- /dev/null
+/*
+ * 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_PLUGIN_H__
+#define __MM_SOUND_PLUGIN_H__
+
+enum {
+ MM_SOUND_PLUGIN_TYPE_NONE = 0,
+ MM_SOUND_PLUGIN_TYPE_CODEC,
+ MM_SOUND_PLUGIN_TYPE_RUN,
+ MM_SOUND_PLUGIN_TYPE_LAST,
+};
+
+typedef struct {
+ int type;
+ void *module;
+} MMSoundPluginType;
+
+#define MMSOUND_TRUE 1
+#define MMSOUND_FALSE 0
+
+/* Plugin Interface */
+int MMSoundGetPluginType(void);
+
+/* Utility Interfaces */
+char* MMSoundPluginGetTypeName(int type);
+int MMSoundPluginScan(const char *plugindir, const int type, MMSoundPluginType **pluginlist);
+int MMSoundPluginRelease(MMSoundPluginType *pluginlist);
+
+int MMSoundPluginOpen(char *file, MMSoundPluginType *plugin);
+int MMSoundPluginClose(MMSoundPluginType *plugin);
+int MMSoundPluginGetSymbol(MMSoundPluginType *plugin, const char *symbol, void **func);
+
+#endif /* __MM_SOUND_PLUGIN_H__ */
+
--- /dev/null
+/*
+ * 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_PLUGIN_CODEC_H__
+#define __MM_SOUND_PLUGIN_CODEC_H__
+
+#include "mm_sound_plugin.h"
+#include <mm_source.h>
+#include <mm_types.h>
+
+enum MMSoundSupportedCodec {
+ MM_SOUND_SUPPORTED_CODEC_INVALID = -1, /**< Invalid codec type */
+ MM_SOUND_SUPPORTED_CODEC_WAVE, /**< WAVE codec */
+ MM_SOUND_SUPPORTED_CODEC_DTMF, /**< DTMF codec */
+ MM_SOUND_SUPPORTED_CODEC_MP3, /**< MP3 codec */
+ MM_SOUND_SUPPORTED_CODEC_NUM, /**< Number of audio codec type */
+};
+
+typedef struct {
+ int codec;
+ int channels;
+ int samplerate;
+ int format;
+ int doffset;
+ int size;
+} mmsound_codec_info_t;
+
+typedef struct {
+ int (*stop_cb)(int);
+ int pid;
+ int param;
+ int tone;
+ int repeat_count;
+ double volume;
+ int priority;
+ int volume_config;
+ int keytone;
+ MMSourceType *source;
+ int handle_route;
+} mmsound_codec_param_t;
+
+typedef struct {
+ int* (*GetSupportTypes)(void);
+ int (*SetThreadPool) (int (*)(void*, void (*)(void*)));
+ int (*Parse)(MMSourceType*, mmsound_codec_info_t*);
+ int (*Create)(mmsound_codec_param_t*, mmsound_codec_info_t*, MMHandleType*);
+ int (*Play_wav)(mmsound_codec_param_t *, mmsound_codec_info_t *, MMHandleType );
+ int (*Play)(MMHandleType);
+ int (*Stop)(MMHandleType);
+ int (*Destroy)(MMHandleType);
+} mmsound_codec_interface_t;
+
+/* Utility Functions */
+#define CODEC_GET_INTERFACE_FUNC_NAME "MMSoundPlugCodecGetInterface"
+#define MMSoundPlugCodecCastGetInterface(func) ((int (*)(mmsound_codec_interface_t*))(func))
+
+int MMSoundPlugCodecGetInterface(mmsound_codec_interface_t *intf);
+
+#endif /* __MM_SOUND_PLUGIN_CODEC_H__ */
+
--- /dev/null
+/*
+ * 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_PLUGIN_RUN_H__
+#define __MM_SOUND_PLUGIN_RUN_H__
+
+#include "mm_sound_plugin.h"
+#include <mm_types.h>
+
+enum {
+ MM_SOUND_PLUG_RUN_OP_RUN,
+ MM_SOUND_PLUG_RUN_OP_STOP,
+ MM_SOUND_PLUG_RUN_OP_LAST
+};
+
+/* Plugin Interface */
+typedef struct {
+ int (*run)(void);
+ int (*stop)(void);
+ int (*SetThreadPool) (int (*)(void*, void (*)(void*)));
+} mmsound_run_interface_t;
+
+int MMSoundRunRun(void);
+int MMSoundRunStop(void);
+
+/* Utility Functions */
+#define RUN_GET_INTERFACE_FUNC_NAME "MMSoundPlugRunGetInterface"
+#define MMSoundPlugRunCastGetInterface(func) ((int (*)(mmsound_run_interface_t*))(func))
+int MMSoundPlugRunGetInterface(mmsound_run_interface_t *intf);
+
+#endif /* __MM_SOUND_PLUGIN_RUN_H__ */
+
--- /dev/null
+/*
+ * 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_THREAd_POOL_H__
+#define __MM_SOUND_THREAd_POOL_H__
+
+int MMSoundThreadPoolDump(int fulldump);
+int MMSoundThreadPoolInit(void);
+int MMSoundThreadPoolRun(void *param, void (*func)(void*));
+int MMSoundThreadPoolFini(void);
+
+#endif /* __MM_SOUND_THREAd_POOL_H__ */
--- /dev/null
+/*
+ * 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_thread_pool.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 <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] =
+{
+ /*
+ 0 == ASM_CASE_NONE
+ 1 == ASM_CASE_1PLAY_2STOP
+ 5 == ASM_CASE_1STOP_2PLAY
+ 6 == ASM_CASE_1PAUSE_2PLAY
+ 8 == ASM_CASE_1PLAY_2PLAY_MIX
+ 9 == ASM_CASE_RESOURCE_CHECK
+ */
+ /* SP SC SS SO SA, EP EC ES EO EA, NT CL SF EF EU, AL VC MT RC EM ER */
+ { 8, 8, 8, 8, 8, 6, 6, 6, 6, 6, 8, 6, 8, 6, 6, 6, 6, 8, 6, 6, 9}, /* 00 Shared MMPlayer */
+ { 8, 8, 8, 8, 8, 5, 5, 5, 5, 5, 8, 5, 8, 5, 8, 5, 5, 8, 5, 5, 9}, /* 01 Shared MMCamcorder */
+ { 8, 8, 8, 8, 8, 5, 5, 5, 5, 5, 8, 5, 8, 5, 5, 5, 5, 8, 5, 5, 9}, /* 02 Shared MMSound */
+ { 8, 8, 8, 8, 8, 5, 5, 5, 5, 5, 8, 5, 8, 5, 6, 5, 5, 8, 5, 5, 9}, /* 03 Shared OpenAL */
+ { 8, 8, 8, 8, 8, 5, 5, 5, 5, 5, 8, 5, 8, 5, 8, 5, 5, 8, 5, 5, 9}, /* 04 Shared AVsystem */
+ { 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 8, 6, 6, 6, 6, 6, 6, 8, 6, 6, 9}, /* 05 Exclusive MMPlayer */
+ { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 8, 5, 5, 5, 8, 5, 5 ,8, 5, 5, 9}, /* 06 Exclusive MMCamcorder */
+ { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 8, 5, 5, 5, 5, 5, 5, 8, 5, 5, 9}, /* 07 Exclusive MMSound */
+ { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 8, 5, 5, 5, 6, 5, 5, 8, 5, 5, 9}, /* 08 Exclusive OpenAL */
+ { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 8, 5, 5, 5, 8, 5, 5, 8, 5, 5, 9}, /* 09 Exclusive AVsystem */
+ { 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 5, 8, 8, 8, 5, 5, 8, 5, 5, 9}, /* 10 Notify */
+ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 8, 0, 1, 1, 8, 8, 1, 8, 0, 1, 9}, /* 11 Call */
+ { 8, 8, 8, 8, 8, 5, 5, 5, 5, 5, 8, 5, 5, 5, 5, 5, 5, 8, 5, 5, 9}, /* 12 Shared FMradio */
+ { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 8, 5, 5, 5, 5, 5, 5, 8, 5, 5, 9}, /* 13 Exclusive FMradio */
+ { 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 9}, /* 14 Earjack Unplug */
+ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 8, 6, 1, 1, 8, 8, 6, 8, 6, 5, 9}, /* 15 Alarm */
+ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 8, 1, 1, 1, 8, 8, 0, 8, 1, 1, 9}, /* 16 Video Call */
+ { 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 9}, /* 17 Monitor */
+ { 1, 8, 1, 1, 1, 1, 1, 1, 1, 1, 8, 0, 1, 1, 8, 8, 1, 8, 0, 1, 9}, /* 18 Rich Call */
+ { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 8, 5, 5, 8, 5, 5, 9}, /* 19 Emergency */
+ { 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9}, /* 20 Exclusive Resource */
+};
+
+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",
+ "EMERGENCY",
+ "EXCLUSIVE_RESOURCE"
+};
+
+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",
+ "CASE_RESOURCE_CHECK"
+};
+
+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, x_former_sound_event) \
+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; \
+ asm_snd_msg->data.former_sound_event = x_former_sound_event; \
+} 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_ALARM:
+ case ASM_EVENT_EMERGENCY:
+ 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) {
+ debug_warning("[ASM_Server] %s : could not find a clean monitor handle",__func__);
+ return FALSE;
+ } else {
+ *handle = lhandle;
+ debug_log("[ASM_Server] %s : found a clean monitor handle(%d)",__func__, *handle);
+ 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;
+ debug_log("[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) {
+ debug_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) {
+ debug_log("[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) {
+ debug_log("[ASM_Server][CallCB] %s write error",filename);
+ g_free(filename);
+ if (fd_ASM != -1) {
+ close(fd_ASM);
+ }
+ 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 */
+
+ debug_log("[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) {
+ debug_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));
+ debug_error("[ASM_Server][RETCB] Fail to open fifo (%s)\n", str_error);
+ goto fail;
+ }
+ debug_log("[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) {
+ debug_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) {
+ debug_log("[ASM_Server][RETCB] No need to wait return from client. \n");
+ if (fd != -1) {
+ close (fd);
+ }
+ return ASM_CB_RES_NONE;
+ }
+
+ pfd.fd = fd;
+ pfd.events = POLLIN;
+
+ /*********************************************
+ *
+ * Wait callback result msg
+ *
+ ********************************************/
+ debug_log("[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) {
+ debug_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;
+ debug_log("[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;
+ debug_log("[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) {
+ debug_warning("[ASM_Server] %s\n", msg);
+ }
+ while (temp_list->next != tail_list) {
+ debug_log("[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 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)) {
+ debug_error("[ASM_Server[Error = %d][1st try] phonestatus_set \n", error);
+ if (vconf_set_int(SOUND_STATUS_KEY, g_sound_status_playing)) {
+ debug_error("[ASM_Server][Error = %d][2nd try] phonestatus_set \n", error);
+ }
+ }
+
+ debug_log("[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;
+
+ debug_log("[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)) {
+ debug_warning("[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)) {
+ debug_log("[ASM_Server] remove %s success\n", filename);
+ } else {
+ strerror_r (errno, str_error, sizeof (str_error));
+ debug_error("[ASM_Server] remove %s failed with %s\n", filename, str_error);
+ }
+
+ if (!remove(filename2)) {
+ debug_log("[ASM_Server] remove %s success\n", filename2);
+ } else {
+ strerror_r (errno, str_error, sizeof (str_error));
+ debug_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;
+ }
+ }
+
+ debug_log("[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;
+
+ debug_log("[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;
+
+ debug_log("[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;
+ debug_log("[ASM_Server] __asm_change_state_list\n");
+ if (sound_state == ASM_STATE_IGNORE) {
+ debug_log("[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;
+ debug_log("[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) {
+ debug_error("[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) {
+ debug_error("[ASM_Server] msgsnd failed with error %d\n", errno);
+ exit(EXIT_FAILURE);
+ } else {
+ debug_log("[ASM_Server] __asm_snd_message() success");
+ }
+}
+
+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) {
+ debug_error("[ASM_Server] msgrcv failed with error %d\n", errno);
+ exit(EXIT_FAILURE);
+ } else {
+ debug_log("[ASM_Server] __asm_rcv_message() success");
+ }
+}
+
+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;
+ char handle_info[SERVER_HANDLE_MAX_COUNT];
+
+ debug_log("[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)) {
+ debug_error("[ASM_Server] New handle for %ld is %d\n", instance_id, i);
+ *handle = i;
+ } else {
+ debug_error("[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)
+ debug_log("[ASM_Server] resource NONE\n");
+ if (resource_status & ASM_RESOURCE_CAMERA)
+ debug_log("[ASM_Server] resource CAMERA\n");
+ if (resource_status & ASM_RESOURCE_VIDEO_OVERLAY)
+ debug_log("[ASM_Server] resource VIDEO OVERLAY\n");
+ if (resource_status & ASM_RESOURCE_HW_ENCORDER)
+ debug_log("[ASM_Server] resource HW ENCORDER\n");
+ if (resource_status & ASM_RESOURCE_HW_DECORDER)
+ debug_log("[ASM_Server] resource HW DECORDER\n");
+ if (resource_status & ASM_RESOURCE_RADIO_TUNNER)
+ debug_log("[ASM_Server] resource RADIO TUNNER\n");
+ if (resource_status & ASM_RESOURCE_TV_TUNNER)
+ debug_log("[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;
+
+ debug_log("[ASM_Server][%s] ENTER >>>>>> \n", __func__);
+
+ /* If nobody is playing now, this means no conflict */
+ if (ASM_STATUS_NONE == g_sound_status_playing) {
+ debug_log("[ASM_Server][%s] No conflict ( No existing Sound )\n", __func__);
+
+ ASM_SND_MSG_SET(asm_snd_msg, handle, -1, ASM_COMMAND_NONE, sound_state, ASM_EVENT_NONE);
+
+ 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) {
+
+ debug_log("[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)) {
+ debug_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
+
+ debug_log("[ASM_Server][%s] Conflict policy[0x%x][0x%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.*/
+ debug_log("[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, current_play_sound_event);
+ 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, current_play_sound_event);
+
+ 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. */
+ debug_log("[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;
+
+ case ASM_EVENT_EMERGENCY:
+ event_src = ASM_EVENT_SOURCE_EMERGENCY_START;
+ break;
+
+ case ASM_EVENT_EXCLUSIVE_MMCAMCORDER:
+ event_src = ASM_EVENT_SOURCE_RESUMABLE_MEDIA;
+ break;
+
+ default:
+ event_src = ASM_EVENT_SOURCE_MEDIA;
+ 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);
+ debug_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) {
+ debug_error("[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/EXCLUSIVE_MMCAMCORDER, 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)
+ debug_error("[ASM_Server][%s] oops! not suspected result %d\n", __func__, cb_res);
+ debug_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/EXCLUSIVE_MMCAMCORDER, 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) {
+ debug_log ("[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, current_play_sound_event);
+
+ 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) {
+ debug_log("[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) {
+ debug_log("[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_EMERGENCY:
+ event_src = ASM_EVENT_SOURCE_EMERGENCY_START;
+ break;
+
+ case ASM_EVENT_EXCLUSIVE_MMCAMCORDER:
+ event_src = ASM_EVENT_SOURCE_RESUMABLE_MEDIA;
+ 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_MEDIA;
+ 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);
+ debug_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) {
+ debug_error("[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/EXCLUSIVE_MMCAMCORDER, 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);
+ debug_warning("[ASM_Server][%s] (1PAUSE_2PLAY) : Callback of %s: TID(%ld), result(%d)",
+ __func__,ASM_sound_command_str[command], current_play_instance_id, cb_res);
+ /*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:
+ debug_error("[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, current_play_sound_event);
+
+ 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) {
+ debug_log("[ASM_Server] Do not send check resource conflict in same pid %ld\n", instance_id);
+ } else {
+ /* MIX but need to check resource conflict */
+ debug_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 */
+ debug_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) {
+ debug_error("[ASM_Server][%s] oops! not suspected callback result %d\n", __func__, cb_res);
+ }
+ debug_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);
+ debug_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:
+ debug_error("[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, current_play_sound_event);
+
+ 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_RESOURCE_CHECK:
+ {
+ unsigned short resource_status = current_using_resource & mm_resource;
+ if (resource_status!= ASM_RESOURCE_NONE) {
+ debug_log("[ASM_Server][%s] ASM_CASE_RESOURCE_CHECK : resource conflict found 0x%x\n", __func__, resource_status);
+
+ switch (resource_status){
+ case ASM_RESOURCE_CAMERA:
+ if (current_play_sound_event == ASM_EVENT_SHARE_MMCAMCORDER ||
+ current_play_sound_event == ASM_EVENT_EXCLUSIVE_MMCAMCORDER ||
+ current_play_sound_event == ASM_EVENT_VIDEOCALL ||
+ current_play_sound_event == ASM_EVENT_RICH_CALL ) {
+ /* 1PLAY,2STOP */
+ debug_log("[ASM_Server][%s] ASM_CASE_RESOURCE_CHECK : 1PLAY_2STOP");
+
+ ASM_SND_MSG_SET(asm_snd_msg, handle, handle, ASM_COMMAND_STOP, sound_state, current_play_sound_event);
+ temp_list = tail_list; /* skip all remain list */
+
+ } else if (current_play_sound_event == ASM_EVENT_EXCLUSIVE_RESOURCE){
+ /* 1STOP,2PLAY */
+ debug_log("[ASM_Server][%s] ASM_CASE_RESOURCE_CHECK : 1STOP_2PLAY");
+
+ ASM_event_sources_t event_src;
+ event_src = ASM_EVENT_SOURCE_RESOURCE_CONFLICT;
+
+ /* 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) {
+ debug_error("[ASM_Server][%s] oops! not suspected result %d\n", __func__, cb_res);
+ }
+ debug_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 );
+
+ /* Set state to STOP */
+ __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);
+
+ /* Prepare msg to send */
+ ASM_SND_MSG_SET(asm_snd_msg, handle, handle, ASM_COMMAND_PLAY, sound_state, current_play_sound_event);
+
+ 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:
+ debug_warning("[ASM_Server][%s] ASM_CASE_RESOURCE_CHECK : Not support it(0x%x)", __func__, resource_status);
+ break;
+ }
+ } else {
+ debug_log("[ASM_Server][%s] ASM_CASE_RESOURCE_CHECK : do MIX");
+ /* DO MIX */
+ /* Prepare msg to send */
+ ASM_SND_MSG_SET(asm_snd_msg, handle, handle, ASM_COMMAND_PLAY, sound_state, current_play_sound_event);
+
+ 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, current_play_sound_event);
+ debug_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 */
+ debug_log("[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, current_play_sound_event);
+
+ if (sound_state == ASM_STATE_NONE) {
+ debug_log("[ASM_Server][%s] 1PLAY_2NONE : No Conflict !!!\n", __func__);
+ } else if (sound_state == ASM_STATE_WAITING) {
+ debug_log("[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 */
+ debug_warning("[ASM_Server][%s] Now list's state is pause. %d %d\n", __func__, instance_id, handle);
+ 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) {
+ debug_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 {
+ debug_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];
+
+ debug_log("[ASM_Server][%s] Conflict policy[0x%x][0x%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.
+ debug_log("[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) {
+ debug_warning("[ASM_Server][%s] there is system resource conflict with paused instance 0x%x\n", __func__, resource_status);
+ __print_resource(resource_status);
+ } else {
+ debug_log("[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) {
+ debug_error("[ASM_Server][%s] oops! not suspected callback result %d\n", __func__, cb_res);
+ }
+ debug_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) {
+ debug_error("[ASM_Server][%s] oops! not suspected result %d\n", __func__, cb_res);
+ }
+ debug_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);
+ }
+
+ debug_log("[ASM_Server][%s] 1STOP_2PLAY cause RESOURCE : msg sent and then received msg !!!\n",__func__);
+ break;
+ }
+
+ default:
+ /* debug_warning("[ASM_Server] >>>> __asm_compare_priority_matrix : ASM_CASE_NONE [do not anything] !!!\n"); */
+ break;
+
+ } /* switch (sound_case) */
+ } else {
+ /* debug_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
+
+ debug_log("[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;
+
+ debug_log("[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;
+ }
+
+ debug_log("[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");
+ debug_log ("[ASM_Server][Security] asm server gid = [%d]\n", asm_gid);
+ if (asm_gid < 0) {
+ debug_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) {
+ debug_log("[ASM_Server][Security] security_server_check_privilege() returns [%d]\n", retval);
+ return true;
+ } else {
+ debug_error("[ASM_Server][Security] security_server_check_privilege() returns [%d]\n", retval);
+ return false;
+ }
+}
+#endif /* USE_SECURITY */
+
+int __asm_process_message (void *rcv_msg, void *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_msg_lib_to_asm_t *asm_rcv_msg = (ASM_msg_lib_to_asm_t *)rcv_msg;
+ ASM_msg_asm_to_lib_t *asm_ret_msg = (ASM_msg_asm_to_lib_t *)ret_msg;
+
+ debug_log ("[ASM_Server] ===================================================================== [%s] Starting.... ", __func__);
+ pthread_mutex_lock(&g_mutex_asm);
+ debug_log ("[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;
+
+ /*******************************************************************/
+ debug_log("[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) {
+ debug_warning("[ASM_Server] request_id : %s\n", ASM_sound_request_str[rcv_request_id]);
+ if (rcv_request_id == ASM_REQUEST_SET_SUBSESSION) {
+ debug_warning("[ASM_Server] subsession : %s\n", subsession_str[rcv_sound_event]);
+ } else {
+ debug_warning("[ASM_Server] sound_event : %s\n", ASM_sound_events_str[rcv_sound_event]);
+ debug_warning("[ASM_Server] sound_state : %s\n", ASM_sound_state_str[rcv_sound_state]);
+ debug_warning("[ASM_Server] resource : 0x%x\n", rcv_resource);
+ }
+ }
+ /*******************************************************************/
+ debug_log ("[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) {
+ debug_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;
+ }
+ debug_log ("[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) {
+ debug_log ("[ASM_Server] ****** SESSION_VOICECALL start ******\n");
+ MMSoundMgrSessionSetSession(SESSION_VOICECALL, SESSION_START);
+ } else if (rcv_sound_event == ASM_EVENT_VIDEOCALL) {
+ debug_log ("[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) {
+ debug_log ("[ASM_Server] ****** SESSION_VOICECALL end ******\n");
+ MMSoundMgrSessionSetSession(SESSION_VOICECALL, SESSION_END);
+ } else if (rcv_sound_event == ASM_EVENT_VIDEOCALL) {
+ debug_log ("[ASM_Server] ****** SESSION_VOIP end ******\n");
+ MMSoundMgrSessionSetSession(SESSION_VOIP, SESSION_END);
+ }
+ break;
+
+ case ASM_EVENT_ALARM:
+ {
+ session_t cur_session;
+ MMSoundMgrSessionGetSession(&cur_session);
+ if (cur_session == SESSION_NOTIFICATION) {
+ debug_log ("[ASM_Server] ****** SESSION_NOTIFICATON end ******\n");
+ MMSoundMgrSessionSetSession(SESSION_NOTIFICATION, SESSION_END);
+ __asm_do_all_resume_callback(ASM_EVENT_SOURCE_ALARM_END);
+ } else if (cur_session == SESSION_VOICECALL || cur_session == SESSION_VOIP) {
+ debug_log ("[ASM_Server] ****** Alarm ends on Call/Voip session ******\n");
+ } else {
+ debug_warning ("[ASM_Server] ****** Not expected case : current session was [%d] ******\n", cur_session);
+ }
+ break;
+ }
+
+ case ASM_EVENT_EMERGENCY:
+ debug_log ("[ASM_Server] ****** SESSION_EMERGENCY end ******\n");
+ MMSoundMgrSessionSetSession(SESSION_EMERGENCY, SESSION_END);
+ __asm_do_all_resume_callback(ASM_EVENT_SOURCE_EMERGENCY_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) {
+ debug_log ("[ASM_Server] ****** SESSION_NOTIFICATION ongoing ******\n");
+ } else if (cur_session == SESSION_VOICECALL || cur_session == SESSION_VOIP) {
+ debug_log ("[ASM_Server] ****** Alarm starts on Call/Voip session ******\n");
+ } else {
+ debug_log ("[ASM_Server] ****** SESSION_NOTIFICATION start ******\n");
+ MMSoundMgrSessionSetSession(SESSION_NOTIFICATION, SESSION_START);
+ }
+ }
+ break;
+
+ case ASM_EVENT_EMERGENCY:
+ {
+ session_t cur_session;
+ MMSoundMgrSessionGetSession(&cur_session);
+ if (cur_session == SESSION_EMERGENCY) {
+ debug_log ("[ASM_Server] ****** SESSION_EMERGENCY ongoing ******\n");
+ } else {
+ debug_log ("[ASM_Server] ****** SESSION_EMERGENCY start ******\n");
+ MMSoundMgrSessionSetSession(SESSION_EMERGENCY, 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) {
+ debug_log ("[ASM_Server] ****** SESSION_FMRADIO ongoing ******\n");
+ } else {
+ debug_log ("[ASM_Server] ****** SESSION_FMRADIO start ******\n");
+ MMSoundMgrSessionSetSession(SESSION_FMRADIO, SESSION_START);
+ }
+ }
+ break;
+ default:
+ 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) {
+ debug_log ("[ASM_Server] ****** SESSION_FMRADIO end ******");
+ MMSoundMgrSessionSetSession(SESSION_FMRADIO, SESSION_END);
+ } else {
+ debug_log ("[ASM_Server] Session is not SESSION_FMRADIO");
+ }
+ }
+ break;
+ case ASM_EVENT_EXCLUSIVE_MMCAMCORDER:
+ debug_log ("[ASM_Server] ****** EXCLUSIVE_MMCAMCORDER end ******");
+ break;
+
+ default:
+ 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);
+ }
+
+ debug_log ("[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:
+ {
+ subsession_t subsession = 0;
+ int ret = 0;
+
+ /* FIXME: have to check only call instance with playing stsate can request this */
+ debug_log ("[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);
+ debug_log ("[ASM_Server] --------------------------------------------------------------------- [%s] End (UNLOCKED) ", __func__);
+}
+
+void __asm_main_run (void* param)
+{
+ 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) {
+ debug_error("[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)) {
+ debug_error("[ASM_Server] vconf_set_int fail\n");
+ if (vconf_set_int(SOUND_STATUS_KEY, 0)) {
+ debug_error("[ASM_Server] vconf_set_int fail\n");
+ }
+ }
+
+#ifdef SUPPORT_GCF
+ if (vconf_get_int(VCONFKEY_ADMIN_GCF_TEST, &is_gcf)) {
+ debug_warning("[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)) {
+ debug_error("[ASM_Server] vconf_set_int fail\n");
+ }
+
+ /* Msg Loop */
+ while (true) {
+ debug_log("[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 */
+ }
+}
+
+
+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;
+}
+
--- /dev/null
+/*
+ * 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 <mm_source.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_codec.h"
+#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 */
+
+typedef struct {
+ int (*callback)(int, void *, void *); /* msg_type(pid) client callback & client data info */
+ void *param;
+ int pid;
+ void *msgcallback;
+ void *msgdata;
+ MMHandleType plughandle;
+
+ int pluginid;
+ int status;
+ int session_type;
+ int session_handle;
+ } __mmsound_mgr_codec_handle_t;
+
+static MMSoundPluginType *g_codec_plugins = NULL;
+static __mmsound_mgr_codec_handle_t g_slots[MANAGER_HANDLE_MAX];
+static mmsound_codec_interface_t g_plugins[MM_SOUND_SUPPORTED_CODEC_NUM];
+static pthread_mutex_t g_slot_mutex;
+
+static int _MMSoundMgrCodecStopCallback(int param);
+static int _MMSoundMgrCodecFindKeytoneSlot(int *slotid);
+static int _MMSoundMgrCodecGetEmptySlot(int *slotid);
+static int _MMSoundMgrCodecFindLocaleSlot(int *slotid);
+static int _MMSoundMgrCodecRegisterInterface(MMSoundPluginType *plugin);
+
+#define STATUS_IDLE 0
+#define STATUS_KEYTONE 1
+#define STATUS_LOCALE 2
+#define STATUS_SOUND 3
+
+#define SOUND_SLOT_START 0
+
+
+
+ASM_cb_result_t
+sound_codec_asm_callback(int handle, ASM_event_sources_t event_src, ASM_sound_commands_t command, unsigned int sound_status, void* cb_data)
+{
+ int slotid = (int)cb_data;
+ int result = MM_ERROR_NONE;
+ ASM_cb_result_t cb_res = ASM_CB_RES_NONE;
+
+ debug_log("Got audio session callback msg for session_handle %d\n", handle);
+
+ switch(command)
+ {
+ case ASM_COMMAND_STOP:
+ case ASM_COMMAND_PAUSE:
+ debug_log("Got msg from asm to Stop or Pause %d\n", command);
+ result = MMSoundMgrCodecStop(slotid);
+ cb_res = ASM_CB_RES_STOP;
+ break;
+ case ASM_COMMAND_RESUME:
+ case ASM_COMMAND_PLAY:
+ debug_log("Got msg from asm to Play or Resume %d\n", command);
+ cb_res = ASM_CB_RES_NONE;;
+ default:
+ break;
+ }
+ return cb_res;
+}
+
+
+int MMSoundMgrCodecInit(const char *targetdir)
+{
+ int loop = 0;
+ int count = 0;
+
+ debug_enter("\n");
+
+ memset (g_slots, 0, sizeof(g_slots));
+
+ if(pthread_mutex_init(&g_slot_mutex, NULL)) {
+ debug_error("pthread_mutex_init failed [%s][%d]\n", __func__, __LINE__);
+ return MM_ERROR_SOUND_INTERNAL;
+ }
+
+ for (count = 0; count < MANAGER_HANDLE_MAX; count++) {
+ g_slots[count].status = STATUS_IDLE;
+ g_slots[count].plughandle = -1;
+ }
+
+ if (g_codec_plugins) {
+ debug_warning("Please Check Init twice\n");
+ MMSoundPluginRelease(g_codec_plugins);
+ }
+
+ MMSoundPluginScan(targetdir, MM_SOUND_PLUGIN_TYPE_CODEC, &g_codec_plugins);
+
+ while (g_codec_plugins[loop].type != MM_SOUND_PLUGIN_TYPE_NONE) {
+ _MMSoundMgrCodecRegisterInterface(&g_codec_plugins[loop++]);
+ }
+
+ debug_leave("\n");
+ return MM_ERROR_NONE;
+}
+
+int MMSoundMgrCodecFini(void)
+{
+ debug_enter("\n");
+
+ memset(g_plugins, 0, sizeof(mmsound_codec_interface_t) * MM_SOUND_SUPPORTED_CODEC_NUM);
+ MMSoundPluginRelease(g_codec_plugins);
+ g_codec_plugins = NULL;
+ pthread_mutex_destroy(&g_slot_mutex);
+
+ debug_leave("\n");
+ return MM_ERROR_NONE;
+}
+
+
+int MMSoundMgrCodecPlay(int *slotid, const mmsound_mgr_codec_param_t *param)
+{
+ int count = 0;
+ mmsound_codec_info_t info;
+ mmsound_codec_param_t codec_param;
+ int err = MM_ERROR_NONE;
+ int errorcode = 0;
+ int need_asm_unregister = 0;
+
+ debug_enter("\n");
+
+ debug_msg("DTMF : [%d]\n",param->tone);
+ debug_msg("Repeat : [%d]\n",param->repeat_count);
+ debug_msg("Volume : [%f]\n",param->volume);
+
+ for (count = 0; g_plugins[count].GetSupportTypes; count++) {
+ /* Find codec */
+ if (g_plugins[count].Parse(param->source, &info) == MM_ERROR_NONE)
+ break;
+ }
+
+ debug_msg("Find plugin codec ::: [%d]\n", count); /*The count num means codec type WAV, MP3 */
+
+ if (g_plugins[count].GetSupportTypes == NULL) { /* Codec not found */
+ debug_error("unsupported file type %d\n", count);
+ err = MM_ERROR_SOUND_UNSUPPORTED_MEDIA_TYPE;
+ goto cleanup;
+ }
+
+ /* KeyTone */
+ if (param->keytone == 1) {
+ /* Find keytone slot */
+ err = _MMSoundMgrCodecFindKeytoneSlot(slotid);
+ /* Not First connect */
+ if (err == MM_ERROR_NONE) {
+ if(g_slots[*slotid].status != STATUS_IDLE) {
+ MMSoundMgrCodecStop(*slotid);
+ }
+ debug_msg("Key tone : Stop to Play !!!\n");
+ }
+ codec_param.keytone = param->keytone;
+ } else if (param->keytone == 2) {
+ /* Find keytone slot */
+ err = _MMSoundMgrCodecFindLocaleSlot(slotid);
+ /* Not First connect */
+ if (err == MM_ERROR_NONE) {
+ if(g_slots[*slotid].status != STATUS_IDLE) {
+ MMSoundMgrCodecStop(*slotid);
+ }
+ debug_msg("Key tone : Stop to Play !!!\n");
+ }
+ codec_param.keytone = param->keytone;
+ } else {
+ debug_msg("Get New handle\n");
+ codec_param.keytone = 0;
+ }
+
+ err = _MMSoundMgrCodecGetEmptySlot(slotid);
+ if (err != MM_ERROR_NONE) {
+ debug_error("Empty g_slot is not found\n");
+ goto cleanup;
+ }
+
+ codec_param.tone = param->tone;
+ codec_param.volume_config = param->volume_config;
+ codec_param.repeat_count = param->repeat_count;
+ codec_param.volume = param->volume;
+ codec_param.source = param->source;
+ codec_param.priority = param->priority;
+ codec_param.stop_cb = _MMSoundMgrCodecStopCallback;
+ codec_param.param = *slotid;
+ codec_param.pid = (int)param->param;
+ codec_param.handle_route = param->handle_route;
+
+ pthread_mutex_lock(&g_slot_mutex);
+ debug_msg("After Slot_mutex LOCK\n");
+
+ /* In case of KEYTONE */
+ if (param->keytone == 1)
+ g_slots[*slotid].status = STATUS_KEYTONE;
+
+ /* In case of LOCALE */
+ if (param->keytone == 2) /* KeyTone */
+ g_slots[*slotid].status = STATUS_LOCALE;
+
+ /*
+ * Register ASM here
+ */
+
+ if(param->session_type != ASM_EVENT_CALL && param->session_type != ASM_EVENT_VIDEOCALL) {
+ if(!ASM_register_sound_ex((int)param->param, ¶m->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;
+ }
+ }
+ //
+
+ /* Codec id WAV or MP3 */
+ g_slots[*slotid].pluginid = count;
+ g_slots[*slotid].callback = param->callback;
+ g_slots[*slotid].msgcallback = param->msgcallback;
+ g_slots[*slotid].msgdata = param->msgdata;
+ g_slots[*slotid].param = param->param; /* This arg is used callback data */
+ g_slots[*slotid].session_type = param->session_type;
+ g_slots[*slotid].session_handle = param->session_handle;
+
+ debug_msg("Using Slotid : [%d] Slot Status : [%d]\n", *slotid, g_slots[*slotid].status);
+
+
+
+ err = g_plugins[g_slots[*slotid].pluginid].Create(&codec_param, &info, &(g_slots[*slotid].plughandle));
+ debug_msg("Created audio handle : [%d]\n", g_slots[*slotid].plughandle);
+ if (err != MM_ERROR_NONE) {
+ debug_error("Plugin create fail : 0x%08X\n", err);
+ g_slots[*slotid].status = STATUS_IDLE;
+ pthread_mutex_unlock(&g_slot_mutex);
+ debug_warning("After Slot_mutex UNLOCK\n");
+ need_asm_unregister = 1;
+ goto cleanup;
+ }
+
+ err = g_plugins[g_slots[*slotid].pluginid].Play(g_slots[*slotid].plughandle);
+ if (err != MM_ERROR_NONE) {
+ debug_error("Fail to play : 0x%08X\n", err);
+ g_plugins[g_slots[*slotid].pluginid].Destroy(g_slots[*slotid].plughandle);
+ need_asm_unregister = 1;
+ }
+
+ pthread_mutex_unlock(&g_slot_mutex);
+ debug_msg("After Slot_mutex UNLOCK\n");
+
+cleanup:
+ if(param->session_type != ASM_EVENT_CALL && param->session_type != ASM_EVENT_VIDEOCALL && need_asm_unregister == 1) {
+ 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;
+ }
+ }
+
+ debug_leave("\n");
+
+ return err;
+}
+
+#define DTMF_PLUGIN_COUNT 2
+int MMSoundMgrCodecPlayDtmf(int *slotid, const mmsound_mgr_codec_param_t *param)
+{
+ int count = 0;
+ int *codec_type;
+ mmsound_codec_info_t info;
+ mmsound_codec_param_t codec_param;
+ int err = MM_ERROR_NONE;
+
+ debug_enter("\n");
+
+ debug_msg("DTMF : [%d]\n",param->tone);
+ debug_msg("Repeat : [%d]\n",param->repeat_count);
+ debug_msg("Volume : [%f]\n",param->volume);
+
+ for (count = 0; g_plugins[count].GetSupportTypes; count++) {
+ /* Find codec */
+ codec_type = g_plugins[count].GetSupportTypes();
+ if(codec_type && (MM_SOUND_SUPPORTED_CODEC_DTMF == codec_type[0]))
+ break;
+ }
+
+ debug_msg("Find plugin codec ::: [%d]\n", count); /*The count num means codec type DTMF */
+
+ if (g_plugins[count].GetSupportTypes == NULL) { /* Codec not found */
+ debug_error("unsupported file type %d\n", count);
+ printf("unsupported file type %d\n", count);
+ err = MM_ERROR_SOUND_UNSUPPORTED_MEDIA_TYPE;
+ goto cleanup;
+ }
+
+ debug_msg("Get New handle\n");
+ codec_param.keytone = 0;
+
+ err = _MMSoundMgrCodecGetEmptySlot(slotid);
+ if(err != MM_ERROR_NONE)
+ {
+ debug_error("Empty g_slot is not found\n");
+ goto cleanup;
+ }
+
+ codec_param.tone = param->tone;
+ codec_param.priority = 0;
+ codec_param.volume_config = param->volume_config;
+ codec_param.repeat_count = param->repeat_count;
+ codec_param.volume = param->volume;
+ codec_param.stop_cb = _MMSoundMgrCodecStopCallback;
+ codec_param.param = *slotid;
+ codec_param.pid = (int)param->param;
+
+ pthread_mutex_lock(&g_slot_mutex);
+ debug_msg("After Slot_mutex LOCK\n");
+
+ //
+ /*
+ * Register ASM here
+ */
+ int errorcode = 0;
+ int need_asm_unregister = 0;
+
+ if(param->session_type != ASM_EVENT_CALL && param->session_type != ASM_EVENT_VIDEOCALL) {
+ if(!ASM_register_sound_ex((int)param->param, ¶m->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;
+ }
+ }
+
+ g_slots[*slotid].pluginid = count;
+ g_slots[*slotid].callback = param->callback;
+ g_slots[*slotid].param = param->param; /* This arg is used callback data */
+ g_slots[*slotid].session_type = param->session_type;
+ g_slots[*slotid].session_handle = param->session_handle;
+
+ debug_msg("Using Slotid : [%d] Slot Status : [%d]\n", *slotid, g_slots[*slotid].status);
+
+ err = g_plugins[g_slots[*slotid].pluginid].Create(&codec_param, &info, &(g_slots[*slotid].plughandle));
+ debug_msg("Created audio handle : [%d]\n", g_slots[*slotid].plughandle);
+ if (err != MM_ERROR_NONE) {
+ debug_error("Plugin create fail : 0x%08X\n", err);
+ g_slots[*slotid].status = STATUS_IDLE;
+ pthread_mutex_unlock(&g_slot_mutex);
+ debug_warning("After Slot_mutex UNLOCK\n");
+ need_asm_unregister = 1;
+ goto cleanup;
+ }
+
+ err = g_plugins[g_slots[*slotid].pluginid].Play(g_slots[*slotid].plughandle);
+ if (err != MM_ERROR_NONE) {
+ debug_error("Fail to play : 0x%08X\n", err);
+ g_plugins[g_slots[*slotid].pluginid].Destroy(g_slots[*slotid].plughandle);
+ need_asm_unregister = 1;
+ }
+
+ pthread_mutex_unlock(&g_slot_mutex);
+
+ debug_msg("Using Slotid : [%d] Slot Status : [%d]\n", *slotid, g_slots[*slotid].status);
+ debug_msg("After Slot_mutex UNLOCK\n")
+
+cleanup:
+ debug_leave("\n");
+
+ return err;
+}
+
+
+int MMSoundMgrCodecStop(const int slotid)
+{
+ int err = MM_ERROR_NONE;
+
+ debug_enter("(Slotid : [%d])\n", slotid);
+
+ if (slotid < 0 || MANAGER_HANDLE_MAX <= slotid) {
+ return MM_ERROR_INVALID_ARGUMENT;
+ }
+
+ pthread_mutex_lock (&g_slot_mutex);
+ debug_msg("After Slot_mutex LOCK\n");
+ if (g_slots[slotid].status == STATUS_IDLE) {
+ err = MM_ERROR_SOUND_INVALID_STATE;
+ debug_warning("The playing slots is not found, Slot ID : [%d]\n", slotid);
+ goto cleanup;
+ }
+ debug_msg("Found slot, Slotid [%d] State [%d]\n", slotid, g_slots[slotid].status);
+
+ err = g_plugins[g_slots[slotid].pluginid].Stop(g_slots[slotid].plughandle);
+ if (err != MM_ERROR_NONE) {
+ debug_error("Fail to STOP Code : 0x%08X\n", err);
+ }
+ debug_msg("Found slot, Slotid [%d] State [%d]\n", slotid, g_slots[slotid].status);
+cleanup:
+ pthread_mutex_unlock(&g_slot_mutex);
+ debug_msg("After Slot_mutex UNLOCK\n");
+ debug_leave("(err : 0x%08X)\n", err);
+
+ return err;
+}
+
+static int _MMSoundMgrCodecStopCallback(int param)
+{
+ int err = MM_ERROR_NONE;
+
+ debug_enter("(Slot : %d)\n", param);
+
+ pthread_mutex_lock(&g_slot_mutex);
+ debug_msg("[CODEC MGR] Slot_mutex lock done\n");
+
+
+ /*
+ * Unregister ASM here
+ */
+
+ int errorcode = 0;
+
+ 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_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);
+ }
+ }
+
+
+
+ if (g_slots[param].msgcallback) {
+ debug_msg("[CODEC MGR] msgcallback : %p\n", g_slots[param].msgcallback);
+ debug_msg("[CODEC MGR] msg data : %p\n", g_slots[param].msgdata);
+ debug_msg("[CODEC MGR] mgr codec callback : %p\n", g_slots[param].callback);
+ g_slots[param].callback((int)g_slots[param].param, g_slots[param].msgcallback, g_slots[param].msgdata); /*param means client msg_type */
+ }
+ debug_msg("Client callback msg_type (instance) : [%d]\n", (int)g_slots[param].param);
+ debug_msg("Handle allocated handle : [0x%08X]\n", g_slots[param].plughandle);
+ err = g_plugins[g_slots[param].pluginid].Destroy(g_slots[param].plughandle);
+ if (err < 0 ) {
+ debug_critical("[CODEC MGR] Fail to destroy slot number : [%d] err [0x%x]\n", param, err);
+ }
+ memset(&g_slots[param], 0, sizeof(__mmsound_mgr_codec_handle_t));
+ g_slots[param].status = STATUS_IDLE;
+ pthread_mutex_unlock(&g_slot_mutex);
+ debug_msg("[CODEC MGR] Slot_mutex done\n");
+
+ return err;
+}
+
+static int _MMSoundMgrCodecFindKeytoneSlot(int *slotid)
+{
+ int count = 0;
+ int err = MM_ERROR_NONE;
+
+ debug_enter("\n");
+
+ pthread_mutex_lock(&g_slot_mutex);
+ debug_warning("After Slot_mutex LOCK\n");
+
+ for (count = SOUND_SLOT_START; count < MANAGER_HANDLE_MAX ; count++) {
+ if (g_slots[count].status == STATUS_KEYTONE) {
+ break;
+ }
+ }
+ pthread_mutex_unlock(&g_slot_mutex);
+ debug_warning("After Slot_mutex UNLOCK\n");
+ if (count < MANAGER_HANDLE_MAX) {
+ debug_msg("Found keytone handle allocated (Slot : [%d])\n", count);
+ *slotid = count;
+ err = MM_ERROR_NONE;
+ } else {
+ debug_warning("Handle is full handle [KEY TONE] : [%d]\n", count);
+ err = MM_ERROR_SOUND_INTERNAL;
+ }
+
+ debug_leave("\n");
+
+ return err;
+}
+
+static int _MMSoundMgrCodecFindLocaleSlot(int *slotid)
+{
+ int count = 0;
+ int err = MM_ERROR_NONE;
+
+ debug_enter("\n");
+
+ pthread_mutex_lock(&g_slot_mutex);
+ debug_warning("After Slot_mutex LOCK\n");
+
+ for (count = SOUND_SLOT_START; count < MANAGER_HANDLE_MAX ; count++) {
+ if (g_slots[count].status == STATUS_LOCALE) {
+ break;
+ }
+ }
+ pthread_mutex_unlock(&g_slot_mutex);
+
+ debug_warning("After Slot_mutex UNLOCK\n");
+ if (count < MANAGER_HANDLE_MAX) {
+ debug_msg("Found locale handle allocated (Slot : [%d])\n", count);
+ *slotid = count;
+ err = MM_ERROR_NONE;
+ } else {
+ debug_warning("Handle is full handle [KEY TONE] \n");
+ err = MM_ERROR_SOUND_INTERNAL;
+ }
+
+ debug_leave("\n");
+
+ return err;
+}
+
+static int _MMSoundMgrCodecGetEmptySlot(int *slot)
+{
+ int count = 0;
+ int err = MM_ERROR_NONE;
+
+ debug_enter("\n");
+ debug_msg("Codec slot ID : [%d]\n", *slot);
+ pthread_mutex_lock(&g_slot_mutex);
+ debug_msg("After Slot_mutex LOCK\n");
+
+ for (count = SOUND_SLOT_START; count < MANAGER_HANDLE_MAX ; count++) {
+ if (g_slots[count].status == STATUS_IDLE) {
+ g_slots[count].status = STATUS_SOUND;
+ break;
+ }
+ }
+ pthread_mutex_unlock(&g_slot_mutex);
+ debug_msg("After Slot_mutex UNLOCK\n");
+
+ if (count < MANAGER_HANDLE_MAX) {
+ debug_msg("New handle allocated (codec slot ID : [%d])\n", count);
+ *slot = count;
+ err = MM_ERROR_NONE;
+ } else {
+ debug_warning("Handle is full handle : [%d]\n", count);
+ *slot = -1;
+ /* Temporal code for reset */
+ while(count--) {
+ g_slots[count].status = STATUS_IDLE;
+ }
+ err = MM_ERROR_SOUND_INTERNAL;
+ }
+
+ debug_leave("\n");
+
+ return err;
+}
+
+static int _MMSoundMgrCodecRegisterInterface(MMSoundPluginType *plugin)
+{
+ int err = MM_ERROR_NONE;
+ int count = 0;
+ void *getinterface = NULL;
+
+ debug_enter("\n");
+
+ /* find emptry slot */
+ for (count = 0; count < MM_SOUND_SUPPORTED_CODEC_NUM; count++) {
+ if (g_plugins[count].GetSupportTypes == NULL)
+ break;
+ }
+
+ if (count == MM_SOUND_SUPPORTED_CODEC_NUM) {
+ debug_critical("The plugin support type is not valid\n");
+ return MM_ERROR_COMMON_OUT_OF_RANGE;
+ }
+
+ debug_msg("Empty slot find : %d\n", count);
+
+ err = MMSoundPluginGetSymbol(plugin, CODEC_GET_INTERFACE_FUNC_NAME, &getinterface);
+ if (err != MM_ERROR_NONE) {
+ debug_error("Get Symbol CODEC_GET_INTERFACE_FUNC_NAME is fail : %x\n", err);
+ goto cleanup;
+ }
+ debug_msg("Getinterface name : %s\n", (char*)getinterface );
+
+ err = MMSoundPlugCodecCastGetInterface(getinterface)(&g_plugins[count]);
+ if (err != MM_ERROR_NONE) {
+ debug_error("Get interface fail : %x\n", err);
+
+cleanup:
+ /* If error occur, clean interface */
+ memset(&g_plugins[count], 0, sizeof(mmsound_codec_interface_t));
+ } else {
+ if (g_plugins[count].SetThreadPool)
+ g_plugins[count].SetThreadPool(MMSoundThreadPoolRun);
+ }
+
+ debug_leave("\n");
+
+ return err;
+}
+
--- /dev/null
+/*
+ * 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 */
+ ret = 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 */
+ ret = MMSoundMgrSessionIsDeviceAvailable(device_out, device_in, &is_available);
+ if (ret != MM_ERROR_NONE) {
+ debug_error("MMSoundMgrSessionIsDeviceAvailable() failed (%d)\n", ret);
+ goto FINISH;
+ }
+
+ /* 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");
+ ret = MM_ERROR_SOUND_INTERNAL;
+ goto FINISH;
+ }
+ msg->sound_msg.route_list[available_count++] = route_list[route_index];
+ }
+ }
+FINISH:
+ 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)) {
+
+ }
+
+ ret = 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();
+
+ ret = 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 = NULL;
+ _mm_sound_mgr_device_param_t *cb_param = NULL;
+ 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");
+ ret = MM_ERROR_SOUND_INTERNAL;
+ goto FINISH;
+ }
+ }
+
+FINISH:
+ 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 = NULL;
+ _mm_sound_mgr_device_param_t *cb_param = NULL;
+
+ 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 = NULL;
+ _mm_sound_mgr_device_param_t *cb_param = NULL;
+ 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))
+ {
+ memset(&msg, 0, sizeof(mm_ipc_msg_t));
+ 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 (%x)\n", ret);
+ goto FINISH;
+ }
+ }
+ }
+FINISH:
+ 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 = NULL;
+ _mm_sound_mgr_device_param_t *cb_param = NULL;
+ 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");
+ ret = MM_ERROR_SOUND_INTERNAL;
+ goto FINISH;
+ }
+ }
+FINISH:
+ 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 = NULL;
+ _mm_sound_mgr_device_param_t *cb_param = NULL;
+
+ 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 = NULL;
+ 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;
+
+ debug_fenter();
+
+ memset (&msg, 0, sizeof(mm_ipc_msg_t));
+
+ route_list_count = _mm_sound_get_valid_route_list(&route_list);
+ debug_log("in=[%x], out=[%x], route_list_count = [%d], available = [%d]", device_in, device_out, route_list_count, available);
+ 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");
+ return MM_ERROR_SOUND_INTERNAL;
+ }
+ debug_log("route_index [%d] is added to route_list [%d]", route_index, available_count);
+ 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");
+ goto FINISH;
+ }
+ }
+ }
+FINISH:
+ MMSOUND_LEAVE_CRITICAL_SECTION(&g_available_route_cb_mutex);
+
+ debug_fleave();
+ return ret;
+}
+
--- /dev/null
+/*
+ * 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 "include/mm_sound_mgr_dock.h"
+#include "include/mm_sound_mgr_session.h"
+
+/******************************* Dock Code **********************************/
+
+#include <sys/types.h>
+#include <stdbool.h>
+#include <errno.h>
+#include <assert.h>
+
+#include "mm_ipc.h"
+#include "mm_sound_common.h"
+#include "mm_sound.h"
+
+#include <vconf.h>
+#include <vconf-keys.h>
+
+#define SOUND_DOCK_ON "/usr/share/sounds/sound-server/dock.wav"
+#define SOUND_DOCK_OFF "/usr/share/sounds/sound-server/undock.wav"
+#define SOUND_DOCK_ON_DELAY 1000000
+#define SOUND_DOCK_OFF_DELAY 10000
+
+#define DOCK_OFF false
+#define DOCK_ON true
+
+#define DOCK_NO_RESTORE false
+#define DOCK_RESTORE true
+
+int g_saved_dock_status;
+
+static void __dock_sound_finished_cb (void *data)
+{
+ debug_log ("dock sound play finished!!!\n");
+ *(bool*)data = true;
+}
+static void __play_dock_sound_sync(bool is_on, bool need_restore)
+{
+ int handle;
+ bool is_play_finished = false;
+
+ if (g_saved_dock_status == -1) {
+ debug_log ("skip dock sound because status is not valid [%d]\n", g_saved_dock_status);
+ return;
+ }
+
+ debug_log ("start to play dock sound : is_on=[%d], need_restore=[%d]\n", is_on, need_restore);
+
+ if (need_restore) {
+ mm_sound_play_loud_solo_sound((is_on? SOUND_DOCK_ON:SOUND_DOCK_OFF), VOLUME_TYPE_FIXED, __dock_sound_finished_cb, &is_play_finished, &handle);
+ debug_log ("waiting for dock sound finish\n");
+ while (!is_play_finished) {
+ usleep (SOUND_DOCK_OFF_DELAY);
+ }
+ } else {
+ mm_sound_play_loud_solo_sound_no_restore((is_on? SOUND_DOCK_ON:SOUND_DOCK_OFF), VOLUME_TYPE_FIXED, __dock_sound_finished_cb, &is_play_finished, &handle);
+ debug_log ("waiting for dock sound finish\n");
+ usleep (SOUND_DOCK_ON_DELAY);
+ }
+
+ debug_log ("dock sound finished!!!\n");
+}
+
+/* DOCK status value from system server */
+static void _dock_status_changed_cb(keynode_t* node, void* data)
+{
+ int ret = 0;
+ int dock_enable = 0;
+ int dock_available = 0;
+
+ if (node == NULL) {
+ debug_error ("node is null...\n");
+ return;
+ }
+
+ debug_msg ("Handling [%s] Starts\n", vconf_keynode_get_name(node));
+
+ /* Get actual vconf value */
+ vconf_get_int(VCONFKEY_SYSMAN_CRADLE_STATUS, &dock_available);
+ debug_msg ("DOCK : [%s]=[%d]\n", VCONFKEY_SYSMAN_CRADLE_STATUS, dock_available);
+
+ /* Set available/non-available based on vconf status value */
+ if (dock_available) {
+ /* Check user preference first */
+ vconf_get_bool(VCONFKEY_DOCK_EXT_SPEAKER, &dock_enable);
+ debug_msg ("DOCK : [%s]=[%d]\n", VCONFKEY_DOCK_EXT_SPEAKER, dock_enable);
+
+ /* If user preference is enabled, available it */
+ if (dock_enable) {
+ /* Play sound for dock status */
+ __play_dock_sound_sync (DOCK_ON, DOCK_NO_RESTORE);
+
+ /* Update device available status (available) */
+ ret = MMSoundMgrSessionSetDeviceAvailable (DEVICE_DOCK, dock_available, 0, NULL);
+ if (ret != MM_ERROR_NONE) {
+ debug_error ("MMSoundMgrSessionSetDeviceAvailable() failed...ret=%x\n", ret);
+ goto EXIT;
+ }
+ } else {
+ /* Play sound for dock status */
+ __play_dock_sound_sync (DOCK_ON, DOCK_RESTORE);
+
+ debug_msg ("Dock is not enabled by user, no need to set available device\n");
+ }
+ } else {
+ /* Play sound for dock status */
+ __play_dock_sound_sync (DOCK_OFF, DOCK_RESTORE);
+
+ /* Update device available status (non-available) */
+ ret = MMSoundMgrSessionSetDeviceAvailable (DEVICE_DOCK, dock_available, 0, NULL);
+ if (ret != MM_ERROR_NONE) {
+ debug_error ("MMSoundMgrSessionSetDeviceAvailable() failed...ret=%x\n", ret);
+ goto EXIT;
+ }
+ }
+
+EXIT:
+ g_saved_dock_status = dock_available;
+
+ debug_msg ("Handling [%s] Ends normally\n", vconf_keynode_get_name(node));
+}
+
+static int _register_dock_status ()
+{
+ /* set callback for vconf key change */
+ int ret = vconf_notify_key_changed(VCONFKEY_SYSMAN_CRADLE_STATUS, _dock_status_changed_cb, NULL);
+ debug_msg ("vconf [%s] set ret = [%d]\n", VCONFKEY_SYSMAN_CRADLE_STATUS, ret);
+ return ret;
+}
+
+/* DOCK enable setting */
+static void _dock_setting_enable_changed_cb(keynode_t* node, void* data)
+{
+ int ret = 0;
+ int dock_enable = 0;
+ int dock_available = 0;
+
+ if (node == NULL) {
+ debug_error ("node is null...return\n");
+ return;
+ }
+
+ debug_msg ("Handling [%s] Starts\n", vconf_keynode_get_name(node));
+
+ /* Get actual vconf value */
+ vconf_get_bool(VCONFKEY_DOCK_EXT_SPEAKER, &dock_enable);
+ debug_msg ("DOCK : [%s]=[%d]\n", VCONFKEY_DOCK_EXT_SPEAKER, dock_enable);
+
+ vconf_get_int(VCONFKEY_SYSMAN_CRADLE_STATUS, &dock_available);
+ debug_msg ("DOCK : [%s]=[%d]\n", VCONFKEY_SYSMAN_CRADLE_STATUS, dock_available);
+
+ /* Take care if dock is available now */
+ if (dock_available) {
+ ret = MMSoundMgrSessionSetDeviceAvailable (DEVICE_DOCK, dock_enable, 0, NULL);
+ if (ret != MM_ERROR_NONE) {
+ debug_error ("MMSoundMgrSessionSetDeviceAvailable() failed...ret=%x\n", ret);
+ return;
+ }
+ } else {
+ /* Do nothing */
+ debug_msg ("Dock is enabled/disabled while not available, Nothing to do Now\n");
+ }
+
+ debug_msg ("Handling [%s] Ends normally\n", vconf_keynode_get_name(node));
+}
+
+static int _register_dock_enable_setting ()
+{
+ /* set callback for vconf key change */
+ int ret = vconf_notify_key_changed(VCONFKEY_DOCK_EXT_SPEAKER, _dock_setting_enable_changed_cb, NULL);
+ debug_msg ("vconf [%s] set ret = [%d]\n", VCONFKEY_DOCK_EXT_SPEAKER, ret);
+ return ret;
+}
+
+
+
+int MMSoundMgrDockInit(void)
+{
+ int ret = 0;
+ debug_enter("\n");
+
+ g_saved_dock_status = -1;
+
+ ret = vconf_get_int(VCONFKEY_SYSMAN_CRADLE_STATUS, &g_saved_dock_status);
+ debug_msg ("Initial status is [%d], ret=[%d]\n", g_saved_dock_status, ret);
+
+ if (_register_dock_status () != 0) {
+ debug_error ("Registering dock status failed\n");
+ return MM_ERROR_SOUND_INTERNAL;
+ }
+ if (_register_dock_enable_setting() != 0) {
+ debug_error ("Registering dock enable setting failed\n");
+ return MM_ERROR_SOUND_INTERNAL;
+ }
+
+ debug_leave("\n");
+ return MM_ERROR_NONE;
+}
+
+int MMSoundMgrDockFini(void)
+{
+ debug_enter("\n");
+
+ debug_leave("\n");
+ return MM_ERROR_NONE;
+}
+
--- /dev/null
+/*
+ * 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 "include/mm_sound_mgr_hdmi.h"
+#include "include/mm_sound_mgr_session.h"
+
+/******************************* HDMI Code **********************************/
+
+#include "mm_sound.h"
+
+#include <vconf.h>
+#include <vconf-keys.h>
+
+
+/* HDMI status value from system server */
+static void _hdmi_status_changed_cb(keynode_t* node, void* data)
+{
+ int hdmi_available = 0;
+
+ /* Get actual vconf value */
+ vconf_get_int(VCONFKEY_SYSMAN_HDMI, &hdmi_available);
+
+ debug_msg ("[%s] changed callback called\n", vconf_keynode_get_name(node));
+ debug_msg ("HDMI : [%s]=[%d]\n",
+ VCONFKEY_SYSMAN_HDMI, hdmi_available);
+
+ MMSoundMgrSessionSetDeviceAvailable (DEVICE_HDMI, hdmi_available, 0, NULL);
+}
+
+static int _register_hdmi_status(void)
+{
+ /* set callback for vconf key change */
+ int ret = vconf_notify_key_changed(VCONFKEY_SYSMAN_HDMI, _hdmi_status_changed_cb, NULL);
+ debug_msg ("vconf [%s] set ret = [%d]\n", VCONFKEY_SYSMAN_HDMI, ret);
+ return ret;
+}
+
+int MMSoundMgrHdmiInit(void)
+{
+ debug_enter("\n");
+
+ if (_register_hdmi_status() != 0) {
+ debug_error ("Registering hdmi status failed\n");
+ return MM_ERROR_SOUND_INTERNAL;
+ }
+
+ debug_leave("\n");
+ return MM_ERROR_NONE;
+}
+
+int MMSoundMgrHdmiFini(void)
+{
+ debug_enter("\n");
+
+ debug_leave("\n");
+ return MM_ERROR_NONE;
+}
+
--- /dev/null
+/*
+ * 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_thread_pool.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
+
+void __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(¤t_type, &waitfd)))
+ return;
+
+ while(1) {
+ //waiting earjack event
+ err = avsys_audio_earjack_manager_wait(waitfd, ¤t_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;
+
+fail:
+ debug_error("earjack manager exit with 0x%x\n", 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;
+}
+
--- /dev/null
+/*
+ * 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 <errno.h>
+
+#include "include/mm_sound_mgr_common.h"
+#include "include/mm_sound_mgr_ipc.h"
+
+#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>
+
+#include <audio-session-manager.h>
+
+#define SHM_OPEN
+
+#ifdef PULSE_CLIENT
+#include "include/mm_sound_mgr_pulse.h"
+#endif
+
+/* message id */
+int g_rcvid;
+int g_sndid;
+int g_cbid;
+
+
+/* Msg processing */
+static void _MMSoundMgrRun(void *data);
+static int _MMSoundMgrStopCB(int msgid, void* msgcallback, void *msgdata); /* msg_type means instance for client */
+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 _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);
+
+int MMSoundMgrIpcInit(void)
+{
+ debug_fenter();
+
+ /* create msg queue rcv, snd, cb */
+ /* This func is called only once */
+ g_rcvid = msgget(ftok(KEY_BASE_PATH, RCV_MSG), IPC_CREAT |0666);
+ g_sndid = msgget(ftok(KEY_BASE_PATH, SND_MSG), IPC_CREAT |0666);
+ g_cbid = msgget(ftok(KEY_BASE_PATH, CB_MSG), IPC_CREAT |0666);
+
+ if ((g_rcvid == -1 || g_sndid == -1 || g_cbid == -1) != MM_ERROR_NONE) {
+ if(errno == EACCES)
+ printf("Require ROOT permission.\n");
+ else if(errno == EEXIST)
+ printf("System memory is empty.\n");
+ else if(errno == ENOMEM)
+ printf("System memory is empty.\n");
+ else if(errno == ENOSPC)
+ printf("Resource is empty.\n");
+
+ debug_error("Fail to create msgid\n");
+ exit(1);
+ return MM_ERROR_SOUND_INTERNAL;
+ }
+
+ debug_msg("Created server msg queue id : [%d]\n", g_rcvid);
+ debug_msg("Created server msg queue id : [%d]\n", g_sndid);
+ debug_msg("Created server msg queue id : [%d]\n", g_cbid);
+
+ debug_fleave();
+ return MM_ERROR_NONE;
+}
+
+int MMSoundMgrIpcFini(void)
+{
+ return MM_ERROR_NONE;
+}
+
+int MMSoundMgrIpcReady(void)
+{
+ int ret = MM_ERROR_NONE;
+ int err1, err2, err3;
+ mm_ipc_msg_t msg = {0,};
+ mm_ipc_msg_t resp = {0,};
+
+ debug_fenter();
+
+ debug_msg("Created server msg queue id : [%d]\n", g_rcvid);
+ debug_msg("Created server msg queue id : [%d]\n", g_sndid);
+ debug_msg("Created server msg queue id : [%d]\n", g_cbid);
+
+ /* Ready to recive message */
+ while(1) {
+ ret = _MMIpcRecvMsg(0, &msg);
+ if (ret != MM_ERROR_NONE) {
+ debug_critical("Fail recieve message. \n");
+ exit(1);
+ }
+
+ debug_msg("msgtype : %d\n", msg.sound_msg.msgtype);
+ debug_msg("instance msgid : %d\n", msg.sound_msg.msgid);
+ debug_msg("handle : %d\n", msg.sound_msg.handle);
+ debug_msg("volume : %d\n", msg.sound_msg.volume);
+ debug_msg("keytone : %d\n", msg.sound_msg.keytone);
+ debug_msg("tone : %d\n", msg.sound_msg.tone);
+ debug_msg("callback : %p\n", msg.sound_msg.callback);
+ debug_msg("volume_config : %x\n", msg.sound_msg.volume_config);
+ debug_msg("priority : %d\n", msg.sound_msg.priority);
+ debug_msg("data : %p\n", msg.sound_msg.cbdata);
+ debug_msg("route : %d\n", msg.sound_msg.handle_route);
+
+ switch (msg.sound_msg.msgtype)
+ {
+ case MM_SOUND_MSG_REQ_FILE:
+ case MM_SOUND_MSG_REQ_MEMORY:
+ case MM_SOUND_MSG_REQ_STOP:
+#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:
+ 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));
+ if (msg_to_queue) {
+ memcpy (msg_to_queue, &msg, sizeof (mm_ipc_msg_t));
+ debug_msg ("func = %p, alloc param(msg_to_queue) = %p\n", _MMSoundMgrRun, msg_to_queue);
+ ret = MMSoundThreadPoolRun(msg_to_queue, _MMSoundMgrRun);
+ /* In case of error condition */
+ if (ret != MM_ERROR_NONE) {
+ /* Do not send msg in Ready, Just print log */
+ debug_critical("Fail to run thread [MgrRun]");
+
+ SOUND_MSG_SET(resp.sound_msg, MM_SOUND_MSG_RES_ERROR, ret, -1, msg.sound_msg.msgid);
+ ret = _MMIpcSndMsg(&resp);
+ if (ret != MM_ERROR_NONE)
+ debug_error("Fail to send message in IPC ready\n");
+ }
+ } else {
+ debug_error ("failed to alloc msg\n");
+ }
+ }
+ break;
+
+ default:
+ /*response err unknown operation*/;
+ debug_critical("Error condition\n");
+ debug_msg("The message Msg [%d] client id [%d]\n", msg.sound_msg.msgtype, msg.sound_msg.msgid);
+ SOUND_MSG_SET(resp.sound_msg, MM_SOUND_MSG_RES_ERROR, ret, -1, msg.sound_msg.msgid);
+ ret = _MMIpcSndMsg(&resp);
+ if (ret != MM_ERROR_NONE)
+ debug_error("Fail to send message in IPC ready\n");
+ break;
+ } /* end : switch (msg.sound_msg.msgtype) */
+ }
+
+ /* destroy msg queue */
+ err1 = msgctl(g_rcvid, IPC_RMID, NULL);
+ err2 = msgctl(g_sndid, IPC_RMID, NULL);
+ err3 = msgctl(g_cbid, IPC_RMID, NULL);
+
+ if (err1 == -1 ||err2 == -1 ||err3 ==-1) {
+ debug_error("Base message node destroy fail");
+ return MM_ERROR_SOUND_INTERNAL;
+ }
+
+ debug_fleave();
+ return MM_ERROR_NONE;
+}
+
+static void _MMSoundMgrRun(void *data)
+{
+ mm_ipc_msg_t respmsg = {0,};
+ 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;
+ mm_ipc_msg_t *msg = (mm_ipc_msg_t *)data;
+
+ debug_fenter();
+
+ instance = msg->sound_msg.msgid;
+
+ switch (msg->sound_msg.msgtype)
+ {
+ case MM_SOUND_MSG_REQ_FILE:
+ debug_msg("Recv REQUEST FILE MSG\n");
+ ret = _MMSoundMgrIpcPlayFile(&handle, msg);
+ if ( ret != MM_ERROR_NONE) {
+ debug_error("Error to MM_SOUND_MSG_REQ_FILE\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_FILE, handle, MM_ERROR_NONE, instance);
+ }
+ break;
+
+ case MM_SOUND_MSG_REQ_MEMORY:
+ debug_msg("Recv REQUEST MEMORY MSG\n");
+ ret =_MMSoundMgrIpcPlayMemory(&handle, msg);
+ if (ret != MM_ERROR_NONE) {
+ debug_error("Error to MM_SOUND_MSG_REQ_MEMORY.\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_MEMORY, handle, MM_ERROR_NONE, instance);
+ }
+ break;
+
+ case MM_SOUND_MSG_REQ_STOP:
+ debug_msg("Recv STOP msg\n");
+ debug_msg("STOP Handle(codec slot ID) %d \n", msg->sound_msg.handle);
+ ret = _MMSoundMgrIpcStop(msg);
+ if ( ret != MM_ERROR_NONE) {
+ debug_error("Error to MM_SOUND_MSG_REQ_STOP.\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_STOP, msg->sound_msg.handle, MM_ERROR_NONE, instance);
+ }
+ break;
+
+#ifdef PULSE_CLIENT
+ case MM_SOUND_MSG_REQ_IS_BT_A2DP_ON:
+ debug_msg("Recv REQ_IS_BT_A2DP_ON msg\n");
+ MMSoundMgrPulseHandleIsBtA2DPOnReq (msg,_MMIpcSndMsg);
+ return;
+#endif // PULSE_CLIENT
+
+ case MM_SOUND_MSG_REQ_DTMF:
+ debug_msg("Recv DTMF msg\n");
+ debug_msg(" Handle(codec slot ID) %d \n", msg->sound_msg.handle);
+ ret = _MMSoundMgrIpcPlayDTMF(&handle, msg);
+ if ( ret != MM_ERROR_NONE) {
+ debug_error("Error to MM_SOUND_MSG_REQ_STOP.\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_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 );
+ SOUND_MSG_SET(respmsg.sound_msg, MM_SOUND_MSG_RES_ERROR, -1, MM_ERROR_SOUND_INTERNAL, instance);
+ break;
+ } /* switch (msg->sound_msg.msgtype) */
+
+ ret = _MMIpcSndMsg(&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",
+ msg->sound_msg.msgid, respmsg.sound_msg.handle, respmsg.sound_msg.msgtype, respmsg.sound_msg.code);
+
+ if (msg) {
+ debug_log ("Free mm_ipc_msg_t [%p]\n", msg);
+ free (msg);
+ }
+
+ debug_msg("Ready to next msg\n");
+ debug_fleave();
+}
+
+static int _MMSoundMgrStopCB(int msgid, void* msgcallback, void *msgdata)
+{
+ /* msgid means client instance(msg_type) must be unique */
+ mm_ipc_msg_t resp = {0,};
+ int ret = MM_ERROR_SOUND_INTERNAL;
+
+ debug_fenter();
+
+ SOUND_MSG_SET(resp.sound_msg, MM_SOUND_MSG_INF_STOP_CB, 0, MM_ERROR_NONE, msgid);
+ resp.sound_msg.callback = msgcallback;
+ resp.sound_msg.cbdata = msgdata;
+
+ ret = _MMIpcCBSndMsg(&resp);
+ if (ret != MM_ERROR_NONE)
+ debug_error("Fail to send callback message\n");
+
+ debug_fleave();
+ return MM_ERROR_NONE;
+}
+
+static int _MMSoundMgrIpcPlayFile(int *codechandle, mm_ipc_msg_t *msg)
+{
+ mmsound_mgr_codec_param_t param = {0,};
+ MMSourceType *source = NULL;
+ int ret = MM_ERROR_NONE;
+ int mm_session_type = MM_SESSION_TYPE_SHARE;
+
+ debug_fenter();
+
+ /* Set source */
+ source = (MMSourceType*)malloc(sizeof(MMSourceType));
+
+ ret = mm_source_open_file(msg->sound_msg.filename, source, MM_SOURCE_CHECK_DRM_CONTENTS);
+ if(ret != MM_ERROR_NONE) {
+ debug_error("Fail to open file\n");
+ if (source)
+ free(source);
+ return ret;
+ }
+
+ /* Set sound player parameter */
+ param.tone = msg->sound_msg.tone;
+ param.repeat_count = msg->sound_msg.repeat;
+ param.param = (void*)msg->sound_msg.msgid; //this is pid of client
+ param.volume = msg->sound_msg.volume;
+ param.volume_config = msg->sound_msg.volume_config;
+ param.priority = msg->sound_msg.priority;
+ mm_session_type = msg->sound_msg.session_type;
+ param.callback = _MMSoundMgrStopCB;
+ param.keytone = msg->sound_msg.keytone;
+ param.msgcallback = msg->sound_msg.callback;
+ param.msgdata = msg->sound_msg.cbdata;
+ param.source = source;
+ param.handle_route = msg->sound_msg.handle_route;
+
+ debug_msg("DTMF %d\n", param.tone);
+ debug_msg("Loop %d\n", param.repeat_count);
+ debug_msg("Volume %d\n", param.volume);
+ debug_msg("Priority %d\n", param.priority);
+ debug_msg("VolumeConfig %x\n", param.volume_config);
+ debug_msg("callback %p\n", param.callback);
+ debug_msg("param %d\n", (int)param.param);
+ debug_msg("source type %d\n", param.source->type);
+ debug_msg("source ptr %p\n", param.source->ptr);
+ 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)
+ {
+ case MM_SESSION_TYPE_SHARE:
+ param.session_type = ASM_EVENT_SHARE_MMSOUND;
+ break;
+ case MM_SESSION_TYPE_EXCLUSIVE:
+ param.session_type = ASM_EVENT_EXCLUSIVE_MMSOUND;
+ break;
+ case MM_SESSION_TYPE_NOTIFY:
+ param.session_type = ASM_EVENT_NOTIFY;
+ break;
+ case MM_SESSION_TYPE_ALARM:
+ param.session_type = ASM_EVENT_ALARM;
+ break;
+ case MM_SESSION_TYPE_EMERGENCY:
+ param.session_type = ASM_EVENT_EMERGENCY;
+ break;
+ case MM_SESSION_TYPE_CALL:
+ param.session_type = ASM_EVENT_CALL;
+ break;
+ case MM_SESSION_TYPE_VIDEOCALL:
+ param.session_type = ASM_EVENT_VIDEOCALL;
+ break;
+ default:
+ debug_error("Unknown session type - use default shared type. %s %d\n", __FUNCTION__, __LINE__);
+ param.session_type = ASM_EVENT_SHARE_MMSOUND;
+ break;
+ }
+
+
+ ret = MMSoundMgrCodecPlay(codechandle, ¶m);
+ if ( ret != MM_ERROR_NONE) {
+ debug_error("Will be closed a sources, codechandle : 0x%08X\n", *codechandle);
+
+ return ret;
+ }
+
+ debug_fleave();
+ return MM_ERROR_NONE;
+}
+static int _MMSoundMgrIpcStop(mm_ipc_msg_t *msg)
+{
+ int ret = MM_ERROR_NONE;
+
+ debug_fenter();
+
+ ret = MMSoundMgrCodecStop(msg->sound_msg.handle);
+
+ if (ret != MM_ERROR_NONE) {
+ debug_error("Fail to stop sound\n");
+ return ret;
+ }
+
+ debug_fleave();
+ return MM_ERROR_NONE;
+}
+
+static int _MMSoundMgrIpcPlayMemory(int *codechandle, mm_ipc_msg_t *msg)
+{
+ mmsound_mgr_codec_param_t param = {0,};
+ MMSourceType *source = NULL;
+ int ret = MM_ERROR_NONE;
+ int shm_fd = -1;
+ void* mmap_buf = NULL;
+
+ debug_fenter();
+
+#ifndef SHM_OPEN
+ if ((shmid = shmget((key_t)(msg->sound_msg.sharedkey), msg->sound_msg.memsize, 0)) == -1)
+ {
+ if(errno == ENOENT)
+ {
+ debug_error("Not initialized.\n");
+ }
+ else if(errno == EACCES)
+ {
+ debug_error("Require ROOT permission.\n");
+ }
+ else if(errno == ENOSPC)
+ {
+ debug_critical("Resource is empty.\n");
+ }
+ return MM_ERROR_SOUND_INTERNAL;
+ }
+
+ source = (MMSourceType*)malloc(sizeof(MMSourceType));
+
+ if (mm_source_open_full_memory(shmat(shmid, 0, 0), msg->sound_msg.memsize, 0, source) != MM_ERROR_NONE)
+ {
+ debug_error("Fail to set source\n");
+ free(source);
+ return MM_ERROR_SOUND_INTERNAL;
+ }
+#else
+
+ debug_msg("Shm file name : %s\n", msg->sound_msg.filename);
+
+ if(msg->sound_msg.sharedkey != 1) {
+ debug_error("NOT memory interface\n");
+ return MM_ERROR_SOUND_INVALID_PATH;
+ }
+
+ shm_fd = shm_open(msg->sound_msg.filename, O_RDONLY, 0666);
+ if(shm_fd < 0) {
+ debug_error("Fail to open\n");
+ return MM_ERROR_SOUND_INTERNAL;
+ }
+
+ mmap_buf = mmap (0, MEMTYPE_SUPPORT_MAX, PROT_READ , MAP_SHARED, shm_fd, 0);
+ if (mmap_buf == MAP_FAILED) {
+ perror("Fail to mmap\n");
+ debug_error("MMAP failed \n");
+ return MM_ERROR_SOUND_INTERNAL;
+ }
+
+ /* Set source */
+ source = (MMSourceType*)malloc(sizeof(MMSourceType));
+ if(!source) {
+ debug_error("Can not allocate memory");
+ return MM_ERROR_OUT_OF_MEMORY;
+ }
+
+ if (mm_source_open_full_memory(mmap_buf, msg->sound_msg.memsize, 0, source) != MM_ERROR_NONE) {
+ debug_error("Fail to set source\n");
+ free(source);
+ return MM_ERROR_SOUND_INTERNAL;
+ }
+#endif
+
+ /* Set sound player parameter */
+ param.tone = msg->sound_msg.tone;
+ param.repeat_count = msg->sound_msg.repeat;
+ param.param = (void*)msg->sound_msg.msgid;
+ param.volume = msg->sound_msg.volume;
+ param.volume_config = msg->sound_msg.volume_config;
+ param.callback = _MMSoundMgrStopCB;
+ param.keytone = msg->sound_msg.keytone;
+ param.msgcallback = msg->sound_msg.callback;
+ param.msgdata = msg->sound_msg.cbdata;
+ param.priority = msg->sound_msg.priority;
+ param.source = source;
+
+ debug_msg("DTMF %d\n", param.tone);
+ debug_msg("Loop %d\n", param.repeat_count);
+ debug_msg("Volume %d\n",param.volume);
+ debug_msg("Priority %d\n",param.priority);
+ debug_msg("VolumeConfig %x\n",param.volume_config);
+ debug_msg("callback %p\n", param.callback);
+ debug_msg("param %d\n", (int)param.param);
+ debug_msg("source type %d\n", param.source->type);
+ debug_msg("source ptr %p\n", param.source->ptr);
+ debug_msg("keytone %d\n", param.keytone);
+
+ ret = MMSoundMgrCodecPlay(codechandle, ¶m);
+ if ( ret != MM_ERROR_NONE) {
+ debug_error("Will be closed a sources, codec handle : [0x%d]\n", *codechandle);
+ mm_source_close(source);
+ if (source)
+ free(source);
+ return ret;
+ }
+
+ debug_fleave();
+ return ret;
+}
+
+static int _MMSoundMgrIpcPlayDTMF(int *codechandle, mm_ipc_msg_t *msg)
+{
+ mmsound_mgr_codec_param_t param = {0,};
+ int ret = MM_ERROR_NONE;
+
+ debug_fenter();
+
+ /* Set sound player parameter */
+ param.tone = msg->sound_msg.tone;
+ param.repeat_count = msg->sound_msg.repeat;
+ param.param = (void*)msg->sound_msg.msgid;
+ param.volume = msg->sound_msg.volume;
+ param.volume_config = msg->sound_msg.volume_config;
+ param.priority = msg->sound_msg.priority;
+ param.callback = _MMSoundMgrStopCB;
+ param.msgcallback = msg->sound_msg.callback;
+ param.msgdata = msg->sound_msg.cbdata;
+
+ //convert mm_session_type to asm_event_type
+ switch(msg->sound_msg.session_type)
+ {
+ case MM_SESSION_TYPE_SHARE:
+ param.session_type = ASM_EVENT_SHARE_MMSOUND;
+ break;
+ case MM_SESSION_TYPE_EXCLUSIVE:
+ param.session_type = ASM_EVENT_EXCLUSIVE_MMSOUND;
+ break;
+ case MM_SESSION_TYPE_NOTIFY:
+ param.session_type = ASM_EVENT_NOTIFY;
+ break;
+ case MM_SESSION_TYPE_ALARM:
+ param.session_type = ASM_EVENT_ALARM;
+ break;
+ case MM_SESSION_TYPE_EMERGENCY:
+ param.session_type = ASM_EVENT_EMERGENCY;
+ break;
+ case MM_SESSION_TYPE_CALL:
+ param.session_type = ASM_EVENT_CALL;
+ break;
+ case MM_SESSION_TYPE_VIDEOCALL:
+ param.session_type = ASM_EVENT_VIDEOCALL;
+ break;
+ default:
+ debug_error("Unknown session type - use default shared type. %s %d\n", __FUNCTION__, __LINE__);
+ param.session_type = ASM_EVENT_SHARE_MMSOUND;
+ break;
+ }
+
+ debug_msg("DTMF %d\n", param.tone);
+ debug_msg("Loop %d\n", param.repeat_count);
+ debug_msg("Volume %d\n",param.volume);
+ debug_msg("VolumeConfig %x\n",param.volume_config);
+ debug_msg("Priority %d\n", param.priority);
+ debug_msg("callback %p\n", param.callback);
+ debug_msg("param %d\n", (int)param.param);
+ debug_msg("session %d\n", param.session_type);
+
+ ret = MMSoundMgrCodecPlayDtmf(codechandle, ¶m);
+ if ( ret != MM_ERROR_NONE) {
+ debug_error("Will be closed a sources, codec handle : [0x%d]\n", *codechandle);
+ return ret;
+ }
+
+ 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;
+ int ret = MM_ERROR_NONE;
+
+ debug_fenter();
+
+ param.route = msg->sound_msg.route;
+ ret = _mm_sound_mgr_device_is_route_available(¶m, 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);
+
+ debug_fleave();
+ return ret;
+}
+
+static int __mm_sound_mgr_ipc_set_active_route(mm_ipc_msg_t *msg)
+{
+ _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(¶m);
+
+ 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(¶m, 0x00, sizeof(_mm_sound_mgr_device_param_t));
+ param.pid = msg->sound_msg.msgid;
+
+ ret = _mm_sound_mgr_device_get_active_device(¶m, 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(¶m, 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(¶m);
+
+ 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(¶m, 0x00, sizeof(_mm_sound_mgr_device_param_t));
+ param.pid = msg->sound_msg.msgid;
+
+ ret = _mm_sound_mgr_device_remove_active_device_callback(¶m);
+
+ 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(¶m, 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(¶m);
+
+ 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(¶m, 0x00, sizeof(_mm_sound_mgr_device_param_t));
+ param.pid = msg->sound_msg.msgid;
+
+ ret = _mm_sound_mgr_device_remove_available_route_callback(¶m);
+
+ debug_fleave();
+ return ret;
+}
+
+static int _MMIpcRecvMsg(int msgtype, mm_ipc_msg_t *msg)
+{
+ /* rcv message */
+ if(msgrcv(g_rcvid, msg, DSIZE, 0, 0) == -1)
+ {
+ if(errno == E2BIG) {
+ debug_warning("Not acces.\n");
+ } else if(errno == EACCES) {
+ debug_warning("Access denied\n");
+ } else if(errno == ENOMSG) {
+ debug_warning("Blocked process [msgflag & IPC_NOWAIT != 0]\n");
+ } else if(errno == EIDRM) {
+ debug_warning("Removed msgid from system\n");
+ } else if(errno == EINTR) {
+ debug_warning("Iterrrupted by singnal\n");
+ } else if(errno == EINVAL) {
+ debug_warning("Invalid msgid \n");
+ }
+
+ debug_warning("Fail to recive msg queue : [%d] \n", g_rcvid);
+ return MM_ERROR_COMMON_UNKNOWN;
+ }
+ return MM_ERROR_NONE;
+}
+
+int _MMIpcSndMsg(mm_ipc_msg_t *msg)
+{
+ /* snd message */
+ int error = MM_ERROR_NONE;
+ msg->msg_type = msg->sound_msg.msgid;
+ debug_msg("Send message type (for client) : [%ld]\n",msg->msg_type);
+ error = msgsnd(g_sndid, msg,DSIZE, 0);
+ if ( error == -1)
+ {
+ if(errno == EACCES) {
+ debug_warning("Not acces.\n");
+ } else if(errno == EAGAIN) {
+ debug_warning("Blocked process [msgflag & IPC_NOWAIT != 0]\n");
+ } else if(errno == EIDRM) {
+ debug_warning("Removed msgid from system\n");
+ } else if(errno == EINTR) {
+ debug_warning("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("The address pointed to by msgp isn't accessible \n");
+ } else if(errno == ENOMEM) {
+ debug_warning("The system does not have enough memory to make a copy of the message pointed to by msgp\n");
+ }
+ debug_critical("Fail to send message msg queue : [%d] \n", g_sndid);
+ debug_critical("Fail to send message msg queue : [%d] \n", errno);
+ return MM_ERROR_SOUND_INTERNAL;
+ }
+ return MM_ERROR_NONE;
+}
+
+int _MMIpcCBSndMsg(mm_ipc_msg_t *msg)
+{
+ /* rcv message */
+ msg->msg_type = msg->sound_msg.msgid;
+ debug_msg("Send CB message type (for client) : [%ld]\n",msg->msg_type);
+ if (msgsnd(g_cbid, msg,DSIZE, 0)== -1)
+ {
+ if(errno == EACCES) {
+ debug_warning("Not acces.\n");
+ } else if(errno == EAGAIN) {
+ debug_warning("Blocked process [msgflag & IPC_NOWAIT != 0]\n");
+ } else if(errno == EIDRM) {
+ debug_warning("Removed msgid from system\n");
+ } else if(errno == EINTR) {
+ debug_warning("Iterrrupted by singnal\n");
+ } else if(errno == EINVAL) {
+ debug_warning("Invalid msgid or msgtype < 1 or out of data size \n");
+ }
+ debug_critical("Fail to callback send message msg queue : [%d] \n", g_cbid);
+ return MM_ERROR_SOUND_INTERNAL;
+ }
+ return MM_ERROR_NONE;
+}
+
--- /dev/null
+/*
+ * 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 <pulse/pulseaudio.h>
+#include <pulse/ext-policy.h>
+
+#define SUPPORT_MONO_AUDIO
+
+#define SUPPORT_BT_SCO_DETECT
+
+#include "include/mm_sound_mgr_pulse.h"
+#include "include/mm_sound_mgr_session.h"
+
+#include "include/mm_sound_msg.h"
+#include "include/mm_sound_mgr_ipc.h"
+
+
+#include <vconf.h>
+#include <vconf-keys.h>
+
+#define MAX_STRING 32
+
+typedef struct _pulse_info
+{
+ pa_threaded_mainloop *m;
+ pa_context *context;
+ char device_api_name[MAX_STRING];
+ char device_bus_name[MAX_STRING];
+ bool init_bt_status;
+ int bt_idx;
+ int usb_idx;
+}pulse_info_t;
+
+pthread_mutex_t g_mutex = PTHREAD_MUTEX_INITIALIZER;
+
+pulse_info_t* pulse_info = NULL;
+
+#define DEVICE_BUS_USB "usb"
+#define DEVICE_BUS_BUILTIN "builtin"
+#define IS_STREQ(str1, str2) (strcmp (str1, str2) == 0)
+#define IS_BUS_USB(bus) IS_STREQ(bus, DEVICE_BUS_USB)
+
+/* -------------------------------- PULSEAUDIO --------------------------------------------*/
+
+static void server_info_cb(pa_context *c, const pa_server_info *i, void *userdata)
+{
+ int ret = 0;
+
+ if (!i) {
+ debug_error("error in server info callback\n");
+
+ } else {
+ debug_msg ("We got default sink = [%s]\n", i->default_sink_name);
+
+ /* 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);
+ }
+ }
+
+
+}
+
+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;
+ }
+
+ if (strstr (i->name, "bluez")) {
+ pinfo->init_bt_status = true;
+ }
+}
+
+static void new_card_info_cb (pa_context *c, const pa_card_info *i, int eol, void *userdata)
+{
+ int ret = 0;
+ char* desc = NULL;
+ char* bus = NULL;
+ pulse_info_t *pinfo = (pulse_info_t *)userdata;
+
+ if (eol || i == NULL || pinfo == NULL) {
+ return;
+ }
+
+ bus = pa_proplist_gets(i->proplist, PA_PROP_DEVICE_BUS);
+ debug_msg ("[%s][%d] card name is [%s], card.property.device.bus = [%s]\n", __func__, __LINE__, i->name, bus);
+
+ if (IS_BUS_USB(bus)) {
+ ret = MMSoundMgrSessionSetDeviceAvailable (DEVICE_USB_AUDIO, AVAILABLE, 0, (desc)? desc : "NONAME");
+ if (ret != MM_ERROR_NONE) {
+ /* TODO : Error Handling */
+ debug_error ("MMSoundMgrSessionSetDeviceAvailable failed....ret = [%x]\n", ret);
+ }
+ /* Store USB index for future removal */
+ pinfo->usb_idx = i->index;
+
+ } else { /* other than USB, we assume this is BT */
+ /* 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);
+
+ /* 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);
+ }
+ /* Store BT index for future removal */
+ pinfo->bt_idx = i->index;
+ }
+}
+
+static void context_subscribe_cb (pa_context * c, pa_subscription_event_type_t t, uint32_t idx, void *userdata)
+{
+ pulse_info_t *pinfo = (pulse_info_t *)userdata;
+ debug_msg (">>>>>>>>> [%s][%d] type=(0x%x) idx=(%u) pinfo=(%p)\n", __func__, __LINE__, t, idx, pinfo);
+
+ if (pinfo == NULL) {
+ debug_error ("pinfo is null, return");
+ return;
+ }
+
+ 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/USB is removed */
+ if (idx == pinfo->bt_idx) {
+ MMSoundMgrSessionSetDeviceAvailable (DEVICE_BT_A2DP, NOT_AVAILABLE, 0, NULL);
+ } else if (idx == pinfo->usb_idx) {
+ MMSoundMgrSessionSetDeviceAvailable (DEVICE_USB_AUDIO, NOT_AVAILABLE, 0, NULL);
+ } else {
+ debug_warning ("Unexpected card index [%d] is removed. (Current bt index=[%d], usb index=[%d]", idx, pinfo->bt_idx, pinfo->usb_idx);
+ }
+ } else if ((t & PA_SUBSCRIPTION_EVENT_TYPE_MASK) == PA_SUBSCRIPTION_EVENT_NEW) { /* BT/USB is loaded */
+ /* Get more additional information for this card */
+ pa_operation *o;
+ if (!(o = pa_context_get_card_info_by_index (c, idx, new_card_info_cb, pinfo))) {
+ 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;
+ }
+}
+
+
+static void context_state_cb (pa_context *c, void *userdata)
+{
+ pulse_info_t *pinfo = (pulse_info_t *)userdata;
+
+ 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:
+ {
+ 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_CARD | PA_SUBSCRIPTION_MASK_SERVER, NULL, NULL))) {
+ return;
+ }
+ pa_operation_unref(o);
+
+ 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;
+ }
+ }
+}
+
+
+static int pulse_init (pulse_info_t * pinfo)
+{
+ int res;
+
+ debug_msg (">>>>>>>>> [%s][%d]\n", __func__, __LINE__);
+
+ /* Create new mainloop */
+ pinfo->m = pa_threaded_mainloop_new();
+ //g_assert(g_m);
+
+ res = pa_threaded_mainloop_start (pinfo->m);
+ //g_assert (res == 0);
+
+ /* LOCK thread */
+ pa_threaded_mainloop_lock (pinfo->m);
+
+ /* Get mainloop API */
+ pa_mainloop_api *api = pa_threaded_mainloop_get_api(pinfo->m);
+
+ /* Create new Context */
+ pinfo->context = pa_context_new(api, "SOUND_SERVER_ROUTE_MANAGER");
+
+ /* Set Callback */
+ pa_context_set_state_callback (pinfo->context, context_state_cb, pinfo);
+
+ /* Connect */
+ 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 (pinfo->context);
+
+ debug_msg ("context state is now %d\n", state);
+
+ if (!PA_CONTEXT_IS_GOOD (state)) {
+ debug_error ("connection failed\n");
+ break;
+ }
+
+ if (state == PA_CONTEXT_READY)
+ break;
+
+ /* Wait until the context is ready */
+ debug_msg ("waiting..................\n");
+ pa_threaded_mainloop_wait (pinfo->m);
+ }
+
+ /* UNLOCK thread */
+ pa_threaded_mainloop_unlock (pinfo->m);
+
+ debug_msg ("<<<<<<<<<< [%s][%d]\n", __func__, __LINE__);
+
+ return res;
+}
+
+
+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;
+
+ 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;
+ }
+
+ debug_log ("Checking for sink name=[%s] Starts, finding api=[%s],bus=[%s]\n", i->name, pinfo->device_api_name, pinfo->device_bus_name);
+
+ if (i->name && i->proplist) {
+ const char *api_string = pa_proplist_gets (i->proplist, "device.api");
+ if (api_string) {
+ debug_log (" Found api = [%s]\n", api_string);
+ if (IS_STREQ(api_string, pinfo->device_api_name)) {
+ const char *bus_string = pa_proplist_gets (i->proplist, "device.bus");
+ if (bus_string) {
+ debug_log (" Found bus = [%s]\n", bus_string);
+ if (IS_STREQ(bus_string, pinfo->device_bus_name)) {
+ 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));
+ } else {
+ debug_warning ("No string [%s] match!!!!\n", pinfo->device_bus_name);
+ }
+ } else {
+ debug_log (" Found no bus ");
+ if (IS_STREQ(DEVICE_BUS_BUILTIN, pinfo->device_bus_name)) {
+ debug_log (" searching bus was builtin, then select this");
+ pa_operation_unref(pa_context_set_default_sink(pinfo->context, i->name, NULL, NULL));
+ }
+ }
+ } else {
+ debug_warning ("No string [%s] match!!!!\n", pinfo->device_api_name);
+ }
+ }
+ }
+
+ debug_log ("Checked for sink name=[%s]\n", i->name);
+}
+
+
+static void pulse_set_default_sink (pulse_info_t * pinfo, char *device_api_name, char *device_bus_name)
+{
+ strcpy (pinfo->device_api_name, device_api_name);
+ strcpy (pinfo->device_bus_name, device_bus_name);
+ pa_operation_unref(pa_context_get_sink_info_list(pinfo->context, sink_info_cb, pinfo));
+}
+
+static int pulse_deinit (pulse_info_t * pinfo)
+{
+ pa_threaded_mainloop_lock (pinfo->m);
+ if (pinfo->context) {
+ pa_context_disconnect (pinfo->context);
+
+ /* Make sure we don't get any further callbacks */
+ pa_context_set_state_callback (pinfo->context, NULL, NULL);
+
+ pa_context_unref (pinfo->context);
+ pinfo->context = NULL;
+ }
+ pa_threaded_mainloop_unlock (pinfo->m);
+
+ pa_threaded_mainloop_stop (pinfo->m);
+ pa_threaded_mainloop_free (pinfo->m);
+
+ debug_msg ("<<<<<<<<<< [%s][%d]\n", __func__, __LINE__);
+
+ return 0;
+
+}
+
+/* -------------------------------- MONO AUDIO --------------------------------------------*/
+#ifdef SUPPORT_MONO_AUDIO
+#define MONO_KEY VCONFKEY_SETAPPL_ACCESSIBILITY_MONO_AUDIO
+
+static void success_cb (pa_context *c, int success, void *userdata)
+{
+ debug_msg ("success = %d\n", success);
+}
+
+static void mono_changed_cb(keynode_t* node, void* data)
+{
+ int key_value;
+ pulse_info_t* pinfo = (pulse_info_t*)data;
+
+ debug_msg ("%s changed callback called\n",vconf_keynode_get_name(node));
+
+ vconf_get_bool(MONO_KEY, &key_value);
+ debug_msg ("key value = %d\n", key_value);
+
+ pa_operation_unref (pa_ext_policy_set_mono (pinfo->context, key_value, success_cb, NULL));
+}
+
+int MMSoundMgrPulseHandleRegisterMonoAudio (void* pinfo)
+{
+ 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 */
+
+
+/* -------------------------------- BT SCO --------------------------------------------*/
+#ifdef SUPPORT_BT_SCO_DETECT
+
+static void bt_changed_cb(keynode_t* node, void* data)
+{
+ int bt_status = VCONFKEY_BT_DEVICE_NONE;
+ int available = 0;
+
+ debug_msg ("[%s] changed callback called\n", vconf_keynode_get_name(node));
+
+ /* Get actual vconf value */
+ vconf_get_int(VCONFKEY_BT_DEVICE, &bt_status);
+ debug_msg ("key value = 0x%x\n", bt_status);
+
+ /* 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);
+
+ bt_name = MMSoundMgrSessionGetBtA2DPName();
+ if (bt_name && strlen(bt_name) > 0) {
+ is_bt_on = true;
+ }
+
+ debug_log ("is_bt_on = [%d], name = [%s]\n", is_bt_on, bt_name);
+
+ 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);
+
+ /* Send Response */
+ ret = sendfunc (&respmsg);
+ if (ret != MM_ERROR_NONE) {
+ /* TODO : Error Handling */
+ debug_error ("sendfunc failed....ret = [%x]\n", ret);
+ }
+
+ pthread_mutex_unlock(&g_mutex);
+
+ debug_leave("\n");
+
+ return ret;
+}
+
+void MMSoundMgrPulseSetDefaultSink (char* device_api_name, char* device_bus_name)
+{
+ debug_enter("\n");
+
+ pulse_set_default_sink(pulse_info, device_api_name, device_bus_name);
+
+ debug_leave("\n");
+}
+
+void MMSoundMgrPulseGetInitialBTStatus (bool *a2dp, bool *sco)
+{
+ int bt_status = VCONFKEY_BT_DEVICE_NONE;
+
+ if (a2dp == NULL || sco == NULL) {
+ debug_error ("Invalide arguments!!!\n");
+ return;
+ }
+
+ /* Get saved bt status */
+ *a2dp = pulse_info->init_bt_status;
+
+ /* 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;
+
+ debug_msg ("returning a2dp=[%d], sco=[%d]\n", *a2dp, *sco);
+}
+
+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_info);
+
+#ifdef SUPPORT_MONO_AUDIO
+ MMSoundMgrPulseHandleRegisterMonoAudio(pulse_info);
+#endif
+
+#ifdef SUPPORT_BT_SCO_DETECT
+ MMSoundMgrPulseHandleRegisterBluetoothStatus(pulse_info);
+#endif
+
+ debug_leave("\n");
+ return pulse_info;
+}
+
+int MMSoundMgrPulseFini(void* handle)
+{
+ debug_enter("\n");
+
+ pulse_deinit((pulse_info_t *)handle);
+
+ debug_leave("\n");
+ return MM_ERROR_NONE;
+}
+
--- /dev/null
+/*
+ * 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 "include/mm_sound_plugin_run.h"
+#include "include/mm_sound_mgr_run.h"
+#include "include/mm_sound_thread_pool.h"
+
+#include <mm_error.h>
+#include <mm_debug.h>
+
+static void _MMsoundMgrRunRunInternal(void *param);
+
+static MMSoundPluginType *g_run_plugins = NULL;
+
+int MMSoundMgrRunInit(const char *targetdir)
+{
+ debug_fenter();
+
+ if (g_run_plugins) {
+ debug_error("Please Check Init twice\n");
+ return MM_ERROR_SOUND_INTERNAL;
+ }
+ MMSoundPluginScan(targetdir, MM_SOUND_PLUGIN_TYPE_RUN, &g_run_plugins);
+
+ debug_fleave();
+ return MM_ERROR_NONE;
+}
+
+int MMSoundMgrRunFini(void)
+{
+ debug_fenter();
+
+ MMSoundPluginRelease(g_run_plugins);
+ g_run_plugins = NULL;
+
+ debug_fleave();
+ return MM_ERROR_NONE;
+}
+
+int MMSoundMgrRunRunAll(void)
+{
+ int loop = 0;
+
+ debug_fenter();
+
+ while (g_run_plugins[loop].type != MM_SOUND_PLUGIN_TYPE_NONE) {
+ MMSoundThreadPoolRun((void*)loop, _MMsoundMgrRunRunInternal);
+ loop++;
+ }
+
+ debug_fleave();
+ return MM_ERROR_NONE;
+}
+
+int MMSoundMgrRunStopAll(void)
+{
+ mmsound_run_interface_t intface;
+ void *func = NULL;
+ int loop = 0;
+
+ debug_fenter();
+
+ while (g_run_plugins[loop].type != MM_SOUND_PLUGIN_TYPE_NONE) {
+ debug_msg("loop : %d\n", loop);
+ MMSoundPluginGetSymbol(&g_run_plugins[loop], RUN_GET_INTERFACE_FUNC_NAME, &func);
+ MMSoundPlugRunCastGetInterface(func)(&intface);
+ intface.stop();
+ loop++;
+ }
+
+ debug_fleave();
+ return MM_ERROR_NONE;
+}
+
+static void _MMsoundMgrRunRunInternal(void *param)
+{
+ int err = MM_ERROR_NONE;
+ mmsound_run_interface_t intface;
+ void* func = NULL;
+
+ debug_enter("plugin number %d\n", (int)param);
+
+ err = MMSoundPluginGetSymbol(&g_run_plugins[(int)param], RUN_GET_INTERFACE_FUNC_NAME, &func);
+ if (err != MM_ERROR_NONE) {
+ debug_error("Get Symbol RUN_GET_INTERFACE_FUNC_NAME is fail : %x\n", err);
+ }
+ err = MMSoundPlugRunCastGetInterface(func)(&intface);
+ if (err != MM_ERROR_NONE) {
+ debug_error("Get interface fail : %x\n", err);
+ /* If error occur, clean interface */
+ //memset(&g_run_plugins[(int)param], 0, sizeof(mmsound_run_interface_t));
+ }
+ if(intface.SetThreadPool)
+ intface.SetThreadPool(MMSoundThreadPoolRun);
+ intface.run();
+ debug_msg("Trace\n");
+ debug_msg("Trace\n");
+
+ debug_fleave();
+}
+
--- /dev/null
+/*
+ * 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 <vconf.h>
+#include <mm_error.h>
+#include <mm_debug.h>
+#include <audio-session-manager.h>
+#include <avsys-audio.h>
+
+#include "../include/mm_sound_common.h"
+#include "../include/mm_sound_utils.h"
+#include "include/mm_sound_mgr_common.h"
+#include "include/mm_sound_mgr_session.h"
+#include "include/mm_sound_mgr_device.h"
+#include "include/mm_sound_mgr_headset.h"
+#include "include/mm_sound_mgr_pulse.h"
+#include "include/mm_sound_mgr_asm.h"
+
+#define EARJACK_WITH_MIC 2
+
+#define MAX_STRING_LEN 256
+
+#define DEVICE_API_BLUETOOTH "bluez"
+#define DEVICE_API_ALSA "alsa"
+#ifdef USE_PULSE_WFD /* Not enabled yet */
+#define DEVICE_API_WFD "wfd"
+#endif
+
+#define DEVICE_BUS_BLUETOOTH "bluetooth"
+#define DEVICE_BUS_USB "usb"
+#define DEVICE_BUS_BUILTIN "builtin"
+#ifdef SEPARATE_SPEAKER_AND_WIRED_ACCESSORY
+#define DEVICE_BUS_WIRED "wired"
+#endif
+
+#define MM_SOUND_DEVICE_OUT_ANY 0x000FFF00
+#define MM_SOUND_DEVICE_IN_ANY 0x000000FF
+
+#define MM_SOUND_DEVICE_OUT_FILTER 0x000000FF
+#define MM_SOUND_DEVICE_IN_FILTER 0x000FFF00
+
+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)
+#define IS_EMERGENCY_SESSION() (g_info.session == SESSION_EMERGENCY)
+
+static int __set_sound_path_for_current_active ();
+static int __set_sound_path_to_dual ();
+static int __set_sound_path_to_speaker ();
+static void __select_playback_active_device (void);
+static void __select_capture_active_device (void);
+
+#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;
+
+typedef enum
+{
+ NO_NOTI = 0,
+ DO_NOTI
+} noti_t;
+
+
+static void dump_info ()
+{
+ int i = 0;
+
+ const char *playback_device_str[] = { "SPEAKER ", "RECEIVER ", "HEADSET ", "BTSCO ", "BTA2DP ", "DOCK ", "HDMI ", "WFD ", "USB " };
+ const char *capture_device_str[] = { "MAINMIC ", "HEADSET ", "BTMIC " };
+
+ int playback_max = sizeof (playback_device_str) / sizeof (char*);
+ int capture_max = sizeof (capture_device_str) / sizeof (char*);
+
+ static char tmp_str[128];
+ static char tmp_str2[128];
+
+ debug_log ("<----------------------------------------------------->\n");
+
+
+ strcpy (tmp_str, "PLAYBACK = [ ");
+ for (i=0; i<playback_max; 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_max; 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_max; 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_max; 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 __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;
+ }
+
+ /* Set default subsession as MEDIA */
+ g_info.subsession = SUBSESSION_MEDIA;
+
+ /* (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;
+ }
+
+ /* activate current available device based on priority */
+ debug_log ("Reset ACTIVE and find new one by priority.\n");
+ RESET_ACTIVE(0);
+ __select_playback_active_device();
+ __select_capture_active_device();
+
+ 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_playback_route_emergency (session_state_t state)
+{
+ int ret = MM_ERROR_NONE;
+
+ debug_fenter();
+
+ if (state == SESSION_START) {
+ ret = __set_sound_path_to_speaker ();
+ if (ret != MM_ERROR_NONE) {
+ debug_error ("__set_sound_path_to_speaker() failed [%x]\n", ret);
+ }
+
+ } else { /* SESSION_END */
+ __set_path_with_notification (NO_NOTI);
+ }
+
+ debug_fleave();
+
+ return ret;
+}
+
+static bool __is_forced_session ()
+{
+ return (IS_NOTIFICATION_SESSION() || IS_EMERGENCY_SESSION())? true : false;
+}
+
+static int __set_sound_path_for_current_active (void)
+{
+ int ret = MM_ERROR_NONE;
+ int option = AVSYS_AUDIO_PATH_OPTION_NONE;
+ int in = 0, out = 0, gain = 0;
+ int sound_play;
+
+ debug_fenter();
+
+ if (__is_forced_session()) {
+ debug_log ("Current session is NOTI/EMER, pending path setting. path set will be done after session ends")
+ goto CURRENT_ACTIVE_END;
+ }
+
+ /* Pulseaudio route */
+ if (IS_ACTIVE(MM_SOUND_DEVICE_OUT_BT_A2DP)) {
+ debug_log ("BT A2DP is active, Set default sink to BLUEZ");
+ MMSoundMgrPulseSetDefaultSink (DEVICE_API_BLUETOOTH, DEVICE_BUS_BLUETOOTH);
+ goto CURRENT_ACTIVE_END;
+ } else if (IS_ACTIVE(MM_SOUND_DEVICE_OUT_WFD)) {
+#ifdef USE_PULSE_WFD /* Not enabled yet */
+ debug_log ("WFD is active, Set default sink to WFD");
+ MMSoundMgrPulseSetDefaultSink (DEVICE_API_WFD, DEVICE_BUS_BUILTIN);
+ goto CURRENT_ACTIVE_END;
+#endif
+ } else if (IS_ACTIVE(MM_SOUND_DEVICE_OUT_USB_AUDIO)) {
+ debug_log ("USB Audio is active, Set default sink to USB Audio");
+ MMSoundMgrPulseSetDefaultSink (DEVICE_API_ALSA, DEVICE_BUS_USB);
+ goto CURRENT_ACTIVE_END;
+ }
+
+#ifndef SEPARATE_SPEAKER_AND_WIRED_ACCESSORY
+ /* ALSA route */
+ debug_log ("Set default sink to ALSA with BUILTIN");
+ MMSoundMgrPulseSetDefaultSink (DEVICE_API_ALSA, DEVICE_BUS_BUILTIN);
+#endif
+
+ /* prepare 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;
+ }
+
+ /* prepare 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_DOCK)) {
+ out = AVSYS_AUDIO_PATH_EX_DOCK;
+ } else if (IS_ACTIVE(MM_SOUND_DEVICE_OUT_HDMI)) {
+ out = AVSYS_AUDIO_PATH_EX_HDMI;
+ } else if (IS_ACTIVE(MM_SOUND_DEVICE_OUT_WFD)) {
+#ifndef USE_PULSE_WFD
+ out = AVSYS_AUDIO_PATH_EX_HDMI;
+#endif
+ }
+
+ /* prepare GAIN */
+ switch (g_info.session) {
+ case SESSION_MEDIA:
+ case SESSION_NOTIFICATION:
+ case SESSION_EMERGENCY:
+ 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 if (g_info.subsession == SUBSESSION_VOICE) {
+ gain = (g_info.session == SESSION_VOICECALL)?
+ AVSYS_AUDIO_GAIN_EX_VOICECALL : AVSYS_AUDIO_GAIN_EX_VIDEOCALL;
+
+ if (out == AVSYS_AUDIO_PATH_EX_HEADSET) {
+ debug_log ("Fix in path to headsetmic when out path is headset\n");
+ in = AVSYS_AUDIO_PATH_EX_HEADSETMIC;
+ }
+ } else {
+ debug_warning ("Unexpected SUBSESSION [%d]\n", g_info.subsession);
+ }
+ break;
+
+ case SESSION_FMRADIO:
+ gain = AVSYS_AUDIO_GAIN_EX_FMRADIO;
+ in = AVSYS_AUDIO_PATH_EX_FMINPUT;
+ break;
+
+ default:
+ debug_warning ("session [%d] is not handled...\n", g_info.session);
+ break;
+ }
+
+#ifdef SEPARATE_SPEAKER_AND_WIRED_ACCESSORY
+ if (!IS_ACTIVE(MM_SOUND_DEVICE_OUT_BT_A2DP)) {
+ debug_log ("BT A2DP is not active, Set default sink to ALSA_XX");
+ if (out == AVSYS_AUDIO_PATH_EX_HEADSET) {
+ debug_log ("Set default sink to ALSA_WIRED_ACCESSORY");
+ MMSoundMgrPulseSetDefaultSink (DEVICE_API_ALSA, DEVICE_BUS_WIRED);
+ } else if (out == AVSYS_AUDIO_PATH_EX_SPK) {
+ debug_log ("Set default sink to ALSA_SPEAKER");
+ MMSoundMgrPulseSetDefaultSink (DEVICE_API_ALSA, DEVICE_BUS_BUILTIN);
+ }
+ }
+#endif
+
+ debug_log ("Trying to set avsys set path gain[%d], out[%d], in[%d], option[%d]\n", gain, out, in, option);
+
+ /* Set Path (GAIN, OUT, IN) */
+ 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;
+ }
+
+CURRENT_ACTIVE_END:
+ /* clean up */
+ debug_fleave();
+ return ret;
+}
+
+static int __set_sound_path_to_dual (void)
+{
+ 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 int __set_sound_path_to_speaker (void)
+{
+ int ret = MM_ERROR_NONE;
+
+ debug_fenter();
+
+ /* Sound path for ALSA */
+ debug_log ("Set path to SPEAKER.\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_NONE))) {
+ 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 (void)
+{
+ 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_WFD)) {
+ debug_log ("WFD available, set as active!!\n");
+ SET_ACTIVE(MM_SOUND_DEVICE_OUT_WFD);
+ } else if (IS_AVAILABLE(MM_SOUND_DEVICE_OUT_DOCK)) {
+ debug_log ("DOCK available, set as active!!\n");
+ SET_ACTIVE(MM_SOUND_DEVICE_OUT_DOCK);
+ } else if (IS_AVAILABLE(MM_SOUND_DEVICE_OUT_HDMI)) {
+ debug_log ("HDMI available, set as active!!\n");
+ SET_ACTIVE(MM_SOUND_DEVICE_OUT_HDMI);
+ } else if (IS_AVAILABLE(MM_SOUND_DEVICE_OUT_USB_AUDIO)) {
+ debug_log ("USB Audio available, set as active!!\n");
+ SET_ACTIVE(MM_SOUND_DEVICE_OUT_USB_AUDIO);
+ } 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 (void)
+{
+ 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 (void)
+{
+ 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 (void)
+{
+ 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 (void)
+{
+ 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 (void)
+{
+ /* 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)
+{
+ /* 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);
+ }
+
+ /* Do set path and notify result */
+ __set_path_with_notification(DO_NOTI);
+
+ dump_info ();
+}
+
+static void __handle_headset_off (void)
+{
+ 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();
+
+ /* Do set path and notify result */
+ __set_path_with_notification(DO_NOTI);
+
+ dump_info ();
+}
+
+static void __handle_dock_on (void)
+{
+ /* ToDo : alarm/notification session ???? */
+ if (IS_COMMUNICATION_SESSION()) {
+ debug_log ("Current session is VOICECALL, no auto-activation!!!\n");
+ return;
+ }
+
+ debug_log ("Activate DOCK device\n");
+ SET_PLAYBACK_ONLY_ACTIVE(MM_SOUND_DEVICE_OUT_DOCK);
+
+ /* Do set path and notify result */
+ __set_path_with_notification(DO_NOTI);
+
+ dump_info ();
+}
+
+static void __handle_dock_off (void)
+{
+ if (!IS_ACTIVE(MM_SOUND_DEVICE_OUT_DOCK)) {
+ debug_msg("MM_SOUND_DEVICE_OUT_DOCK was not active. nothing to do here.");
+ return;
+ }
+
+ /* No PAUSE on Dock off case */
+
+ /* set DOCK device to none */
+ debug_msg("Deactivate DOCK device\n");
+ UNSET_ACTIVE(MM_SOUND_DEVICE_OUT_DOCK);
+
+ /* 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_hdmi_on (void)
+{
+ /* ToDo : alarm/notification session ???? */
+ if (IS_COMMUNICATION_SESSION()) {
+ debug_log ("Current session is VOICECALL, no auto-activation!!!\n");
+ return;
+ }
+
+ debug_log ("Activate HDMI device\n");
+ SET_PLAYBACK_ONLY_ACTIVE(MM_SOUND_DEVICE_OUT_HDMI);
+
+ /* Do set path and notify result */
+ __set_path_with_notification(DO_NOTI);
+
+ dump_info ();
+}
+
+static void __handle_hdmi_off (void)
+{
+ if (!IS_ACTIVE(MM_SOUND_DEVICE_OUT_HDMI)) {
+ debug_msg("MM_SOUND_DEVICE_OUT_HDMI was not active. nothing to do here.");
+ return;
+ }
+
+ /* if HDMI was active, then do asm pause */
+ debug_msg("Do pause here");
+ _asm_pause_process (g_info.asm_handle);
+
+ /* set DOCK device to none */
+ debug_msg("Deactivate HDMIdevice\n");
+ UNSET_ACTIVE(MM_SOUND_DEVICE_OUT_HDMI);
+
+ /* 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_wfd_on (void)
+{
+ /* ToDo : alarm/notification session ???? */
+ if (IS_COMMUNICATION_SESSION()) {
+ debug_log ("Current session is VOICECALL, no auto-activation!!!\n");
+ return;
+ }
+
+ debug_log ("Activate WFD device\n");
+ SET_PLAYBACK_ONLY_ACTIVE(MM_SOUND_DEVICE_OUT_WFD);
+
+ /* Do set path and notify result */
+ __set_path_with_notification(DO_NOTI);
+
+ dump_info ();
+}
+
+static void __handle_wfd_off (void)
+{
+ if (!IS_ACTIVE(MM_SOUND_DEVICE_OUT_WFD)) {
+ debug_msg("MM_SOUND_DEVICE_OUT_WFD was not active. nothing to do here.");
+ return;
+ }
+
+ /* if WFD was active, then do asm pause */
+ debug_msg("Do pause here");
+ _asm_pause_process (g_info.asm_handle);
+
+ /* set WFD device to none */
+ debug_msg("Deactivate WFD device\n");
+ UNSET_ACTIVE(MM_SOUND_DEVICE_OUT_WFD);
+
+ /* 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_usb_audio_on (void)
+{
+ int ret = MM_ERROR_NONE;
+
+ if (IS_COMMUNICATION_SESSION()) {
+ debug_log ("Current session is VOICECALL, no auto-activation!!!\n");
+ return;
+ }
+
+ debug_log ("Activate USB Audio device\n");
+ SET_PLAYBACK_ONLY_ACTIVE(MM_SOUND_DEVICE_OUT_USB_AUDIO);
+
+ 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_usb_audio_off (void)
+{
+ if (!IS_ACTIVE(MM_SOUND_DEVICE_OUT_USB_AUDIO)) {
+ debug_msg("MM_SOUND_DEVICE_OUT_USB_AUDIO was not active. nothing to do here.");
+ dump_info ();
+ return;
+ }
+
+ /* if device 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 USB Audio device\n");
+ UNSET_ACTIVE(MM_SOUND_DEVICE_OUT_USB_AUDIO);
+
+ /* 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 ();
+}
+
+
+/* ------------------------- 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:
+ if (available) {
+ if (!IS_AVAILABLE(MM_SOUND_DEVICE_OUT_DOCK)) {
+ SET_AVAILABLE(MM_SOUND_DEVICE_OUT_DOCK);
+ _mm_sound_mgr_device_available_device_callback(
+ MM_SOUND_DEVICE_IN_NONE,
+ MM_SOUND_DEVICE_OUT_DOCK,
+ AVAILABLE);
+ __handle_dock_on();
+ } else {
+ debug_log ("Already device [%d] is available...\n", device);
+ }
+ } else {
+ if (IS_AVAILABLE(MM_SOUND_DEVICE_OUT_DOCK)) {
+ UNSET_AVAILABLE(MM_SOUND_DEVICE_OUT_DOCK);
+ _mm_sound_mgr_device_available_device_callback(
+ MM_SOUND_DEVICE_IN_NONE,
+ MM_SOUND_DEVICE_OUT_DOCK,
+ NOT_AVAILABLE);
+
+ __handle_dock_off();
+ } else {
+ debug_log ("Already device [%d] is unavailable...\n", device);
+ }
+ }
+ break;
+
+ case DEVICE_HDMI:
+ if (available) {
+ if (!IS_AVAILABLE(MM_SOUND_DEVICE_OUT_HDMI)) {
+ SET_AVAILABLE(MM_SOUND_DEVICE_OUT_HDMI);
+ _mm_sound_mgr_device_available_device_callback(
+ MM_SOUND_DEVICE_IN_NONE,
+ MM_SOUND_DEVICE_OUT_HDMI,
+ AVAILABLE);
+ __handle_hdmi_on();
+ } else {
+ debug_log ("Already device [%d] is available...\n", device);
+ }
+ } else {
+ if (IS_AVAILABLE(MM_SOUND_DEVICE_OUT_HDMI)) {
+ UNSET_AVAILABLE(MM_SOUND_DEVICE_OUT_HDMI);
+ _mm_sound_mgr_device_available_device_callback(
+ MM_SOUND_DEVICE_IN_NONE,
+ MM_SOUND_DEVICE_OUT_HDMI,
+ NOT_AVAILABLE);
+
+ __handle_hdmi_off();
+ } else {
+ debug_log ("Already device [%d] is unavailable...\n", device);
+ }
+ }
+ break;
+
+ case DEVICE_WFD:
+ if (available) {
+ if (!IS_AVAILABLE(MM_SOUND_DEVICE_OUT_WFD)) {
+ SET_AVAILABLE(MM_SOUND_DEVICE_OUT_WFD);
+ _mm_sound_mgr_device_available_device_callback(
+ MM_SOUND_DEVICE_IN_NONE,
+ MM_SOUND_DEVICE_OUT_WFD,
+ AVAILABLE);
+ __handle_wfd_on();
+ } else {
+ debug_log ("Already device [%d] is available...\n", device);
+ }
+ } else {
+ if (IS_AVAILABLE(MM_SOUND_DEVICE_OUT_WFD)) {
+ UNSET_AVAILABLE(MM_SOUND_DEVICE_OUT_WFD);
+ _mm_sound_mgr_device_available_device_callback(
+ MM_SOUND_DEVICE_IN_NONE,
+ MM_SOUND_DEVICE_OUT_WFD,
+ NOT_AVAILABLE);
+
+ __handle_wfd_off();
+ } else {
+ debug_log ("Already device [%d] is unavailable...\n", device);
+ }
+ }
+ break;
+
+ case DEVICE_USB_AUDIO:
+ if (available) {
+ if (!IS_AVAILABLE(MM_SOUND_DEVICE_OUT_USB_AUDIO)) {
+ SET_AVAILABLE(MM_SOUND_DEVICE_OUT_USB_AUDIO);
+ _mm_sound_mgr_device_available_device_callback(
+ MM_SOUND_DEVICE_IN_NONE,
+ MM_SOUND_DEVICE_OUT_USB_AUDIO,
+ AVAILABLE);
+ __handle_usb_audio_on();
+ } else {
+ debug_log ("Already device [%d] is available...\n", device);
+ }
+ } else {
+ if (IS_AVAILABLE(MM_SOUND_DEVICE_OUT_USB_AUDIO)) {
+ UNSET_AVAILABLE(MM_SOUND_DEVICE_OUT_USB_AUDIO);
+ _mm_sound_mgr_device_available_device_callback(
+ MM_SOUND_DEVICE_IN_NONE,
+ MM_SOUND_DEVICE_OUT_USB_AUDIO,
+ NOT_AVAILABLE);
+
+ __handle_usb_audio_off();
+ } else {
+ debug_log ("Already device [%d] is unavailable...\n", device);
+ }
+ }
+ break;
+
+ default:
+ debug_warning ("device [%d] is not handled...\n", device);
+ 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;
+
+ 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");
+
+ /* 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;
+
+ case SESSION_EMERGENCY:
+ __set_playback_route_emergency (state);
+ break;
+
+ default:
+ debug_warning ("session [%d] is not handled...\n", session);
+ 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();
+
+ if (g_info.subsession == subsession) {
+ debug_msg ("[SESSION][%s][%d] already subsession is [%d]. skip this!!\n", __func__, __LINE__, subsession);
+ } else {
+ 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;
+}
+
--- /dev/null
+/*
+ * 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 "include/mm_sound_mgr_wfd.h"
+#include "include/mm_sound_mgr_session.h"
+
+/******************************* WFD Code **********************************/
+
+#include "mm_sound.h"
+
+#include <vconf.h>
+#include <vconf-keys.h>
+
+
+/* WFD status value */
+static void _wfd_status_changed_cb(keynode_t* node, void* data)
+{
+ int wfd_available = 0;
+ int wfd_status = 0;
+
+ /* Get actual vconf value */
+ vconf_get_int(VCONFKEY_WIFI_DIRECT_STATE, &wfd_status);
+
+ debug_msg ("[%s] changed callback called\n", vconf_keynode_get_name(node));
+ debug_msg ("WFD : [%s]=[%d]\n",
+ VCONFKEY_WIFI_DIRECT_STATE, wfd_status);
+
+ wfd_available = (wfd_status == VCONFKEY_WIFI_DIRECT_GROUP_OWNER)? 1 : 0;
+
+ MMSoundMgrSessionSetDeviceAvailable (DEVICE_WFD, wfd_available, 0, NULL);
+}
+
+static int _register_wfd_status(void)
+{
+ /* set callback for vconf key change */
+ int ret = vconf_notify_key_changed(VCONFKEY_WIFI_DIRECT_STATE, _wfd_status_changed_cb, NULL);
+ debug_msg ("vconf [%s] set ret = [%d]\n", VCONFKEY_WIFI_DIRECT_STATE, ret);
+ return ret;
+}
+
+int MMSoundMgrWfdInit(void)
+{
+ debug_enter("\n");
+
+ if (_register_wfd_status() != 0) {
+ debug_error ("Registering WFD status failed\n");
+ return MM_ERROR_SOUND_INTERNAL;
+ }
+
+ debug_leave("\n");
+ return MM_ERROR_NONE;
+}
+
+int MMSoundMgrWfdFini(void)
+{
+ debug_enter("\n");
+
+ debug_leave("\n");
+ return MM_ERROR_NONE;
+}
+
--- /dev/null
+/*
+ * 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 <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+#include <dirent.h>
+#include <dlfcn.h>
+
+#include "include/mm_sound_plugin.h"
+#include <mm_error.h>
+#include <mm_debug.h>
+
+static char* __strcatdup(const char *str1, const char *str2);
+static int _MMSoundPluginGetList(const char *plugdir ,char ***list);
+static int _MMSoundPluginDestroyList(char **list);
+
+char* MMSoundPluginGetTypeName(int type)
+{
+ static char *typename[] = {
+ "ERROR",
+ "SOUND",
+ "RUN",
+ };
+
+ if (type < MM_SOUND_PLUGIN_TYPE_LAST && type > -1)
+ return typename[type];
+ else
+ return "Unknown"; /* error condition */
+}
+
+int MMSoundPluginScan(const char *plugindir, const int type, MMSoundPluginType **pluginlist)
+{
+ char **list = NULL;
+ int err = MM_ERROR_NONE;
+ char *item = NULL;
+ int index = 0;
+ MMSoundPluginType plugin[100];
+ int plugin_index = 0;
+
+ debug_fenter ();
+
+ debug_msg(" Plugin dir :: %s \n", plugindir);
+ err = _MMSoundPluginGetList(plugindir, &list);
+ if (err != MM_ERROR_NONE)
+ return err;
+
+ while((item = list[index++]) != NULL) {
+ if(MMSoundPluginOpen(item, &plugin[plugin_index]) != MM_ERROR_NONE) {
+ debug_warning("%s is not sound plugin\n", item);
+ continue;
+ }
+ if (plugin[plugin_index].type != type)
+ MMSoundPluginClose(&plugin[plugin_index]);
+ else
+ plugin_index++;
+ }
+
+ _MMSoundPluginDestroyList(list);
+
+ *pluginlist = (MMSoundPluginType*) malloc(sizeof(MMSoundPluginType) * (plugin_index+1));
+ if ((*pluginlist) == NULL) {
+ debug_critical("Memory allocation fail\n");
+ /* Occur segmentation fault */
+ *pluginlist = (void*)1;
+ }
+
+ memcpy(*pluginlist, plugin, sizeof(MMSoundPluginType) * (plugin_index+1));
+ /* Marking end of array */
+ (*pluginlist)[plugin_index].type = MM_SOUND_PLUGIN_TYPE_NONE;
+ (*pluginlist)[plugin_index].module = NULL;
+
+ debug_fleave ();
+
+ return MM_ERROR_NONE;
+}
+
+int MMSoundPluginRelease(MMSoundPluginType *pluginlist)
+{
+ int loop = 0;
+
+ debug_fenter ();
+
+ while (pluginlist[loop].type != MM_SOUND_PLUGIN_TYPE_NONE) {
+ MMSoundPluginClose(&pluginlist[loop++]);
+ }
+
+ free (pluginlist);
+
+ debug_fleave ();
+
+ return MM_ERROR_NONE;
+}
+
+int MMSoundPluginOpen(char *file, MMSoundPluginType *plugin)
+{
+ void *pdll = NULL;
+ int (*func)(void) = NULL;
+ int t = -1;
+
+ debug_fenter ();
+
+ pdll = dlopen(file, RTLD_NOW|RTLD_GLOBAL);
+
+ if (pdll == NULL) {
+ debug_error("%s\n", dlerror());
+ return MM_ERROR_SOUND_INVALID_FILE;
+ }
+
+ func = (int (*)(void))dlsym(pdll, "MMSoundGetPluginType");
+ if (func == NULL) {
+ dlclose(pdll);
+ debug_error("Cannot find symbol : MMSoundGetPluginType\n");
+ return MM_ERROR_SOUND_INVALID_FILE;
+ }
+ t = func();
+
+ debug_msg("%s is %s\n", file,
+ t == MM_SOUND_PLUGIN_TYPE_CODEC ? "CODEC":
+ t == MM_SOUND_PLUGIN_TYPE_RUN ? "RUN" : "Unknown");
+ switch(t)
+ {
+ case MM_SOUND_PLUGIN_TYPE_CODEC:
+ case MM_SOUND_PLUGIN_TYPE_RUN:
+ plugin->type = t;
+ plugin->module = pdll;
+ break;
+ default:
+ debug_error("Type is %d\n",t);
+ dlclose(pdll);
+ return MM_ERROR_SOUND_INVALID_FILE;
+ }
+
+ debug_fleave ();
+
+ return MM_ERROR_NONE;
+}
+
+int MMSoundPluginClose(MMSoundPluginType *plugin)
+{
+ debug_fenter ();
+
+ if(plugin->module)
+ dlclose(plugin->module);
+ plugin->type = MM_SOUND_PLUGIN_TYPE_NONE;
+ plugin->module = NULL;
+
+ debug_fleave ();
+ return MM_ERROR_NONE;
+}
+
+int MMSoundPluginGetSymbol(MMSoundPluginType *plugin, const char *symbol, void **func)
+{
+ void *fn = NULL;
+
+ debug_fenter ();
+
+ if (plugin->module == NULL)
+ return MM_ERROR_SOUND_INVALID_FILE;
+ fn = dlsym(plugin->module, symbol);
+ if (fn == NULL)
+ return MM_ERROR_SOUND_INVALID_FILE;
+ *func = fn;
+
+ debug_fleave ();
+ return MM_ERROR_NONE;
+}
+#define MAX_PATH_SIZE 256
+static int _MMSoundPluginGetList(const char *plugdir ,char ***list)
+{
+ struct dirent **entry = NULL;
+ int items;
+ struct stat finfo;
+ char **temp;
+ int tn = 0;
+ static char curdir[MAX_PATH_SIZE];
+ int item_idx;
+ int ret = MM_ERROR_NONE;
+
+ items = scandir(plugdir, &entry, NULL, alphasort);
+ debug_msg("Items %d\n", items);
+
+ if (items == -1)
+ return MM_ERROR_INVALID_ARGUMENT;
+
+ temp = (char **)malloc(sizeof(char *) * (items + 1));
+ if(!temp) {
+ ret = MM_ERROR_OUT_OF_MEMORY;
+ goto free_entry;
+ }
+ memset(temp, 0, sizeof(char*) * (items + 1));
+ memset(curdir, '\0', sizeof(curdir));
+ if(NULL == getcwd(curdir, sizeof(curdir)-1)) {
+ if (temp) {
+ free (temp);
+ temp = NULL;
+ }
+ ret = MM_ERROR_OUT_OF_STORAGE;
+ goto free_entry;
+ }
+ /* FIXME : need to handle error case */
+ chdir(plugdir);
+
+ for(item_idx = items; item_idx--; ) {
+ if(stat(entry[item_idx]->d_name, &finfo) < 0) {
+ debug_error("Stat error\n");
+ if (temp) {
+ free(temp);
+ temp = NULL;
+ }
+ ret = MM_ERROR_INVALID_ARGUMENT;
+ goto free_entry;
+ }
+
+ debug_msg("item %d is %s\n", item_idx, entry[item_idx]->d_name);
+
+ if (S_ISREG(finfo.st_mode)) {
+ temp[tn++] = __strcatdup(plugdir, entry[item_idx]->d_name);
+ }
+ }
+ *list = temp;
+free_entry:
+ for(item_idx = 0; item_idx < items; item_idx++) {
+ free(entry[item_idx]);
+ }
+ free(entry);
+ return ret;
+}
+
+static int _MMSoundPluginDestroyList(char **list)
+{
+ int tn = 0;
+ while(list[tn]) {
+ free(list[tn++]);
+ }
+ free (list);
+ return MM_ERROR_NONE;
+}
+
+static char* __strcatdup(const char *str1, const char *str2)
+{
+ char *dest = NULL;
+ int len = 0;
+ len = strlen(str1) + strlen(str2) + 1;
+ dest = (char*) malloc(len*sizeof(char));
+ if (!dest)
+ return NULL;
+ strncpy(dest, str1, len-1);
+ strncat(dest, str2, len-1);
+ return dest;
+}
--- /dev/null
+/*
+ * 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 <stdlib.h>
+#include <string.h>
+#include <error.h>
+#include <sys/types.h>
+#include <sys/wait.h>
+#include <unistd.h>
+#include <signal.h>
+#include <pthread.h>
+#include <getopt.h>
+
+#include <vconf.h>
+#include <avsys-audio.h>
+#include <mm_error.h>
+#include <mm_debug.h>
+
+#include "../include/mm_sound_common.h"
+#include "../include/mm_sound_utils.h"
+#include "include/mm_sound_thread_pool.h"
+#include "include/mm_sound_mgr_run.h"
+#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_device.h"
+#include "include/mm_sound_mgr_headset.h"
+#include "include/mm_sound_mgr_dock.h"
+#include "include/mm_sound_mgr_hdmi.h"
+#include "include/mm_sound_mgr_wfd.h"
+
+#include <heynoti.h>
+
+#include <glib.h>
+
+#define PLUGIN_ENV "MM_SOUND_PLUGIN_PATH"
+#define PLUGIN_DIR "/usr/lib/soundplugins/"
+#define PLUGIN_MAX 30
+
+#define HIBERNATION_SOUND_CHECK_PATH "/tmp/hibernation/sound_ready"
+#define USE_SYSTEM_SERVER_PROCESS_MONITORING
+
+#define ASM_CHECK_INTERVAL 10000
+
+#define MAX_PLUGIN_DIR_PATH_LEN 256
+
+typedef struct {
+ char plugdir[MAX_PLUGIN_DIR_PATH_LEN];
+ int startserver;
+ int printlist;
+ int testmode;
+} server_arg;
+
+static int getOption(int argc, char **argv, server_arg *arg);
+static int usgae(int argc, char **argv);
+
+static struct sigaction sigint_action; /* Backup pointer of SIGINT handler */
+static struct sigaction sigabrt_action; /* Backup pointer of SIGABRT signal handler */
+static struct sigaction sigsegv_action; /* Backup pointer of SIGSEGV fault signal handler */
+static struct sigaction sigterm_action; /* Backup pointer of SIGTERM signal handler */
+static struct sigaction sigsys_action; /* Backup pointer of SIGSYS signal handler */
+static void _exit_handler(int sig);
+
+GMainLoop *g_mainloop;
+
+void* pulse_handle;
+
+gpointer event_loop_thread(gpointer data)
+{
+ g_mainloop = g_main_loop_new(NULL, TRUE);
+ if(g_mainloop == NULL) {
+ debug_error("g_main_loop_new() failed\n");
+ }
+ g_main_loop_run(g_mainloop);
+ return NULL;
+}
+
+#ifdef USE_HIBERNATION
+static void __hibernation_leave_cb()
+{
+ int volumes[VOLUME_TYPE_MAX] = {0, };
+
+ MMSoundMgrPulseHandleRegisterMonoAudio(pulse_handle);
+ MMSoundMgrPulseHandleRegisterBluetoothStatus (pulse_handle);
+
+ _mm_sound_volume_get_values_on_bootup(volumes);
+ if (avsys_audio_hibernation_reset(volumes)) {
+ debug_error("Audio reset failed\n");
+ } else {
+ debug_msg("Audio reset success\n");
+ }
+}
+#endif
+
+static 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)
+{
+ server_arg serveropt;
+ struct sigaction action;
+#ifdef USE_HIBERNATION
+ int heynotifd = -1;
+#endif
+ int volumes[VOLUME_TYPE_MAX] = {0, };
+#if !defined(USE_SYSTEM_SERVER_PROCESS_MONITORING)
+ int pid;
+ int ret;
+#endif
+
+ action.sa_handler = _exit_handler;
+ action.sa_flags = 0;
+ sigemptyset(&action.sa_mask);
+
+ if (getOption(argc, argv, &serveropt))
+ return 1;
+
+ /* Daemon process create */
+ if (!serveropt.testmode && serveropt.startserver) {
+#if !defined(USE_SYSTEM_SERVER_PROCESS_MONITORING)
+ daemon(0,0); //chdir to ("/"), and close stdio
+#endif
+ }
+
+ signal(SIGPIPE, SIG_IGN); //ignore SIGPIPE
+
+ _mm_sound_volume_get_values_on_bootup(volumes);
+ if (avsys_audio_hibernation_reset(volumes)) {
+ debug_error("Audio reset failed\n");
+ } else {
+ debug_msg("Audio reset success\n");
+ }
+
+#ifdef USE_HIBERNATION
+ heynotifd = heynoti_init();
+ if(heynoti_subscribe(heynotifd, "HIBERNATION_LEAVE", __hibernation_leave_cb, NULL)) {
+ debug_error("heynoti_subscribe failed...\n");
+ } else {
+ debug_msg("heynoti_subscribe() success\n");
+ }
+
+ if(heynoti_attach_handler(heynotifd)) {
+ debug_error("heynoti_attach_handler() failed\n");
+ } else {
+ debug_msg("heynoti_attach_handler() success\n");
+ }
+#endif
+
+#if !defined(USE_SYSTEM_SERVER_PROCESS_MONITORING)
+ while(1)
+ {
+ if ((pid = fork()) < 0)
+ {
+ fprintf(stderr, "Sub Fork Error\n");
+ return 2;
+ }
+ else if(pid == 0)
+ {
+ break;
+ }
+ else if(pid > 0)
+ {
+ wait(&ret);
+ fprintf(stderr, "Killed by signal [%05X]\n", ret);
+ fprintf(stderr, "Daemon is run againg\n");
+ }
+ }
+#endif
+ sigaction(SIGABRT, &action, &sigabrt_action);
+ sigaction(SIGSEGV, &action, &sigsegv_action);
+ sigaction(SIGTERM, &action, &sigterm_action);
+ sigaction(SIGSYS, &action, &sigsys_action);
+
+ if (!g_thread_supported ())
+ g_thread_init (NULL);
+
+ if(NULL == g_thread_create(event_loop_thread, NULL, FALSE, NULL)) {
+ fprintf(stderr,"event loop thread create failed\n");
+ return 3;
+ }
+
+
+ if (serveropt.startserver || serveropt.printlist) {
+ MMSoundThreadPoolInit();
+ MMSoundMgrRunInit(serveropt.plugdir);
+ MMSoundMgrCodecInit(serveropt.plugdir);
+ if (!serveropt.testmode)
+ MMSoundMgrIpcInit();
+
+ pulse_handle = MMSoundMgrPulseInit();
+ MMSoundMgrASMInit();
+ /* Wait for ASM Ready */
+ __wait_for_asm_ready();
+ _mm_sound_mgr_device_init();
+ MMSoundMgrHeadsetInit();
+ MMSoundMgrDockInit();
+ MMSoundMgrHdmiInit();
+ MMSoundMgrWfdInit();
+ MMSoundMgrSessionInit();
+ }
+
+ if (serveropt.startserver) {
+ /* Start Run types */
+ MMSoundMgrRunRunAll();
+
+#ifdef USE_HIBERNATION
+ /* set hibernation check */
+ _mm_sound_check_hibernation (HIBERNATION_SOUND_CHECK_PATH);
+#endif
+
+ /* Start Ipc mgr */
+ MMSoundMgrIpcReady();
+ }
+
+ if (serveropt.startserver || serveropt.printlist) {
+ MMSoundMgrRunStopAll();
+ if (!serveropt.testmode)
+ MMSoundMgrIpcFini();
+
+ MMSoundMgrCodecFini();
+ MMSoundMgrRunFini();
+ MMSoundThreadPoolFini();
+
+ MMSoundMgrWfdFini();
+ MMSoundMgrHdmiFini();
+ MMSoundMgrDockFini();
+ MMSoundMgrHeadsetFini();
+ MMSoundMgrSessionFini();
+ _mm_sound_mgr_device_fini();
+ MMSoundMgrASMFini();
+ MMSoundMgrPulseFini(pulse_handle);
+
+#ifdef USE_HIBERNATION
+ if(heynoti_unsubscribe(heynotifd, "HIBERNATION_LEAVE", NULL)) {
+ debug_error("heynoti_unsubscribe failed..\n");
+ }
+ heynoti_close(heynotifd);
+#endif
+ }
+ return 0;
+}
+
+static int getOption(int argc, char **argv, server_arg *arg)
+{
+ int c;
+ char *plugin_env_dir = NULL;
+ static struct option long_options[] = {
+ {"start", 0, 0, 'S'},
+ {"list", 0, 0, 'L'},
+ {"help", 0, 0, 'H'},
+ {"plugdir", 1, 0, 'P'},
+ {"testmode", 0, 0, 'T'},
+ {0, 0, 0, 0}
+ };
+ memset(arg, 0, sizeof(server_arg));
+
+ plugin_env_dir = getenv(PLUGIN_ENV);
+ if (plugin_env_dir) {
+ strncpy (arg->plugdir, plugin_env_dir, sizeof(arg->plugdir)-1);
+ } else {
+ strncpy (arg->plugdir, PLUGIN_DIR, sizeof(arg->plugdir)-1);
+ }
+
+ arg->testmode = 0;
+
+ while (1)
+ {
+ int opt_idx = 0;
+
+ c = getopt_long (argc, argv, "SLHRP:T", long_options, &opt_idx);
+ if (c == -1)
+ break;
+ switch (c)
+ {
+ case 'S': /* Start daemon */
+ arg->startserver = 1;
+ break;
+ case 'L': /* list of plugins */
+ arg->printlist = 1;
+ break;
+ case 'R':
+ MMSoundMgrCodecInit(arg->plugdir);
+ break;
+ case 'P': /* Custom plugindir */
+ strncpy (arg->plugdir, optarg, sizeof(arg->plugdir)-1);
+ break;
+ case 'T': /* Test mode */
+ arg->testmode = 1;
+ break;
+ case 'H': /* help msg */
+ default:
+ return usgae(argc, argv);
+ }
+ }
+ if (argc == 1)
+ return usgae(argc, argv);
+ return 0;
+}
+
+//__attribute__ ((destructor))
+static void _exit_handler(int sig)
+{
+ int ret = MM_ERROR_NONE;
+
+ ret = MMSoundMgrRunStopAll();
+ if (ret != MM_ERROR_NONE) {
+ debug_error("Fail to stop run-plugin\n");
+ } else {
+ debug_log("All run-type plugin stopped\n");
+ }
+
+ switch(sig)
+ {
+ case SIGINT:
+ sigaction(SIGINT, &sigint_action, NULL);
+ debug_error("signal(SIGINT) error");
+ break;
+ case SIGABRT:
+ sigaction(SIGABRT, &sigabrt_action, NULL);
+ debug_error("signal(SIGABRT) error");
+ break;
+ case SIGSEGV:
+ sigaction(SIGSEGV, &sigsegv_action, NULL);
+ debug_error("signal(SIGSEGV) error");
+ break;
+ case SIGTERM:
+ sigaction(SIGTERM, &sigterm_action, NULL);
+ debug_error("signal(SIGTERM) error");
+ break;
+ case SIGSYS:
+ sigaction(SIGSYS, &sigsys_action, NULL);
+ debug_error("signal(SIGSYS) error");
+ break;
+ default:
+ break;
+ }
+ raise(sig);
+}
+
+static int usgae(int argc, char **argv)
+{
+ fprintf(stderr, "Usage: %s [Options]\n", argv[0]);
+ fprintf(stderr, "\t%-20s: start sound server.\n", "--start,-S");
+ fprintf(stderr, "\t%-20s: print plugin list.\n", "--list,-L");
+ fprintf(stderr, "\t%-20s: print this message.\n", "--help,-H");
+ fprintf(stderr, "\t%-20s: print this message.\n", "--plugdir,-P");
+
+ return 1;
+}
+
--- /dev/null
+/*
+ * 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 <stdlib.h>
+#include <pthread.h>
+#include <unistd.h>
+
+#include <mm_error.h>
+#include <mm_debug.h>
+#include <mm_sound_thread_pool.h>
+
+#define USE_G_THREAD_POOL
+#ifdef USE_G_THREAD_POOL
+#include <glib.h>
+GThreadPool* g_pool;
+
+#define MAX_UNUSED_THREADS_IN_THREADPOOL 10
+
+typedef struct __THREAD_INFO
+{
+ void (*func)(gpointer data);
+ void *param;
+} THREAD_INFO;
+
+static void __DummyWork (void* param)
+{
+ debug_msg ("thread index = %d\n", (int)param);
+ sleep (1);
+}
+
+static void __ThreadWork(gpointer data, gpointer user_data)
+{
+ THREAD_INFO* info = (THREAD_INFO*)data;
+ if (info) {
+ if (info->func) {
+ debug_msg ("Calling [%p] with param [%p]\n", info->func, info->param);
+ info->func (info->param);
+ } else {
+ debug_warning ("No func to call....\n");
+ }
+
+ /* Info was allocated by MMSoundThreadPoolRun().
+ The actual content of info should be freed whether inside func or outside (if handle) */
+ debug_msg ("free [%p]\n", info);
+ free (info);
+ info = NULL;
+ } else {
+ debug_warning ("No valid thread info...Nothing to do...\n");
+ }
+}
+
+int MMSoundThreadPoolDump(int fulldump)
+{
+ if (g_pool == NULL) {
+ debug_error ("No thread pool initialized....\n");
+ return MM_ERROR_SOUND_INTERNAL;
+ }
+
+ if (fulldump) {
+ debug_msg ("##### [ThreadPool] max threads=[%d], max unused=[%d], max idle time=[%d]\n",
+ g_thread_pool_get_max_threads (g_pool),
+ g_thread_pool_get_max_unused_threads(),
+ g_thread_pool_get_max_idle_time() );
+ }
+ debug_msg ("***** [ThreadPool] running=[%d], unused=[%d]\n",
+ g_thread_pool_get_num_threads (g_pool),
+ g_thread_pool_get_num_unused_threads() );
+
+ return MM_ERROR_NONE;
+}
+
+int MMSoundThreadPoolInit()
+{
+ int i=0;
+ GError* error = NULL;
+
+ /* Create thread pool (non-exclude mode with infinite max threads) */
+ g_pool = g_thread_pool_new (__ThreadWork, NULL, -1, FALSE, &error);
+ if (g_pool == NULL && error != NULL) {
+ debug_error ("thread pool created failed : %s\n", error->message);
+ g_error_free (error);
+ return MM_ERROR_SOUND_INTERNAL;
+ }
+ debug_msg ("thread pool created successfully\n");
+
+ MMSoundThreadPoolDump(TRUE);
+
+ /* Thread pool setting : this will maintain at least 10 unused threads and this will be reused. */
+ /* If no unused thread left, new thread will be created, but always maintain 10 unused thread */
+ debug_msg ("thread pool set max unused threads to %d\n", MAX_UNUSED_THREADS_IN_THREADPOOL);
+ g_thread_pool_set_max_unused_threads (MAX_UNUSED_THREADS_IN_THREADPOOL);
+
+ /* To reserve unused threads, let's start some threads for beggining
+ This dummy thread will be remained unused as soon as it started */
+ debug_msg ("run threads to reserve minimum thread\n");
+ for (i=0; i<MAX_UNUSED_THREADS_IN_THREADPOOL; i++) {
+ MMSoundThreadPoolRun ((void *)i, __DummyWork);
+ }
+
+ MMSoundThreadPoolDump(TRUE);
+
+ return MM_ERROR_NONE;
+}
+
+int MMSoundThreadPoolRun(void *param, void (*func)(void*))
+{
+ GError* error = NULL;
+
+ /* Dump current thread pool */
+ MMSoundThreadPoolDump(FALSE);
+
+ /* Create thread info structure.
+ This thread info data will be free in __ThreadWork(), after use. */
+ THREAD_INFO* thread_info = (THREAD_INFO*)malloc (sizeof(THREAD_INFO));
+ if (thread_info) {
+ thread_info->func = func;
+ thread_info->param = param;
+ debug_msg ("alloc thread_info = %p\n", thread_info);
+
+ /* Add thread to queue of thread pool */
+ g_thread_pool_push (g_pool, thread_info, &error);
+ if (error) {
+ debug_error ("g_thread_pool_push failed : %s\n", error->message);
+ g_error_free (error);
+ return MM_ERROR_SOUND_INTERNAL;
+ }
+ } else {
+ debug_error("failed to alloc thread info\n");
+ return MM_ERROR_SOUND_INTERNAL;
+ }
+
+ return MM_ERROR_NONE;
+}
+
+int MMSoundThreadPoolFini(void)
+{
+ /* If immediate is TRUE, no new task is processed for pool.
+ Otherwise pool is not freed before the last task is processed.
+ Note however, that no thread of this pool is interrupted, while processing a task.
+ Instead at least all still running threads can finish their tasks before the pool is freed.
+
+ If wait_ is TRUE, the functions does not return before all tasks to be processed
+ (dependent on immediate, whether all or only the currently running) are ready.
+ Otherwise the function returns immediately. */
+ debug_msg ("thread pool will be free\n");
+ g_thread_pool_free (g_pool, TRUE, FALSE);
+
+ return MM_ERROR_NONE;
+}
+
+#else // USE_G_THREAD_POOL
+
+#define THREAD_POOL_MAX 10
+
+struct __control_t
+{
+ pthread_t threadid;
+ pthread_cond_t condition;
+ int stopflag;
+ void *param;
+ void (*func)(void *);
+};
+
+static int threadmap[THREAD_POOL_MAX];
+static struct __control_t control[THREAD_POOL_MAX];
+
+static pthread_cond_t startcond = PTHREAD_COND_INITIALIZER;
+static pthread_mutex_t startsync = PTHREAD_MUTEX_INITIALIZER;
+static pthread_mutex_t controlsync = PTHREAD_MUTEX_INITIALIZER;
+static pthread_mutex_t funcsync = PTHREAD_MUTEX_INITIALIZER;
+
+static int __GetEmptyPool(void)
+{
+ int count = 0;
+ while ((count < THREAD_POOL_MAX) && threadmap[count] == 1)
+ ++count;
+ return count == THREAD_POOL_MAX ? -1 : count;
+}
+
+static void __SetPool(int n)
+{
+ threadmap[n] = 1;
+}
+
+static void __ResetPool(int n)
+{
+ threadmap[n] = 0;
+}
+
+static void __InitPool(void)
+{
+ int count = 0;
+ for (count = 0; count < THREAD_POOL_MAX; count++)
+ {
+ threadmap[count] = 0;
+ if (pthread_cond_init(&control[count].condition, NULL) != 0)
+ perror("Make Thread Condition");
+ }
+}
+
+static void __DestroyPool(void)
+{
+ int count = 0;
+ for (count = 0; count < THREAD_POOL_MAX; count++)
+ {
+ if (pthread_cond_destroy(&control[count].condition) != 0)
+ {
+ perror("Remove Thread Condition");
+ exit(0);
+ }
+ }
+}
+
+static void* __ThreadWork(void *param)
+{
+ int myid = -1;
+
+ myid = (int)param;
+
+ pthread_mutex_lock(&startsync);
+ pthread_cond_signal(&startcond);
+ pthread_mutex_unlock(&startsync);
+
+ while(1)
+ {
+ pthread_mutex_lock(&controlsync);
+ pthread_cond_wait(&control[myid].condition, &controlsync);
+ pthread_mutex_unlock(&controlsync);
+
+ if (control[myid].func != NULL)
+ control[myid].func(control[myid].param);
+/* if (control[myid].param != NULL)
+ free(control[myid].param);*/
+
+ control[myid].func = NULL;
+ control[myid].param = NULL;
+ pthread_mutex_lock(&startsync);
+ __ResetPool(myid);
+ pthread_mutex_unlock(&startsync);
+
+ if (control[myid].stopflag) {
+ pthread_exit(0);
+ }
+ }
+}
+
+int MMSoundThreadPoolDump(void)
+{
+ int count = 0;
+ int ret = MM_ERROR_NONE;
+
+ fprintf(stdout, "================================================================================\n");
+ fprintf(stdout, " Thread States \n");
+ fprintf(stdout, "--------------------------------------------------------------------------------\n");
+ for (count = 0; count < THREAD_POOL_MAX; count ++)
+ {
+ fprintf(stdout, "Thread %d\n", control[count].threadid);
+ fprintf(stdout, "Current State is \"%s\"\n", threadmap[count] ? "Running" : "Ready");
+ if (threadmap[count])
+ {
+ fprintf(stdout, "Running function address %p\n", control[count].func);
+ }
+ else
+ {
+ fprintf(stdout, "Threadmap is NULL\n");
+ ret = MM_ERROR_SOUND_INTERNAL;
+ }
+ }
+ fprintf(stdout, "================================================================================\n");
+ return ret;
+}
+
+int MMSoundThreadPoolInit(void)
+{
+ volatile int count = 0;
+ pthread_mutex_lock(&funcsync);
+
+ __InitPool();
+
+ for (count = 0; count < THREAD_POOL_MAX; count++)
+ {
+ control[count].stopflag = 0;
+ pthread_mutex_lock(&startsync);
+ if (pthread_create(&control[count].threadid, NULL, __ThreadWork, (void*)count) < 0)
+ {
+ perror("Make Thread Fail");
+ exit(0);
+ }
+ pthread_cond_wait(&startcond, &startsync);
+ pthread_mutex_unlock(&startsync);
+ usleep(100); /* Delay for thread init */
+ }
+ pthread_mutex_unlock(&funcsync);
+ return MM_ERROR_NONE;
+}
+
+int MMSoundThreadPoolRun(void *param, void (*func)(void*))
+{
+ int poolnum = -1;
+
+ pthread_mutex_lock(&funcsync);
+ pthread_mutex_lock(&startsync);
+ poolnum = __GetEmptyPool();
+ if (poolnum < 0) {
+ pthread_mutex_unlock(&startsync);
+ pthread_mutex_unlock(&funcsync);
+ return MM_ERROR_COMMON_NO_FREE_SPACE;
+ }
+ __SetPool(poolnum);
+ pthread_mutex_unlock(&startsync);
+ control[poolnum].param = param;
+ control[poolnum].func = func;
+ pthread_cond_signal(&control[poolnum].condition);
+ pthread_mutex_unlock(&funcsync);
+
+ return MM_ERROR_NONE;
+}
+
+int MMSoundThreadPoolFini(void)
+{
+ int count = 0;
+
+ pthread_mutex_lock(&funcsync);
+ for (count = 0; count < THREAD_POOL_MAX; count++)
+ {
+ control[count].stopflag = 1;
+ pthread_cond_signal(&control[count].condition);
+ if (pthread_join(control[count].threadid, NULL) < 0)
+ {
+ perror("Join Fail");
+ exit(0);
+ }
+ }
+ __DestroyPool();
+ pthread_mutex_unlock(&funcsync);
+
+ return MM_ERROR_NONE;
+}
+#endif // USE_G_THREAD_POOL
+
--- /dev/null
+SUBDIRS = wav keytone tone
--- /dev/null
+lib_LTLIBRARIES = libsoundpluginkeytone.la
+
+#libsoundpluginkeytone_la_SOURCES = mm_sound_plugin_run_keytone.c
+#libsoundpluginkeytone_la_SOURCES = mm_sound_plugin_run_keytone_alsa.c
+libsoundpluginkeytone_la_SOURCES = mm_sound_plugin_run_key_tone.c
+
+libsoundpluginkeytone_la_CFLAGS = \
+ $(MMCOMMON_CFLAGS) \
+ -I$(srcdir)/../../../include \
+ -I$(srcdir)/../../include \
+ $(MMLOGSVR_CFLAGS) -DMMF_LOG_OWNER=0x020 -DMMF_DEBUG_PREFIX=\"MMF-SOUND\"
+
+libsoundpluginkeytone_la_LIBADD = $(MMCOMMON_LIBS) \
+ $(MMLOGSVR_LIBS) \
+ $(srcdir)/../../../common/libmmfsoundcommon.la
+
+libsoundpluginkeytone_la_CFLAGS += $(AVSYSTEM_CFLAGS)
+libsoundpluginkeytone_la_LIBADD += $(AVSYSTEM_LIBS)
+
+install-exec-hook:
+ mkdir -p $(DESTDIR)$(libdir)/soundplugins
+ ln -sf /usr/lib/libsoundpluginkeytone.so $(DESTDIR)$(libdir)/soundplugins/libsoundpluginkeytone.so
+
--- /dev/null
+/*
+ * 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 <stdlib.h>
+#include <string.h>
+#include <sys/time.h>
+#include <time.h>
+#include <semaphore.h>
+#include <unistd.h>
+#include <sys/syscall.h>
+#include <mm_error.h>
+#include <mm_debug.h>
+#include <mm_source.h>
+
+#include <pthread.h>
+#include <fcntl.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <errno.h>
+#include <semaphore.h>
+
+#include <avsys-audio.h>
+
+
+#include "../../include/mm_sound_plugin_run.h"
+#include "../../include/mm_sound_plugin_codec.h"
+
+#define TIMEOUT_SEC 2
+#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 */
+#define AUDIO_CHANNEL 1
+#define AUDIO_SAMPLERATE 44100
+
+
+enum {
+ WAVE_CODE_UNKNOWN = 0,
+ WAVE_CODE_PCM = 1,
+ WAVE_CODE_ADPCM = 2,
+ WAVE_CODE_G711 = 3,
+ WAVE_CODE_IMA_ADPCM = 17,
+ WAVE_CODE_G723_ADPCM = 20,
+ WAVE_CODE_GSM = 49,
+ WAVE_CODE_G721_ADPCM = 64,
+ WAVE_CODE_MPEG = 80,
+};
+
+#define MAKE_FOURCC(a, b, c, d) ((a) | (b) << 8) | ((c) << 16 | ((d) << 24))
+#define RIFF_CHUNK_ID ((unsigned long) MAKE_FOURCC('R', 'I', 'F', 'F'))
+#define RIFF_CHUNK_TYPE ((unsigned long) MAKE_FOURCC('W', 'A', 'V', 'E'))
+#define FMT_CHUNK_ID ((unsigned long) MAKE_FOURCC('f', 'm', 't', ' '))
+#define DATA_CHUNK_ID ((unsigned long) MAKE_FOURCC('d', 'a', 't', 'a'))
+
+enum {
+ RENDER_READY,
+ RENDER_START,
+ RENDER_STARTED,
+ RENDER_STOP,
+ RENDER_STOPED,
+ RENDER_STOPED_N_WAIT,
+ RENDER_COND_TIMED_WAIT,
+};
+
+typedef struct
+{
+ pthread_mutex_t sw_lock;
+ pthread_cond_t sw_cond;
+ avsys_handle_t handle;
+
+ int period;
+ int volume_config;
+ int state;
+ void *src;
+} keytone_info_t;
+
+typedef struct
+{
+ char filename[FILE_FULL_PATH];
+ int volume_config;
+} ipc_type;
+
+typedef struct
+{
+ mmsound_codec_info_t *info;
+ MMSourceType *source;
+} buf_param_t;
+
+static int (*g_thread_pool_func)(void*, void (*)(void*)) = NULL;
+
+int CreateAudioHandle();
+static int g_CreatedFlag;
+static int __MMSoundKeytoneParse(MMSourceType *source, mmsound_codec_info_t *info);
+static int _MMSoundKeytoneInit(void);
+static int _MMSoundKeytoneFini(void);
+static int _MMSoundKeytoneRender(void *param_not_used);
+static keytone_info_t g_keytone;
+static int stop_flag = 0;
+
+static
+int MMSoundPlugRunKeytoneControlRun(void)
+{
+ int pre_mask;
+ int ret = MM_ERROR_NONE;
+ int fd = -1;
+ ipc_type data;
+ int size = 0;
+ mmsound_codec_info_t info = {0,};
+ MMSourceType source = {0,};
+ buf_param_t buf_param = {NULL, NULL};
+
+ debug_enter("\n");
+
+ /* INIT IPC */
+ pre_mask = umask(0);
+ if (mknod(KEYTONE_PATH,S_IFIFO|0660,0)<0) {
+ debug_warning ("mknod failed. errno=[%d][%s]\n", errno, strerror(errno));
+ }
+ umask(pre_mask);
+
+ fd = open(KEYTONE_PATH, O_RDWR);
+ debug_msg("after open file descriptor %d\n", fd);
+ if (fd == -1) {
+ debug_warning("Check ipc node %s\n", KEYTONE_PATH);
+ 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][%s]\n", errno, strerror(errno));
+ }
+
+ /* Init Audio Handle & internal buffer */
+ ret = _MMSoundKeytoneInit(); /* Create two thread and open device */
+ if (ret != MM_ERROR_NONE) {
+ debug_critical("Cannot create keytone\n");
+
+ }
+ stop_flag = 1;
+ source.ptr = NULL;
+
+ debug_msg("[%s] Trace\n", __func__);
+ size = sizeof(ipc_type);
+ int once= MMSOUND_TRUE;
+ g_CreatedFlag = MMSOUND_FALSE;
+
+ while (stop_flag) {
+ memset(&data, 0, sizeof(ipc_type));
+ debug_msg("[%s] The Keytone plugin is running......\n", __func__);
+ ret = read(fd, (void *)&data, size);
+ if (ret == -1) {
+ 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.volume_config = data.volume_config;
+ debug_log("[%s] The volume config is [%x]\n", __func__, g_keytone.volume_config);
+
+ if (g_keytone.state == RENDER_STARTED) {
+ g_keytone.state = RENDER_STOP;
+ pthread_cond_wait(&g_keytone.sw_cond, &g_keytone.sw_lock);
+ }
+
+ ret = mm_source_open_file(data.filename, &source, MM_SOURCE_NOT_DRM_CONTENTS);
+ if (ret != MM_ERROR_NONE) {
+ debug_critical("Cannot open files\n");
+ pthread_mutex_unlock(&g_keytone.sw_lock);
+ continue;
+ }
+
+
+ ret = __MMSoundKeytoneParse(&source, &info);
+ if (ret != MM_ERROR_NONE) {
+ debug_critical("Fail to parse file\n");
+ mm_source_close(&source);
+ source.ptr = NULL;
+ pthread_mutex_unlock(&g_keytone.sw_lock);
+ continue;
+ }
+
+ if (g_CreatedFlag== MMSOUND_FALSE) {
+ if(MM_ERROR_NONE != CreateAudioHandle(info)) {
+ debug_critical("Audio handle creation failed. cannot play keytone\n");
+ mm_source_close(&source);
+ source.ptr = NULL;
+ pthread_mutex_unlock(&g_keytone.sw_lock);
+ continue;
+ }
+ g_CreatedFlag = MMSOUND_TRUE;
+ }
+
+ buf_param.info = &info;
+ buf_param.source = &source;
+ g_keytone.src = &buf_param;
+ if (once== MMSOUND_TRUE) {
+ g_thread_pool_func(NULL, (void*)_MMSoundKeytoneRender);
+ once= MMSOUND_FALSE;
+ }
+
+ if (g_keytone.state == RENDER_STOPED_N_WAIT ||
+ g_keytone.state == RENDER_COND_TIMED_WAIT) {
+ 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);
+
+ }
+
+ if (fd > -1)
+ close(fd);
+ _MMSoundKeytoneFini();
+ debug_leave("\n");
+
+ return MM_ERROR_NONE;
+}
+
+static
+int MMSoundPlugRunKeytoneControlStop(void)
+{
+ stop_flag = 0; /* No impl. Don`t stop */
+ return MM_ERROR_NONE;
+}
+
+static
+int MMSoundPlugRunKeytoneSetThreadPool(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 = MMSoundPlugRunKeytoneControlRun;
+ intf->stop = MMSoundPlugRunKeytoneControlStop;
+ intf->SetThreadPool = MMSoundPlugRunKeytoneSetThreadPool;
+ debug_leave("\n");
+
+ return MM_ERROR_NONE;
+}
+
+EXPORT_API
+int MMSoundGetPluginType(void)
+{
+ debug_enter("\n");
+ debug_leave("\n");
+ return MM_SOUND_PLUGIN_TYPE_RUN;
+}
+
+static int _MMSoundKeytoneInit(void)
+{
+
+ debug_enter("\n");
+
+ //g_keytone.vol_type = AVSYS_AUDIO_VOLUME_TYPE_SYSTEM; //default value.
+
+ /* Set audio FIXED param */
+
+ g_keytone.state = RENDER_READY;
+ if (pthread_mutex_init(&(g_keytone.sw_lock), NULL)) {
+ debug_error("pthread_mutex_init() failed [%s][%d]\n", __func__, __LINE__);
+ return MM_ERROR_SOUND_INTERNAL;
+ }
+ if (pthread_cond_init(&g_keytone.sw_cond,NULL)) {
+ debug_error("pthread_cond_init() failed [%s][%d]\n", __func__, __LINE__);
+ return MM_ERROR_SOUND_INTERNAL;
+ }
+
+ debug_msg("init\n");
+ return MM_ERROR_NONE;
+}
+
+static int _MMSoundKeytoneFini(void)
+{
+ g_keytone.handle = (avsys_handle_t)-1;
+
+ if (pthread_mutex_destroy(&(g_keytone.sw_lock))) {
+ debug_error("Fail to destroy mutex\n");
+ return MM_ERROR_SOUND_INTERNAL;
+ }
+ debug_msg("destroy\n");
+
+ if (pthread_cond_destroy(&g_keytone.sw_cond)) {
+ debug_error("Fail to destroy cond\n");
+ return MM_ERROR_SOUND_INTERNAL;
+ }
+
+ return MM_ERROR_NONE;
+}
+
+int CreateAudioHandle(mmsound_codec_info_t info)
+{
+ int err = MM_ERROR_NONE;
+ avsys_audio_param_t audio_param;
+
+ memset(&audio_param, 0, sizeof(avsys_audio_param_t));
+
+ audio_param.mode = AVSYS_AUDIO_MODE_OUTPUT_LOW_LATENCY;
+ audio_param.channels = info.channels;//AUDIO_CHANNEL;
+ audio_param.samplerate = info.samplerate;//AUDIO_SAMPLERATE;
+ audio_param.format = AVSYS_AUDIO_FORMAT_16BIT;
+ audio_param.vol_type = g_keytone.volume_config;
+ audio_param.priority = AVSYS_AUDIO_PRIORITY_0;
+
+
+ err = avsys_audio_open(&audio_param, &g_keytone.handle, &g_keytone.period);
+ if (AVSYS_FAIL(err)) {
+ debug_error("Fail to audio open 0x%08X\n", err);
+ return MM_ERROR_SOUND_INTERNAL;
+ }
+ debug_log("Period size is %d bytes\n", g_keytone.period);
+
+
+ //FIXME :: remove dasf buffer size
+ if (g_keytone.period > MAX_BUFFER_SIZE) {
+ g_keytone.period = MAX_BUFFER_SIZE;
+ }
+
+ return err;
+
+}
+
+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[MAX_BUFFER_SIZE];
+ unsigned int size=0;
+ buf_param_t *param=NULL;
+ struct timespec timeout;
+ struct timeval tv;
+ int stat;
+
+ 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);
+ }
+
+ 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 */
+ info = *param->info;
+ buf = source.ptr+info.doffset;
+
+ size = info.size;
+ if(buf==NULL) {
+ size=0;
+ debug_critical("Ooops.... Not Expected!!!!!!!!\n");
+ }
+
+ g_keytone.state = RENDER_STARTED;
+ }
+
+ pthread_mutex_unlock(&g_keytone.sw_lock);
+
+
+
+
+ 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;
+ }
+ pthread_mutex_unlock(&g_keytone.sw_lock);
+
+ if(size<g_keytone.period) {
+#if defined(_DEBUG_VERBOS_)
+ 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);
+ avsys_audio_write(g_keytone.handle, (void *)Outbuf, g_keytone.period);
+
+ memset(Outbuf, 0, g_keytone.period);
+ avsys_audio_write(g_keytone.handle, (void *)Outbuf, g_keytone.period);
+ avsys_audio_write(g_keytone.handle, (void *)Outbuf, g_keytone.period);
+
+ size = 0;
+ } else {
+#if defined(_DEBUG_VERBOS_)
+ debug_msg("[%s][Keysound] size=%d, period=%d\n", __func__, size, g_keytone.period);
+#endif
+ memcpy(Outbuf, buf, g_keytone.period);
+
+ avsys_audio_write(g_keytone.handle, (void *)Outbuf, g_keytone.period);
+ size -= g_keytone.period;
+ buf += g_keytone.period;
+
+ }
+ }
+
+ mm_source_close(&source);
+ source.ptr = NULL;
+
+ 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) {
+ 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;
+ }
+ } /* while(stop_flag) */
+
+ pthread_mutex_unlock(&g_keytone.sw_lock);
+ }
+ return MMSOUND_FALSE;
+}
+
+static int __MMSoundKeytoneParse(MMSourceType *source, mmsound_codec_info_t *info)
+{
+ struct __riff_chunk
+ {
+ long chunkid;
+ long chunksize;
+ long rifftype;
+ };
+
+ struct __wave_chunk
+ {
+ long chunkid;
+ long chunksize;
+ unsigned short compression;
+ unsigned short channels;
+ unsigned long samplerate;
+ unsigned long avgbytepersec;
+ unsigned short blockkalign;
+ unsigned short bitspersample;
+ };
+
+ struct __data_chunk
+ {
+ long chunkid;
+ long chunkSize;
+ };
+
+ struct __riff_chunk *priff = NULL;
+ struct __wave_chunk *pwav = NULL;
+ struct __data_chunk *pdata = NULL;
+// struct __fmt_chunk *pfmt = NULL;
+
+ int datalen = -1;
+ char *data = NULL;
+ unsigned int tSize;
+
+ debug_enter("\n");
+
+ data = MMSourceGetPtr(source);
+ datalen = MMSourceGetCurSize(source);
+
+#if defined(_DEBUG_VERBOS_)
+ debug_msg("source ptr :[%p]\n", data);
+ debug_msg("source size :[%d]\n", datalen);
+#endif
+ priff = (struct __riff_chunk *) data;
+
+ /* Must be checked, Just for wav or not */
+ if (priff->chunkid != RIFF_CHUNK_ID ||priff->rifftype != RIFF_CHUNK_TYPE)
+ return MM_ERROR_SOUND_UNSUPPORTED_MEDIA_TYPE;
+
+ if(priff->chunksize != datalen -8)
+ priff->chunksize = (datalen-8);
+
+ if (priff->chunkid != RIFF_CHUNK_ID ||priff->chunksize != datalen -8 ||priff->rifftype != RIFF_CHUNK_TYPE) {
+ debug_msg("This contents is not RIFF file\n");
+#if defined(_DEBUG_VERBOS_)
+ debug_msg("cunkid : %ld, chunksize : %ld, rifftype : 0x%lx\n", priff->chunkid, priff->chunksize, priff->rifftype);
+ debug_msg("cunkid : %ld, chunksize : %d, rifftype : 0x%lx\n", RIFF_CHUNK_ID, datalen-8, RIFF_CHUNK_TYPE);
+#endif
+ return MM_ERROR_SOUND_UNSUPPORTED_MEDIA_TYPE;
+ }
+#if defined(_DEBUG_VERBOS_)
+ debug_msg("cunkid : %ld, chunksize : %ld, rifftype : %lx\n", priff->chunkid, priff->chunksize, priff->rifftype);
+ debug_msg("cunkid : %ld, chunksize : %d, rifftype : %lx\n", RIFF_CHUNK_ID, datalen-8, RIFF_CHUNK_TYPE);
+#endif
+ tSize = sizeof(struct __riff_chunk);
+ pdata = (struct __data_chunk*)(data+tSize);
+
+ while (pdata->chunkid != FMT_CHUNK_ID && tSize < datalen) {
+ tSize += (pdata->chunkSize+8);
+
+ if (tSize >= datalen) {
+ debug_warning("Wave Parsing is Finished : unable to find the Wave Format chunk\n");
+ return MM_ERROR_SOUND_UNSUPPORTED_MEDIA_TYPE;
+ } else {
+ pdata = (struct __data_chunk*)(data+tSize);
+ }
+ }
+ pwav = (struct __wave_chunk*)(data+tSize);
+
+ if (pwav->chunkid != FMT_CHUNK_ID ||
+ pwav->compression != WAVE_CODE_PCM || /* Only supported PCM */
+ pwav->avgbytepersec != pwav->samplerate * pwav->blockkalign ||
+ pwav->blockkalign != (pwav->bitspersample >> 3)*pwav->channels) {
+ debug_msg("This contents is not supported wave file\n");
+#if defined(_DEBUG_VERBOS_)
+ debug_msg("chunkid : 0x%lx, comp : 0x%x, av byte/sec : %lu, blockalign : %d\n", pwav->chunkid, pwav->compression, pwav->avgbytepersec, pwav->blockkalign);
+#endif
+ return MM_ERROR_SOUND_UNSUPPORTED_MEDIA_TYPE;
+ }
+
+ /* Only One data chunk support */
+
+ tSize += (pwav->chunksize+8);
+ pdata = (struct __data_chunk *)(data+tSize);
+
+ while (pdata->chunkid != DATA_CHUNK_ID && tSize < datalen) {
+ tSize += (pdata->chunkSize+8);
+ if (tSize >= datalen) {
+ debug_warning("Wave Parsing is Finished : unable to find the data chunk\n");
+ return MM_ERROR_SOUND_UNSUPPORTED_MEDIA_TYPE;
+ } else {
+ pdata = (struct __data_chunk*)(data+tSize);
+ }
+ }
+
+ info->codec = MM_SOUND_SUPPORTED_CODEC_WAVE;
+ info->channels = pwav->channels;
+ info->format = pwav->bitspersample;
+ info->samplerate = pwav->samplerate;
+ info->doffset = (tSize+8);
+ info->size = pdata->chunkSize;
+ debug_msg("info->size:%d\n", info->size);
+ debug_leave("\n");
+ return MM_ERROR_NONE;
+}
--- /dev/null
+lib_LTLIBRARIES = libsoundplugintone.la
+
+libsoundplugintone_la_SOURCES = mm_sound_plugin_codec_tone.c
+
+libsoundplugintone_la_CFLAGS = \
+ $(MMCOMMON_CFLAGS) \
+ -I$(srcdir)/../../../../common/include \
+ -I$(srcdir)/../../../include \
+ $(MMLOGSVR_CFLAGS) -DMMF_LOG_OWNER=0x020 -DMMF_DEBUG_PREFIX=\"MMF-SOUND\"
+
+libsoundplugintone_la_LIBADD = \
+ $(MMCOMMON_LIBS) \
+ $(MMLOGSVR_LIBS)
+
+libsoundplugintone_la_CFLAGS += $(AVSYSTEM_CFLAGS)
+libsoundplugintone_la_LIBADD += $(AVSYSTEM_LIBS)
+
+install-exec-hook:
+ mkdir -p $(DESTDIR)$(libdir)/soundplugins
+ ln -sf /usr/lib/libsoundplugintone.so $(DESTDIR)$(libdir)/soundplugins/libsoundplugintone.so
+
--- /dev/null
+/*
+ * 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 <stdlib.h>
+#include <string.h>
+
+#include <semaphore.h>
+#include <unistd.h>
+#include <pthread.h>
+
+#include <avsys-audio.h>
+
+#include "../../include/mm_sound_thread_pool.h"
+#include "../../include/mm_sound_plugin_codec.h"
+#include <mm_error.h>
+#include <mm_debug.h>
+#include <mm_sound.h>
+
+#include <sys/types.h>
+#include <sys/stat.h>
+
+/* For Beep */
+#include <fcntl.h>
+#include <math.h>
+#include <glib.h>
+#ifndef M_PI
+#define M_PI 3.14159265358979323846
+#endif
+
+#ifndef M_PI_2
+#define M_PI_2 1.57079632679489661923
+#endif
+
+#define SAMPLERATE 44100
+
+#define SAMPLE_SIZE 16
+#define CHANNELS 1
+#define MAX_DURATION 100
+#define TONE_COLUMN 6
+
+typedef enum {
+ STATE_NONE = 0,
+ STATE_READY,
+ STATE_BEGIN,
+ STATE_PLAY,
+ STATE_STOP,
+} state_e;
+
+typedef enum {
+ CONTROL_STOPPED,
+ CONTROL_READY,
+ CONTROL_STARTING,
+ CONTROL_PLAYING,
+} control_e;
+
+typedef struct {
+ pthread_mutex_t syncker;
+ pthread_cond_t cond;
+ int state;
+} tone_control_t;
+
+typedef struct {
+ /* AMR Buffer */
+ int size; /* sizeof hole amr data */
+
+ /* Audio Infomations */
+ avsys_handle_t audio_handle;
+
+ /* control Informations */
+ int repeat_count;
+ int (*stop_cb)(int);
+ int cb_param;
+ int state;
+ int number;
+ double volume;
+ int time;
+ int pid;
+
+} tone_info_t;
+
+typedef enum
+{
+ LOW_FREQUENCY = 0,
+ MIDDLE_FREQUENCY,
+ HIGH_FREQUENCY,
+ PLAYING_TIME,
+ LOOP_COUNT,
+ LOOP_INDEX,
+} volume_type_e;
+
+typedef struct st_tone
+{
+ float low_frequency;
+ float middle_frequency;
+ float high_frequency;
+ int playingTime;
+ int loopCnt;
+ int loopIndx;
+} TONE;
+
+ static const int TONE_SEGMENT[][MM_SOUND_TONE_NUM] =
+ {
+ {941, 1336, 0, -1, 0, 0,
+ -1, -1, -1, -1, 0, 0},// 0 key: 1336Hz, 941Hz
+
+ {697, 1209, 0, -1, 0, 0,
+ -1, -1, -1, -1, 0, 0},// 1 key: 1209Hz, 697Hz
+
+ {697, 1336, 0, -1, 0, 0,
+ -1, -1, -1, -1, 0, 0},// 2 key: 1336Hz, 697Hz
+
+ {697, 1477, 0, -1, 0, 0,
+ -1, -1, -1, -1, 0, 0}, // 3 key: 1477Hz, 697Hz
+
+ {770, 1209, 0, -1, 0, 0,
+ -1, -1, -1, -1, 0, 0},// 4 key: 1209Hz, 770Hz
+
+ {770, 1336, 0, -1, 0, 0,
+ -1, -1, -1, -1, 0, 0},// 5 key: 1336Hz, 770Hz
+
+ {770, 1477, 0, -1, 0, 0,
+ -1, -1, -1, -1, 0, 0},// 6 key: 1477Hz, 770Hz
+
+ {852, 1209, 0, -1, 0, 0,
+ -1, -1, -1, -1, 0, 0},// 7 key: 1209Hz, 852Hz
+
+ {852, 1336, 0, -1, 0, 0,
+ -1, -1, -1, -1, 0, 0},// 8 key: 1336Hz, 852Hz
+
+ {852, 1477, 0, -1, 0, 0,
+ -1, -1, -1, -1, 0, 0},// 9 key: 1477Hz, 852Hz
+
+ {941, 1209, 0, -1, 0, 0,
+ -1, -1, -1, -1, 0, 0},// * key: 1209Hz, 941Hz
+
+ {941, 1477, 0, -1, 0, 0,
+ -1, -1, -1, -1, 0, 0},// # key: 1477Hz, 941Hz
+
+ {697, 1633, 0, -1, 0, 0,
+ -1, -1, -1, -1, 0, 0},// A key: 1633Hz, 697Hz
+
+ {770, 1633, 0, -1, 0, 0,
+ -1, -1, -1, -1, 0, 0},// B key: 1633Hz, 770Hz
+
+ {852, 1633, 0, -1, 0, 0,
+ -1, -1, -1, -1, 0, 0},// C key: 1633Hz, 852Hz
+
+ {941, 1633, 0, -1, 0, 0,
+ -1, -1, -1, -1, 0, 0}, // D key: 1633Hz, 941Hz
+
+ {425, 0, 0, -1, 0, 0,
+ -1, -1, -1, -1, 0, 0}, //Call supervisory tone, Dial tone: CEPT: 425Hz, continuous
+
+ {350, 440, 0, -1, 0, 0,
+ -1, -1, -1, -1, 0, 0}, //Call supervisory tone, Dial tone: ANSI (IS-95): 350Hz+440Hz, continuous
+
+ {400, 0, 0, -1, 0, 0,
+ -1, -1, -1, -1, 0, 0}, //Call supervisory tone, Dial tone: JAPAN: 400Hz, continuous
+
+ {425, 0, 0, 500, 0, 0,
+ 0, 0, 0, 500, 0, 0,
+ -1, -1, -1, -1, 0, 0},//Call supervisory tone, Busy: CEPT: 425Hz, 500ms ON, 500ms OFF...
+
+ {480, 620, 0, 500, 0, 0,
+ 0, 0, 0, 500, 0, 0,
+ -1, -1, -1, -1, 0, 0}, //Call supervisory tone, Busy: ANSI (IS-95): 480Hz+620Hz, 500ms ON, 500ms OFF...
+
+ {400, 0, 0, 500, 0, 0,
+ 0, 0, 0, 500, 0, 0,
+ -1, -1, -1, -1, 0, 0}, //Call supervisory tone, Busy: JAPAN: 400Hz, 500ms ON, 500ms OFF...
+
+ {425, 0, 0, 200, 0, 0,
+ 0, 0, 0, 200, 0, 0,
+ -1, -1, -1, -1, 0, 0}, //Call supervisory tone, Congestion: CEPT, JAPAN: 425Hz, 200ms ON, 200ms OFF
+
+ {480, 620, 0, 250, 0, 0,
+ 0, 0, 0, 250, 0, 0,
+ -1, -1, -1, -1, 0, 0}, //Call supervisory tone, Congestion: ANSI (IS-95): 480Hz+620Hz, 250ms ON, 250ms OFF...
+
+ {425, 0, 0, 200, 0, 0,
+ -1, -1, -1, -1, 0, 0}, //Call supervisory tone, Radio path acknowlegment : CEPT, ANSI: 425Hz, 200ms ON
+
+ {400, 0, 0, 1000, 0, 0,
+ 0, 0, 0, 2000, 0, 0,
+ -1, -1, -1, -1, 0, 0}, //Call supervisory tone, Radio path acknowlegment : JAPAN: 400Hz, 1s ON, 2s OFF...
+
+ {425, 0, 0, 200, 0, 0,
+ 0, 0, 0, 200, 0, 0,
+ -1, -1, -1, -1, 3, 0}, //Call supervisory tone, Radio path not available: 425Hz, 200ms ON, 200 OFF 3 bursts
+
+ {950, 1400, 1800, 330, 0, 0,
+ 0, 0, 0, 1000, 0, 0,
+ -1, -1, -1, -1, 0, 0}, //Call supervisory tone, Error/Special info: 950Hz+1400Hz+1800Hz, 330ms ON, 1s OFF...
+
+ {425, 0, 0, 200, 0, 0,
+ 0, 0, 0, 600, 0, 0,
+ 425, 0, 0, 200, 0, 0,
+ 0, 0, 0, 3000,0, 0,
+ -1, -1, -1, -1, 0, 0}, //Call supervisory tone, Call Waiting: CEPT, JAPAN: 425Hz, 200ms ON, 600ms OFF, 200ms ON, 3s OFF...
+
+ {440, 0, 0, 300, 0, 0,
+ 0, 0, 0, 9700, 0, 0,
+ 440, 0, 0, 100, 0, 0,
+ 0, 0, 0, 100, 0, 0,
+ 440, 0, 0, 100, 0, 0,
+ 0, 0, 0, 9700, 0, 0,
+ -1, -1, -1, -1, 0, 0}, //Call supervisory tone, Call Waiting: ANSI (IS-95): 440 Hz, 300 ms ON, 9.7 s OFF, (100 ms ON, 100 ms OFF, 100 ms ON, 9.7s OFF ...)
+
+ {425, 0, 0, 1000, 0, 0,
+ 0, 0, 0, 4000, 0, 0,
+ -1, -1, -1, -1, 0, 0}, //Call supervisory tone, Ring Tone: CEPT, JAPAN: 425Hz, 1s ON, 4s OFF...
+
+ {440, 480, 0, 2000, 0, 0,
+ 0, 0, 0, 4000, 0, 0,
+ -1, -1, -1, -1, 0, 0}, //Call supervisory tone, Ring Tone: ANSI (IS-95): 440Hz + 480Hz, 2s ON, 4s OFF...
+
+ {400, 1200, 0, 35, 0, 0,
+ -1, -1, -1, -1, 0, 0}, // General beep: 400Hz+1200Hz, 35ms ON
+
+ {1200, 0, 0, 100, 0, 0,
+ 0, 0, 0, 100, 0, 0,
+ -1, -1, -1, -1, 2, 0}, //Proprietary tone, positive acknowlegement: 1200Hz, 100ms ON, 100ms OFF 2 bursts
+
+ {300, 400, 500, 400, 0, 0,
+ -1, -1, -1, -1, 0, 0}, //Proprietary tone, negative acknowlegement: 300Hz+400Hz+500Hz, 400ms ON
+
+ {400, 1200, 0, 200, 0, 0,
+ -1, -1, -1, -1, 0, 0}, //Proprietary tone, prompt tone: 400Hz+1200Hz, 200ms ON
+
+ {400, 1200, 0, 35, 0, 0,
+ 0, 0, 0, 200, 0, 0,
+ 400, 1200, 0, 35, 0, 0,
+ -1, -1, -1, -1, 0, 0}, //Proprietary tone, general double beep: twice 400Hz+1200Hz, 35ms ON, 200ms OFF, 35ms ON
+
+ {440, 0, 0, 250, 0, 0,
+ 620, 0, 0, 250, 0, 0,
+ -1, -1, -1, -1, 0, 0}, //Call supervisory tone (IS-95), intercept tone: alternating 440 Hz and 620 Hz tones, each on for 250 ms
+
+ {440, 0, 0, 250, 0, 0,
+ 620, 0, 0, 250, 0, 0,
+ -1, -1, -1, -1, 8, 0}, //Call supervisory tone (IS-95), abbreviated intercept: intercept tone limited to 4 seconds
+
+ {480, 620, 0, 250, 0, 0,
+ 0, 0, 0, 250, 0, 0,
+ -1, -1, -1, -1, 8, 0 }, //Call supervisory tone (IS-95), abbreviated congestion: congestion tone limited to 4 seconds
+
+ {350, 440, 0, 100, 0, 0,
+ 0, 0, 0, 100, 0, 0,
+ -1, -1, -1, -1, 3, 0}, //Call supervisory tone (IS-95), confirm tone: a 350 Hz tone added to a 440 Hz tone repeated 3 times in a 100 ms on, 100 ms off cycle
+
+ {480, 0, 0, 100, 0, 0,
+ 0, 0, 0, 100, 0, 0,
+ -1, -1, -1, -1, 4, 0}, //Call supervisory tone (IS-95), pip tone: four bursts of 480 Hz tone (0.1 s on, 0.1 s off).
+
+ { 425, 0, 0, -1, 0, 0,
+ -1, -1, -1, -1, 0, 0}, //425Hz continuous
+
+ {440, 480, 0, 2000, 0, 0,
+ 0, 0, 0, 4000, 0, 0,
+ -1, -1, -1, -1, 0, 0}, //CDMA USA Ringback: 440Hz+480Hz 2s ON, 4000 OFF ...
+
+ {440, 0, 0, 250, 0, 0,
+ 620, 0, 0, 250, 0, 0,
+ -1, -1, -1, -1, 0, 0}, //CDMA Intercept tone: 440Hz 250ms ON, 620Hz 250ms ON ...
+
+ {440, 0, 0, 250, 0, 0,
+ 620, 0, 0, 250, 0, 0,
+ -1, -1, -1, -1, 0, 0 }, //CDMA Abbr Intercept tone: 440Hz 250ms ON, 620Hz 250ms ON
+
+ {480, 620, 0, 250, 0, 0,
+ 0, 0, 0, 250, 0, 0,
+ -1, -1, -1, -1, 0, 0 }, //CDMA Reorder tone: 480Hz+620Hz 250ms ON, 250ms OFF...
+
+ {480, 620, 0, 250, 0, 0,
+ 0, 0, 0, 250, 0, 0,
+ -1, -1, -1, -1, 8, 0}, //CDMA Abbr Reorder tone: 480Hz+620Hz 250ms ON, 250ms OFF repeated for 8 times
+
+ {480, 620, 0, 500, 0, 0,
+ 0, 0, 0, 500, 0, 0,
+ -1, -1, -1, -1, 0, 0}, //CDMA Network Busy tone: 480Hz+620Hz 500ms ON, 500ms OFF continuous
+
+ {350, 440, 0, 100, 0, 0,
+ 0, 0, 0, 100, 0, 0,
+ -1, -1, -1, -1, 3, 0}, //CDMA Confirm tone: 350Hz+440Hz 100ms ON, 100ms OFF repeated for 3 times
+
+ {660, 1000, 0, 500, 0, 0,
+ 0, 0, 0, 100, 0, 0,
+ -1, -1, -1, -1, 0, 0}, //CDMA answer tone: silent tone - defintion Frequency 0, 0ms ON, 0ms OFF
+
+ {440, 0, 0, 300, 0, 0,
+ -1, -1, -1, -1, 0, 0}, //CDMA Network Callwaiting tone: 440Hz 300ms ON
+
+ {480, 0, 0, 100, 0, 0,
+ 0, 0, 0, 100, 0, 0,
+ -1, -1, -1, -1, 4, 0}, //CDMA PIP tone: 480Hz 100ms ON, 100ms OFF repeated for 4 times
+
+ {2090, 0, 0, 32, 0, 0,
+ 2556, 0, 0, 64, 19, 0,
+ 2090, 0, 0, 32, 0, 0,
+ 2556, 0, 0, 48, 0, 0,
+ 0, 0, 0, 4000, 0, 0,
+ -1, -1, -1, -1, 0, 0}, //ISDN Call Signal Normal tone: {2091Hz 32ms ON, 2556 64ms ON} 20 times, 2091 32ms ON, 2556 48ms ON, 4s OFF
+
+ {2091, 0, 0, 32, 0, 0,
+ 2556, 0, 0, 64, 7, 0,
+ 2091, 0, 0, 32, 0, 0,
+ 0, 0, 0, 400, 0, 0,
+ 2091, 0, 0, 32, 0, 0,
+ 2556, 0, 0, 64, 7, 4,
+ 2091, 0, 0, 32, 0, 0,
+ 0, 0, 0, 4000, 0, 0,
+ -1, -1, -1, -1, 0, 0}, //ISDN Call Signal Intergroup tone: {2091Hz 32ms ON, 2556 64ms ON} 8 times, 2091Hz 32ms ON, 400ms OFF, {2091Hz 32ms ON, 2556Hz 64ms ON} 8times, 2091Hz 32ms ON, 4s OFF.
+
+ {2091, 0, 0, 32, 0, 0,
+ 2556, 0, 0, 64, 3, 0,
+ 2091, 0, 0, 32, 0, 0,
+ 0, 0, 0, 200, 0, 0,
+ 2091, 0, 0, 32, 0, 0,
+ 2556, 0, 0, 64, 3, 4,
+ 2091, 0, 0, 32, 0, 0,
+ 0, 0, 0, 200, 0, 0,
+ -1, -1, -1, -1, 0, 0},//ISDN Call Signal SP PRI tone:{2091Hz 32ms ON, 2556 64ms ON} 4 times 2091Hz 16ms ON, 200ms OFF, {2091Hz 32ms ON, 2556Hz 64ms ON} 4 times, 2091Hz 16ms ON, 200ms OFF
+
+ {0, 0, 0, -1, 0, 0,
+ -1, -1, -1, -1, 0, 0}, //ISDN Call sign PAT3 tone: silent tone
+
+ {2091, 0, 0, 32, 0, 0,
+ 2556, 0, 0, 64, 4, 0,
+ 2091, 0, 0, 20, 0, 0,
+ -1, -1, -1, -1, 0, 0}, //ISDN Ping Ring tone: {2091Hz 32ms ON, 2556Hz 64ms ON} 5 times 2091Hz 20ms ON
+
+ {0, 0, 0, -1, 0, 0,
+ -1, -1, -1, -1, 0, 0}, //ISDN Pat5 tone: silent tone
+
+ {0, 0, 0, -1, 0, 0,
+ -1, -1, -1, -1, 0, 0}, //ISDN Pat6 tone: silent tone
+
+ {0, 0, 0, -1, 0, 0,
+ -1, -1, -1, -1, 0, 0}, //ISDN Pat7 tone: silent tone
+
+ {3700, 0, 0, 25, 0, 0,
+ 4000, 0, 0, 25, 39, 0,
+ 0, 0, 0, 4000, 0, 0,
+ -1, -1, -1, -1, 0, 0}, //TONE_CDMA_HIGH_L tone: {3700Hz 25ms, 4000Hz 25ms} 40 times 4000ms OFF, Repeat ....
+
+ {2600, 0, 0, 25, 0, 0,
+ 2900, 0, 0, 25, 39, 0,
+ 0, 0, 0, 4000, 0, 0,
+ -1, -1, -1, -1, 0, 0},//TONE_CDMA_MED_L tone: {2600Hz 25ms, 2900Hz 25ms} 40 times 4000ms OFF, Repeat ....
+
+ {1300, 0, 0, 25, 0, 0,
+ 1450, 0, 0, 25, 39, 0,
+ 0, 0, 0,4000, 0, 0,
+ -1, -1, -1, -1, 0, 0}, //TONE_CDMA_LOW_L tone: {1300Hz 25ms, 1450Hz 25ms} 40 times, 4000ms OFF, Repeat ....
+
+ {3700, 0, 0, 25, 0, 0,
+ 4000, 0, 0, 25, 15, 0,
+ 0, 0, 0, 400, 0, 0,
+ -1, -1, -1, -1, 0, 0},//CDMA HIGH SS tone: {3700Hz 25ms, 4000Hz 25ms} repeat 16 times, 400ms OFF, repeat ....
+
+ {2600, 0, 0, 25, 0, 0,
+ 2900, 0, 0, 25, 15, 0,
+ 0, 0, 0,400, 0, 0,
+ -1, -1, -1, -1, 0, 0}, //CDMA MED SS tone: {2600Hz 25ms, 2900Hz 25ms} repeat 16 times, 400ms OFF, repeat ....
+
+ {1300, 0, 0, 25, 0, 0,
+ 1450, 0, 0, 25, 15, 0,
+ 0, 0, 0, 400, 0, 0,
+ -1, -1, -1, -1, 0, 0}, //CDMA LOW SS tone: {1300z 25ms, 1450Hz 25ms} repeat 16 times, 400ms OFF, repeat ....
+
+ {3700, 0, 0, 25, 0, 0,
+ 4000, 0, 0, 25, 7, 0,
+ 0, 0, 0, 200, 0, 0,
+ 3700, 0, 0, 25, 0, 0,
+ 4000, 0, 0, 25, 7, 3,
+ 0, 0, 0, 200, 0, 0,
+ 3700, 0, 0, 25, 0, 0,
+ 4000, 0, 0, 25, 15, 6,
+ 0, 0, 0, 4000,0, 0,
+ -1, -1, -1, -1, 0, 0}, //CDMA HIGH SSL tone: {3700Hz 25ms, 4000Hz 25ms} 8 times, 200ms OFF, {3700Hz 25ms, 4000Hz 25ms} repeat 8 times, 200ms OFF, {3700Hz 25ms, 4000Hz 25ms} repeat 16 times, 4000ms OFF, repeat ...
+
+ {2600, 0, 0, 25, 0, 0,
+ 2900, 0, 0, 25, 7, 0,
+ 0, 0, 0, 200, 0, 0,
+ 2600, 0, 0, 25, 0, 0,
+ 2900, 0, 0, 25, 7, 3,
+ 0, 0, 0, 200, 0, 0,
+ 2600, 0, 0, 25, 0, 0,
+ 2900, 0, 0, 25, 15, 6,
+ 0, 0, 0, 4000,0, 0,
+ -1, -1, -1, -1, 0, 0}, //CDMA MED SSL tone: {2600Hz 25ms, 2900Hz 25ms} 8 times, 200ms OFF, {2600Hz 25ms, 2900Hz 25ms} repeat 8 times, 200ms OFF, {2600Hz 25ms, 2900Hz 25ms} repeat 16 times, 4000ms OFF, repeat ...
+
+ {1300, 0, 0, 25, 0, 0,
+ 1450, 0, 0, 25, 7, 0,
+ 0, 0, 0, 200, 0, 0,
+ 1300, 0, 0, 25, 0, 0,
+ 1450, 0, 0, 25, 7, 3,
+ 0, 0, 0, 200, 0, 0,
+ 1300, 0, 0, 25, 0, 0,
+ 1450, 0, 0, 25, 15, 6,
+ 0, 0, 0, 4000,0, 0,
+ -1, -1, -1, -1, 0, 0}, //CDMA LOW SSL tone: {1300Hz 25ms, 1450Hz 25ms} 8 times, 200ms OFF, {1300Hz 25ms, 1450Hz 25ms} repeat 8 times, 200ms OFF, {1300Hz 25ms, 1450Hz 25ms} repeat 16 times, 4000ms OFF, repeat ...
+
+ {3700, 0, 0, 25, 0, 0,
+ 4000, 0, 0, 25, 19, 0,
+ 0, 0, 0, 1000, 0, 0,
+ 3700, 0, 0, 25, 0, 0,
+ 4000, 0, 0, 25, 19, 3,
+ 0, 0, 0, 3000, 0, 0,
+ -1, -1, -1, -1, 0, 0 },//CDMA HIGH SS2 tone: {3700Hz 25ms, 4000Hz 25ms} 20 times, 1000ms OFF, {3700Hz 25ms, 4000Hz 25ms} 20 times, 3000ms OFF, repeat ....
+
+ {2600, 0, 0, 25, 0, 0,
+ 2900, 0, 0, 25, 19, 0,
+ 0, 0, 0, 1000, 0, 0,
+ 2600, 0, 0, 25, 0, 0,
+ 2900, 0, 0, 25, 19, 3,
+ 0, 0, 0, 3000, 0, 0,
+ -1, -1, -1, -1, 0, 0}, //CDMA MED SS2 tone: {2600Hz 25ms, 2900Hz 25ms} 20 times, 1000ms OFF, {2600Hz 25ms, 2900Hz 25ms} 20 times, 3000ms OFF, repeat ....
+
+ {1300, 0, 0, 25, 0, 0,
+ 1450, 0, 0, 25, 19, 0,
+ 0, 0, 0, 1000, 0, 0,
+ 1300, 0, 0, 25, 0, 0,
+ 1450, 0, 0, 25, 19, 3,
+ 0, 0, 0, 3000, 0, 0,
+ -1, -1, -1, -1, 0, 0 }, //CDMA LOW SS2 tone: {1300Hz 25ms, 1450Hz 25ms} 20 times, 1000ms OFF, {1300Hz 25ms, 1450Hz 25ms} 20 times, 3000ms OFF, repeat ....
+
+ {3700, 0, 0, 25, 0, 0,
+ 4000, 0, 0, 25, 9, 0,
+ 0, 0, 0, 500, 0, 0,
+ 3700, 0, 0, 25, 0, 0,
+ 4000, 0, 0, 25, 19, 3,
+ 0, 0, 0, 500, 0, 0,
+ 3700, 0, 0, 25, 0, 0,
+ 4000, 0, 0, 25, 9, 6,
+ 0, 0, 0, 3000, 0, 0,
+ -1, -1, -1, -1, 0, 0}, //CDMA HIGH SLS tone: {3700Hz 25ms, 4000Hz 25ms} 10 times, 500ms OFF, {3700Hz 25ms, 4000Hz 25ms} 20 times, 500ms OFF, {3700Hz 25ms, 4000Hz 25ms} 10 times, 3000ms OFF, REPEAT
+
+ {2600, 0, 0, 25, 0, 0,
+ 2900, 0, 0, 25, 9, 0,
+ 0, 0, 0, 500, 0, 0,
+ 2600, 0, 0, 25, 0, 0,
+ 2900, 0, 0, 25, 19, 3,
+ 0, 0, 0, 500, 0, 0,
+ 2600, 0, 0, 25, 0, 0,
+ 2900, 0, 0, 25, 9, 6,
+ 0, 0, 0, 3000, 0, 0,
+ -1, -1, -1, -1, 0, 0}, //CDMA MED SLS tone: {2600Hz 25ms, 2900Hz 25ms} 10 times, 500ms OFF, {2600Hz 25ms, 2900Hz 25ms} 20 times, 500ms OFF, {2600Hz 25ms, 2900Hz 25ms} 10 times, 3000ms OFF, REPEAT
+
+ {1300, 0, 0, 25, 0, 0,
+ 1450, 0, 0, 25, 9, 0,
+ 0, 0, 0, 500, 0, 0,
+ 1300, 0, 0, 25, 0, 0,
+ 1450, 0, 0, 25, 19, 3,
+ 0, 0, 0, 500, 0, 0,
+ 1300, 0, 0, 25, 0, 0,
+ 1450, 0, 0, 25, 9, 6,
+ 0, 0, 0, 3000, 0, 0,
+ -1, -1, -1, -1, 0, 0}, //CDMA LOW SLS tone: {1300Hz 25ms, 1450Hz 25ms} 10 times, 500ms OFF, {1300Hz 25ms, 1450Hz 25ms} 20 times, 500ms OFF, {1300Hz 25ms, 1450Hz 25ms} 10 times, 3000ms OFF, REPEAT//
+
+ {3700, 0, 0, 25, 0, 0,
+ 4000, 0, 0, 25, 9, 0,
+ 0, 0, 0, 500, 0, 0,
+ 3700, 0, 0, 25, 0, 0,
+ 4000, 0, 0, 25, 9, 3,
+ 0, 0, 0, 500, 0, 0,
+ 3700, 0, 0, 25, 0, 0,
+ 4000, 0, 0, 25, 9, 6,
+ 0, 0, 0, 2500, 0, 0,
+ -1, -1, -1, -1, 0, 0}, ////CDMA HIGH S X4 tone: {3700Hz 25ms, 4000Hz 25ms} 10 times, 500ms OFF, {3700Hz 25ms, 4000Hz 25ms} 10 times, 500ms OFF, {3700Hz 25ms, 4000Hz 25ms} 10 times, 500ms OFF, {3700Hz 25ms, 4000Hz 25ms} 10 times, 2500ms OFF, REPEAT....
+
+ {2600, 0, 0, 25, 0, 0,
+ 2900, 0, 0, 25, 9, 0,
+ 0, 0, 0, 500, 0, 0,
+ 2600, 0, 0, 25, 0, 0,
+ 2900, 0, 0, 25, 9, 4,
+ 0, 0, 0, 500, 0, 0,
+ 2600, 0, 0, 25, 0, 0,
+ 2900, 0, 0, 25, 9, 6,
+ 0, 0, 0, 2500, 0, 0,
+ -1, -1, -1, -1, 0, 0 },//CDMA MED S X4 tone: {2600Hz 25ms, 2900Hz 25ms} 10 times, 500ms OFF, {2600Hz 25ms, 2900Hz 25ms} 10 times, 500ms OFF, {2600Hz 25ms, 2900Hz 25ms} 10 times, 500ms OFF, {2600Hz 25ms, 2900Hz 25ms} 10 times, 2500ms OFF, REPEAT....
+
+ {1300, 0, 0, 25, 0, 0,
+ 1450, 0, 0, 25, 9, 0,
+ 0, 0, 0, 500, 0, 0,
+ 1300, 0, 0, 25, 0, 0,
+ 1450, 0, 0, 25, 9, 3,
+ 0, 0, 0, 500, 0, 0,
+ 1300, 0, 0, 25, 0, 0,
+ 1450, 0, 0, 25, 9, 6,
+ 0, 0, 0, 2500, 0, 0,
+ -1, -1, -1, -1, 0, 0}, //CDMA LOW S X4 tone: {2600Hz 25ms, 2900Hz 25ms} 10 times, 500ms OFF, {2600Hz 25ms, 2900Hz 25ms} 10 times, 500ms OFF, {2600Hz 25ms, 2900Hz 25ms} 10 times, 500ms OFF, {2600Hz 25ms, 2900Hz 25ms} 10 times, 2500ms OFF, REPEAT....
+
+ {3700, 0, 0, 25, 0, 0,
+ 4000, 0, 0, 25, 19, 0,
+ 0, 0, 0, 2000, 0, 0,
+ -1, -1, -1, -1, 0, 0 },//CDMA HIGH PBX L: {3700Hz 25ms, 4000Hz 25ms}20 times, 2000ms OFF, REPEAT....
+
+ {2600, 0, 0, 25, 0, 0,
+ 2900, 0, 0, 25, 19, 0,
+ 0, 0, 0, 2000, 0, 0,
+ -1, -1, -1, -1, 0, 0}, //CDMA MED PBX L: {2600Hz 25ms, 2900Hz 25ms}20 times, 2000ms OFF, REPEAT....
+
+ {1300, 0, 0, 25, 0, 0,
+ 1450, 0, 0, 25, 19, 0,
+ 0, 0, 0, 2000, 0, 0,
+ -1, -1, -1, -1, 0, 0 },//CDMA LOW PBX L: {1300Hz 25ms,1450Hz 25ms}20 times, 2000ms OFF, REPEAT....
+
+ {3700, 0, 0, 25, 0, 0,
+ 4000, 0, 0, 25, 7, 0,
+ 0, 0, 0, 200, 0, 0,
+ 3700, 0, 0, 25, 0, 0,
+ 4000, 0, 0, 25, 7, 3,
+ 0, 0, 0, 2000, 0, 0,
+ -1, -1, -1, -1, 0, 0}, //CDMA HIGH PBX SS tone: {3700Hz 25ms, 4000Hz 25ms} 8 times 200 ms OFF, {3700Hz 25ms 4000Hz 25ms}8 times, 2000ms OFF, REPEAT....
+
+ {2600, 0, 0, 25, 0, 0,
+ 2900, 0, 0, 25, 7, 0,
+ 0, 0, 0, 200, 0, 0,
+ 2600, 0, 0, 25, 0, 0,
+ 2900, 0, 0, 25, 7, 3,
+ 0, 0, 0, 2000, 0, 0,
+ -1, -1, -1, -1, 0, 0 }, //CDMA MED PBX SS tone: {2600Hz 25ms, 2900Hz 25ms} 8 times 200 ms OFF, {2600Hz 25ms 2900Hz 25ms}8 times, 2000ms OFF, REPEAT....
+
+ {1300, 0, 0, 25, 0, 0,
+ 1450, 0, 0, 25, 7, 0,
+ 0, 0, 0, 200, 0, 0,
+ 1300, 0, 0, 25, 0, 0,
+ 1450, 0, 0, 25, 7, 3,
+ 0, 0, 0, 2000, 0, 0,
+ -1, -1, -1, -1, 0, 0 },//CDMA LOW PBX SS tone: {1300Hz 25ms, 1450Hz 25ms} 8 times 200 ms OFF, {1300Hz 25ms 1450Hz 25ms}8 times, 2000ms OFF, REPEAT....
+
+ {3700, 0, 0, 25, 0, 0,
+ 4000, 0, 0, 25, 7, 0,
+ 0, 0, 0, 200, 0, 0,
+ 3700, 0, 0, 25, 0, 0,
+ 4000, 0, 0, 25, 7, 3,
+ 0, 0, 0, 200, 0, 0,
+ 3700, 0, 0, 25, 0, 0,
+ 4000, 0, 0, 25, 15, 6,
+ 0, 0, 0, 1000, 0, 0,
+ -1, -1, -1, -1, 0, 0}, //CDMA HIGH PBX SSL tone:{3700Hz 25ms, 4000Hz 25ms} 8 times 200ms OFF, {3700Hz 25ms, 4000Hz 25ms} 8 times, 200ms OFF, {3700Hz 25ms, 4000Hz 25ms} 16 times, 1000ms OFF, REPEAT....//
+
+ {2600, 0, 0, 25, 0, 0,
+ 2900, 0, 0, 25, 7, 0,
+ 0, 0, 0, 200, 0, 0,
+ 2600, 0, 0, 25, 0, 0,
+ 2900, 0, 0, 25, 7, 3,
+ 0, 0, 0, 200, 0, 0,
+ 2600, 0, 0, 25, 0, 0,
+ 2900, 0, 0, 25, 15, 6,
+ 0, 0, 0, 1000, 0, 0,
+ -1, -1, -1, -1, 0, 0}, //CDMA MED PBX SSL tone:{2600Hz 25ms, 2900Hz 25ms} 8 times 200ms OFF, {2600Hz 25ms, 2900Hz 25ms} 8 times, 200ms OFF, {2600Hz 25ms, 2900Hz 25ms} 16 times, 1000ms OFF, REPEAT....//
+
+ {1300, 0, 0, 25, 0, 0,
+ 1450, 0, 0, 25, 7, 0,
+ 0, 0, 0, 200, 0, 0,
+ 1300, 0, 0, 25, 0, 0,
+ 1450, 0, 0, 25, 7, 3,
+ 0, 0, 0, 200, 0, 0,
+ 1300, 0, 0, 25, 0, 0,
+ 1450, 0, 0, 25, 15, 6,
+ 0, 0, 0, 1000, 0, 0,
+ -1, -1, -1, -1, 0, 0}, //CDMA LOW PBX SSL tone:{1300Hz 25ms, 1450Hz 25ms} 8 times 200ms OFF, {1300Hz 25ms, 1450Hz 25ms} 8 times, 200ms OFF, {1300Hz 25ms, 1450Hz 25ms} 16 times, 1000ms OFF, REPEAT....//
+
+ {3700, 0, 0, 25, 0, 0,
+ 4000, 0, 0, 25, 15, 0,
+ 0, 0, 0, 200, 0, 0,
+ 3700, 0, 0, 25, 0, 0,
+ 4000, 0, 0, 25, 7, 3,
+ 0, 0, 0, 1000, 0, 0,
+ -1, -1, -1, -1, 0, 0 },//CDMA HIGH PBX SLS tone:{3700Hz 25ms, 4000Hz 25ms} 8 times 200ms OFF, {3700Hz 25ms, 4000Hz 25ms} 16 times, 200ms OFF, {3700Hz 25ms, 4000Hz 25ms} 8 times, 1000ms OFF, REPEAT.... //
+
+ {2600, 0, 0, 25, 0, 0,
+ 2900, 0, 0, 25, 15, 0,
+ 0, 0, 0, 200, 0, 0,
+ 2600, 0, 0, 25, 0, 0,
+ 2900, 0, 0, 25, 7, 3,
+ 0, 0, 0, 1000,0, 0,
+ -1, -1, -1, -1, 0, 0 }, //CDMA HIGH PBX SLS tone:{2600Hz 25ms, 2900Hz 25ms} 8 times 200ms OFF, {2600Hz 25ms, 2900Hz 25ms} 16 times, 200ms OFF, {2600Hz 25ms, 2900Hz 25ms} 8 times, 1000ms OFF, REPEAT....//
+
+ {1300, 0, 0, 25, 0, 0,
+ 1450, 0, 0, 25, 15, 0,
+ 0, 0, 0, 200, 0, 0,
+ 1300, 0, 0, 25, 0, 0,
+ 1450, 0, 0, 25, 7, 3,
+ 0, 0, 0, 1000, 0, 0,
+ -1, -1, -1, -1, 0, 0 }, //CDMA HIGH PBX SLS tone:{1300Hz 25ms, 1450Hz 25ms} 8 times 200ms OFF, {1300Hz 25ms, 1450Hz 25ms} 16 times, 200ms OFF, {1300Hz 25ms, 1450Hz 25ms} 8 times, 1000ms OFF, REPEAT....//
+
+ {3700, 0, 0, 25, 0, 0,
+ 4000, 0, 0, 25, 7, 0,
+ 0, 0, 0, 200, 0, 0,
+ 3700, 0, 0, 25, 0, 0,
+ 4000, 0, 0, 25, 7, 3,
+ 0, 0, 0, 200, 0, 0,
+ 3700, 0, 0, 25, 0, 0,
+ 4000, 0, 0, 25, 7, 6,
+ 0, 0, 0, 200, 0, 0,
+ 3700, 0, 0, 25, 0, 0,
+ 4000, 0, 0, 25, 7, 9,
+ 0, 0, 0, 800, 0, 0,
+ -1, -1, -1, -1, 0, 0}, //CDMA HIGH PBX X S4 tone: {3700Hz 25ms 4000Hz 25ms} 8 times, 200ms OFF, {3700Hz 25ms 4000Hz 25ms} 8 times, 200ms OFF, {3700Hz 25ms 4000Hz 25ms} 8 times, 200ms OFF, {3700Hz 25ms 4000Hz 25ms} 8 times, 800ms OFF, REPEAT...
+
+ {2600, 0, 0, 25, 0, 0,
+ 2900, 0, 0, 25, 7, 0,
+ 0, 0, 0, 200, 0, 0,
+ 2600, 0, 0, 25, 0, 0,
+ 2900, 0, 0, 25, 7, 3,
+ 0, 0, 0, 200, 0, 0,
+ 2600, 0, 0, 25, 0, 0,
+ 2900, 0, 0, 25, 7, 6,
+ 0, 0, 0, 200, 0, 0,
+ 2600, 0, 0, 25, 0, 0,
+ 2900, 0, 0, 25, 7, 9,
+ 0, 0, 0, 800, 0, 0,
+ -1, -1, -1, -1, 0, 0}, //CDMA MED PBX X S4 tone: {2600Hz 25ms 2900Hz 25ms} 8 times, 200ms OFF, {2600Hz 25ms 2900Hz 25ms} 8 times, 200ms OFF, {2600Hz 25ms 2900Hz 25ms} 8 times, 200ms OFF, {2600Hz 25ms 2900Hz 25ms} 8 times, 800ms OFF, REPEAT...
+
+ {1300, 0, 0, 25, 0, 0,
+ 1450, 0, 0, 25, 7, 0,
+ 0, 0, 0, 200, 0, 0,
+ 1300, 0, 0, 25, 0, 0,
+ 1450, 0, 0, 25, 7, 3,
+ 0, 0, 0, 200, 0, 0,
+ 1300, 0, 0, 25, 0, 0,
+ 1450, 0, 0, 25, 7, 6,
+ 0, 0, 0, 200, 0, 0,
+ 1300, 0, 0, 25, 0, 0,
+ 1450, 0, 0, 25, 7, 9,
+ 0, 0, 0, 800, 0, 0,
+ -1, -1, -1, -1, 0, 0}, //CDMA LOW PBX X S4 tone: {1300Hz 25ms 1450Hz 25ms} 8 times, 200ms OFF, {1300Hz 25ms 1450Hz 25ms} 8 times, 200ms OFF, {1300Hz 25ms 1450Hz 25ms} 8 times, 200ms OFF, {1300Hz 25ms 1450Hz 25ms} 8 times, 800ms OFF, REPEAT...
+
+ {1109, 0, 0, 62, 0, 0,
+ 784, 0, 0, 62, 0, 0,
+ 740, 0, 0, 62, 0, 0,
+ 622, 0, 0, 62, 0, 0,
+ 1109, 0, 0, 62, 0, 0,
+ -1, -1, -1, -1, 0, 0}, //CDMA Alert Network Lite tone: 1109Hz 62ms ON, 784Hz 62ms ON, 740Hz 62ms ON 622Hz 62ms ON, 1109Hz 62ms ON
+
+ {1245, 0, 0, 62, 0, 0,
+ 659, 0, 0, 62, 0, 0,
+ 1245, 0, 0, 62, 0, 0,
+ 659, 0, 0, 62, 0, 0,
+ 1245, 0, 0, 62, 0, 0,
+ 659, 0, 0, 62, 0, 0,
+ 1245, 0, 0, 62, 0, 0,
+ -1, -1, -1, -1, 0, 0},//CDMA Alert Auto Redial tone: {1245Hz 62ms ON, 659Hz 62ms ON} 3 times, 1245 62ms ON//
+
+ {1150, 770, 0, 400, 0, 0,
+ -1, -1, -1, -1, 0, 0}, //CDMA One Min Beep tone: 1150Hz+770Hz 400ms ON//
+
+ {941, 1477, 0, 120, 0, 0,
+ -1, -1, -1, -1, 0, 0}, //CDMA KEYPAD Volume key lite tone: 941Hz+1477Hz 120ms ON
+
+ {587, 0, 0, 375, 0, 0,
+ 1175, 0, 0, 125, 0, 0,
+ -1, -1, -1, -1, 0, 0}, //CDMA PRESSHOLDKEY LITE tone: 587Hz 375ms ON, 1175Hz 125ms ON
+
+ {587, 0, 0, 62, 0, 0,
+ 784, 0, 0, 62, 0, 0,
+ 831, 0, 0, 62, 0, 0,
+ 784, 0, 0, 62, 0, 0,
+ 1109, 0, 0, 62, 0, 0,
+ 784, 0, 0, 62, 0, 0,
+ 831, 0, 0, 62, 0, 0,
+ 784, 0, 0, 62, 0, 0,
+ -1, -1, -1, -1, 0, 0}, //CDMA ALERT INCALL LITE tone: 587Hz 62ms, 784 62ms, 831Hz 62ms, 784Hz 62ms, 1109 62ms, 784Hz 62ms, 831Hz 62ms, 784Hz 62ms
+
+ {941, 0, 0, 125, 0, 0,
+ 0, 0, 0, 10, 0, 0,
+ 941, 0, 0, 125, 0, 0,
+ 0, 0, 0, 10, 0, 0,
+ 1245, 0, 0, 62, 0, 0,
+ 0, 0, 0, 10, 0, 0,
+ 0, 0, 0, 4990, 0, 0,
+ -1, -1, -1, -1, 0, 0}, //CDMA EMERGENCY RINGBACK tone: {941Hz 125ms ON, 10ms OFF} 3times 4990ms OFF, REPEAT...
+
+ {1319, 0, 0, 125, 0, 0,
+ 0, 0, 0, 125, 0, 0,
+ -1, -1, -1, -1, 3, 0 }, //CDMA ALERT CALL GUARD tone: {1319Hz 125ms ON, 125ms OFF} 3 times
+
+ {1047, 0, 0, 125, 0, 0,
+ 370, 0, 0, 125, 0, 0,
+ -1, -1, -1, -1, 0, 0}, //CDMA SOFT ERROR LITE tone: 1047Hz 125ms ON, 370Hz 125ms
+
+ {1480, 0, 0, 125, 0, 0,
+ 1397, 0, 0, 125, 0, 0,
+ 784, 0, 0, 125, 0, 0,
+ -1, -1, -1, -1, 0, 0}, //CDMA CALLDROP LITE tone: 1480Hz 125ms, 1397Hz 125ms, 784Hz 125ms//
+
+ {425, 0, 0, 125, 0, 0,
+ 0, 0, 0, 125, 0, 0,
+ -1, -1, -1, -1, 0, 0},//CDMA_NETWORK_BUSY_ONE_SHOT tone: 425Hz 500ms ON, 500ms OFF.
+
+ {1150, 770, 0, 400, 0, 0,
+ -1, -1, -1, -1, 0, 0}, //CDMA_ABBR_ALERT tone: 1150Hz+770Hz 400ms ON
+
+ {0, 0, 0, -1, 0, 0,
+ -1, -1, -1, -1, 0, 0}, //CDMA_SIGNAL_OFF - silent tone
+ };
+
+static tone_control_t g_control;
+static int (*g_thread_pool_func)(void*, void (*)(void*)) = NULL;
+
+static int _MMSoundToneInit(void);
+static int _MMSoundToneFini(void);
+static void _running_tone(void *param);
+
+
+
+int* MMSoundPlugCodecToneGetSupportTypes(void)
+{
+ debug_enter("\n");
+ static int suported[2] = {MM_SOUND_SUPPORTED_CODEC_DTMF, 0};
+ debug_leave("\n");
+ return suported;
+}
+
+int MMSoundPlugCodecToneParse(MMSourceType *source, mmsound_codec_info_t *info)
+{
+ debug_enter("\n");
+ // do nothing
+ debug_leave("\n");
+ return MM_ERROR_NONE;
+}
+
+int MMSoundPlugCodecToneCreate(mmsound_codec_param_t *param, mmsound_codec_info_t *info, MMHandleType *handle)
+{
+ avsys_audio_param_t audio_param;
+ tone_info_t *toneInfo;
+
+ int result = AVSYS_STATE_SUCCESS;
+
+ debug_enter("\n");
+
+ toneInfo = (tone_info_t *)malloc(sizeof(tone_info_t));
+ if (toneInfo == NULL) {
+ debug_error("memory allocation error\n");
+ return MM_ERROR_OUT_OF_MEMORY;
+ }
+
+ memset(toneInfo, 0, sizeof(tone_info_t));
+
+ toneInfo->state = STATE_READY;
+
+ /* set audio param */
+ memset (&audio_param, 0, sizeof(avsys_audio_param_t));
+
+ /* Set sound player parameter */
+ audio_param.samplerate = SAMPLERATE;
+ audio_param.channels = CHANNELS;
+ audio_param.format = AVSYS_AUDIO_FORMAT_16BIT;
+ audio_param.mode = AVSYS_AUDIO_MODE_OUTPUT;
+ audio_param.vol_type = param->volume_config;
+ audio_param.priority = AVSYS_AUDIO_PRIORITY_0;
+
+ result = avsys_audio_open(&audio_param, &toneInfo->audio_handle, &toneInfo->size);
+ if (AVSYS_FAIL(result)) {
+ debug_error("Device Open Error 0x%x\n", result);
+ goto Error;
+ }
+ debug_log("Create audio_handle is %d\n", toneInfo->audio_handle);
+
+ debug_msg("tone : %d\n", param->tone);
+ debug_msg("repeat : %d\n", param->repeat_count);
+ debug_msg("volume config : %x\n", param->volume_config);
+ debug_msg("callback : %p\n", param->stop_cb);
+ debug_msg("pid : %d\n", param->pid);
+
+ toneInfo->number = param->tone;
+ toneInfo->time = param->repeat_count;
+ toneInfo->stop_cb = param->stop_cb;
+ toneInfo->cb_param = param->param;
+ toneInfo->pid = param->pid;
+ toneInfo->volume = param->volume;
+
+ result = g_thread_pool_func(toneInfo, _running_tone);
+ if (result != 0) {
+ debug_error("pthread_create() fail in pcm thread\n");
+ result = MM_ERROR_SOUND_INTERNAL;
+ goto Error;
+ }
+
+ *handle = (MMHandleType)toneInfo;
+
+ debug_leave("\n");
+ return MM_ERROR_NONE;
+
+Error:
+ if(toneInfo) {
+ if(toneInfo->audio_handle)
+ avsys_audio_close(toneInfo->audio_handle);
+
+ free(toneInfo);
+ }
+
+ return result;
+
+}
+
+int MMSoundPlugCodecToneDestroy(MMHandleType handle)
+{
+ tone_info_t *toneInfo = (tone_info_t*) handle;
+ int err = MM_ERROR_NONE;
+ if (!toneInfo) {
+ debug_critical("Confirm the hadle (is NULL)\n");
+ return MM_ERROR_SOUND_INTERNAL;
+ }
+
+ debug_enter("(handle %x)\n", handle);
+
+ if (toneInfo)
+ free (toneInfo);
+
+ debug_leave("\n");
+ return err;
+}
+
+static
+int MMSoundPlugCodecTonePlay(MMHandleType handle)
+{
+ tone_info_t *toneInfo = (tone_info_t *) handle;
+
+ debug_enter("(handle %x)\n", handle);
+
+ toneInfo->state = STATE_BEGIN;
+ debug_msg("sent start signal\n");
+
+ debug_leave("\n");
+
+ return MM_ERROR_NONE;
+}
+
+static char*
+_create_tone (double *sample, TONE _TONE, double volume, int *toneSize)
+{
+ short *pbuf;
+ double i = 0;
+ double amplitude, f1, f2, f3;
+ int quota= 0;
+ float low_frequency = _TONE.low_frequency;
+ float middle_frequency = _TONE.middle_frequency;
+ float high_frequency = _TONE.high_frequency;
+ int sample_size = 0;
+
+ if(sample == NULL) {
+ debug_error("Sample buffer is not allocated\n");
+ return NULL;
+ }
+
+ /* Create a buffer for the tone */
+ if((_TONE.playingTime > MAX_DURATION) || (_TONE.playingTime == -1) ) {
+ *toneSize = ((MAX_DURATION / 1000.) * SAMPLERATE * SAMPLE_SIZE * CHANNELS) / 8;
+ } else {
+ *toneSize = ((_TONE.playingTime / 1000.) * SAMPLERATE * SAMPLE_SIZE * CHANNELS) / 8;
+ }
+ *toneSize = ((*toneSize+1)>>1)<<1;
+ sample_size = (*toneSize) / (SAMPLE_SIZE / 8);
+
+ debug_log("_TONE.playing_time: %d toneSize: %d\n", _TONE.playingTime, *toneSize);
+ char* buffer = g_malloc (*toneSize);
+
+ if(buffer == NULL) {
+ debug_error("Buffer is not allocated\n");
+ return NULL;
+ } else {
+ pbuf = (short*)buffer;
+
+ if(_TONE.low_frequency > 0) {
+ quota++;
+ }
+ if(_TONE.middle_frequency > 0) {
+ quota++;
+ }
+ if(_TONE.high_frequency > 0) {
+ quota++;
+ }
+
+ for (i = 0; i < sample_size; i++) {
+ /*
+ * We add the fundamental frequencies together.
+ */
+
+ f1 = sin (2 * M_PI * low_frequency * ((*sample) / SAMPLERATE));
+ f2 = sin (2 * M_PI * middle_frequency * ((*sample) / SAMPLERATE));
+ f3 = sin (2 * M_PI * high_frequency * ((*sample) / SAMPLERATE));
+
+ if(f1 + f2 + f3 != 0) {
+ amplitude = (f1 + f2 + f3) / quota;
+ /* Adjust the volume */
+ amplitude *= volume;
+
+ /* Make the [-1:1] interval into a [-32767:32767] interval */
+ amplitude *= 32767;
+ } else {
+ amplitude = 0;
+ }
+
+ /* Store it in the data buffer */
+ *(pbuf++) = (short) amplitude;
+
+ (*sample)++;
+ }
+ }
+ return buffer;
+}
+
+static TONE
+_mm_get_tone(int key, int CurIndex)
+{
+ TONE _TONE;
+
+ _TONE.low_frequency = TONE_SEGMENT[key][CurIndex * TONE_COLUMN + LOW_FREQUENCY];
+ _TONE.middle_frequency = TONE_SEGMENT[key][CurIndex * TONE_COLUMN + MIDDLE_FREQUENCY];
+ _TONE.high_frequency = TONE_SEGMENT[key][CurIndex * TONE_COLUMN + HIGH_FREQUENCY];
+ _TONE.playingTime = TONE_SEGMENT[key][CurIndex * TONE_COLUMN + PLAYING_TIME];
+ _TONE.loopCnt = TONE_SEGMENT[key][CurIndex * TONE_COLUMN + LOOP_COUNT];
+ _TONE.loopIndx = TONE_SEGMENT[key][CurIndex * TONE_COLUMN + LOOP_INDEX];
+
+ return _TONE;
+}
+
+static int
+_mm_get_waveCnt_PlayingTime(int toneTime, TONE _TONE, int *waveCnt, int *waveRestPlayTime)
+{
+ int ret = MM_ERROR_NONE;
+ if(waveCnt == NULL || waveRestPlayTime == NULL) {
+ debug_error("waveCnt || waveRestPlayTime buffer is NULL\n");
+ return MM_ERROR_SOUND_INTERNAL;
+ }
+ /*Set wave count and wave playing time*/
+ if( _TONE.playingTime == -1) {
+ *waveCnt = abs(toneTime) /MAX_DURATION;
+ *waveRestPlayTime = abs(toneTime) % MAX_DURATION;
+ } else {
+ *waveCnt = _TONE.playingTime /MAX_DURATION;
+ *waveRestPlayTime = _TONE.playingTime % MAX_DURATION;
+ }
+ return ret;
+}
+
+static int
+_mm_get_CurIndex(TONE _TONE, int *CurArrayPlayCnt, int *CurIndex)
+{
+ int ret = MM_ERROR_NONE;
+ if(CurArrayPlayCnt == NULL || CurIndex == NULL) {
+ debug_error("CurArrayPlayCnt || CurIndex buffer is NULL\n");
+ return MM_ERROR_SOUND_INTERNAL;
+ }
+
+ if(_TONE.loopCnt != 0 && *CurArrayPlayCnt <= _TONE.loopCnt) {
+ (*CurArrayPlayCnt)++;
+ if(*CurArrayPlayCnt >_TONE.loopCnt) {
+ (*CurIndex)++;
+ *CurArrayPlayCnt = 0;
+ } else {
+ *CurIndex = _TONE.loopIndx;
+ }
+ } else {
+ (*CurIndex)++;
+ }
+ debug_log("CurIndex: %d, CurArrayPlayCnt :%d", *CurIndex, *CurArrayPlayCnt);
+ return ret;
+}
+
+static void _running_tone(void *param)
+{
+ int result = AVSYS_STATE_SUCCESS;
+ char *ptoneBuf = NULL;
+ char filename[100];
+
+ if(param == NULL) {
+ debug_error("param Buffer is not allocated\n");
+ return;
+ }
+ tone_info_t *toneInfo = (tone_info_t*) param;
+ int toneKey = 0;
+ int toneTime =0;
+ int prePlayingTime = 0;
+ int duration = 0;
+ int playingTime = 0;
+ int toneSize = 0;
+ int CurWaveIndex = 0;
+ int numWave = 0;
+ int waveRestPlayTime = 0;
+ int CurIndex = 0;
+ int CurArrayPlayCnt = 0;
+
+ debug_enter("\n");
+ double sample = 0;
+ toneTime = toneInfo->time;
+ if(toneTime != 0) {
+ toneKey = toneInfo->number;
+ debug_msg ("toneKey number = %d\n", toneKey);
+
+ /* Set pid check file */
+ snprintf(filename, sizeof(filename), "/proc/%d/cmdline", toneInfo->pid);
+
+ debug_msg("Wait start signal\n");
+ while(toneInfo->state == STATE_READY)
+ usleep(10);
+ debug_msg("Recv start signal\n");
+ toneInfo->state = STATE_PLAY;
+ } else {
+ return;
+ }
+
+ while (1) {
+ TONE _TONE = _mm_get_tone(toneKey, CurIndex); /*Pop one of Tone Set */
+ if(_mm_get_waveCnt_PlayingTime(toneTime, _TONE, &numWave, &waveRestPlayTime) != MM_ERROR_NONE) {
+ debug_error("_mm_get_waveCnt_PlayingTime return value error\n");
+ goto exit;
+ }
+ debug_log ("Predefined Tone[%d] Total Play time (ms) : %d, _TONE.playing_time: %d _numWave = %d low_frequency: %0.f, middle_frequency: %0.f, high_frequency: %0.f\n",
+ CurIndex, toneTime, _TONE.playingTime, numWave, _TONE.low_frequency, _TONE.middle_frequency, _TONE.high_frequency);
+
+ if (_TONE.low_frequency == -1) { /* skip frequency which's value is -1*/
+ CurIndex = _TONE.loopIndx;
+ continue;
+ }
+
+ /* Write pcm data */
+
+ for(CurWaveIndex = 0; CurWaveIndex < numWave+1; CurWaveIndex++) {
+ if(CurWaveIndex == numWave ) { /* play the last tone set*/
+ playingTime = waveRestPlayTime;
+ } else {
+ playingTime = MAX_DURATION;
+ }
+ duration = playingTime;
+
+ if(playingTime == 0) {
+ break;
+ }
+
+ if(prePlayingTime + playingTime > toneTime && toneTime != -1) {
+ playingTime = toneTime - prePlayingTime;
+ }
+
+ ptoneBuf = _create_tone (&sample, _TONE, toneInfo->volume, &toneSize);
+ if(ptoneBuf == NULL) {
+ debug_error("Tone Buffer is not allocated\n");
+ goto exit;
+ }
+ debug_log ("[TONE] Play.....%dth %dms\n", CurWaveIndex, playingTime);
+ avsys_audio_write(toneInfo->audio_handle, ptoneBuf, ((toneSize * playingTime /duration + 1)>>1)<<1);
+ prePlayingTime += playingTime;
+ debug_log ("previous_sum: %d\n", prePlayingTime);
+ g_free (ptoneBuf);
+ ptoneBuf = NULL;
+
+ if(prePlayingTime == toneTime || toneInfo->state != STATE_PLAY) {
+ debug_log ("Finished.....on Total Playing Time : %d _TONE.playing_time: %d\n", prePlayingTime, _TONE.playingTime);
+ avsys_audio_drain(toneInfo->audio_handle);
+ debug_log ("Finished.....quit loop\n");
+ goto exit;
+ }
+ }
+ if(_mm_get_CurIndex(_TONE, &CurArrayPlayCnt, &CurIndex) != MM_ERROR_NONE) {
+ debug_error("_mm_get_CurIndex return value error\n");
+ goto exit;
+ }
+
+ debug_log ("CurIndex: %d previous_sum: %d CurArrayPlayCnt: %d\n", CurIndex, prePlayingTime, CurArrayPlayCnt);
+ }
+
+exit :
+ result = avsys_audio_close(toneInfo->audio_handle);
+ if(AVSYS_FAIL(result)) {
+ debug_error("Device Close Error 0x%x\n", result);
+ }
+
+ pthread_mutex_destroy(&g_control.syncker);
+
+ debug_msg("Play end\n");
+ toneInfo->state = STATE_STOP;
+
+ if (toneInfo->stop_cb)
+ toneInfo->stop_cb(toneInfo->cb_param);
+
+ debug_leave("\n");
+}
+
+static
+int MMSoundPlugCodecToneStop(MMHandleType handle)
+{
+ tone_info_t *toneInfo = (tone_info_t*) handle;
+
+ debug_enter("(handle %x)\n", handle);
+ toneInfo->state = STATE_STOP;
+ debug_msg("sent stop signal\n");
+ debug_leave("\n");
+
+ return MM_ERROR_NONE;
+}
+
+static
+int MMSoundPlugCodecToneSetThreadPool(int (*func)(void*, void (*)(void*)))
+{
+ debug_enter("(func : 0x%x)\n", func);
+ g_thread_pool_func = func;
+ debug_leave("\n");
+ return MM_ERROR_NONE;
+}
+
+static int _MMSoundToneInit(void)
+{
+ memset(&g_control, 0, sizeof(tone_control_t));
+ pthread_mutex_init(&g_control.syncker, NULL);
+ return MM_ERROR_NONE;
+}
+
+static int _MMSoundToneFini(void)
+{
+ pthread_mutex_destroy(&g_control.syncker);
+ return MM_ERROR_NONE;
+}
+
+EXPORT_API
+int MMSoundGetPluginType(void)
+{
+ debug_enter("\n");
+ debug_leave("\n");
+ return MM_SOUND_PLUGIN_TYPE_CODEC;
+}
+
+EXPORT_API
+int MMSoundPlugCodecGetInterface(mmsound_codec_interface_t *intf)
+{
+ debug_enter("\n");
+
+ intf->GetSupportTypes = MMSoundPlugCodecToneGetSupportTypes;
+ intf->Parse = MMSoundPlugCodecToneParse;
+ intf->Create = MMSoundPlugCodecToneCreate;
+ intf->Destroy = MMSoundPlugCodecToneDestroy;
+ intf->Play = MMSoundPlugCodecTonePlay;
+ intf->Stop = MMSoundPlugCodecToneStop;
+ intf->SetThreadPool = MMSoundPlugCodecToneSetThreadPool;
+
+ debug_leave("\n");
+
+ return MM_ERROR_NONE;
+}
+
--- /dev/null
+lib_LTLIBRARIES = libsoundpluginwave.la
+
+libsoundpluginwave_la_SOURCES = mm_sound_plugin_codec_wave.c
+
+libsoundpluginwave_la_CFLAGS = \
+ $(MMCOMMON_CFLAGS) \
+ -I$(srcdir)/../../../include \
+ -I$(srcdir)/../../include \
+ $(MMLOGSVR_CFLAGS) -DMMF_LOG_OWNER=0x020 -DMMF_DEBUG_PREFIX=\"MMF-SOUND\"
+
+libsoundpluginwave_la_LIBADD = $(MMCOMMON_LIBS) \
+ $(MMLOGSVR_LIBS) \
+ $(srcdir)/../../../common/libmmfsoundcommon.la
+
+libsoundpluginwave_la_CFLAGS += $(AVSYSTEM_CFLAGS)
+libsoundpluginwave_la_LIBADD += $(AVSYSTEM_LIBS)
+
+install-exec-hook:
+ mkdir -p $(DESTDIR)$(libdir)/soundplugins
+ ln -sf /usr/lib/libsoundpluginwave.so $(DESTDIR)$(libdir)/soundplugins/libsoundpluginwave.so
+
--- /dev/null
+/*
+ * 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 <stdlib.h>
+#include <string.h>
+
+#include <semaphore.h>
+#include <unistd.h>
+
+#include <mm_error.h>
+#include <mm_debug.h>
+#include <pthread.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"
+
+
+#define SAMPLE_COUNT 128
+enum {
+ WAVE_CODE_UNKNOWN = 0,
+ WAVE_CODE_PCM = 1,
+ WAVE_CODE_ADPCM = 2,
+ WAVE_CODE_G711 = 3,
+ WAVE_CODE_IMA_ADPCM = 17,
+ WAVE_CODE_G723_ADPCM = 20,
+ WAVE_CODE_GSM = 49,
+ WAVE_CODE_G721_ADPCM = 64,
+ WAVE_CODE_MPEG = 80,
+};
+
+#define MAKE_FOURCC(a, b, c, d) ((a) | (b) << 8) | ((c) << 16 | ((d) << 24))
+#define RIFF_CHUNK_ID ((unsigned long) MAKE_FOURCC('R', 'I', 'F', 'F'))
+#define RIFF_CHUNK_TYPE ((unsigned long) MAKE_FOURCC('W', 'A', 'V', 'E'))
+#define FMT_CHUNK_ID ((unsigned long) MAKE_FOURCC('f', 'm', 't', ' '))
+#define DATA_CHUNK_ID ((unsigned long) MAKE_FOURCC('d', 'a', 't', 'a'))
+
+enum {
+ STATE_NONE = 0,
+ STATE_READY,
+ STATE_BEGIN,
+ STATE_PLAY,
+ STATE_STOP,
+};
+
+typedef struct
+{
+ char *ptr_current;
+ int size;
+ int transper_size;
+ avsys_handle_t audio_handle;
+ int period;
+ int tone;
+ int keytone;
+ int repeat_count;
+ int (*stop_cb)(int);
+ int cb_param;
+ int state;
+ pthread_mutex_t mutex;
+ MMSourceType *source;
+ char buffer[48000 / 1000 * SAMPLE_COUNT * 2 *2];//segmentation fault when above 22.05KHz stereo
+ int handle_route;
+} wave_info_t;
+
+static void _runing(void *param);
+
+static int (*g_thread_pool_func)(void*, void (*)(void*)) = NULL;
+
+int MMSoundPlugCodecWaveSetThreadPool(int (*func)(void*, void (*)(void*)))
+{
+ debug_enter("(func : %p)\n", func);
+ g_thread_pool_func = func;
+ debug_leave("\n");
+ return MM_ERROR_NONE;
+}
+
+int* MMSoundPlugCodecWaveGetSupportTypes(void)
+{
+ debug_enter("\n");
+ static int suported[2] = {MM_SOUND_SUPPORTED_CODEC_WAVE, 0};
+ debug_leave("\n");
+ return suported;
+}
+
+int MMSoundPlugCodecWaveParse(MMSourceType *source, mmsound_codec_info_t *info)
+{
+ struct __riff_chunk
+ {
+ long chunkid;
+ long chunksize;
+ long rifftype;
+ };
+
+ struct __wave_chunk
+ {
+ long chunkid;
+ long chunksize;
+ unsigned short compression;
+ unsigned short channels;
+ unsigned long samplerate;
+ unsigned long avgbytepersec;
+ unsigned short blockkalign;
+ unsigned short bitspersample;
+ };
+
+ struct __data_chunk
+ {
+ long chunkid;
+ long chunkSize;
+ };
+
+ struct __riff_chunk *priff = NULL;
+ struct __wave_chunk *pwav = NULL;
+ struct __data_chunk *pdata = NULL;
+// struct __fmt_chunk *pfmt = NULL;
+
+ int datalen = -1;
+ char *data = NULL;
+ unsigned int tSize;
+
+ debug_enter("\n");
+
+ data = MMSourceGetPtr(source);
+ debug_msg("[CODEC WAV] source ptr :[%p]\n", data);
+
+ datalen = MMSourceGetCurSize(source);
+ debug_msg("[CODEC WAV] source size :[0x%08X]\n", datalen);
+
+ priff = (struct __riff_chunk *) data;
+
+ /* Must be checked, Just for wav or not */
+ if (priff->chunkid != RIFF_CHUNK_ID ||priff->rifftype != RIFF_CHUNK_TYPE)
+ return MM_ERROR_SOUND_UNSUPPORTED_MEDIA_TYPE;
+
+ if(priff->chunksize != datalen -8)
+ priff->chunksize = (datalen-8);
+
+ if (priff->chunkid != RIFF_CHUNK_ID ||priff->chunksize != datalen -8 ||priff->rifftype != RIFF_CHUNK_TYPE) {
+ debug_msg("[CODEC WAV] This contents is not RIFF file\n");
+ debug_msg("[CODEC WAV] cunkid : %ld, chunksize : %ld, rifftype : 0x%lx\n", priff->chunkid, priff->chunksize, priff->rifftype);
+ //debug_msg("[CODEC WAV] cunkid : %ld, chunksize : %d, rifftype : 0x%lx\n", RIFF_CHUNK_ID, datalen-8, RIFF_CHUNK_TYPE);
+ return MM_ERROR_SOUND_UNSUPPORTED_MEDIA_TYPE;
+ }
+
+ debug_msg("[CODEC WAV] cunkid : %ld, chunksize : %ld, rifftype : 0x%lx\n", priff->chunkid, priff->chunksize, priff->rifftype);
+ //debug_msg("[CODEC WAV] cunkid : %ld, chunksize : %d, rifftype : 0x%lx\n", RIFF_CHUNK_ID, datalen-8, RIFF_CHUNK_TYPE);
+
+ tSize = sizeof(struct __riff_chunk);
+ pdata = (struct __data_chunk*)(data+tSize);
+
+ while (pdata->chunkid != FMT_CHUNK_ID && tSize < datalen) {
+ tSize += (pdata->chunkSize+8);
+
+ if (tSize >= datalen) {
+ debug_warning("[CODEC WAV] Parsing finished : unable to find the Wave Format chunk\n");
+ return MM_ERROR_SOUND_UNSUPPORTED_MEDIA_TYPE;
+ } else {
+ pdata = (struct __data_chunk*)(data+tSize);
+ }
+ }
+ pwav = (struct __wave_chunk*)(data+tSize);
+
+ if (pwav->chunkid != FMT_CHUNK_ID ||
+ pwav->compression != WAVE_CODE_PCM || /* Only supported PCM */
+ pwav->avgbytepersec != pwav->samplerate * pwav->blockkalign ||
+ pwav->blockkalign != (pwav->bitspersample >> 3)*pwav->channels) {
+ debug_msg("[CODEC WAV] This contents is not supported wave file\n");
+ debug_msg("[CODEC WAV] chunkid : 0x%lx, comp : 0x%x, av byte/sec : %lu, blockalign : %d\n", pwav->chunkid, pwav->compression, pwav->avgbytepersec, pwav->blockkalign);
+ return MM_ERROR_SOUND_UNSUPPORTED_MEDIA_TYPE;
+ }
+
+ /* Only One data chunk support */
+
+ tSize += (pwav->chunksize+8);
+ pdata = (struct __data_chunk *)(data+tSize);
+
+ while (pdata->chunkid != DATA_CHUNK_ID && tSize < datalen) {
+ tSize += (pdata->chunkSize+8);
+ if (tSize >= datalen) {
+ debug_warning("[CODEC WAV] Parsing finished : unable to find the data chunk\n");
+ return MM_ERROR_SOUND_UNSUPPORTED_MEDIA_TYPE;
+ } else {
+ pdata = (struct __data_chunk*)(data+tSize);
+ }
+ }
+
+ info->codec = MM_SOUND_SUPPORTED_CODEC_WAVE;
+ info->channels = pwav->channels;
+ info->format = pwav->bitspersample;
+ info->samplerate = pwav->samplerate;
+ info->doffset = (tSize+8);
+ info->size = pdata->chunkSize;
+ debug_msg("info->size:%d\n", info->size);
+
+ debug_leave("\n");
+ return MM_ERROR_NONE;
+}
+
+
+
+int MMSoundPlugCodecWaveCreate(mmsound_codec_param_t *param, mmsound_codec_info_t *info, MMHandleType *handle)
+{
+ int ret = MM_ERROR_NONE;
+ wave_info_t* p = NULL;
+
+ avsys_audio_param_t audio_param;
+
+ static avsys_handle_t keytone_handle = (avsys_handle_t)-1;
+ MMSourceType *source;
+
+ static int keytone_period = 0;
+
+ debug_enter("\n");
+ debug_msg("[CODEC WAV] Local keytone_period : %d\n", keytone_period);
+ debug_msg("[CODEC WAV] Local keytone_handle : %d\n", (int)keytone_handle);
+
+ debug_msg("[CODEC WAV] Type %s\n", info->codec == MM_SOUND_SUPPORTED_CODEC_WAVE ? "PCM Wave" : "Unknown");
+ debug_msg("[CODEC WAV] channels : %d\n", info->channels);
+ debug_msg("[CODEC WAV] format : %d\n", info->format);
+ debug_msg("[CODEC WAV] samplerate : %d\n", info->samplerate);
+ debug_msg("[CODEC WAV] doffset : %d\n", info->doffset);
+
+ debug_msg("[CODEC WAV] priority : %d\n", param->priority);
+ debug_msg("[CODEC WAV] repeat : %d\n", param->repeat_count);
+ debug_msg("[CODEC WAV] volume type : %d\n", param->volume);
+ debug_msg("[CODEC WAV] callback : %p\n", param->stop_cb);
+ debug_msg("[CODEC WAV] Keytonemode : %08x\n", param->keytone);
+ debug_msg("[CODEC WAV] handle route : %d\n", param->handle_route);
+
+ source = param->source;
+
+ if (g_thread_pool_func == NULL) {
+ debug_error("[CODEC WAV] Need thread pool!\n");
+ return MM_ERROR_SOUND_INTERNAL;
+ }
+
+ p = (wave_info_t *) malloc(sizeof(wave_info_t));
+
+ if (p == NULL) {
+ debug_error("[CODEC WAV] memory allocation failed\n");
+ return MM_ERROR_OUT_OF_MEMORY;
+ }
+
+ memset(p, 0, sizeof(wave_info_t));
+ p->audio_handle = (avsys_handle_t)-1;
+
+ p->ptr_current = MMSourceGetPtr(source) + info->doffset;
+
+ p->size = info->size;
+ p->transper_size = info->samplerate / 1000 * SAMPLE_COUNT * (info->format >> 3) * info->channels;
+
+ p->tone = param->tone;
+ p->repeat_count = param ->repeat_count;
+ p->stop_cb = param->stop_cb;
+ p->cb_param = param->param;
+ p->source = source;
+ // pthread_mutex_init(&p->mutex, NULL);
+
+ debug_msg("[CODEC WAV] transper_size : %d\n", p->transper_size);
+ debug_msg("[CODEC WAV] size : %d\n", p->size);
+
+
+ /* audio param setting */
+ memset (&audio_param, 0, sizeof(avsys_audio_param_t));
+ audio_param.mode = AVSYS_AUDIO_MODE_OUTPUT;
+ audio_param.priority = param->priority;
+ audio_param.vol_type = param->volume_config;
+ audio_param.channels = info->channels;
+ audio_param.samplerate = info->samplerate;
+ 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)
+ {
+ case 8:
+ audio_param.format = AVSYS_AUDIO_FORMAT_8BIT;
+ break;
+ case 16:
+ audio_param.format = AVSYS_AUDIO_FORMAT_16BIT;
+ break;
+ default:
+ audio_param.format = AVSYS_AUDIO_FORMAT_16BIT;
+ break;
+ }
+
+ debug_msg("[CODEC WAV] PARAM mode : [%d]\n", audio_param.mode);
+ 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);
+ debug_msg("[CODEC WAV] PARAM volume type : [%x]\n", audio_param.vol_type);
+
+ ret = avsys_audio_open(&audio_param, &p->audio_handle, &p->period);
+ if (ret != MM_ERROR_NONE)
+ debug_critical("[CODEC WAV] Can not open audio handle\n");
+
+
+
+ if (p->audio_handle == (avsys_handle_t)-1) {
+ debug_critical("[CODEC WAV] audio_handle is not created !! \n");
+ if (p)
+ free(p);
+ return MM_ERROR_SOUND_INTERNAL;
+ }
+
+
+ p->state = STATE_READY;
+
+ g_thread_pool_func(p, _runing);
+ debug_msg("[CODEC WAV] Thread pool start\n");
+ *handle = (MMHandleType)p;
+
+ debug_leave("\n");
+
+ return MM_ERROR_NONE;
+}
+
+
+int MMSoundPlugCodecWavePlay(MMHandleType handle)
+{
+ wave_info_t *p = (wave_info_t *) handle;
+
+ debug_enter("(handle %x)\n", handle);
+
+ if (p->size <= 0) {
+ debug_error("[CODEC WAV] end of file\n");
+ return MM_ERROR_END_OF_FILE;
+ }
+ debug_msg("[CODEC WAV] send start signal\n");
+ p->state = STATE_BEGIN;
+
+ debug_leave("\n");
+
+ return MM_ERROR_NONE;
+ }
+
+
+
+static void _runing(void *param)
+{
+ wave_info_t *p = (wave_info_t*) param;
+ int nread = 0;
+ char *org_cur = NULL;
+ int org_size = 0;
+ int stop_size;
+ char *dummy = NULL;
+ int ret;
+
+ int gain, out, in, option;
+ int gain_after, out_after, in_after, option_after;
+
+
+ debug_enter("[CODEC WAV] (Slot ID %d)\n", p->cb_param);
+
+ /* Set the thread schedule */
+ org_cur = p->ptr_current;
+ org_size = p->size;
+
+ dummy = malloc(p->period);
+ if(!dummy) {
+ debug_error("[CODEC WAV] not enough memory");
+ return;
+ }
+ memset(dummy, 0, p->period);
+ p->transper_size = p->period;
+ stop_size = org_size > p->period ? org_size : p->period;
+
+ debug_msg("[CODEC WAV] Wait start signal\n");
+
+ while(p->state == STATE_READY)
+ usleep(4);
+
+ /*
+ * set path here
+ */
+ switch(p->handle_route)
+ {
+ case MM_SOUND_HANDLE_ROUTE_SPEAKER:
+ case MM_SOUND_HANDLE_ROUTE_SPEAKER_NO_RESTORE:
+ 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 MM_SOUND_HANDLE_ROUTE_USING_CURRENT:
+ default:
+ break;
+ }
+
+ debug_msg("[CODEC WAV] Recv start signal\n");
+ debug_msg("[CODEC WAV] repeat : %d\n", p->repeat_count);
+ debug_msg("[CODEC WAV] transper_size : %d\n", p->transper_size);
+
+ if (p->state != STATE_STOP) {
+ debug_msg("[CODEC WAV] Play start\n");
+ p->state = STATE_PLAY;
+ } else {
+ debug_warning ("[CODEC WAV] state is already STATE_STOP\n");
+ }
+
+ while (((p->repeat_count == -1)?(1):(p->repeat_count--)) && p->state == STATE_PLAY) {
+ while (p->state == STATE_PLAY && p->size > 0) {
+ if (p->size >= p->transper_size) {
+ nread = p->transper_size;
+ memcpy(p->buffer, p->ptr_current, nread);
+ avsys_audio_write(p->audio_handle, p->buffer, nread);
+ p->ptr_current += nread;
+ p->size -= nread;
+ debug_msg("[CODEC WAV] Playing, nRead_data : %d Size : %d \n", nread, p->size);
+ } else {
+ /* Write remain size */
+ nread = p->size;
+ memcpy(p->buffer, p->ptr_current, nread);
+ avsys_audio_write(p->audio_handle, p->buffer, nread);
+ avsys_audio_write(p->audio_handle, dummy, (p->transper_size-nread));
+ //avsys_audio_drain(p->audio_handle);
+ //debug_error("Drain is called\n");
+ p->ptr_current += nread;
+ p->size = 0;
+ }
+ }
+ p->ptr_current = org_cur;
+ p->size = org_size;
+ }
+
+ debug_msg("[CODEC WAV] End playing\n");
+ p->state = STATE_STOP;
+
+ if (p->audio_handle == (avsys_handle_t)-1) {
+ usleep(200000);
+ debug_warning("[CODEC WAV] audio already unrealize !!\n");
+ } else {
+ //usleep(75000);
+
+ if(AVSYS_FAIL(avsys_audio_drain(p->audio_handle)))
+ {
+ debug_error("avsys_audio_drain() failed\n");
+ }
+
+ /*
+ * Restore path here
+ */
+ 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);
+ if (AVSYS_FAIL(ret)) {
+ debug_critical("[CODEC WAV] Can not close audio handle\n");
+ }
+
+ }
+ p->audio_handle = (avsys_handle_t)-1;
+
+ p->state = STATE_NONE;
+
+ free(dummy);
+ if (p->stop_cb)
+ {
+ debug_msg("[CODEC WAV] Play is finished, Now start callback\n");
+ p->stop_cb(p->cb_param);
+ }
+ debug_leave("\n");
+}
+
+
+int MMSoundPlugCodecWaveStop(MMHandleType handle)
+{
+ wave_info_t *p = (wave_info_t*) handle;
+ if (!p) {
+ debug_error("The handle is NULL\n");
+ return MM_ERROR_SOUND_INTERNAL;
+ }
+ debug_msg("[CODEC WAV] Current state is state %d\n", p->state);
+ debug_msg("[CODEC WAV] Handle 0x%08X stop requested\n", handle);
+
+ p->state = STATE_STOP;
+
+ return MM_ERROR_NONE;
+}
+
+int MMSoundPlugCodecWaveDestroy(MMHandleType handle)
+{
+ wave_info_t *p = (wave_info_t*) handle;
+
+ if(!p) {
+ debug_warning("Can not destroy handle :: handle is null\n");
+ return MM_ERROR_SOUND_INVALID_POINTER;
+ }
+
+ if(p->source) {
+ mm_source_close(p->source);
+ free(p->source);
+ }
+
+ free(p);
+
+ return MM_ERROR_NONE;
+}
+
+EXPORT_API
+int MMSoundGetPluginType(void)
+{
+ return MM_SOUND_PLUGIN_TYPE_CODEC;
+}
+
+EXPORT_API
+int MMSoundPlugCodecGetInterface(mmsound_codec_interface_t *intf)
+{
+ intf->GetSupportTypes = MMSoundPlugCodecWaveGetSupportTypes;
+ intf->Parse = MMSoundPlugCodecWaveParse;
+ intf->Create = MMSoundPlugCodecWaveCreate;
+ intf->Destroy = MMSoundPlugCodecWaveDestroy;
+ intf->Play = MMSoundPlugCodecWavePlay;
+ intf->Stop = MMSoundPlugCodecWaveStop;
+ intf->SetThreadPool = MMSoundPlugCodecWaveSetThreadPool;
+
+ return MM_ERROR_NONE;
+}
+
+
--- /dev/null
+bin_PROGRAMS = mm_sound_testsuite
+
+mm_sound_testsuite_SOURCES = mm_sound_testsuite_simple.c
+
+mm_sound_testsuite_CFLAGS = $(MMCOMMON_CFLAGS) \
+ -I$(srcdir)/../include \
+ $(AVSYSTEM_CFLAGS) \
+ $(ALSA_CFLAGS) \
+ $(VCONF_CFLAGS) \
+ $(AUDIOSESSIONMGR_CFLAGS) \
+ $(MMSESSION_CFLAGS)
+
+mm_sound_testsuite_DEPENDENCIES = $(srcdir)/../.libs/libmmfsound.la \
+ $(srcdir)/../.libs/libmmfkeysound.la
+
+mm_sound_testsuite_LDADD = $(MMCOMMON_LIBS) \
+ $(MMSESSION_LIBS) \
+ $(AVSYSTEM_LIBS) \
+ $(VCONF_LIBS) \
+ $(AUDIOSESSIONMGR_LIBS) \
+ $(srcdir)/../.libs/libmmfsound.la \
+ $(srcdir)/../.libs/libmmfkeysound.la \
+ $(srcdir)/../common/.libs/libmmfsoundcommon.la \
+ -lpthread
--- /dev/null
+/*
+ * 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 <string.h>
+#include <stdlib.h>
+
+#define debug_log(msg, args...) fprintf(stderr, msg, ##args)
+#define avsys_info(msg, args...) fprintf(stderr, msg, ##args)
+#define MAX_STRING_LEN 256
+#define MAX_PATH_LEN 1024
+#define MIN_TONE_PLAY_TIME 300
+#include "../include/mm_sound.h"
+#include "../include/mm_sound_private.h"
+
+#include <glib.h>
+
+#include <pthread.h>
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+#include <dirent.h>
+#include <vconf.h>
+#include <mm_session_private.h>
+#include <audio-session-manager-types.h>
+
+#define POWERON_FILE "/usr/share/keysound/poweron.wav"
+
+
+// For testsuite status
+enum {
+ CURRENT_STATUS_MAINMENU = 0,
+ CURRENT_STATUS_FILENAME = 1,
+ CURRENT_STATUS_POSITION = 2,
+ CURRENT_STATUS_DIRNAME = 3,
+};
+
+int g_menu_state = CURRENT_STATUS_MAINMENU;
+
+volume_type_t g_volume_type = VOLUME_TYPE_MEDIA;
+unsigned int g_volume_value;
+
+GIOChannel *stdin_channel;
+char g_file_name[MAX_STRING_LEN];
+char g_dir_name[MAX_PATH_LEN];
+
+
+GMainLoop* g_loop;
+
+// Function
+static void interpret (char *buf);
+gboolean timeout_menu_display(void *data);
+gboolean timeout_quit_program(void *data);
+gboolean input (GIOChannel *channel);
+
+static char* __get_playback_device_str (mm_sound_device_out out);
+static char* __get_capture_device_str (mm_sound_device_in in);
+static char* __get_route_str (mm_sound_route route);
+static int __mm_sound_foreach_available_route_cb (mm_sound_route route, void *user_data);
+static void __mm_sound_available_route_changed_cb (mm_sound_route route, bool available, void *user_data);
+static void __mm_sound_active_device_changed_cb (mm_sound_device_in device_in, mm_sound_device_out device_out, void *user_data);
+
+void mycallback(void *data)
+{
+ char *str = (char*)data;
+ if(data != NULL)
+ debug_log("mycallback called (user data:%s)\n", str);
+ else
+ debug_log("mycallback called (no user data)\n");
+}
+volatile char test_callback_done;
+void test_callback(void *data)
+{
+ debug_log("test_callback is called\n");
+ test_callback_done = 1;
+}
+void quit_program()
+{
+ g_main_loop_quit(g_loop);
+}
+
+static void displaymenu()
+{
+ if (g_menu_state == CURRENT_STATUS_MAINMENU) {
+ g_print("==================================================================\n");
+ g_print(" Sound Path APIs\n");
+ g_print("==================================================================\n");
+ g_print("1. Play speaker \t");
+ g_print("2. Play headset \n");
+ g_print("3. (blank) \n");
+ g_print("4. Rec. with mic \t");
+ g_print("5. (blank) \t");
+ g_print("6. Call receiver \n");
+ g_print("7. Call end \t");
+ g_print("8. VT call speaker \t");
+ g_print("9. VT call end \n");
+ g_print("==================================================================\n");
+ g_print(" Sound Play APIs\n");
+ g_print("==================================================================\n");
+ g_print("k : Key Sound \t");
+ g_print("a : play sound \t");
+ g_print("A : play loud solo\n");
+ g_print("c : play sound ex \t");
+ g_print("F : Play DTMF \t");
+ g_print("b : Play directory\n");
+ g_print("s : Stop play \n");
+ g_print("==================================================================\n");
+ g_print(" Volume APIs\n");
+ g_print("==================================================================\n");
+ g_print("q : Get media \t");
+ g_print("w : Inc. media \t");
+ g_print("e : Dec. media \n");
+ g_print("r : Get system \t");
+ g_print("t : Inc. system \t");
+ g_print("y : Dec. system \n");
+ g_print("==================================================================\n");
+ g_print(" Audio route APIs\n");
+ g_print("==================================================================\n");
+ g_print("u : Foreach Available Routes \t");
+ g_print("i : Get Active Devices \n");
+ g_print("o : Add Available Routes Callback \t");
+ g_print("O : Remove Available Routes Callback \n");
+ g_print("p : Add Active Route Callback\t");
+ g_print("P : Remove Active Route Callback \n");
+ g_print("{ : Get BT A2DP Status\n");
+ g_print("==================================================================\n");
+ g_print(" Session Test\n");
+ g_print("==================================================================\n");
+ g_print("z : Call start \t");
+ g_print("Z : VideoCall start \t");
+ g_print("v : Call/VideoCall end \t");
+ g_print("V : Current Status \n");
+ g_print("==================================================================\n");
+ g_print("d : Input Directory \t");
+ g_print("f : Input File name \t");
+ g_print("x : Exit Program \n");
+ g_print("==================================================================\n");
+ g_print(" Input command >>>>>>>> ");
+ }
+ else if (g_menu_state == CURRENT_STATUS_FILENAME) {
+ g_print(">>>>Input file name to play : ");
+ }
+ else if (g_menu_state == CURRENT_STATUS_DIRNAME) {
+ g_print(">>>>Input directory which contain audio files : ");
+ }
+ else {
+ g_print("**** Unknown status.\n");
+ quit_program();
+ }
+}
+
+gboolean timeout_menu_display(void* data)
+{
+ displaymenu();
+ return FALSE;
+}
+
+gboolean timeout_quit_program(void* data)
+{
+ quit_program();
+ return FALSE;
+}
+
+gboolean input (GIOChannel *channel)
+{
+ char buf[MAX_STRING_LEN + 3];
+ gsize read;
+
+ g_io_channel_read(channel, buf, MAX_STRING_LEN, &read);
+ buf[read] = '\0';
+ g_strstrip(buf);
+ interpret (buf);
+ return TRUE;
+}
+
+
+static void input_filename(char *filename)
+{
+ strncpy(g_file_name, filename, sizeof(g_file_name)-1);
+ g_print("\nThe input filename is '%s' \n\n",g_file_name);
+
+}
+
+static void input_dirname(char *dirname)
+{
+ strncpy(g_dir_name, dirname, sizeof(g_dir_name)-1);
+ g_print("\nThe input directory is '%s' \n\n",g_dir_name);
+}
+
+static char* __get_playback_device_str (mm_sound_device_out out)
+{
+ switch (out) {
+ case MM_SOUND_DEVICE_OUT_SPEAKER: return "SPEAKER";
+ case MM_SOUND_DEVICE_OUT_RECEIVER: return "RECEIVER";
+ case MM_SOUND_DEVICE_OUT_WIRED_ACCESSORY: return "HEADSET";
+ case MM_SOUND_DEVICE_OUT_BT_SCO: return "BTSCO";
+ case MM_SOUND_DEVICE_OUT_BT_A2DP: return "BTA2DP";
+ case MM_SOUND_DEVICE_OUT_DOCK: return "DOCK";
+ case MM_SOUND_DEVICE_OUT_HDMI: return "HDMI";
+ case MM_SOUND_DEVICE_OUT_WFD: return "WFD";
+ case MM_SOUND_DEVICE_OUT_USB_AUDIO: return "USB";
+ default: return NULL;
+ }
+}
+
+static char* __get_capture_device_str (mm_sound_device_in in)
+{
+ switch (in) {
+ case MM_SOUND_DEVICE_IN_MIC: return "MAINMIC";
+ case MM_SOUND_DEVICE_IN_WIRED_ACCESSORY: return "HEADSET";
+ case MM_SOUND_DEVICE_IN_BT_SCO: return "BTMIC";
+ default: return NULL;
+ }
+}
+
+static char* __get_route_str (mm_sound_route route)
+{
+ switch (route) {
+ case MM_SOUND_ROUTE_OUT_SPEAKER: return "OUT_SPEAKER";
+ case MM_SOUND_ROUTE_OUT_WIRED_ACCESSORY: return "OUT_WIRED_ACCESSORY";
+ case MM_SOUND_ROUTE_OUT_BLUETOOTH: return "OUT_BLUETOOTH";
+ case MM_SOUND_ROUTE_OUT_DOCK: return "OUT_DOCK";
+ case MM_SOUND_ROUTE_OUT_HDMI: return "OUT_HDMI";
+ case MM_SOUND_ROUTE_OUT_WFD: return "OUT_WFD";
+ case MM_SOUND_ROUTE_OUT_USB_AUDIO: return "OUT_USB";
+ case MM_SOUND_ROUTE_IN_MIC: return "IN_MIC";
+ case MM_SOUND_ROUTE_IN_WIRED_ACCESSORY: return "IN_WIRED_ACCESSORY";
+ case MM_SOUND_ROUTE_IN_MIC_OUT_RECEIVER: return "IN_MIC_OUT_RECEIVER";
+ case MM_SOUND_ROUTE_IN_MIC_OUT_SPEAKER: return "IN_MIC_OUT_SPEAKER";
+ case MM_SOUND_ROUTE_IN_MIC_OUT_HEADPHONE: return "IN_MIC_OUT_HEADPHONE";
+ case MM_SOUND_ROUTE_INOUT_HEADSET: return "INOUT_HEADSET";
+ case MM_SOUND_ROUTE_INOUT_BLUETOOTH: return "INOUT_BLUETOOTH";
+ default: return NULL;
+ }
+}
+
+static int __mm_sound_foreach_available_route_cb (mm_sound_route route, void *user_data)
+{
+ g_print ("[%s] route = [0x%08x][%s]\n", __func__, route, __get_route_str(route));
+ return true;
+}
+
+static void __mm_sound_available_route_changed_cb (mm_sound_route route, bool available, void *user_data)
+{
+ g_print ("[%s] route = [%d][0x%08x][%s]\n", __func__, available, route, __get_route_str(route));
+}
+
+static void __mm_sound_active_device_changed_cb (mm_sound_device_in device_in, mm_sound_device_out device_out, void *user_data)
+{
+ g_print ("[%s] in[0x%08x][%s], out[0x%08x][%s]\n", __func__,
+ device_in, __get_capture_device_str(device_in), device_out, __get_playback_device_str(device_out));
+}
+
+static void interpret (char *cmd)
+{
+ int ret=0;
+ static int handle = -1;
+ MMSoundPlayParam soundparam = {0,};
+
+ switch (g_menu_state)
+ {
+ case CURRENT_STATUS_MAINMENU:
+ if(strncmp(cmd, "k", 1) == 0)
+ {
+ ret = mm_sound_play_keysound(POWERON_FILE, 8);
+ if(ret < 0)
+ debug_log("keysound play failed with 0x%x\n", ret);
+ }
+ else if(strncmp(cmd, "q", 1) == 0)
+ {//get media volume
+ unsigned int value = 100;
+ ret = mm_sound_volume_get_value(g_volume_type, &value);
+ if(ret < 0) {
+ debug_log("mm_sound_volume_get_value 0x%x\n", ret);
+ }
+ else{
+ g_print("*** MEDIA VOLUME : %u ***\n", value);
+ g_volume_value = value;
+ }
+ }
+ else if(strncmp(cmd, "w", 1) == 0)
+ {//set media volume up
+ unsigned int value = 100;
+ ret = mm_sound_volume_get_value(g_volume_type, &value);
+ if(ret < 0) {
+ debug_log("mm_sound_volume_get_value 0x%x\n", ret);
+ }
+ else {
+ debug_log("Loaded media volume is %d\n", value);
+ int step;
+ value++;
+ mm_sound_volume_get_step(g_volume_type, &step);
+ if(value >= step) {
+ value = step-1;
+ }
+ ret = mm_sound_volume_set_value(g_volume_type, value);
+ if(ret < 0) {
+ debug_log("mm_sound_volume_set_value 0x%x\n", ret);
+ }
+ }
+ }
+ else if(strncmp(cmd, "e", 1) == 0)
+ {//set media volume down
+ unsigned int value = 100;
+ ret = mm_sound_volume_get_value(g_volume_type, &value);
+ if(ret < 0) {
+ debug_log("mm_sound_volume_get_value 0x%x\n", ret);
+ }
+ else {
+ if(value != 0) {
+ value--;
+ }
+
+ ret = mm_sound_volume_set_value(g_volume_type, value);
+ if(ret < 0) {
+ debug_log("mm_sound_volume_set_value 0x%x\n", ret);
+ }
+ }
+ }
+ else if(strncmp(cmd, "r", 1) == 0)
+ {//get media volume
+ unsigned int value = 100;
+ ret = mm_sound_volume_get_value(VOLUME_TYPE_SYSTEM, &value);
+ if(ret < 0) {
+ debug_log("mm_sound_volume_get_value 0x%x\n", ret);
+ }
+ else{
+ g_print("*** SYSTEM VOLUME : %u ***\n", value);
+ g_volume_value = value;
+ }
+ }
+ else if(strncmp(cmd, "t", 1) == 0)
+ {//set media volume up
+ unsigned int value = 100;
+ ret = mm_sound_volume_get_value(VOLUME_TYPE_SYSTEM, &value);
+ if(ret < 0) {
+ debug_log("mm_sound_volume_get_value 0x%x\n", ret);
+ }
+ else {
+ debug_log("Loaded system volume is %d\n", value);
+ int step;
+ value++;
+ mm_sound_volume_get_step(VOLUME_TYPE_SYSTEM, &step);
+ if(value >= step) {
+ value = step-1;
+ }
+ ret = mm_sound_volume_set_value(VOLUME_TYPE_SYSTEM, value);
+ if(ret < 0) {
+ debug_log("mm_sound_volume_set_value 0x%x\n", ret);
+ }else {
+ g_print("Current System volume is %d\n", value);
+ }
+ }
+ }
+ else if(strncmp(cmd, "y", 1) == 0)
+ {//set media volume down
+ unsigned int value = 100;
+ ret = mm_sound_volume_get_value(VOLUME_TYPE_SYSTEM, &value);
+ if(ret < 0) {
+ debug_log("mm_sound_volume_get_value 0x%x\n", ret);
+ }
+ else {
+ if(value != 0) {
+ value--;
+ }
+
+ ret = mm_sound_volume_set_value(VOLUME_TYPE_SYSTEM, value);
+ if(ret < 0) {
+ debug_log("mm_sound_volume_set_value 0x%x\n", ret);
+ }else {
+ g_print("Current System volume is %d\n", value);
+ }
+ }
+ }
+ else if(strncmp(cmd, "a", 1) == 0)
+ {
+ debug_log("volume is %d type, %d\n", g_volume_type, g_volume_value);
+ ret = mm_sound_play_sound(g_file_name, g_volume_type, mycallback ,"USERDATA", &handle);
+ if(ret < 0)
+ debug_log("mm_sound_play_sound() failed with 0x%x\n", ret);
+ }
+ else if(strncmp(cmd, "A", 1) == 0)
+ {
+ debug_log("volume is %d type, %d\n", g_volume_type, g_volume_value);
+ ret = mm_sound_play_loud_solo_sound(g_file_name, g_volume_type, mycallback ,"USERDATA", &handle);
+ if(ret < 0)
+ debug_log("mm_sound_play_sound_loud_solo() failed with 0x%x\n", ret);
+ }
+ else if(strncmp(cmd, "F", 1) == 0)
+ {
+ char num = 0;
+ char input_string[128] = "";
+ char *tok = NULL;
+ int tonetime=0;
+ double volume=1.0;
+ int volume_type = -1;
+ MMSoundTone_t tone = MM_SOUND_TONE_DTMF_0;
+
+ while(num != 'q') {
+ fflush(stdin);
+ g_print("enter number(0~H exit:q), volume type(0~7), volume(0.0~1.0), time(ms):\t ");
+ fgets(input_string, sizeof(input_string)-1, stdin);
+ tok = strtok(input_string, " ");
+ if(!tok) continue;
+ if(tok[0] == 'q') {
+ break;
+ }
+ else if(tok[0] < '0' || tok[0] > '~') {
+ if(tok[0] == '*' || tok[0] == '#')
+ ;
+ else
+ continue;
+ }
+ num = tok[0];
+ if(num >= '0' && num <= '9') {
+ tone = (MMSoundTone_t)(num - '0');
+ }
+ else if(num == '*') {
+ tone = MM_SOUND_TONE_DTMF_S;
+ }
+ else if(num == '#') {
+ tone =MM_SOUND_TONE_DTMF_P;
+ }
+ else if(num == 'A') { tone = MM_SOUND_TONE_DTMF_A; }
+ else if(num == 'B') { tone = MM_SOUND_TONE_DTMF_B; }
+ else if(num == 'C') { tone = MM_SOUND_TONE_DTMF_C; }
+ else if(num == 'D') { tone = MM_SOUND_TONE_DTMF_D; }
+ else if(num == 'E') { tone = MM_SOUND_TONE_SUP_DIAL; }
+ else if(num == 'F') { tone = MM_SOUND_TONE_ANSI_DIAL; }
+ else if(num == 'G') { tone = MM_SOUND_TONE_JAPAN_DIAL; }
+ else if(num == 'H') { tone = MM_SOUND_TONE_SUP_BUSY; }
+ else if(num == 'I') { tone = MM_SOUND_TONE_ANSI_BUSY; }
+ else if(num == 'J') { tone = MM_SOUND_TONE_JAPAN_BUSY; }
+ else if(num == 'K') { tone = MM_SOUND_TONE_SUP_CONGESTION; }
+ else if(num == 'L') { tone = MM_SOUND_TONE_ANSI_CONGESTION; }
+ else if(num == 'M') { tone = MM_SOUND_TONE_SUP_RADIO_ACK; }
+ else if(num == 'N') { tone = MM_SOUND_TONE_JAPAN_RADIO_ACK; }
+ else if(num == 'O') { tone = MM_SOUND_TONE_SUP_RADIO_NOTAVAIL; }
+ else if(num == 'P') { tone = MM_SOUND_TONE_SUP_ERROR; }
+ else if(num == 'Q') { tone = MM_SOUND_TONE_SUP_CALL_WAITING; }
+ else if(num == 'R') { tone = MM_SOUND_TONE_ANSI_CALL_WAITING; }
+ else if(num == 'S') { tone = MM_SOUND_TONE_SUP_RINGTONE; }
+ else if(num == 'T') { tone = MM_SOUND_TONE_ANSI_RINGTONE; }
+ else if(num == 'U') { tone = MM_SOUND_TONE_PROP_BEEP; }
+ else if(num == 'V') { tone = MM_SOUND_TONE_PROP_ACK; }
+ else if(num == 'W') { tone = MM_SOUND_TONE_PROP_NACK; }
+ else if(num == 'X') { tone = MM_SOUND_TONE_PROP_PROMPT; }
+ else if(num == 'Y') { tone = MM_SOUND_TONE_PROP_BEEP2; }
+ else if(num == 'Z') { tone =MM_SOUND_TONE_CDMA_HIGH_SLS; }
+ else if(num == '[') { tone = MM_SOUND_TONE_CDMA_MED_SLS; }
+ else if(num == ']') { tone = MM_SOUND_TONE_CDMA_LOW_SLS; }
+ else if(num == '^') { tone =MM_SOUND_TONE_CDMA_HIGH_S_X4; }
+ else if(num == '_') { tone =MM_SOUND_TONE_CDMA_MED_S_X4; }
+ else if(num == 'a') { tone =MM_SOUND_TONE_CDMA_LOW_S_X4; }
+ else if(num == 'b') { tone =MM_SOUND_TONE_CDMA_HIGH_PBX_L; }
+ else if(num == 'c') { tone =MM_SOUND_TONE_CDMA_MED_PBX_L; }
+ else if(num == 'd') { tone =MM_SOUND_TONE_CDMA_LOW_PBX_L; }
+ else if(num == 'e') { tone =MM_SOUND_TONE_CDMA_HIGH_PBX_SS; }
+ else if(num == 'f') { tone =MM_SOUND_TONE_CDMA_MED_PBX_SS; }
+ else if(num == 'g') { tone =MM_SOUND_TONE_CDMA_LOW_PBX_SS; }
+ else if(num == 'h') { tone =MM_SOUND_TONE_CDMA_HIGH_PBX_SSL; }
+ else if(num == 'i') { tone =MM_SOUND_TONE_CDMA_MED_PBX_SSL; }
+ else if(num == 'j') { tone =MM_SOUND_TONE_CDMA_LOW_PBX_SSL; }
+ else if(num == 'k') { tone =MM_SOUND_TONE_CDMA_HIGH_PBX_SLS; }
+ else if(num == 'l') { tone =MM_SOUND_TONE_CDMA_MED_PBX_SLS; }
+ else if(num == 'm') { tone =MM_SOUND_TONE_CDMA_LOW_PBX_SLS; }
+ else if(num == 'n') { tone =MM_SOUND_TONE_CDMA_HIGH_PBX_S_X4; }
+ else if(num == 'o') { tone =MM_SOUND_TONE_CDMA_MED_PBX_S_X4; }
+ else if(num == 'p') { tone =MM_SOUND_TONE_CDMA_LOW_PBX_S_X4; }
+ else if(num == 'q') { tone =MM_SOUND_TONE_CDMA_ALERT_NETWORK_LITE; }
+ else if(num == 'r') { tone =MM_SOUND_TONE_CDMA_ALERT_AUTOREDIAL_LITE; }
+ else if(num == 's') { tone =MM_SOUND_TONE_CDMA_ONE_MIN_BEEP; }
+ else if(num == 't') { tone =MM_SOUND_TONE_CDMA_KEYPAD_VOLUME_KEY_LITE; }
+ else if(num == 'u') { tone =MM_SOUND_TONE_CDMA_PRESSHOLDKEY_LITE; }
+ else if(num == 'v') { tone =MM_SOUND_TONE_CDMA_ALERT_INCALL_LITE; }
+ else if(num == 'w') { tone =MM_SOUND_TONE_CDMA_EMERGENCY_RINGBACK; }
+ else if(num == 'x') { tone =MM_SOUND_TONE_CDMA_ALERT_CALL_GUARD; }
+ else if(num == 'y') { tone =MM_SOUND_TONE_CDMA_SOFT_ERROR_LITE; }
+ else if(num == 'z') { tone =MM_SOUND_TONE_CDMA_CALLDROP_LITE; }
+ else if(num == '{') { tone =MM_SOUND_TONE_CDMA_NETWORK_BUSY_ONE_SHOT; }
+ else if(num == '}') { tone =MM_SOUND_TONE_CDMA_CALL_SIGNAL_ISDN_PING_RING; }
+ else if(num == '~') { tone =MM_SOUND_TONE_CDMA_SIGNAL_OFF; }
+ tok = strtok(NULL, " ");
+ if(tok) volume_type = (double)atoi(tok);
+
+ tok = strtok(NULL, " ");
+ if(tok) volume = (double)atof(tok);
+
+ tok = strtok(NULL, " ");
+ if(tok)
+ {
+ tonetime = atoi(tok);
+ }
+ else
+ {
+ tonetime = MIN_TONE_PLAY_TIME;
+ }
+
+ debug_log("volume type: %d\t volume is %f\t tonetime: %d \n", volume_type, volume, tonetime);
+ ret = mm_sound_play_tone(tone, volume_type, volume, tonetime, &handle);
+ if(ret<0)
+ debug_log ("[magpie] Play DTMF sound cannot be played ! %d\n", handle);
+ }
+ }
+ else if (strncmp (cmd, "b",1) == 0)
+ {
+ DIR *basedir;
+ struct dirent *entry;
+ struct stat file_stat;
+ char fullpath[MAX_PATH_LEN]="";
+ struct timespec start_time = {0,};
+ struct timespec current_time = {0,};
+
+ if(g_dir_name[strlen(g_dir_name)-1] == '/')
+ g_dir_name[strlen(g_dir_name)-1] = '\0';
+
+ basedir = opendir(g_dir_name);
+ if(basedir != NULL)
+ {
+ while( (entry = readdir(basedir)) != NULL)
+ {
+ int playfail =0;
+ int mywait = 0;
+ if(entry->d_name[0] == '.')
+ continue;
+ memset(fullpath, '\0' ,sizeof(fullpath));
+ snprintf(fullpath, sizeof(fullpath)-1,"%s/%s", g_dir_name, entry->d_name);
+ debug_log("Try %s\n", fullpath);
+
+ if (lstat(fullpath, &file_stat) == -1)
+ continue;
+
+ if(S_ISREG(file_stat.st_mode))
+ {
+ test_callback_done = 0 ;
+ start_time.tv_sec = (long int)(time(NULL));
+ start_time.tv_nsec = 0;
+ ret = mm_sound_play_sound(fullpath, g_volume_type, test_callback, NULL, &handle);
+ if(ret != MM_ERROR_NONE)
+ {
+ debug_log("Play file error : %s\n", fullpath);
+ sleep(4);
+ playfail = 1;
+ }
+ }
+ else
+ {
+ debug_log("this is not regular file : %s\n", fullpath);
+ playfail = 1;
+ }
+ while((test_callback_done == 0) && (playfail ==0))
+ {
+ current_time.tv_sec = (long int)(time(NULL));
+ current_time.tv_nsec = 0;
+ if(current_time.tv_sec - start_time.tv_sec > 200)
+ {
+ if((++mywait)%5 == 0)
+ {
+ debug_log("I'm waiting callback for %d seconds after play %s\n",
+ (int)(current_time.tv_sec - start_time.tv_sec),
+ fullpath);
+ }
+ }
+ sleep(2);
+ }
+ debug_log("goto next file\n");
+ }
+ closedir(basedir);
+ }
+ else
+ {
+ debug_log("Cannot Open such a directory %s\n", g_dir_name);
+ }
+
+ }
+
+ else if (strncmp (cmd, "c",1) == 0)
+ {
+ soundparam.volume = g_volume_value;
+ soundparam.loop = -1; /* loop case */
+ soundparam.callback = mycallback;
+ soundparam.data = NULL;
+ soundparam.mem_ptr = NULL;
+ soundparam.mem_size = 0;
+ soundparam.filename = g_file_name;
+ soundparam.volume_config = g_volume_type;
+
+ if ((mm_sound_play_sound_ex (&soundparam, &handle))<0)
+ debug_log ("Play EX sound cannot be played !\n");
+
+ debug_log ("Ex sound is played Handle is [%d]\n", handle);
+ }
+ else if (strncmp (cmd, "f",1) == 0) {
+ g_menu_state=CURRENT_STATUS_FILENAME;
+ }
+
+ else if (strncmp (cmd, "d",1) == 0) {
+ g_menu_state=CURRENT_STATUS_DIRNAME;
+ }
+ else if (strncmp (cmd, "s",1) == 0) {
+ if(mm_sound_stop_sound(handle))
+ debug_log (" Cannot stop sound !!! %d \n", handle);
+ }
+ else if (strncmp (cmd, "1",1) == 0) {
+ //ap to spk
+ if (mm_sound_set_path (MM_SOUND_GAIN_KEYTONE, MM_SOUND_PATH_SPK, MM_SOUND_PATH_NONE, MM_SOUND_PATH_OPTION_NONE)<0)
+ debug_log ("Fail to set sound path !!!\n");
+ g_print("Set path for speaker playback\n");
+ }
+
+ else if (strncmp (cmd, "2",1) == 0) {
+ //ap to headset
+ if (mm_sound_set_path(MM_SOUND_GAIN_KEYTONE, MM_SOUND_PATH_HEADSET, MM_SOUND_PATH_NONE, MM_SOUND_PATH_OPTION_NONE)<0)
+ debug_log ("Fail to set sound path !!!\n");
+ g_print("Set path for headset playback\n");
+ }
+ else if (strncmp (cmd, "3",1) == 0) {
+
+ }
+ else if (strncmp (cmd, "4",1) == 0) {
+ //recording
+ if (mm_sound_set_path(MM_SOUND_GAIN_VOICEREC, MM_SOUND_PATH_NONE, MM_SOUND_PATH_MIC, MM_SOUND_PATH_OPTION_NONE)<0)
+ debug_log ("Fail to set sound path !!!\n");
+ g_print("Set path for recording with main mic\n");
+ }
+ else if (strncmp (cmd, "5",1) == 0) {
+
+ }
+ else if (strncmp (cmd, "6",1) == 0) {
+ //voice call
+ if (mm_sound_set_path(MM_SOUND_GAIN_VOICECALL, MM_SOUND_PATH_RECV, MM_SOUND_PATH_MIC, MM_SOUND_PATH_OPTION_NONE)<0)
+ debug_log ("Fail to set sound path !!!\n");
+ g_print("Set path for voicecall\n");
+ }
+ else if (strncmp (cmd, "7",1) == 0) {
+ //voicecall release
+ if (mm_sound_set_path(MM_SOUND_GAIN_VOICECALL, MM_SOUND_PATH_NONE, MM_SOUND_PATH_NONE, MM_SOUND_PATH_OPTION_NONE)<0)
+ debug_log ("Fail to set sound path !!!\n");
+ g_print("release path for voicecall\n");
+ }
+ else if (strncmp (cmd, "8",1) == 0) {
+ //voice call
+ if (mm_sound_set_path(MM_SOUND_GAIN_VIDEOCALL, MM_SOUND_PATH_SPK, MM_SOUND_PATH_MIC, MM_SOUND_PATH_OPTION_NONE)<0)
+ debug_log ("Fail to set sound path !!!\n");
+ g_print("Set path for VT call\n");
+ }
+
+ else if (strncmp (cmd, "9",1) == 0) {
+ //voicecall release
+ if (mm_sound_set_path(MM_SOUND_GAIN_VIDEOCALL, MM_SOUND_PATH_NONE, MM_SOUND_PATH_NONE, MM_SOUND_PATH_OPTION_NONE)<0)
+ debug_log ("[magpie] Fail to set sound path !!!\n");
+ g_print("release path for VT call\n");
+ }
+
+ /* -------------------------- Route Test : Starts -------------------------- */
+#if 0
+ g_print("==================================================================\n");
+ g_print(" Audio route APIs\n");
+ g_print("==================================================================\n");
+ g_print("u : Foreach Available Routes \t");
+ g_print("i : Get Active Devices \n");
+ g_print("o : Add Available Routes Callback \t");
+ g_print("O : Remove Available Routes Callback \n");
+ g_print("p : Add Active Route Callback\t");
+ g_print("P : Remove Active Route Callback \n");
+ g_print("{ : Get BT A2DP Status\n");
+#endif
+ else if (strncmp(cmd, "u", 1) == 0) {
+ int ret = 0;
+ ret = mm_sound_foreach_available_route_cb(__mm_sound_foreach_available_route_cb, NULL);
+ if (ret == MM_ERROR_NONE) {
+ g_print ("### mm_sound_foreach_available_route_cb() Success\n\n");
+ } else {
+ g_print ("### mm_sound_foreach_available_route_cb() Error : errno [%x]\n\n", ret);
+ }
+ }
+ else if (strncmp(cmd, "i", 1) == 0) {
+ int ret = 0;
+ mm_sound_device_in in;
+ mm_sound_device_out out;
+ ret = mm_sound_get_active_device(&in, &out);
+ if (ret == MM_ERROR_NONE) {
+ g_print ("### mm_sound_get_active_device() Success : in[0x%08x][%s], out[0x%08x][%s]\n\n",
+ in, __get_capture_device_str(in), out, __get_playback_device_str(out));
+ } else {
+ g_print ("### mm_sound_get_active_device() Error : errno [%x]\n\n", ret);
+ }
+ }
+ else if (strncmp(cmd, "o", 1) == 0) {
+ int ret = 0;
+ ret = mm_sound_add_available_route_changed_callback(__mm_sound_available_route_changed_cb, NULL);
+ if (ret == MM_ERROR_NONE) {
+ g_print ("### mm_sound_add_available_route_changed_callback() Success\n\n");
+ } else {
+ g_print ("### mm_sound_add_available_route_changed_callback() Error : errno [%x]\n\n", ret);
+ }
+ }
+ else if (strncmp(cmd, "O", 1) == 0) {
+ int ret = 0;
+ ret = mm_sound_remove_available_route_changed_callback();
+ if (ret == MM_ERROR_NONE) {
+ g_print ("### mm_sound_remove_available_route_changed_callback() Success\n\n");
+ } else {
+ g_print ("### mm_sound_remove_available_route_changed_callback() Error : errno [%x]\n\n", ret);
+ }
+ }
+ else if (strncmp(cmd, "p", 1) == 0) {
+ int ret = 0;
+ ret = mm_sound_add_active_device_changed_callback(__mm_sound_active_device_changed_cb, NULL);
+ if (ret == MM_ERROR_NONE) {
+ g_print ("### mm_sound_add_active_device_changed_callback() Success\n\n");
+ } else {
+ g_print ("### mm_sound_add_active_device_changed_callback() Error : errno [%x]\n\n", ret);
+ }
+ }
+ else if (strncmp(cmd, "P", 1) == 0) {
+ int ret = 0;
+ ret = mm_sound_remove_active_device_changed_callback();
+ if (ret == MM_ERROR_NONE) {
+ g_print ("### mm_sound_remove_active_device_changed_callback() Success\n\n");
+ } else {
+ g_print ("### mm_sound_remove_active_device_changed_callback() Error : errno [%x]\n\n", ret);
+ }
+ }
+ else if (strncmp(cmd, "{", 1) == 0) {
+ int ret = 0;
+ int connected = 0;
+ char* bt_name = NULL;
+
+ ret = mm_sound_route_get_a2dp_status (&connected, &bt_name);
+ if (ret == MM_ERROR_NONE) {
+ g_print ("### mm_sound_route_get_a2dp_status() Success : connected=[%d] name=[%s]\n", connected, bt_name);
+ if (bt_name)
+ free (bt_name);
+ } else {
+ g_print ("### mm_sound_route_get_a2dp_status() Error : errno [%x]\n", ret);
+ }
+ }
+
+ else if(strncmp(cmd, "}", 1) == 0)
+ {
+ int ret = 0;
+ char input_string[128];
+ mm_sound_route route = MM_SOUND_ROUTE_OUT_SPEAKER;
+ char num;
+
+ fflush(stdin);
+ g_print ("1. MM_SOUND_ROUTE_OUT_SPEAKER\n");
+ g_print ("2. MM_SOUND_ROUTE_OUT_WIRED_ACCESSORY\n");
+ g_print ("3. MM_SOUND_ROUTE_OUT_BLUETOOTH\n");
+ g_print ("4. MM_SOUND_ROUTE_OUT_DOCK\n");
+ g_print ("5. MM_SOUND_ROUTE_OUT_HDMI\n");
+ g_print ("6. MM_SOUND_ROUTE_OUT_WFD\n");
+ g_print ("7. MM_SOUND_ROUTE_OUT_USB_AUDIO\n");
+ g_print ("8. MM_SOUND_ROUTE_IN_MIC\n");
+ g_print ("9. MM_SOUND_ROUTE_IN_WIRED_ACCESSORY\n");
+ g_print ("0. MM_SOUND_ROUTE_IN_MIC_OUT_RECEIVER\n");
+ g_print ("a. MM_SOUND_ROUTE_IN_MIC_OUT_SPEAKER\n");
+ g_print ("b. MM_SOUND_ROUTE_IN_MIC_OUT_HEADPHONE\n");
+ g_print ("c. MM_SOUND_ROUTE_INOUT_HEADSET\n");
+ g_print ("d. MM_SOUND_ROUTE_INOUT_BLUETOOTH\n");
+ g_print("> select route number : ");
+
+ fgets(input_string, sizeof(input_string)-1, stdin);
+ num = input_string[0];
+
+ if(num == '1') { route = MM_SOUND_ROUTE_OUT_SPEAKER; }
+ else if(num == '2') { route = MM_SOUND_ROUTE_OUT_WIRED_ACCESSORY; }
+ else if(num == '3') { route = MM_SOUND_ROUTE_OUT_BLUETOOTH; }
+ else if(num == '4') { route = MM_SOUND_ROUTE_OUT_DOCK; }
+ else if(num == '5') { route = MM_SOUND_ROUTE_OUT_HDMI; }
+ else if(num == '6') { route = MM_SOUND_ROUTE_OUT_WFD; }
+ else if(num == '7') { route = MM_SOUND_ROUTE_OUT_USB_AUDIO; }
+ else if(num == '8') { route = MM_SOUND_ROUTE_IN_MIC; }
+ else if(num == '9') { route = MM_SOUND_ROUTE_IN_WIRED_ACCESSORY; }
+ else if(num == '0') { route = MM_SOUND_ROUTE_IN_MIC_OUT_RECEIVER; }
+ else if(num == 'a') { route = MM_SOUND_ROUTE_IN_MIC_OUT_SPEAKER; }
+ else if(num == 'b') { route = MM_SOUND_ROUTE_IN_MIC_OUT_HEADPHONE; }
+ else if(num == 'c') { route = MM_SOUND_ROUTE_INOUT_HEADSET; }
+ else if(num == 'd') { route = MM_SOUND_ROUTE_INOUT_BLUETOOTH; }
+
+ ret = mm_sound_set_active_route(route);
+ if (ret == MM_ERROR_NONE) {
+ g_print ("### mm_sound_set_active_route(%s) Success\n\n", __get_route_str (route));
+ } else {
+ g_print ("### mm_sound_set_acstive_route(%s) Error : errno [%x]\n\n", __get_route_str (route), ret);
+ }
+ }
+
+ else if(strncmp(cmd, "z", 1) ==0) {
+ if(MM_ERROR_NONE != mm_session_init(MM_SESSION_TYPE_CALL))
+ {
+ g_print("Call session init failed\n");
+ }
+ }
+ else if(strncmp(cmd, "Z", 1) ==0) {
+ if(MM_ERROR_NONE != mm_session_init(MM_SESSION_TYPE_VIDEOCALL))
+ {
+ g_print("VideoCall session init failed\n");
+ }
+ }
+ else if(strncmp(cmd, "v", 1) ==0) {
+ if(MM_ERROR_NONE != mm_session_finish())
+ {
+ g_print("Call session finish failed\n");
+ }
+ }
+
+ else if(strncmp(cmd, "V", 1) ==0) {
+ int value;
+ if(vconf_get_int(SOUND_STATUS_KEY, &value)) {
+ g_print("Can not get %s\n", SOUND_STATUS_KEY);
+ }
+ else
+ {
+ if(value == ASM_STATUS_NONE || value == ASM_STATUS_MONITOR)
+ {
+ g_print("No Session Instance\n");
+ }
+ if(value & ASM_STATUS_SHARE_MMPLAYER) {
+ g_print("SHARE - PLAYER\n");
+ }
+ if(value & ASM_STATUS_EXCLUSIVE_MMPLAYER) {
+ g_print("EXCLUSIVE - PLAYER\n");
+ }
+ if(value & ASM_STATUS_SHARE_MMSOUND) {
+ g_print("SHARE - SOUND\n");
+ }
+ if(value & ASM_STATUS_EXCLUSIVE_MMSOUND) {
+ g_print("EXCLUSIVE - SOUND\n");
+ }
+ if(value & ASM_STATUS_SHARE_MMCAMCORDER) {
+ g_print("SHARE - CAMCORDER\n");
+ }
+ if(value & ASM_STATUS_EXCLUSIVE_MMCAMCORDER) {
+ g_print("EXCLUSIVE - CAMCORDER\n");
+ }
+ if(value & ASM_STATUS_SHARE_OPENAL) {
+ g_print("SHARE - OPENAL\n");
+ }
+ if(value & ASM_STATUS_EXCLUSIVE_OPENAL) {
+ g_print("EXCLUSIVE - OPENAL\n");
+ }
+ if(value & ASM_STATUS_SHARE_AVSYSTEM) {
+ g_print("SHARE - AVSYSTEM\n");
+ }
+ if(value & ASM_STATUS_EXCLUSIVE_AVSYSTEM) {
+ g_print("EXCLUSIVE - AVSYSTEM\n");
+ }
+ if(value & ASM_STATUS_NOTIFY) {
+ g_print("NOTIFY\n");
+ }
+ if(value & ASM_STATUS_ALARM) {
+ g_print("ALARM\n");
+ }
+ if(value & ASM_STATUS_CALL) {
+ g_print("CALL\n");
+ }
+ if(value & ASM_STATUS_VIDEOCALL) {
+ g_print("VIDEOCALL\n");
+ }
+ }
+ }
+
+ // End of sound & avsystem interpret
+ else if (strncmp(cmd, "x", 1) == 0) {
+ quit_program();
+ }
+ break;
+
+ case CURRENT_STATUS_FILENAME:
+ input_filename(cmd);
+ g_menu_state=CURRENT_STATUS_MAINMENU;
+ break;
+
+ case CURRENT_STATUS_DIRNAME:
+ input_dirname(cmd);
+ g_menu_state=CURRENT_STATUS_MAINMENU;
+ break;
+ case CURRENT_STATUS_POSITION:
+ break;
+ }
+ //g_timeout_add(100, timeout_menu_display, 0);
+}
+
+void volume_change_callback(void* data)
+{
+ volume_type_t* type = (volume_type_t*) data;
+
+ g_volume_type = *type;
+ mm_sound_volume_get_value(g_volume_type, &g_volume_value);
+ g_print("Volume Callback Runs :::: MEDIA VALUME %d\n", g_volume_value);
+}
+
+
+void audio_route_policy_changed_callback(void* data, system_audio_route_t policy)
+{
+ int dummy = (int) data;
+ system_audio_route_t lv_policy;
+ char *str_route[SYSTEM_AUDIO_ROUTE_POLICY_MAX] = {
+ "DEFAULT","IGN_A2DP","HANDSET"
+ };
+ g_print("Audio Route Policy has changed to [%s]\n", str_route[policy]);
+ g_print("...read....current....policy...to cross check..%d\n", dummy);
+ if(0 > mm_sound_route_get_system_policy(&lv_policy)) {
+ g_print("Can not get policy...in callback function\n");
+ }
+ else {
+ g_print("...readed policy [%s]\n", str_route[lv_policy]);
+ }
+}
+
+int main(int argc, char *argv[])
+{
+ stdin_channel = g_io_channel_unix_new(0);
+ g_io_add_watch(stdin_channel, G_IO_IN, (GIOFunc)input, NULL);
+ g_loop = g_main_loop_new (NULL, 1);
+
+ g_print("callback function addr :: %p\n", volume_change_callback);
+ 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);
+ displaymenu();
+ g_main_loop_run (g_loop);
+
+ return 0;
+}
+