#!/bin/sh
EXITCODE=0
if [ $0 != "./configure" ] ; then
echo This script needs to be executed in the directory that
echo contains this script.
exit 1
fi
# MaraDNS 2.0 is AUTHONLY
AUTHONLY="yes"
export AUTHONLY
# Options: '--ipv6'
if [ "$1" = '--ipv6' ] ; then
IPV6="yes"
elif [ -n "$1" ] ; then
echo 'Usage: ./configure [options]'
echo 'Where [options] currently only supports "--ipv6" for'
echo 'making an ipv6-capable build of MaraDNS'
exit 1
fi
# Make sure we are running this script from the maradns base directory
if [ $( pwd | awk -F/ '{print $NF}' | cut -f1 -d- | tr '[A-Z]' '[a-z]' ) \
!= "maradns" ] ; then
echo This script needs to be run from the MaraDNS base
echo directory \(the top-level directory created when the
echo MaraDNS tar file was extracted\)
exit 1
fi
# Set the directory for the build files
BUILDDIR=build
export BUILDDIR
# Show them the disclaimer
cat 00README.FIRST
echo -----
echo
# Try to determine what kind of system we are running
UNAME=`uname -s`
# Make sure the Makefile has the current version number of MaraDNS
# VERSION is a one line file in the form "VERSION=0.1.23" (without the
# quotes
# Now that this is in github, pull the version number from the git log
USE_GIT=$( pwd | cut -f2 -d- )
# However, since 3.5 releases are copies of the Git tree, make sure
# we have the correct version there
if echo $USE_GIT | grep 3.5 > /dev/null ; then
echo VERSION=$USE_GIT > VERSION
elif [ -e .git ] || [ "$USE_GIT" = "master" ] ; then
git log -1 > git.commit 2> /dev/null || echo unknown > git.commit
head -1 git.commit | awk '
{print "VERSION=git-" substr($2,1,10)}' > VERSION
fi
# Looks like github sometimes scrubs symlinks
if [ ! -e server/MaraDNS_locale.h ] ; then
cp server/MaraDNS_en.h server/MaraDNS_locale.h
cp server/MaraBigHash_en.h server/MaraBigHash_locale.h
cp tcp/getzone_en.h tcp/getzone_locale.h
fi
if [ -f VERSION ] ; then
cp VERSION Makefile
elif [ -f $BUILDDIR/VERSION ] ; then
cp $BUILDDIR/VERSION Makefile
else
pwd | awk -F- '{if($2 ~ /Q/){print "VERSION="$2 "-" $3 "-" $4}
else{print "VERSION="$NF}}' > Makefile
fi
# Set up the informaiton on where and when this version of MaraDNS was
# compiled
SA="system at"
if [ -z "$IPV6" ] ; then
echo COMPILED=\"$UNAME system at `date`\" >> Makefile
echo COMPILED_DEBUG=\"$UNAME system at `date`\ \(Debug\)\" >> Makefile
else
echo COMPILED=\"$UNAME system at `date` \(IPv6\)\" >> Makefile
echo COMPILED_DEBUG=\"$UNAME $SA `date`\ \(Debug IPv6\)\" >> Makefile
fi
# Give them a message dependent on what kind of system they have
if echo $UNAME | grep -i linux > /dev/null ; then
cat $BUILDDIR/Makefile.linux >> Makefile
DEADWOOD="$( echo deadwood-*/src )"
cp ${DEADWOOD}/Makefile.centos8 ${DEADWOOD}/Makefile
echo It looks like you are using Linux\; just type in \'make\'
EXITCODE=0
elif echo $UNAME | grep -i mingw32 > /dev/null ; then
cat $BUILDDIR/Makefile.mingw32 >> Makefile
echo It looks like you are using MinGW32 \; this is only a partial
echo port of MaraDNS and does not have all of the security features
echo of other ports of MaraDNS. Only MaraDNS and Askmara will
echo compile. You need mingw32 and pthreads to compile this.
echo You have been warned.
# We don't support --authonly for the mingw32 port
# Other Makefile changes
cp server/Makefile.mingw32 server/Makefile
cp tools/Makefile.mingw32 tools/Makefile
cp qual/Makefile.nothreads qual/Makefile
cp dns/Makefile.authonly dns/Makefile
# Mingw32 doesn't support symlinks
cp server/MaraBigHash_en.h server/MaraBigHash_locale.h
cp server/MaraDNS_en.h server/MaraDNS_locale.h
cp COPYING 00README.FIRST
exit 0
elif echo $UNAME | grep -i cygwin > /dev/null ; then
cat $BUILDDIR/Makefile.noflock >> Makefile
DEADWOOD="$( echo deadwood-*/src )"
cp ${DEADWOOD}/Makefile.centos8 ${DEADWOOD}/Makefile
echo It looks like you are using Cygwin\; this will compile fine
echo by typing in \'make\'.
echo
echo Note that Deadwood will not compile\; use the pre-built
echo Windows service in the maradns-win32/ directory. This
echo service is built using mingw.
echo
echo To start MaraDNS \(authoritative\) as a service:
echo
echo cygrunsrv.exe --install MaraDNS --path /usr/local/bin/maradns.exe
echo cygrunsrv.exe -S MaraDNS
echo
EXITCODE=0
# This is a a template for adding support to a new OS for MaraDNS.
# Some points: If you port MaraDNS, make sure the underlying OS has
# /dev/urandom support or have the default mararc have a
# random_seed_file mararc variable pointing to a file with good
# randomness. Make sure this port compiles and installs. Take
# responsibility for people who have problems with this port.
elif echo $UNAME | grep -i SomeNewPortOfMaradns > /dev/null ; then
cat $BUILDDIR/Makefile.SomeNewPort >> Makefile
echo It looks like you are using NAME OF OS HERE\; this port has
echo been done by YOUR NAME AND CONTACT INFO HERE\; this should
echo compile fine by typing in \'make\'. If you encounter any
echo problems with this port, please contact the person who has
echo done the port before trying to contact the MaraDNS
echo developer.
# The next line is technically optional, but should be here
EXITCODE=0
else
cat $BUILDDIR/Makefile.noflock >> Makefile
echo WARNING WARNING WARNING
echo
echo This is an unknown platform. MaraDNS may or may not compile
echo on this platform. THIS IS NOT A SUPPORTED PLATFORM.
echo DO NOT WASTE MY TIME FILING GITHUB ISSUES ABOUT THIS PLATFORM.
echo
echo To install Deadwood by hand, please read
echo deadwood-github/INSTALL.txt
echo
echo I encourage you to make a fork of MaraDNS for this
echo platform so other users may not see this obnoxious
echo warning.
echo
echo I ask that any fork of MaraDNS not be called \"MaraDNS\"
echo
echo You might be able to compile MaraDNS by typing \"make\"
echo \(if you typed in \"make\" before, just type it again\)
echo
echo THIS PORT HAS NOT BEEN TESTED\; USE AT YOUR OWN RISK
EXITCODE=1
fi
# Set up recursive and authoritative name serving
if [ -z "$IPV6" ] ; then
cp server/Makefile.authonly server/Makefile
cp qual/Makefile.nothreads qual/Makefile
cp tcp/Makefile.authonly tcp/Makefile
cp dns/Makefile.authonly dns/Makefile
cp tools/Makefile.authonly tools/Makefile
else
cp server/Makefile.ipv6 server/Makefile
cp qual/Makefile.nothreads qual/Makefile
cp tcp/Makefile.ipv6 tcp/Makefile
cp dns/Makefile.authonly dns/Makefile
cp tools/Makefile.ipv6 tools/Makefile
DEADWOOD_DIR=$( echo deadwood-* )
cp $DEADWOOD_DIR/src/Makefile.ipv6 $DEADWOOD_DIR/src/Makefile
fi
echo
exit $EXITCODE