#!/bin/sh # # configure, simulation of autoconf script, much simplified # # Copyright (c) 2008-2010 Wind River Systems, Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the Lesser GNU General Public License version 2.1 as # published by the Free Software Foundation. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the Lesser GNU General Public License for more details. # # You should have received a copy of the Lesser GNU General Public License # version 2.1 along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # # not a real configure script... opt_prefix= opt_libdir= opt_suffix= opt_bits= opt_sqlite=/usr usage() { echo >&2 "usage:" echo >&2 " configure --prefix=..." echo >&2 " [--libdir=...]" echo >&2 " [--suffix=...]" echo >&2 " [--with-sqlite=...]" echo >&2 " [--with-rpath=...|--without-rpath]" echo >&2 " [--bits=32|64]" exit 1 } for arg do case $arg in --) shift; break ;; --prefix=*) opt_prefix=${arg#--prefix=} ;; --libdir=*) opt_libdir=${arg#--libdir=} ;; --with-sqlite=*) opt_sqlite=${arg#--with-sqlite=} # assign new value if unset : ${opt_rpath=-Wl,-R\$(SQLITE)/lib} ;; --without-rpath) opt_rpath='' ;; --with-rpath=*) rpath=${arg#--with-rpath=} opt_rpath=${rpath:+-Wl,-R$rpath} ;; --suffix=*) opt_suffix=${arg#--suffix=} ;; --bits=*) opt_bits=${arg#--bits=} case $opt_bits in 64) opt_mark64=64;; 32) opt_mark64=;; *) echo >&2 "Unknown bit size $opt_bits (only 32 and 64 known)." ;; esac ;; *) echo >&2 "warning: Unrecognized option '$arg'" ;; esac done if [ -z "$opt_prefix" ]; then usage fi if [ -n "$opt_bits" ] && [ -n "$opt_libdir" ]; then echo >&2 "Can not specify both --libdir and --bits" exit 1 fi if [ -z "$opt_libdir" ]; then opt_libdir=$opt_prefix/lib$opt_mark64 fi if [ ! -f "${opt_sqlite}/include/sqlite3.h" ]; then echo >&2 "SQLite3 headers not found in at ${opt_sqlite}/include/sqlite3.h. Please check that SQLite3 and SQLite3 headers are installed." exit 1 fi read t1 t2 SQLITE3_VERSION << EOF `grep "#define SQLITE_VERSION_NUMBER " ${opt_sqlite}/include/sqlite3.h` EOF echo "SQLite header for version ${SQLITE3_VERSION} found." if [ "${SQLITE3_VERSION}" -lt "03006000" ]; then echo >&2 "Pseudo requires SQLite version 3, 3.6.x or later." exit 1 fi sed -e ' s,@PREFIX@,'"$opt_prefix"',g s,@LIBDIR@,'"$opt_libdir"',g s,@SUFFIX@,'"$opt_suffix"',g s,@SQLITE@,'"$opt_sqlite"',g s!@RPATH@!'"$opt_rpath"'!g s,@MARK64@,'"$opt_mark64"',g s,@BITS@,'"$opt_bits"',g ' < Makefile.in > Makefile