* More stuff to make --with-sysmagic work

This commit is contained in:
pancake 2011-10-18 18:12:17 +02:00
parent 4106e9e1b2
commit 3b9420fad8
12 changed files with 34 additions and 25 deletions

View File

@ -1,4 +1,5 @@
include ../../libr/config.mk
include ../../config-user.mk
.PHONY: all clean

View File

@ -25,9 +25,9 @@ LDFLAGS+=../../libr/db/sdb/src/libsdb.a
ifeq ($(HAVE_LIB_GMP),1)
LDFLAGS+=-lgmp
endif
ifeq ($(HAVE_LIB_MAGIC),1)
LDFLAGS+=-lmagic
endif
ifeq ($(USE_LIB_MAGIC),1)
LDFLAGS+=-lmagic
endif
ifeq ($(uname),OpenBSD)

View File

@ -16,9 +16,9 @@ LDFLAGS+=../../libr/db/sdb/src/libsdb.a
ifeq ($(HAVE_LIB_GMP),1)
LDFLAGS+=-lgmp
endif
ifeq ($(HAVE_LIB_MAGIC),1)
LDFLAGS+=-lmagic
endif
ifeq ($(USE_LIB_MAGIC),1)
LDFLAGS+=-lmagic
endif
ifeq (${HAVE_LIB_SSL},1)

View File

@ -39,6 +39,7 @@ HAVE_LIB_TCC=@HAVE_LIB_TCC@
HAVE_LIB_GMP=@HAVE_LIB_GMP@
HAVE_LIB_SSL=@HAVE_OPENSSL@
HAVE_LIB_MAGIC=@HAVE_LIB_MAGIC@
USE_LIB_MAGIC=@USE_LIB_MAGIC@
SSL_CFLAGS=@SSL_CFLAGS@
SSL_LDFLAGS=@SSL_LDFLAGS@

27
configure vendored
View File

@ -147,10 +147,9 @@ System types:
--target=TARGET configure for building compilers for TARGET [HOST]
EOF2
printf "
Optional Features:
printf "\nOptional Features:
--without-debugger disable native debugger features
--with-magic force to use system's magic
--with-sysmagic force to use system's magic
--without-ewf disable EWF dependency
--without-gmp disable GMP dependency
--without-ssl disable openssl dependency
@ -160,20 +159,16 @@ Optional Features:
--with-ostype Choose OS type ( gnulinux windows darwin ) (USEROSTYPE=auto)
--without-pic do not build libr as a program independent location
--with-nonpic build the library archives .a
--with-libversion specify different libversion (LIBVERSION=xxx)
"
printf "
Some influential environment variables:
--with-libversion specify different libversion (LIBVERSION=xxx)\n"
printf "\nSome influential environment variables:
CC C compiler command
CFLAGS C compiler flags
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>
CPP C preprocessor
"
printf "
Report bugs to: pancake <pancake@nopcode.org>"
CPP C preprocessor\n"
printf "\nReport bugs to: pancake <pancake@nopcode.org>"
echo ""
exit 0
}
@ -209,7 +204,7 @@ echo "LANGS: c"
echo "REQUIRED: libdl"
echo "OPTIONAL: libmagic"
echo "PKG-CONFIG: openssl"
echo "FLAGS: --without-debugger --with-magic --without-ewf --without-gmp --without-ssl --with-little-endian --with-big-endian --with-compiler=gcc --with-ostype=auto --without-pic --with-nonpic --with-libversion=xxx"
echo "FLAGS: --without-debugger --with-sysmagic --without-ewf --without-gmp --without-ssl --with-little-endian --with-big-endian --with-compiler=gcc --with-ostype=auto --without-pic --with-nonpic --with-libversion=xxx"
exit 0
;;
"--cache-file")
@ -252,7 +247,7 @@ echo "FLAGS: --without-debugger --with-magic --without-ewf --without-gmp --w
MANDIR="$value"; ;;
"--without-debugger") DEBUGGER="0"; ;;
"--with-magic") USE_MAGIC="1"; ;;
"--with-sysmagic") USE_MAGIC="1"; ;;
"--without-ewf") HAVE_EWF="0"; ;;
"--without-gmp") HAVE_GMP="0"; ;;
"--without-ssl") HAVE_OPENSSL="0"; ;;
@ -280,7 +275,7 @@ parse_options $1
shift
done
ENVWORDS="MANDIR INFODIR LIBDIR INCLUDEDIR LOCALSTATEDIR SYSCONFDIR DATADIR LIBEXECDIR SBINDIR BINDIR EPREFIX PREFIX SPREFIX TARGET HOST BUILD INSTALL INSTALL_LIB INSTALL_MAN INSTALL_PROGRAM 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 LDFLAGS HAVE_LANG_C DEBUGGER HAVE_LIB_DL DL_LIBS LIL_ENDIAN BIG_ENDIAN BYTEORDER HAVE_LIB_MAGIC USE_MAGIC USE_LIB_MAGIC HAVE_LIB_EWF HAVE_EWF HAVE_LIB_GMP HAVE_GMP HAVE_LIB_SSL SSL_CFLAGS SSL_LDFLAGS HAVE_PKGCFG_OPENSSL HAVE_OPENSSL HAVE_LILEND HAVE_BIGEND HAVE_LIB_LUA5_1 HAVE_LIB_TCC USERCC USEROSTYPE WITHPIC WITHNONPIC LIBVERSION"
ENVWORDS="MANDIR INFODIR LIBDIR INCLUDEDIR LOCALSTATEDIR SYSCONFDIR DATADIR LIBEXECDIR SBINDIR BINDIR EPREFIX PREFIX SPREFIX TARGET HOST BUILD INSTALL INSTALL_LIB INSTALL_MAN INSTALL_PROGRAM 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 LDFLAGS HAVE_LANG_C DEBUGGER HAVE_LIB_DL DL_LIBS LIL_ENDIAN BIG_ENDIAN BYTEORDER HAVE_LIB_MAGIC USE_MAGIC USE_LIB_MAGIC LIBMAGIC HAVE_LIB_EWF HAVE_EWF HAVE_LIB_GMP HAVE_GMP HAVE_LIB_SSL SSL_CFLAGS SSL_LDFLAGS HAVE_PKGCFG_OPENSSL HAVE_OPENSSL HAVE_LILEND HAVE_BIGEND HAVE_LIB_LUA5_1 HAVE_LIB_TCC USERCC USEROSTYPE WITHPIC WITHNONPIC LIBVERSION"
create_environ
@ -358,8 +353,10 @@ check_library HAVE_LIB_MAGIC magic 0
if [ 11 = "$HAVE_LIB_MAGIC$USE_MAGIC" ]; then
USE_LIB_MAGIC="1"
LIBMAGIC="-lmagic"
else
USE_LIB_MAGIC="0"; fi
USE_LIB_MAGIC="0"
LIBMAGIC="-lr_magic"; fi
check_library HAVE_LIB_EWF ewf 0
if [ "$HAVE_EWF" = "0" ]; then
HAVE_LIB_EWF="0"; fi

