#!/bin/sh # # configure, simulation of autoconf script, much simplified # # Copyright (c) 2008-2013 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_arch=x86 opt_bits= opt_sqlite=/usr opt_rpath= opt_memory= opt_async= compile_x86_32=-m32 compile_x86_64=-m64 usage() { echo >&2 "usage:" echo >&2 " configure --prefix=..." echo >&2 " [--libdir=...]" echo >&2 " [--suffix=...]" echo >&2 " [--enable-memory-db]" echo >&2 " [--enable-force-async]" echo >&2 " [--with-sqlite=...]" echo >&2 " [--with-sqlite-lib=...]" echo >&2 " [--enable-static-sqlite]" echo >&2 " [--with-static-sqlite=...]" echo >&2 " [--with-rpath=...|--without-rpath]" echo >&2 " [--cflags='']" echo >&2 " [--bits=32|64]" exit 1 } sqlite_ldarg=-lsqlite3 maybe_rpath= use_maybe_rpath=true for arg do case $arg in --) shift; break ;; --prefix=*) opt_prefix=${arg#--prefix=} ;; --libdir=*) opt_libdir=${arg#--libdir=} ;; --with-static-sqlite=*) opt_sqlite_ldarg=${arg#--with-static-sqlite=} sqlite_ldarg=$opt_sqlite_ldarg use_maybe_rpath=false ;; --enable-static-sqlite) sqlite_ldarg='$(SQLITE)/$(SQLITE_LIB)/libsqlite3.a' use_maybe_rpath=false ;; --enable-force-async=no | --disable-force-async) opt_async=false ;; --enable-force-async=yes | --enable-force-async) opt_async=true ;; --enable-memory-db=no) opt_memory=false ;; --enable-memory-db=yes | --enable-memory-db) opt_memory=true ;; --with-sqlite=*) opt_sqlite=${arg#--with-sqlite=} # assign new value if unset maybe_rpath='-Wl,-R$(SQLITE)/$(SQLITE_LIB)' ;; --with-sqlite-lib=*) opt_sqlite_lib=${arg#--with-sqlite-lib=} # assign new value if unset maybe_rpath='-Wl,-R$(SQLITE)/$(SQLITE_LIB)' ;; --without-rpath) opt_rpath='' use_maybe_rpath=false ;; --with-rpath=*) rpath=${arg#--with-rpath=} opt_rpath=${rpath:+-Wl,-R$rpath} use_maybe_rpath=false ;; --suffix=*) opt_suffix=${arg#--suffix=} ;; --arch=*) echo >&2 "WARNING: The --arch option is now deprecated. Use --cflags." opt_arch=${arg#--arch=} ;; --cflags=*) opt_cflags=${arg#--cflags=} ;; --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 case $opt_arch in '' | x86 | arm ) ;; *) echo >&2 "Untested arch $opt_arch." ;; esac if [ "${opt_cflags-UNSET}" = "UNSET" ]; then # Some targets want something like -m64. eval arch_flags=\$compile_${opt_arch}_${opt_bits} echo >&2 "WARNING: Guessing architecture CFLAGS '${arch_flags-}'." echo >&2 "If you need specific flags, use --cflags." else arch_flags=$opt_cflags fi if $use_maybe_rpath && [ -n "$maybe_rpath" ]; then echo >&2 "Adding default RPATH for sqlite." opt_rpath="${opt_rpath+${opt_rpath} }${maybe_rpath}" fi if [ -z "$opt_prefix" ]; then usage fi if [ -z "$opt_libdir" ]; then opt_libdir=$opt_prefix/lib$opt_mark64 fi # We need to find the libdir relative to the prefix, this is required # by the code in pseudo-utils.c that handles relocation. opt_lib=${opt_libdir#$opt_prefix/} if [ "$opt_lib" = "$opt_libdir" ]; then echo >&2 "libdir must be relative to prefix." exit 1 fi if [ -z "$opt_sqlite_lib" ]; then opt_sqlite_lib=$opt_lib 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 in ${opt_sqlite}." if [ "${SQLITE3_VERSION}" -lt "03006000" ]; then echo >&2 "Pseudo requires SQLite version 3, 3.6.x or later." exit 1 fi if [ -z "$opt_async" ]; then opt_async=false fi if $opt_async; then FORCE_ASYNC="-DPSEUDO_FORCE_ASYNC" else FORCE_ASYNC="" fi if [ -z "$opt_memory" ]; then if [ "${SQLITE3_VERSION}" -lt "03007000" ]; then echo "Disabling in-memory database by default (sqlite too old)." opt_memory=false else echo "Enabling in-memory database by default." opt_memory=true fi fi if $opt_memory; then if [ "${SQLITE3_VERSION}" -lt "03007000" ]; then cat >&2 < Makefile