1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342
|
#!/bin/sh
#
# configure, simulation of autoconf script, much simplified
#
# Copyright (c) 2008-2014 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=
opt_xattr=
opt_xattrdb=false
opt_profile=false
opt_passwd_fallback='""'
compile_x86_32=
compile_x86_64=
usage()
{
echo >&2 "usage:"
echo >&2 " configure --prefix=..."
echo >&2 " [--libdir=...]"
echo >&2 " [--suffix=...]"
echo >&2 " [--enable-memory-db]"
echo >&2 " [--enable-xattr]"
echo >&2 " [--enable-xattrdb]"
echo >&2 " [--enable-profiling]"
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 " [--with-passwd-fallback=...|--without-passwd-fallback]"
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
--disable-*)
arg="--enable-${arg%--disable-}=no"
;;
esac
case $arg in
--) shift; break ;;
--prefix=*)
opt_prefix=${arg#--prefix=}
if [ -d "$opt_prefix" ]; then
maybe_prefix=$(cd "$opt_prefix"; pwd)
else
maybe_prefix=$opt_prefix
fi
if [ "$maybe_prefix" = "$(pwd)" ]; then
echo >&2 "ERROR: Prefix is current directory. That doesn't work."
exit 1
fi
;;
--libdir=*)
opt_libdir=${arg#--libdir=}
;;
--with-static-sqlite=*)
opt_sqlite_ldarg=${arg#--with-static-sqlite=}
sqlite_ldarg=$opt_sqlite_ldarg
use_maybe_rpath=false
;;
--without-passwd-fallback)
opt_passwd_fallback='NULL'
;;
--with-passwd-fallback=*)
opt_passwd_fallback="${arg#--with-passwd-fallback=}"
# Trim a trailing /, remove quotes. So / => "".
opt_passwd_fallback="\"${opt_passwd_fallback%/}\""
;;
--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-profiling=no)
opt_profiling=false
;;
--enable-profiling=yes | --enable-profiling)
opt_profiling=true
;;
--enable-xattr=no)
opt_xattr=false
;;
--enable-xattr=yes | --enable-xattr)
opt_xattr=true
;;
--enable-xattrdb=no)
opt_xattrdb=false
;;
--enable-xattrdb=yes | --enable-xattrdb)
opt_xattrdb=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=}
;;
*)
echo >&2 "warning: Unrecognized option '$arg'"
;;
esac
done
case $opt_arch in
'' | x86 | arm )
;;
*) echo >&2 "Untested arch $opt_arch."
;;
esac
if [ -z "$opt_bits" ]; then
printf >&2 "Bit width unspecified;"
case $(file -L /bin/sh 2>/dev/null) in
*64-bit*) opt_bits=64;;
*32-bit*) opt_bits=32;;
esac
if [ -n "$opt_bits" ]; then
echo >&2 " guessing bit width is $opt_bits, based on /bin/sh."
else
echo >&2 " can't tell, assuming 32."
opt_bits=32
fi
fi
case $opt_bits in
64) opt_mark64=;;
32) opt_mark64=;;
*) echo >&2 "Unknown bit size $opt_bits (only 32 and 64 known)."
;;
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-<unset>}'."
echo >&2 "If you need specific flags, use --cflags."
else
arch_flags=$opt_cflags
fi
arch_flags=$(echo "$arch_flags" | sed -e 's/,/\\,/g')
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 getfattr --help >/dev/null 2>&1; then
xattr_runs=true
else
xattr_runs=false
fi
if [ -z "$opt_xattr" ]; then
if $opt_xattrdb; then
opt_xattr=true
echo "xattr DB support implies extended attribute support"
else
if $xattr_runs; then
opt_xattr=true
echo "getfattr runs, enabling extended attribute support"
else
opt_xattr=false
echo "getfattr fails, disabling extended attribute support"
fi
fi
fi
if $opt_xattr || $opt_xattrdb; then
if ! $xattr_runs; then
echo >&2 "WARNING: getfattr doesn't work, but xattr-related features requestd."
fi
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 <<EOF
WARNING: sqlite prior to 3.7 has been known to perform exceedingly poorly
with the in-memory database option. You asked for it, you get it, but if
you get horrible performance, try turning it off.
EOF
fi
SQLITE_MEMORY="-DUSE_MEMORY_DB"
else
SQLITE_MEMORY=""
fi
# Suppress the -L if sqlite is in the default path.
if [ "$opt_sqlite" = "/usr" ]; then
default_sqlite="# "
fi
touch port_deps.mk
touch func_deps.mk
sed -e '
s,@PREFIX@,'"$opt_prefix"',g
s,@XATTR@,'"$opt_xattr"',g
s,@XATTRDB@,'"$opt_xattrdb"',g
s,@PROFILING@,'"$opt_profiling"',g
s,@LIBDIR@,'"$opt_libdir"',g
s,@LIB@,'"$opt_lib"',g
s,@SUFFIX@,'"$opt_suffix"',g
s,@SQLITE@,'"$opt_sqlite"',g
s,@ARCH_FLAGS@,'"$arch_flags"',g
s,@DEFAULT_SQLITE@,'"$default_sqlite"',g
s,@SQLITE_LDARG@,'"$sqlite_ldarg"',g
s,@SQLITE_LIB@,'"$opt_sqlite_lib"',g
s,@SQLITE_MEMORY@,'"$SQLITE_MEMORY"',g
s,@FORCE_ASYNC@,'"$FORCE_ASYNC"',g
s,@PASSWD_FALLBACK@,'$opt_passwd_fallback',g
s!@RPATH@!'"$opt_rpath"'!g
s,@MARK64@,'"$opt_mark64"',g
s,@ARCH@,'"$opt_arch"',g
s,@BITS@,'"$opt_bits"',g
' < Makefile.in > Makefile
|