vendor/bmake: upgrade from 20210206 to 20210314
[dragonfly.git] / contrib / bmake / mk / autoconf.mk
1 # $Id: autoconf.mk,v 1.10 2020/08/19 17:51:53 sjg Exp $
2 #
3 #       @(#) Copyright (c) 1996-2009, Simon J. Gerraty
4 #
5 #       This file is provided in the hope that it will
6 #       be of use.  There is absolutely NO WARRANTY.
7 #       Permission to copy, redistribute or otherwise
8 #       use this file is hereby granted provided that
9 #       the above copyright notice and this notice are
10 #       left intact.
11 #
12 #       Please send copies of changes and bug-fixes to:
13 #       sjg@crufty.net
14 #
15
16 .NOPATH:        config.h config.status
17
18 CONFIGURE_DEPS += ${.CURDIR}/config.h.in ${.CURDIR}/configure
19
20 .if !target(config.h)
21 config.h:       ${CONFIGURE_DEPS} config.status
22         ./config.status
23 .endif
24
25 .if !target(config.status)
26 # avoid the targets behaving differently
27 .if exists(${.OBJDIR}/config.status)
28 config.status:  config.recheck
29 .else
30 config.status:  config.gen
31 .endif
32
33 config.recheck: ${CONFIGURE_DEPS}
34         ./config.status --recheck
35         @touch $@
36
37 config.gen: ${CONFIGURE_DEPS}
38         CC="${CC} ${CCMODE}" ${.CURDIR}/configure --no-create ${CONFIGURE_ARGS}
39         @touch $@ config.recheck
40
41 CLEANFILES+= config.recheck config.gen config.status *.meta
42 .endif
43
44 # avoid things blowing up if these are not here...
45 # this is not quite per the autoconf manual,
46 # and is extremely convoluted - but all utterly necessary!
47
48 .if make(autoconf-in) || make(configure) || make(config.h.in) || ${AUTO_AUTOCONF:Uno:tl} == "yes"
49 AUTOCONF ?= autoconf
50 AUTOHEADER ?= autoheader
51
52 # expand it to a full path
53 AUTOCONF := ${AUTOCONF:${M_whence}}
54
55 .if exists(${AUTOCONF})
56
57 .PRECIOUS: configure config.h.in config.status
58
59 ACLOCAL =
60 ACCONFIG =
61
62 .if exists(${.CURDIR}/aclocal.m4)
63 ACLOCAL += aclocal.m4
64 .endif
65 # use of acconfig.h is deprecated!
66 .if exists(${.CURDIR}/acconfig.h)
67 ACCONFIG += acconfig.h
68 .endif
69
70 config.h.in:    ${.CURDIR}/configure.in ${ACCONFIG}
71         (cd ${.CURDIR} && ${AUTOHEADER})
72
73 configure:      ${.CURDIR}/configure.in ${ACLOCAL}
74         (cd ${.CURDIR} && ${AUTOCONF})
75
76 AUTOCONF_INPUTS += configure
77 autoconf-input: ${AUTOCONF_INPUTS}
78
79 .endif
80 .endif