summaryrefslogtreecommitdiff
blob: fade1028301d91cb91b103b7209bc7c01d0dc627 (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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
--- xfsprogs-4.9.0/configure
+++ xfsprogs-4.9.0/configure
@@ -861,6 +861,7 @@
 enable_blkid
 enable_gettext
 enable_shared
+BUILD_CFLAGS
 BUILD_CC
 CPP
 OTOOL64
@@ -960,7 +961,9 @@
 LDFLAGS
 LIBS
 CPPFLAGS
-CPP'
+CPP
+BUILD_CC
+BUILD_CFLAGS'
 
 
 # Initialize some variables set by options.
@@ -1616,6 +1619,9 @@
   CPPFLAGS    C/C++/Objective C preprocessor flags, e.g. -I<include dir> if
               you have headers in a nonstandard directory <include dir>
   CPP         C preprocessor
+  BUILD_CC    C compiler for build tools
+  BUILD_CFLAGS
+              C compiler flags for build tools
 
 Use these variables to override the choices made by `configure' or to help
 it to find libraries and programs with nonstandard names/locations.
@@ -11116,11 +11122,12 @@
 ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
 ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
-if test $cross_compiling = no; then
-  BUILD_CC="$CC"
 
-else
-  for ac_prog in gcc cc
+if test "${BUILD_CC+set}" != "set"; then
+  if test $cross_compiling = no; then
+    BUILD_CC="$CC"
+  else
+    for ac_prog in gcc cc
 do
   # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
@@ -11162,6 +11169,15 @@
   test -n "$BUILD_CC" && break
 done
 
+  fi
+fi
+
+if test "${BUILD_CFLAGS+set}" != "set"; then
+  if test $cross_compiling = no; then
+    BUILD_CFLAGS="$CFLAGS"
+  else
+    BUILD_CFLAGS="-g -O2"
+  fi
 fi
 
 # Check whether --enable-shared was given.
--- xfsprogs-4.9.0/configure.ac
+++ xfsprogs-4.9.0/configure.ac
@@ -9,11 +9,21 @@
 AC_PROG_LIBTOOL
 
 AC_PROG_CC
-if test $cross_compiling = no; then
-  BUILD_CC="$CC"
-  AC_SUBST(BUILD_CC)
-else
-  AC_CHECK_PROGS(BUILD_CC, gcc cc)
+AC_ARG_VAR(BUILD_CC, [C compiler for build tools])
+if test "${BUILD_CC+set}" != "set"; then
+  if test $cross_compiling = no; then
+    BUILD_CC="$CC"
+  else
+    AC_CHECK_PROGS(BUILD_CC, gcc cc)
+  fi
+fi
+AC_ARG_VAR(BUILD_CFLAGS, [C compiler flags for build tools])
+if test "${BUILD_CFLAGS+set}" != "set"; then
+  if test $cross_compiling = no; then
+    BUILD_CFLAGS="$CFLAGS"
+  else
+    BUILD_CFLAGS="-g -O2"
+  fi
 fi
 
 AC_ARG_ENABLE(shared,
--- xfsprogs-4.9.0/include/builddefs.in
+++ xfsprogs-4.9.0/include/builddefs.in
@@ -26,6 +26,7 @@
 LOADERFLAGS = @LDFLAGS@
 LTLDFLAGS = @LDFLAGS@
 CFLAGS = @CFLAGS@ -D_FILE_OFFSET_BITS=64
+BUILD_CFLAGS = @BUILD_CFLAGS@ -D_FILE_OFFSET_BITS=64
 
 LIBRT = @librt@
 LIBUUID = @libuuid@
@@ -154,7 +155,7 @@
 endif
 
 
-GCFLAGS = $(OPTIMIZER) $(DEBUG) \
+GCFLAGS = $(DEBUG) \
 	  -DVERSION=\"$(PKG_VERSION)\" -DLOCALEDIR=\"$(PKG_LOCALE_DIR)\"  \
 	  -DPACKAGE=\"$(PKG_NAME)\" -I$(TOPDIR)/include -I$(TOPDIR)/libxfs
 
@@ -162,8 +163,9 @@
 GCFLAGS += -DENABLE_GETTEXT
 endif
 
+BUILD_CFLAGS += $(GCFLAGS) $(PCFLAGS)
 # First, Global, Platform, Local CFLAGS
-CFLAGS += $(FCFLAGS) $(GCFLAGS) $(PCFLAGS) $(LCFLAGS)
+CFLAGS += $(FCFLAGS) $(OPTIMIZER) $(GCFLAGS) $(PCFLAGS) $(LCFLAGS)
 
 include $(TOPDIR)/include/buildmacros
 
--- xfsprogs-4.9.0/libxfs/Makefile
+++ xfsprogs-4.9.0/libxfs/Makefile
@@ -124,7 +124,7 @@
 
 crc32table.h: gen_crc32table.c
 	@echo "    [CC]     gen_crc32table"
-	$(Q) $(BUILD_CC) $(CFLAGS) -o gen_crc32table $<
+	$(Q) $(BUILD_CC) $(BUILD_CFLAGS) -o gen_crc32table $<
 	@echo "    [GENERATE] $@"
 	$(Q) ./gen_crc32table > crc32table.h
 
@@ -135,7 +135,7 @@
 # disk.
 crc32selftest: gen_crc32table.c crc32table.h crc32.c
 	@echo "    [TEST]    CRC32"
-	$(Q) $(BUILD_CC) $(CFLAGS) -D CRC32_SELFTEST=1 crc32.c -o $@
+	$(Q) $(BUILD_CC) $(BUILD_CFLAGS) -D CRC32_SELFTEST=1 crc32.c -o $@
 	$(Q) ./$@
 
 # set up include/xfs header directory