summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--configure.ac14
-rw-r--r--m4/symbol.m465
-rw-r--r--src/libreal/real_common.c7
-rw-r--r--src/libreal/real_common.h28
4 files changed, 106 insertions, 8 deletions
diff --git a/configure.ac b/configure.ac
index 542e5306e..b0bb4c3f1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2069,6 +2069,19 @@ AC_ARG_WITH([real-codecs-path],
AC_DEFINE_UNQUOTED([REAL_CODEC_PATH], ["$withval"], [Specified path for Real binary codecs])
])
+if test "x$enable_real_codecs" != "xno"; then
+ dnl For those that have a replacement, break at the first one found
+ AC_CHECK_SYMBOLS([__environ _environ environ], [break], [need_weak_aliases=yes])
+ AC_CHECK_SYMBOLS([stderr __stderrp], [break], [need_weak_aliases=yes])
+
+ dnl For these there are no replacements
+ AC_CHECK_SYMBOLS([___brk_addr __ctype_b])
+
+ if test "x$need_weak_aliases" = "xyes"; then
+ CC_ATTRIBUTE_ALIAS(, [AC_MSG_ERROR([You need weak aliases support for Real codecs on your platform])])
+ fi
+fi
+
AM_CONDITIONAL([ENABLE_REAL], [test "x$enable_real_codecs" != "xno"])
dnl --------------------------------------------
@@ -2212,7 +2225,6 @@ CC_FLAG_VISIBILITY([
AC_SUBST([VISIBILITY_FLAG])
CC_ATTRIBUTE_SENTINEL
-CC_ATTRIBUTE_ALIAS
AC_OPTIMIZATIONS
diff --git a/m4/symbol.m4 b/m4/symbol.m4
new file mode 100644
index 000000000..cb31e193b
--- /dev/null
+++ b/m4/symbol.m4
@@ -0,0 +1,65 @@
+dnl Macros to check the presence of generic (non-typed) symbols.
+dnl Copyright (c) 2007 xine project
+dnl
+dnl This program is free software; you can redistribute it and/or modify
+dnl it under the terms of the GNU General Public License as published by
+dnl the Free Software Foundation; either version 2, or (at your option)
+dnl any later version.
+dnl
+dnl This program is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+dnl GNU General Public License for more details.
+dnl
+dnl You should have received a copy of the GNU General Public License
+dnl along with this program; if not, write to the Free Software
+dnl Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+dnl 02110-1301, USA.
+dnl
+dnl As a special exception, the xine project, as copyright owner of the
+dnl macro gives unlimited permission to copy, distribute and modify the
+dnl configure scripts that are the output of Autoconf when processing the
+dnl Macro. You need not follow the terms of the GNU General Public
+dnl License when using or distributing such scripts, even though portions
+dnl of the text of the Macro appear in them. The GNU General Public
+dnl License (GPL) does govern all other use of the material that
+dnl constitutes the Autoconf Macro.
+dnl
+dnl This special exception to the GPL applies to versions of the
+dnl Autoconf Macro released by the xine project. When you make and
+dnl distribute a modified version of the Autoconf Macro, you may extend
+dnl this special exception to the GPL to apply to your modified version as
+dnl well.
+
+dnl AC_CHECK_SYMBOL - Check for a single symbol
+dnl Usage: AC_CHECK_SYMBOL([symbol], [action-if-found], [action-if-not-found])
+dnl Default action, defines HAVE_SYMBOL (with symbol capitalised) if the
+dnl symbol is present at link time.
+AC_DEFUN([AC_CHECK_SYMBOL], [
+ AC_CACHE_CHECK([for $1 symbol presence],
+ AS_TR_SH([ac_cv_symbol_$1]),
+ [AC_TRY_LINK([extern void *$1;], [void *tmp = $1;],
+ [eval "AS_TR_SH([ac_cv_symbol_$1])=yes"],
+ [eval "AS_TR_SH([ac_cv_symbol_$1])=no"])
+ ])
+
+ ifelse([$2], , [AC_DEFINE_UNQUOTED(AS_TR_CPP([HAVE_$1]), [1], [Define to 1 if you have the $1 symbol.])], [$2])
+ ifelse([$3], , , [$3])
+])
+
+dnl AC_CHECK_SYMBOLS - Check for multiple symbols
+dnl Usage: AC_CHECK_SYMBOLS([symbol1 symbol2], [action-if-found], [action-if-not-found])
+AC_DEFUN([AC_CHECK_SYMBOLS], [
+ AH_CHECK_SYMBOLS([$1])
+
+ for ac_symbol in $1
+ do
+ AC_CHECK_SYMBOL($ac_symbol, [AC_DEFINE_UNQUOTED(AS_TR_CPP([HAVE_$ac_symbol])) $2], [$3])
+ done
+])
+
+m4_define([AH_CHECK_SYMBOLS], [
+ m4_foreach_w([AC_Symbol], [$1],
+ [AH_TEMPLATE(AS_TR_CPP([HAVE_]m4_defn([AC_Symbol])),
+ [Define to 1 if you have the ]m4_defn([AC_Symbol])[ symbol.])])
+]) \ No newline at end of file
diff --git a/src/libreal/real_common.c b/src/libreal/real_common.c
index dbe528ee0..7110198db 100644
--- a/src/libreal/real_common.c
+++ b/src/libreal/real_common.c
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: real_common.c,v 1.10 2007/03/16 22:49:16 dgp85 Exp $
+ * $Id: real_common.c,v 1.11 2007/03/17 06:11:30 dgp85 Exp $
*
* Common function for the thin layer to use Real binary-only codecs in xine
*/
@@ -62,8 +62,11 @@ void __pure_virtual(void) {
#endif
-#ifdef __FreeBSD__ /* TODO: alias them if at all possible */
+#ifndef HAVE____BRK_ADDR
void ___brk_addr(void) { exit(0); }
+#endif
+
+#ifndef HAVE___CTYPE_B
void __ctype_b(void) { exit(0); }
#endif
diff --git a/src/libreal/real_common.h b/src/libreal/real_common.h
index 86cf4a63f..7fcd1c4fa 100644
--- a/src/libreal/real_common.h
+++ b/src/libreal/real_common.h
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: real_common.h,v 1.5 2007/03/16 22:46:49 dgp85 Exp $
+ * $Id: real_common.h,v 1.6 2007/03/17 06:11:31 dgp85 Exp $
*
* Common function for the thin layer to use Real binary-only codecs in xine
*/
@@ -44,13 +44,31 @@ void __pure_virtual(void) EXPORTED;
#endif
-#ifdef __FreeBSD__
- #ifdef SUPPORT_ATTRIBUTE_ALIAS
-char **__environ __attribute__((weak, alias("environ")));
+#ifndef HAVE___ENVIRON
+# ifdef HAVE__ENVIRON
+ char **__environ __attribute__((weak, alias("_environ")));
+# elif defined(HAVE_ENVIRON)
+ char **__environ __attribute__((weak, alias("environ")));
+# else
+ char **fake__environ = { NULL };
+ char **__environ __attribute__((weak, alias("fake__environ")));
+# endif
+#endif
+
+#ifndef HAVE_STDERR
+# ifdef HAVE___STDERRP
+# undef stderr
FILE *stderr __attribute__((weak, alias("__stderrp")));
+# else
+# error Your stderr alias is not supported, please report to xine developers.
+# endif
+#endif
- #endif
+#ifndef HAVE____BRK_ADDR
void ___brk_addr(void) EXPORTED;
+#endif
+
+#ifndef HAVE___CTYPE_B
void __ctype_b(void) EXPORTED;
#endif