#!/bin/sh # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # # ==================================================================== # # configure Simple configure script with no dependency on # GNU autoconf tools. # # Important environment variables # # TOPDIR Top directory defaults to . # JAVA_HOME Home of the Java SDK # Overridable by --with-java-home option # # ==================================================================== # name=commons-runtime topdir="${TOPDIR:=.}" java_home="`echo $JAVA_HOME | tr '\\' '/' 2>/dev/null`" compile_source=5 compile_target=5 has_64_bit=no has_maintainer_mode=off has_debug=off has_optimize=on has_deprecation=on host="" mach="" for o do case "$o" in --enable-*) a=`echo "$o" | sed -e 's/--enable-//' -e 's/-/_/'` case "$a" in *=* ) v=`echo "$a" | sed 's/^[_a-zA-Z0-9]*=//'` a=`echo "$a" | sed 's/=.*//'` ;; * ) v='yes' ;; esac eval has_$a=$v eval has_$a_set=on shift continue ;; --disable-*) a=`echo "$o" | sed -e 's/--disable-//' -e 's/-/_/'` case "$a" in *=* ) a=`echo "$a" | sed 's/=.*//'` ;; esac eval has_$a=no eval has_$a_set=off shift continue ;; *=*) a=`echo "$o" | sed 's/^[-_a-zA-Z0-9]*=//'` ;; *) a='' ;; esac case "$o" in --name=* ) name="$a" shift ;; --with-java-home=* ) java_home="$a" shift ;; --with-java-version=* ) compile_source="$a" compile_target="$a" shift ;; --with-java-source=* ) compile_source="$a" shift ;; --with-java-target=* ) compile_target="$a" shift ;; --with-host=* ) host="$a" shift ;; --with-cpu=* ) mach="$a" shift ;; * ) cat 1>&2 << EOH Usage: ./configure [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Usage: configure [options] Optional features: --with-java-home=DIR Path to the Java SDK [\$JAVA_HOME environment variable] --with-java-source=VER Compile for Java source VER [Default 5] --with-java-target=VER Compile for Java target VER [Default 5] --with-host=NAME Configure for native HOST [Default current host] --with-cpu=NAME Configure for native CPU [Default current machine] EOH exit 1 ;; esac done toupper() { echo "$1" | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' } tolower() { echo "$1" | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' } major_sed='/#define.*ACR_MAJOR_VERSION/s/^[^0-9]*\([0-9]*\).*$/\1/p' minor_sed='/#define.*ACR_MINOR_VERSION/s/^[^0-9]*\([0-9]*\).*$/\1/p' patch_sed='/#define.*ACR_PATCH_VERSION/s/^[^0-9]*\([0-9]*\).*$/\1/p' devel_sed='/#define.*ACR_IS_DEV_VERSION/s/^[^0-9]*\([0-9]*\).*$/\1/p' vmajor="`sed -n $major_sed $topdir/src/main/native/include/acr_version.h`" vminor="`sed -n $minor_sed $topdir/src/main/native/include/acr_version.h`" vpatch="`sed -n $patch_sed $topdir/src/main/native/include/acr_version.h`" vdevel="`sed -n $devel_sed $topdir/src/main/native/include/acr_version.h`" if [ "$vdelel" = ".0" ]; then devsfx="" else devsfx="-dev" fi if [ ".$mach" = . ]; then mach=`uname -m 2>/dev/null | tr '[A-Z]' '[a-z]'` || mach="unknown" fi if [ ".$host" = . ]; then host=`uname -s 2>/dev/null | tr '[A-Z]' '[a-z]'` || host="unknown" fi soext="so" case "$host" in hp-ux ) host=hpux ;; sunos ) host=solaris ;; cygwin* ) host=windows ext="dll" ;; mingw* ) host=windows soext="dll" ;; * ) host=`tolower "$host"` ;; esac case "$mach" in amd64 ) mach=x86_64 ;; i[3-7]86 ) mach=x86 ;; i86pc ) mach=x86 ;; sun4* ) mach=sparc ;; 9000/[678][0-9][0-9] ) mach=parisc soext="sl" ;; esac sed -e "s;=@name@;=$name;g" \ -e "s;=@vmajor@;=$vmajor;g" \ -e "s;=@vminor@;=$vminor;g" \ -e "s;=@vpatch@;=$vpatch;g" \ -e "s;=@devsfx@;=$devsfx;g" \ -e "s;@compile_source@;$compile_source;g" \ -e "s;@compile_target@;$compile_target;g" \ -e "s;=@debug@;=$has_debug;g" \ -e "s;=@optimize@;=$has_optimize;g" \ -e "s;=@deprecate@;=$has_deprecation;g" \ -e "s;@host@;$host;g" \ -e "s;@cpu@;$mach;g" \ -e "s;@ext@;$soext;g" \ build.properties.in > build.properties echo "" echo "Configured for java 1.$compile_target." echo ""