mirror of
				https://github.com/tmux/tmux.git
				synced 2025-11-04 00:56:10 +00:00 
			
		
		
		
	Put AM_* back, but this time do a dance in configure.ac so that we can keep
using CFLAGS for the tests.
This commit is contained in:
		
							
								
								
									
										38
									
								
								Makefile.am
									
									
									
									
									
								
							
							
						
						
									
										38
									
								
								Makefile.am
									
									
									
									
									
								
							@@ -12,49 +12,49 @@ dist-hook:
 | 
			
		||||
	grep "^#enable_debug=" configure
 | 
			
		||||
 | 
			
		||||
# Preprocessor flags.
 | 
			
		||||
CPPFLAGS += @XOPEN_DEFINES@ -DTMUX_CONF="\"$(sysconfdir)/tmux.conf\""
 | 
			
		||||
AM_CPPFLAGS += @XOPEN_DEFINES@ -DTMUX_CONF="\"$(sysconfdir)/tmux.conf\""
 | 
			
		||||
 | 
			
		||||
# glibc as usual does things ass-backwards and hides useful things by default,
 | 
			
		||||
# so everyone has to add this.
 | 
			
		||||
if IS_GLIBC
 | 
			
		||||
CFLAGS += -D_GNU_SOURCE
 | 
			
		||||
AM_CFLAGS += -D_GNU_SOURCE
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
# Set flags for gcc.
 | 
			
		||||
if IS_GCC
 | 
			
		||||
CFLAGS += -std=gnu99 -O2
 | 
			
		||||
AM_CFLAGS += -std=gnu99 -O2
 | 
			
		||||
if IS_DEBUG
 | 
			
		||||
CFLAGS += -g
 | 
			
		||||
CFLAGS += -Wno-long-long -Wall -W -Wformat=2
 | 
			
		||||
CFLAGS += -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations
 | 
			
		||||
CFLAGS += -Wwrite-strings -Wshadow -Wpointer-arith -Wsign-compare
 | 
			
		||||
CFLAGS += -Wundef -Wbad-function-cast -Winline -Wcast-align
 | 
			
		||||
CFLAGS += -Wdeclaration-after-statement -Wno-pointer-sign -Wno-attributes
 | 
			
		||||
CPPFLAGS += -DDEBUG
 | 
			
		||||
AM_CFLAGS += -g
 | 
			
		||||
AM_CFLAGS += -Wno-long-long -Wall -W -Wformat=2
 | 
			
		||||
AM_CFLAGS += -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations
 | 
			
		||||
AM_CFLAGS += -Wwrite-strings -Wshadow -Wpointer-arith -Wsign-compare
 | 
			
		||||
AM_CFLAGS += -Wundef -Wbad-function-cast -Winline -Wcast-align
 | 
			
		||||
AM_CFLAGS += -Wdeclaration-after-statement -Wno-pointer-sign -Wno-attributes
 | 
			
		||||
AM_CPPFLAGS += -DDEBUG
 | 
			
		||||
endif
 | 
			
		||||
if IS_COVERAGE
 | 
			
		||||
CFLAGS += -g -O0 --coverage
 | 
			
		||||
LDFLAGS += --coverage
 | 
			
		||||
AM_CFLAGS += -g -O0 --coverage
 | 
			
		||||
AM_LDFLAGS += --coverage
 | 
			
		||||
endif
 | 
			
		||||
if IS_PROFILE
 | 
			
		||||
CFLAGS += -g -O0 -pg
 | 
			
		||||
LDFLAGS += -pg
 | 
			
		||||
AM_CFLAGS += -g -O0 -pg
 | 
			
		||||
AM_LDFLAGS += -pg
 | 
			
		||||
endif
 | 
			
		||||
CPPFLAGS += -iquote.
 | 
			
		||||
AM_CPPFLAGS += -iquote.
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
# Set flags for Solaris.
 | 
			
		||||
if IS_SUNOS
 | 
			
		||||
if IS_GCC
 | 
			
		||||
CPPFLAGS += -D_XPG6 -D__EXTENSIONS__ -D_POSIX_PTHREAD_SEMANTICS
 | 
			
		||||
AM_CPPFLAGS += -D_XPG6 -D__EXTENSIONS__ -D_POSIX_PTHREAD_SEMANTICS
 | 
			
		||||
else
 | 
			
		||||
CPPFLAGS += -D_XPG4_2 -D__EXTENSIONS__ -D_POSIX_PTHREAD_SEMANTICS
 | 
			
		||||
AM_CPPFLAGS += -D_XPG4_2 -D__EXTENSIONS__ -D_POSIX_PTHREAD_SEMANTICS
 | 
			
		||||
endif
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
# Set flags for Sun CC.
 | 
			
		||||
if IS_SUNCC
 | 
			
		||||
CFLAGS += -erroff=E_EMPTY_DECLARATION
 | 
			
		||||
AM_CFLAGS += -erroff=E_EMPTY_DECLARATION
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
# Set _LINUX_SOURCE_COMPAT for AIX for malloc(0).
 | 
			
		||||
