Skip to content
Tcl Source Code View Ticket
Login

View Ticket

CPPFLAGS is not properly supported

Closed / Fixed1586861fffffffffffffffffffffffffffffffffCreated 20 years agoUpdated 20 years ago
Descriptionplain2006-10-29 21:39:07
The Tcl configure script, when it processes a number of
actions during the configure process, uses CPPFLAGS to
test the compiler.  But when it comes to the actual
build process, this environment variable is totally
ignored.

The reason for needing this is to better support a
general application environment, and the integration of
Tcl libraries into that environment.  In these builds,
a clean separation is desired between CFLAGS (used only
for the C compiler), CXXFLAGS (used only for the C++
compiler), and CPPFLAGS (for settings in common between
the C and C++ compilers).

As an example of how this failure causes problems, on
the Solaris platform, the -D_POSIX_C_SOURCE=200112L
flag should be set in CFLAGS to conform to the rest of
the application build, and -D__EXTENSIONS__ flag should
be set in CPPFLAGS.  But with this combination of
environment variables, and -D__EXTENSIONS__ in CPPFLAGS
being ignored, the compilation of tclUnixChan.c
fails because certain symbols (such as TIOCMGET) from
<sys/termios.h> do not get defined.
dkf Ticket [1586861fff]: 1 change [History diff]2006-10-30 21:47:58
jenglish Ticket [1586861fff]: 1 change [History diff]2006-10-30 22:11:03
mmaslanoplain2007-01-02 23:29:28
Logged In: YES 
user_id=1580598
Originator: NO

I use this patch. Is it the solution or the problem remain?

--- tcl-8.4.13/tcl8.4.13/unix/tcl.m4.6-cflags   2006-07-20 15:11:19.000000000 -0400                                           
+++ tcl-8.4.13/tcl8.4.13/unix/tcl.m4    2006-07-20 15:12:40.000000000 -0400                                                   
@@ -1340,7 +1340,7 @@                                                                                                         
            #CFLAGS_OPTIMIZE="${CFLAGS_OPTIMIZE} -D__NO_STRING_INLINES -D__NO_MATH_INLINES"                                   
                                                                                                                              
            if test "$have_dl" = yes; then                                                                                    
-               SHLIB_LD='${CC} -shared -Wl,-soname,${@}'                                                                     
+               SHLIB_LD='${CC} ${CFLAGS} -shared -Wl,-soname,${@}'                                                           
                DL_OBJS="tclLoadDl.o"                                                                                         
                DL_LIBS="-ldl"                                                                                                
                LDFLAGS="$LDFLAGS -Wl,--export-dynamic"                                                                       
--- tcl-8.4.13/tk8.4.13/unix/tcl.m4.6-cflags    2006-04-19 08:29:38.000000000 -0400                                           
+++ tcl-8.4.13/tk8.4.13/unix/tcl.m4     2006-07-20 15:13:04.000000000 -0400                                                   
@@ -1340,7 +1340,7 @@                                                                                                         
            #CFLAGS_OPTIMIZE="${CFLAGS_OPTIMIZE} -D__NO_STRING_INLINES -D__NO_MATH_INLINES"                                   
                                                                                                                              
            if test "$have_dl" = yes; then                                                                                    
-               SHLIB_LD="${CC} -shared"                                                                                      
+               SHLIB_LD="${CC} ${CFLAGS} -shared"                                                                            
                DL_OBJS="tclLoadDl.o"                                                                                         
                DL_LIBS="-ldl"                                                                                                
                LDFLAGS="$LDFLAGS -Wl,--export-dynamic"
dasplain2007-01-19 08:15:30
Logged In: YES 
user_id=90580
Originator: NO

fixed in HEAD, core-8-4-branch and tclconfig
if set,  the CPPFLAGS env var is now included in CFLAGS by tcl.m4
Log in (anonymous is fine) to add a comment.