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/
........

Merged revisions 425964 from http://svn.asterisk.org/svn/asterisk/branches/12
........

Merged revisions 425965 from http://svn.asterisk.org/svn/asterisk/branches/13


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@425966 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
George Joseph 2014-10-19 17:09:38 +00:00
parent 404b6ab3ab
commit 5e10e369b1
5 changed files with 309 additions and 242 deletions

View File

@ -104,7 +104,7 @@ export PYTHON
# 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

524
configure vendored

File diff suppressed because it is too large Load Diff

View File

@ -192,6 +192,25 @@ esac
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)
if test ! x"${UNAME}" = xNo; then

View File

@ -1289,6 +1289,11 @@
/* Define to 1 if running on Darwin. */
#undef _DARWIN_UNLIMITED_SELECT
/* Enable large inode numbers on Mac OS X 10.5. */
#ifndef _DARWIN_USE_64_BIT_INODE
# define _DARWIN_USE_64_BIT_INODE 1
#endif
/* Number of bits in a file offset, on hosts where this is settable. */
#undef _FILE_OFFSET_BITS

View File

@ -60,6 +60,7 @@ PTHREAD_LIBS=@PTHREAD_LIBS@
CONFIG_CFLAGS=@CONFIG_CFLAGS@
CONFIG_LDFLAGS=@CONFIG_LDFLAGS@
CONFIG_SIGNED_CHAR=@CONFIG_SIGNED_CHAR@
GNU_LD=@GNU_LD@
WEAKREF=@PBX_WEAKREF@