Description of problem: using $RPM_OPT_FLAGS, can't build emacs cvs CFLAGS=-DMAIL_USE_LOCKF -O2 -Wall -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -m32 -march=athlon $rpmbuild -ba --target=athlon emacs.spec [...] gcc -D_BSD_SOURCE -DHAVE_CONFIG_H -I. -I../src -I/usr/src/redhat/BUILD/emacs-22.0.50/lib-src -I/usr/src/redhat/BUILD/emacs-22.0.50/lib-src/../src -Wl,-znocombreloc -L/usr/X11R6/lib -D_BSD_SOURCE -DMAIL_USE_LOCKF -O2 -Wall -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -m32 -march=athlon /usr/src/redhat/BUILD/emacs-22.0.50/lib-src/emacsclient.c getopt.o getopt1.o -DVERSION="\"22.0.50\"" -lc -o emacsclient /usr/src/redhat/BUILD/emacs-22.0.50/lib-src/emacsclient.c:45:15: error: macro "getcwd" requires 2 arguments, but only 1 given /usr/src/redhat/BUILD/emacs-22.0.50/lib-src/emacsclient.c:45: error: 'getcwd' redeclared as different kind of symbol /usr/include/unistd.h:449: error: previous declaration of 'getcwd' was here /usr/src/redhat/BUILD/emacs-22.0.50/lib-src/emacsclient.c: In function 'main': /usr/src/redhat/BUILD/emacs-22.0.50/lib-src/emacsclient.c:458: error: called object 'getcwd' is not a function make[1]: *** [emacsclient] Error 1 make[1]: Leaving directory `/usr/src/redhat/BUILD/emacs-22.0.50/lib-src' make: *** [lib-src] Error 2 But in emacs-22.0.50/lib-src/Makefile Changed to CFLAGS=-O2 -g (like to make bootstrap) no errors Version-Release number of selected component (if applicable): gcc-4.0.0-0.34 How reproducible: always Steps to Reproduce: 1. 2. 3. Actual results: Expected results: Additional info: glibc-2.3.4-14, emacs cvs 20050317
The same problem happens in emacs-21.3-25.src.rpm, too.
That's a bug in emacs. POSIX allows getcwd (actually, most of its functions) to be also defined as function-like macros. If emacs wants to use getcwd for something else, it should either #undef getcwd first or prevent its expansion as function-like macro (e.g. using (getcwd) (...) instead of getcwd (...)).