1 # $Id: autoconf.mk,v 1.10 2020/08/19 17:51:53 sjg Exp $
3 # @(#) Copyright (c) 1996-2009, Simon J. Gerraty
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
12 # Please send copies of changes and bug-fixes to:
16 .NOPATH: config.h config.status
18 CONFIGURE_DEPS += ${.CURDIR}/config.h.in ${.CURDIR}/configure
21 config.h: ${CONFIGURE_DEPS} config.status
25 .if !target(config.status)
26 # avoid the targets behaving differently
27 .if exists(${.OBJDIR}/config.status)
28 config.status: config.recheck
30 config.status: config.gen
33 config.recheck: ${CONFIGURE_DEPS}
34 ./config.status --recheck
37 config.gen: ${CONFIGURE_DEPS}
38 CC="${CC} ${CCMODE}" ${.CURDIR}/configure --no-create ${CONFIGURE_ARGS}
39 @touch $@ config.recheck
41 CLEANFILES+= config.recheck config.gen config.status *.meta
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!
48 .if make(autoconf-in) || make(configure) || make(config.h.in) || ${AUTO_AUTOCONF:Uno:tl} == "yes"
50 AUTOHEADER ?= autoheader
52 # expand it to a full path
53 AUTOCONF := ${AUTOCONF:${M_whence}}
55 .if exists(${AUTOCONF})
57 .PRECIOUS: configure config.h.in config.status
62 .if exists(${.CURDIR}/aclocal.m4)
65 # use of acconfig.h is deprecated!
66 .if exists(${.CURDIR}/acconfig.h)
67 ACCONFIG += acconfig.h
70 config.h.in: ${.CURDIR}/configure.in ${ACCONFIG}
71 (cd ${.CURDIR} && ${AUTOHEADER})
73 configure: ${.CURDIR}/configure.in ${ACLOCAL}
74 (cd ${.CURDIR} && ${AUTOCONF})
76 AUTOCONF_INPUTS += configure
77 autoconf-input: ${AUTOCONF_INPUTS}