1*0a6a1f1dSLionel Sambuc#!/bin/sh 2*0a6a1f1dSLionel Sambuc# 3*0a6a1f1dSLionel Sambuc# Copyright (c) 2014 Ingo Schwarze <schwarze@openbsd.org> 4*0a6a1f1dSLionel Sambuc# 5*0a6a1f1dSLionel Sambuc# Permission to use, copy, modify, and distribute this software for any 6*0a6a1f1dSLionel Sambuc# purpose with or without fee is hereby granted, provided that the above 7*0a6a1f1dSLionel Sambuc# copyright notice and this permission notice appear in all copies. 8*0a6a1f1dSLionel Sambuc# 9*0a6a1f1dSLionel Sambuc# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 10*0a6a1f1dSLionel Sambuc# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 11*0a6a1f1dSLionel Sambuc# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 12*0a6a1f1dSLionel Sambuc# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 13*0a6a1f1dSLionel Sambuc# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 14*0a6a1f1dSLionel Sambuc# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15*0a6a1f1dSLionel Sambuc# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16*0a6a1f1dSLionel Sambuc 17*0a6a1f1dSLionel Sambucset -e 18*0a6a1f1dSLionel Sambuc 19*0a6a1f1dSLionel SambucSRCDIR=${SRCDIR:-.} 20*0a6a1f1dSLionel Sambucexec > config.h 2> config.log 21*0a6a1f1dSLionel Sambuc 22*0a6a1f1dSLionel SambucCFLAGS="${CFLAGS} -Wno-unused -Werror" 23*0a6a1f1dSLionel Sambuc 24*0a6a1f1dSLionel Sambucruntest() { 25*0a6a1f1dSLionel Sambuc echo ${CC} ${CFLAGS} -o test-${1} ${SRCDIR}/test-${1}.c 1>&2 26*0a6a1f1dSLionel Sambuc ${CC} ${CFLAGS} -o "test-${1}" "${SRCDIR}/test-${1}.c" 1>&2 || return 0 27*0a6a1f1dSLionel Sambuc "./test-${1}" && echo "#define HAVE_${2}" \ 28*0a6a1f1dSLionel Sambuc || echo FAILURE: test-${1} returned $? 1>&2 29*0a6a1f1dSLionel Sambuc rm "test-${1}" 30*0a6a1f1dSLionel Sambuc} 31*0a6a1f1dSLionel Sambuc 32*0a6a1f1dSLionel Sambuccat ${SRCDIR}/config.h.pre 33*0a6a1f1dSLionel Sambucecho 34*0a6a1f1dSLionel Sambucecho "#define VERSION \"${VERSION}\"" 35*0a6a1f1dSLionel Sambucruntest fgetln FGETLN 36*0a6a1f1dSLionel Sambucruntest getsubopt GETSUBOPT 37*0a6a1f1dSLionel Sambucruntest mmap MMAP 38*0a6a1f1dSLionel Sambucruntest ohash OHASH 39*0a6a1f1dSLionel Sambucruntest strcasestr STRCASESTR 40*0a6a1f1dSLionel Sambucruntest strlcat STRLCAT 41*0a6a1f1dSLionel Sambucruntest strlcpy STRLCPY 42*0a6a1f1dSLionel Sambucruntest strnlen STRNLEN 43*0a6a1f1dSLionel Sambucruntest strptime STRPTIME 44*0a6a1f1dSLionel Sambucruntest strsep STRSEP 45*0a6a1f1dSLionel Sambucecho 46*0a6a1f1dSLionel Sambuccat ${SRCDIR}/config.h.post 47*0a6a1f1dSLionel Sambuc 48*0a6a1f1dSLionel Sambucexit 0 49