Changeset 11285
- Timestamp:
- Jan 24, 2007, 4:52:26 PM (19 years ago)
- Location:
- trunk/Ohana
- Files:
-
- 1 added
- 1 edited
-
configure (modified) (1 diff)
-
configure.tcsh (added)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/configure
r11122 r11285 1 #!/bin/ csh -f1 #!/bin/bash 2 2 3 # this is a very low-tech version of configure, not built by autoconf. 4 # we check for the following libraries: 5 6 # we need to be able to list the required libraries for a given distribution 7 8 # libX11.a 9 # libsocket.a 10 # libnsl.a 11 # libpng.a 12 # libjpeg.a 13 # libz.a 14 # libreadline.a 15 # libtermcap.a 16 17 # evaluate command-line options 18 set vararch = 0 19 set prefix = "" 20 21 set bindir = "" 22 set libdir = "" 23 set incdir = "" 24 set mandir = "" 25 set datadir = "" 26 set sysconfdir = "" 27 set optflags = "-g -O0" 28 set pedantic = "" 29 30 set root = "" 31 set args = "" 32 while ("$1" != "") 33 switch ($1) 34 case --vararch 35 set vararch = 1 36 breaksw; 37 case --enable-optimize 38 set optflags = "-O2" 39 breaksw; 40 case --pedantic 41 set pedantic = "-Wall -Werror" 42 breaksw; 43 case --prefix* 44 set prefix = `echo $1 | tr = ' ' | awk '{print $2}'` 45 breaksw; 46 case --bindir* 47 set bindir = `echo $1 | tr = ' ' | awk '{print $2}'` 48 breaksw; 49 case --libdir* 50 set libdir = `echo $1 | tr = ' ' | awk '{print $2}'` 51 breaksw; 52 case --includedir* 53 set incdir = `echo $1 | tr = ' ' | awk '{print $2}'` 54 breaksw; 55 case --sysconfdir* 56 set sysconfdir = `echo $1 | tr = ' ' | awk '{print $2}'` 57 breaksw; 58 case --datadir* 59 set datadir = `echo $1 | tr = ' ' | awk '{print $2}'` 60 breaksw; 61 case --mandir* 62 set mandir = `echo $1 | tr = ' ' | awk '{print $2}'` 63 breaksw; 64 case --help: 65 goto usage 66 case -*: 67 echo "" 68 echo "Unknown option: $1" 69 goto usage 70 default: 71 set args=($args $1); 72 breaksw; 73 endsw 74 shift 75 end 76 if ($#args != 1) goto usage 77 78 set needlibs = "png z jpeg readline X11 pthread m" 79 set syslibpath = "/usr/lib /usr/X11R6/lib /usr/openwin/lib" 80 81 set needincs = "math.h fcntl.h malloc.h errno.h time.h memory.h stdlib.h string.h X11/X.h" 82 set sysincpath = "/usr/include /usr/X11R6/include /usr/openwin/include" 83 84 # check the hardware architecture: 85 set sys=`uname -s` 86 switch ($sys) 87 case IRIX64: 88 set arch="irix"; 89 breaksw; 90 case SunOS: 91 set ver=`uname -r | awk '{print substr($1,1,1)}'`; 92 if ($ver == 5) then 93 set arch="sol"; 94 else 95 set arch="sun4"; 96 endif 97 # sun (at least) seems to need the socket library (linux does not) 98 set needlibs = "$needlibs libsocket libnsl" 99 breaksw; 100 case Linux: 101 set arch="linux"; 102 if (-e /etc/sidious.config) set arch="sid"; 103 set mach=`uname -m` 104 if ("$mach" == "x86_64") then 105 set arch="lin64"; 106 endif 107 breaksw; 108 case HP-UX: 109 set arch="hpux"; 110 breaksw; 111 default: 112 echo "unknown architecture"; 113 exit 1; 114 breaksw; 115 endsw 116 echo "setting architecture to: $arch" 117 118 # set up the basic directory names: 119 # XXX : this should be set based on the rules for libdir below 120 set root = `pwd` 121 if ($prefix == "") set prefix = $root 122 if ($vararch) then 123 set inc = $prefix/include/$arch 124 set lib = $prefix/lib/$arch 125 else 126 set inc = $prefix/include 127 set lib = $prefix/lib 128 endif 129 if ($?LD_LIBRARY_PATH) then 130 set libpath = `echo $LD_LIBRARY_PATH | tr ':' ' '` 131 else 132 set libpath = "" 133 endif 134 135 # check for basic libraries 136 set faillibs = "" 137 set libflags = "" 138 set libdirs = "" 139 foreach f ( $needlibs ) 140 foreach g ( $syslibpath $lib $libpath ) 141 set name = "$g/lib$f.a" 142 if (-e $name) goto got_lib; 143 set name = "$g/lib$f.so" 144 if (-e $name) goto got_lib; 145 end 146 echo "missing lib$f" 147 set faillibs = "$faillibs lib$f" 148 continue 149 got_lib: 150 echo "found lib$f ($name)" 151 echo "$libdirs" | grep -- "-L$g " > /dev/null 152 if ($status) then 153 set libdirs = "$libdirs -L$g " 154 endif 155 echo "$libflags" | grep -- "-l$f " > /dev/null 156 if ($status) then 157 set libflags = "$libflags -l$f " 158 endif 159 end 160 161 # we need a curses library; can choose one of the following: 162 # check for termcap, curses, etc 163 foreach f ( ncurses curses termcap ) 164 foreach g ( $syslibpath $lib $libpath ) 165 set name = "$g/lib$f.a" 166 if (-e $name) goto got_curses; 167 set name = "$g/lib$f.so" 168 if (-e $name) goto got_curses; 169 end 170 end 171 set faillibs = "$faillibs (ncurses | curses | termcap)" 172 echo "missing a valid curses library" 173 echo "missing: $faillibs" 174 echo "please find them and install them in $lib" 175 exit 1 176 177 got_curses: 178 echo "found $f ($name)" 179 echo "$libdirs" | grep -- "-L$g " > /dev/null 180 if ($status) then 181 set libdirs = "$libdirs -L$g " 182 endif 183 echo "$libflags" | grep -- "-l$f " > /dev/null 184 if ($status) then 185 set libflags = "$libflags -l$f " 186 endif 187 188 if ("$faillibs" != "") then 189 echo "your installation is missing some important libraries" 190 echo "missing: $faillibs" 191 echo "please find them and install them in $lib" 192 exit 1 193 endif 194 195 # check for headers 196 set failincs = "" 197 set incdirs = "" 198 foreach f ( $needincs ) 199 foreach g ( $sysincpath $inc ) 200 set name = "$g/$f" 201 if (-e $name) goto got_inc; 202 end 203 echo "missing $f" 204 set failincs = "$failincs $f" 205 continue 206 got_inc: 207 echo "found $f ($name)" 208 echo "$incdirs" | grep -- "-I$g " > /dev/null 209 if ($status) then 210 set incdirs = "$incdirs -I$g " 211 endif 212 end 213 214 if ("$failincs" != "") then 215 echo "your installation is missing some important library headers" 216 echo "please find them and install them in $inc" 217 exit 1 218 endif 219 220 echo INCDIRS: $incdirs 221 echo LIBDIRS: $libdirs 222 echo LIBFLAGS: $libflags 223 224 echo ARCH: $arch 225 echo ROOT: $root 226 echo PREFIX: $prefix 227 echo 228 229 #echo BINDIR $bindir 230 #echo LIBDIR $libdir 231 #echo INCDIR $incdir 232 #echo DATADIR $datadir 233 #echo MANDIR $mandir 234 235 if (-e Configure) mv Configure Configure.bak 236 237 rm -f Configure.in.tmp Configure.tmp 238 cp Configure.in Configure.in.tmp 239 240 # we don't currently need to modify the Makefile but since configure 241 # should create a new Makefile, we need to do this: 242 cp -f Makefile.in Makefile 243 244 # modify the BINDIR 245 if ("$bindir" == "") then 246 set subdir = bin 247 set subpath = bin 248 if ($vararch) then 249 set subdir = 'bin/$(ARCH)' 250 set subpath = "bin/$arch" 251 endif 252 set bindir = $prefix/$subdir 253 set binpath = $prefix/$subpath 254 endif 255 cat Configure.in.tmp | sed "s|@BINDIR@| $bindir|" > Configure.tmp 256 rm -f Configure.in.tmp 257 mv Configure.tmp Configure.in.tmp 258 echo BINDIR $bindir 259 260 # modify the INCDIR 261 if ("$incdir" == "") then 262 set subdir = include 263 if ($vararch) set subdir = 'include/$(ARCH)' 264 set incdir = $prefix/$subdir 265 endif 266 cat Configure.in.tmp | sed "s|@INCDIR@|$incdir|" > Configure.tmp 267 rm -f Configure.in.tmp 268 mv Configure.tmp Configure.in.tmp 269 echo INCDIR $incdir 270 271 # modify the LIBDIR 272 if ("$libdir" == "") then 273 set subdir = lib 274 if ($vararch) set subdir = 'lib/$(ARCH)' 275 set libdir = $prefix/$subdir 276 endif 277 cat Configure.in.tmp | sed "s|@LIBDIR@|$libdir|" > Configure.tmp 278 rm -f Configure.in.tmp 279 mv Configure.tmp Configure.in.tmp 280 echo LIBDIR $libdir 281 282 # modify the MANDIR 283 if ("$mandir" == "") then 284 set mandir = $prefix/man 285 endif 286 cat Configure.in.tmp | sed "s|@MANDIR@|$mandir|" > Configure.tmp 287 rm -f Configure.in.tmp 288 mv Configure.tmp Configure.in.tmp 289 echo MANDIR $mandir 290 291 # modify the DATADIR 292 if ("$datadir" == "") then 293 set datadir = $prefix/share 294 endif 295 cat Configure.in.tmp | sed "s|@DATADIR@|$datadir|" > Configure.tmp 296 rm -f Configure.in.tmp 297 mv Configure.tmp Configure.in.tmp 298 echo DATADIR $datadir 299 300 if ($vararch) then 301 cat Configure.in.tmp | sed "s|^\s*ARCH|# ARCH|" > Configure.tmp 302 else 303 cat Configure.in.tmp | sed "s|@ARCHVAL@|$arch|" > Configure.tmp 304 endif 305 rm -f Configure.in.tmp 306 mv Configure.tmp Configure.in.tmp 307 308 cat Configure.in.tmp | sed "s|@ROOTDIR@|$root|" | sed "s|@INCDIRS@|$incdirs|" | sed "s|@LIBDIRS@|$libdirs|" | sed "s|@LIBFLAGS@|$libflags|" | sed "s|@OPTFLAGS@|$optflags $pedantic|" > Configure 309 rm -f Configure.in.tmp Configure.tmp 310 311 cat ohana-config.in | sed "s|@INCDIR@|$incdir|" | sed "s|@LIBDIR@|$libdir|" | sed "s|(ARCH)|ARCH|" > ohana-config 312 313 echo "" 314 echo "include $bindir in your path" 315 316 exit 0 317 318 usage: 319 cat <<EOF 320 USAGE: configure [OPTION] 321 322 set the installation directory root with --prefix 323 if you define the environment variable ARCH, you can set --vararch 324 325 Configuration: 326 -h, --help display this help and exit 327 --enable-optimize enable compiler optimization 328 --pedantic include -Wall -Werror on compilation 329 330 Installation directories: 331 --prefix=PREFIX install architecture-independent files in PREFIX 332 --vararch install with ARCH suffixes for variable architectures 333 334 Fine tuning of the installation directories: 335 --bindir=DIR user executables [PREFIX/bin/$ARCH] 336 --libdir=DIR object code libraries [PREFIX/lib/$ARCH] 337 --includedir=DIR C header files [PREFIX/include] 338 --mandir=DIR man documentation [PREFIX/man] 339 --datadir=DIR read-only architecture-independent data [PREFIX/share] 340 --sysconfdir=DIR read-only single-machine data [PREFIX/etc] 341 342 EOF 343 exit 2; 3 ./configure.tcsh $*
Note:
See TracChangeset
for help on using the changeset viewer.
