From 412a20921894c3d1320aa2edd65467f3b384aef6 Mon Sep 17 00:00:00 2001 From: "zodiac@gmail.com" Date: Wed, 29 Sep 2010 00:33:44 +0000 Subject: [PATCH] Added support for building with toolchains that don't support symbol aliasing. git-svn-id: https://shellinabox.googlecode.com/svn/trunk@229 0da03de8-d603-11dd-86c2-0f8696b7b6f9 --- config.h | 5 ++++- config.h.in | 3 +++ configure | 22 +++++++++++++++++++++- configure.ac | 9 ++++++++- demo/vt100.js | 2 +- logging/logging.c | 11 +++++++++++ shellinabox/shell_in_a_box.js | 2 +- shellinabox/vt100.js | 2 +- 8 files changed, 50 insertions(+), 6 deletions(-) diff --git a/config.h b/config.h index c236166..8af3437 100644 --- a/config.h +++ b/config.h @@ -1,6 +1,9 @@ /* config.h. Generated from config.h.in by configure. */ /* config.h.in. Generated from configure.ac by autoheader. */ +/* Define to 1 if you have support for symbol aliasing */ +#define HAVE_ATTRIBUTE_ALIAS 1 + /* Set if you want support for calling /bin/login */ #define HAVE_BIN_LOGIN 1 @@ -153,7 +156,7 @@ #define STDC_HEADERS 1 /* Most recent revision number in the version control system */ -#define VCS_REVISION "228" +#define VCS_REVISION "229" /* Version number of package */ #define VERSION "2.10" diff --git a/config.h.in b/config.h.in index 483b00e..9d5e516 100644 --- a/config.h.in +++ b/config.h.in @@ -1,5 +1,8 @@ /* config.h.in. Generated from configure.ac by autoheader. */ +/* Define to 1 if you have support for symbol aliasing */ +#undef HAVE_ATTRIBUTE_ALIAS + /* Set if you want support for calling /bin/login */ #undef HAVE_BIN_LOGIN diff --git a/configure b/configure index 1c9896e..2026648 100755 --- a/configure +++ b/configure @@ -2328,7 +2328,7 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $ ac_compiler_gnu=$ac_cv_c_compiler_gnu -VCS_REVISION=228 +VCS_REVISION=229 cat >>confdefs.h <<_ACEOF @@ -10766,6 +10766,26 @@ if ac_fn_c_try_link "$LINENO"; then : $as_echo "#define HAVE_UPDWTMPX 1" >>confdefs.h +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +void x(void) { }; + void y(void) __attribute__((alias("x"))); +int +main () +{ +y(); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + +$as_echo "#define HAVE_ATTRIBUTE_ALIAS 1" >>confdefs.h + fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext diff --git a/configure.ac b/configure.ac index 24a2e8a..20c2ee8 100644 --- a/configure.ac +++ b/configure.ac @@ -2,7 +2,7 @@ AC_PREREQ(2.57) dnl This is the one location where the authoritative version number is stored AC_INIT(shellinabox, 2.10, markus@shellinabox.com) -VCS_REVISION=228 +VCS_REVISION=229 AC_SUBST(VCS_REVISION) AC_DEFINE_UNQUOTED(VCS_REVISION, "${VCS_REVISION}", [Most recent revision number in the version control system]) @@ -71,6 +71,13 @@ AC_TRY_LINK([#include ], [AC_DEFINE(HAVE_UPDWTMPX, 1, Define to 1 if you have support for updwtmpx)]) +dnl Check if the compiler supports aliasing of symbols +AC_TRY_LINK([void x(void) { }; + void y(void) __attribute__((alias("x")));], + [y();], + [AC_DEFINE(HAVE_ATTRIBUTE_ALIAS, 1, + Define to 1 if you have support for symbol aliasing)]) + dnl On some systems, calling /bin/login does not work. Disable the LOGIN dnl feature, if the user tells us that it does not do the right thing. AC_ARG_ENABLE(login, diff --git a/demo/vt100.js b/demo/vt100.js index 0cab41f..b965626 100644 --- a/demo/vt100.js +++ b/demo/vt100.js @@ -2402,7 +2402,7 @@ VT100.prototype.toggleCursorBlinking = function() { }; VT100.prototype.about = function() { - alert("VT100 Terminal Emulator " + "2.10 (revision 228)" + + alert("VT100 Terminal Emulator " + "2.10 (revision 229)" + "\nCopyright 2008-2010 by Markus Gutschke\n" + "For more information check http://shellinabox.com"); }; diff --git a/logging/logging.c b/logging/logging.c index 2a806c6..532b8fa 100644 --- a/logging/logging.c +++ b/logging/logging.c @@ -180,4 +180,15 @@ char *stringPrintf(char *buf, const char *fmt, ...) { } char *stringPrintfUnchecked(char *buf, const char *fmt, ...) +#ifdef HAVE_ATTRIBUTE_ALIAS __attribute__((alias("stringPrintf"))); +#else +{ + va_list ap; + va_start(ap, fmt); + char *s = vStringPrintf(buf, fmt, ap); + va_end(ap); + return s; +} +#endif + diff --git a/shellinabox/shell_in_a_box.js b/shellinabox/shell_in_a_box.js index c9b288d..9496ec5 100644 --- a/shellinabox/shell_in_a_box.js +++ b/shellinabox/shell_in_a_box.js @@ -358,7 +358,7 @@ ShellInABox.prototype.extendContextMenu = function(entries, actions) { }; ShellInABox.prototype.about = function() { - alert("Shell In A Box version " + "2.10 (revision 228)" + + alert("Shell In A Box version " + "2.10 (revision 229)" + "\nCopyright 2008-2010 by Markus Gutschke\n" + "For more information check http://shellinabox.com" + (typeof serverSupportsSSL != 'undefined' && serverSupportsSSL ? diff --git a/shellinabox/vt100.js b/shellinabox/vt100.js index 0cab41f..b965626 100644 --- a/shellinabox/vt100.js +++ b/shellinabox/vt100.js @@ -2402,7 +2402,7 @@ VT100.prototype.toggleCursorBlinking = function() { }; VT100.prototype.about = function() { - alert("VT100 Terminal Emulator " + "2.10 (revision 228)" + + alert("VT100 Terminal Emulator " + "2.10 (revision 229)" + "\nCopyright 2008-2010 by Markus Gutschke\n" + "For more information check http://shellinabox.com"); };