comparison configure.ac @ 1439:8d24733026c5 coverity

merge
author Matt Johnston <matt@ucc.asn.au>
date Sat, 24 Jun 2017 23:33:16 +0800
parents a097c9c9608a
children 793c43cf523e bfed37d12d90
comparison
equal deleted inserted replaced
1400:238a439670f5 1439:8d24733026c5
7 7
8 AC_PREREQ(2.59) 8 AC_PREREQ(2.59)
9 AC_INIT 9 AC_INIT
10 AC_CONFIG_SRCDIR(buffer.c) 10 AC_CONFIG_SRCDIR(buffer.c)
11 11
12 OLDCFLAGS=$CFLAGS 12 OLDCFLAGS="$CFLAGS"
13 # Checks for programs. 13 # Checks for programs.
14 AC_PROG_CC 14 AC_PROG_CC
15 AC_PROG_MAKE_SET 15 AC_PROG_MAKE_SET
16 16
17 if test -z "$LD" ; then 17 if test -z "$LD" ; then
18 LD=$CC 18 LD=$CC
19 fi 19 fi
20 AC_SUBST(LD) 20 AC_SUBST(LD)
21 21
22 # set compile flags prior to other tests
22 if test -z "$OLDCFLAGS" && test "$GCC" = "yes"; then 23 if test -z "$OLDCFLAGS" && test "$GCC" = "yes"; then
23 AC_MSG_NOTICE(No \$CFLAGS set... using "-Os -W -Wall" for GCC) 24 AC_MSG_NOTICE(No \$CFLAGS set... using "-Os -W -Wall" for GCC)
24 CFLAGS="-Os -W -Wall -Wno-pointer-sign" 25 CFLAGS="-Os -W -Wall -Wno-pointer-sign"
26 fi
27
28 AC_MSG_CHECKING([if compiler '$CC' supports -fno-strict-overflow])
29 OLDCFLAGS="$CFLAGS"
30 CFLAGS="$CFLAGS -fno-strict-overflow"
31 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],
32 [AC_MSG_RESULT(yes)],
33 [AC_MSG_RESULT(no); CFLAGS="$OLDCFLAGS" ]
34 )
35
36 hardenbuild=1
37 AC_ARG_ENABLE(harden,
38 [ --disable-harden Don't set hardened build flags],
39 [
40 if test "x$enableval" = "xno"; then
41 hardenbuild=0
42 AC_MSG_NOTICE(Disabling hardened build flags)
43 fi
44 ], [])
45
46 if test "$hardenbuild" -eq 1; then
47 AC_MSG_NOTICE(Checking for available hardened build flags:)
48 # pie
49 OLDCFLAGS="$CFLAGS"
50 TESTFLAGS="-fPIE"
51 CFLAGS="$CFLAGS $TESTFLAGS"
52 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],
53 [AC_MSG_NOTICE([Setting $TESTFLAGS])],
54 [AC_MSG_NOTICE([Not setting $TESTFLAGS]); CFLAGS="$OLDCFLAGS" ]
55 )
56 OLDLDFLAGS="$LDFLAGS"
57 TESTFLAGS="-Wl,-pie"
58 LDFLAGS="$LDFLAGS $TESTFLAGS"
59 AC_LINK_IFELSE([AC_LANG_PROGRAM([])],
60 [AC_MSG_NOTICE([Setting $TESTFLAGS])],
61 [
62 LDFLAGS="$OLDLDFLAGS"
63 TESTFLAGS="-pie"
64 LDFLAGS="$LDFLAGS $TESTFLAGS"
65 AC_LINK_IFELSE([AC_LANG_PROGRAM([])],
66 [AC_MSG_NOTICE([Setting $TESTFLAGS])],
67 [AC_MSG_NOTICE([Not setting $TESTFLAGS]); LDFLAGS="$OLDLDFLAGS" ]
68 )
69 ]
70 )
71 # readonly elf relocation sections (relro)
72 OLDLDFLAGS="$LDFLAGS"
73 TESTFLAGS="-Wl,-z,now -Wl,-z,relro"
74 LDFLAGS="$LDFLAGS $TESTFLAGS"
75 AC_LINK_IFELSE([AC_LANG_PROGRAM([])],
76 [AC_MSG_NOTICE([Setting $TESTFLAGS])],
77 [AC_MSG_NOTICE([Not setting $TESTFLAGS]); LDFLAGS="$OLDLDFLAGS" ]
78 )
79 # stack protector. -strong is good but only in gcc 4.9 or later
80 OLDCFLAGS="$CFLAGS"
81 TESTFLAGS="-fstack-protector-strong"
82 CFLAGS="$CFLAGS $TESTFLAGS"
83 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],
84 [AC_MSG_NOTICE([Setting $TESTFLAGS])],
85 [
86 CFLAGS="$OLDCFLAGS"
87 TESTFLAGS="-fstack-protector --param=ssp-buffer-size=4"
88 CFLAGS="$CFLAGS $TESTFLAGS"
89 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],
90 [AC_MSG_NOTICE([Setting $TESTFLAGS])],
91 [AC_MSG_NOTICE([Not setting $TESTFLAGS]); CFLAGS="$OLDCFLAGS" ]
92 )
93 ]
94 )
95 # FORTIFY_SOURCE
96 OLDCFLAGS="$CFLAGS"
97 TESTFLAGS="-D_FORTIFY_SOURCE=2"
98 CFLAGS="$CFLAGS $TESTFLAGS"
99 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],
100 [AC_MSG_NOTICE([Setting $TESTFLAGS])],
101 [AC_MSG_NOTICE([Not setting $TESTFLAGS]); CFLAGS="$OLDCFLAGS" ]
102 )
25 fi 103 fi
26 104
27 # large file support is useful for scp 105 # large file support is useful for scp
28 AC_SYS_LARGEFILE 106 AC_SYS_LARGEFILE
29 107
220 298
221 299
222 # Checks for header files. 300 # Checks for header files.
223 AC_HEADER_STDC 301 AC_HEADER_STDC
224 AC_HEADER_SYS_WAIT 302 AC_HEADER_SYS_WAIT
225 AC_CHECK_HEADERS([fcntl.h limits.h netinet/in.h netinet/tcp.h stdlib.h string.h sys/socket.h sys/time.h termios.h unistd.h crypt.h pty.h ioctl.h libutil.h libgen.h inttypes.h stropts.h utmp.h utmpx.h lastlog.h paths.h util.h netdb.h security/pam_appl.h pam/pam_appl.h netinet/in_systm.h sys/uio.h]) 303 AC_CHECK_HEADERS([fcntl.h limits.h netinet/in.h netinet/tcp.h stdlib.h \
304 string.h sys/socket.h sys/time.h termios.h unistd.h crypt.h \
305 pty.h ioctl.h libutil.h libgen.h inttypes.h stropts.h utmp.h \
306 utmpx.h lastlog.h paths.h util.h netdb.h security/pam_appl.h \
307 pam/pam_appl.h netinet/in_systm.h sys/uio.h linux/pkt_sched.h])
226 308
227 # Checks for typedefs, structures, and compiler characteristics. 309 # Checks for typedefs, structures, and compiler characteristics.
228 AC_C_CONST 310 AC_C_CONST
229 AC_TYPE_UID_T 311 AC_TYPE_UID_T
230 AC_TYPE_MODE_T 312 AC_TYPE_MODE_T
386 if test "x$enableval" = "xyes"; then 468 if test "x$enableval" = "xyes"; then
387 BUNDLED_LIBTOM=1 469 BUNDLED_LIBTOM=1
388 AC_MSG_NOTICE(Forcing bundled libtom*) 470 AC_MSG_NOTICE(Forcing bundled libtom*)
389 else 471 else
390 BUNDLED_LIBTOM=0 472 BUNDLED_LIBTOM=0
391 AC_CHECK_LIB(tommath, mp_exptmod, LIBTOM_LIBS="$LIBTOM_LIBS -ltommath", 473 AC_CHECK_LIB(tommath, mp_exptmod, LIBTOM_LIBS="-ltommath $LIBTOM_LIBS",
392 [AC_MSG_ERROR([Missing system libtommath and --disable-bundled-libtom was specified])] ) 474 [AC_MSG_ERROR([Missing system libtommath and --disable-bundled-libtom was specified])] )
393 AC_CHECK_LIB(tomcrypt, register_cipher, LIBTOM_LIBS="$LIBTOM_LIBS -ltomcrypt", 475 AC_CHECK_LIB(tomcrypt, register_cipher, LIBTOM_LIBS="-ltomcrypt $LIBTOM_LIBS",
394 [AC_MSG_ERROR([Missing system libtomcrypt and --disable-bundled-libtom was specified])] ) 476 [AC_MSG_ERROR([Missing system libtomcrypt and --disable-bundled-libtom was specified])] )
395 fi 477 fi
396 ], 478 ],
397 [ 479 [
398 BUNDLED_LIBTOM=0 480 BUNDLED_LIBTOM=0
399 AC_CHECK_LIB(tommath, mp_exptmod, LIBTOM_LIBS="$LIBTOM_LIBS -ltommath", BUNDLED_LIBTOM=1) 481 AC_CHECK_LIB(tommath, mp_exptmod, LIBTOM_LIBS="-ltommath $LIBTOM_LIBS", BUNDLED_LIBTOM=1)
400 AC_CHECK_LIB(tomcrypt, register_cipher, LIBTOM_LIBS="$LIBTOM_LIBS -ltomcrypt", BUNDLED_LIBTOM=1) 482 AC_CHECK_LIB(tomcrypt, register_cipher, LIBTOM_LIBS="-ltomcrypt $LIBTOM_LIBS", BUNDLED_LIBTOM=1)
401 ] 483 ]
402 ) 484 )
403 485
404 if test $BUNDLED_LIBTOM = 1 ; then 486 if test $BUNDLED_LIBTOM = 1 ; then
405 AC_DEFINE(BUNDLED_LIBTOM,1,Use bundled libtom) 487 AC_DEFINE(BUNDLED_LIBTOM,1,Use bundled libtom)