summaryrefslogtreecommitdiff
blob: 186c6d8d6229912fd58cd70243e3e58405b29c4c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
let the preprocessor work its magic rather than executing the code

https://bugs.gentoo.org/432120

--- a/Configure
+++ b/Configure
@@ -2730,20 +2730,17 @@ LOCKF_OWNER4
       rm -f ${LSOF_TMPC}.*
       cat > $LSOF_TMPC.c << .LSOF_END_HERE_DOC1
 #include <features.h>
-main() {
+#undef XXX
 #if defined(__GLIBC__) && defined(__GLIBC_MINOR__)
-printf("-DGLIBCV=%d\n",__GLIBC__*100+__GLIBC_MINOR__);
+XXX: __GLIBC__ * 100 + __GLIBC_MINOR__
 #elif defined(__GLIBC__)
-printf("-DGLIBCV=%d00\n",__GLIBC__);
-#else
-printf("\n");
+XXX: __GLIBC__ * 100
 #endif
-return(0); }
 .LSOF_END_HERE_DOC1
-      $LINUX_CONF_CC ${LSOF_TMPC}.c -I$LSOF_INCLUDE -o ${LSOF_TMPC}.x > /dev/null 2>&1
+      $LINUX_CONF_CC ${LSOF_TMPC}.c -E -I$LSOF_INCLUDE 2>/dev/null | sed -n '/^XXX:/s|.*:||p' > ${LSOF_TMPC}.x
-      if test -x ${LSOF_TMPC}.x	# {
+      if test -s ${LSOF_TMPC}.x	# {
       then
-	LINUX_CLIB=`${LSOF_TMPC}.x`
+	LINUX_CLIB="-DGLIBCV=$(( `cat ${LSOF_TMPC}.x` ))"
 	LSOF_TMP=$?
       else
 	LINUX_CLIB=""