@@ -64,7 +64,7 @@ endif
 | 
			
		||||
 | 
			
		||||
# Set flags for NetBSD.
 | 
			
		||||
if IS_NETBSD
 | 
			
		||||
CPPFLAGS += -D_OPENBSD_SOURCE
 | 
			
		||||
AM_CPPFLAGS += -D_OPENBSD_SOURCE
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
# List of sources.
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										25
									
								
								configure.ac
									
									
									
									
									
								
							
							
						
						
									
										25
									
								
								configure.ac
									
									
									
									
									
								
							@@ -12,6 +12,13 @@ AC_CANONICAL_HOST
 | 
			
		||||
# empty default.
 | 
			
		||||
: ${CFLAGS=""}
 | 
			
		||||
 | 
			
		||||
# Save user CPPFLAGS, CFLAGS and LDFLAGS. We need to change them because
 | 
			
		||||
# AC_CHECK_HEADER doesn't give us any other way to update the include
 | 
			
		||||
# paths. But for Makefile.am we want to use AM_CPPFLAGS and friends.
 | 
			
		||||
SAVED_CFLAGS="$CFLAGS"
 | 
			
		||||
SAVED_CPPFLAGS="$CPPFLAGS"
 | 
			
		||||
SAVED_LDFLAGS="$LDFLAGS"
 | 
			
		||||
 | 
			
		||||
# Set up the compiler in two different ways and say yes we may want to install.
 | 
			
		||||
AC_PROG_CC
 | 
			
		||||
AM_PROG_CC_C_O
 | 
			
		||||
@@ -51,8 +58,9 @@ AC_ARG_ENABLE(
 | 
			
		||||
	AC_HELP_STRING(--enable-static, create a static build)
 | 
			
		||||
)
 | 
			
		||||
if test "x$enable_static" = xyes; then
 | 
			
		||||
	LDFLAGS="$LDFLAGS -static"
 | 
			
		||||
	test "x$PKG_CONFIG" != x && PKG_CONFIG="$PKG_CONFIG --static"
 | 
			
		||||
	AM_LDFLAGS="-static $AM_LDFLAGS"
 | 
			
		||||
	LDFLAGS="$AM_LDFLAGS $SAVED_LDFLAGS"
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
# Is this gcc?
 | 
			
		||||
@@ -129,7 +137,8 @@ PKG_CHECK_MODULES(
 | 
			
		||||
	LIBEVENT,
 | 
			
		||||
	libevent,
 | 
			
		||||
	[
 | 
			
		||||
		CPPFLAGS="$LIBEVENT_CFLAGS $CPPFLAGS"
 | 
			
		||||
		AM_CFLAGS="$LIBEVENT_CFLAGS $AM_CFLAGS"
 | 
			
		||||
		CFLAGS="$AM_CFLAGS $SAVED_CFLAGS"
 | 
			
		||||
		LIBS="$LIBEVENT_LIBS $LIBS"
 | 
			
		||||
		found_libevent=yes
 | 
			
		||||
	],
 | 
			
		||||
@@ -156,7 +165,8 @@ PKG_CHECK_MODULES(
 | 
			
		||||
	LIBNCURSES,
 | 
			
		||||
	ncurses,
 | 
			
		||||
	[
 | 
			
		||||
		CPPFLAGS="$LIBNCURSES_CFLAGS $CPPFLAGS"
 | 
			
		||||
		AM_CFLAGS="$LIBNCURSES_CFLAGS $AM_CFLAGS"
 | 
			
		||||
		CFLAGS="$AM_CFLAGS $SAVED_CFLAGS"
 | 
			
		||||
		LIBS="$LIBNCURSES_LIBS $LIBS"
 | 
			
		||||
		found_ncurses=yes
 | 
			
		||||
	],
 | 
			
		||||
@@ -645,5 +655,14 @@ AM_CONDITIONAL(IS_SUNOS, test "x$PLATFORM" = xsunos)
 | 
			
		||||
AM_CONDITIONAL(IS_HPUX, test "x$PLATFORM" = xhpux)
 | 
			
		||||
AM_CONDITIONAL(IS_UNKNOWN, test "x$PLATFORM" = xunknown)
 | 
			
		||||
 | 
			
		||||
# Save our CFLAGS/CPPFLAGS/LDFLAGS for the Makefile and restore the old user
 | 
			
		||||
# variables.
 | 
			
		||||
AC_SUBST(AM_CPPFLAGS)
 | 
			
		||||
CPPFLAGS="$SAVED_CPPFLAGS"
 | 
			
		||||
AC_SUBST(AM_CFLAGS)
 | 
			
		||||
CFLAGS="$SAVED_CFLAGS"
 | 
			
		||||
AC_SUBST(AM_LDFLAGS)
 | 
			
		||||
LDFLAGS="$SAVED_LDFLAGS"
 | 
			
		||||
 | 
			
		||||
# autoconf should create a Makefile.
 | 
			
		||||
AC_OUTPUT(Makefile)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user