Diff for /embedaddon/miniupnpd/genconfig.sh between versions 1.1.1.2 and 1.1.1.3

version 1.1.1.2, 2012/05/29 12:55:57 version 1.1.1.3, 2013/07/22 00:32:35
Line 2 Line 2
 # $Id$  # $Id$
 # miniupnp daemon  # miniupnp daemon
 # http://miniupnp.free.fr or http://miniupnp.tuxfamily.org/  # http://miniupnp.free.fr or http://miniupnp.tuxfamily.org/
# (c) 2006-2011 Thomas Bernard# (c) 2006-2012 Thomas Bernard
 # This software is subject to the conditions detailed in the  # This software is subject to the conditions detailed in the
 # LICENCE file provided within the distribution  # LICENCE file provided within the distribution
   
   for argv; do
   case "$argv" in
           --ipv6) IPV6=1 ;;
           --igd2) IGD2=1 ;;
           --strict) STRICT=1 ;;
           --leasefile) LEASEFILE=1 ;;
           --help|-h)
                   echo "Usage : $0 [options]"
                   echo " --ipv6      enable IPv6"
                   echo " --igd2      build an IGDv2 instead of an IGDv1"
                   echo " --strict    be more strict regarding compliance with UPnP specifications"
                   echo " --leasefile enable lease file"
                   exit 1
                   ;;
           *)
                   echo "Option not recognized : $argv"
                   echo "use -h option to display help"
                   exit 1
                   ;;
   esac
   done
   
 RM="rm -f"  RM="rm -f"
 CONFIGFILE="config.h"  CONFIGFILE="config.h"
CONFIGMACRO="__CONFIG_H__"CONFIGMACRO="CONFIG_H_INCLUDED"
   
 # version reported in XML descriptions  # version reported in XML descriptions
 #UPNP_VERSION=20070827  #UPNP_VERSION=20070827
Line 34  if [ -f ./os.openwrt ]; then Line 56  if [ -f ./os.openwrt ]; then
         OS_VERSION=$(cat ./os.openwrt)          OS_VERSION=$(cat ./os.openwrt)
 fi  fi
   
   # AstLinux special case
   if [ -f ./os.astlinux ]; then
           OS_NAME=AstLinux
           OS_VERSION=$(cat ./os.astlinux)
   fi
   
   # Tomato USB special case
   if [ -f ../shared/tomato_version ]; then
           OS_NAME=Tomato
           OS_VERSION="Tomato $(cat ../shared/tomato_version)"
   fi
   
 ${RM} ${CONFIGFILE}  ${RM} ${CONFIGFILE}
   
 echo "/* MiniUPnP Project" >> ${CONFIGFILE}  echo "/* MiniUPnP Project" >> ${CONFIGFILE}
 echo " * http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/" >> ${CONFIGFILE}  echo " * http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/" >> ${CONFIGFILE}
echo " * (c) 2006-2011 Thomas Bernard" >> ${CONFIGFILE}echo " * (c) 2006-2012 Thomas Bernard" >> ${CONFIGFILE}
echo " * generated by $0 on `date` */" >> ${CONFIGFILE}echo " * generated by $0 on `date`" >> ${CONFIGFILE}
 echo " * using command line options $* */" >> ${CONFIGFILE}
 echo "#ifndef $CONFIGMACRO" >> ${CONFIGFILE}  echo "#ifndef $CONFIGMACRO" >> ${CONFIGFILE}
 echo "#define $CONFIGMACRO" >> ${CONFIGFILE}  echo "#define $CONFIGMACRO" >> ${CONFIGFILE}
 echo "" >> ${CONFIGFILE}  echo "" >> ${CONFIGFILE}
