1275970Scydnl ######################################################################
2275970Scydnl NTP_VPATH_HACK
3275970Scydnl
4275970Scydnl Compiling ntpd doesn't require YACC or Bison unless ntp_parser.y is
5275970Scydnl modified, because the output ntp_parser.[ch] are committed.  This
6275970Scydnl raises an issue with Automake-generated Makefiles on non-GNU make
7275970Scydnl used from a build tree outside the source tree.
8275970Scydnl
9275970Scydnl With GNU make, ylwrap updates $srcdir/ntp_parser.[ch] directly.
10275970Scydnl Under Sun or BSD make, ylwrap needs those files to be in the build
11275970Scydnl tree.
12275970Scydnl
13275970Scydnl With VPATH_HACK enabled, ntpd/Makefile.am includes code to symlink
14275970Scydnl from ntp_parser.[ch] in the build tree to the corresponding files
15275970Scydnl in $srcdir, and to check for ylwrap replacing the .h with a normal
16275970Scydnl file, and in that case copy the updated .h to $srcdir and restore
17275970Scydnl the symlink.
18275970Scydnl
19275970Scydnl if we are building outside the srcdir and either
20275970Scydnl   force_ntp_vpath_hack is yes
21275970Scydnl     or
22275970Scydnl   we're not using GNU make
23275970Scydnl then we want VPATH_HACK to be true for .am tests
24275970Scydnl
25275970ScyAC_DEFUN([NTP_VPATH_HACK], [
26275970ScyAC_MSG_CHECKING([to see if we need ylwrap VPATH hack])
27275970Scyntp_vpath_hack="no"
28275970Scycase "$srcdir::${force_ntp_vpath_hack-no}" in
29275970Scy .::*)
30275970Scy    ;; # VPATH_HACK path is for VPATH builds only.
31275970Scy *::yes)
32275970Scy    ntp_vpath_hack="yes"
33275970Scy    ;;
34275970Scy *::*)
35275970Scy    case "`${MAKE-make} -v -f /dev/null 2>/dev/null | grep 'GNU Make'`" in
36275970Scy     '')
37275970Scy	ntp_vpath_hack="yes"
38275970Scy    esac
39275970Scyesac
40275970ScyAC_MSG_RESULT([$ntp_vpath_hack])
41275970ScyAM_CONDITIONAL([VPATH_HACK], [test x$ntp_vpath_hack = xyes])
42275970Scy])
43275970Scydnl ======================================================================
44