build: Backport misc autoconf/pkgconf improvements
This commit is contained in:
parent
c1860c8d80
commit
a795dc1972
1
.gitignore
vendored
1
.gitignore
vendored
@ -30,6 +30,7 @@
|
|||||||
/configure
|
/configure
|
||||||
/configure.ac.save
|
/configure.ac.save
|
||||||
/build-aux
|
/build-aux
|
||||||
|
/aclocal.m4
|
||||||
/*~
|
/*~
|
||||||
/config.status
|
/config.status
|
||||||
/config.log
|
/config.log
|
||||||
|
@ -72,15 +72,18 @@ export AWK
|
|||||||
|
|
||||||
override DEFAULT_CPPFLAGS := @CPPFLAGS@
|
override DEFAULT_CPPFLAGS := @CPPFLAGS@
|
||||||
$(eval $(call DEFAULT_VAR,CPPFLAGS,$(DEFAULT_CPPFLAGS)))
|
$(eval $(call DEFAULT_VAR,CPPFLAGS,$(DEFAULT_CPPFLAGS)))
|
||||||
|
override CPPFLAGS := @PKGCONF_CPPFLAGS@ $(CPPFLAGS)
|
||||||
export CPPFLAGS
|
export CPPFLAGS
|
||||||
override DEFAULT_CFLAGS := @CFLAGS@
|
override DEFAULT_CFLAGS := @CFLAGS@
|
||||||
$(eval $(call DEFAULT_VAR,CFLAGS,$(DEFAULT_CFLAGS)))
|
$(eval $(call DEFAULT_VAR,CFLAGS,$(DEFAULT_CFLAGS)))
|
||||||
|
override CFLAGS += @PKGCONF_CFLAGS@
|
||||||
export CFLAGS
|
export CFLAGS
|
||||||
override DEFAULT_LDFLAGS := @LDFLAGS@
|
override DEFAULT_LDFLAGS := @LDFLAGS@
|
||||||
$(eval $(call DEFAULT_VAR,LDFLAGS,$(DEFAULT_LDFLAGS)))
|
$(eval $(call DEFAULT_VAR,LDFLAGS,$(DEFAULT_LDFLAGS)))
|
||||||
export LDFLAGS
|
export LDFLAGS
|
||||||
override DEFAULT_LIBS := @LIBS@
|
override DEFAULT_LIBS := @LIBS@
|
||||||
$(eval $(call DEFAULT_VAR,LIBS,$(DEFAULT_LIBS)))
|
$(eval $(call DEFAULT_VAR,LIBS,$(DEFAULT_LIBS)))
|
||||||
|
override LIBS += @PKGCONF_LIBS@
|
||||||
export LIBS
|
export LIBS
|
||||||
|
|
||||||
override WERROR_FLAG := @WERROR_FLAG@
|
override WERROR_FLAG := @WERROR_FLAG@
|
||||||
@ -322,7 +325,7 @@ distclean: clean
|
|||||||
|
|
||||||
.PHONY: maintainer-clean
|
.PHONY: maintainer-clean
|
||||||
maintainer-clean: distclean
|
maintainer-clean: distclean
|
||||||
cd '$(call SHESCAPE,$(SRCDIR))' && rm -rf common/flanterm common/stb/stb_image.h decompressor/tinf freestanding-headers libgcc-binaries limine-efi freestanding-toolchain configure build-aux *'~' autom4te.cache *.tar.xz *.tar.gz
|
cd '$(call SHESCAPE,$(SRCDIR))' && rm -rf common/flanterm common/stb/stb_image.h decompressor/tinf freestanding-headers libgcc-binaries limine-efi freestanding-toolchain configure build-aux *'~' autom4te.cache aclocal.m4 *.tar.xz *.tar.gz
|
||||||
|
|
||||||
.PHONY: common-uefi-x86-64
|
.PHONY: common-uefi-x86-64
|
||||||
common-uefi-x86-64:
|
common-uefi-x86-64:
|
||||||
|
50
configure.ac
50
configure.ac
@ -51,28 +51,60 @@ if ! test "x$FIND_FOUND" = "xyes"; then
|
|||||||
AC_MSG_ERROR([find not found, please install find before configuring])
|
AC_MSG_ERROR([find not found, please install find before configuring])
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
AC_ARG_VAR([STRIP], [strip command])
|
||||||
|
|
||||||
|
if ! test -z "$STRIP"; then
|
||||||
|
AC_CHECK_PROG([STRIP_USER_FOUND], [$STRIP], [yes])
|
||||||
|
if ! test "x$STRIP_USER_FOUND" = "xyes"; then
|
||||||
|
AC_MSG_ERROR([$STRIP not found, please install $STRIP before configuring])
|
||||||
|
fi
|
||||||
|
else
|
||||||
STRIP="$($CC -dumpmachine)"-strip
|
STRIP="$($CC -dumpmachine)"-strip
|
||||||
AC_CHECK_PROG([STRIP_FOUND], [$STRIP], [yes])
|
AC_CHECK_PROG([STRIP_FOUND], [$STRIP], [yes])
|
||||||
if ! test "x$STRIP_FOUND" = "xyes"; then
|
if ! test "x$STRIP_FOUND" = "xyes"; then
|
||||||
STRIP=strip
|
STRIP=strip
|
||||||
|
AC_CHECK_PROG([STRIP_DEFAULT_FOUND], [$STRIP], [yes])
|
||||||
|
if ! test "x$STRIP_DEFAULT_FOUND" = "xyes"; then
|
||||||
|
AC_MSG_ERROR([$STRIP not found, please install $STRIP before configuring])
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
AC_SUBST([STRIP])
|
AC_SUBST([STRIP])
|
||||||
|
|
||||||
PKGCONFIG="$($CC -dumpmachine)"-pkg-config
|
PKGCONF_LIBS_LIST=""
|
||||||
AC_CHECK_PROG([PKGCONFIG_FOUND], [$PKGCONFIG], [yes])
|
|
||||||
if ! test "x$PKGCONFIG_FOUND" = "xyes"; then
|
|
||||||
PKGCONFIG=pkg-config
|
|
||||||
fi
|
|
||||||
|
|
||||||
PKGCONFIG_LIBS=""
|
PKG_PROG_PKG_CONFIG
|
||||||
|
|
||||||
CFLAGS="$CFLAGS $($PKGCONFIG --cflags-only-other $PKGCONFIG_LIBS 2>/dev/null)"
|
for lib in $PKGCONF_LIBS_LIST; do
|
||||||
CPPFLAGS="$($PKGCONFIG --cflags-only-I $PKGCONFIG_LIBS 2>/dev/null) $CPPFLAGS"
|
set -e
|
||||||
LIBS="$LIBS $($PKGCONFIG --libs $PKGCONFIG_LIBS 2>/dev/null)"
|
$PKG_CONFIG --exists --print-errors "$lib"
|
||||||
|
set +e
|
||||||
|
done
|
||||||
|
|
||||||
|
PKGCONF_CFLAGS="$($PKG_CONFIG --cflags-only-other $PKGCONF_LIBS_LIST 2>/dev/null)"
|
||||||
|
PKGCONF_CPPFLAGS="$($PKG_CONFIG --cflags-only-I $PKGCONF_LIBS_LIST 2>/dev/null)"
|
||||||
|
PKGCONF_LIBS="$($PKG_CONFIG --libs $PKGCONF_LIBS_LIST 2>/dev/null)"
|
||||||
|
|
||||||
|
AC_SUBST([PKGCONF_CFLAGS])
|
||||||
|
AC_SUBST([PKGCONF_CPPFLAGS])
|
||||||
|
AC_SUBST([PKGCONF_LIBS])
|
||||||
|
|
||||||
|
OLD_CFLAGS="$CFLAGS"
|
||||||
|
OLD_CPPFLAGS="$CPPFLAGS"
|
||||||
|
OLD_LIBS="$LIBS"
|
||||||
|
|
||||||
|
CFLAGS="$CFLAGS $PKGCONF_CFLAGS"
|
||||||
|
CPPFLAGS="$PKGCONF_CPPFLAGS $CPPFLAGS"
|
||||||
|
LIBS="$LIBS $PKGCONF_LIBS"
|
||||||
|
|
||||||
AC_CHECK_HEADERS([stdint.h stddef.h stdbool.h limits.h inttypes.h stdio.h stdlib.h string.h],
|
AC_CHECK_HEADERS([stdint.h stddef.h stdbool.h limits.h inttypes.h stdio.h stdlib.h string.h],
|
||||||
[], [AC_MSG_ERROR([required header not found])])
|
[], [AC_MSG_ERROR([required header not found])])
|
||||||
|
|
||||||
|
CFLAGS="$OLD_CFLAGS"
|
||||||
|
CPPFLAGS="$OLD_CPPFLAGS"
|
||||||
|
LIBS="$OLD_LIBS"
|
||||||
|
|
||||||
AC_ARG_VAR([TOOLCHAIN_FOR_TARGET], [alternative toolchain prefix for Limine (or 'llvm', or 'gnu')])
|
AC_ARG_VAR([TOOLCHAIN_FOR_TARGET], [alternative toolchain prefix for Limine (or 'llvm', or 'gnu')])
|
||||||
AC_ARG_VAR([CC_FOR_TARGET], [C compiler command for Limine])
|
AC_ARG_VAR([CC_FOR_TARGET], [C compiler command for Limine])
|
||||||
AC_ARG_VAR([LD_FOR_TARGET], [linker command for Limine])
|
AC_ARG_VAR([LD_FOR_TARGET], [linker command for Limine])
|
||||||
|
Loading…
Reference in New Issue
Block a user