1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-03-09 15:50:02 +00:00

configure: various fixes regarding compiler flags

First attempt at setting certain -Defines and compiler flags (like
-fno-strict-aliasing).  Only linux for now.

Add CSRG_BASED to CPP_SOURCE_FLAGS rather than directly at CFLAGS.
This will be added to CFLAGS later on in the script along with other
gathered flags and options.

Set CFLAGS, CXXFLAGS, and CPPFLAGS at the end, composed of other env
variables we set earlier on.
This commit is contained in:
Jon Trulson 2019-10-28 14:26:41 -06:00
parent c0e3f08c9f
commit 9eee455580

View file

@ -20,8 +20,21 @@ AC_SUBST(MAJOR)
AC_SUBST(MINOR) AC_SUBST(MINOR)
AC_SUBST(MICRO) AC_SUBST(MICRO)
dnl These OS checks are deprecated and should be replaced with feature checks dnl SOURCE_DEFINES - needed for some OS's
dnl where appropriate SOURCE_CPP_DEFINES=""
dnl CPP_COMPILER_FLAGS - CPP/C/C++ compiler flags
CPP_COMPILER_FLAGS=""
dnl CXX_COMPILER_FLAGS - C++ compiler flags
CXX_COMPILER_FLAGS=""
dnl C_COMPILER_FLAGS - C compiler flags
C_COMPILER_FLAGS=""
dnl These OS version checks are deprecated and should be replaced with
dnl feature checks where appropriate
build_linux=no build_linux=no
bsd=no bsd=no
@ -38,37 +51,41 @@ dnl choose defaults here. These need to be removed in the code in favor
dnl of actual checks for functionality. So this should be considered dnl of actual checks for functionality. So this should be considered
dnl temporary. dnl temporary.
osmajorversion=4 OSMAJORVERSION=4
osminorversion=15 OSMINORVERSION=15
case "${host_os}" in case "${host_os}" in
linux*) linux*)
build_linux=yes build_linux=yes
osmajorversion=4 OSMAJORVERSION=4
osminorversion=15 OSMINORVERSION=15
;; SOURCE_CPP_DEFINES="-D_POSIX_SOURCE -D_DEFAULT_SOURCE \
-D_BSD_SOURCE -D_SVID_SOURCE"
CPP_COMPILER_FLAGS="-fno-strict-aliasing -Wno-write-strings \
-Wno-unused-result"
;;
freebsd*) freebsd*)
build_freebsd=yes build_freebsd=yes
bsd=yes bsd=yes
osmajorversion=10 OSMAJORVERSION=10
osminorversion=0 OSMINORVERSION=0
;; ;;
openbsd*) openbsd*)
build_openbsd=yes build_openbsd=yes
bsd=yes bsd=yes
osmajorversion=6 OSMAJORVERSION=6
osminorversion=2 OSMINORVERSION=2
;; ;;
netbsd*) netbsd*)
build_netbsd=yes build_netbsd=yes
bsd=yes bsd=yes
osmajorversion=8 OSMAJORVERSION=8
osminorversion=0 OSMINORVERSION=0
;; ;;
solaris*|sun*) solaris*|sun*)
build_solaris=yes build_solaris=yes
osmajorversion=5 OSMAJORVERSION=5
osminorversion=10 OSMINORVERSION=10
;; ;;
aix*) aix*)
build_aix=yes build_aix=yes
@ -88,16 +105,12 @@ AM_CONDITIONAL([AIX], [test "$build_aix" = "yes"])
AM_CONDITIONAL([HPUX], [test "$build_hpux" = "yes"]) AM_CONDITIONAL([HPUX], [test "$build_hpux" = "yes"])
dnl Add osmajor/minor version to cppflags. dnl Add osmajor/minor version to cppflags.
oflags="$CPPFLAGS" OSVERSION="-DOSMAJORVERSION=$OSMAJORVERSION -DOSMINORVERSION=$OSMINORVERSION"
CPPFLAGS="$oflags -DOSMAJORVERSION=$osmajorversion \
-DOSMINORVERSION=$osminorversion"
dnl set CSRG_BASED define for the BSD's dnl set CSRG_BASED define for the BSD's
if test "$build_bsd" = "yes" if test "$build_bsd" = "yes"
then then
oflags="$CPPFLAGS" SOURCE_CPP_DEFINES="${SOURCE_CPP_DEFINES} -DCSRG_BASED"
CPPFLAGS="$oflags -DCSRG_BASED"
fi fi
is_x86_64=no is_x86_64=no
@ -136,7 +149,7 @@ AM_CONDITIONAL([MIPS], [test "is_mips" = yes])
AM_CONDITIONAL([PPC], [test "is_ppc" = yes]) AM_CONDITIONAL([PPC], [test "is_ppc" = yes])
dnl our main libraries dnl our main libraries
dnl we use single quotes so that $top_builder is evaluated in the makfiles, dnl we use single quotes so that $top_builder is evaluated in the makefiles,
dnl not here. dnl not here.
AC_SUBST(LIBTT, '$(top_builddir)/lib/tt/lib/libtt.la') AC_SUBST(LIBTT, '$(top_builddir)/lib/tt/lib/libtt.la')
AC_SUBST(LIBXIN, '$(top_builddir)/lib/DtXinerama/libDtXinerama.a') AC_SUBST(LIBXIN, '$(top_builddir)/lib/DtXinerama/libDtXinerama.a')
@ -230,6 +243,12 @@ AC_CHECK_LIB(tirpc, main, [TIRPCINC="-DOPT_TIRPC -I/usr/include/tirpc"; TIRPCLIB
AC_SUBST(TIRPCINC) AC_SUBST(TIRPCINC)
AC_SUBST(TIRPCLIB) AC_SUBST(TIRPCLIB)
dnl set CPPFLAGS, CFLAGS, and CXXFLAGS
CPPFLAGS="${CPPFLAGS} ${SOURCE_CPP_DEFINES} ${CPP_COMPILER_FLAGS} ${OSVERSION}"
CFLAGS="${CFLAGS} ${C_COMPILER_FLAGS}"
CXXFLAGS="${CXXFLAGS} ${CXX_COMPILER_FLAGS}"
dnl All of the makefiles we need to generate go here... dnl All of the makefiles we need to generate go here...
AC_CONFIG_FILES([ AC_CONFIG_FILES([
Makefile Makefile