bug-autoconf
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

CFLAGS and CPPFLAGS Fails When Defining String Symbols with -D


From: imacat
Subject: CFLAGS and CPPFLAGS Fails When Defining String Symbols with -D
Date: Sun, 18 May 2003 13:28:23 +0800

Dear all,

    I think someone has reported this before (2002-08-14, by Harlan
Stenn), but I did not see any response.  I know this might not be an
easy problem, but I still post it here, since it indeed does not work.

    autoconf does not handle the CFLAGS and CPPFLAGS well when defining
string symbols with -D.  The following illustrate the failure when
running with my attached test package:

===================================
address@hidden src/test % export 'CFLAGS=-DDEFSOURCE=\"CFLAGS\"'
address@hidden src/test % echo $CFLAGS
-DDEFSOURCE=\"CFLAGS\"
address@hidden src/test % ./configure
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking for gcc... gcc
checking for C compiler default output... configure: error: C compiler cannot 
create executables
See `config.log' for more details.
address@hidden src/test % make test
cc -DDEFSOURCE=\"CFLAGS\"    test.c   -o test
address@hidden src/test % ./test
DEFSOURCE obtained from CFLAGS
Done. 0 seconds elapsed.
address@hidden src/test % export 'CFLAGS=-DDEFSOURCE="CFLAGS"'
address@hidden src/test % echo $CFLAGS
-DDEFSOURCE="CFLAGS"
address@hidden src/test % ./configure
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking for gcc... gcc
checking for C compiler default output... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ANSI C... none needed
checking for style of include used by make... GNU
checking dependency style of gcc... gcc3
configure: creating ./config.status
config.status: creating Makefile
config.status: creating config.h
config.status: executing depfiles commands
address@hidden src/test % make
make  all-am
make[1]: Entering directory `/home/imacat/src/test'
if gcc -DHAVE_CONFIG_H -I. -I. -I.     -DDEFSOURCE="CFLAGS" -MT test.o -MD -MP 
-MF ".deps/test.Tpo" \
  -c -o test.o `test -f 'test.c' || echo './'`test.c; \
then mv -f ".deps/test.Tpo" ".deps/test.Po"; \
else rm -f ".deps/test.Tpo"; exit 1; \
fi
test.c: In function `main':
test.c:18: `CFLAGS' undeclared (first use in this function)
test.c:18: (Each undeclared identifier is reported only once
test.c:18: for each function it appears in.)
make[1]: *** [test.o] Error 1
make[1]: Leaving directory `/home/imacat/src/test'
make: *** [all] Error 2
address@hidden src/test %
===================================

    make requires the CFLAGS formated as

      export 'CFLAGS=-DDEFSOURCE=\"CFLAGS\"'

    But autoconf can't handle it.  autoconf requires CFLAGS formated as

      export 'CFLAGS=-DDEFSOURCE="CFLAGS"'

    But this violate the practice of make.

    Attached is the testing package I used to generate the above result. 
I'm testing with autoconf 2.57, GNU Make 3.79.1, automake 1.74, gcc 3.3,
glibc 2.3.2, linux kernel 2.4.20, Intel Pentium III 800MHz, 896MB RAM,
20GB HD.  Sorry I did not test it with the CVS version, as suggested by
you.  I'm not good at CVS.

--
Best regards,
imacat ^_*' <address@hidden>
PGP Key: http://www.imacat.idv.tw/me/pgpkey.txt

<<Woman's Voice>> News: http://www.wov.idv.tw/
Tavern IMACAT's: http://www.imacat.idv.tw/
TLUG List Manager: http://www.linux.org.tw/mailman/listinfo/tlug

Attachment: test-0.0.1.tar.gz
Description: Binary data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]