Hello,

Here's my bug report, I'm building my software out of the source tree, this is 
called parallel build (very nice feature).
The way to reproduce the issue is very simple, set myprog_CXXFLAGS = -DANY and 
VPATH=@MYDIR@ and the corresponding Makefile won't find my source file. Replace 
myprog_CXXFLAGS by AM_CXXFLAGS and it works well.
Autoconf 2.69, automake 1.13.4

Autoconf.ac:

AC_PREREQ([2.69])
AC_INIT([myprog], [1.0], [julien.cour...@aqsacom.com])
AC_CONFIG_AUX_DIR([autotools_build])
AM_INIT_AUTOMAKE([1.13 -Wall -Werror foreign subdir-objects])
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_SRCDIR([src/DFluxMsgStdLib/Makefile.am])
AC_COPYRIGHT([[AQSACOM 2018]])
AC_CANONICAL_BUILD

# Checks for programs.
AC_PROG_CC([gcc])
AC_PROG_CXX([g++])
AC_LANG_CPLUSPLUS
m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
AM_SILENT_RULES([yes])
AM_PROG_CC_C_O([gcc])
AX_CXX_COMPILE_STDCXX_11([noext], [mandatory])
AC_CHECK_PROG([LSB_RELEASE],[lsb_release],yes)
LT_INIT()
MYPROG_ROOT_PATH=`cat $COMPONENTS | grep MYPROG_ROOT_PATH | awk -F '=' '{print 
$2}'`
DEV_HOME_PATH=`cat $COMPONENTS | grep DEV_HOME | awk -F '=' '{print $2}'`

# AC_SET_COMPONENT_VAR(FILE, PATTERN, TARGET])
# --------------------------------------------
m4_define([AC_SET_COMPONENT_VAR],
          [{ GREP_LINE=`cat $1 | grep $2`;
             AS_IF([test `echo $GREP_LINE | wc -w` = "3"],
                   AC_SUBST([$3], [$MYPROG_ROOT_PATH/$(echo $GREP_LINE | awk '{ 
print $[]1 }')-$(echo $GREP_LINE | awk '{ print $[]2 }')]),
                   AC_SUBST([$3], [$(echo $GREP_LINE | awk '{ print $[]1 
}')]));}])

AC_SET_COMPONENT_VAR([$COMPONENTS], [MYPROG_VAR], [MYPROG_PATH])
CFLAGS="$CFLAGS -pie -fPIE -D_FORTIFY_SOURCE=2 -fstack-protector-all -Wall 
-Werror -Wformat -Wformat-security"
CXXFLAGS="$CFLAGS $CXXFLAGS"
CPPFLAGS="$CPPFLAGS -D_REENTRANT $VER_LINUX -DPOSTGRESQL"
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_FILES([Makefile])
AC_OUTPUT

Makefile.am :
bin_PROGRAMS=myprog
myprog_SOURCES  = Main.cpp
myprog_CXXFLAGS = -DANY
AM_CPPFLAGS  = -I@MYPROG_PATH@
VPATH=@MYPROG_PATH@


I tried to set myprog_CXXFLAGS anywhere else in the file, but the issue is 
still the same. Same behavior applies to myprog_LDADD, myprog_CFLAGS and so on.
Hope my bug report is detailed enough.

Julien

Reply via email to