1. Remove gmon.out first before generating it in the configure check.
2. Make tst-gmon-gprof.out depend on the gprof binary.
3. Check that gmon.out is non-empty.
4. Don't include <sys/cdefs.h> in tst-gmon.c.
PR gprof/32764
* configure.ac: Remove gmon.out first.
* configure: Regenerated.
* testsuite/Makefile.am (tst-gmon-gprof.out): Depend on
$(GPROF).
* testsuite/Makefile.in: Regenerated.
* testsuite/tst-gmon-gprof.sh: Check that gmon.out is non-empty.
* testsuite/tst-gmon.c: Don't include <sys/cdefs.h>.
Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
gprof_cv_sys_native=no
if test x"${host}" = x"${target}" \
&& ${CC-cc} -O2 -pg -o tst-gmon $srcdir/testsuite/tst-gmon.c; then
+ rm -f gmon.out
./tst-gmon
if test -s gmon.out; then
gprof_cv_sys_native=yes
gprof_cv_sys_native=no
if test x"${host}" = x"${target}" \
&& ${CC-cc} -O2 -pg -o tst-gmon $srcdir/testsuite/tst-gmon.c; then
+ rm -f gmon.out
./tst-gmon
if test -s gmon.out; then
gprof_cv_sys_native=yes
$(COMPILE) -c -o $@ $<
tst-gmon: tst-gmon.$(OBJEXT)
$(LINK) tst-gmon.$(OBJEXT)
-tst-gmon-gprof.out: tst-gmon$(EXEEXT)
+tst-gmon-gprof.out: tst-gmon$(EXEEXT) $(GPROF)
$(srcdir)/tst-gmon-gprof.sh $(GPROF) tst-gmon$(EXEEXT)
endif NATIVE
@NATIVE_TRUE@ $(COMPILE) -c -o $@ $<
@NATIVE_TRUE@tst-gmon: tst-gmon.$(OBJEXT)
@NATIVE_TRUE@ $(LINK) tst-gmon.$(OBJEXT)
-@NATIVE_TRUE@tst-gmon-gprof.out: tst-gmon$(EXEEXT)
+@NATIVE_TRUE@tst-gmon-gprof.out: tst-gmon$(EXEEXT) $(GPROF)
@NATIVE_TRUE@ $(srcdir)/tst-gmon-gprof.sh $(GPROF) tst-gmon$(EXEEXT)
# Tell versions [3.59,3.63) of GNU make to not export all variables.
data=gmon.out
rm -f $data
./$program
-if test ! -f $data; then
+if test ! -s $data; then
echo "FAIL"
exit 1
fi
License along with the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */
-#include <sys/cdefs.h>
-
/* This program does not use the test harness because we want tight
control over the call graph. */