32 lines
1.0 KiB
Diff
32 lines
1.0 KiB
Diff
We'll need to run the compiled binary to report our current version.
|
|
|
|
With the same code base, we should have the same version information
|
|
regardless of compiler and architecture.
|
|
|
|
Let's use the compiler for building architecture to build the reporting
|
|
binary. Which is usually reported under variable CC_FOR_BUILD,
|
|
a convention established by GNU Autotools, and fall back to CC if it's
|
|
not defined.
|
|
--- a/configure
|
|
+++ b/configure
|
|
@@ -89,8 +89,10 @@ fi
|
|
BASHCMD=${BASHCMD:-bash}
|
|
PERL=${PERL:-perl}
|
|
CC=${CC:-cc}
|
|
+CC_FOR_BUILD=${CC_FOR_BUILD:-$CC}
|
|
CXX=${CXX:-c++}
|
|
CFLAGS=${CFLAGS:--g -O2}
|
|
+CFLAGS_FOR_BUILD=${CFLAGS_FOR_BUILD:-$CFLAGS}
|
|
CPPFLAGS=${CPPFLAGS:-}
|
|
CXXFLAGS_for_sh=${CXXFLAGS:-${CFLAGS}}
|
|
CXXFLAGS=${CXXFLAGS:-\$(CFLAGS)}
|
|
@@ -448,7 +450,7 @@ int main(void) {
|
|
return 0;
|
|
}
|
|
EOF
|
|
-if ${CC} ${CFLAGS} -I"$srcdir" _libversion.c -o _libversion > /dev/null 2>&1 \
|
|
+if ${CC_FOR_BUILD} ${CFLAGS_FOR_BUILD} -I"$srcdir" _libversion.c -o _libversion > /dev/null 2>&1 \
|
|
&& ./_libversion > _libversion.sh && . ./_libversion.sh
|
|
then
|
|
printf "OK.\n"
|