xref: /freebsd/contrib/ntp/sntp/m4/ntp_harden.m4 (revision 74ca7bf1d4c7173d5575ba168bc4b5f6d181ff5a)
1dnl ######################################################################
2dnl @synopsis NTP_HARDEN([SCRIPTSDIRPATH])
3dnl Build (compile/link) hardening information:
4dnl - NTP_HARD_CFLAGS
5dnl - NTP_HARD_CPPFLAGS
6dnl - NTP_HARD_LDFLAGS
7
8AC_DEFUN([NTP_HARDEN], [
9
10AC_MSG_CHECKING([for compile/link hardening flags])
11
12AC_ARG_WITH(
13    [hardenfile],
14    [AS_HELP_STRING(
15	[--with-hardenfile=XXX],
16	[os-specific or "/dev/null"]
17    )],
18    [],
19    [with_hardenfile=no]
20)
21
22(									\
23    SENTINEL_DIR="$PWD" &&						\
24    cd $srcdir/$1 &&							\
25    case "$with_hardenfile" in						\
26     yes|no|'')								\
27	scripts/genHardFlags -d "$SENTINEL_DIR"				\
28	;;								\
29     *)									\
30	scripts/genHardFlags -d "$SENTINEL_DIR" -f "$with_hardenfile"	\
31	;;								\
32    esac								\
33) > genHardFlags.i 2> genHardFlags.err
34. ./genHardFlags.i
35
36case "$GENHARDFLAG" in
37 OK)
38    AC_MSG_RESULT([in file $GENHARDFLAGFILE])
39    rm genHardFlags.err genHardFlags.i
40    ;;
41 *)
42    AC_MSG_RESULT([failed.])
43    AC_MSG_ERROR([Problem with genHardFlags!])
44    ;;
45esac
46
47AC_SUBST([NTP_HARD_CFLAGS])
48AC_SUBST([NTP_HARD_CPPFLAGS])
49AC_SUBST([NTP_HARD_LDFLAGS])
50
51])dnl
52dnl ======================================================================
53