aboutsummaryrefslogtreecommitdiffstats
path: root/main/bacula/configure-detect-gcc.patch
blob: 2d0c647da768e9993b8320f8b8c9bf2aad903b49 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
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 <cxxabi.h>
 #include <execinfo.h>
 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__) */