Author: gtjoseph Date: Sun Oct 19 12:03:49 2014 New Revision: 425964 URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=425964 Log: build: Force -fsigned-char on platforms where the default for char is unsigned
gcc on the ARM platform defaults 'char' to 'unsigned char' whereas Intel and SPARC default to 'signed char'. This is only an issue in the rare cases where negative values are assigned to a 'char' but this this patch insures compatibility by detecting platforms that default to 'unsigned' and adding an '-fsigned-char' flag to _ASTCFLAGS. If compiling for ARM (native or cross-compile) be sure to run ./bootstrap.sh and ./configure to regenerate the build files. You shouldn't have to do this for Intel or SPARC. Tested-by: George Joseph Review: https://reviewboard.asterisk.org/r/4091/ Modified: branches/12/Makefile branches/12/configure branches/12/configure.ac branches/12/makeopts.in Modified: branches/12/Makefile URL: http://svnview.digium.com/svn/asterisk/branches/12/Makefile?view=diff&rev=425964&r1=425963&r2=425964 ============================================================================== --- branches/12/Makefile (original) +++ branches/12/Makefile Sun Oct 19 12:03:49 2014 @@ -104,7 +104,7 @@ # start the primary CFLAGS and LDFLAGS with any that were provided # to the configure script -_ASTCFLAGS:=$(CONFIG_CFLAGS) +_ASTCFLAGS:=$(CONFIG_CFLAGS) $(CONFIG_SIGNED_CHAR) _ASTLDFLAGS:=$(CONFIG_LDFLAGS) # Some build systems, such as the one in openwrt, like to pass custom target Modified: branches/12/configure.ac URL: http://svnview.digium.com/svn/asterisk/branches/12/configure.ac?view=diff&rev=425964&r1=425963&r2=425964 ============================================================================== --- branches/12/configure.ac (original) +++ branches/12/configure.ac Sun Oct 19 12:03:49 2014 @@ -191,6 +191,25 @@ AC_SUBST(OSARCH) AC_SUBST(PBX_WINARCH) + +AC_MSG_CHECKING(whether char is unsigned) +AC_COMPILE_IFELSE( + [ + AC_LANG_SOURCE( +#include <limits.h> +#if CHAR_MIN == 0 +#error +#endif + ) + ],[ + AC_MSG_RESULT(no) + CONFIG_SIGNED_CHAR="" + ],[ + AC_MSG_RESULT(yes) + CONFIG_SIGNED_CHAR="-fsigned-char" + ] +) +AC_SUBST(CONFIG_SIGNED_CHAR) # check for uname AC_PATH_TOOL([UNAME], [uname], No) Modified: branches/12/makeopts.in URL: http://svnview.digium.com/svn/asterisk/branches/12/makeopts.in?view=diff&rev=425964&r1=425963&r2=425964 ============================================================================== --- branches/12/makeopts.in (original) +++ branches/12/makeopts.in Sun Oct 19 12:03:49 2014 @@ -60,6 +60,7 @@ CONFIG_CFLAGS=@CONFIG_CFLAGS@ CONFIG_LDFLAGS=@CONFIG_LDFLAGS@ +CONFIG_SIGNED_CHAR=@CONFIG_SIGNED_CHAR@ GNU_LD=@GNU_LD@ WEAKREF=@PBX_WEAKREF@ -- _____________________________________________________________________ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- svn-commits mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/svn-commits
