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