Home | History | Annotate | Download | only in diskomizer
      1 #!/bin/ksh -p
      2 #
      3 # CDDL HEADER START
      4 #
      5 # The contents of this file are subject to the terms of the
      6 # Common Development and Distribution License (the "License").
      7 # You may not use this file except in compliance with the License.
      8 #
      9 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
     10 # or http://www.opensolaris.org/os/licensing.
     11 # See the License for the specific language governing permissions
     12 # and limitations under the License.
     13 #
     14 # When distributing Covered Code, include this CDDL HEADER in each
     15 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
     16 # If applicable, add the following below this CDDL HEADER, with the
     17 # fields enclosed by brackets "[]" replaced with your own identifying
     18 # information: Portions Copyright [yyyy] [name of copyright owner]
     19 #
     20 # CDDL HEADER END
     21 #
     22 
     23 #ident	"@(#)diskomizer.sh	1.12	09/05/26 SMI"
     24 
     25 #
     26 # Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
     27 # Use is subject to license terms.
     28 #
     29 # Simple script to call the correct program.
     30 #
     31 bindir=${0%/*}
     32 if [[ ${bindir#/} = ${bindir} ]]
     33 then
     34         bindir=${PWD}/$bindir
     35 fi
     36 libdir=${bindir%/bin}/lib
     37 etcdir=${bindir%/bin}/etc
     38 
     39 function doit
     40 {
     41 	isa=$1
     42 	shift
     43 	prog=$1
     44 	shift
     45 	exec ${bindir}/${isa}/${prog} ${1+"$@"}
     46 }
     47 for isa in $(isalist 2> /dev/null)
     48 do
     49 	# SunPRO compilers opimizer flags are -xOn where n is 0-5
     50 	for level in 5 4 3 2 1 0
     51 	do
     52 		test -x ${bindir}/${isa}-xO${level}/${0##*/} && \
     53 			doit ${isa}-xO${level} ${0##*/} ${1+"$@"}
     54 	done
     55 	# gcc optimizer flag is -O
     56 	test -x ${bindir}/${isa}-O/${0##*/} && \
     57 		doit ${isa}-O ${0##*/} ${1+"$@"}
     58 	test -x ${bindir}/${isa}/${0##*/} && \
     59 		doit ${isa} ${0##*/} ${1+"$@"}
     60 done
     61