comparison configure.ac @ 1478:3a933956437e coverity

update coverity
author Matt Johnston <matt@ucc.asn.au>
date Fri, 09 Feb 2018 23:49:22 +0800
parents 67bcd5fa40c6
children 9b87cbe931e3
comparison
equal deleted inserted replaced
1439:8d24733026c5 1478:3a933956437e
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"
13 # Checks for programs. 12 # Checks for programs.
14 AC_PROG_CC 13 AC_PROG_CC
15 AC_PROG_MAKE_SET 14 AC_PROG_MAKE_SET
16 15
17 if test -z "$LD" ; then 16 if test -z "$LD" ; then
18 LD=$CC 17 LD=$CC
19 fi 18 fi
20 AC_SUBST(LD) 19 AC_SUBST(LD)
21 20
21 AC_DEFUN(DB_TRYADDCFLAGS,
22 [{
23 OLDFLAGS="$CFLAGS"
24 TESTFLAGS="$1"
25 CFLAGS="$CFLAGS $TESTFLAGS"
26 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],
27 [AC_MSG_NOTICE([Setting $TESTFLAGS])],
28 [AC_MSG_NOTICE([Not setting $TESTFLAGS]); CFLAGS="$OLDFLAGS" ]
29 )
30 }])
31
22 # set compile flags prior to other tests 32 # set compile flags prior to other tests
23 if test -z "$OLDCFLAGS" && test "$GCC" = "yes"; then 33 if test -z "$OLDCFLAGS" && test "$GCC" = "yes"; then
24 AC_MSG_NOTICE(No \$CFLAGS set... using "-Os -W -Wall" for GCC) 34 AC_MSG_NOTICE(No \$CFLAGS set... using "-Os -W -Wall" for GCC)
25 CFLAGS="-Os -W -Wall -Wno-pointer-sign" 35 CFLAGS="-Os -W -Wall"
26 fi 36 fi
27 37
28 AC_MSG_CHECKING([if compiler '$CC' supports -fno-strict-overflow]) 38 AC_MSG_NOTICE([Checking if compiler '$CC' supports -Wno-pointer-sign])
29 OLDCFLAGS="$CFLAGS" 39 DB_TRYADDCFLAGS([-Wno-pointer-sign])
30 CFLAGS="$CFLAGS -fno-strict-overflow" 40
31 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])], 41 AC_MSG_NOTICE([Checking if compiler '$CC' supports -fno-strict-overflow])
32 [AC_MSG_RESULT(yes)], 42 DB_TRYADDCFLAGS([-fno-strict-overflow])
33 [AC_MSG_RESULT(no); CFLAGS="$OLDCFLAGS" ] 43
34 ) 44 STATIC=0
45 AC_ARG_ENABLE(static,
46 [ --enable-static Build static binaries],
47 [
48 if test "x$enableval" = "xyes"; then
49 STATIC=1
50 AC_MSG_NOTICE(Static Build)
51 fi
52 ], [])
53 AC_SUBST(STATIC)
35 54
36 hardenbuild=1 55 hardenbuild=1
37 AC_ARG_ENABLE(harden, 56 AC_ARG_ENABLE(harden,
38 [ --disable-harden Don't set hardened build flags], 57 [ --disable-harden Don't set hardened build flags],
39 [ 58 [
40 if test "x$enableval" = "xno"; then 59 if test "x$enableval" = "xno"; then
41 hardenbuild=0 60 hardenbuild=0
42 AC_MSG_NOTICE(Disabling hardened build flags) 61 AC_MSG_NOTICE(Disabling hardened build flags)
43 fi 62 fi
44 ], []) 63 ], [])
45 64
46 if test "$hardenbuild" -eq 1; then 65 if test "$hardenbuild" -eq 1; then
47 AC_MSG_NOTICE(Checking for available hardened build flags:) 66 AC_MSG_NOTICE(Checking for available hardened build flags:)
48 # pie 67 # relocation flags don't make sense for static builds
49 OLDCFLAGS="$CFLAGS" 68 if test "$STATIC" -ne 1; then
50 TESTFLAGS="-fPIE" 69 # pie
51 CFLAGS="$CFLAGS $TESTFLAGS" 70 DB_TRYADDCFLAGS([-fPIE])
52 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])], 71
53 [AC_MSG_NOTICE([Setting $TESTFLAGS])], 72 OLDLDFLAGS="$LDFLAGS"
54 [AC_MSG_NOTICE([Not setting $TESTFLAGS]); CFLAGS="$OLDCFLAGS" ] 73 TESTFLAGS="-Wl,-pie"
55 ) 74 LDFLAGS="$LDFLAGS $TESTFLAGS"
56 OLDLDFLAGS="$LDFLAGS" 75 AC_LINK_IFELSE([AC_LANG_PROGRAM([])],
57 TESTFLAGS="-Wl,-pie" 76 [AC_MSG_NOTICE([Setting $TESTFLAGS])],
58 LDFLAGS="$LDFLAGS $TESTFLAGS" 77 [
59 AC_LINK_IFELSE([AC_LANG_PROGRAM([])], 78 LDFLAGS="$OLDLDFLAGS"
60 [AC_MSG_NOTICE([Setting $TESTFLAGS])], 79 TESTFLAGS="-pie"
61 [ 80 LDFLAGS="$LDFLAGS $TESTFLAGS"
62 LDFLAGS="$OLDLDFLAGS" 81 AC_LINK_IFELSE([AC_LANG_PROGRAM([])],
63 TESTFLAGS="-pie" 82 [AC_MSG_NOTICE([Setting $TESTFLAGS])],
64 LDFLAGS="$LDFLAGS $TESTFLAGS" 83 [AC_MSG_NOTICE([Not setting $TESTFLAGS]); LDFLAGS="$OLDLDFLAGS" ]
65 AC_LINK_IFELSE([AC_LANG_PROGRAM([])], 84 )
66 [AC_MSG_NOTICE([Setting $TESTFLAGS])], 85 ]
67 [AC_MSG_NOTICE([Not setting $TESTFLAGS]); LDFLAGS="$OLDLDFLAGS" ] 86 )
68 ) 87 # readonly elf relocation sections (relro)
69 ] 88 OLDLDFLAGS="$LDFLAGS"
70 ) 89 TESTFLAGS="-Wl,-z,now -Wl,-z,relro"
71 # readonly elf relocation sections (relro) 90 LDFLAGS="$LDFLAGS $TESTFLAGS"
72 OLDLDFLAGS="$LDFLAGS" 91 AC_LINK_IFELSE([AC_LANG_PROGRAM([])],
73 TESTFLAGS="-Wl,-z,now -Wl,-z,relro" 92 [AC_MSG_NOTICE([Setting $TESTFLAGS])],
74 LDFLAGS="$LDFLAGS $TESTFLAGS" 93 [AC_MSG_NOTICE([Not setting $TESTFLAGS]); LDFLAGS="$OLDLDFLAGS" ]
75 AC_LINK_IFELSE([AC_LANG_PROGRAM([])], 94 )
76 [AC_MSG_NOTICE([Setting $TESTFLAGS])], 95 fi # non-static
77 [AC_MSG_NOTICE([Not setting $TESTFLAGS]); LDFLAGS="$OLDLDFLAGS" ]
78 )
79 # stack protector. -strong is good but only in gcc 4.9 or later 96 # stack protector. -strong is good but only in gcc 4.9 or later
80 OLDCFLAGS="$CFLAGS" 97 OLDCFLAGS="$CFLAGS"
81 TESTFLAGS="-fstack-protector-strong" 98 TESTFLAGS="-fstack-protector-strong"
82 CFLAGS="$CFLAGS $TESTFLAGS" 99 CFLAGS="$CFLAGS $TESTFLAGS"
83 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])], 100 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],
91 [AC_MSG_NOTICE([Not setting $TESTFLAGS]); CFLAGS="$OLDCFLAGS" ] 108 [AC_MSG_NOTICE([Not setting $TESTFLAGS]); CFLAGS="$OLDCFLAGS" ]
92 ) 109 )
93 ] 110 ]
94 ) 111 )
95 # FORTIFY_SOURCE 112 # FORTIFY_SOURCE
96 OLDCFLAGS="$CFLAGS" 113 DB_TRYADDCFLAGS([-D_FORTIFY_SOURCE=2])
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 )
103 fi 114 fi
104 115
105 # large file support is useful for scp 116 # large file support is useful for scp
106 AC_SYS_LARGEFILE 117 AC_SYS_LARGEFILE
107 118
228 ] 239 ]
229 ) 240 )
230 241
231 242
232 AC_ARG_ENABLE(pam, 243 AC_ARG_ENABLE(pam,
233 [ --enable-pam Try to include PAM support], 244 [ --enable-pam Try to include PAM support],
234 [ 245 [
235 if test "x$enableval" = "xyes"; then 246 if test "x$enableval" = "xyes"; then
236 AC_CHECK_LIB(pam, pam_authenticate, , AC_MSG_ERROR([*** PAM missing - install first or check config.log ***])) 247 AC_CHECK_LIB(pam, pam_authenticate, , AC_MSG_ERROR([*** PAM missing - install first or check config.log ***]))
237 AC_MSG_NOTICE(Enabling PAM) 248 AC_MSG_NOTICE(Enabling PAM)
238 AC_CHECK_FUNCS(pam_fail_delay) 249 AC_CHECK_FUNCS(pam_fail_delay)
253 [ 264 [
254 if test "x$enableval" = "xno"; then 265 if test "x$enableval" = "xno"; then
255 AC_MSG_NOTICE(Not using openpty) 266 AC_MSG_NOTICE(Not using openpty)
256 else 267 else
257 AC_MSG_NOTICE(Using openpty if available) 268 AC_MSG_NOTICE(Using openpty if available)
258 AC_SEARCH_LIBS(openpty, util, [AC_DEFINE(HAVE_OPENPTY,1,[Have openpty() function])]) 269 AC_SEARCH_LIBS(openpty, util, [dropbear_cv_func_have_openpty=yes])
259 fi 270 fi
260 ], 271 ],
261 [ 272 [
262 AC_MSG_NOTICE(Using openpty if available) 273 AC_MSG_NOTICE(Using openpty if available)
263 AC_SEARCH_LIBS(openpty, util, [AC_DEFINE(HAVE_OPENPTY)]) 274 AC_SEARCH_LIBS(openpty, util, [dropbear_cv_func_have_openpty=yes])
264 ] 275 ]
265 ) 276 )
266 277
278 if test "x$dropbear_cv_func_have_openpty" = "xyes"; then
279 AC_DEFINE(HAVE_OPENPTY,,Have openpty() function)
280 no_ptc_check=yes
281 no_ptmx_check=yes
282 fi
267 283
268 AC_ARG_ENABLE(syslog, 284 AC_ARG_ENABLE(syslog,
269 [ --disable-syslog Don't include syslog support], 285 [ --disable-syslog Don't include syslog support],
270 [ 286 [
271 if test "x$enableval" = "xno"; then 287 if test "x$enableval" = "xno"; then
780 fi 796 fi
781 fi 797 fi
782 798
783 AC_EXEEXT 799 AC_EXEEXT
784 800
785 # XXX there must be a nicer way to do this
786 if test $BUNDLED_LIBTOM = 1 ; then 801 if test $BUNDLED_LIBTOM = 1 ; then
787 AS_MKDIR_P(libtomcrypt/src/ciphers/aes) 802 (cd $srcdir; find libtomcrypt -type d) | xargs mkdir -pv
788 AS_MKDIR_P(libtomcrypt/src/ciphers/safer)
789 AS_MKDIR_P(libtomcrypt/src/ciphers/twofish)
790 AS_MKDIR_P(libtomcrypt/src/encauth/ccm)
791 AS_MKDIR_P(libtomcrypt/src/encauth/eax)
792 AS_MKDIR_P(libtomcrypt/src/encauth/gcm)
793 AS_MKDIR_P(libtomcrypt/src/encauth/ocb)
794 AS_MKDIR_P(libtomcrypt/src/hashes)
795 AS_MKDIR_P(libtomcrypt/src/hashes/chc)
796 AS_MKDIR_P(libtomcrypt/src/hashes/helper)
797 AS_MKDIR_P(libtomcrypt/src/hashes/sha2)
798 AS_MKDIR_P(libtomcrypt/src/hashes/whirl)
799 AS_MKDIR_P(libtomcrypt/src/mac/hmac)
800 AS_MKDIR_P(libtomcrypt/src/mac/omac)
801 AS_MKDIR_P(libtomcrypt/src/mac/pelican)
802 AS_MKDIR_P(libtomcrypt/src/mac/pmac)
803 AS_MKDIR_P(libtomcrypt/src/mac/f9)
804 AS_MKDIR_P(libtomcrypt/src/mac/xcbc)
805 AS_MKDIR_P(libtomcrypt/src/math/fp)
806 AS_MKDIR_P(libtomcrypt/src/misc/base64)
807 AS_MKDIR_P(libtomcrypt/src/misc/crypt)
808 AS_MKDIR_P(libtomcrypt/src/misc/mpi)
809 AS_MKDIR_P(libtomcrypt/src/misc/pkcs5)
810 AS_MKDIR_P(libtomcrypt/src/modes/cbc)
811 AS_MKDIR_P(libtomcrypt/src/modes/cfb)
812 AS_MKDIR_P(libtomcrypt/src/modes/ctr)
813 AS_MKDIR_P(libtomcrypt/src/modes/ecb)
814 AS_MKDIR_P(libtomcrypt/src/modes/ofb)
815 AS_MKDIR_P(libtomcrypt/src/modes/f8)
816 AS_MKDIR_P(libtomcrypt/src/modes/lrw)
817 AS_MKDIR_P(libtomcrypt/src/pk/asn1/der/bit)
818 AS_MKDIR_P(libtomcrypt/src/pk/asn1/der/boolean)
819 AS_MKDIR_P(libtomcrypt/src/pk/asn1/der/choice)
820 AS_MKDIR_P(libtomcrypt/src/pk/asn1/der/ia5)
821 AS_MKDIR_P(libtomcrypt/src/pk/asn1/der/integer)
822 AS_MKDIR_P(libtomcrypt/src/pk/asn1/der/object_identifier)
823 AS_MKDIR_P(libtomcrypt/src/pk/asn1/der/octet)
824 AS_MKDIR_P(libtomcrypt/src/pk/asn1/der/printable_string)
825 AS_MKDIR_P(libtomcrypt/src/pk/asn1/der/sequence)
826 AS_MKDIR_P(libtomcrypt/src/pk/asn1/der/set)
827 AS_MKDIR_P(libtomcrypt/src/pk/asn1/der/short_integer)
828 AS_MKDIR_P(libtomcrypt/src/pk/asn1/der/utctime)
829 AS_MKDIR_P(libtomcrypt/src/pk/asn1/der/utf8)
830 AS_MKDIR_P(libtomcrypt/src/pk/dh)
831 AS_MKDIR_P(libtomcrypt/src/pk/dsa)
832 AS_MKDIR_P(libtomcrypt/src/pk/ecc)
833 AS_MKDIR_P(libtomcrypt/src/pk/katja)
834 AS_MKDIR_P(libtomcrypt/src/pk/pkcs1)
835 AS_MKDIR_P(libtomcrypt/src/pk/rsa)
836 AS_MKDIR_P(libtomcrypt/src/prngs)
837 LIBTOM_FILES="libtomcrypt/Makefile libtommath/Makefile" 803 LIBTOM_FILES="libtomcrypt/Makefile libtommath/Makefile"
838 fi 804 fi
805
839 AC_CONFIG_HEADER(config.h) 806 AC_CONFIG_HEADER(config.h)
840 AC_CONFIG_FILES(Makefile $LIBTOM_FILES) 807 AC_CONFIG_FILES(Makefile $LIBTOM_FILES)
841 AC_OUTPUT 808 AC_OUTPUT
842 809
843 AC_MSG_NOTICE() 810 AC_MSG_NOTICE()