File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / pimd / configure
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Mon Jun 12 07:59:37 2017 UTC (7 years ago) by misho
Branches: pimd, MAIN
CVS tags: v2_3_2, HEAD
pimd 2.3.2

    1: #!/bin/sh
    2: #
    3: # --enable-broken-crc:
    4: #   If your RP is buggy cisco PIM-SMv2 implementation that computes
    5: #   the PIM-Register checksum over the whole pkt instead only over
    6: #   the header, you need to define this. Otherwise, all your PIM-Register
    7: #   may be dropped by the cisco-RP.
    8: #DEFS += -DBROKEN_CISCO_CHECKSUM
    9: #
   10: # --enable-kernel-encap:
   11: #   Register kernel encapsulation.  Your kernel must support registers
   12: #   kernel encapsulation to be able to use it.
   13: #DEFS += -DPIM_REG_KERNEL_ENCAP
   14: #
   15: # --enable-kernel-mfc:
   16: #   (*,G) kernel MFC support.  Use it ONLY with (*,G) capable kernel
   17: #DEFS += -DKERNEL_MFC_WC_G
   18: #
   19: # --enable-memory-save:
   20: #   Saves 4 bytes per unconfigured interface per routing entry.  If set,
   21: #   configuring such interface will restart the daemon and will flush
   22: #   the routing table.
   23: #DEFS += -DSAVE_MEMORY
   24: #
   25: # --enable-scoped-acls:
   26: #   Scoped access control list support in pimd.conf.  If you want to
   27: #   install NUL OIF for the "scoped groups", use the following syntax:
   28: #   "phyint IFNAME [scoped <MCAST_ADDR> masklen <PREFIX_LEN>]", e.g.
   29: #      phyint fxp0 scoped "addr" masklen "len"
   30: #   Support contributed by Marian Stagarescu <marian@cidera.com>
   31: #DEFS += -DSCOPED_ACL
   32: #
   33: 
   34: OS=`uname`
   35: CFG=config.mk
   36: TMP=`mktemp /tmp/XXXXXX`
   37: BUGREPORT_URL="https://github.com/troglobit/pimd/issues"
   38: 
   39: # Defaults
   40: debug=0
   41: disable_genid=0
   42: embedded_libc=0
   43: 
   44: print()
   45: {
   46:     case $OS in
   47: 	Linux)
   48: 	    /bin/echo -ne "$*"
   49: 	    ;;
   50: 
   51: 	*)
   52: 	    printf "$*"
   53: 	    ;;
   54:     esac
   55: }
   56: 
   57: heading()
   58: {
   59:     echo "# This makefile snippet is generated by the pimd configure script." > $CFG
   60:     echo >> $CFG
   61:     echo "# Initial definitions ..." >> $CFG
   62:     echo "# -D_GNU_SOURCE Use GNU extensions, where possible" >> $CFG
   63:     echo "# -D_BSD_SOURCE Use functions derived from 4.3 BSD Unix rather than POSIX.1" >> $CFG
   64:     echo "#               In GLIBC >= v2.20 this is replaced with -D_DEFAULT_SOURCE  " >> $CFG
   65:     echo "# -DPIM         Enable PIM extensions in RSRR" >> $CFG
   66:     echo "DEFS          = -D_BSD_SOURCE -D_DEFAULT_SOURCE -D_GNU_SOURCE -DPIM" >> $CFG
   67:     echo "# EXTRA_OBJS  = For locally provided objects missing on some platforms, e.g., strlcpy.o"  >> $CFG
   68:     echo "# EXTRA_LIBS  = For platform specific libraries, e.g., -lutil" >> $CFG
   69:     echo >> $CFG
   70:     echo "# $OS specific settings ..." >> $CFG
   71: }
   72: 
   73: usage()
   74: {
   75:     print "Run this script to configure pimd for your system.\n"
   76:     print "\n"
   77:     print "Usage: configure [ARG]\n"
   78:     print "\n"
   79:     print "  --debug                  Enable debuggable build, -g and -O0\n"
   80:     print "  --prefix=PATH            Base installation directory, default: /usr/local/\n"
   81:     print "  --sysconfdir=PATH        Path to pimd.conf, default: /etc/\n"
   82:     print "  --embedded-libc          Linux system with uClibc or musl libc.  These two\n"
   83:     print "                           C libraries have strlcpy() and strlcat()"
   84:     print "\n"
   85:     print "By default 'make install' installs files to /usr/local/{sbin, share, man} and\n"
   86:     print "/etc/, this can be changed with the --prefix and --syconfdir options. On top of\n"
   87:     print "this you can also set DESTDIR when installing, to get another root directory.\n"
   88:     print "\n"
   89:     print "  --enable-broken-crc      Interop with older broken Cisco firmware that did\n"
   90:     print "                           checksum in PIM Register messages slightly wrong.\n"
   91:     print "                           Should not be needed anymore.\n"
   92:     print "  --enable-kernel-encap    Specialized kernels do PIM Register encapsulation\n"
   93:     print "                           by themselves, speeding up processing considerably.\n"
   94:     print "                           \e[1mNot on Linux/*BSD\e[0m, needs pimkern-PATCH_6!\n"
   95:     print "  --enable-kernel-mfc      Specialized kernels may have (*,G) MFC support.\n"
   96:     print "                           \e[1mNot on Linux/*BSD\e[0m, need pimkern-PATCH_7!\n"
   97:     print "  --enable-memory-save     Save 4 bytes/unconfigured interface/routing entry\n"
   98:     print "                           Must restart pimd and cause routing table to be\n"
   99:     print "                           flushed when configuring new interfaces.\n"
  100:     print "  --enable-scoped-acls     Scoped access control list support in pimd.conf\n"
  101:     print "                           phyint IFNAME [scoped <MCGROUP> masklen <LEN>]\n"
  102:     print "                           phyint fxp0 scoped 239.0.0.0 masklen 8\n"
  103:     print "  --enable-rsrr            Routing Support for Resource Reservations, defined in\n"
  104:     print "                           http://tools.ietf.org/html/draft-ietf-rsvp-routing-02\n"
  105:     print "                           currently used by RSVP.  \e[1mEXPERIMENTAL\e[0m\n"
  106:     print "\n"
  107:     print "  --disable-pim-genid      Disable Generation ID in PIM Hello, RFC3973\n"
  108:     print "  --disable-exit-on-error  Do not exit on error messages (LOG_ERR)\n"
  109:     print "  --disable-masklen-check  Allow virtual tunctl VIFs with masklen 32\n"
  110:     print "\n"
  111:     print "  --with-includes=PATH     Use this if the multicast header files are not in\n"
  112:     print "                           a standard location on your system. E.g., /sys\n"
  113:     print "  --with-max-vifs=MAXVIFS  Kernel maximum number of allowed VIFs, default: 32\n"
  114:     print "                           \e[1mNote:\e[0m Try multiple routing tables instead!\n"
  115:     print "\n"
  116:     print "Report bugs to $BUGREPORT_URL\n"
  117:     print "\n"
  118: 
  119:     exit 1
  120: }
  121: 
  122: echo > $TMP
  123: echo "# Configured settings/features ..." >> $TMP
  124: 
  125: while [ "$*" != "" ]; do
  126:     opt=`expr -- "$1" : "--\([^=]*\)=.*"`
  127:     arg=`expr -- "$1" : "--[^=]*=\(.*\)"`
  128:     if [ -z "$opt" ]; then
  129:         opt=`expr -- "$1" : "--\(.*\)"`
  130: 	if [ -z "$opt" ]; then
  131:             opt=`expr -- "$1" : "-\(.*\)"`
  132: 	fi
  133:     fi
  134:     shift
  135: 
  136:     case $opt in
  137: 	debug)
  138: 	    debug=1;
  139: 	    ;;
  140: 
  141: 	prefix)
  142: 	    echo "prefix        = $arg"     >> $TMP
  143: 	    echo "sysconfdir   += $arg/etc" >> $TMP
  144: 	    ;;
  145: 
  146: 	sysconfdir)
  147: 	    echo "sysconfdir    = $arg" >> $TMP
  148: 	    ;;
  149: 
  150: 	embedded-libc)
  151: 	    embedded_libc=1
  152: 	    ;;
  153: 
  154:         enable-broken-crc)
  155:             echo "DEFS         += -DBROKEN_CISCO_CHECKSUM" >> $TMP
  156:             ;;
  157: 
  158:         enable-kernel-encap)
  159:             echo "DEFS         += -DPIM_REG_KERNEL_ENCAP" >> $TMP
  160:             ;;
  161: 
  162:         enable-kernel-mfc)
  163:             echo "DEFS         += -DKERNEL_MFC_WC_G" >> $TMP
  164:             ;;
  165: 
  166:         enable-memory-save)
  167:             echo "DEFS         += -DSAVE_MEMORY" >> $TMP
  168:             ;;
  169: 
  170:         enable-scoped-acls)
  171:             echo "DEFS         += -DSCOPED_ACL" >> $TMP
  172:             ;;
  173: 
  174:         enable-rsrr)
  175:             echo "DEFS         += -DRSRR" >> $TMP
  176:             echo "EXTRA_OBJS   += rsrr.o" >> $TMP
  177:             ;;
  178: 
  179:         enable-pim-hello-genid)
  180:             echo "PIM Hello GenID is enabled by default."
  181:             ;;
  182: 
  183: 	disable-pim-genid)
  184:             disable_genid=1
  185:             ;;
  186: 
  187:         disable-exit-on-error)
  188:             echo "DEFS         += -DCONTINUE_ON_ERROR" >> $TMP
  189:             ;;
  190: 
  191:         disable-masklen-check)
  192:             echo "DEFS         += -DDISABLE_MASKLEN_CHECK" >> $TMP
  193:             ;;
  194: 
  195:         with-includes)
  196:             echo "INCLUDES     += -I$arg" >> $TMP
  197:             ;;
  198: 
  199:         with-max-vifs)
  200:             echo "DEFS         += -DCUSTOM_MAX_VIFS=$arg" >> $TMP
  201:             ;;
  202: 
  203:         help | h)
  204:             usage
  205:             ;;
  206: 
  207:         *)
  208:             echo "Skipping unknown option: $opt"
  209:             ;;
  210:     esac
  211: done
  212: 
  213: echo "DEFS         += -DPACKAGE_BUGREPORT=\\\"$BUGREPORT_URL\\\"" >> $TMP
  214: 
  215: if [ $disable_genid -ne 1 ]; then
  216:     echo "DEFS         += -DENABLE_PIM_HELLO_GENID" >> $TMP
  217: fi
  218: 
  219: ## BSDI		-D__bsdi__ is defined by the OS
  220: #INCLUDES     = -Iinclude
  221: #DEFS        +=
  222: #EXTRA_OBJS   = strlcpy.o pidfile.o
  223: 
  224: ## SunOS, OSF1, gcc
  225: #INCLUDES     = -Iinclude -Iinclude/sunos-gcc
  226: #DEFS        += -DSunOS=43
  227: #EXTRA_OBJS   = strlcpy.o pidfile.o
  228: 
  229: ## SunOS, OSF1, cc
  230: #INCLUDES     = -Iinclude -Iinclude/sunos-cc
  231: #DEFS        += -DSunOS=43
  232: #EXTRA_OBJS   = strlcpy.o pidfile.o
  233: 
  234: ## IRIX
  235: #INCLUDES     = -Iinclude
  236: #DEFS        += -D_BSD_SIGNALS -DIRIX
  237: #EXTRA_OBJS   = strlcpy.o pidfile.o
  238: 
  239: ## Solaris 2.5, gcc
  240: #INCLUDES     = -Iinclude
  241: #DEFS        += -DSYSV -DSunOS=55
  242: ## Solaris 2.5, cc
  243: #INCLUDES     = -Iinclude
  244: #DEFS        += -DSYSV -DSunOS=55
  245: ## Solaris 2.6
  246: #INCLUDES     = -Iinclude
  247: #DEFS        += -DSYSV -DSunOS=56
  248: ## Solaris 2.x
  249: #EXTRA_OBJS   = strlcpy.o pidfile.o
  250: #EXTRA_LIBS   = -L/usr/ucblib -lucb -L/usr/lib -lsocket -lnsl
  251: case $OS in
  252:     Linux)
  253:         heading
  254: 	echo "INCLUDES     = -Iinclude" >> $CFG
  255: 	echo "DEFS        += -DRAW_OUTPUT_IS_RAW -DIOCTL_OK_ON_RAW_SOCKET" >> $CFG
  256: 	echo "ROUTER_OBJS += netlink.o" >> $CFG
  257: 	if [ $embedded_libc -ne 1 ]; then
  258: 	    echo "EXTRA_OBJS   = libite/strlcpy.o libite/strlcat.o" >> $CFG
  259: 	fi
  260: 	echo "EXTRA_OBJS  += libite/pidfile.o libite/strtonum.o" >> $CFG
  261: 	echo "EXTRA_LIBS   =" >> $CFG
  262: 	;;
  263: 
  264:     FreeBSD)
  265:         heading
  266: 	echo "INCLUDES     =" >> $CFG
  267: 	echo "ROUTER_OBJS += routesock.o" >> $CFG
  268: 	echo "EXTRA_OBJS   = libite/pidfile.o" >> $CFG
  269: 	echo "EXTRA_LIBS   =" >> $CFG
  270: 	;;
  271: 
  272:     NetBSD)
  273:         heading
  274: 	echo "INCLUDES     =" >> $CFG
  275: 	echo "ROUTER_OBJS += routesock.o" >> $CFG
  276: 	echo "EXTRA_OBJS   = libite/strtonum.o" >> $CFG
  277: 	echo "EXTRA_LIBS   = -lutil" >> $CFG
  278: 	;;
  279: 
  280:     OpenBSD)
  281:         heading
  282: 	echo "INCLUDES     =" >> $CFG
  283: 	echo "ROUTER_OBJS += routesock.o" >> $CFG
  284: 	echo "EXTRA_OBJS   =" >> $CFG
  285: 	echo "EXTRA_LIBS   = -lutil" >> $CFG
  286: 	;;
  287: 
  288:     *)
  289: 	rm $CFG
  290: 	echo "$OS is currently unsupported.  Help out at https://github.com/troglobit/pimd/"
  291: 	exit 1
  292: 	;;
  293: esac
  294: 
  295: echo >> $CFG
  296: echo "# Build specific settings ..." >> $CFG
  297: if [ $debug -eq 1 ]; then
  298:     echo "CFLAGS      += -O0 -g" >> $CFG
  299: else
  300:     echo "CFLAGS      += -O2" >> $CFG
  301: fi
  302: 
  303: cat $TMP >> $CFG
  304: rm $TMP
  305: 
  306: if [ ! -e libite/lite.h ]; then
  307:     print "  FIXDEP  libite/lite.h missing ... "
  308:     git submodule update --init >/dev/null
  309:     if [ $? -ne 0 ]; then
  310: 	print "FAILED!  No Internet access?"
  311: 	exit 1
  312:     fi
  313:     print "OK\n"
  314: fi
  315: 
  316: 
  317: exit 0
  318: 

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