Line 67  case $OS_NAME in Line 102  case $OS_NAME in
                 if [ \( $MAJORVER -ge 5 \) -o \( $MAJORVER -eq 4 -a $MINORVER -ge 7 \) ]; then                  if [ \( $MAJORVER -ge 5 \) -o \( $MAJORVER -eq 4 -a $MINORVER -ge 7 \) ]; then
                         echo "#define PF_NEWSTYLE" >> ${CONFIGFILE}                          echo "#define PF_NEWSTYLE" >> ${CONFIGFILE}
                 fi                  fi
                echo "#define USE_PF 1" >> ${CONFIGFILE}                # onrdomain was introduced in OpenBSD 5.0
                 if [ $MAJORVER -ge 5 ]; then
                         echo "#define PFRULE_HAS_ONRDOMAIN" >> ${CONFIGFILE}
                 fi
                 FW=pf                  FW=pf
                 echo "#define USE_IFACEWATCHER 1" >> ${CONFIGFILE}                  echo "#define USE_IFACEWATCHER 1" >> ${CONFIGFILE}
                 OS_URL=http://www.openbsd.org/                  OS_URL=http://www.openbsd.org/
Line 79  case $OS_NAME in Line 117  case $OS_NAME in
                 fi                  fi
                 # new way to see which one to use PF or IPF.                  # new way to see which one to use PF or IPF.
                 # see http://miniupnp.tuxfamily.org/forum/viewtopic.php?p=957                  # see http://miniupnp.tuxfamily.org/forum/viewtopic.php?p=957
                # source file wource config file so we can probe vars                if [ -f /etc/rc.subr ] && [ -f /etc/rc.conf ] ; then
                if [ -f /etc/rc.subr ] && [ -f /etc/rc.conf ]; then 
                         # source file with handy subroutines like checkyesno                          # source file with handy subroutines like checkyesno
                         . /etc/rc.subr                          . /etc/rc.subr
                         # source config file so we can probe vars                          # source config file so we can probe vars
                         . /etc/rc.conf                          . /etc/rc.conf
                         if checkyesno ipfilter_enable; then                          if checkyesno ipfilter_enable; then
                                 echo "Using ipf"                                  echo "Using ipf"
                                FW=ipf                        FW=ipf
                                echo "#define USE_IPF 1" >> ${CONFIGFILE} 
                         elif checkyesno pf_enable; then                          elif checkyesno pf_enable; then
                                 echo "Using pf"                                  echo "Using pf"
                                 FW=pf                                  FW=pf
                                echo "#define USE_PF 1" >> ${CONFIGFILE}                        elif checkyesno firewall_enable; then
                        else                                echo "Using ifpw"
                                echo "Could not detect usage of ipf or pf. Compiling for pf by default"                                FW=ipfw
                                FW=pf 
                                echo "#define USE_PF 1" >> ${CONFIGFILE} 
                         fi                          fi
                # TODO : Add support for IPFW                fi
                # echo "#define USE_IPFW 1" >> ${CONFIGFILE}                if [ -z $FW ] ; then
                # FW=ipfw                        echo "Could not detect usage of ipf, pf, ipfw. Compiling for pf by default"
                else 
                        echo "Could not detect usage of ipf or pf. Compiling for pf by default" 
                         FW=pf                          FW=pf
                         echo "#define USE_PF 1" >> ${CONFIGFILE}  
                 fi                  fi
                 echo "#define USE_IFACEWATCHER 1" >> ${CONFIGFILE}                  echo "#define USE_IFACEWATCHER 1" >> ${CONFIGFILE}
                 OS_URL=http://www.freebsd.org/                  OS_URL=http://www.freebsd.org/
                 ;;                  ;;
         pfSense)          pfSense)
                 # we need to detect if PFRULE_INOUT_COUNTS macro is needed                  # we need to detect if PFRULE_INOUT_COUNTS macro is needed
                 echo "#define USE_PF 1" >> ${CONFIGFILE}  
                 FW=pf                  FW=pf
                 echo "#define USE_IFACEWATCHER 1" >> ${CONFIGFILE}                  echo "#define USE_IFACEWATCHER 1" >> ${CONFIGFILE}
                 OS_URL=http://www.pfsense.com/                  OS_URL=http://www.pfsense.com/
                 ;;                  ;;
         NetBSD)          NetBSD)
                # source file with handy subroutines like checkyesno                if [ -f /etc/rc.subr ] && [ -f /etc/rc.conf ] ; then
                . /etc/rc.subr                        # source file with handy subroutines like checkyesno
                # source config file so we can probe vars                        . /etc/rc.subr
                . /etc/rc.conf                        # source config file so we can probe vars
                if checkyesno pf; then                        . /etc/rc.conf
                        echo "#define USE_PF 1" >> ${CONFIGFILE}                        if checkyesno pf; then
                        FW=pf                                FW=pf
                elif checkyesno ipfilter; then                        elif checkyesno ipfilter; then
                        echo "#define USE_IPF 1" >> ${CONFIGFILE}                                FW=ipf
                        FW=ipf                        fi
                else                fi
                 if [ -z $FW ] ; then
                         echo "Could not detect ipf nor pf, defaulting to pf."                          echo "Could not detect ipf nor pf, defaulting to pf."
                         echo "#define USE_PF 1" >> ${CONFIGFILE}  
                         FW=pf                          FW=pf
                 fi                  fi
                 echo "#define USE_IFACEWATCHER 1" >> ${CONFIGFILE}                  echo "#define USE_IFACEWATCHER 1" >> ${CONFIGFILE}
                 OS_URL=http://www.netbsd.org/                  OS_URL=http://www.netbsd.org/
                 ;;                  ;;
         DragonFly)          DragonFly)
                # source file with handy subroutines like checkyesno                if [ -f /etc/rc.subr ] && [ -f /etc/rc.conf ] ; then
                . /etc/rc.subr                        # source file with handy subroutines like checkyesno
                # source config file so we can probe vars                        . /etc/rc.subr
                . /etc/rc.conf                        # source config file so we can probe vars
                if checkyesno pf; then                        . /etc/rc.conf
                        echo "#define USE_PF 1" >> ${CONFIGFILE}                        if checkyesno pf; then
                        FW=pf                                FW=pf
                elif checkyesno ipfilter; then                        elif checkyesno ipfilter; then
                        echo "#define USE_IPF 1" >> ${CONFIGFILE}                                FW=ipf
                        FW=ipf                        fi
                else                fi
                 if [ -z $FW ] ; then
                         echo "Could not detect ipf nor pf, defaulting to pf."                          echo "Could not detect ipf nor pf, defaulting to pf."
                         echo "#define USE_PF 1" >> ${CONFIGFILE}  
                         FW=pf                          FW=pf
                 fi                  fi
                 echo "#define USE_IFACEWATCHER 1" >> ${CONFIGFILE}                  echo "#define USE_IFACEWATCHER 1" >> ${CONFIGFILE}
                 OS_URL=http://www.dragonflybsd.org/                  OS_URL=http://www.dragonflybsd.org/
                 ;;                  ;;
         SunOS)          SunOS)
                 echo "#define USE_IPF 1" >> ${CONFIGFILE}  
                 echo "#define USE_IFACEWATCHER 1" >> ${CONFIGFILE}                  echo "#define USE_IFACEWATCHER 1" >> ${CONFIGFILE}
                 FW=ipf                  FW=ipf
                 echo "#define LOG_PERROR 0" >> ${CONFIGFILE}                  echo "#define LOG_PERROR 0" >> ${CONFIGFILE}
                 echo "#define SOLARIS_KSTATS 1" >> ${CONFIGFILE}                  echo "#define SOLARIS_KSTATS 1" >> ${CONFIGFILE}
                   # solaris 10 does not define u_int64_t ?
                   # but it does define uint64_t
                   echo "typedef uint64_t u_int64_t;" >> ${CONFIGFILE}
                 OS_URL=http://www.sun.com/solaris/                  OS_URL=http://www.sun.com/solaris/
                 ;;                  ;;
         Linux)          Linux)
