fi
fi
+#
+# gcc visibility cflag checks
+#
+AC_ARG_ENABLE([visibility],
+ [AS_HELP_STRING([--disable-visibility], [Disable or enable API visibility support (default: use if available)])],
+ [enable_visibility="${enableval}"],
+ [enable_visibility="detect"]
+)
+HAVE_VISIBILITY="no"
+
+if test "x${enable_visibility}" != "xno" ; then
+
+ case "${ax_cv_c_compiler_vendor}" in
+ gnu)
+ save_CFLAGS="${CFLAGS}"
+ CFLAGS="${CFLAGS} -fvisibility=hidden"
+ AC_MSG_CHECKING([whether the compiler supports -fvisibility=hidden])
+ AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM(
+ [int foo __attribute__ ((visibility("default")));],
+ [;]
+ )],
+
+ [AC_MSG_RESULT([yes])
+ APR_ADDTO([SWITCH_AM_CFLAGS], [-fvisibility=hidden -DSWITCH_API_VISIBILITY=1 -DHAVE_VISIBILITY=1])
+ APR_ADDTO([SWITCH_AM_CXXFLAGS], [-fvisibility=hidden -DSWITCH_API_VISIBILITY=1 -DHAVE_VISIBILITY=1])
+ HAVE_VISIBILITY="yes"],
+
+ [AC_MSG_RESULT([no])]
+ )
+ CFLAGS="${save_CFLAGS}"
+ ;;
+
+ sun)
+ save_CFLAGS="${CFLAGS}"
+ CFLAGS="${CFLAGS} -xldscope=hidden"
+ AC_MSG_CHECKING([whether the compiler supports -xldscope=hidden])
+ AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM(
+ [int foo __attribute__ ((visibility("default")));],
+ [;]
+ )],
+
+ [AC_MSG_RESULT([yes])
+ APR_ADDTO([SWITCH_AM_CFLAGS], [-xldscope=hidden -DSWITCH_API_VISIBILITY=1 -DHAVE_VISIBILITY=1])
+ APR_ADDTO([SWITCH_AM_CXXFLAGS], [-xldscope=hidden -DSWITCH_API_VISIBILITY=1 -DHAVE_VISIBILITY=1])
+ HAVE_VISIBILITY="yes"],
+
+ [AC_MSG_RESULT([no])]
+ )
+ CFLAGS="${save_CFLAGS}"
+ ;;
+
+ *)
+ if test "x${enable_visibility}" = "xyes" ; then
+ AC_MSG_ERROR([Non-GNU / SUN compilers are currently unsupported])
+ else
+ AC_MSG_WARN([Non-GNU / SUN compilers are currently unsupported])
+ fi
+ ;;
+ esac
+
+ #
+ # visibility explicitly requested but not supported by this compiler => error
+ #
+ if test "x${enable_visibility}" = "xyes" -a "x${HAVE_VISIBILITY}" = "xno" ; then
+ AC_MSG_ERROR([API visibility not supported by this compiler])
+ fi
+fi
+
# Enable debugging (default: on)
# (rename option if the default is changed)
AC_ARG_ENABLE(debug,
AM_INIT_AUTOMAKE(libteletone,0.1)\r
AC_CONFIG_SRCDIR([src])\r
\r
+# disable checks\r
+m4_defun([_LT_AC_LANG_CXX_CONFIG], [:])\r
+m4_defun([_LT_AC_LANG_F77_CONFIG], [:])\r
+\r
# Checks for programs.\r
AC_PROG_CC\r
AC_PROG_MAKE_SET\r
AC_PROG_LIBTOOL\r
AC_PROG_INSTALL\r
+\r
# Optimize\r
AC_ARG_ENABLE(optimization,\r
[AC_HELP_STRING([--enable-optimization],[Set if you want us to add max optimising compiler flags])],[enable_optimizer="$enableval"],[enable_optimizer="no"])\r
new_AM_LDFLAGS=""\r
;;\r
esac\r
+\r
+#\r
+# gcc visibility cflag checks\r
+#\r
+AC_ARG_ENABLE([visibility],\r
+ [AS_HELP_STRING([--disable-visibility], [Disable or enable API visibility support (default: use if available)])],\r
+ [enable_visibility="${enableval}"],\r
+ [enable_visibility="detect"]\r
+)\r
+HAVE_VISIBILITY="no"\r
+\r
+if test "x${enable_visibility}" != "xno" ; then\r
+\r
+ case "${ax_cv_c_compiler_vendor}" in\r
+ gnu)\r
+ save_CFLAGS="${CFLAGS}"\r
+ CFLAGS="${CFLAGS} -fvisibility=hidden"\r
+ AC_MSG_CHECKING([whether the compiler supports -fvisibility=hidden])\r
+ AC_COMPILE_IFELSE(\r
+ [AC_LANG_PROGRAM(\r
+ [int foo __attribute__ ((visibility("default")));],\r
+ [;]\r
+ )],\r
+\r
+ [AC_MSG_RESULT([yes])\r
+ new_AM_CFLAGS="${new_AM_CFLAGS} -fvisibility=hidden"\r
+ AC_DEFINE([HAVE_VISIBILITY], [1], [GCC visibility support available])\r
+ HAVE_VISIBILITY="yes"],\r
+\r
+ [AC_MSG_RESULT([no])]\r
+ )\r
+ CFLAGS="${save_CFLAGS}"\r
+ ;;\r
+\r
+ sun)\r
+ save_CFLAGS="${CFLAGS}"\r
+ CFLAGS="${CFLAGS} -xldscope=hidden"\r
+ AC_MSG_CHECKING([whether the compiler supports -xldscope=hidden])\r
+ AC_COMPILE_IFELSE(\r
+ [AC_LANG_PROGRAM(\r
+ [int foo __attribute__ ((visibility("default")));],\r
+ [;]\r
+ )],\r
+\r
+ [AC_MSG_RESULT([yes])\r
+ new_AM_CFLAGS="${new_AM_CFLAGS} -xldscope=hidden"\r
+ AC_DEFINE([HAVE_VISIBILITY], [1], [SUNCC visibility support available])\r
+ HAVE_VISIBILITY="yes"],\r
+\r
+ [AC_MSG_RESULT([no])]\r
+ )\r
+ CFLAGS="${save_CFLAGS}"\r
+ ;;\r
+\r
+ *)\r
+ if test "x${enable_visibility}" = "xyes" ; then\r
+ AC_MSG_ERROR([Non-GNU / SUN compilers are currently unsupported])\r
+ else\r
+ AC_MSG_WARN([Non-GNU / SUN compilers are currently unsupported])\r
+ fi\r
+ ;;\r
+ esac\r
+\r
+ #\r
+ # visibility explicitly requested but not supported by this compiler => error\r
+ #\r
+ if test "x${enable_visibility}" = "xyes" -a "x${HAVE_VISIBILITY}" = "xno" ; then\r
+ AC_MSG_ERROR([API visibility not supported by this compiler])\r
+ fi\r
+fi\r
+\r
AC_SUBST(new_AM_CFLAGS)\r
AC_SUBST(new_AM_LDFLAGS)\r
\r
#define teletone_assert(expr) assert(expr)
#endif
+#if (defined(__GNUC__) || defined(__SUNCC__)) && defined(HAVE_VISIBILITY)
+#define TELETONE_API __attribute__((visibility("default")))
+#else
+#define TELETONE_API
+#endif
+
#include <libteletone_generate.h>
#include <libteletone_detect.h>
goertzel_state->fac = tdesc->fac;
}
-void teletone_goertzel_update(teletone_goertzel_state_t *goertzel_state,
+TELETONE_API void teletone_goertzel_update(teletone_goertzel_state_t *goertzel_state,
int16_t sample_buffer[],
int samples)
{
#define teletone_goertzel_result(gs) (double)(((gs)->v3 * (gs)->v3 + (gs)->v2 * (gs)->v2 - (gs)->v2 * (gs)->v3 * (gs)->fac))
-void teletone_dtmf_detect_init (teletone_dtmf_detect_state_t *dtmf_detect_state, int sample_rate)
+TELETONE_API void teletone_dtmf_detect_init (teletone_dtmf_detect_state_t *dtmf_detect_state, int sample_rate)
{
int i;
float theta;
dtmf_detect_state->mhit = 0;
}
-void teletone_multi_tone_init(teletone_multi_tone_t *mt, teletone_tone_map_t *map)
+TELETONE_API void teletone_multi_tone_init(teletone_multi_tone_t *mt, teletone_tone_map_t *map)
{
float theta = 0;
int x = 0;
}
-int teletone_multi_tone_detect (teletone_multi_tone_t *mt,
+TELETONE_API int teletone_multi_tone_detect (teletone_multi_tone_t *mt,
int16_t sample_buffer[],
int samples)
{
}
-int teletone_dtmf_detect (teletone_dtmf_detect_state_t *dtmf_detect_state,
+TELETONE_API int teletone_dtmf_detect (teletone_dtmf_detect_state_t *dtmf_detect_state,
int16_t sample_buffer[],
int samples)
{
}
-int teletone_dtmf_get (teletone_dtmf_detect_state_t *dtmf_detect_state,
+TELETONE_API int teletone_dtmf_get (teletone_dtmf_detect_state_t *dtmf_detect_state,
char *buf,
int max)
{
};
-int teletone_set_tone(teletone_generation_session_t *ts, int index, ...)
+TELETONE_API int teletone_set_tone(teletone_generation_session_t *ts, int index, ...)
{
va_list ap;
int i = 0;
}
-int teletone_set_map(teletone_tone_map_t *map, ...)
+TELETONE_API int teletone_set_map(teletone_tone_map_t *map, ...)
{
va_list ap;
int i = 0;
}
-int teletone_init_session(teletone_generation_session_t *ts, int buflen, tone_handler handler, void *user_data)
+TELETONE_API int teletone_init_session(teletone_generation_session_t *ts, int buflen, tone_handler handler, void *user_data)
{
memset(ts, 0, sizeof(*ts));
ts->rate = 8000;
return 0;
}
-int teletone_destroy_session(teletone_generation_session_t *ts)
+TELETONE_API int teletone_destroy_session(teletone_generation_session_t *ts)
{
if (ts->buffer) {
free(ts->buffer);
return 0;
}
-int teletone_mux_tones(teletone_generation_session_t *ts, teletone_tone_map_t *map)
+TELETONE_API int teletone_mux_tones(teletone_generation_session_t *ts, teletone_tone_map_t *map)
{
/*teletone_process_t period = (1.0 / ts->rate) / ts->channels;*/
int i, c;
return (char *) memcpy (new, s, len);
}
-int teletone_run(teletone_generation_session_t *ts, const char *cmd)
+TELETONE_API int teletone_run(teletone_generation_session_t *ts, const char *cmd)
{
char *data = NULL, *cur = NULL, *end = NULL;
int var = 0, LOOPING = 0;
#define SWITCH_THREAD_FUNC __stdcall
#else //not win32
#define O_BINARY 0
-#define SWITCH_DECLARE(type) type
-#define SWITCH_DECLARE_NONSTD(type) type
-#define SWITCH_MOD_DECLARE(type) type
+#if (defined(__GNUC__) || defined(__SUNCC__)) && defined(SWITCH_API_VISIBILITY)
+#define SWITCH_DECLARE(type) __attribute__((visibility("default"))) type
+#define SWITCH_DECLARE_NONSTD(type) __attribute__((visibility("default"))) type
+#define SWITCH_DECLARE_DATA __attribute__((visibility("default")))
+#define SWITCH_MOD_DECLARE(type) __attribute__((visibility("default"))) type
+#define SWITCH_MOD_DECLARE_DATA __attribute__((visibility("default")))
+#else
+#define SWITCH_DECLARE(type) type
+#define SWITCH_DECLARE_NONSTD(type) type
#define SWITCH_DECLARE_DATA
+#define SWITCH_MOD_DECLARE(type) type
#define SWITCH_MOD_DECLARE_DATA
+#endif
#define SWITCH_THREAD_FUNC
#endif
#define SWITCH_DECLARE_CONSTRUCTOR SWITCH_DECLARE_DATA