gcc options and mingw: move a gcc options detection from a makefile to the configure
+ define XCC and XAR if mingw32 defined
    + use XCC and XAR in lib/Makefile if defined
    Try "./configure --enable-mingw32; make". This must work
			
			
This commit is contained in:
		
							parent
							
								
									76af948623
								
							
						
					
					
						commit
						48d12e42ad
					
				
					 3 changed files with 20 additions and 18 deletions
				
			
		
							
								
								
									
										14
									
								
								Makefile
									
										
									
									
									
								
							
							
						
						
									
										14
									
								
								Makefile
									
										
									
									
									
								
							| 
						 | 
					@ -8,19 +8,7 @@ VPATH = $(top_srcdir)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
CPPFLAGS += -I$(TOP) # for config.h
 | 
					CPPFLAGS += -I$(TOP) # for config.h
 | 
				
			||||||
 | 
					
 | 
				
			||||||
ifeq (-$(findstring gcc,$(CC))-,-gcc-)
 | 
					ifneq (-$(findstring gcc,$(CC))-,-gcc-)
 | 
				
			||||||
ifeq (-$(findstring $(GCC_MAJOR),01)-,--)
 | 
					 | 
				
			||||||
CFLAGS+=-fno-strict-aliasing
 | 
					 | 
				
			||||||
ifeq (-$(findstring $(GCC_MAJOR),23)-,--)
 | 
					 | 
				
			||||||
CFLAGS+=-Wno-pointer-sign -Wno-sign-compare
 | 
					 | 
				
			||||||
ifeq (-$(GCC_MAJOR)-$(findstring $(GCC_MINOR),56789)-,-4--)
 | 
					 | 
				
			||||||
CFLAGS+=-D_FORTIFY_SOURCE=0
 | 
					 | 
				
			||||||
else
 | 
					 | 
				
			||||||
CFLAGS+=-Wno-unused-result
 | 
					 | 
				
			||||||
endif
 | 
					 | 
				
			||||||
endif
 | 
					 | 
				
			||||||
endif
 | 
					 | 
				
			||||||
else # not GCC
 | 
					 | 
				
			||||||
ifeq (-$(findstring clang,$(CC))-,-clang-)
 | 
					ifeq (-$(findstring clang,$(CC))-,-clang-)
 | 
				
			||||||
# make clang accept gnuisms in libtcc1.c
 | 
					# make clang accept gnuisms in libtcc1.c
 | 
				
			||||||
CFLAGS+=-fheinous-gnu-extensions
 | 
					CFLAGS+=-fheinous-gnu-extensions
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										18
									
								
								configure
									
										
									
									
										vendored
									
									
								
							
							
						
						
									
										18
									
								
								configure
									
										
									
									
										vendored
									
									
								
							| 
						 | 
					@ -373,8 +373,16 @@ else
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# a final configuration tuning
 | 
					# a final configuration tuning
 | 
				
			||||||
W_PRESENT="$($cc -v --help 2>&1 | grep deprecated-declarations)"
 | 
					W_OPTIONS="deprecated-declarations strict-aliasing pointer-sign sign-compare unused-result uninitialized"
 | 
				
			||||||
if test -n "$W_PRESENT"; then  cc="$cc -Wno-deprecated-declarations"; fi
 | 
					for i in $W_OPTIONS; do
 | 
				
			||||||
 | 
					    O_PRESENT="$($cc -v --help 2>&1 | grep -- -W$i)"
 | 
				
			||||||
 | 
					    if test -n "$O_PRESENT"; then  CFLAGS="$CFLAGS -Wno-$i"; fi
 | 
				
			||||||
 | 
					done
 | 
				
			||||||
 | 
					F_OPTIONS="strict-aliasing"
 | 
				
			||||||
 | 
					for i in $F_OPTIONS; do
 | 
				
			||||||
 | 
					    O_PRESENT="$($cc -v --help 2>&1 | grep -- -f$i)"
 | 
				
			||||||
 | 
					    if test -n "$O_PRESENT"; then  CFLAGS="$CFLAGS -fno-$i"; fi
 | 
				
			||||||
 | 
					done
 | 
				
			||||||
