Skip to content
Newer
Older
100755 125 lines (114 sloc) 3.65 KB
eabe791 @jwatte initial release
jwatte authored Sep 24, 2012
1 #!/bin/bash
2 # Simple configuration script for people who expect such a script to exist.
3 # Please do not convert istatd to autotools. We will likely not accept such
4 # a conversion. Thanks for your interest in istatd, and good luck!
5
6 set -e
7 set -o nounset
8
9 rm -f makevars.config
10 echo "# makevars.config for istatd generated on " `date` > makevars.config
11
12 BOOST_SYSTEM=""
13 BOOST_FILESYSTEM=""
14 STATGRAB=""
15 DESTDIR=""
16 USR_PREFIX=""
17 VAR_PREFIX=""
18 ETC_PREFIX=""
19
20 while [ $# -gt 0 ]; do
21 case $1 in
22 --boost_system)
23 shift
24 BOOST_SYSTEM="$1"
25 ;;
26 --boost_filesystem)
27 shift
28 BOOST_FILESYSTEM="$1"
29 ;;
30 --statgrab)
31 shift
32 STATGRAB="$1"
33 ;;
34 --prefix)
35 shift
36 DESTDIR="$1"
37 ;;
38 --usr-prefix)
39 shift
40 USR_PREFIX="$1"
41 ;;
42 --var-prefix)
43 shift
44 VAR_PREFIX="$1"
45 ;;
46 --etc-prefix)
47 shift
48 ETC_PREFIX="$1"
49 ;;
50 *)
51 echo "Options:"
52 echo "--boost_system -lboost_system-mt What is the boost_system library name?"
53 echo "--boost_filesystem -lboost_filesystem-mt What is the boost_filesystem library name?"
54 echo "--statgrab -lstatgrab What is the statgrab library name?"
55 echo "--prefix / What is the root of the install?"
56 echo "--usr-prefix /usr What is the '/usr' directory for executables?"
57 echo "--var-prefix /var What is the '/var' directory for database data?"
58 echo "--etc-prefix /etc What is the '/etc/ directory for rc.d scripts?"
59 echo "No equal sign for option values."
60 exit 1
61 ;;
62 esac
63 shift
64 done
65
66 # see if we need to install boost
67 if [ ! -d /usr/include/boost -a ! -d /usr/local/include/boost ]; then
68 echo "You need to install libboost-all-dev for your distribution."
69 exit 1
70 fi
71
72 if [ ! -r /usr/include/statgrab.h -a ! -r /usr/local/include/statgrab.h ]; then
73 echo "You need to install libstatgrab-dev for your distribution, or "
74 echo "download and install it from source. See README.md"
75 fi
76
77
78 # boost_system is a pain across versions
79 if [ -z "$BOOST_SYSTEM" ]; then
80 if [ -r /usr/lib/libboost_system.so ]; then
81 BOOST_SYSTEM=-lboost_system
82 elif [ -r /usr/lib/libboost_system.so ]; then
83 BOOST_SYSTEM=-lboost_system-mt.so
84 fi
85 fi
86 # boost_filesystem is also somewhat a pain
87 if [ -z "$BOOST_FILESYSTEM" ]; then
88 if [ -r /usr/lib/libboost_filesystem.so ]; then
89 BOOST_FILESYSTEM=-lboost_filesystem
90 elif [ -r /usr/lib/libboost_filesystem.so ]; then
91 BOOST_FILESYSTEM=-lboost_filesystem-mt
92 fi
93 fi
94 if [ -z "$STATGRAB" ]; then
95 if [ -r /usr/lib/libstatgrab.so ]; then
96 STATGRAB=-lstatgrab
97 elif [ -r /usr/local/lib/libstatgrab.so ]; then
98 STATGRAB=-lstatgrab
99 fi
100 fi
101
102 if [ ! -z "$BOOST_SYSTEM" ]; then
103 echo "BOOST_SYSTEM=$BOOST_SYSTEM" >> makevars.config
104 fi
105 if [ ! -z "$BOOST_FILESYSTEM" ]; then
106 echo "BOOST_FILESYSTEM=$BOOST_FILESYSTEM" >> makevars.config
107 fi
108 if [ ! -z "$STATGRAB" ]; then
109 echo "STATGRAB=$STATGRAB" >> makevars.config
110 fi
111 if [ ! -z "$DESTDIR" ]; then
112 echo "DESTDIR=$DESTDIR" >> makevars.config
113 fi
114 if [ ! -z "$USR_PREFIX" ]; then
115 echo "USR_PREFIX=$USR_PREFIX" >> makevars.config
116 fi
117 if [ ! -z "$VAR_PREFIX" ]; then
118 echo "VAR_PREFIX=$VAR_PREFIX" >> makevars.config
119 fi
120 if [ ! -z "$ETC_PREFIX" ]; then
121 echo "ETC_PREFIX=$ETC_PREFIX" >> makevars.config
122 fi
123
124 echo "All done"
Something went wrong with that request. Please try again.