Using OSVERSION in Templates/config.site

Scot Hetzel swhetzel at gmail.com
Fri Apr 26 17:12:23 UTC 2013


Recently a new variable was added to config.site that broke the build on
older systems as it said that we have that function (it was fixed by
commenting out that variable).  In order to allow this new variable to
still be used, I propose that we add the following (taken from bsd.ports.mk)
to the top of config.site:

AWK=/usr/bin/awk
SYSCTL=/sbin/sysctl

if [ "${SRC_BASE}x" = "x" ] ; then
    SRC_BASE=/usr/src
fi

# Get __FreeBSD_version
if [ "${OSVERSION}x" = "x" ] ; then
    if [ -e /usr/include/sys/param.h ] ; then
        OSVERSION=`${AWK} '/^\#define[[:blank:]]__FreeBSD_version/ {print
$$3}' < /usr/include/sys/param.h`
    else if [ -e ${SRC_BASE}/sys/sys/param.h ] ; then
        OSVERSION=`${AWK} '/^\#define[[:blank:]]__FreeBSD_version/ {print
$$3}' < ${SRC_BASE}/sys/sys/param.h`
    else
        OSVERSION=`${SYSCTL} -n kern.osreldate`
    fi
fi

NOTE: OSVERSION and SRC_BASE can be overridden in the CONFIGURE_ENV if
needed.

Then we can change all the commented out variables to:

# Has appeared in FreeBSD 10-CURRENT and FreeBSD 9.1-STABLE
if [ (${OSVERSION} -ge 901503 -a ${OSVERSION} -lt 10000000) -o ${OSVERSION}
-ge 1000025 ]; then
    ac_cv_func_waitid=${ac_cv_func_waitid=yes}
else
    ac_cv_func_waitid=${ac_cv_func_waitid=no}
fi

Unfortunately, my system is down so I won't be able to provide a patch for
this.

-- 
DISCLAIMER:

No electrons were maimed while sending this message. Only slightly bruised.


More information about the freebsd-ports mailing list