Make configure detect required libraries to link.
This commit is contained in:
parent
57af8f9ee0
commit
33c1a33912
87
configure
vendored
87
configure
vendored
@ -188,32 +188,6 @@ linux)
|
|||||||
esac
|
esac
|
||||||
|
|
||||||
|
|
||||||
#
|
|
||||||
# Check if external proplib should be used instead.
|
|
||||||
#
|
|
||||||
if [ -z "$EXTERNAL_PROPLIB" ]; then
|
|
||||||
EXTERNAL_PROPLIB_VALUE=no
|
|
||||||
echo "CPPFLAGS += -I\$(TOPDIR)/lib/portableproplib" >>$CONFIG_MK
|
|
||||||
else
|
|
||||||
EXTERNAL_PROPLIB_VALUE=yes
|
|
||||||
echo "USE_EXTERNAL_PROPLIB = 1" >>$CONFIG_MK
|
|
||||||
echo "LDFLAGS += -lprop" >>$CONFIG_MK
|
|
||||||
echo "STATIC_PROPLIB = -lprop" >> $CONFIG_MK
|
|
||||||
fi
|
|
||||||
|
|
||||||
#
|
|
||||||
# Check if external libfetch should be used.
|
|
||||||
#
|
|
||||||
if [ -z "$EXTERNAL_LIBFETCH" ]; then
|
|
||||||
EXTERNAL_LIBFETCH_VALUE=no
|
|
||||||
echo "CPPFLAGS += -I\$(TOPDIR)/lib/fetch" >>$CONFIG_MK
|
|
||||||
else
|
|
||||||
EXTERNAL_LIBFETCH_VALUE=yes
|
|
||||||
echo "USE_EXTERNAL_LIBFETCH = 1" >>$CONFIG_MK
|
|
||||||
echo "LDFLAGS += -lfetch" >>$CONFIG_MK
|
|
||||||
echo "STATIC_FETCH = -lfetch" >>$CONFIG_MK
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Add CPPFLAGS and CFLAGS to CC for testing features
|
# Add CPPFLAGS and CFLAGS to CC for testing features
|
||||||
XCC="$CC `$SED -n -e 's/CPPLAGS+=*\(.*\)/\1/p' $CONFIG_MK`"
|
XCC="$CC `$SED -n -e 's/CPPLAGS+=*\(.*\)/\1/p' $CONFIG_MK`"
|
||||||
XCC="$XCC `$SED -n -e 's/CFLAGS+=*\(.*\)/\1/p' $CONFIG_MK`"
|
XCC="$XCC `$SED -n -e 's/CFLAGS+=*\(.*\)/\1/p' $CONFIG_MK`"
|
||||||
@ -236,7 +210,7 @@ int main(void) { return 0; }
|
|||||||
EOF
|
EOF
|
||||||
if $XCC -${mode}${flag} _ccflag.c -o _ccflag 2>_ccflag.err; then
|
if $XCC -${mode}${flag} _ccflag.c -o _ccflag 2>_ccflag.err; then
|
||||||
if ! test -s _ccflag.err; then
|
if ! test -s _ccflag.err; then
|
||||||
if [ "$mode" = "W" ]; then
|
if [ "$mode" = "W" -a -z "$var" ]; then
|
||||||
echo "CPPFLAGS += -${mode}${flag}" >>$CONFIG_MK
|
echo "CPPFLAGS += -${mode}${flag}" >>$CONFIG_MK
|
||||||
else
|
else
|
||||||
echo "$var += -${mode}${flag}" >>$CONFIG_MK
|
echo "$var += -${mode}${flag}" >>$CONFIG_MK
|
||||||
@ -260,7 +234,7 @@ EOF
|
|||||||
for f in all extra error shadow "format=2" missing-prototypes \
|
for f in all extra error shadow "format=2" missing-prototypes \
|
||||||
missing-declarations nested-externs \
|
missing-declarations nested-externs \
|
||||||
cast-align cast-qual pointer-arith comment unused-macros \
|
cast-align cast-qual pointer-arith comment unused-macros \
|
||||||
declaration-after-statement stack-protector "l,--as-needed"; do
|
declaration-after-statement stack-protector; do
|
||||||
check_compiler_flag ${f} W
|
check_compiler_flag ${f} W
|
||||||
done
|
done
|
||||||
|
|
||||||
@ -281,6 +255,7 @@ if [ $? -eq 0 ]; then
|
|||||||
fi
|
fi
|
||||||
check_compiler_flag "visibility=default" f SHAREDLIB_CFLAGS
|
check_compiler_flag "visibility=default" f SHAREDLIB_CFLAGS
|
||||||
check_compiler_flag "std=c99"
|
check_compiler_flag "std=c99"
|
||||||
|
check_compiler_flag "l,--as-needed" W LDFLAGS
|
||||||
|
|
||||||
#
|
#
|
||||||
# Check if -fPIE and -pie are supported if --build-pie is set.
|
# Check if -fPIE and -pie are supported if --build-pie is set.
|
||||||
@ -386,29 +361,58 @@ fi
|
|||||||
#
|
#
|
||||||
# zlib with pkg-config support is required.
|
# zlib with pkg-config support is required.
|
||||||
#
|
#
|
||||||
printf "Checking for zlib via pkg-config ..."
|
printf "Checking for zlib via pkg-config ... "
|
||||||
if ! $PKGCONFIG_BIN --exists zlib; then
|
if ! $PKGCONFIG_BIN --exists zlib; then
|
||||||
echo "zlib.pc file not found, exiting."
|
echo "zlib.pc file not found, exiting."
|
||||||
exit 1
|
exit 1
|
||||||
else
|
else
|
||||||
echo "found version $($PKGCONFIG_BIN --modversion zlib)."
|
echo "found version $($PKGCONFIG_BIN --modversion zlib)."
|
||||||
|
echo "CFLAGS += $($PKGCONFIG_BIN --cflags zlib)" >>$CONFIG_MK
|
||||||
|
echo "LDFLAGS += $($PKGCONFIG_BIN --libs zlib)" >>$CONFIG_MK
|
||||||
|
echo "STATIC_LIBS = $($PKGCONFIG_BIN --libs --static zlib)" \
|
||||||
|
>>$CONFIG_MK
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "STATIC_LIBS = -lz \$(STATIC_PROPLIB) \$(STATIC_FETCH) -lpthread" >>$CONFIG_MK
|
#
|
||||||
|
# Check if external proplib via pkg-config should be used instead.
|
||||||
|
#
|
||||||
|
if [ -z "$EXTERNAL_PROPLIB" ]; then
|
||||||
|
EXTERNAL_PROPLIB_VALUE=no
|
||||||
|
echo "CPPFLAGS += -I\$(TOPDIR)/lib/portableproplib" >>$CONFIG_MK
|
||||||
|
echo "LDFLAGS += -lpthread" >>$CONFIG_MK
|
||||||
|
echo "STATIC_LIBS += -lpthread" >>$CONFIG_MK
|
||||||
|
else
|
||||||
|
EXTERNAL_PROPLIB_VALUE=yes
|
||||||
|
echo "USE_EXTERNAL_PROPLIB = 1" >>$CONFIG_MK
|
||||||
|
printf "Checking for proplib via pkg-config ... "
|
||||||
|
if ! $PKGCONFIG_BIN --exists proplib; then
|
||||||
|
echo "proplib.pc file not found, exiting."
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
echo "found version $($PKGCONFIG_BIN --modversion proplib)."
|
||||||
|
echo "CFLAGS += $($PKGCONFIG_BIN --cflags proplib)" >>$CONFIG_MK
|
||||||
|
echo "LDFLAGS += $($PKGCONFIG_BIN --libs proplib)" \
|
||||||
|
>>$CONFIG_MK
|
||||||
|
echo "STATIC_LIBS += $($PKGCONFIG_BIN --libs --static proplib)" \
|
||||||
|
>>$CONFIG_MK
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
#
|
#
|
||||||
# OpenSSL libssl with pkg-config support is required.
|
# OpenSSL libssl with pkg-config support is required.
|
||||||
#
|
#
|
||||||
printf "Checking for OpenSSL via pkg-config ..."
|
printf "Checking for OpenSSL via pkg-config ... "
|
||||||
if ! $PKGCONFIG_BIN --exists libssl; then
|
if ! $PKGCONFIG_BIN --exists libssl; then
|
||||||
echo "libssl.pc file not found, exiting."
|
echo "libssl.pc file not found, exiting."
|
||||||
exit 1
|
exit 1
|
||||||
else
|
else
|
||||||
echo "found version $($PKGCONFIG_BIN --modversion libssl)."
|
echo "found version $($PKGCONFIG_BIN --modversion libssl)."
|
||||||
|
echo "CFLAGS += $($PKGCONFIG_BIN --cflags libssl)" >>$CONFIG_MK
|
||||||
|
echo "LDFLAGS += $($PKGCONFIG_BIN --libs libssl)" >>$CONFIG_MK
|
||||||
|
echo "STATIC_LIBS += $($PKGCONFIG_BIN --libs --static libssl)" \
|
||||||
|
>>$CONFIG_MK
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "STATIC_LIBS += $($PKGCONFIG_BIN --libs --static libssl)" >>$CONFIG_MK
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# libarchive >= 2.8.0 with pkg-config support is required.
|
# libarchive >= 2.8.0 with pkg-config support is required.
|
||||||
#
|
#
|
||||||
@ -418,9 +422,24 @@ if ! $PKGCONFIG_BIN --exists libarchive; then
|
|||||||
exit 1
|
exit 1
|
||||||
else
|
else
|
||||||
echo "found version $($PKGCONFIG_BIN --modversion libarchive)."
|
echo "found version $($PKGCONFIG_BIN --modversion libarchive)."
|
||||||
|
echo "CFLAGS += $($PKGCONFIG_BIN --cflags libarchive)" >>$CONFIG_MK
|
||||||
|
echo "LDFLAGS += $($PKGCONFIG_BIN --libs libarchive)" >>$CONFIG_MK
|
||||||
|
echo "STATIC_LIBS += $($PKGCONFIG_BIN --libs --static libarchive)" \
|
||||||
|
>>$CONFIG_MK
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "STATIC_LIBS += $($PKGCONFIG_BIN --libs --static libarchive)" >>$CONFIG_MK
|
#
|
||||||
|
# Check if external libfetch should be used.
|
||||||
|
#
|
||||||
|
if [ -z "$EXTERNAL_LIBFETCH" ]; then
|
||||||
|
EXTERNAL_LIBFETCH_VALUE=no
|
||||||
|
echo "CPPFLAGS += -I\$(TOPDIR)/lib/fetch" >>$CONFIG_MK
|
||||||
|
else
|
||||||
|
EXTERNAL_LIBFETCH_VALUE=yes
|
||||||
|
echo "USE_EXTERNAL_LIBFETCH = 1" >>$CONFIG_MK
|
||||||
|
echo "LDFLAGS += -lfetch" >>$CONFIG_MK
|
||||||
|
echo "STATIC_LIBS += -lfetch" >>$CONFIG_MK
|
||||||
|
fi
|
||||||
|
|
||||||
echo
|
echo
|
||||||
echo " XBPS has been configured with the following options:"
|
echo " XBPS has been configured with the following options:"
|
||||||
|
@ -4,7 +4,6 @@ LIBXBPS_MAJOR = 0
|
|||||||
LIBXBPS_MINOR = 0
|
LIBXBPS_MINOR = 0
|
||||||
LIBXBPS_MICRO = 0
|
LIBXBPS_MICRO = 0
|
||||||
LIBXBPS_SHLIB = libxbps.so.$(LIBXBPS_MAJOR).$(LIBXBPS_MINOR).$(LIBXBPS_MICRO)
|
LIBXBPS_SHLIB = libxbps.so.$(LIBXBPS_MAJOR).$(LIBXBPS_MINOR).$(LIBXBPS_MICRO)
|
||||||
LDFLAGS += -lpthread -larchive -lssl -lz
|
|
||||||
LDFLAGS += -shared -Wl,-soname,libxbps.so.$(LIBXBPS_MAJOR)
|
LDFLAGS += -shared -Wl,-soname,libxbps.so.$(LIBXBPS_MAJOR)
|
||||||
|
|
||||||
# portableproplib
|
# portableproplib
|
||||||
@ -19,7 +18,6 @@ LIBPROP_CFLAGS = -Wno-cast-qual -Wno-unused-parameter
|
|||||||
|
|
||||||
ifdef USE_EXTERNAL_PROPLIB
|
ifdef USE_EXTERNAL_PROPLIB
|
||||||
LIBPROP_OBJS =
|
LIBPROP_OBJS =
|
||||||
LDFLAGS += -lprop
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# libfetch
|
# libfetch
|
||||||
@ -33,7 +31,6 @@ LIBFETCH_GEN = fetch/ftperr.h fetch/httperr.h
|
|||||||
|
|
||||||
ifdef USE_EXTERNAL_LIBFETCH
|
ifdef USE_EXTERNAL_LIBFETCH
|
||||||
LIBFETCH_OBJS =
|
LIBFETCH_OBJS =
|
||||||
LDFLAGS += -lfetch
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# libxbps
|
# libxbps
|
||||||
|
3
prog.mk
3
prog.mk
@ -36,8 +36,7 @@ endif
|
|||||||
|
|
||||||
$(BIN).static: $(OBJS)
|
$(BIN).static: $(OBJS)
|
||||||
@printf " [CCLD]\t\t$@\n"
|
@printf " [CCLD]\t\t$@\n"
|
||||||
@$(CC) -static $^ $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) \
|
@$(CC) -static $^ $(CPPFLAGS) $(CFLAGS) -lxbps $(STATIC_LIBS) -o $@
|
||||||
$(STATIC_LIBS) -o $@
|
|
||||||
|
|
||||||
$(BIN): $(OBJS)
|
$(BIN): $(OBJS)
|
||||||
@printf " [CCLD]\t\t$@\n"
|
@printf " [CCLD]\t\t$@\n"
|
||||||
|
Loading…
Reference in New Issue
Block a user