1# $Id: autoconf.mk,v 1.16 2021/10/19 17:36:06 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.gen config.recheck config.status 17 18CONFIGURE_DEPS += ${.CURDIR}/config.h.in ${.CURDIR}/configure 19 20.if !target(config.h) 21config.h: .NOTMAIN ${CONFIGURE_DEPS} config.status 22 ./config.status 23.if !empty(AUTOCONF_GENERATED_MAKEFILE) && ${AUTOCONF_GENERATED_MAKEFILE:T:@m@${"${.MAKE.MAKEFILES:T:M$m}":?yes:no}@:Mno} != "" 24 @echo Generated ${AUTOCONF_GENERATED_MAKEFILE}, you need to restart; exit 1 25.endif 26.endif 27 28.if !target(config.status) 29# avoid the targets behaving differently 30config.status: .NOTMAIN 31.if exists(${.OBJDIR}/config.status) 32config.status: config.recheck 33.else 34config.status: config.gen 35.endif 36 37config.recheck: .NOTMAIN ${CONFIGURE_DEPS} config.gen 38 ./config.status --recheck 39 @touch $@ 40 41config.gen: .NOTMAIN ${CONFIGURE_DEPS} 42 CC="${CC} ${CCMODE}" ${.CURDIR}/configure --no-create ${CONFIGURE_ARGS} 43 @touch $@ config.recheck 44 45CLEANFILES+= config.recheck config.gen config.status *.meta \ 46 ${AUTOCONF_GENERATED_MAKEFILE:U} 47.endif 48 49# avoid things blowing up if these are not here... 50# this is not quite per the autoconf manual, 51# and is extremely convoluted - but all utterly necessary! 52 53.if make(autoconf-in) || make(configure) || make(config.h.in) || ${AUTO_AUTOCONF:Uno:tl} == "yes" 54AUTOCONF ?= autoconf 55AUTOHEADER ?= autoheader 56 57# expand it to a full path 58AUTOCONF := ${AUTOCONF:${M_whence}} 59 60.if exists(${AUTOCONF}) 61 62.PRECIOUS: configure config.h.in config.status 63 64ACLOCAL = 65ACCONFIG = 66 67.if exists(${.CURDIR}/aclocal.m4) 68ACLOCAL += aclocal.m4 69.endif 70# use of acconfig.h is deprecated! 71.if exists(${.CURDIR}/acconfig.h) 72ACCONFIG += acconfig.h 73.endif 74 75config.h.in: .NOTMAIN ${.CURDIR}/configure.in ${ACCONFIG} 76 (cd ${.CURDIR} && ${AUTOHEADER}) 77 78configure: .NOTMAIN ${.CURDIR}/configure.in ${ACLOCAL} 79 (cd ${.CURDIR} && ${AUTOCONF}) 80 81AUTOCONF_INPUTS += configure 82autoconf-input: .NOTMAIN ${AUTOCONF_INPUTS} 83 84.endif 85.endif 86