Line 200  case $OS_NAME in Line 232  case $OS_NAME in
                                         ;;                                          ;;
                         esac                          esac
                 fi                  fi
                 echo "#define USE_NETFILTER 1" >> ${CONFIGFILE}  
                 echo "#define USE_IFACEWATCHER 1" >> ${CONFIGFILE}                  echo "#define USE_IFACEWATCHER 1" >> ${CONFIGFILE}
                 FW=netfilter                  FW=netfilter
                 ;;                  ;;
         OpenWRT)          OpenWRT)
                 OS_URL=http://www.openwrt.org/                  OS_URL=http://www.openwrt.org/
                 echo "#define USE_NETFILTER 1" >> ${CONFIGFILE}  
                 echo "#define USE_IFACEWATCHER 1" >> ${CONFIGFILE}                  echo "#define USE_IFACEWATCHER 1" >> ${CONFIGFILE}
                 FW=netfilter                  FW=netfilter
                 ;;                  ;;
           AstLinux)
                   OS_URL=http://www.astlinux.org/
                   echo "#define USE_IFACEWATCHER 1" >> ${CONFIGFILE}
                   FW=netfilter
                   ;;
           Tomato)
                   OS_NAME=UPnP
                   OS_URL=http://tomatousb.org/
                   echo "" >> ${CONFIGFILE}
                   echo "#include <tomato_config.h>" >> ${CONFIGFILE}
                   echo "" >> ${CONFIGFILE}
                   echo "#ifdef LINUX26" >> ${CONFIGFILE}
                   echo "#define USE_IFACEWATCHER 1" >> ${CONFIGFILE}
                   echo "#endif" >> ${CONFIGFILE}
                   echo "#ifdef TCONFIG_IPV6" >> ${CONFIGFILE}
                   echo "#define ENABLE_IPV6" >> ${CONFIGFILE}
                   echo "#endif" >> ${CONFIGFILE}
                   FW=netfilter
                   ;;
         Darwin)          Darwin)
                 echo "#define USE_IPFW 1" >> ${CONFIGFILE}  
                 echo "#define USE_IFACEWATCHER 1" >> ${CONFIGFILE}                  echo "#define USE_IFACEWATCHER 1" >> ${CONFIGFILE}
                 FW=ipfw                  FW=ipfw
                 OS_URL=http://developer.apple.com/macosx                  OS_URL=http://developer.apple.com/macosx
