1*25f78d91Sagc#! /bin/sh 2*25f78d91Sagc 3*25f78d91Sagc# $NetBSD: configure,v 1.1 2014/03/09 00:15:45 agc Exp $ 4*25f78d91Sagc 5*25f78d91Sagc# Copyright (c) 2013 Alistair Crooks <agc@NetBSD.org> 6*25f78d91Sagc# All rights reserved. 7*25f78d91Sagc# 8*25f78d91Sagc# Redistribution and use in source and binary forms, with or without 9*25f78d91Sagc# modification, are permitted provided that the following conditions 10*25f78d91Sagc# are met: 11*25f78d91Sagc# 1. Redistributions of source code must retain the above copyright 12*25f78d91Sagc# notice, this list of conditions and the following disclaimer. 13*25f78d91Sagc# 2. Redistributions in binary form must reproduce the above copyright 14*25f78d91Sagc# notice, this list of conditions and the following disclaimer in the 15*25f78d91Sagc# documentation and/or other materials provided with the distribution. 16*25f78d91Sagc# 17*25f78d91Sagc# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 18*25f78d91Sagc# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19*25f78d91Sagc# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20*25f78d91Sagc# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21*25f78d91Sagc# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22*25f78d91Sagc# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23*25f78d91Sagc# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24*25f78d91Sagc# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25*25f78d91Sagc# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26*25f78d91Sagc# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27*25f78d91Sagc# 28*25f78d91Sagc 29*25f78d91Sagc# set up defs and paths, etc 30*25f78d91Sagcprefix=/usr/local 31*25f78d91Sagcmandir=${prefix}/man 32*25f78d91Sagcwhile [ $# -gt 0 ]; do 33*25f78d91Sagc case "$1" in 34*25f78d91Sagc --prefix=*) prefix=$(echo "$1" | sed -e 's|--prefix=||') ;; 35*25f78d91Sagc --mandir=*) mandir=$(echo "$1" | sed -e 's|--mandir=||') ;; 36*25f78d91Sagc --build=*|--host=*|--infodir=*) ;; 37*25f78d91Sagc *) break ;; 38*25f78d91Sagc esac 39*25f78d91Sagc shift 40*25f78d91Sagcdone 41*25f78d91Sagc 42*25f78d91Sagcrm -f config.h 43*25f78d91Sagcecho "#ifndef CONFIG_H_" > config.h 44*25f78d91Sagcecho "#define CONFIG_H_ $(date '+%Y%m%d')" >> config.h 45*25f78d91Sagcecho "" >> config.h 46*25f78d91Sagc 47*25f78d91Sagc# portability macros 48*25f78d91Sagcecho "#ifndef __UNCONST" >> config.h 49*25f78d91Sagcecho "#define __UNCONST(a) ((void *)(unsigned long)(const void *)(a))" >> config.h 50*25f78d91Sagcecho "#endif /* __UNCONST */" >> config.h 51*25f78d91Sagcecho "" >> config.h 52*25f78d91Sagcecho "#ifndef USE_ARG" >> config.h 53*25f78d91Sagcecho "#define USE_ARG(x) /*LINTED*/(void)&(x)" >> config.h 54*25f78d91Sagcecho "#endif /* USE_ARG */" >> config.h 55*25f78d91Sagc 56*25f78d91Sagcecho "" >> config.h 57*25f78d91Sagcecho "#endif /* CONFIG_H_ */" >> config.h 58*25f78d91Sagc 59*25f78d91Sagcfor f in Makefile.in; do 60*25f78d91Sagc sed -e 's|@PREFIX@|'${prefix}'|g' \ 61*25f78d91Sagc -e 's|@MANDIR@|'${mandir}'|g' $f > $(basename $f .in) 62*25f78d91Sagcdone 63*25f78d91Sagc 64*25f78d91Sagcexit 0 65