Guest User

NS2allinone - install.sh

a guest
Jul 24th, 2010
339
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 25.64 KB | None | 0 0
  1. #! /bin/sh
  2. #
  3. # Copyright (C) 2000 by USC/ISI
  4. # All rights reserved.
  5. #
  6. # Redistribution and use in source and binary forms are permitted
  7. # provided that the above copyright notice and this paragraph are
  8. # duplicated in all such forms and that any documentation, advertising
  9. # materials, and other materials related to such distribution and use
  10. # acknowledge that the software was developed by the University of
  11. # Southern California, Information Sciences Institute.  The name of the
  12. # University may not be used to endorse or promote products derived from
  13. # this software without specific prior written permission.
  14. #
  15. # THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED
  16. # WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
  17. # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  18. #
  19. # $Header: /cvsroot/nsnam/ns-2/allinone/install,v 1.31 2007/03/10 23:40:05 tom_henderson Exp $
  20.  
  21. die() {
  22.     echo "$@"  1>&2
  23.     test ! -z "$blame" && echo "$blame" 1>&2
  24.     exit 1
  25. }
  26.  
  27. warn() {
  28.     echo "$@"
  29. }
  30.  
  31. test_proceed() {
  32.         echo "";
  33.         echo "The above test indicates that your installation of Cygwin";
  34.         echo "is probably NOT SUITABLE for installing ns-2 allinone.";
  35.         echo "(More details can be found in the specific error message above.)";
  36.         echo "";
  37.         echo -n "Do you wish to proceed regardless? [y/N] "
  38.         read answer;
  39.         if [ "$answer" != "y" ] && [ "$answer" != "Y" ]; then
  40.                 die "Installation aborted...";
  41.                 exit 1;
  42.         fi;
  43.         echo "";
  44.         echo "*** OK, but you're on your own... ***";
  45.         echo "";
  46. }
  47.  
  48. test_packages() {
  49.          for i in $@; do
  50.                 echo -n "Checking for ${i}... ";
  51.                 cygcheck -c ${i} | grep ${i} >/dev/null 2>&1;
  52.                 if [ "$?" -eq "0" ]; then
  53.                         echo "ok";
  54.                 else
  55.                         echo "NO!";
  56.                         echo "";
  57.                         echo "Package ${i} is not present on your system.";
  58.                         echo "";
  59.                         echo "Please install it using Cygwin's setup.exe";
  60.                         echo "before trying to install the ns-2 distribution.";
  61.                         test_proceed;
  62.                 fi;
  63.         done;
  64. }
  65.  
  66. cygwin_tests() {
  67.         echo -n "Checking Cygwin version is >= 1.3.12... "
  68.         cmaj=` uname -r | sed -e 's/^\([0-9]*\)\.\([0-9]*\).\([0-9]*\).*/\1/'`;
  69.         echo $cmaj | grep -v [0-9] >/dev/null 2>&1
  70.         if [ "$?" -eq "0" ]; then
  71.                 cmaj=0;
  72.         fi;
  73.         cmin=` uname -r | sed -e 's/^\([0-9]*\)\.\([0-9]*\).\([0-9]*\).*/\2/'`;
  74.         echo $cmin | grep -v [0-9] >/dev/null 2>&1
  75.         if [ "$?" -eq "0" ]; then
  76.                 cmin=0;
  77.         fi;
  78.         cpat=` uname -r | sed -e 's/^\([0-9]*\)\.\([0-9]*\).\([0-9]*\).*/\3/'`;
  79.         echo $cpat | grep -v [0-9] >/dev/null 2>&1
  80.         if [ "$?" -eq "0" ]; then
  81.                 cpat=0;
  82.         fi;
  83.         echo -n "$cmaj.$cmin.$cpat ";
  84.         if ([ "$cmaj" -gt "1" ]) || ([ "$cmaj" -eq "1" ] && [ $cmin -gt "3" ]) || ([ "$cmaj" -eq 1 ] && [ $cmin -eq "3" ] && [ "$cpat" -ge "12" ]); then
  85.                 echo "(should be ok)";
  86.         else
  87.                 echo "(NO!)";
  88.                 echo "";
  89.                 echo "ns-allinone-${NSVER} has not been tested under versions of Cygwin older than";
  90.                 echo "1.3.12. Your version ($cmaj.$cmin.$cpat) appears to be older than that. Success of";
  91.                 echo "the install process is therefore NOT GUARANTEED.";
  92.                 echo "";
  93.                 cygversion="failed";
  94.                 test_proceed;
  95.         fi;
  96.         echo -n "Checking filesystems are mounted as UNIX filetype... ";
  97.         mount | grep "textmode" >/dev/null 2>&1;
  98.         if [ "$?" -eq "0" ]; then
  99.                 echo "NO!";
  100.                 mount_test="failed";
  101.                 echo "";
  102.                 echo "It appears that some of your Cygwin shares are mounted as DOS file";
  103.                 echo "type. This has not been tested, but is likely to result in failure of";
  104.                 echo "validation tests. Success of the install process is also NOT";
  105.                 echo "GUARANTEED.";
  106.                 echo "";
  107.                 echo "Refer to the Cygwin user guide for how to install Cygwin with the UNIX";
  108.                 echo "file text mode.";
  109.                 test_proceed;
  110.         else
  111.                 echo "yes";
  112.                 echo -n "Checking default mode is binmode... ";
  113.                 echo ${CYGWIN} | grep "nobinmode" >/dev/null 2>&1;
  114.                 if [ "$?" -eq "0" ]; then
  115.                         cyg_env_var="failed";
  116.                         echo "*** NO! ***";
  117.                         echo "";
  118.                         echo "Your \$CYGWIN environment variable specifies \"nobinmode\". This is";
  119.                         echo "likely to result in failure of validation tests, and (possibly) of";
  120.                         echo "the whole install process. You need to have the \$CYGWIN environment";
  121.                         echo "variable set to \"binmode\". Please refer to the Cygwin user guide for";
  122.                         echo "details on how to change this.";
  123.                         test_proceed;
  124.                 else
  125.                         echo "yes";
  126.                 fi;
  127.         fi;                          
  128.  
  129.         login=`whoami`
  130.         echo -n "Checking legitimate login name... ";
  131.         echo ${login} | grep " " >/dev/null 2>&1;
  132.         if [ "$?" -eq "0" ]; then
  133.                 echo "NO!";
  134.                 echo "";
  135.                 echo "Your username (${login}) contains spaces,";
  136.                 echo "which makes the installation of ns-2 impossible.";
  137.                 echo "Please try to install ns-2 as a different user, whose";
  138.                 echo "name does not contain any spaces.";
  139.                
  140.                 test_proceed;
  141.         else
  142.                 echo "ok";
  143.         fi;
  144.  
  145.         echo -n "Checking legitimate path name... ";
  146.        
  147.         installpath=`cygpath -d /`;
  148.         echo ${installpath} | grep " " >/dev/null 2>&1;
  149.         if [ "$?" -eq "0" ]; then
  150.                 echo "NO!";
  151.                 echo "";
  152.                 echo "Your Cygwin installation path (${installpath}) contains spaces,";
  153.                 echo "which makes the installation of ns-2 impossible.";
  154.                 echo "Please reinstall Cygwin in a different directory, which";
  155.                 echo "does not contain any spaces.";
  156.                 test_proceed;
  157.         else
  158.                 echo "ok";
  159.         fi;
  160.  
  161.         test_packages ${packages_base}        
  162.  
  163.         echo -n "Checking for diff... ";
  164.         diff -v 2>&1 | grep -iv "not found" >/dev/null 2>&1;
  165.         if [ "$?" -eq "0" ]; then
  166.                 echo "ok";
  167.         else
  168.                 echo "NO!";
  169.                 echo "";
  170.                 echo "diff is not present on your system.";
  171.                 echo "";
  172.                 echo "Please install it using Cygwin's setup.exe";
  173.                 echo "before trying to install the ns-2 distribution.";
  174.                 test_proceed;
  175.         fi;    
  176.  
  177.         echo -n "Checking for X... ";
  178.         cygcheck -c xorg-x11-base | grep xorg-x11-base >/dev/null 2>&1;
  179.         if [ "$?" -eq "0" ]; then
  180.                 echo "X.org";
  181.                 test_packages ${packages_xorg}
  182.                
  183.         else
  184.                 cygcheck -c XFree86-base | grep XFree86-base >/dev/null 2>&1;
  185.                 if [ "$?" -eq "0" ]; then
  186.                         echo "XFree86";
  187.                         test_packages ${packages_xfree}                                              
  188.                 else
  189.                         echo "None found!";
  190.                        
  191.                         echo "";
  192.                         echo "Neither Package xorg-x11-base nor XFree86-base is present on your system.";
  193.                         echo "";
  194.                         echo "Please install one of it using Cygwin's setup.exe";
  195.                         echo "before trying to install the ns-2 distribution.";
  196.                         test_proceed;
  197.                        
  198.                  fi;
  199.         fi;
  200.     }
  201.  
  202.  
  203. # Package VERSIONs. Change these when releasing new packages
  204. TCLVER=8.4.18
  205. TKVER=8.4.18
  206. OTCLVER=1.13
  207. TCLCLVER=1.19
  208. NSVER=2.34
  209. NAMVER=1.14
  210. XGRAPHVER=12.1
  211. ZLIBVER=1.2.3
  212. DEI80211MRVER=1.1.4
  213.  
  214. # Get current path
  215. CUR_PATH=`pwd`
  216.  
  217. echo "============================================================"
  218. echo "* Testing for Darwin (OS X) environment"
  219. echo "============================================================"
  220. if  [ `uname` = "Darwin" ]; then
  221.     echo "Darwin detected";
  222.     DYLD_LIBRARY_PATH=$CUR_PATH/tcl$TCLVER/unix:$CUR_PATH/tk$TKVER/unix:$DYLD_LIBRARY_PATH
  223.     export DYLD_LIBRARY_PATH
  224.     test_darwin=true
  225. fi
  226.  
  227. # A Cygwin install requires these packages:
  228. packages_base="gcc gcc-g++ gawk tar gzip make patch perl w32api"
  229. packages_xfree="XFree86-bin XFree86-prog XFree86-lib XFree86-etc"
  230. packages_xorg="xorg-x11-bin xorg-x11-bin-dlls xorg-x11-devel xorg-x11-libs-data xorg-x11-etc"
  231.  
  232. # Check if we are using Cygwin, and if so, if it is a good install
  233. # Most Cygwin fixes in the tree and this part of the install script were
  234. # contributed by Nicolas Christin <[email protected]>
  235.  
  236. echo "============================================================"
  237. echo "* Testing for Cygwin environment"
  238. echo "============================================================"
  239.  
  240. if [ -x /usr/bin/uname ]; then
  241.         # it may be a Cygwin install
  242.         test_cygwin=`uname | tr [a-z] [A-Z] | sed -e 's|.*CYGWIN.*|true|'`;
  243.         if  [ "${test_cygwin}" = "true" ]; then
  244.                 echo "Cygwin detected";
  245.                 echo "Note: Cygwin install is still considered EXPERIMENTAL";
  246.                 echo "";
  247.                 cygwin_tests;
  248.                
  249.                 echo "Patching Tcl/Tk for Cygwin.";
  250.                 if [ ! -f ./tcl${TCLVER}/generic/tcl.h.orig ]; then
  251.                         cp ./tcl${TCLVER}/generic/tcl.h ./tcl${TCLVER}/generic/tcl.h.orig;
  252.                         echo "The original tcl${TCLVER}/generic/tcl.h is backed up as tcl${TCLVER}/generic/tcl.h.orig";
  253.                         sed -e 's/\#define _TCL/\#define _TCL\`\`\#ifdef __CYGWIN__\`\#define HAVE_TM_ZONE 1\`\#endif \/\* __CYGWIN__ \*\//g' ./tcl${TCLVER}/generic/tcl.h.orig | tr '\`' '\n' > ./tcl${TCLVER}/generic/tcl.h;
  254.             cp ./tk${TCLVER}/generic/default.h ./tk${TCLVER}/generic/default.h.orig;
  255.                         echo "The original tk${TKVER}/generic/default.h is backed up as tk${TKVER}/generic/default.h.orig";
  256.                         sed -e 's/defined(__CYGWIN__) || defined(__MINGW32__)/0/g' ./tk${TKVER}/generic/default.h.orig > ./tk${TKVER}/generic/default.h;
  257.                 fi;
  258.                 touch ./tcl${TCLVER}/generic/tclStubInit.c;
  259.                 echo "Patching sgb for Cygwin.";
  260.                 cp ./sgb/Makefile ./sgb/Makefile.orig;
  261.                 echo "The original sgb/Makefile is backed up as sgb/Makefile.orig";
  262.                 sed -e 's|rm \(.*\)test_io test_graph test_flip test_sample\(.*\)|rm -f \1test_io.exe test_graph.exe test_flip.exe test_sample.exe\2|' ./sgb/Makefile.orig > ./sgb/Makefile;
  263.                 echo "Setting executable format to .exe...";
  264.                 EXE=".exe";
  265.         else
  266.                 echo "Cygwin not detected, proceeding with regular install.";
  267.                 EXE=;
  268.         fi;
  269. else
  270.         echo "Cygwin not detected, proceeding with regular install.";
  271. fi;
  272.  
  273. echo "============================================================"
  274. echo "* Testing for FreeBSD environment"
  275. echo "============================================================"
  276. # See if we need to use gmake.
  277. if [ "`uname -s`" = "FreeBSD" ]; then
  278.  echo "FreeBSD detected; using gmake instead of make"
  279.  if (type gmake &>/dev/null); then
  280.    alias make="gmake"
  281.  fi
  282. else
  283.  echo "FreeBSD not detected"
  284. fi
  285.  
  286. # Compile and install xgraph
  287.  
  288. echo "============================================================"
  289. echo "* Build XGraph-$XGRAPHVER"
  290. echo "============================================================"
  291.  
  292. cd ./xgraph-$XGRAPHVER
  293. ./configure --prefix=../
  294. if  [ "${test_cygwin}" = "true" ]; then
  295.        touch stamp-h;
  296. fi;
  297. if make
  298. then
  299.     echo "xgraph has been installed successfully. "
  300. else
  301.     echo "Can not create xgraph; But xgraph is an optional package, continuing..."
  302. fi
  303.  
  304. cd ../
  305.  
  306. # Compile and install cweb and sgblib
  307.  
  308. echo "============================================================"
  309. echo "* Build CWeb"
  310. echo "============================================================"
  311.  
  312. cd ./cweb
  313.  
  314. if [ ! -f ./Makefile ]
  315. then
  316.     echo "ns-allinone unable to install cweb for you. Please install it manually. cweb is used by sgb to create sgblibrary needed by scenario-generator. But this will not affect the use of ns as such, so continue.."
  317. else
  318.     echo "Making cweb"
  319.     touch *.c
  320.     make all || warn "cweb failed to make, but it's optional"
  321.     # xxx: other stuff will fail...
  322.     chmod 755 cweave${EXE}
  323.     chmod 755 ctangle${EXE}
  324.     cd ..
  325.     #echo "cd .."
  326.     if [ ! -d bin ]
  327.     then
  328.         mkdir bin
  329.     fi
  330.     cd bin
  331.     ln -s $CUR_PATH/cweb/cweave${EXE} cweave${EXE}
  332.     ln -s $CUR_PATH/cweb/ctangle${EXE} ctangle${EXE}
  333. fi
  334.  
  335. cd ..
  336. PATH=$CUR_PATH/bin:$PATH
  337. export PATH
  338.  
  339. echo "============================================================"
  340. echo "* Build Stanford GraphBase"
  341. echo "============================================================"
  342.  
  343. cd ./sgb
  344. if [ ! -f ./Makefile ]
  345.     then
  346.     echo "Unable to create sgb library. This library is used by gt-itm and so for scenario generators. If you already have sgblib (possible if you are on solaris,sunos or freebsd platforms) you may still be able to run gt-itm. so continuing.."
  347. else
  348.     echo "Making sgb"
  349.     if make tests
  350.     then
  351.                 if [ -f libgb.a ] ; then
  352.                         rm -f ../gt-itm/lib/libgb.a
  353.             cp libgb.a ../gt-itm/lib/libgb.a
  354.                 else
  355.                 echo "* Weird: sgb said it has been built but we can't find libgb.a! "
  356.             exit -1
  357.                 fi
  358.     else
  359.             echo "Unable to create sgb library, but it's optional, so continuing..."
  360.     fi
  361. fi
  362.  
  363. cd ..
  364.  
  365. # Compile and install gt-itm & sgb2ns
  366.  
  367. echo "============================================================"
  368. echo "* Build GT-ITM"
  369. echo "============================================================"
  370.  
  371. if [ -f ./gt-itm/lib/libgb.a ]
  372. then
  373.  if [ ! -f ./gt-itm/src/Makefile ]
  374.     then
  375.     echo "ns-alline is unable to install gt-itm sgb2ns for you, please install"
  376.     echo "them manually. You can't run scenario generator without gt-itm"
  377.     echo "and sgb2ns. But it will not affect you use ns, so continue ..."
  378.  else
  379.     cd ./gt-itm/src
  380.     if make
  381.     then
  382.       echo "gt-itm has been installed successfully."
  383.     fi
  384.    
  385.     cd ../sgb2ns
  386.     if make
  387.     then
  388.       echo "sgb2ns has been installed successfully."
  389.     fi
  390.    cd ../../
  391.  fi
  392. else
  393.     echo "sgb lib not found. gt-itm & sgb2ns could not be installed. Continuing.."
  394. fi
  395.  
  396. # Build zlib
  397.  
  398. echo "============================================================"
  399. echo "* Build zlib"
  400. echo "============================================================"
  401.  
  402. cd ./zlib-$ZLIBVER
  403.  
  404. if ./configure --exec-prefix=../ --prefix=../
  405. then
  406.     if make
  407.     then
  408.         echo "Zlib has been installed successfully."
  409.     else
  410.         warn "Zlib make failed, but it's optional Continue ..."
  411.     fi
  412. else
  413.     warn "Zlib-$ZLIBVER configuration failed, but it's optional, so continuing ..."
  414. fi
  415.  
  416. cd ../
  417.  
  418. # Build Tcl8.4.18
  419.  
  420. echo "============================================================"
  421. echo "* Build tcl$TCLVER"
  422. echo "============================================================"
  423.  
  424. cd ./tcl$TCLVER/unix
  425. if [ -f Makefile ] ; then
  426.     make distclean
  427. fi
  428.  
  429. blame='Tcl is not part of the ns project.  Please see www.Scriptics.com
  430. to see if they have a fix for your platform.'
  431. autoconf
  432. ./configure --enable-gcc --disable-shared --prefix=$CUR_PATH || die "tcl$TCLVER configuration failed! Exiting ..."
  433. if make
  434. then
  435.     echo "tcl$TCLVER make succeeded."
  436.     make install || die "tcl$TCLVER installation failed."
  437.     echo "tcl$TCLVER installation succeeded."
  438.     cp ../generic/*.h ../../include
  439. else
  440.     echo "tcl$TCLVER make failed! Exiting ..."
  441.     echo "For problems with Tcl/Tk see http://www.scriptics.com"
  442.     exit
  443. fi
  444.  
  445. cd ../../
  446.  
  447. # compile and install tk
  448.  
  449. echo "============================================================"
  450. echo "* Build Tk$TKVER"
  451. echo "============================================================"
  452.  
  453. cd ./tk$TKVER/unix
  454. if [ -f Makefile ] ; then
  455.     make distclean
  456. fi
  457.  
  458. blame='Tk is not part of the ns project.  Please see www.Scriptics.com
  459. to see if they have a fix for your platform.'
  460. autoconf
  461. ./configure --enable-gcc --disable-shared --prefix=$CUR_PATH || die "tk$TKVER configuration failed! Exiting ..."
  462. if make
  463. then
  464.     echo "tk$TKVER build succeeded."
  465.     make install || die "tk$TKVER installation failed."
  466.     echo "tk$TKVER installation succeeded."
  467. else
  468.     echo "tk$TKVER make failed! Exiting ..."
  469.     echo "For problems with Tcl/Tk see http://www.scriptics.com"
  470.     exit
  471. fi
  472.  
  473. cd ../../
  474.  
  475. #
  476. # Since our configures search for tclsh in $PATH, the following
  477. # is needed. This is necessary for otcl/tclcl/ns/nam
  478. #
  479. PATH=$CUR_PATH/tcl$TCLVER/unix:$CUR_PATH/tk$TKVER/unix:$PATH
  480. export PATH
  481. LD_LIBRARY_PATH=$CUR_PATH/tcl$TCLVER/unix:$CUR_PATH/tk$TKVER/unix:$LD_LIBRARY_PATH
  482. export LD_LIBRARY_PATH
  483.  
  484. # Build otcl
  485.  
  486. echo "============================================================"
  487. echo "* Build OTcl-$OTCLVER"
  488. echo "============================================================"
  489.  
  490. cd ./otcl-$OTCLVER
  491.  
  492. blame='Please check http://www.isi.edu/nsnam/ns/ns-problems.html
  493. for common problems and bug fixes.'
  494. if  [ "${test_cygwin}" = "true" ]; then
  495.         ./configure --x-libraries=/usr/X11R6/lib --x-includes=/usr/X11R6/include || die "otcl-$OTCLVER configuration failed! Exiting ...";
  496. else
  497.         ./configure || die "otcl-$OTCLVER configuration failed! Exiting ...";
  498. fi
  499.  
  500. if make
  501. then
  502.     echo "otcl-$OTCLVER has been installed successfully."
  503. else
  504.     echo "otcl-$OTCLVER make failed! Exiting ..."
  505.     echo "See http://www.isi.edu/nsnam/ns/ns-problems.html for problems"
  506.     exit
  507. fi
  508.  
  509. cd ..
  510.  
  511. # Build tclcl
  512.  
  513. echo "============================================================"
  514. echo "* Build Tclcl-$TCLCLVER"
  515. echo "============================================================"
  516.  
  517. cd ./tclcl-$TCLCLVER
  518.  
  519. if  [ "${test_cygwin}" = "true" ]; then
  520.         ./configure --x-libraries=/usr/X11R6/lib --x-includes=/usr/X11R6/include || die "tclcl-$TCLCLVER configuration failed! Exiting ...";
  521. else
  522.         ./configure --with-otcl=../otcl-$OTCLVER || die "tclcl-$TCLCLVER configuration failed! Exiting ..."
  523. fi
  524.  
  525. if make
  526. then
  527.     echo "tclcl-$TCLCLVER has been installed successfully."
  528. else
  529.     echo "tclcl-$TCLCLVER make failed! Exiting ..."
  530.     echo "See http://www.isi.edu/nsnam/ns/ns-problems.html for problems"
  531.     exit
  532. fi 
  533.  
  534. cd ../
  535.  
  536. # John's hack
  537. test -f ./otcl-$OTCLVER/libotcl.a && rm ./otcl-$OTCLVER/libotcl.so
  538.  
  539. echo "============================================================"
  540. echo "* Build ns-$NSVER"
  541. echo "============================================================"
  542.  
  543. cd ./ns-$NSVER
  544. if [ -f Makefile ] ; then
  545. echo "============================================================"
  546. echo "Going to make distclean"
  547.     make distclean
  548. fi
  549.  
  550. echo "Going to configure"
  551. if  [ "${test_cygwin}" = "true" ]; then
  552.         ./configure --x-libraries=/usr/X11R6/lib --x-includes=/usr/X11R6/include || die "Ns configuration failed! Exiting ...";
  553. else
  554.     echo "============================================================"
  555.     echo "Going to configure normal"
  556.         ./configure --enable-debug --with-otcl=../otcl-$OTCLVER --with-tclcl=../tclcl-$TCLCLVER || die "Ns configuration failed! Exiting ...";
  557. fi
  558. ########################################
  559. ## THE STATEMENT WHERE THE BUILD FAILS #
  560. ########################################
  561. if make
  562. then
  563.     echo " Ns has been installed successfully."
  564. else
  565.     echo "Ns make failed!"
  566.     echo "See http://www.isi.edu/nsnam/ns/ns-problems.html for problems"
  567.     exit
  568. fi
  569.  
  570. cd ../
  571.  
  572. # Build nam
  573.  
  574. echo "============================================================"
  575. echo "* Build nam-$NAMVER"
  576. echo "============================================================"
  577.  
  578. ln -s otcl-$OTCLVER otcl
  579. ln -s tclcl-$TCLCLVER tclcl
  580.  
  581. cd ./nam-$NAMVER
  582.  
  583. # XXX temporary OS X hack
  584. if  [ "${test_darwin}" = "true" ]; then
  585. ln -s /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation libcorefoundation.dylib
  586. fi
  587.  
  588. if  [ "${test_cygwin}" = "true" ]; then
  589.         ./configure --x-libraries=/usr/X11R6/lib --x-includes=/usr/X11R6/include --with-tclcl=$CUR_PATH/tclcl-$TCLCLVER  || die "Nam configuration failed! Exiting ...";
  590. else
  591.         ./configure --with-otcl=../otcl-$OTCLVER --with-tclcl=../tclcl-$TCLCLVER || die "Nam configuration failed! Exiting ...";
  592. fi
  593.  
  594. if make
  595. then
  596.     echo "Nam has been installed successfully."
  597. elif  [ "${test_darwin}" = "true" ]; then
  598.     # XXX workaround for OS X nam Tcl/Tk problems
  599.     echo "Nam make failed! Trying to relink..."
  600.     echo "g++ -o nam tkcompat.o tkUnixInit.o xwd.o netview.o netmodel.o edge.o packet.o node.o main.o trace.o queue.o drop.o animation.o agent.o feature.o route.o transform.o paint.o state.o monitor.o anetmodel.o random.o rng.o view.o graphview.o netgraph.o tracehook.o lan.o psview.o group.o editview.o tag.o address.o animator.o wnetmodel.o nam_stream.o enetmodel.o testview.o parser.o trafficsource.o lossmodel.o queuehandle.o gen/version.o gen/nam_tcl.o  ../tcl8.4.18/unix/libtcl8.4.a ../tk8.4.18/unix/libtk8.4.a ../tcl8.4.18/unix/libtclstub8.4.a -L../tclcl-1.19 -ltclcl -L../otcl -lotcl -L/usr/lib -lz -L/usr/X11R6/lib -lXext -lX11 -lm -L. -lcorefoundation"
  601.     g++ -o nam tkcompat.o tkUnixInit.o xwd.o netview.o netmodel.o edge.o packet.o node.o main.o trace.o queue.o drop.o animation.o agent.o feature.o route.o transform.o paint.o state.o monitor.o anetmodel.o random.o rng.o view.o graphview.o netgraph.o tracehook.o lan.o psview.o group.o editview.o tag.o address.o animator.o wnetmodel.o nam_stream.o enetmodel.o testview.o parser.o trafficsource.o lossmodel.o queuehandle.o gen/version.o gen/nam_tcl.o  ../tcl8.4.18/unix/libtcl8.4.a ../tk8.4.18/unix/libtk8.4.a ../tcl8.4.18/unix/libtclstub8.4.a -L../tclcl-1.19 -ltclcl -L../otcl -lotcl -L/usr/lib -lz -L/usr/X11R6/lib -lXext -lX11 -lm -L. -lcorefoundation
  602.     if [ -e nam ]; then
  603.         echo "Nam relinking succeeded; nam has been installed successfully."
  604.     else
  605.         echo "Nam make failed! You may want to tweak the above linker path if libraries are not being picked up successfuly.  Continue ..."
  606.         echo "See http://www.isi.edu/nsnam/ns-problems.html for problems"
  607.     fi
  608. else
  609.     echo "Nam make failed! Continue ..."
  610.     echo "See http://www.isi.edu/nsnam/ns-problems.html for problems"
  611. fi
  612.  
  613. cd ../
  614.  
  615.  
  616.  
  617. # Building dei80211mr
  618.  
  619. cd ./dei80211mr-${DEI80211MRVER}
  620.  
  621. ./configure --with-ns-allinone=${CUR_PATH} --prefix=${CUR_PATH} \
  622.     && make \
  623.     && make install
  624.  
  625. cd ..
  626.  
  627.  
  628. # Install nam, ns, xgraph into bin
  629.  
  630. if [ ! -d bin ] ; then
  631.     mkdir bin
  632. fi
  633.  
  634. cd bin
  635.  
  636. ln -s $CUR_PATH/ns-$NSVER/ns${EXE} ns${EXE}
  637.  
  638. if test -x $CUR_PATH/nam-$NAMVER/nam${EXE}
  639. then
  640.     ln -s $CUR_PATH/nam-$NAMVER/nam${EXE} nam${EXE}
  641. else
  642.     echo "Please compile your nam separately."
  643. fi
  644.  
  645. if test -x $CUR_PATH/xgraph-$XGRAPHVER/xgraph${EXE}
  646. then
  647.     ln -s $CUR_PATH/xgraph-$XGRAPHVER/xgraph${EXE} xgraph${EXE}
  648. else
  649.     echo "Please compile your xgraph separately."
  650. fi
  651.  
  652. if test -x $CUR_PATH/gt-itm/bin/sgb2ns${EXE}
  653. then
  654.     ln -s $CUR_PATH/gt-itm/bin/sgb2ns${EXE} sgb2ns${EXE}
  655.     ln -s $CUR_PATH/gt-itm/bin/sgb2hierns${EXE} sgb2hierns${EXE}
  656.     ln -s $CUR_PATH/gt-itm/bin/sgb2comns${EXE} sgb2comns${EXE}
  657.     ln -s $CUR_PATH/gt-itm/bin/itm${EXE} itm${EXE}
  658.     ln -s $CUR_PATH/gt-itm/bin/sgb2alt${EXE} sgb2alt${EXE}
  659.     ln -s $CUR_PATH/gt-itm/bin/edriver${EXE} edriver${EXE}
  660. else
  661.     echo "Please compile your gt-itm & sgb2ns separately."
  662. fi
  663.  
  664. echo ""
  665. echo "Ns-allinone package has been installed successfully."
  666. echo "Here are the installation places:"
  667. echo "tcl$TCLVER:   $CUR_PATH/{bin,include,lib}"
  668. echo "tk$TKVER:     $CUR_PATH/{bin,include,lib}"
  669. echo "otcl:     $CUR_PATH/otcl-$OTCLVER"
  670. echo "tclcl:        $CUR_PATH/tclcl-$TCLCLVER"
  671. echo "ns:       $CUR_PATH/ns-$NSVER/ns"
  672.  
  673. if [ -x $CUR_PATH/nam-$NAMVER/nam ]
  674. then
  675. echo "nam:  $CUR_PATH/nam-$NAMVER/nam"
  676. fi
  677.  
  678. if [ -x $CUR_PATH/xgraph-$XGRAPHVER/xgraph ]
  679. then
  680. echo "xgraph:   $CUR_PATH/xgraph-$XGRAPHVER"
  681. fi
  682. if [ -x $CUR_PATH/gt-itm/bin/sgb2ns ]
  683. then
  684. echo "gt-itm:   $CUR_PATH/itm, edriver, sgb2alt, sgb2ns, sgb2comns, sgb2hierns"
  685. fi
  686.  
  687. echo ""
  688. echo "----------------------------------------------------------------------------------"
  689. echo ""
  690. echo "Please put $CUR_PATH/bin:$CUR_PATH/tcl$TCLVER/unix:$CUR_PATH/tk$TKVER/unix"
  691. echo "into your PATH environment; so that you'll be able to run itm/tclsh/wish/xgraph."
  692. echo ""
  693. echo "IMPORTANT NOTICES:"
  694. echo ""
  695. echo "(1) You MUST put $CUR_PATH/otcl-$OTCLVER, $CUR_PATH/lib, "
  696. echo "    into your LD_LIBRARY_PATH environment variable."
  697. echo "    If it complains about X libraries, add path to your X libraries "
  698. echo "    into LD_LIBRARY_PATH."
  699. echo "    If you are using csh, you can set it like:"
  700. echo "      setenv LD_LIBRARY_PATH <paths>"
  701. echo "    If you are using sh, you can set it like:"
  702. echo "      export LD_LIBRARY_PATH=<paths>"
  703. echo ""
  704. echo "(2) You MUST put $CUR_PATH/tcl$TCLVER/library into your TCL_LIBRARY environmental"
  705. echo "    variable. Otherwise ns/nam will complain during startup."
  706. echo ""
  707. echo ""
  708. echo "After these steps, you can now run the ns validation suite with"
  709. echo "cd ns-$NSVER; ./validate"
  710. echo ""
  711. echo "For trouble shooting, please first read ns problems page "
  712. echo "http://www.isi.edu/nsnam/ns/ns-problems.html. Also search the ns mailing list archive"
  713. echo "for related posts."
  714. echo ""
  715.  
  716. exit 0
Advertisement
Add Comment
Please, Sign In to add comment