Line 223  case $OS_NAME in Line 271  case $OS_NAME in
                 ;;                  ;;
 esac  esac
   
   case $FW in
           pf)
                   echo "#define USE_PF 1" >> ${CONFIGFILE}
                   ;;
           ipf)
                   echo "#define USE_IPF 1" >> ${CONFIGFILE}
                   ;;
           ipfw)
                   echo "#define USE_IPFW 1" >> ${CONFIGFILE}
                   ;;
           netfilter)
                   echo "#define USE_NETFILTER 1" >> ${CONFIGFILE}
                   ;;
           *)
                   echo "Unknown Firewall/packet filtering software [$FW]"
                   echo "Please contact the author at http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/."
                   exit 1
                   ;;
   esac
   
 echo "Configuring compilation for [$OS_NAME] [$OS_VERSION] with [$FW] firewall software."  echo "Configuring compilation for [$OS_NAME] [$OS_VERSION] with [$FW] firewall software."
 echo "Please edit config.h for more compilation options."  echo "Please edit config.h for more compilation options."
   
Line 253  echo "" >> ${CONFIGFILE} Line 321  echo "" >> ${CONFIGFILE}
   
 echo "/* Uncomment the following line to enable generation of" >> ${CONFIGFILE}  echo "/* Uncomment the following line to enable generation of" >> ${CONFIGFILE}
 echo " * filter rules with pf */" >> ${CONFIGFILE}  echo " * filter rules with pf */" >> ${CONFIGFILE}
echo "#define PF_ENABLE_FILTER_RULES">> ${CONFIGFILE}echo "/*#define PF_ENABLE_FILTER_RULES*/">> ${CONFIGFILE}
 echo "" >> ${CONFIGFILE}  echo "" >> ${CONFIGFILE}
   
 echo "/* Uncomment the following line to enable caching of results of" >> ${CONFIGFILE}  echo "/* Uncomment the following line to enable caching of results of" >> ${CONFIGFILE}
Line 276  echo "#define USE_DAEMON" >> ${CONFIGFILE} Line 344  echo "#define USE_DAEMON" >> ${CONFIGFILE}
 echo "" >> ${CONFIGFILE}  echo "" >> ${CONFIGFILE}
   
 echo "/* Uncomment the following line to enable lease file support */" >> ${CONFIGFILE}  echo "/* Uncomment the following line to enable lease file support */" >> ${CONFIGFILE}