View File

@ -11,11 +11,13 @@ USE_DL
CHECK_ENDIAN
CHKLIB magic
ARG_WITH USE_MAGIC magic force to use system's magic ;
ARG_WITH USE_MAGIC sysmagic force to use system's magic ;
IFAND HAVE_LIB_MAGIC USE_MAGIC {
USE_LIB_MAGIC = 1 ;
LIBMAGIC = -lmagic ;
}{
USE_LIB_MAGIC = 0 ;
LIBMAGIC = -lr_magic ;
}

View File

@ -15,4 +15,5 @@ ifeq ($(shell uname),OpenBSD)
LDFLAGS+=-lpthread
endif
include ../rules.mk

View File

@ -17,8 +17,8 @@
#define RMagic struct magic_set
#define r_magic_new() magic_open(0)
#define r_magic_free(x) magic_close(x)
#define r_magic_new(x) magic_open(x)
#define r_magic_free(x) x?magic_close(x):x
#define r_magic_file(x,y) magic_file(x,y)
#define r_magic_buffer(x,y,z) magic_buffer(x,y,z)
#define r_magic_descriptor(x,y) magic_descriptor(x,y)

View File

@ -54,6 +54,12 @@ else
$(LIBAR):
endif
ifeq ($(USE_LIB_MAGIC),1)
MAGICSED=| sed -e 's,lr_magic,lmagic,g'
else
MAGICSED=
endif
pkgcfg:
@echo Generating pkgconfig stub for ${NAME}
@echo 'prefix=@PREFIX@' > ../../pkgcfg/${NAME}.pc.acr
@ -66,7 +72,7 @@ pkgcfg:
@echo 'Version: @VERSION@' >> ../../pkgcfg/${NAME}.pc.acr
@echo 'Requires:' >> ../../pkgcfg/${NAME}.pc.acr
@if [ "${NAME}" = "libr" ]; then NAME=''; else NAME=${NAME}; fi ;\
echo 'Libs: -L$${libdir} '`echo $${NAME} ${DEPS}|sed -e s,r_,-lr_,g` >> ../../pkgcfg/${NAME}.pc.acr
echo 'Libs: -L$${libdir} '`echo $${NAME} ${DEPS}|sed -e s,r_,-lr_,g` ${MAGICSED} >> ../../pkgcfg/${NAME}.pc.acr
@echo 'Cflags: -I$${includedir}/libr' >> ../../pkgcfg/${NAME}.pc.acr
install:

View File

@ -7,5 +7,5 @@ Name: r_core
Description: radare foundation libraries
Version: @VERSION@
Requires:
Libs: -L${libdir} -lr_core -lr_config -lr_cons -lr_line -lr_io -lr_cmd -lr_util -lr_print -lr_flags -lr_asm -lr_lib -lr_debug -lr_hash -lr_bin -lr_lang -lr_io -lr_anal -lr_parse -lr_print -lr_bp -lr_egg -lr_reg -lr_search -lr_syscall -lr_sign -lr_diff -lr_socket -lr_fs -lr_magic
Libs: -L${libdir} -lr_core -lr_config -lr_cons -lr_line -lr_io -lr_cmd -lr_util -lr_print -lr_flags -lr_asm -lr_lib -lr_debug -lr_hash -lr_bin -lr_lang -lr_io -lr_anal -lr_parse -lr_print -lr_bp -lr_egg -lr_reg -lr_search -lr_syscall -lr_sign -lr_diff -lr_socket -lr_fs -lmagic
Cflags: -I${includedir}/libr

View File

@ -7,5 +7,5 @@ Name: r_magic
Description: radare foundation libraries
Version: @VERSION@
Requires:
Libs: -L${libdir} -lr_magic -lr_util
Libs: -L${libdir} -lmagic -lr_util
Cflags: -I${includedir}/libr

View File

@ -19,3 +19,4 @@ r_lang
r_sign
r_print
r_fs
r_magic