When running from a distribution tarball, bison should not be necessary.
The generated files (QLParser.tab.cc, QLParser.tab.hh) should be distributed.
configure.ac should not abort if bison is missing.
configure.ac should remove temporary files (dummy.c, Simple.class).
bison must be run once to create QLParser.tab.cc and QLParser.tab.hh.
gprofng/ChangeLog
2023-10-03 Vladimir Mezentsev <vladimir.mezentsev@oracle.com>
PR gprofng/30894
* configure.ac: Don't abort if bison is missing. Remove temporary files.
* src/Makefile.am: Distribute QLParser.tab.cc and QLParser.tab.hh.
* Run bison once to create QLParser.tab.cc and QLParser.tab.hh.
* configure: Rebuild.
* src/Makefile.in: Rebuild.
fi
-if test x$BISON = "x:"; then
- as_fn_error $? "Building gprofng requires bison 3.0.4 or later." "$LINENO" 5
-fi
# Check whether --enable-shared was given.
if test "${enable_shared+set}" = set; then :
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 12255 "configure"
+#line 12252 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 12361 "configure"
+#line 12358 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
$as_echo "#define GPROFNG_JAVA_PROFILING 1" >>confdefs.h
if test "x$JAVAC" != x; then
- cat > configtest.java << EOF
+ cat > Simple.java << EOF
class Simple{
public static void main(String args){
System.out.println("Hello Java");
}
}
EOF
- if { ac_try='$JAVAC configtest.java >&5 2>&5'
+ if { ac_try='$JAVAC Simple.java >&5 2>&5'
{ { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
(eval $ac_try) 2>&5
ac_status=$?
else
GPROFNG_BROKEN_JAVAC=yes
fi
- rm -f configtest.*
+ rm -f Simple.*
fi
fi
$as_echo "#define __MUSL_LIBC 1" >>confdefs.h
fi
-
+rm -f dummy.c
# Check if linker supports --as-needed and --no-as-needed options.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking linker --as-needed support" >&5
AC_PROG_RANLIB
AM_PROG_AR
gl_PROG_BISON([BISON],[3.0.4])
-if test x$BISON = "x:"; then
- AC_MSG_ERROR([Building gprofng requires bison 3.0.4 or later.])
-fi
AC_DISABLE_SHARED
LT_INIT
else
AC_DEFINE(GPROFNG_JAVA_PROFILING, 1, [Enable java profiling])
if test "x$JAVAC" != x; then
- cat > configtest.java << EOF
+ cat > Simple.java << EOF
class Simple{
public static void main(String args[]){
System.out.println("Hello Java");
}
}
EOF
- if AC_TRY_COMMAND($JAVAC configtest.java >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD); then
+ if AC_TRY_COMMAND($JAVAC Simple.java >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD); then
GPROFNG_BROKEN_JAVAC=no
else
GPROFNG_BROKEN_JAVAC=yes
fi
- rm -f configtest.*
+ rm -f Simple.*
fi
fi
AC_SUBST(GPROFNG_BROKEN_JAVAC)
if test "$LIBC" = musl; then
AC_DEFINE(__MUSL_LIBC, 1, [Build with musl-libc.])
fi
-
+rm -f dummy.c
# Check if linker supports --as-needed and --no-as-needed options.
AC_CACHE_CHECK(linker --as-needed support, bfd_cv_ld_as_needed,
$(GPROFNG_NO_SWITCH_CFLAGS)
AM_CXXFLAGS = $(AM_CFLAGS)
-QLParser.tab.cc QLParser.tab.hh: QLParser.yy
+# bison generates two files QLParser.tab.cc, QLParser.tab.hh.
+# we don't know which file will be newer.
+# Make QLParser.tab.cc always newer than QLParser.tab.hh.
+QLParser.tab.hh: QLParser.yy
+ if test "$(BISON)" = ":"; then \
+ echo "fatal: Building gprofng requires bison 3.0.4 or later."; \
+ exit 1; \
+ fi; \
$(BISON) $^
-BUILT_SOURCES = QLParser.tab.hh
-EXTRA_DIST = QLParser.yy
+QLParser.tab.cc: QLParser.tab.hh
+ touch $@
+BUILT_SOURCES = QLParser.tab.cc QLParser.tab.hh
+EXTRA_DIST = QLParser.tab.cc QLParser.tab.hh QLParser.yy
+
+# info and diststuff are needed for src-release.sh:
+info: $(BUILT_SOURCES)
+diststuff: info
lib_LTLIBRARIES = $(LIBGPROFNG)
libgprofng_la_SOURCES = $(CCSOURCES) $(CSOURCES)
$(GPROFNG_NO_SWITCH_CFLAGS)
AM_CXXFLAGS = $(AM_CFLAGS)
-BUILT_SOURCES = QLParser.tab.hh
-EXTRA_DIST = QLParser.yy
+BUILT_SOURCES = QLParser.tab.cc QLParser.tab.hh
+EXTRA_DIST = QLParser.tab.cc QLParser.tab.hh QLParser.yy
lib_LTLIBRARIES = $(LIBGPROFNG)
libgprofng_la_SOURCES = $(CCSOURCES) $(CSOURCES)
libgprofng_la_LDFLAGS = -version-info 0:0:0
html-am:
-info: info-am
-
info-am:
install-data-am: install-dbeDATA
.PRECIOUS: Makefile
-QLParser.tab.cc QLParser.tab.hh: QLParser.yy
+# bison generates two files QLParser.tab.cc, QLParser.tab.hh.
+# we don't know which file will be newer.
+# Make QLParser.tab.cc always newer than QLParser.tab.hh.
+QLParser.tab.hh: QLParser.yy
+ if test "$(BISON)" = ":"; then \
+ echo "fatal: Building gprofng requires bison 3.0.4 or later."; \
+ exit 1; \
+ fi; \
$(BISON) $^
+QLParser.tab.cc: QLParser.tab.hh
+ touch $@
+
+# info and diststuff are needed for src-release.sh:
+info: $(BUILT_SOURCES)
+diststuff: info
+
# Distribution involves building the binaries to generate the manpage,
# so ensure that the necessary libraries are built at dist time.
dist-hook: $(LIBGPROFNG)