Merge lp:~brianaker/libdrizzle/bootstrap-update-april-2013 into lp:libdrizzle
- bootstrap-update-april-2013
- Merge into libdrizzle-redux
Status: | Merged |
---|---|
Approved by: | Andrew Hutchings |
Approved revision: | 121 |
Merged at revision: | 121 |
Proposed branch: | lp:~brianaker/libdrizzle/bootstrap-update-april-2013 |
Merge into: | lp:libdrizzle |
Diff against target: |
1208 lines (+475/-152) 3 files modified
bootstrap.sh (+358/-127) configure.ac (+3/-0) m4/ax_harden_compiler_flags.m4 (+114/-25) |
To merge this branch: | bzr merge lp:~brianaker/libdrizzle/bootstrap-update-april-2013 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Andrew Hutchings | Approve | ||
Review via email: mp+161265@code.launchpad.net |
Commit message
Description of the change
Update bootstrap and hardening files.
Andrew Hutchings (linuxjedi) wrote : | # |
so, we have 2 problems found by the RHEL builder:
1. it appears to be a lot stricter than before (and stricter than the other builders) and firing lots of warnings
2. the test suite is now executing on that builder and is having connect timeouts which isn't a SKIP event we test for. I'm hoping this isn't a bug :/
I'll look at #1 at some point today (going to download CentOS first to try this out)
Brian Aker (brianaker) wrote : | # |
I can take a look as well. I've had to remove reachable for other
projects because of the glibc issue for the resolver.
Sent from my Ti85
On Apr 27, 2013, at 0:15, Andrew Hutchings <email address hidden> wrote:
> so, we have 2 problems found by the RHEL builder:
>
> 1. it appears to be a lot stricter than before (and stricter than the other builders) and firing lots of warnings
>
> 2. the test suite is now executing on that builder and is having connect timeouts which isn't a SKIP event we test for. I'm hoping this isn't a bug :/
>
> https:/
>
> I'll look at #1 at some point today (going to download CentOS first to try this out)
> --
> https:/
> You are the owner of lp:~brianaker/libdrizzle/bootstrap-update-april-2013.
- 122. By Brian Aker
-
Update bootstrap and disable two warning types that currently are not passable.
Brian Aker (brianaker) wrote : | # |
I am commenting out style and effc for the moment.
effc is showing a few real bugs (init issues).
Cheers,
-Brian
On Apr 26, 2013, at 11:59 PM, Andrew Hutchings <email address hidden> wrote:
> The proposal to merge lp:~brianaker/libdrizzle/bootstrap-update-april-2013 into lp:libdrizzle has been updated.
>
> Status: Needs review => Approved
>
> For more details, see:
> https:/
> --
> https:/
> You are the owner of lp:~brianaker/libdrizzle/bootstrap-update-april-2013.
Preview Diff
1 | === modified file 'bootstrap.sh' |
2 | --- bootstrap.sh 2013-01-10 12:04:23 +0000 |
3 | +++ bootstrap.sh 2013-04-27 15:24:24 +0000 |
4 | @@ -1,6 +1,6 @@ |
5 | #!/bin/bash |
6 | # |
7 | -# Copyright (C) 2012 Brian Aker |
8 | +# Copyright (C) 2012-2013 Brian Aker |
9 | # All rights reserved. |
10 | # |
11 | # Redistribution and use in source and binary forms, with or without |
12 | @@ -151,7 +151,8 @@ |
13 | fi |
14 | } |
15 | |
16 | -# Valid values are: darwin,fedora,rhel,ubuntu |
17 | +# Validate the distribution name, or toss an erro |
18 | +# values: darwin,fedora,rhel,ubuntu,debian,opensuse |
19 | function set_VENDOR_DISTRIBUTION () |
20 | { |
21 | local dist=`echo "$1" | tr '[A-Z]' '[a-z]'` |
22 | @@ -165,9 +166,15 @@ |
23 | rhel) |
24 | VENDOR_DISTRIBUTION='rhel' |
25 | ;; |
26 | + debian) |
27 | + VENDOR_DISTRIBUTION='debian' |
28 | + ;; |
29 | ubuntu) |
30 | VENDOR_DISTRIBUTION='ubuntu' |
31 | ;; |
32 | + suse) |
33 | + VENDOR_DISTRIBUTION='opensuse' |
34 | + ;; |
35 | opensuse) |
36 | VENDOR_DISTRIBUTION='opensuse' |
37 | ;; |
38 | @@ -177,21 +184,57 @@ |
39 | esac |
40 | } |
41 | |
42 | +# Validate a Vendor's release name/number |
43 | function set_VENDOR_RELEASE () |
44 | { |
45 | local release=`echo "$1" | tr '[A-Z]' '[a-z]'` |
46 | - case "$VENDOR_DISTRIBUTION" in |
47 | + |
48 | + if $DEBUG; then |
49 | + echo "VENDOR_DISTRIBUTION:$VENDOR_DISTRIBUTION" |
50 | + echo "VENDOR_RELEASE:$release" |
51 | + fi |
52 | + |
53 | + case $VENDOR_DISTRIBUTION in |
54 | darwin) |
55 | - VENDOR_RELEASE='mountain' |
56 | + case $release in |
57 | + 10.6*) |
58 | + VENDOR_RELEASE='snow_leopard' |
59 | + ;; |
60 | + 10.7*) |
61 | + VENDOR_RELEASE='mountain' |
62 | + ;; |
63 | + mountain) |
64 | + VENDOR_RELEASE='mountain' |
65 | + ;; |
66 | + 10.8.*) |
67 | + echo "mountain_lion" |
68 | + VENDOR_RELEASE='mountain_lion' |
69 | + ;; |
70 | + *) |
71 | + echo $VENDOR_RELEASE |
72 | + VENDOR_RELEASE='unknown' |
73 | + ;; |
74 | + esac |
75 | ;; |
76 | fedora) |
77 | VENDOR_RELEASE="$release" |
78 | + if [[ "x$VENDOR_RELEASE" == '18' ]]; then |
79 | + VENDOR_RELEASE='sphericalcow' |
80 | + fi |
81 | ;; |
82 | rhel) |
83 | VENDOR_RELEASE="$release" |
84 | ;; |
85 | + debian) |
86 | + VENDOR_RELEASE="$release" |
87 | + ;; |
88 | ubuntu) |
89 | VENDOR_RELEASE="$release" |
90 | + if [[ "x$VENDOR_RELEASE" == 'x12.04' ]]; then |
91 | + VENDOR_RELEASE="precise" |
92 | + elif [[ "x$VENDOR_RELEASE" == 'x12.10' ]]; then |
93 | + VENDOR_RELEASE="quantal" |
94 | + fi |
95 | ;; |
96 | opensuse) |
97 | VENDOR_RELEASE="$release" |
98 | @@ -206,7 +249,7 @@ |
99 | } |
100 | |
101 | |
102 | -# Valid values are: apple, redhat, centos, canonical |
103 | +# Valid values are: apple, redhat, centos, canonical, oracle, suse |
104 | function set_VENDOR () |
105 | { |
106 | local vendor=`echo "$1" | tr '[A-Z]' '[a-z]'` |
107 | @@ -218,12 +261,30 @@ |
108 | redhat) |
109 | VENDOR='redhat' |
110 | ;; |
111 | + fedora) |
112 | + VENDOR='redhat' |
113 | + ;; |
114 | + redhat-release-server-*) |
115 | + VENDOR='redhat' |
116 | + ;; |
117 | + enterprise-release-*) |
118 | + VENDOR='oracle' |
119 | + ;; |
120 | centos) |
121 | VENDOR='centos' |
122 | ;; |
123 | canonical) |
124 | VENDOR='canonical' |
125 | ;; |
126 | + ubuntu) |
127 | + VENDOR='canonical' |
128 | + ;; |
129 | + debian) |
130 | + VENDOR='debian' |
131 | + ;; |
132 | + opensuse) |
133 | + VENDOR='suse' |
134 | + ;; |
135 | suse) |
136 | VENDOR='suse' |
137 | ;; |
138 | @@ -234,6 +295,27 @@ |
139 | |
140 | set_VENDOR_DISTRIBUTION $2 |
141 | set_VENDOR_RELEASE $3 |
142 | + |
143 | + # Set which vendor/versions we trust for autoreconf |
144 | + case $VENDOR_DISTRIBUTION in |
145 | + fedora) |
146 | + if [[ "x$VENDOR_RELEASE" == 'x18' ]]; then |
147 | + AUTORECONF_REBUILD_HOST=true |
148 | + elif [[ "x$VENDOR_RELEASE" == 'xsphericalcow' ]]; then |
149 | + AUTORECONF_REBUILD_HOST=true |
150 | + elif [[ "x$VENDOR_RELEASE" == 'x19' ]]; then |
151 | + AUTORECONF_REBUILD_HOST=true |
152 | + fi |
153 | + ;; |
154 | + canonical) |
155 | + if [[ "x$VENDOR_RELEASE" == 'xprecise' ]]; then |
156 | + AUTORECONF_REBUILD_HOST=true |
157 | + elif [[ "x$VENDOR_RELEASE" == 'xquantal' ]]; then |
158 | + AUTORECONF_REBUILD_HOST=true |
159 | + fi |
160 | + ;; |
161 | + esac |
162 | + |
163 | } |
164 | |
165 | function determine_target_platform () |
166 | @@ -242,14 +324,14 @@ |
167 | UNAME_KERNEL=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown |
168 | UNAME_KERNEL_RELEASE=`(uname -r) 2>/dev/null` || UNAME_KERNEL_RELEASE=unknown |
169 | |
170 | - if [[ $(uname) == 'Darwin' ]]; then |
171 | + if [[ -x '/usr/bin/sw_vers' ]]; then |
172 | + local _VERSION=`/usr/bin/sw_vers -productVersion` |
173 | + set_VENDOR 'apple' 'darwin' $_VERSION |
174 | + elif [[ $(uname) == 'Darwin' ]]; then |
175 | set_VENDOR 'apple' 'darwin' 'mountain' |
176 | elif [[ -f '/etc/fedora-release' ]]; then |
177 | local fedora_version=`cat /etc/fedora-release | awk ' { print $3 } '` |
178 | set_VENDOR 'redhat' 'fedora' $fedora_version |
179 | - if [[ "x$VENDOR_RELEASE" == 'x17' ]]; then |
180 | - AUTORECONF_REBUILD_HOST=true |
181 | - fi |
182 | elif [[ -f '/etc/centos-release' ]]; then |
183 | local centos_version=`cat /etc/centos-release | awk ' { print $7 } '` |
184 | set_VENDOR 'centos' 'rhel' $centos_version |
185 | @@ -259,14 +341,18 @@ |
186 | set_VENDOR 'suse' $suse_distribution $suse_version |
187 | elif [[ -f '/etc/redhat-release' ]]; then |
188 | local rhel_version=`cat /etc/redhat-release | awk ' { print $7 } '` |
189 | - set_VENDOR 'redhat' 'rhel' $rhel_version |
190 | + local _vendor=`rpm -qf /etc/redhat-release` |
191 | + set_VENDOR $_vendor 'rhel' $rhel_version |
192 | + elif [[ -f '/etc/os-release' ]]; then |
193 | + source '/etc/os-release' |
194 | + set_VENDOR $ID $ID $VERSION_ID |
195 | + elif [[ -x '/usr/bin/lsb_release' ]]; then |
196 | + local _ID=`/usr/bin/lsb_release -s -i` |
197 | + local _VERSION=`/usr/bin/lsb_release -s -r` |
198 | + set_VENDOR $_ID $_ID $_VERSION_ID |
199 | elif [[ -f '/etc/lsb-release' ]]; then |
200 | - local debian_DISTRIB_ID=`cat /etc/lsb-release | grep DISTRIB_ID | awk -F= ' { print $2 } '` |
201 | - local debian_version=`cat /etc/lsb-release | grep DISTRIB_CODENAME | awk -F= ' { print $2 } '` |
202 | - set_VENDOR 'canonical' $debian_DISTRIB_ID $debian_version |
203 | - if [[ "x$VENDOR_RELEASE" == 'xprecise' ]]; then |
204 | - AUTORECONF_REBUILD_HOST=true |
205 | - fi |
206 | + source '/etc/lsb-release' |
207 | + set_VENDOR 'canonical' $DISTRIB_ID $DISTRIB_CODENAME |
208 | fi |
209 | |
210 | rebuild_host_os |
211 | @@ -296,42 +382,48 @@ |
212 | # Arguments for configure |
213 | local BUILD_CONFIGURE_ARG= |
214 | |
215 | - # Set ENV DEBUG in order to enable debugging |
216 | - if $DEBUG; then |
217 | - BUILD_CONFIGURE_ARG='--enable-debug' |
218 | - fi |
219 | - |
220 | - # Set ENV ASSERT in order to enable assert |
221 | - if [[ -n "$ASSERT" ]]; then |
222 | - local ASSERT_ARG= |
223 | - ASSERT_ARG='--enable-assert' |
224 | - BUILD_CONFIGURE_ARG="$ASSERT_ARG $BUILD_CONFIGURE_ARG" |
225 | + # If ENV DEBUG is set we enable both debug and asssert, otherwise we see if this is a VCS checkout and if so enable assert |
226 | + # Set ENV ASSERT in order to enable assert. |
227 | + # If we are doing a valgrind run, we always compile with assert disabled |
228 | + if $valgrind_run; then |
229 | + BUILD_CONFIGURE_ARG+= " CXXFLAGS=-DNDEBUG " |
230 | + BUILD_CONFIGURE_ARG+= " CFLAGS=-DNDEBUG " |
231 | + else |
232 | + if $DEBUG; then |
233 | + BUILD_CONFIGURE_ARG+=' --enable-debug --enable-assert' |
234 | + elif [[ -n "$VCS_CHECKOUT" ]]; then |
235 | + BUILD_CONFIGURE_ARG+=' --enable-assert' |
236 | + fi |
237 | fi |
238 | |
239 | if [[ -n "$CONFIGURE_ARG" ]]; then |
240 | - BUILD_CONFIGURE_ARG= "$BUILD_CONFIGURE_ARG $CONFIGURE_ARG" |
241 | + BUILD_CONFIGURE_ARG+=" $CONFIGURE_ARG" |
242 | + fi |
243 | + |
244 | + if [[ -n "$PREFIX_ARG" ]]; then |
245 | + BUILD_CONFIGURE_ARG+=" $PREFIX_ARG" |
246 | fi |
247 | |
248 | ret=1; |
249 | # If we are executing on OSX use CLANG, otherwise only use it if we find it in the ENV |
250 | case $HOST_OS in |
251 | *-darwin-*) |
252 | - CC=clang CXX=clang++ $top_srcdir/configure $BUILD_CONFIGURE_ARG || die "Cannot execute CC=clang CXX=clang++ configure $BUILD_CONFIGURE_ARG $PREFIX_ARG" |
253 | + CC=clang CXX=clang++ $top_srcdir/configure $BUILD_CONFIGURE_ARG || die "Cannot execute CC=clang CXX=clang++ configure $BUILD_CONFIGURE_ARG" |
254 | ret=$? |
255 | ;; |
256 | rhel-5*) |
257 | command_exists 'gcc44' || die "Could not locate gcc44" |
258 | - CC=gcc44 CXX=gcc44 $top_srcdir/configure $BUILD_CONFIGURE_ARG $PREFIX_ARG || die "Cannot execute CC=gcc44 CXX=gcc44 configure $BUILD_CONFIGURE_ARG $PREFIX_ARG" |
259 | + CC=gcc44 CXX=gcc44 $top_srcdir/configure $BUILD_CONFIGURE_ARG || die "Cannot execute CC=gcc44 CXX=gcc44 configure $BUILD_CONFIGURE_ARG" |
260 | ret=$? |
261 | ;; |
262 | *) |
263 | - $CONFIGURE $BUILD_CONFIGURE_ARG $PREFIX_ARG |
264 | + $CONFIGURE $BUILD_CONFIGURE_ARG |
265 | ret=$? |
266 | ;; |
267 | esac |
268 | |
269 | if [ $ret -ne 0 ]; then |
270 | - die "Could not execute $CONFIGURE $BUILD_CONFIGURE_ARG $PREFIX_ARG" |
271 | + die "Could not execute $CONFIGURE $BUILD_CONFIGURE_ARG" |
272 | fi |
273 | |
274 | if [ ! -f 'Makefile' ]; then |
275 | @@ -353,7 +445,7 @@ |
276 | function setup_valgrind_command () { |
277 | VALGRIND_PROGRAM=`type -p valgrind` |
278 | if [[ -n "$VALGRIND_PROGRAM" ]]; then |
279 | - VALGRIND_COMMAND="$VALGRIND_PROGRAM --error-exitcode=1 --leak-check=yes --show-reachable=yes --track-fds=yes --malloc-fill=A5 --free-fill=DE" |
280 | + VALGRIND_COMMAND="$VALGRIND_PROGRAM --error-exitcode=1 --leak-check=yes --malloc-fill=A5 --free-fill=DE --xml=yes --xml-file=\"valgrind-%p.xml\"" |
281 | fi |
282 | } |
283 | |
284 | @@ -367,6 +459,10 @@ |
285 | die "OLD_CONFIGURE_ARG($OLD_CONFIGURE_ARG) was set on push, programmer error!" |
286 | fi |
287 | |
288 | + if [[ -n "$OLD_PREFIX" ]]; then |
289 | + die "OLD_PREFIX($OLD_PREFIX) was set on push, programmer error!" |
290 | + fi |
291 | + |
292 | if [[ -n "$OLD_MAKE" ]]; then |
293 | die "OLD_MAKE($OLD_MAKE) was set on push, programmer error!" |
294 | fi |
295 | @@ -402,6 +498,10 @@ |
296 | CONFIGURE_ARG=$OLD_CONFIGURE_ARG |
297 | fi |
298 | |
299 | + if [[ -n "$OLD_PREFIX" ]]; then |
300 | + PREFIX_ARG=$OLD_PREFIX |
301 | + fi |
302 | + |
303 | if [[ -n "$OLD_MAKE" ]]; then |
304 | MAKE=$OLD_MAKE |
305 | fi |
306 | @@ -412,56 +512,11 @@ |
307 | |
308 | OLD_CONFIGURE= |
309 | OLD_CONFIGURE_ARG= |
310 | + OLD_PREFIX= |
311 | OLD_MAKE= |
312 | OLD_TESTS_ENVIRONMENT= |
313 | - echo "reset happened" |
314 | -} |
315 | - |
316 | -function push_PREFIX_ARG () |
317 | -{ |
318 | - if [[ -n "$OLD_PREFIX_ARG" ]]; then |
319 | - die "OLD_PREFIX_ARG was set on push, programmer error!" |
320 | - fi |
321 | - |
322 | - if [[ -n "$PREFIX_ARG" ]]; then |
323 | - OLD_PREFIX_ARG=$PREFIX_ARG |
324 | - PREFIX_ARG= |
325 | - fi |
326 | - |
327 | - if [[ -n "$1" ]]; then |
328 | - PREFIX_ARG="--prefix=$1" |
329 | - fi |
330 | -} |
331 | - |
332 | -function pop_PREFIX_ARG () |
333 | -{ |
334 | - if [[ -n "$OLD_PREFIX_ARG" ]]; then |
335 | - PREFIX_ARG=$OLD_PREFIX_ARG |
336 | - OLD_PREFIX_ARG= |
337 | - else |
338 | - PREFIX_ARG= |
339 | - fi |
340 | -} |
341 | - |
342 | -function push_TESTS_ENVIRONMENT () |
343 | -{ |
344 | - if [[ -n "$OLD_TESTS_ENVIRONMENT" ]]; then |
345 | - die "OLD_TESTS_ENVIRONMENT was set on push, programmer error!" |
346 | - fi |
347 | - |
348 | - if [[ -n "$TESTS_ENVIRONMENT" ]]; then |
349 | - OLD_TESTS_ENVIRONMENT=$TESTS_ENVIRONMENT |
350 | - TESTS_ENVIRONMENT= |
351 | - fi |
352 | -} |
353 | - |
354 | -function pop_TESTS_ENVIRONMENT () |
355 | -{ |
356 | - TESTS_ENVIRONMENT= |
357 | - if [[ -n "$OLD_TESTS_ENVIRONMENT" ]]; then |
358 | - TESTS_ENVIRONMENT=$OLD_TESTS_ENVIRONMENT |
359 | - OLD_TESTS_ENVIRONMENT= |
360 | - fi |
361 | + |
362 | + export -n CC CXX |
363 | } |
364 | |
365 | function safe_pushd () |
366 | @@ -490,11 +545,6 @@ |
367 | |
368 | function make_valgrind () |
369 | { |
370 | - if [[ "$VENDOR_DISTRIBUTION" == 'darwin' ]]; then |
371 | - make_darwin_malloc |
372 | - return |
373 | - fi |
374 | - |
375 | # If the env VALGRIND_COMMAND is set then we assume it is valid |
376 | local valgrind_was_set=false |
377 | if [[ -z "$VALGRIND_COMMAND" ]]; then |
378 | @@ -512,10 +562,12 @@ |
379 | return 1 |
380 | fi |
381 | |
382 | + save_BUILD |
383 | + |
384 | + valgrind_run=true |
385 | + |
386 | # If we are required to run configure, do so now |
387 | - run_configure_if_required |
388 | - |
389 | - push_TESTS_ENVIRONMENT |
390 | + run_configure |
391 | |
392 | # If we don't have a configure, then most likely we will be missing libtool |
393 | assert_file 'configure' |
394 | @@ -525,15 +577,29 @@ |
395 | TESTS_ENVIRONMENT="$VALGRIND_COMMAND" |
396 | fi |
397 | |
398 | - make_target 'check' || return 1 |
399 | - |
400 | - pop_TESTS_ENVIRONMENT |
401 | + make_target 'check' |
402 | + ret=$? |
403 | + |
404 | + # If we aren't going to error, we will clean up our environment |
405 | + if [ "$ret" -eq 0 ]; then |
406 | + make 'distclean' |
407 | + fi |
408 | + |
409 | + valgrind_run=false |
410 | + |
411 | + restore_BUILD |
412 | + |
413 | + if [ "$ret" -ne 0 ]; then |
414 | + return 1 |
415 | + fi |
416 | } |
417 | |
418 | function make_install_system () |
419 | { |
420 | local INSTALL_LOCATION=$(mktemp -d /tmp/XXXXXXXXXX) |
421 | - push_PREFIX_ARG $INSTALL_LOCATION |
422 | + |
423 | + save_BUILD |
424 | + PREFIX_ARG="--prefix=$INSTALL_LOCATION" |
425 | |
426 | if [ ! -d $INSTALL_LOCATION ] ; then |
427 | die "ASSERT temp directory not found '$INSTALL_LOCATION'" |
428 | @@ -541,17 +607,12 @@ |
429 | |
430 | run_configure #install_buid_dir |
431 | |
432 | - push_TESTS_ENVIRONMENT |
433 | - |
434 | make_target 'install' |
435 | |
436 | make_target 'installcheck' |
437 | |
438 | make_target 'uninstall' |
439 | |
440 | - pop_TESTS_ENVIRONMENT |
441 | - pop_PREFIX_ARG |
442 | - |
443 | rm -r -f $INSTALL_LOCATION |
444 | make 'distclean' |
445 | |
446 | @@ -559,6 +620,7 @@ |
447 | die "ASSERT Makefile should not exist" |
448 | fi |
449 | |
450 | + restore_BUILD |
451 | safe_popd |
452 | } |
453 | |
454 | @@ -625,7 +687,29 @@ |
455 | return 0 |
456 | } |
457 | |
458 | -function make_skeleton_mingw () |
459 | +function check_clang () |
460 | +{ |
461 | + command_exists 'clang' |
462 | + ret=$? |
463 | + if [ "$ret" -ne 0 ]; then |
464 | + return 1 |
465 | + fi |
466 | + |
467 | + return 0 |
468 | +} |
469 | + |
470 | +function check_clang_analyzer () |
471 | +{ |
472 | + command_exists 'scan-build' |
473 | + ret=$? |
474 | + if [ "$ret" -ne 0 ]; then |
475 | + return 1 |
476 | + fi |
477 | + |
478 | + return 0 |
479 | +} |
480 | + |
481 | +function make_skeleton () |
482 | { |
483 | run_configure |
484 | ret=$? |
485 | @@ -642,8 +726,6 @@ |
486 | if command_exists 'wine'; then |
487 | TESTS_ENVIRONMENT='wine' |
488 | fi |
489 | - elif command_exists 'wineconsole'; then |
490 | - TESTS_ENVIRONMENT='wineconsole --backend=curses' |
491 | fi |
492 | |
493 | if [[ -n "$TESTS_ENVIRONMENT" ]]; then |
494 | @@ -662,9 +744,8 @@ |
495 | |
496 | function make_for_mingw () |
497 | { |
498 | - check_mingw |
499 | if ! check_mingw; then |
500 | - die 'mingw64 tools were not found' |
501 | + return 1 |
502 | fi |
503 | |
504 | # Make sure it is clean |
505 | @@ -678,10 +759,73 @@ |
506 | |
507 | CONFIGURE='mingw64-configure' |
508 | MAKE='mingw64-make' |
509 | - CONFIGURE_ARGS='--enable-static' |
510 | - |
511 | - make_skeleton_mingw |
512 | - ret=$? |
513 | + CONFIGURE_ARGS='--enable-static --disable-shared' |
514 | + |
515 | + make_skeleton |
516 | + ret=$? |
517 | + |
518 | + restore_BUILD |
519 | + |
520 | + return $ret |
521 | +} |
522 | + |
523 | +function make_for_clang () |
524 | +{ |
525 | + if ! check_clang; then |
526 | + return 1 |
527 | + fi |
528 | + |
529 | + # Make sure it is clean |
530 | + if [ -f Makefile -o -f configure ]; then |
531 | + make_maintainer_clean |
532 | + fi |
533 | + |
534 | + run_autoreconf |
535 | + |
536 | + save_BUILD |
537 | + |
538 | + CC=clang CXX=clang++ |
539 | + export CC CXX |
540 | + |
541 | + make_skeleton |
542 | + ret=$? |
543 | + |
544 | + make_target 'check' |
545 | + |
546 | + restore_BUILD |
547 | + |
548 | + return $ret |
549 | +} |
550 | + |
551 | +function make_for_clang_analyzer () |
552 | +{ |
553 | + if ! check_clang; then |
554 | + return 1 |
555 | + fi |
556 | + |
557 | + if ! check_clang_analyzer; then |
558 | + die 'clang-analyzer was not found' |
559 | + fi |
560 | + |
561 | + # Make sure it is clean |
562 | + if [ -f Makefile -o -f configure ]; then |
563 | + make_maintainer_clean |
564 | + fi |
565 | + |
566 | + run_autoreconf |
567 | + |
568 | + save_BUILD |
569 | + |
570 | + CC=clang CXX=clang++ |
571 | + export CC CXX |
572 | + CONFIGURE_ARGS='--enable-debug' |
573 | + |
574 | + make_skeleton |
575 | + ret=$? |
576 | + |
577 | + make_target 'clean' 'warn' |
578 | + |
579 | + scan-build -o clang-html make -j4 -k |
580 | |
581 | restore_BUILD |
582 | |
583 | @@ -710,6 +854,8 @@ |
584 | make_valgrind |
585 | make_gdb |
586 | make_rpm |
587 | + make_for_clang |
588 | + make_for_clang_analyzer |
589 | |
590 | if [ check_mingw -eq 0 ]; then |
591 | make_for_mingw |
592 | @@ -815,11 +961,11 @@ |
593 | |
594 | function make_gdb () |
595 | { |
596 | + save_BUILD |
597 | + |
598 | if command_exists 'gdb'; then |
599 | run_configure_if_required |
600 | |
601 | - push_TESTS_ENVIRONMENT |
602 | - |
603 | # Set ENV GDB_COMMAND |
604 | if [[ -z "$GDB_COMMAND" ]]; then |
605 | setup_gdb_command |
606 | @@ -839,8 +985,6 @@ |
607 | rm 'gdb.txt' |
608 | fi |
609 | |
610 | - pop_TESTS_ENVIRONMENT |
611 | - |
612 | if [ -f '.gdb_history' ]; then |
613 | rm '.gdb_history' |
614 | fi |
615 | @@ -852,6 +996,8 @@ |
616 | echo 'gdb was not present' |
617 | return 1 |
618 | fi |
619 | + |
620 | + restore_BUILD |
621 | } |
622 | |
623 | # $1 target to compile |
624 | @@ -883,9 +1029,9 @@ |
625 | |
626 | if [ $ret -ne 0 ]; then |
627 | if [ -n "$2" ]; then |
628 | - warn "Cannot execute $MAKE $1: $ret" |
629 | + warn "Failed to execute $MAKE $1: $ret" |
630 | else |
631 | - die "Cannot execute $MAKE $1: $ret" |
632 | + die "Failed to execute $MAKE $1: $ret" |
633 | fi |
634 | fi |
635 | |
636 | @@ -951,6 +1097,13 @@ |
637 | assert_file 'Makefile' 'configure did not produce a Makefile' |
638 | } |
639 | |
640 | +function run_make_maintainer_clean_if_possible () |
641 | +{ |
642 | + if [ -f 'Makefile' ]; then |
643 | + make_maintainer_clean |
644 | + fi |
645 | +} |
646 | + |
647 | function run_autoreconf_if_required () |
648 | { |
649 | if [ ! -x 'configure' ]; then |
650 | @@ -958,6 +1111,7 @@ |
651 | fi |
652 | |
653 | assert_exec_file 'configure' |
654 | + bash -n configure |
655 | } |
656 | |
657 | function run_autoreconf () |
658 | @@ -971,7 +1125,7 @@ |
659 | run $BOOTSTRAP_LIBTOOLIZE '--copy' '--install' '--force' || die "Cannot execute $BOOTSTRAP_LIBTOOLIZE" |
660 | fi |
661 | |
662 | - run $AUTORECONF || die "Cannot execute $AUTORECONF" |
663 | + run $AUTORECONF $AUTORECONF_ARGS || die "Cannot execute $AUTORECONF" |
664 | |
665 | eval 'bash -n configure' || die "autoreconf generated a malformed configure" |
666 | } |
667 | @@ -1023,6 +1177,14 @@ |
668 | ;; |
669 | h) # help |
670 | echo "bootstrap.sh [options] optional_target ..." |
671 | + echo " -a # Just run autoreconf"; |
672 | + echo " -p # Print ENV"; |
673 | + echo " -c # Just run configure"; |
674 | + echo " -m # Just run maintainer-clean"; |
675 | + echo " -t # Make target"; |
676 | + echo " -d # Enable debug"; |
677 | + echo " -h # Show help"; |
678 | + echo " -v # Be more verbose in output"; |
679 | exit |
680 | ;; |
681 | v) # verbose |
682 | @@ -1057,6 +1219,8 @@ |
683 | VCS_CHECKOUT=svn |
684 | elif [[ -d '.hg' ]]; then |
685 | VCS_CHECKOUT=hg |
686 | + else |
687 | + VCS_CHECKOUT= |
688 | fi |
689 | |
690 | if [[ -n "$VCS_CHECKOUT" ]]; then |
691 | @@ -1122,6 +1286,7 @@ |
692 | |
693 | if [[ -z "$BOOTSTRAP_LIBTOOLIZE" ]]; then |
694 | echo "Couldn't find user supplied libtoolize, it is required" |
695 | + return 1 |
696 | fi |
697 | else |
698 | # If we are using OSX, we first check to see glibtoolize is available |
699 | @@ -1130,21 +1295,27 @@ |
700 | |
701 | if [[ -z "$BOOTSTRAP_LIBTOOLIZE" ]]; then |
702 | echo "Couldn't find glibtoolize, it is required on OSX" |
703 | + return 1 |
704 | fi |
705 | else |
706 | BOOTSTRAP_LIBTOOLIZE=`type -p libtoolize` |
707 | |
708 | if [[ -z "$BOOTSTRAP_LIBTOOLIZE" ]]; then |
709 | echo "Couldn't find libtoolize, it is required" |
710 | + return 1 |
711 | fi |
712 | fi |
713 | fi |
714 | + |
715 | if $VERBOSE; then |
716 | LIBTOOLIZE_OPTIONS="--verbose $BOOTSTRAP_LIBTOOLIZE_OPTIONS" |
717 | fi |
718 | + |
719 | if $DEBUG; then |
720 | LIBTOOLIZE_OPTIONS="--debug $BOOTSTRAP_LIBTOOLIZE_OPTIONS" |
721 | fi |
722 | + |
723 | + # Here we set LIBTOOLIZE to true since we are going to invoke it via BOOTSTRAP_LIBTOOLIZE |
724 | LIBTOOLIZE=true |
725 | fi |
726 | |
727 | @@ -1182,7 +1353,7 @@ |
728 | fi |
729 | |
730 | if [[ -n "$GNU_BUILD_FLAGS" ]]; then |
731 | - AUTORECONF="$AUTORECONF $GNU_BUILD_FLAGS" |
732 | + AUTORECONF_ARGS="$GNU_BUILD_FLAGS" |
733 | fi |
734 | fi |
735 | |
736 | @@ -1200,6 +1371,9 @@ |
737 | echo 'BOOTSTRAP ENV' |
738 | echo "AUTORECONF=$AUTORECONF" |
739 | echo "HOST_OS=$HOST_OS" |
740 | + echo "VENDOR=$VENDOR" |
741 | + echo "VENDOR_DISTRIBUTION=$VENDOR_DISTRIBUTION" |
742 | + echo "VENDOR_RELEASE=$VENDOR_RELEASE" |
743 | |
744 | echo "getopt()" |
745 | if $AUTORECONF_OPTION; then |
746 | @@ -1333,18 +1507,25 @@ |
747 | ;; |
748 | 'make_default') |
749 | ;; |
750 | - 'test-*') |
751 | - ;; |
752 | - 'valgrind-*') |
753 | - ;; |
754 | - 'gdb-*') |
755 | + 'clang') |
756 | + ;; |
757 | + 'clang-analyzer') |
758 | + ;; |
759 | + test-*) |
760 | + ;; |
761 | + valgrind-*) |
762 | + ;; |
763 | + gdb-*) |
764 | ;; |
765 | 'dist') |
766 | ;; |
767 | *) |
768 | - die "Unknown MAKE_TARGET option: $1" |
769 | + echo "Matched default" |
770 | + return 1 |
771 | ;; |
772 | esac |
773 | + |
774 | + return 0 |
775 | } |
776 | |
777 | function bootstrap () |
778 | @@ -1355,7 +1536,9 @@ |
779 | |
780 | # Set up whatever we need to do to use autoreconf later |
781 | require_libtoolise |
782 | - autoreconf_setup |
783 | + if ! autoreconf_setup; then |
784 | + return 1 |
785 | + fi |
786 | |
787 | if [ -z "$MAKE_TARGET" ]; then |
788 | MAKE_TARGET="make_default" |
789 | @@ -1377,7 +1560,7 @@ |
790 | |
791 | # Set ENV PREFIX in order to set --prefix for ./configure |
792 | if [[ -n "$PREFIX" ]]; then |
793 | - push_PREFIX_ARG $PREFIX |
794 | + PREFIX_ARG="--prefix=$PREFIX" |
795 | fi |
796 | |
797 | # We should always have a target by this point |
798 | @@ -1390,8 +1573,15 @@ |
799 | # If we are running inside of Jenkins, we want to only run some of the possible tests |
800 | if $jenkins_build_environment; then |
801 | check_make_target $target |
802 | + ret=$? |
803 | + if [ $ret -ne 0 ]; then |
804 | + die "Unknown MAKE_TARGET option: $target" |
805 | + fi |
806 | fi |
807 | |
808 | + local snapshot_run=false |
809 | + local valgrind_run=false |
810 | + |
811 | case $target in |
812 | 'self') |
813 | self_test |
814 | @@ -1417,26 +1607,48 @@ |
815 | 'make_default') |
816 | make_default |
817 | ;; |
818 | + 'clang') |
819 | + if ! check_clang; then |
820 | + die "clang was not found" |
821 | + fi |
822 | + |
823 | + if ! make_for_clang; then |
824 | + die "Failed to build clang: $?" |
825 | + fi |
826 | + ;; |
827 | + 'clang-analyzer') |
828 | + if ! check_clang_analyzer; then |
829 | + die "clang-analyzer was not found" |
830 | + fi |
831 | + if ! check_clang; then |
832 | + die "clang was not found" |
833 | + fi |
834 | + |
835 | + if ! make_for_clang_analyzer; then |
836 | + die "Failed to build clang-analyzer: $?" |
837 | + fi |
838 | + ;; |
839 | 'mingw') |
840 | - check_mingw |
841 | if ! check_mingw; then |
842 | die "mingw was not found" |
843 | fi |
844 | |
845 | - make_for_mingw |
846 | - check_ret=$? |
847 | - |
848 | if ! make_for_mingw; then |
849 | die "Failed to build mingw: $?" |
850 | fi |
851 | ;; |
852 | 'snapshot') |
853 | make_for_snapshot |
854 | + snapshot_run=true |
855 | ;; |
856 | 'rpm') |
857 | make_rpm |
858 | ;; |
859 | + 'darwin_malloc') |
860 | + make_darwin_malloc |
861 | + ;; |
862 | 'valgrind') |
863 | + make_maintainer_clean |
864 | make_valgrind |
865 | ;; |
866 | 'universe') |
867 | @@ -1450,6 +1662,13 @@ |
868 | make_target "$target" |
869 | ;; |
870 | esac |
871 | + |
872 | + if $jenkins_build_environment; then |
873 | + if ! $snapshot_run; then |
874 | + run_make_maintainer_clean_if_possible |
875 | + fi |
876 | + fi |
877 | + |
878 | done |
879 | } |
880 | |
881 | @@ -1474,6 +1693,7 @@ |
882 | |
883 | local OLD_CONFIGURE= |
884 | local OLD_CONFIGURE_ARG= |
885 | + local OLD_PREFIX= |
886 | local OLD_MAKE= |
887 | local OLD_TESTS_ENVIRONMENT= |
888 | |
889 | @@ -1517,7 +1737,16 @@ |
890 | # We don't want Jenkins overriding other variables, so we NULL them. |
891 | if [ -z "$MAKE_TARGET" ]; then |
892 | if $jenkins_build_environment; then |
893 | - MAKE_TARGET='jenkins' |
894 | + if [[ -n "$label" ]]; then |
895 | + check_make_target $label |
896 | + if [ $? -eq 0 ]; then |
897 | + MAKE_TARGET="$label" |
898 | + fi |
899 | + fi |
900 | + |
901 | + if [ -z "$MAKE_TARGET" ]; then |
902 | + MAKE_TARGET='check' |
903 | + fi |
904 | fi |
905 | fi |
906 | |
907 | @@ -1620,11 +1849,13 @@ |
908 | export AUTOM4TE |
909 | export AUTOMAKE |
910 | export AUTORECONF |
911 | +export CONFIGURE_ARG |
912 | export DEBUG |
913 | export GNU_BUILD_FLAGS |
914 | export LIBTOOLIZE |
915 | export LIBTOOLIZE_OPTIONS |
916 | export MAKE |
917 | +export PREFIX_ARG |
918 | export TESTS_ENVIRONMENT |
919 | export VERBOSE |
920 | export WARNINGS |
921 | |
922 | === modified file 'configure.ac' |
923 | --- configure.ac 2013-04-25 10:26:18 +0000 |
924 | +++ configure.ac 2013-04-27 15:24:24 +0000 |
925 | @@ -44,6 +44,9 @@ |
926 | LT_INIT |
927 | LT_LANG([C++]) |
928 | |
929 | +AC_PROG_CC_C99 |
930 | +AS_IF([test "x${ac_cv_prog_cc_c99}" == "xno"],[AC_MSG_ERROR([No c99 compatible compiler found])]) |
931 | + |
932 | AX_PLATFORM |
933 | AX_ASSERT |
934 | |
935 | |
936 | === modified file 'm4/ax_harden_compiler_flags.m4' |
937 | --- m4/ax_harden_compiler_flags.m4 2013-04-26 19:50:55 +0000 |
938 | +++ m4/ax_harden_compiler_flags.m4 2013-04-27 15:24:24 +0000 |
939 | @@ -1,3 +1,4 @@ |
940 | +# vim:expandtab:shiftwidth=2:tabstop=2:smarttab: |
941 | # =========================================================================== |
942 | # https://github.com/BrianAker/ddm4/ |
943 | # =========================================================================== |
944 | @@ -14,7 +15,7 @@ |
945 | # |
946 | # LICENSE |
947 | # |
948 | -# Copyright (C) 2012 Brian Aker |
949 | +# Copyright (C) 2012-2013 Brian Aker |
950 | # All rights reserved. |
951 | # |
952 | # Redistribution and use in source and binary forms, with or without |
953 | @@ -52,7 +53,7 @@ |
954 | # ? _APPEND_COMPILE_FLAGS_ERROR([-Wlong-long]) -- Don't turn on for |
955 | # compatibility issues memcached_stat_st |
956 | |
957 | -#serial 7 |
958 | +#serial 9 |
959 | |
960 | AC_DEFUN([_WARNINGS_AS_ERRORS], |
961 | [AC_CACHE_CHECK([if all warnings into errors],[ac_cv_warnings_as_errors], |
962 | @@ -75,10 +76,11 @@ |
963 | # Everything above this does the heavy lifting, while what follows does the specifics. |
964 | |
965 | AC_DEFUN([_HARDEN_LINKER_FLAGS], |
966 | - [_APPEND_LINK_FLAGS_ERROR([-z relro -z now]) |
967 | - #_APPEND_LINK_FLAGS_ERROR([-pie]) |
968 | - AS_IF([test "x$ac_cv_warnings_as_errors" = xyes], |
969 | - [AX_APPEND_LINK_FLAGS([-Werror])]) |
970 | + [ |
971 | + AS_IF([test "$CC" != "clang"], |
972 | + [_APPEND_LINK_FLAGS_ERROR([-z relro -z now]) |
973 | + AS_IF([test "x$ac_cv_warnings_as_errors" = xyes], |
974 | + [AX_APPEND_LINK_FLAGS([-Werror])])]) |
975 | ]) |
976 | |
977 | AC_DEFUN([_HARDEN_CC_COMPILER_FLAGS], |
978 | @@ -86,27 +88,37 @@ |
979 | |
980 | AS_IF([test "x$ax_enable_debug" = xyes], |
981 | [CFLAGS='' |
982 | + _APPEND_COMPILE_FLAGS_ERROR([-H]) |
983 | _APPEND_COMPILE_FLAGS_ERROR([-ggdb]) |
984 | _APPEND_COMPILE_FLAGS_ERROR([-g]) |
985 | - _APPEND_COMPILE_FLAGS_ERROR([-O0])], |
986 | - [_APPEND_COMPILE_FLAGS_ERROR([-g]) |
987 | - _APPEND_COMPILE_FLAGS_ERROR([-O2])]) |
988 | + _APPEND_COMPILE_FLAGS_ERROR([-O0]), |
989 | + _APPEND_COMPILE_FLAGS_ERROR([-fno-omit-frame-pointer]) |
990 | + ],[ |
991 | + _APPEND_COMPILE_FLAGS_ERROR([-g]) |
992 | + _APPEND_COMPILE_FLAGS_ERROR([-O2]) |
993 | + ]) |
994 | |
995 | AS_IF([test "x$ac_cv_vcs_checkout" = xyes], |
996 | - [_APPEND_COMPILE_FLAGS_ERROR([-fstack-check])], |
997 | - [_APPEND_COMPILE_FLAGS_ERROR([-Wno-pragmas])]) |
998 | + [_APPEND_COMPILE_FLAGS_ERROR([-fstack-check]) |
999 | + _APPEND_COMPILE_FLAGS_ERROR([-Wpragmas]) |
1000 | + _APPEND_COMPILE_FLAGS_ERROR([-Wunknown-pragmas])], |
1001 | + [_APPEND_COMPILE_FLAGS_ERROR([-Wno-unknown-pragmas]) |
1002 | + _APPEND_COMPILE_FLAGS_ERROR([-Wno-pragmas])]) |
1003 | + |
1004 | + AS_IF([test "$CC" = "clang"], |
1005 | + [_APPEND_COMPILE_FLAGS_ERROR([-Qunused-arguments])]) |
1006 | |
1007 | _APPEND_COMPILE_FLAGS_ERROR([-Wall]) |
1008 | _APPEND_COMPILE_FLAGS_ERROR([-Wextra]) |
1009 | - _APPEND_COMPILE_FLAGS_ERROR([-Wunknown-pragmas]) |
1010 | _APPEND_COMPILE_FLAGS_ERROR([-Wthis-test-should-fail]) |
1011 | _APPEND_COMPILE_FLAGS_ERROR([-std=c99]) |
1012 | # Anything below this comment please keep sorted. |
1013 | - AS_IF([test "x$CC_VERSION_VENDOR" != xclang], |
1014 | - [_APPEND_COMPILE_FLAGS_ERROR([--param=ssp-buffer-size=1])], []) |
1015 | # _APPEND_COMPILE_FLAGS_ERROR([-Wmissing-format-attribute]) |
1016 | + _APPEND_COMPILE_FLAGS_ERROR([-Wunsuffixed-float-constants]) |
1017 | + _APPEND_COMPILE_FLAGS_ERROR([-Wjump-misses-init]) |
1018 | _APPEND_COMPILE_FLAGS_ERROR([-Wno-attributes]) |
1019 | _APPEND_COMPILE_FLAGS_ERROR([-Waddress]) |
1020 | + _APPEND_COMPILE_FLAGS_ERROR([-Wvarargs]) |
1021 | _APPEND_COMPILE_FLAGS_ERROR([-Warray-bounds]) |
1022 | _APPEND_COMPILE_FLAGS_ERROR([-Wbad-function-cast]) |
1023 | # Not in use -Wc++-compat |
1024 | @@ -115,6 +127,7 @@ |
1025 | _APPEND_COMPILE_FLAGS_ERROR([-Wfloat-equal]) |
1026 | _APPEND_COMPILE_FLAGS_ERROR([-Wformat-security]) |
1027 | _APPEND_COMPILE_FLAGS_ERROR([-Wformat=2]) |
1028 | + _APPEND_COMPILE_FLAGS_ERROR([-Wformat-y2k]) |
1029 | _APPEND_COMPILE_FLAGS_ERROR([-Wlogical-op]) |
1030 | _APPEND_COMPILE_FLAGS_ERROR([-Wmaybe-uninitialized]) |
1031 | _APPEND_COMPILE_FLAGS_ERROR([-Wmissing-field-initializers]) |
1032 | @@ -124,7 +137,6 @@ |
1033 | _APPEND_COMPILE_FLAGS_ERROR([-Wmissing-prototypes]) |
1034 | _APPEND_COMPILE_FLAGS_ERROR([-Wnested-externs]) |
1035 | _APPEND_COMPILE_FLAGS_ERROR([-Wnormalized=id]) |
1036 | - _APPEND_COMPILE_FLAGS_ERROR([-Wold-style-definition]) |
1037 | _APPEND_COMPILE_FLAGS_ERROR([-Woverride-init]) |
1038 | _APPEND_COMPILE_FLAGS_ERROR([-Wpointer-arith]) |
1039 | _APPEND_COMPILE_FLAGS_ERROR([-Wpointer-sign]) |
1040 | @@ -141,15 +153,48 @@ |
1041 | _APPEND_COMPILE_FLAGS_ERROR([-Wstrict-overflow=1]) |
1042 | _APPEND_COMPILE_FLAGS_ERROR([-Wstrict-prototypes]) |
1043 | _APPEND_COMPILE_FLAGS_ERROR([-Wswitch-enum]) |
1044 | + _APPEND_COMPILE_FLAGS_ERROR([-Wtrampolines]) |
1045 | _APPEND_COMPILE_FLAGS_ERROR([-Wundef]) |
1046 | + _APPEND_COMPILE_FLAGS_ERROR([-Wunsafe-loop-optimizations]) |
1047 | + _APPEND_COMPILE_FLAGS_ERROR([-funsafe-loop-optimizations]) |
1048 | + AS_IF([test "x$ac_cv_vcs_checkout" = xyes],[ |
1049 | + _APPEND_COMPILE_FLAGS_ERROR([-fno-omit-frame-pointer]) |
1050 | + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=address]) |
1051 | + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=integer]) |
1052 | + AS_IF([test "x$enable_shared" = "xyes"],[ |
1053 | + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=thread]) |
1054 | + ]) |
1055 | + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=memory]) |
1056 | + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=alignment]) |
1057 | + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=bool]) |
1058 | + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=bounds]) |
1059 | + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=enum]) |
1060 | + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=float-cast-overflow]) |
1061 | + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=float-divide-by-zero]) |
1062 | + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=integer-divide-by-zero]) |
1063 | + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=null]) |
1064 | + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=object-size]) |
1065 | + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=return]) |
1066 | + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=shift]) |
1067 | + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=signed-integer-overflow]) |
1068 | + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=unreachable]) |
1069 | + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=unsigned-integer-overflow]) |
1070 | + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=vla-bound]) |
1071 | + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=vptr]) |
1072 | + ]) |
1073 | + _APPEND_COMPILE_FLAGS_ERROR([-Wclobbered]) |
1074 | _APPEND_COMPILE_FLAGS_ERROR([-Wunused]) |
1075 | _APPEND_COMPILE_FLAGS_ERROR([-Wunused-result]) |
1076 | _APPEND_COMPILE_FLAGS_ERROR([-Wunused-variable]) |
1077 | + _APPEND_COMPILE_FLAGS_ERROR([-Wunused-parameter]) |
1078 | + _APPEND_COMPILE_FLAGS_ERROR([-Wunused-local-typedefs]) |
1079 | _APPEND_COMPILE_FLAGS_ERROR([-Wwrite-strings]) |
1080 | _APPEND_COMPILE_FLAGS_ERROR([-floop-parallelize-all]) |
1081 | _APPEND_COMPILE_FLAGS_ERROR([-fwrapv]) |
1082 | _APPEND_COMPILE_FLAGS_ERROR([-fmudflapt]) |
1083 | _APPEND_COMPILE_FLAGS_ERROR([-pipe]) |
1084 | + _APPEND_COMPILE_FLAGS_ERROR([-fPIE -pie]) |
1085 | + _APPEND_COMPILE_FLAGS_ERROR([-Wsizeof-pointer-memaccess]) |
1086 | |
1087 | AS_IF([test "x$ax_enable_debug" = xno], |
1088 | [AS_IF([test "x$ac_cv_vcs_checkout" = xyes], |
1089 | @@ -157,7 +202,7 @@ |
1090 | [AS_IF([test "x$ac_c_gcc_recent" = xyes], |
1091 | [_APPEND_COMPILE_FLAGS_ERROR([-D_FORTIFY_SOURCE=2]) |
1092 | #_APPEND_COMPILE_FLAGS_ERROR([-Wstack-protector]) |
1093 | - #_APPEND_COMPILE_FLAGS_ERROR([-fstack-protector]) |
1094 | + #_APPEND_COMPILE_FLAGS_ERROR([-fstack-protector --param=ssp-buffer-size=4]) |
1095 | _APPEND_COMPILE_FLAGS_ERROR([-fstack-protector-all]) |
1096 | ])])])]) |
1097 | |
1098 | @@ -173,25 +218,33 @@ |
1099 | |
1100 | AS_IF([test "x$ax_enable_debug" = xyes], |
1101 | [CXXFLAGS='' |
1102 | + _APPEND_COMPILE_FLAGS_ERROR([-H]) |
1103 | _APPEND_COMPILE_FLAGS_ERROR([-ggdb]) |
1104 | _APPEND_COMPILE_FLAGS_ERROR([-g]) |
1105 | - _APPEND_COMPILE_FLAGS_ERROR([-O0])], |
1106 | - [_APPEND_COMPILE_FLAGS_ERROR([-g]) |
1107 | - _APPEND_COMPILE_FLAGS_ERROR([-O2])]) |
1108 | + _APPEND_COMPILE_FLAGS_ERROR([-O0]), |
1109 | + _APPEND_COMPILE_FLAGS_ERROR([-fno-omit-frame-pointer]) |
1110 | + ],[ |
1111 | + _APPEND_COMPILE_FLAGS_ERROR([-g]) |
1112 | + _APPEND_COMPILE_FLAGS_ERROR([-O2]) |
1113 | + ]) |
1114 | |
1115 | AS_IF([test "x$ac_cv_vcs_checkout" = xyes], |
1116 | - [_APPEND_COMPILE_FLAGS_ERROR([-fstack-check])], |
1117 | - [_APPEND_COMPILE_FLAGS_ERROR([-Wno-pragmas])]) |
1118 | + [_APPEND_COMPILE_FLAGS_ERROR([-fstack-check]) |
1119 | + _APPEND_COMPILE_FLAGS_ERROR([-Wpragmas]) |
1120 | + _APPEND_COMPILE_FLAGS_ERROR([-Wunknown-pragmas])], |
1121 | + [_APPEND_COMPILE_FLAGS_ERROR([-Wno-unknown-pragmas]) |
1122 | + _APPEND_COMPILE_FLAGS_ERROR([-Wno-pragmas])]) |
1123 | + |
1124 | + AS_IF([test "$CXX" = "clang++"], |
1125 | + [_APPEND_COMPILE_FLAGS_ERROR([-Qunused-arguments])]) |
1126 | |
1127 | _APPEND_COMPILE_FLAGS_ERROR([-Wall]) |
1128 | _APPEND_COMPILE_FLAGS_ERROR([-Wextra]) |
1129 | - _APPEND_COMPILE_FLAGS_ERROR([-Wunknown-pragmas]) |
1130 | _APPEND_COMPILE_FLAGS_ERROR([-Wthis-test-should-fail]) |
1131 | # Anything below this comment please keep sorted. |
1132 | - AS_IF([test "x$CXX_VERSION_VENDOR" != xclang], |
1133 | - [_APPEND_COMPILE_FLAGS_ERROR([--param=ssp-buffer-size=1])], []) |
1134 | # _APPEND_COMPILE_FLAGS_ERROR([-Wmissing-format-attribute]) |
1135 | _APPEND_COMPILE_FLAGS_ERROR([-Wno-attributes]) |
1136 | + _APPEND_COMPILE_FLAGS_ERROR([-Wvarargs]) |
1137 | _APPEND_COMPILE_FLAGS_ERROR([-Waddress]) |
1138 | _APPEND_COMPILE_FLAGS_ERROR([-Warray-bounds]) |
1139 | _APPEND_COMPILE_FLAGS_ERROR([-Wchar-subscripts]) |
1140 | @@ -199,6 +252,7 @@ |
1141 | _APPEND_COMPILE_FLAGS_ERROR([-Wctor-dtor-privacy]) |
1142 | _APPEND_COMPILE_FLAGS_ERROR([-Wfloat-equal]) |
1143 | _APPEND_COMPILE_FLAGS_ERROR([-Wformat=2]) |
1144 | + _APPEND_COMPILE_FLAGS_ERROR([-Wformat-y2k]) |
1145 | _APPEND_COMPILE_FLAGS_ERROR([-Wmaybe-uninitialized]) |
1146 | _APPEND_COMPILE_FLAGS_ERROR([-Wmissing-field-initializers]) |
1147 | _APPEND_COMPILE_FLAGS_ERROR([-Wlogical-op]) |
1148 | @@ -219,17 +273,52 @@ |
1149 | _APPEND_COMPILE_FLAGS_ERROR([-Wsign-compare]) |
1150 | _APPEND_COMPILE_FLAGS_ERROR([-Wstrict-overflow=1]) |
1151 | _APPEND_COMPILE_FLAGS_ERROR([-Wswitch-enum]) |
1152 | + _APPEND_COMPILE_FLAGS_ERROR([-Wtrampolines]) |
1153 | _APPEND_COMPILE_FLAGS_ERROR([-Wundef]) |
1154 | + _APPEND_COMPILE_FLAGS_ERROR([-Wunsafe-loop-optimizations]) |
1155 | + _APPEND_COMPILE_FLAGS_ERROR([-funsafe-loop-optimizations]) |
1156 | _APPEND_COMPILE_FLAGS_ERROR([-Wc++11-compat]) |
1157 | +# _APPEND_COMPILE_FLAGS_ERROR([-Weffc++]) |
1158 | + AS_IF([test "x$ac_cv_vcs_checkout" = xyes],[ |
1159 | + _APPEND_COMPILE_FLAGS_ERROR([-fno-omit-frame-pointer]) |
1160 | + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=address]) |
1161 | + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=integer]) |
1162 | + AS_IF([test "x$enable_shared" = "xyes"],[ |
1163 | + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=thread]) |
1164 | + ]) |
1165 | + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=memory]) |
1166 | + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=alignment]) |
1167 | + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=bool]) |
1168 | + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=bounds]) |
1169 | + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=enum]) |
1170 | + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=float-cast-overflow]) |
1171 | + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=float-divide-by-zero]) |
1172 | + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=integer-divide-by-zero]) |
1173 | + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=null]) |
1174 | + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=object-size]) |
1175 | + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=return]) |
1176 | + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=shift]) |
1177 | + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=signed-integer-overflow]) |
1178 | + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=unreachable]) |
1179 | + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=unsigned-integer-overflow]) |
1180 | + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=vla-bound]) |
1181 | + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=vptr]) |
1182 | + ]) |
1183 | +# _APPEND_COMPILE_FLAGS_ERROR([-Wold-style-cast]) |
1184 | + _APPEND_COMPILE_FLAGS_ERROR([-Wclobbered]) |
1185 | _APPEND_COMPILE_FLAGS_ERROR([-Wunused]) |
1186 | _APPEND_COMPILE_FLAGS_ERROR([-Wunused-result]) |
1187 | _APPEND_COMPILE_FLAGS_ERROR([-Wunused-variable]) |
1188 | + _APPEND_COMPILE_FLAGS_ERROR([-Wunused-parameter]) |
1189 | + _APPEND_COMPILE_FLAGS_ERROR([-Wunused-local-typedefs]) |
1190 | _APPEND_COMPILE_FLAGS_ERROR([-Wwrite-strings]) |
1191 | _APPEND_COMPILE_FLAGS_ERROR([-Wformat-security]) |
1192 | _APPEND_COMPILE_FLAGS_ERROR([-floop-parallelize-all]) |
1193 | _APPEND_COMPILE_FLAGS_ERROR([-fwrapv]) |
1194 | _APPEND_COMPILE_FLAGS_ERROR([-fmudflapt]) |
1195 | _APPEND_COMPILE_FLAGS_ERROR([-pipe]) |
1196 | + _APPEND_COMPILE_FLAGS_ERROR([-fPIE -pie]) |
1197 | + _APPEND_COMPILE_FLAGS_ERROR([-Wsizeof-pointer-memaccess]) |
1198 | |
1199 | AS_IF([test "x$ax_enable_debug" = xno], |
1200 | [AS_IF([test "x$ac_cv_vcs_checkout" = xyes], |
1201 | @@ -237,7 +326,7 @@ |
1202 | [AS_IF([test "x$ac_c_gcc_recent" = xyes], |
1203 | [_APPEND_COMPILE_FLAGS_ERROR([-D_FORTIFY_SOURCE=2]) |
1204 | #_APPEND_COMPILE_FLAGS_ERROR([-Wstack-protector]) |
1205 | - #_APPEND_COMPILE_FLAGS_ERROR([-fstack-protector]) |
1206 | + #_APPEND_COMPILE_FLAGS_ERROR([-fstack-protector --param=ssp-buffer-size=4]) |
1207 | _APPEND_COMPILE_FLAGS_ERROR([-fstack-protector-all]) |
1208 | ])])])]) |
1209 |
Lots of really good stuff in there, many thanks :)
Thanks for moving --param= ssp-buffer- size somewhere better. Clang 3.2 was barfing on that but autotools wasn't picking that up in the support check due to the message it generates.