echo "/*#define ENABLE_LEASEFILE*/" >> ${CONFIGFILE}if [ -n "$LEASEFILE" ] ; then
         echo "#define ENABLE_LEASEFILE" >> ${CONFIGFILE}
 else
         echo "/*#define ENABLE_LEASEFILE*/" >> ${CONFIGFILE}
 fi
 echo "" >> ${CONFIGFILE}  echo "" >> ${CONFIGFILE}
   
 echo "/* Define one or none of the two following macros in order to make some" >> ${CONFIGFILE}  echo "/* Define one or none of the two following macros in order to make some" >> ${CONFIGFILE}
Line 288  echo "#define ENABLE_L3F_SERVICE" >> ${CONFIGFILE} Line 360  echo "#define ENABLE_L3F_SERVICE" >> ${CONFIGFILE}
 echo "" >> ${CONFIGFILE}  echo "" >> ${CONFIGFILE}
   
 echo "/* Enable IP v6 support */" >> ${CONFIGFILE}  echo "/* Enable IP v6 support */" >> ${CONFIGFILE}
echo "/*#define ENABLE_IPV6*/" >> ${CONFIGFILE}if [ -n "$IPV6" ]; then
         echo "#define ENABLE_IPV6" >> ${CONFIGFILE}
 else
         echo "/*#define ENABLE_IPV6*/" >> ${CONFIGFILE}
 fi
 echo "" >> ${CONFIGFILE}  echo "" >> ${CONFIGFILE}
   
 echo "/* Enable the support of IGD v2 specification." >> ${CONFIGFILE}  echo "/* Enable the support of IGD v2 specification." >> ${CONFIGFILE}
 echo " * This is not fully tested yet and can cause incompatibilities with some" >> ${CONFIGFILE}  echo " * This is not fully tested yet and can cause incompatibilities with some" >> ${CONFIGFILE}
 echo " * control points, so enable with care. */" >> ${CONFIGFILE}  echo " * control points, so enable with care. */" >> ${CONFIGFILE}
echo "/*#define IGD_V2*/" >> ${CONFIGFILE}if [ -n "$IGD2" ]; then
         echo "#define IGD_V2" >> ${CONFIGFILE}
 else
         echo "/*#define IGD_V2*/" >> ${CONFIGFILE}
 fi
 echo "" >> ${CONFIGFILE}  echo "" >> ${CONFIGFILE}
   
 echo "#ifdef IGD_V2" >> ${CONFIGFILE}  echo "#ifdef IGD_V2" >> ${CONFIGFILE}
Line 323  echo "" >> ${CONFIGFILE} Line 403  echo "" >> ${CONFIGFILE}
   
 echo "/* Enable to make MiniUPnPd more strict about UPnP conformance" >> ${CONFIGFILE}  echo "/* Enable to make MiniUPnPd more strict about UPnP conformance" >> ${CONFIGFILE}
 echo " * and the messages it receives from control points */" >> ${CONFIGFILE}  echo " * and the messages it receives from control points */" >> ${CONFIGFILE}
echo "/*#define UPNP_STRICT*/" >> ${CONFIGFILE}if [ -n "$STRICT" ] ; then
         echo "#define UPNP_STRICT" >> ${CONFIGFILE}
 else
         echo "/*#define UPNP_STRICT*/" >> ${CONFIGFILE}
 fi
 echo "" >> ${CONFIGFILE}
 
 echo "/* Add the optional Date: header in all HTTP responses */" >> ${CONFIGFILE}
 if [ -n "$STRICT" ] ; then
         echo "#define ENABLE_HTTP_DATE" >> ${CONFIGFILE}
 else
         echo "/*#define ENABLE_HTTP_DATE*/" >> ${CONFIGFILE}
 fi
 echo "" >> ${CONFIGFILE}
 
 echo "/* disable reading and parsing of config file (miniupnpd.conf) */" >> ${CONFIGFILE}
 echo "/*#define DISABLE_CONFIG_FILE*/" >> ${CONFIGFILE}
 echo "" >> ${CONFIGFILE}  echo "" >> ${CONFIGFILE}
   
 echo "#endif" >> ${CONFIGFILE}  echo "#endif" >> ${CONFIGFILE}

Removed from v.1.1.1.2  
changed lines
  Added in v.1.1.1.3


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>