if test -z "$tcc_lddir" -a "$cpu" = "x86-64"; then tcc_lddir="lib64"; fi
 | 
					if test -z "$tcc_lddir" -a "$cpu" = "x86-64"; then tcc_lddir="lib64"; fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
echo "Binary  directory   $bindir"
 | 
					echo "Binary  directory   $bindir"
 | 
				
			||||||
| 
						 | 
					@ -420,6 +428,12 @@ LDFLAGS=$LDFLAGS
 | 
				
			||||||
LIBSUF=$LIBSUF
 | 
					LIBSUF=$LIBSUF
 | 
				
			||||||
EXESUF=$EXESUF
 | 
					EXESUF=$EXESUF
 | 
				
			||||||
EOF
 | 
					EOF
 | 
				
			||||||
 | 
					if test "$mingw32" = "yes"; then
 | 
				
			||||||
 | 
					cat >>config.mak <<EOF
 | 
				
			||||||
 | 
					XCC=$cc
 | 
				
			||||||
 | 
					XAR=$ar
 | 
				
			||||||
 | 
					EOF
 | 
				
			||||||
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
print_inc() {
 | 
					print_inc() {
 | 
				
			||||||
  if test -n "$2"; then
 | 
					  if test -n "$2"; then
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -60,15 +60,15 @@ CFLAGS := $(filter-out -fstack-protector-strong,$(CFLAGS))
 | 
				
			||||||
ifeq "$(TARGET)" "i386-win"
 | 
					ifeq "$(TARGET)" "i386-win"
 | 
				
			||||||
 OBJ = $(addprefix $(DIR)/,$(WIN32_O))
 | 
					 OBJ = $(addprefix $(DIR)/,$(WIN32_O))
 | 
				
			||||||
 TGT = -DTCC_TARGET_I386 -DTCC_TARGET_PE
 | 
					 TGT = -DTCC_TARGET_I386 -DTCC_TARGET_PE
 | 
				
			||||||
 XCC = $(TCC) -B$(top_srcdir)/win32 -I$(top_srcdir)/include
 | 
					 XCC ?= $(TCC) -B$(top_srcdir)/win32 -I$(top_srcdir)/include
 | 
				
			||||||
 XAR = $(DIR)/tiny_libmaker$(EXESUF)
 | 
					 XAR ?= $(DIR)/tiny_libmaker$(EXESUF)
 | 
				
			||||||
 PICFLAGS =
 | 
					 PICFLAGS =
 | 
				
			||||||
else
 | 
					else
 | 
				
			||||||
ifeq "$(TARGET)" "x86_64-win"
 | 
					ifeq "$(TARGET)" "x86_64-win"
 | 
				
			||||||
 OBJ = $(addprefix $(DIR)/,$(WIN64_O))
 | 
					 OBJ = $(addprefix $(DIR)/,$(WIN64_O))
 | 
				
			||||||
 TGT = -DTCC_TARGET_X86_64 -DTCC_TARGET_PE
 | 
					 TGT = -DTCC_TARGET_X86_64 -DTCC_TARGET_PE
 | 
				
			||||||
 XCC = $(TCC) -B$(top_srcdir)/win32 -I$(top_srcdir)/include
 | 
					 XCC = $(TCC) -B$(top_srcdir)/win32 -I$(top_srcdir)/include
 | 
				
			||||||
 XAR = $(DIR)/tiny_libmaker$(EXESUF)
 | 
					 XAR ?= $(DIR)/tiny_libmaker$(EXESUF)
 | 
				
			||||||
 PICFLAGS =
 | 
					 PICFLAGS =
 | 
				
			||||||
else
 | 
					else
 | 
				
			||||||
ifeq "$(TARGET)" "i386"
 | 
					ifeq "$(TARGET)" "i386"
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		
		Reference in a new issue