This fixes building with ccache http://bugs.bacula.org/view.php?id=2118 diff --git a/autoconf/configure.in b/autoconf/configure.in index 47d45de..2a6a194 100644 --- a/autoconf/configure.in +++ b/autoconf/configure.in @@ -87,17 +87,6 @@ AC_PROG_CXX AC_PROG_CC_C_O dnl Determine if C compiler support -c -o. AC_PROG_GCC_TRADITIONAL dnl Determine if ioctl() need -traditional. -BASECC=`basename $CC` -have_gcc=no -if test "x$BASECC" = xgcc; then - AC_DEFINE(HAVE_GCC) - have_gcc=yes -fi -AC_PATH_PROG(CXX, $CXX, $CXX) -if test ! -e $CXX; then - AC_MSG_ERROR(Unable to find C++ compiler) -fi - dnl ------------------------------------------------------- dnl Check for programs. dnl ------------------------------------------------------ @@ -2854,10 +2843,18 @@ AC_DEFINE(FDLIBS) CFLAGS=${CFLAGS--O} -if test x$have_gcc = xyes ; then +dnl +dnl Check if gcc +dnl +AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[ + #if !defined (__GNUC__) + #error "not gcc" + #endif + ]])], [ CPPFLAGS="$CPPFLAGS -fno-strict-aliasing -fno-exceptions -fno-rtti" CFLAGS="$CFLAGS -fno-strict-aliasing -fno-exceptions -fno-rtti" -fi +]) + LDFLAGS=${LDFLAGS--O} CPPFLAGS="$CPPFLAGS" CFLAGS="$CFLAGS" diff --git a/src/findlib/file_attrs.c b/src/findlib/file_attrs.c index 9268ce1..42036bb 100644 --- a/src/findlib/file_attrs.c +++ b/src/findlib/file_attrs.c @@ -368,7 +368,7 @@ void encode_stat(char *buf, struct stat *statp, int stat_size, int32_t LinkFI, i #ifdef HAVE_TYPEOF #define plug(st, val) st = (typeof st)val #else - #if !HAVE_GCC & HAVE_SUN_OS + #if !defined(__GNUC__) & HAVE_SUN_OS /* Sun compiler does not handle templates correctly */ #define plug(st, val) st = val #elif __sgi diff --git a/src/lib/bsys.c b/src/lib/bsys.c index 40e048e..f352db0 100644 --- a/src/lib/bsys.c +++ b/src/lib/bsys.c @@ -859,7 +859,7 @@ void allow_os_suspensions() #endif -#if HAVE_BACKTRACE && HAVE_GCC +#if HAVE_BACKTRACE && defined(__GNUC__) #include #include void stack_trace() @@ -910,6 +910,6 @@ void stack_trace() } actuallyfree(stack_strings); /* malloc()ed by backtrace_symbols */ } -#else /* HAVE_BACKTRACE && HAVE_GCC */ +#else /* HAVE_BACKTRACE && defined(__GNUC__) */ void stack_trace() {} -#endif /* HAVE_BACKTRACE && HAVE_GCC */ +#endif /* HAVE_BACKTRACE && defined(__GNUC__) */