]> CyberLeo.Net >> Repos - FreeBSD/releng/10.2.git/blob - contrib/ntp/sntp/m4/ntp_vpathhack.m4
- Copy stable/10@285827 to releng/10.2 in preparation for 10.2-RC1
[FreeBSD/releng/10.2.git] / contrib / ntp / sntp / m4 / ntp_vpathhack.m4
1 dnl ######################################################################
2 dnl NTP_VPATH_HACK
3 dnl
4 dnl Compiling ntpd doesn't require YACC or Bison unless ntp_parser.y is
5 dnl modified, because the output ntp_parser.[ch] are committed.  This
6 dnl raises an issue with Automake-generated Makefiles on non-GNU make
7 dnl used from a build tree outside the source tree.
8 dnl
9 dnl With GNU make, ylwrap updates $srcdir/ntp_parser.[ch] directly.
10 dnl Under Sun or BSD make, ylwrap needs those files to be in the build
11 dnl tree.
12 dnl
13 dnl With VPATH_HACK enabled, ntpd/Makefile.am includes code to symlink
14 dnl from ntp_parser.[ch] in the build tree to the corresponding files
15 dnl in $srcdir, and to check for ylwrap replacing the .h with a normal
16 dnl file, and in that case copy the updated .h to $srcdir and restore
17 dnl the symlink.
18 dnl
19 dnl if we are building outside the srcdir and either
20 dnl   force_ntp_vpath_hack is yes
21 dnl     or
22 dnl   we're not using GNU make
23 dnl then we want VPATH_HACK to be true for .am tests
24 dnl
25 AC_DEFUN([NTP_VPATH_HACK], [
26 AC_MSG_CHECKING([to see if we need ylwrap VPATH hack])
27 ntp_vpath_hack="no"
28 case "$srcdir::${force_ntp_vpath_hack-no}" in
29  .::*)
30     ;; # VPATH_HACK path is for VPATH builds only.
31  *::yes)
32     ntp_vpath_hack="yes"
33     ;;
34  *::*)
35     case "`${MAKE-make} -v -f /dev/null 2>/dev/null | grep 'GNU Make'`" in
36      '')
37         ntp_vpath_hack="yes"
38     esac
39 esac
40 AC_MSG_RESULT([$ntp_vpath_hack])
41 AM_CONDITIONAL([VPATH_HACK], [test x$ntp_vpath_hack = xyes])
42 ])
43 dnl ======================================================================