xref: /dragonfly/contrib/bmake/mk/autoconf.mk (revision c3762235)
1# $Id: autoconf.mk,v 1.8 2012/11/19 05:37:48 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.if !target(config.h)
19config.h:	${.CURDIR}/config.h.in config.status
20	./config.status
21.endif
22
23.if !target(config.status)
24# avoid the targets behaving differently
25.if exists(${.OBJDIR}/config.status)
26config.status:	config.recheck
27.else
28config.status:  config.gen
29.endif
30
31config.recheck: config.h.in ${.CURDIR}/configure
32	./config.status --recheck
33	@touch $@
34
35config.gen: config.h.in ${.CURDIR}/configure
36	CC="${CC} ${CCMODE}" ${.CURDIR}/configure --no-create ${CONFIGURE_ARGS}
37	@touch $@ config.recheck
38
39CLEANFILES+= config.recheck config.gen config.status *.meta
40.endif
41
42# avoid things blowing up if these are not here...
43# this is not quite per the autoconf manual,
44# and is extremely convoluted - but all utterly necessary!
45
46.if make(autoconf-in) || make(configure) || make(config.h.in) || ${AUTO_AUTOCONF:Uno:tl} == "yes"
47AUTOCONF ?= autoconf
48AUTOHEADER ?= autoheader
49
50# expand it to a full path
51AUTOCONF := ${AUTOCONF:${M_whence}}
52
53.if exists(${AUTOCONF})
54
55.PRECIOUS: configure config.h.in config.status
56
57ACLOCAL =
58ACCONFIG =
59
60.if exists(${.CURDIR}/aclocal.m4)
61ACLOCAL += aclocal.m4
62.endif
63# use of acconfig.h is deprecated!
64.if exists(${.CURDIR}/acconfig.h)
65ACCONFIG += acconfig.h
66.endif
67
68config.h.in:	${.CURDIR}/configure.in ${ACCONFIG}
69	(cd ${.CURDIR} && ${AUTOHEADER})
70
71configure:	${.CURDIR}/configure.in ${ACLOCAL}
72	(cd ${.CURDIR} && ${AUTOCONF})
73
74AUTOCONF_INPUTS += configure
75autoconf-input:	${AUTOCONF_INPUTS}
76
77.endif
78.endif
79