2009-03-25 19:53:26 +00:00
#!/bin/sh
2017-02-09 00:21:15 +00:00
# This script was automatically generated by ACR v1.1
2014-12-11 00:16:40 +00:00
# @author: pancake <nopcode.org>
2010-02-22 03:47:19 +00:00
# @url: http://www.nopcode.org
2014-12-11 00:16:40 +00:00
# @repo: git clone https://github.com/radare/acr
2009-03-25 19:53:26 +00:00
do_remove() {
if [ "${ACR_RMFILES}" ]; then
printf "cleaning temporally files... "
rm -f ${ACR_RMFILES}
echo "done"
fi
}
control_c() {
printf "\n\n^C control-c : script execution interrupted.\n"
do_remove
exit 1
}
trap control_c 2
2009-04-19 20:55:25 +00:00
DEBUGGER=1
2011-10-18 07:38:20 +00:00
USE_MAGIC=0
2015-04-09 22:17:30 +00:00
LOADLIBS=1
2015-04-11 03:00:05 +00:00
HAVE_FORK=1
2015-02-16 19:51:24 +00:00
WITH_CAPSTONE=0
2014-01-30 00:45:08 +00:00
USE_ZIP=0
2015-02-07 00:41:54 +00:00
WITH_GPL=1
2012-10-26 00:49:33 +00:00
WANT_OPENSSL=0
2012-08-27 15:02:58 +00:00
USE_RPATH=0
2009-04-03 11:11:17 +00:00
[ -z "${USERCC}" ] && USERCC="gcc"
2010-02-21 19:49:39 +00:00
[ -z "${USEROSTYPE}" ] && USEROSTYPE="auto"
2010-01-21 20:22:30 +00:00
WITHPIC=1
2010-10-29 01:10:10 +00:00
WITHNONPIC=0
2011-04-25 16:11:01 +00:00
[ -z "${LIBVERSION}" ] && LIBVERSION="xxx"
2009-03-25 19:53:26 +00:00
split_host() {
S="$"
while : ; do
ENVWORDS="${ENVWORDS} $1_CPU $1_OS"
STR=`eval "echo ${S}$1"`
SPLIT_CPU="`echo "$STR" | cut -d - -f 1`"
2013-11-12 01:21:31 +00:00
SPLIT_OS="`echo "$STR" | awk -F - '{
2014-03-05 21:22:38 +00:00
if ($2=="unknown"){
if (NF<3) { print $2; } else { print $3; }
} else {
if ($2=="linux") { print $2; } else
if (NF<3) { print $2; } else { print $3; }
}
2013-11-12 01:21:31 +00:00
}'`"
2009-03-25 19:53:26 +00:00
eval "$1_CPU=\"$SPLIT_CPU\""
eval "$1_OS=\"$SPLIT_OS\""
shift
[ -z "$1" ] && break
done
}
VPATH=`dirname ${0}`
if [ "${VPATH}" = "." ]; then
WODIS=current
else
if [ "${VPATH}" = "${PWD}" ]; then
VPATH=.
WODIS=current
else
WODIS=crosspath
CURDIR=$PWD
cd $VPATH
VPATH="${PWD}/"
cd $CURDIR
fi
fi
guess_os() {
if [ -e "${VPATH}/config.guess" ]; then
sh ${VPATH}/config.guess
return
fi
2012-02-07 00:51:56 +00:00
CPU="`uname -m|sed -e 's, ,,g'|cut -d - -f 1`"
OS="`uname -s|tr A-Z a-z`"
2009-03-25 19:53:26 +00:00
GNU="`uname --help 2>&1 | grep gnu`"
[ "${GNU}" ] && OS="${OS}-gnu"
[ "${CPU}" = ppc ] && CPU="powerpc"
echo "${CPU}-unknown-${OS}"
}
SEARCHPATH="/usr /usr/local /usr/pkg /sw"
: ${PREFIX:=/usr/local}
CROSSBUILD=0
BUILD=`guess_os`
HOST="${BUILD}"
TARGET="${HOST}"
SYSCONFDIR=""
create_environ() {
2016-05-15 21:02:37 +00:00
: ${EPREFIX:="${PREFIX}"}
: ${SPREFIX:="${PREFIX}"}
: ${BINDIR:="${SPREFIX}/bin"}
: ${SBINDIR:="${PREFIX}/sbin"}
: ${SYSCONFDIR:="${SPREFIX}/etc"}
: ${LIBDIR:="${SPREFIX}/lib"}
: ${LIBEXECDIR:="${SPREFIX}/libexec"}
: ${INCLUDEDIR:="${SPREFIX}/include"}
: ${DATADIR:="${SPREFIX}/share"}
: ${INFODIR:="${DATADIR}/info"}
: ${MANDIR:="${DATADIR}/man"}
2017-03-15 18:00:52 +00:00
: ${DOCDIR:="${DATADIR}/doc/radare2"}
2016-05-15 21:02:37 +00:00
: ${LOCALSTATEDIR:="${SPREFIX}/var"}
2009-03-25 19:53:26 +00:00
for A in `echo ${PATH} | sed -e 's,:, ,g'` ; do
2017-01-02 14:56:08 +00:00
[ -e "$A"/ginstall ] && : ${INSTALL:="$A"/ginstall} && break
[ -e "$A"/install ] && : ${INSTALL:="$A"/install} && break
2009-03-25 19:53:26 +00:00
done
: ${INSTALL_DIR:=${INSTALL} -d}
: ${INSTALL_DATA:=${INSTALL} -m 644}
: ${INSTALL_SCRIPT:=${INSTALL} -m 755}
2012-06-21 08:12:02 +00:00
: ${INSTALL_PROGRAM:=${INSTALL} -m 755}
: ${INSTALL_PROGRAM_STRIP:=${INSTALL} -m 755 -s}
2009-03-25 19:53:26 +00:00
: ${INSTALL_MAN:=${INSTALL} -m 444}
2014-12-11 00:50:26 +00:00
: ${INSTALL_LIB:=${INSTALL} -m 755 -c}
2017-03-13 13:41:40 +00:00
PKGNAME='radare2' ; VERSION='1.4.0-git' ; CONTACT_MAIL="pancake@nopcode.org" ; CONTACT_NAME="pancake" ; CONTACT="pancake <pancake@nopcode.org>" ;
2009-03-25 19:53:26 +00:00
}
show_usage() {
cat <<EOF2
2017-03-13 13:41:40 +00:00
'configure' configures radare2-1.4.0-git to adapt to many kinds of systems.
2009-03-25 19:53:26 +00:00
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.
Defaults for the options are specified in brackets.
Configuration:
-h, --help display this help and exit
-V, --version display version information and exit
-r, --report show what libs/programs require to work
Installation directories:
--prefix=PREFIX install arch-independent files in PREFIX [/usr/local]
--exec-prefix=EPREFIX install arch-dependent files in EPREFIX [PREFIX]
--sandbox=SPREFIX sandbox prefix directory: SPREFIX [PREFIX]
Fine tuning of the installation directories:
--bindir=DIR user executables [EPREFIX/bin]
--sbindir=DIR system admin executables [EPREFIX/sbin]
--libexecdir=DIR program executables [EPREFIX/libexec]
--datadir=DIR read-only architecture-independent data [PREFIX/share]
--sysconfdir=DIR read-only single-machine data [PREFIX/etc]
--sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
--localstatedir=DIR modifiable single-machine data [PREFIX/var]
--libdir=DIR object code libraries [EPREFIX/lib]
2013-12-31 11:58:09 +00:00
--libpath=DIR set rpath/libname-path to linker
2009-03-25 19:53:26 +00:00
--includedir=DIR C header files [PREFIX/include]
2011-07-20 21:55:05 +00:00
--infodir=DIR info documentation [DATADIR/info]
--mandir=DIR man documentation [DATADIR/man]
2017-03-15 18:00:52 +00:00
--docdir=DIR documentation directory [DATADIR/doc/radare2]
2009-03-25 19:53:26 +00:00
System types:
--build=BUILD configure for building on BUILD [guessed]
--host=HOST cross-compile to build programs to run on HOST [BUILD]
--target=TARGET configure for building compilers for TARGET [HOST]
EOF2
2017-03-15 18:00:52 +00:00
printf "\nOptional Features:
2012-09-12 17:35:27 +00:00
--disable-debugger disable native debugger features
2011-10-18 16:12:17 +00:00
--with-sysmagic force to use system's magic
2015-04-09 22:17:30 +00:00
--disable-loadlibs disable loading plugins
2015-04-11 03:00:05 +00:00
--without-fork disable fork
2014-06-24 10:48:29 +00:00
--with-syscapstone force to use system-wide capstone
2014-01-30 00:45:08 +00:00
--with-syszip force to use system's libzip and zlib
2015-02-07 00:41:54 +00:00
--without-gpl do not build GPL code (grub, cxx, ... )
2012-10-26 00:49:33 +00:00
--with-openssl build with openssl if possible
2012-08-27 15:02:58 +00:00
--with-rpath use rpath to build
2009-04-03 11:11:17 +00:00
--with-compiler Define compiler to use (see mk/) (USERCC=gcc)
2013-06-07 11:21:51 +00:00
--with-ostype Choose OS type ( gnulinux windows darwin haiku ) (USEROSTYPE=auto)
2010-10-29 01:10:10 +00:00
--without-pic do not build libr as a program independent location
2011-04-20 11:56:58 +00:00
--with-nonpic build the library archives .a
2017-03-15 18:00:52 +00:00
--with-libversion specify different libversion (LIBVERSION=xxx)\n"
printf "\nSome influential environment variables:
2009-03-25 19:53:26 +00:00
CC C compiler command
CFLAGS C compiler flags
2012-02-07 00:51:56 +00:00
CPPFLAGS C preprocessor flags
2009-03-25 19:53:26 +00:00
LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a
nonstandard directory <lib dir>
CPPFLAGS C/C++ preprocessor flags, e.g. -I<include dir> if you have
headers in a nonstandard directory <include dir>
2017-03-15 18:00:52 +00:00
CPP C preprocessor\n"
printf "\nReport bugs to: pancake <pancake@nopcode.org>"
2009-03-25 19:53:26 +00:00
echo ""
exit 0
}
take_environ() {
: ${SH:=/bin/sh}
: ${CPP:=cpp}
: ${CC:=gcc}
: ${PREFIX:=/usr/local/}
}
show_version() {
2017-03-13 13:41:40 +00:00
echo "radare2-1.4.0-git configuration script done with acr v1.1.
2009-03-25 19:53:26 +00:00
The 'Free Software Foundation' message is only for autodetection.
2014-12-11 00:16:40 +00:00
Originally written by pancake <nopcode.org>."
2009-03-25 19:53:26 +00:00
exit 0
}
parse_options() {
flag=`echo $1| cut -d = -f 1`
value=`echo $1| awk 'BEGIN{FS="=";}{print $2}'`
flag2=`echo $flag|cut -f2- -d -| sed -e 's,-,_,g' -e 's,^_,,g'|tr '[a-z]' '[A-Z]'`
2012-02-07 00:51:56 +00:00
if [ "${TARGET_OS}" = "darwin" ]; then
LIBPATH=-Wl,-install_name,
else
LIBPATH=-Wl,-R
fi
2009-03-25 19:53:26 +00:00
case $flag in
2013-12-31 11:58:09 +00:00
-h|--help|--hel|--h|--he|-help)
2009-03-25 19:53:26 +00:00
show_usage ; ;;
2013-12-31 11:58:09 +00:00
-V|-version|--version)
2009-03-25 19:53:26 +00:00
show_version ; ;;
2013-12-31 11:58:09 +00:00
-r|--r|--report)
2009-03-25 19:53:26 +00:00
echo "PKGNAME: radare2"
2017-03-13 13:41:40 +00:00
echo "VERSION: 1.4.0-git"
2009-03-25 19:53:26 +00:00
echo "LANGS: c"
2010-03-23 11:30:04 +00:00
echo "REQUIRED: libdl"
2011-10-18 07:38:20 +00:00
echo "OPTIONAL: libmagic"
2015-01-09 15:21:47 +00:00
echo "PKG-CONFIG: capstone openssl"
2016-05-06 08:21:55 +00:00
echo "FLAGS: --disable-debugger --with-sysmagic --disable-loadlibs --without-fork --with-syscapstone --with-syszip --without-gpl --with-openssl --with-rpath --with-compiler=gcc --with-ostype=auto --without-pic --with-nonpic --with-libversion=xxx"
2009-03-25 19:53:26 +00:00
exit 0
;;
2013-12-31 11:58:09 +00:00
--cache-file)
2009-03-25 19:53:26 +00:00
# ignored: acr have no cache
;;
2013-12-31 11:58:09 +00:00
--build)
2010-01-15 12:02:54 +00:00
BUILD="$value"; split_host BUILD ; ;;
2013-12-31 11:58:09 +00:00
--host)
2010-01-15 12:02:54 +00:00
CROSSBUILD=1 # XXX
HOST="$value"; split_host HOST ; ;;
2013-12-31 11:58:09 +00:00
--target)
2010-01-15 12:02:54 +00:00
TARGET="$value"; split_host TARGET ; ;;
2013-12-31 11:58:09 +00:00
--prefix)
2009-03-25 19:53:26 +00:00
PREFIX="$value"; ;;
2013-12-31 11:58:09 +00:00
--exec-prefix)
2009-03-25 19:53:26 +00:00
EPREFIX="$value"; ;;
2013-12-31 11:58:09 +00:00
--sandbox|--sprefix)
2009-03-25 19:53:26 +00:00
SPREFIX="$value"; ;;
2013-12-31 11:58:09 +00:00
--bindir)
2009-03-25 19:53:26 +00:00
BINDIR="$value"; ;;
2013-12-31 11:58:09 +00:00
--sbindir)
2009-03-25 19:53:26 +00:00
SBINDIR="$value"; ;;
2013-12-31 11:58:09 +00:00
--libexecdir)
2009-03-25 19:53:26 +00:00
LIBEXECDIR="$value"; ;;
2017-02-09 00:21:15 +00:00
--docdir)
DOCDIR="$value"; ;;
2013-12-31 11:58:09 +00:00
--datadir)
2009-03-25 19:53:26 +00:00
DATADIR="$value"; ;;
2013-12-31 11:58:09 +00:00
--sysconfdir)
2009-03-25 19:53:26 +00:00
SYSCONFDIR="$value"; ;;
2013-12-31 11:58:09 +00:00
--sharedstatedir)
2009-03-25 19:53:26 +00:00
SHAREDSTATEDIR="$value"; ;;
2013-12-31 11:58:09 +00:00
--localstatedir)
2009-03-25 19:53:26 +00:00
LOCALSTATEDIR="$value"; ;;
2013-12-31 11:58:09 +00:00
--libdir)
LIBDIR="$value"; ;;
--libpath)
LDFLAGS="${LDFLAGS} ${LIBPATH}$value"; ;;
--includedir)
2009-03-25 19:53:26 +00:00
INCLUDEDIR="$value"; CFLAGS="${CFLAGS} -I$value"; ;;
2013-12-31 11:58:09 +00:00
--infodir)
2009-03-25 19:53:26 +00:00
INFODIR="$value"; ;;
2013-12-31 11:58:09 +00:00
--mandir)
2009-03-25 19:53:26 +00:00
MANDIR="$value"; ;;
2012-09-12 17:35:27 +00:00
"--disable-debugger") DEBUGGER="0"; ;;
2011-10-18 16:12:17 +00:00
"--with-sysmagic") USE_MAGIC="1"; ;;
2015-04-09 22:17:30 +00:00
"--disable-loadlibs") LOADLIBS="0"; ;;
2015-04-11 03:00:05 +00:00
"--without-fork") HAVE_FORK="0"; ;;
2015-02-16 19:51:24 +00:00
"--with-syscapstone") WITH_CAPSTONE="1"; ;;
2014-01-30 00:45:08 +00:00
"--with-syszip") USE_ZIP="1"; ;;
2015-02-07 00:41:54 +00:00
"--without-gpl") WITH_GPL="0"; ;;
2012-10-26 00:49:33 +00:00
"--with-openssl") WANT_OPENSSL="1"; ;;
2012-08-27 15:02:58 +00:00
"--with-rpath") USE_RPATH="1"; ;;
2009-04-03 11:11:17 +00:00
--with-compiler) if [ -z "${value}" ]; then USERCC="gcc"; else USERCC="${value}" ; fi ;;
2010-02-21 19:49:39 +00:00
--with-ostype) if [ -z "${value}" ]; then USEROSTYPE="auto"; else USEROSTYPE="${value}" ; fi ;;
2010-01-21 20:22:30 +00:00
"--without-pic") WITHPIC="0"; ;;
2010-10-29 01:10:10 +00:00
"--with-nonpic") WITHNONPIC="1"; ;;
2011-04-25 16:11:01 +00:00
--with-libversion) if [ -z "${value}" ]; then LIBVERSION="xxx"; else LIBVERSION="${value}" ; fi ;;
2009-03-25 19:53:26 +00:00
*) if [ "$value" ]; then eval "`echo $flag2=$value`" ;
else echo ; echo "WARNING: Unknown flag '$flag'." >&2 ; echo ; fi ;;
esac
}
# MAIN #
take_environ
2009-07-16 00:30:20 +00:00
split_host BUILD HOST TARGET
[ -z "$ACRHOOK" ] && ACRHOOK=./configure.hook
[ -e "$ACRHOOK" ] && . ${ACRHOOK}
2009-03-25 19:53:26 +00:00
while : ; do
[ -z "$1" ] && break
2016-05-15 21:02:37 +00:00
parse_options "$1"
2009-03-25 19:53:26 +00:00
shift
done
2017-03-12 22:20:08 +00:00
ENVWORDS="MANDIR INFODIR LIBDIR INCLUDEDIR LOCALSTATEDIR SYSCONFDIR DATADIR DOCDIR LIBEXECDIR SBINDIR BINDIR EPREFIX PREFIX SPREFIX TARGET HOST BUILD INSTALL INSTALL_LIB INSTALL_MAN INSTALL_PROGRAM INSTALL_PROGRAM_STRIP INSTALL_DIR INSTALL_SCRIPT INSTALL_DATA HOST_OS HOST_CPU BUILD_OS BUILD_CPU TARGET_OS TARGET_CPU PKGNAME VPATH VERSION CONTACT CONTACT_NAME CONTACT_MAIL CC CFLAGS CPPFLAGS LDFLAGS HAVE_LANG_C DEBUGGER HAVE_LIB_DL DL_LIBS HAVE_PATCH PATCH HAVE_GIT GIT HAVE_LIB_MAGIC USE_MAGIC USE_LIB_MAGIC LIBMAGIC LOADLIBS HAVE_FORK WITH_CAPSTONE CAPSTONE_CFLAGS CAPSTONE_LDFLAGS HAVE_PKGCFG_CAPSTONE USE_CAPSTONE HAVE_LIB_Z HAVE_LIB_ZIP USE_ZIP USE_LIB_ZIP LIBZIP WITH_GPL HAVE_LIB_GMP HAVE_LIB_SSL SSL_CFLAGS SSL_LDFLAGS HAVE_PKGCFG_OPENSSL HAVE_OPENSSL WANT_OPENSSL USE_RPATH USERCC USEROSTYPE WITHPIC WITHNONPIC LIBVERSION"
2009-03-25 19:53:26 +00:00
create_environ
echo "checking build system type... ${BUILD}"
echo "checking host system type... ${HOST}"
echo "checking target system type... ${TARGET}"
[ "${CROSSBUILD}" = 1 ] && echo "using crosscompilation mode."
2009-07-16 00:30:20 +00:00
#split_host BUILD HOST TARGET
2016-05-15 21:02:37 +00:00
[ -n "${prefix}" ] && PREFIX="${prefix}"
2009-03-25 19:53:26 +00:00
echo "checking for working directories... ${WODIS}"
echo "using prefix '${PREFIX}'"
ACR_RMFILES=" test.c a.out a.exe"
2009-03-31 00:57:39 +00:00
2009-03-25 19:53:26 +00:00
:
COMPILER=CC
printf "checking for c compiler... "
HAVE_LANG_C=1
if [ "${CROSSBUILD}" = 1 ]; then
(command -v ${HOST}-${CC} >/dev/null 2>&1)
if [ $? = 0 ]; then CC="${HOST}-${CC}"; fi
fi
2014-02-21 13:08:17 +00:00
echo "int main(int argc, char **argv){return 0;}" > test.c
2012-02-07 00:51:56 +00:00
(exec ${CC} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS} test.c >/dev/null 2>&1)
2009-03-25 19:53:26 +00:00
if [ $? = 0 ]; then echo ${CC}; else
echo no ; HAVE_LANG_C=0
do_remove
echo "ERROR: ${CC} cannot create executables" >&2 ;
exit 1 ; fi
2010-01-15 12:02:54 +00:00
printf "checking for dynamic library... "
HAVE_LIB_DL=0
2013-11-11 11:00:39 +00:00
for OS in gnulinux linux gnu/kfreebsd syllable sunos darwin beos solaris ; do
2010-01-15 12:02:54 +00:00
if [ "${HOST_OS}" = "${OS}" ]; then
HAVE_LIB_DL=1
break;
fi
done
if [ "${HAVE_LIB_DL}" = 1 ]; then
DL_LIBS="-ldl"
echo "required"
else
DL_LIBS=""
echo "libc"
fi
2016-02-06 22:14:05 +00:00
printf "checking for patch... "
if [ -x "${PATCH}" ]; then
FIND=${PATCH}
else
FIND=""
IFS=:
for A in ${PATH} ; do
if [ -x "${A}/patch" ]; then
FIND="${A}/patch"
break;
fi
done
unset IFS
fi
2016-05-06 08:21:55 +00:00
if [ -n "${FIND}" ]; then
echo ${FIND};
2016-02-06 22:14:05 +00:00
HAVE_PATCH=1
PATCH=${FIND}
else
HAVE_PATCH=0
PATCH=patch
echo no
echo "error: This program is required." >&2
exit 1 ; fi
printf "checking for git... "
if [ -x "${GIT}" ]; then
FIND=${GIT}
else
FIND=""
IFS=:
for A in ${PATH} ; do
if [ -x "${A}/git" ]; then
FIND="${A}/git"
break;
fi
done
unset IFS
fi
2016-05-06 08:21:55 +00:00
if [ -n "${FIND}" ]; then
echo ${FIND};
2016-02-06 22:14:05 +00:00
HAVE_GIT=1
GIT=${FIND}
else
HAVE_GIT=0
GIT=git
echo no ; fi
2009-03-31 00:57:39 +00:00
check_library() {
VAR=$1
S="$"
_REQUIRED=$3
_CHKLIB_NAME=$2
2016-02-27 09:37:10 +00:00
_CHKLIB_LIBS=$(echo "-l${_CHKLIB_NAME}" | sed 's,+, -l,g')
2009-03-31 00:57:39 +00:00
printf "checking for lib${_CHKLIB_NAME} ... "
2014-02-21 13:08:17 +00:00
echo "int main(int ac, char **av){return 0;}" > test.c
2012-02-07 00:51:56 +00:00
eval ${S}${COMPILER} ${CFLAGS} ${CPPFLAGS} ${CXXFLAGS} ${LDFLAGS} ${_CHKLIB_LIBS} test.c >/dev/null 2>&1
2009-03-31 00:57:39 +00:00
if [ $? = 0 ]; then
eval ${VAR}=1
echo yes
else
eval ${VAR}=0
echo no ; fi }
2011-10-18 07:38:20 +00:00
check_library HAVE_LIB_MAGIC magic 0
if [ 11 = "$HAVE_LIB_MAGIC$USE_MAGIC" ]; then
USE_LIB_MAGIC="1"
2011-10-18 16:12:17 +00:00
LIBMAGIC="-lmagic"
2011-10-18 07:38:20 +00:00
else
2011-10-18 16:12:17 +00:00
USE_LIB_MAGIC="0"
LIBMAGIC="-lr_magic"; fi
2015-04-21 20:53:06 +00:00
[ -z "${PKGCONFIG}" ] && PKGCONFIG=pkg-config
echo 'Using PKGCONFIG: '${PKGCONFIG}
2014-06-24 10:48:29 +00:00
printf 'checking pkg-config flags for capstone... '
2015-04-21 18:11:34 +00:00
tmp=`${PKGCONFIG} --cflags capstone 2>/dev/null`
if [ $? != 0 ]; then echo no ; HAVE_PKGCFG_CAPSTONE=0;
2014-06-24 10:48:29 +00:00
else
CAPSTONE_CFLAGS=$tmp;
2015-04-21 18:11:34 +00:00
tmp=`${PKGCONFIG} --libs capstone 2>/dev/null`
2014-06-24 10:48:29 +00:00
if [ $? = 0 ]; then
echo yes; HAVE_PKGCFG_CAPSTONE=1;
CAPSTONE_LDFLAGS=$tmp; fi; fi
2015-02-16 19:51:24 +00:00
if [ 11 = "$WITH_CAPSTONE$HAVE_PKGCFG_CAPSTONE" ]; then
2014-06-24 15:47:38 +00:00
USE_CAPSTONE="1"
else
USE_CAPSTONE="0"; fi
2014-01-30 00:45:08 +00:00
check_library HAVE_LIB_Z z 0
check_library HAVE_LIB_ZIP zip 0
if [ 11 = "$HAVE_LIB_Z$USE_ZIP" ]; then
if [ "$HAVE_LIB_ZIP" = "1" ]; then
USE_LIB_ZIP="1"
LIBZIP="-lz -lzip"
else
USE_LIB_ZIP="0"
LIBZIP="-lrz"; fi
else
USE_LIB_ZIP="0"
LIBZIP="-lrz"; fi
2012-12-14 16:46:33 +00:00
HAVE_LIB_GMP="0"
2011-07-14 20:14:11 +00:00
check_library HAVE_LIB_SSL ssl 0
2015-04-21 20:53:06 +00:00
[ -z "${PKGCONFIG}" ] && PKGCONFIG=pkg-config
echo 'Using PKGCONFIG: '${PKGCONFIG}
2011-07-13 17:22:38 +00:00
printf 'checking pkg-config flags for openssl... '
2015-04-21 18:11:34 +00:00
tmp=`${PKGCONFIG} --cflags openssl 2>/dev/null`
if [ $? != 0 ]; then echo no ; HAVE_PKGCFG_OPENSSL=0;
2011-07-13 17:22:38 +00:00
else
SSL_CFLAGS=$tmp;
2015-04-21 18:11:34 +00:00
tmp=`${PKGCONFIG} --libs openssl 2>/dev/null`
2012-05-29 23:55:39 +00:00
if [ $? = 0 ]; then
2011-07-13 17:22:38 +00:00
echo yes; HAVE_PKGCFG_OPENSSL=1;
SSL_LDFLAGS=$tmp; fi; fi
2013-03-26 12:50:05 +00:00
if [ ! "$SSL_LDFLAGS" = "" ]; then
2012-10-26 00:49:33 +00:00
HAVE_OPENSSL="1"; fi
if [ 11 = "$WANT_OPENSSL$HAVE_OPENSSL" ]; then
HAVE_OPENSSL="1"
else
HAVE_OPENSSL="0"; fi
2011-07-14 20:14:11 +00:00
if [ "$SSL_LDFLAGS" = "" ]; then
if [ "$HAVE_LIB_SSL" = "0" ]; then
HAVE_OPENSSL="0"
else
SSL_LDFLAGS="-lssl"; fi; fi
2010-02-21 19:49:39 +00:00
if [ "$USEROSTYPE" = "auto" ]; then
2015-11-23 01:36:02 +00:00
if [ "$HOST_OS" = "mingw32_nt-6.2" ]; then
USEROSTYPE="mingw32"
else
2015-07-12 23:45:38 +00:00
if [ "$HOST_OS" = "mingw32_nt" ]; then
2015-11-11 22:40:22 +00:00
USEROSTYPE="mingw32"
2015-07-12 23:45:38 +00:00
else
2010-02-21 19:24:28 +00:00
if [ "$HOST_OS" = "linux" ]; then
USEROSTYPE="gnulinux"
else
2011-04-13 14:39:44 +00:00
if [ "$HOST_OS" = "gnu" ]; then
USEROSTYPE="gnulinux"
2011-04-20 11:56:58 +00:00
HAVE_LIB_DL="1"
DL_LIBS="-ldl"
2011-04-13 14:39:44 +00:00
else
2017-01-17 23:47:46 +00:00
if [ "$HOST_OS" = "sunos" ]; then
USEROSTYPE="solaris"
else
2011-04-13 09:34:27 +00:00
if [ "$HOST_OS" = "gnu/kfreebsd" ]; then
2015-10-25 02:53:55 +00:00
USEROSTYPE="bsd"
2011-04-13 09:34:27 +00:00
else
2010-07-03 01:35:26 +00:00
if [ "$HOST_OS" = "netbsd" ]; then
2015-10-25 02:53:55 +00:00
USEROSTYPE="bsd"
2010-07-03 01:35:26 +00:00
else
if [ "$HOST_OS" = "freebsd" ]; then
2015-10-25 02:53:55 +00:00
USEROSTYPE="bsd"
2010-07-03 01:35:26 +00:00
else
if [ "$HOST_OS" = "openbsd" ]; then
2015-10-25 02:53:55 +00:00
USEROSTYPE="bsd"
2010-07-03 01:35:26 +00:00
else
2010-02-21 19:24:28 +00:00
if [ "$HOST_OS" = "darwin" ]; then
2017-01-17 23:47:46 +00:00
USEROSTYPE="darwin"; fi; fi; fi; fi; fi; fi; fi; fi; fi; fi; fi
2011-04-25 16:11:01 +00:00
if [ "$LIBVERSION" = "xxx" ]; then
2011-04-20 11:56:58 +00:00
LIBVERSION="$VERSION"; fi
2009-03-25 19:53:26 +00:00
SEDFLAGS=" -e '"
COUNT=0
for A in ${ENVWORDS} ; do
[ "${A}" = VPATH ] && continue
[ "${A}" = srcdir ] && continue
eval "VAR=\$${A}"
VAR="`echo ${VAR} | sed -e 's/\,/\\\,/g'`"
[ $COUNT = 10 ] && COUNT=0 && SEDFLAGS="${SEDFLAGS}' -e '"
2009-07-16 00:30:20 +00:00
COUNT=$(($COUNT+1))
2009-03-25 19:53:26 +00:00
SEDFLAGS="${SEDFLAGS}s,@${A}@,${VAR},g;"
done
SEDFLAGS="${SEDFLAGS}'"
2016-10-26 23:02:26 +00:00
for A in ./config-user.mk libr/include/r_userconf.h pkgcfg/r_io.pc pkgcfg/r_magic.pc pkgcfg/r_asm.pc pkgcfg/r_bin.pc pkgcfg/r_anal.pc pkgcfg/r_hash.pc pkgcfg/r_cons.pc pkgcfg/r_core.pc pkgcfg/r_lang.pc pkgcfg/r_socket.pc pkgcfg/r_debug.pc pkgcfg/r_reg.pc pkgcfg/r_config.pc pkgcfg/r_flag.pc pkgcfg/r_syscall.pc pkgcfg/r_util.pc pkgcfg/r_search.pc pkgcfg/r_bp.pc pkgcfg/r_parse.pc pkgcfg/r_fs.pc ; do # SUBDIRS
2010-01-12 18:57:33 +00:00
if [ -f "${VPATH}/${A}.acr" ]; then
2009-03-25 19:53:26 +00:00
SD_TARGET=${A}
else
if [ -d "${VPATH}/${A}" ]; then
SD_TARGET=${A}/Makefile
mkdir -p ${A}
else
echo "ERROR: Cannot find ${VPATH}/${A}.acr" >&2
exit 1
fi
fi
echo "creating ${SD_TARGET}"
mkdir -p $(echo ${A} | sed -e "s,/`basename ${A}`$,,g")
cat ${VPATH}/${SD_TARGET}.acr | \
eval sed -e "s,@VPATH@,${VPATH}/${A},g" ${SEDFLAGS} > ${SD_TARGET}.tmp
for A in ${ENVWORDS}; do
VALUE=`eval echo "$"${A}`
2010-01-12 18:57:33 +00:00
if [ "$VALUE" = 0 ]; then ## FALSE
2009-03-25 19:53:26 +00:00
MARK="##${A}##"
2010-01-12 18:57:33 +00:00
if [ -n "`grep \"${MARK}\" ${SD_TARGET}.tmp`" ]; then
2009-03-25 19:53:26 +00:00
mv ${SD_TARGET}.tmp ${SD_TARGET}.tmp2
2010-01-12 18:57:33 +00:00
cat ${SD_TARGET}.tmp2 | MARK=$MARK awk 'BEGIN{a=0;}{if($1==ENVIRON["MARK"]){if(a)a=0;else a=1}else{if(!a)print;}}' > ${SD_TARGET}.tmp
2009-03-25 19:53:26 +00:00
fi
2010-01-12 18:57:33 +00:00
fi
2009-03-25 19:53:26 +00:00
done
mv ${SD_TARGET}.tmp ${SD_TARGET} && rm -f ${SD_TARGET}.tmp2
2012-05-29 23:55:39 +00:00
if [ ! $? = 0 ]; then echo Cannot write target file ; control_c ; fi
2009-03-25 19:53:26 +00:00
done
do_remove
2009-03-31 00:57:39 +00:00
echo
echo "Final report:"
2016-05-15 21:02:37 +00:00
for A in PREFIX HAVE_LIB_GMP HAVE_OPENSSL USE_CAPSTONE HAVE_FORK VERSION USE_LIB_ZIP USE_LIB_MAGIC DEBUGGER CC USERCC USEROSTYPE LIBVERSION BUILD HOST TARGET ; do # REPORT
2009-03-31 00:57:39 +00:00
eval VAL="\$${A}"
[ -z "${VAL}" ] && VAL="(null)"
echo " - ${A} = ${VAL}"
done