Buildchain fixes and updates from Sebastian
authorSteve Youngs <steve@sxemacs.org>
Tue, 3 Jan 2012 21:12:38 +0000 (07:12 +1000)
committerSteve Youngs <steve@sxemacs.org>
Tue, 3 Jan 2012 21:12:38 +0000 (07:12 +1000)
* merges: (21 commits)
  Summary: fix to fix, do not blank EMACSPACKAGEPATH when finding ... Keywords: bldchn
  Summary: minor, also massage sxemacs calls in tests/ with batch env Keywords: bldchn
  Summary: minor, put XCCLDFLAGS in libtool built binaries and libs Keywords: build icc
  Summary: minor, provide XCCLDFLAGS to be passed on through libtool to the CC Keywords: build icc
  Summary: minor, tweak SXE_CHECK_LINKER_FLAGS Keywords: bldchn
  Summary: fix to fix, do not treat compiler flags as linker flags Keywords: bldchn
  Summary: minor, specifically check for all optimisation flags Keywords: bldchn
  Summary: fix, check for special diagnostic 10237 if CC=icc Keywords: bldchn
  Summary: fix, use all CFLAGS for linker flag check Keywords: bldchn
  Summary: minor, provide SXE_CHECK_COMPILER_XFLAG Keywords: bldchn
  Summary: cosmetics, add meself to sppm.texi Keywords: boasting
  Summary: minor, always pass on SXE_DYLD_PATH with pointers to the lwlibdir Keywords: bldchn
  Summary: minor, call the linker (or the compiler front-end) when ... Keywords: bldchn
  Summary: fix, carefully quote esd lib prepending Keywords: bldchn
  Summary: minor, rewrite linker checks to use the compiler front-end and XFLAG Keywords: bldchn
  Summary: cosmetics, add ar-lib wrapper script to git ignore file Keywords: bldchn
  Summary: fix to cosmetics, add AM_PROG_AR conditionally Keywords: bldchn
  Summary: cosmetics, add AM_PROG_AR like autoreconf suggests Keywords: bldchn
  Summary: minor, check certain compiler flags regardless of CC flavour Keywords: bldchn
  Summary: minor, provide C11 check for anonymous structs Keywords: bldchn
  ...

Conflicts:
src/Makefile.am  -- trivial conflict resolved

Signed-off-by: Steve Youngs <steve@sxemacs.org>
15 files changed:
.gitignore
configure.ac
info/sppm.texi
lisp/Makefile.am
m4/sxe-compiler.m4
m4/sxe-libtool.m4
m4/sxe-linker.m4
modules/Makefile.am
modules/ase/Makefile.am
modules/cl/Makefile.am
modules/dbus/Makefile.am
modules/ldap/Makefile.am
src/Makefile.am
src/ui/lwlib/Makefile.am
tests/Makefile.am

index 51a6c56..1c693b5 100644 (file)
@@ -46,6 +46,7 @@ ylwrap
 Makefile.in
 sxemacs_version.m4
 src/config.h.in
+ar-lib
 
 ## configure generated
 .deps
index 8a65ad8..0cfe3e9 100644 (file)
@@ -874,6 +874,8 @@ AS_MESSAGE([Let's look for the entire C build chain])
 SXE_CHECK_CC
 SXE_CHECK_CFLAGS
 
+m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
+
 ## check machine chars
 AS_MESSAGE([Let's have a detailed glance at your machine])
 SXE_PROC_CPUID
@@ -1136,7 +1138,7 @@ SXE_DO_CC_HACKS
 SXE_CHECK_SIMD_EXTENSIONS
 
 ## some linker flags that might come in handy
-SXE_CHECK_LINKER_FLAGS
+SXE_CHECK_LDFLAGS
 
 ## suffices to be defined late, for instance here
 SXE_CHECK_PARSER_LEXER
@@ -1149,7 +1151,7 @@ if test "$with_pdump" != "yes"; then
        ## enough.  Please report it, though.
        ## #### Should make this Solaris-friendly.
        ## Link with -z nocombreloc for now.
-       SXE_CHECK_LD_NOCOMBRELOC
+       SXE_CHECK_LD_ZFLAG([nocombreloc])
        if test "$sxe_cv_ld__z_nocombreloc" = "yes"; then
                SXE_PREPEND_LINKER_FLAG([-z nocombreloc], [ld_switch_site])
        fi
@@ -1607,23 +1609,18 @@ dnl special pthread handling
 dnl AIX uses pthreads instead of pthread, and HP/UX uses cma
 dnl FreeBSD uses -pthread
 AC_CHECK_LIB(pthread, pthread_create)
-if test $ac_cv_lib_pthread_pthread_create = yes; then
-  have_threads=yes
-  have_pthreads_opt=yes
-  case "`$CC -pthreads 2>&1`" in
-      *unrecognized\ option*) have_pthreads_opt=no ;;
-  esac
-  if test "$have_pthreads_opt" = "yes"; then
-       SXE_PREPEND_UNDUP(-pthreads, c_switch_site)
-  fi
-  have_pthread_opt=yes
-  case "`$CC -pthread 2>&1`" in
-     *unrecognized\ option*) have_pthread_opt=no ;;
-  esac
-  if test "$have_pthread_opt" = "yes"; then
-       SXE_PREPEND_UNDUP(-pthread, c_switch_site)
-  fi
-  SXE_PREPEND(-lpthread, MM_LIBS)
+if test "${ac_cv_lib_pthread_pthread_create}" = "yes"; then
+       have_threads=yes
+
+       SXE_CHECK_COMPILER_FLAGS([-pthreads])
+       SXE_CHECK_COMPILER_FLAGS([-pthread])
+       if test "${sxe_cv_c_flags__pthreads}" = "yes"; then
+               SXE_PREPEND_UNDUP([-pthreads], [c_switch_site])
+       fi
+       if test "${sxe_cv_c_flags__pthread}" = "yes"; then
+               SXE_PREPEND_UNDUP([-pthread], [c_switch_site])
+       fi
+       SXE_PREPEND([-lpthread], [MM_LIBS])
 fi
 
 dnl test for AIX pthreads
@@ -3257,7 +3254,8 @@ if test "$with_sound_esd" != "no"; then
                AC_MSG_RESULT([yes])
                need_internal_media=yes
                SXE_ADD_MM_OBJS([sound-esd.o])
-               SXE_PREPEND([`$ESD_CONFIG --libs`], MM_LIBS)
+               ESD_LIBS=$("${ESD_CONFIG}" --libs)
+               SXE_PREPEND(["${ESD_LIBS}"], [MM_LIBS])
                AC_DEFINE([HAVE_ESD_SOUND], [1], [Description here!])
        else
                AC_MSG_RESULT([no])
index 9685bb6..712d1dd 100644 (file)
@@ -1708,6 +1708,9 @@ accessible 24/7.
 Nelson
 @item
 http://git.nelsonferreira.com/sxemacs
+Sebastian
+@item
+git://github.com/hroptatyr/sxemacs.git
 @end itemize
 
 And that is it for now.  We've only just moved to git and the
@@ -1723,7 +1726,7 @@ main SXEmacs developers haven't set up their repos.
 @c Norbert
 @c @item
 @c http://arafel.viteno.net:33080/arch/sxemacs/
-@c Martin KΓΌhl
+@c Martin K@"uhl
 @c @item
 @c http://www.informatik.uni-bremen.de/~mkhl/sxemacs-mirror/
 @c Alexey Mikhailov (karma)
index a1cdbe1..01e5fda 100644 (file)
@@ -39,6 +39,8 @@ bldlispdir = $(abs_top_builddir)/lisp
 bldffidir = $(bldlispdir)/ffi
 bldmuledir = $(bldlispdir)/mule
 bldtermdir = $(bldlispdir)/term
+sxelwlibdir = $(top_srcdir)/src/ui/lwlib
+bldlwlibdir = $(top_builddir)/src/ui/lwlib
 
 lispffidir = $(lispdir)/ffi
 lispmuledir = $(lispdir)/mule
@@ -182,8 +184,10 @@ SXEMACS_DMP = $(SXEMACS).dmp
 AALFILE = $(bldlispdir)/auto-autoloads.el
 BITCH = $(SXEMACS) -batch
 SXE_DYLD_PATH = $(bldsrcdir):$(bldsrcdir)/$(LT_OBJDIR):$(bldlwlibdir):$(bldlwlibdir)/$(LT_OBJDIR):$(DESTDIR)$(libdir)
-BITCHENV = DYLD_LIBRARY_PATH=$(SXE_DYLD_PATH):$$DYLD_LIBRARY_PATH:$(DYLD_LIBRARY_PATH) \
+BATCHENV = DYLD_LIBRARY_PATH=$(SXE_DYLD_PATH):$$DYLD_LIBRARY_PATH:$(DYLD_LIBRARY_PATH) \
        LD_LIBRARY_PATH=$(SXE_DYLD_PATH):$$LD_LIBRARY_PATH:$(LD_LIBRARY_PATH) \
+       SHLIB_PATH=$(SXE_DYLD_PATH):$$SHLIB_PATH:$(SHLIB_PATH)
+BITCHENV = $(BATCHENV) \
        EMACSPACKAGEPATH= \
        SOURCE_TREE_ROOT=$(abs_top_srcdir) \
        BUILD_TREE_ROOT=$(abs_top_builddir)
@@ -238,7 +242,7 @@ autoc.stamp: $(SXEMACS) auto.stamp update-elc.stamp
        $(BATCH) -vanilla -no-autoloads \
                -l finder -f finder-compile-keywords
        @echo "Building finder database ...(done)"
-       $(BITCH) -no-autoloads -l config \
+       $(BATCHENV) $(BITCH) -no-autoloads -l config \
                -l bytecomp -f batch-byte-compile $(builtels)
        @touch $@
 @make_endif@
index c42974a..4cce877 100644 (file)
@@ -603,107 +603,77 @@ AC_DEFUN([SXE_WARNFLAGS], [dnl
        ## by default we want the -Wall level
        SXE_CHECK_COMPILER_FLAGS([-Wall], [warnflags="-Wall"])
 
-       ## If this stays nil, it will be set to warnflags before use.
-       dnl Following warning flags are known to work well.
-       if test "$__SUNPRO_C" = "yes"; then
-               warnflags=""
-
-       elif test "$CC" = "xlc"; then
-               warnflags="-qinfo"
-
-       elif test "$GCC" = "yes" -a \
-               "$with_maximum_warning_output" = "yes"; then
-               warnflags="-Wall"
-
-               ## Yuck, bad compares have been worth at
-               ## least 3 crashes!
-               ## Warnings about char subscripts are pretty
-               ## pointless, though,
-               ## and we use them in various places.
-               SXE_CHECK_COMPILER_FLAGS([-Wsign-compare], [
-                       warnflags="$warnflags -Wsign-compare"])
-               SXE_CHECK_COMPILER_FLAGS([-Wno-char-subscripts], [
-                       warnflags="$warnflags -Wno-char-subscripts"])
-               SXE_CHECK_COMPILER_FLAGS([-Wundef], [
-                       warnflags="$warnflags -Wundef"])
-
-               ## too much at the moment, we rarely define protos
-               #warnflags="$warnflags -Wmissing-prototypes -Wstrict-prototypes"
-               SXE_CHECK_COMPILER_FLAGS([-Wpacked], [
-                       warnflags="$warnflags -Wpacked"])
-
-               ## glibc is intentionally not `-Wpointer-arith'-clean.
-               ## Ulrich Drepper has rejected patches to fix
-               ## the glibc header files.
-               ## we dont care
-               SXE_CHECK_COMPILER_FLAGS([-Wpointer-arith], [
-                       warnflags="$warnflags -Wpointer-arith"])
-
-               SXE_CHECK_COMPILER_FLAGS([-Wshadow], [
-                       warnflags="$warnflags -Wshadow"])
-
-               ## our code lacks declarations almost all the time
-               SXE_CHECK_COMPILER_FLAGS([-Wmissing-declarations], [
-                       warnflags="$warnflags -Wmissing-declarations"])
-
-               case "$compiler_version" in
-               gcc*\ 4.5.0*)
-                       ## gcc 4.5.0 cannot cope with -Winline
-                       ;;
-               *)
-                       SXE_CHECK_COMPILER_FLAGS([-Winline], [
-                               warnflags="$warnflags -Winline"])
-                       ;;
-               esac
-
-               SXE_CHECK_COMPILER_FLAGS([-Wbad-function-cast], [
-                       warnflags="$warnflags -Wbad-function-cast"])
-               SXE_CHECK_COMPILER_FLAGS([-Wcast-qual], [
-                       warnflags="$warnflags -Wcast-qual"])
-               SXE_CHECK_COMPILER_FLAGS([-Wcast-align], [
-                       warnflags="$warnflags -Wcast-align"])
-
-               ## warn about incomplete switches
-               SXE_CHECK_COMPILER_FLAGS([-Wswitch], [
-                       warnflags="$warnflags -Wswitch"])
-               SXE_CHECK_COMPILER_FLAGS([-Wswitch-default], [
-                       warnflags="$warnflags -Wswitch-default"])
-               SXE_CHECK_COMPILER_FLAGS([-Wswitch-enum], [
-                       warnflags="$warnflags -Wswitch-enum"])
-
-               if test "$sxe_cv_c_flags__save_temps" = "yes"; then
-                       : ##warnflags="$warnflags -save-temps"
-               fi
-
-               ## for upcoming openmp support
-               ## which is of course configurable but shut the compiler
-               ## up in case we dont want/have omp, pragmas are a PITA
-               SXE_CHECK_COMPILER_FLAGS([-Wnopragma], [
-                       warnflags="$warnflags -Wnopragma"])
-
-       elif test "$__ICC" = "yes" -a \
-               "$with_maximum_warning_output" = "yes"; then
-               SXE_CHECK_COMPILER_FLAGS([-Wunused-function], [
-                       warnflags="$warnflags -Wunused-function"])
-               SXE_CHECK_COMPILER_FLAGS([-Wunused-variable], [
-                       warnflags="$warnflags -Wunused-variable"])
-               SXE_CHECK_COMPILER_FLAGS([-Wunknown-pragmas], [
-                       warnflags="$warnflags -Wunknown-pragmas"])
-               SXE_CHECK_COMPILER_FLAGS([-Wuninitialized], [
-                       warnflags="$warnflags -Wuninitialized"])
-               SXE_CHECK_COMPILER_FLAGS([-Wshadow], [
-                       warnflags="$warnflags -Wshadow"])
-               SXE_CHECK_COMPILER_FLAGS([-Wmissing-declarations], [
-                       warnflags="$warnflags -Wmissing-declarations"])
-               SXE_CHECK_COMPILER_FLAGS([-Wmissing-prototypes], [
-                       warnflags="$warnflags -Wmissing-prototypes"])
-               SXE_CHECK_COMPILER_FLAGS([-Wreorder], [
-                       warnflags="$warnflags -Wreorder"])
-               SXE_CHECK_COMPILER_FLAGS([-Wdeprecated], [
-                       warnflags="$warnflags -Wdeprecated"])
-               SXE_CHECK_COMPILER_FLAGS([-Wnopragma], [
-                       warnflags="$warnflags -Wnopragma"])
-       fi
+       SXE_CHECK_COMPILER_FLAGS([-qinfo], [
+               warnflags="${warnflags} -qinfo"])
+
+       ## Yuck, bad compares have been worth at
+       ## least 3 crashes!
+       ## Warnings about char subscripts are pretty
+       ## pointless, though,
+       ## and we use them in various places.
+       SXE_CHECK_COMPILER_FLAGS([-Wsign-compare], [
+               warnflags="$warnflags -Wsign-compare"])
+       SXE_CHECK_COMPILER_FLAGS([-Wno-char-subscripts], [
+               warnflags="$warnflags -Wno-char-subscripts"])
+       SXE_CHECK_COMPILER_FLAGS([-Wundef], [
+               warnflags="$warnflags -Wundef"])
+
+       ## too much at the moment, we rarely define protos
+       #warnflags="$warnflags -Wmissing-prototypes -Wstrict-prototypes"
+       SXE_CHECK_COMPILER_FLAGS([-Wpacked], [
+               warnflags="$warnflags -Wpacked"])
+
+       ## glibc is intentionally not `-Wpointer-arith'-clean.
+       ## Ulrich Drepper has rejected patches to fix
+       ## the glibc header files.
+       ## we dont care
+       SXE_CHECK_COMPILER_FLAGS([-Wpointer-arith], [
+               warnflags="$warnflags -Wpointer-arith"])
+
+       SXE_CHECK_COMPILER_FLAGS([-Wshadow], [
+               warnflags="$warnflags -Wshadow"])
+
+       ## our code lacks declarations almost all the time
+       SXE_CHECK_COMPILER_FLAGS([-Wmissing-declarations], [
+               warnflags="$warnflags -Wmissing-declarations"])
+       SXE_CHECK_COMPILER_FLAGS([-Wmissing-prototypes], [
+               warnflags="$warnflags -Wmissing-prototypes"])
+       SXE_CHECK_COMPILER_FLAGS([-Winline], [
+               warnflags="$warnflags -Winline"])
+       SXE_CHECK_COMPILER_FLAGS([-Wbad-function-cast], [
+               warnflags="$warnflags -Wbad-function-cast"])
+       SXE_CHECK_COMPILER_FLAGS([-Wcast-qual], [
+               warnflags="$warnflags -Wcast-qual"])
+       SXE_CHECK_COMPILER_FLAGS([-Wcast-align], [
+               warnflags="$warnflags -Wcast-align"])
+
+       ## warn about incomplete switches
+       SXE_CHECK_COMPILER_FLAGS([-Wswitch], [
+               warnflags="$warnflags -Wswitch"])
+       SXE_CHECK_COMPILER_FLAGS([-Wswitch-default], [
+               warnflags="$warnflags -Wswitch-default"])
+       SXE_CHECK_COMPILER_FLAGS([-Wswitch-enum], [
+               warnflags="$warnflags -Wswitch-enum"])
+
+       ## Wunused's
+       SXE_CHECK_COMPILER_FLAGS([-Wunused-function], [
+               warnflags="$warnflags -Wunused-function"])
+       SXE_CHECK_COMPILER_FLAGS([-Wunused-variable], [
+               warnflags="$warnflags -Wunused-variable"])
+       SXE_CHECK_COMPILER_FLAGS([-Wunused-parameter], [
+               warnflags="$warnflags -Wunused-parameter"])
+       SXE_CHECK_COMPILER_FLAGS([-Wunused-value], [
+               warnflags="$warnflags -Wunused-value"])
+       SXE_CHECK_COMPILER_FLAGS([-Wunused], [
+               warnflags="$warnflags -Wunused"])
+
+       ## icc
+       SXE_CHECK_COMPILER_FLAGS([-Wreorder], [
+               warnflags="$warnflags -Wreorder"])
+       SXE_CHECK_COMPILER_FLAGS([-Wdeprecated], [
+               warnflags="$warnflags -Wdeprecated"])
+       SXE_CHECK_COMPILER_FLAGS([-Wnopragma], [
+               warnflags="$warnflags -Wnopragma"])
 
        ## for upcoming libev support
        ## libev is a warning emitting cow, the developers can't
@@ -711,6 +681,12 @@ AC_DEFUN([SXE_WARNFLAGS], [dnl
        SXE_CHECK_COMPILER_FLAGS([-fno-strict-aliasing], [
                warnflags="$warnflags -fno-strict-aliasing"])
 
+       ## icc specific
+       SXE_CHECK_COMPILER_FLAGS([-diag-disable 10237], [dnl
+               warnflags="${warnflags} -diag-disable 10237"], [
+               SXE_CHECK_COMPILER_FLAGS([-wd 10237], [dnl
+                       warnflags="${warnflags} -wd 10237"])])
+
        AC_MSG_CHECKING([for preferred warning flags])
        AC_MSG_RESULT([${warnflags}])
 ])dnl SXE_WARNFLAGS
@@ -787,6 +763,18 @@ AC_DEFUN([SXE_FEATFLAGS], [dnl
        SXE_CHECK_COMPILER_FLAGS([-nopie],
                [featflags="$featflags -nopie"])
 
+       ## icc and gcc related
+       ## check if some stuff can be staticalised
+       ## actually requires SXE_WARNFLAGS so warnings would be disabled
+       ## that affect the outcome of the following tests
+       SXE_CHECK_COMPILER_FLAGS([-static-intel], [
+               featflags="${featflags} -static-intel"
+               XCCLDFLAGS="${XCCLDFLAGS} -static-intel"], [:], [${SXE_CFLAGS}])
+       SXE_CHECK_COMPILER_FLAGS([-static-libgcc], [
+               featflags="${featflags} -static-libgcc"
+               XCCLDFLAGS="${XCCLDFLAGS} -static-libgcc"], [:], [${SXE_CFLAGS}])
+
+       AC_SUBST([XCCLDFLAGS])
 ])dnl SXE_FEATFLAGS
 
 
@@ -1060,6 +1048,8 @@ dnl       fi
 ##### http://autoconf-archive.cryp.to/ax_check_compiler_flags.html
 ## renamed the prefix to SXE_
 AC_DEFUN([SXE_CHECK_COMPILER_FLAGS], [dnl
+dnl SXE_CHECK_COMPILER_FLAGS(<FLAG>, <ACTION-IF-FOUND>, <ACTION-IF-NOT-FOUND>,
+dnl     <ADDITIONAL-FLAGS>)
        AC_MSG_CHECKING([whether _AC_LANG compiler accepts $1])
 
        dnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
@@ -1067,13 +1057,13 @@ AC_DEFUN([SXE_CHECK_COMPILER_FLAGS], [dnl
        AS_LITERAL_IF([$1], [
                AC_CACHE_VAL(AS_TR_SH(sxe_cv_[]_AC_LANG_ABBREV[]_flags_$1), [
                        sxe_save_FLAGS=$[]_AC_LANG_PREFIX[]FLAGS
-                       _AC_LANG_PREFIX[]FLAGS="$1"
+                       _AC_LANG_PREFIX[]FLAGS="$4 $1"
                        AC_COMPILE_IFELSE([AC_LANG_PROGRAM()],
                                AS_TR_SH(sxe_cv_[]_AC_LANG_ABBREV[]_flags_$1)="yes",
                                AS_TR_SH(sxe_cv_[]_AC_LANG_ABBREV[]_flags_$1)="no")
                        _AC_LANG_PREFIX[]FLAGS=$sxe_save_FLAGS])], [
                sxe_save_FLAGS=$[]_AC_LANG_PREFIX[]FLAGS
-               _AC_LANG_PREFIX[]FLAGS="$1"
+               _AC_LANG_PREFIX[]FLAGS="$4 $1"
                AC_COMPILE_IFELSE([AC_LANG_PROGRAM()],
                        eval AS_TR_SH(sxe_cv_[]_AC_LANG_ABBREV[]_flags_$1)="yes",
                        eval AS_TR_SH(sxe_cv_[]_AC_LANG_ABBREV[]_flags_$1)="no")
@@ -1090,6 +1080,27 @@ AC_DEFUN([SXE_CHECK_COMPILER_FLAGS], [dnl
 ])dnl SXE_CHECK_COMPILER_FLAGS
 
 
+AC_DEFUN([SXE_CHECK_COMPILER_XFLAG], [dnl
+       ## if libtool then
+       case "${LD}" in
+       *"libtool"*)
+               SXE_CHECK_COMPILER_FLAGS([-XCClinker], [
+                       XFLAG="-XCClinker"], [
+                       XFLAG=""])
+               ;;
+       *"ld"*)
+               ## no XFLAG needed
+               XFLAG=""
+               ;;
+       *)
+               SXE_CHECK_COMPILER_FLAGS([-Xlinker], [
+                       XFLAG="-Xlinker"], [
+                       XFLAG=""])
+               ;;
+       esac
+])dnl SXE_CHECK_COMPILER_XFLAG
+
+
 AC_DEFUN([SXE_CHECK_CPU], [dnl
        case "$host_cpu" in
        dnl (
@@ -1651,35 +1662,53 @@ AC_DEFUN([SXE_CHECK_CFLAGS], [dnl
                SXE_DEBUGFLAGS
                SXE_WARNFLAGS
                SXE_OPTIFLAGS
+               SXE_CFLAGS="$debugflags $optiflags $warnflags"
+
                SXE_FEATFLAGS
                SXE_CFLAGS="$debugflags $featflags $optiflags $warnflags"
+
        elif test "$CFLAGS_uspecified_p" = "no" -o \
                "$ac_test_CFLAGS" != "set"; then
                SXE_DEBUGFLAGS
                SXE_WARNFLAGS
-               SXE_FEATFLAGS
 
                ## the old settings
                ## Following values of CFLAGS are known to work well.
                ## Should we take debugging options into consideration?
-               if test "$GCC" = "yes"; then
-                       optiflags="-O3"
-               elif test "$__SUNPRO_C" = "yes"; then
-                       case "$opsys" in
-                       sol2    ) optiflags="-xO4" ;;
-                       sunos4* ) optiflags="-xO2" ;;
-                       esac
-               elif test "$__DECC" = "yes"; then
-                       optiflags="-O3"
-               elif test "$CC" = "xlc"; then
-                       optiflags="-g -O3 -qstrict -qnoansialias -qlibansi -qro -qmaxmem=20000"
-               elif test "$__ICC" = "yes"; then
-                       optiflags="-g -O3 -Ob2"
-               ### Add optimal CFLAGS support for other compilers HERE!
-               else
-                       optiflags="-O" ## The only POSIX-approved flag
+               SXE_CHECK_COMPILER_FLAGS([-xO4], [dnl
+                       ## ah, it's sunos4*
+                       optiflags="${optiflags} -xO4"], [dnl
+                       SXE_CHECK_COMPILER_FLAGS([-xO2], [dnl
+                               ## oh, a sol2
+                               optiflags="${optiflags} -xO2"])])
+               SXE_CHECK_COMPILER_FLAGS([-O3], [dnl
+                       ## gcc, icc, decc, et al.
+                       optiflags="${optiflags} -O3"])
+
+               ## xlc specific
+               SXE_CHECK_COMPILER_FLAGS([-qnoansialias -qlibansi], [dnl
+                       optiflags="${optiflags} -qnoansialias -qlibansi"])
+               SXE_CHECK_COMPILER_FLAGS([-qro -qmaxmem=20000], [dnl
+                       optiflags="${optiflags} -qro -qmaxmem=20000"])
+
+               ## icc specific
+               SXE_CHECK_COMPILER_FLAGS([-inline-level=2], [dnl
+                       ## ah, one of the new flavours, tasty
+                       optiflags="${optiflags} -inline-level=2"], [dnl
+                       SXE_CHECK_COMPILER_FLAGS([-Ob2], [dnl
+                               ## deprecated nowadays
+                               optiflags="${optiflags} -Ob2"])])
+
+               ## final check
+               if test -z "${optiflags}"; then
+                       SXE_CHECK_COMPILER_FLAGS([-O], [dnl
+                               ## The only POSIX-approved flag
+                               optiflags="-O"])
                fi
 
+               SXE_CFLAGS="$debugflags $optiflags $warnflags"
+
+               SXE_FEATFLAGS
                SXE_CFLAGS="$debugflags $featflags $optiflags $warnflags"
        else
                SXE_CFLAGS=${USER_CFLAGS}
@@ -1710,7 +1739,6 @@ respectively
 
 NOTE: -C <directory> option is not available on all systems
                ])
-
 ])dnl SXE_CHECK_CFLAGS
 
 
@@ -1761,4 +1789,38 @@ AC_DEFUN([SXE_CC_LIBRARY_LOCATION], [dnl
        popdef([LIBNAME])
 ])dnl SXE_CC_LIBRARY_LOCATION
 
+
+AC_DEFUN([SXE_CHECK_ANON_STRUCTS], [
+       AC_MSG_CHECKING([whether C compiler can cope with anonymous structures])
+       AC_LANG_PUSH(C)
+       AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+union __test_u {
+       int i;
+       struct {
+               char c;
+               char padc;
+               short int pads;
+       };
+};
+       ]], [[
+       union __test_u tmp = {.c = '4'};
+       ]])], [
+               sxe_cv_have_anon_structs="yes"
+       ], [
+               sxe_cv_have_anon_structs="no"
+       ])
+       AC_MSG_RESULT([${sxe_cv_have_anon_structs}])
+
+       if test "${sxe_cv_have_anon_structs}" = "yes"; then
+               AC_DEFINE([HAVE_ANON_STRUCTS], [1], [
+                       Whether c1x anon structs work])
+               $1
+               :
+       else
+               $2
+               :
+       fi
+       AC_LANG_POP()
+])dnl SXE_CHECK_ANON_STRUCTS
+
 dnl sxe-compiler.m4 ends here
index b2d3a18..c88a216 100644 (file)
@@ -36,6 +36,12 @@ might be wrong as well.
        ## seems to be a consistent choice throughout all libtools
        LT_CONVENIENCE_PREFIX="lt-"
        AC_SUBST([LT_CONVENIENCE_PREFIX])
+
+       ## prefix all the stuff in XCCLDFLAGS with XCCFLAG
+       ## assume XCCFLAG = -XCClinker for now
+       XCCFLAG="-XCClinker"
+       XCCLDFLAGS=$(echo "${XCCLDFLAGS}" | \
+               sed -e 's/\B-/'${XCCFLAG}' -/g')
 ])dnl SXE_CHECK_LIBTOOL
 
 AC_DEFUN([_SXE_CHECK_LT2], [dnl
index 7167593..06d5ac0 100644 (file)
@@ -1,13 +1,49 @@
 dnl sxe-linker.m4 -- Linker stuff, esp. dynamic linking
 dnl needed for emodules for one
 
+AC_DEFUN([SXE_CHECK_LINKER_FLAGS], [dnl
+dnl just like SXE_CHECK_COMPILER_FLAGS but calls the linker
+dnl SXE_CHECK_LINKER_FLAGS(<FLAG>, <ACTION-IF-FOUND>, <ACTION-IF-NOT-FOUND>,
+dnl     <ADDITIONAL-FLAGS>)
+       AC_MSG_CHECKING([whether linker accepts $1])
+
+       dnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
+       SXE_LANG_WERROR([push+on])
+       AS_LITERAL_IF([$1], [
+               AC_CACHE_VAL(AS_TR_SH(sxe_cv_[]_AC_LANG_ABBREV[]_flags_$1), [
+                       sxe_save_FLAGS=$[]_AC_LANG_PREFIX[]FLAGS
+                       _AC_LANG_PREFIX[]FLAGS="$4 ${XFLAG} $1"
+                       AC_LINK_IFELSE([AC_LANG_PROGRAM()],
+                               AS_TR_SH(sxe_cv_[]_AC_LANG_ABBREV[]_flags_$1)="yes",
+                               AS_TR_SH(sxe_cv_[]_AC_LANG_ABBREV[]_flags_$1)="no")
+                       _AC_LANG_PREFIX[]FLAGS=$sxe_save_FLAGS])], [
+               sxe_save_FLAGS=$[]_AC_LANG_PREFIX[]FLAGS
+               _AC_LANG_PREFIX[]FLAGS="$4 ${XFLAG} $1"
+               AC_LINK_IFELSE([AC_LANG_PROGRAM()],
+                       eval AS_TR_SH(sxe_cv_[]_AC_LANG_ABBREV[]_flags_$1)="yes",
+                       eval AS_TR_SH(sxe_cv_[]_AC_LANG_ABBREV[]_flags_$1)="no")
+               _AC_LANG_PREFIX[]FLAGS=$sxe_save_FLAGS])
+       eval sxe_check_linker_flags=$AS_TR_SH(sxe_cv_[]_AC_LANG_ABBREV[]_flags_$1)
+       SXE_LANG_WERROR([pop])
+
+       AC_MSG_RESULT([$sxe_check_linker_flags])
+       if test "$sxe_check_linker_flags" = "yes"; then
+               m4_default([$2], :)
+       else
+               m4_default([$3], :)
+       fi
+])dnl SXE_CHECK_LINKER_FLAGS
+
 
 AC_DEFUN([SXE_CHECK_LD_ZFLAG], [dnl
        pushdef([LD_ZFLAG], [$1])
        pushdef([cv_zflag], [sxe_cv_ld__z_]translit(LD_ZFLAG,[-.=],[___]))
 
-       AC_CACHE_CHECK([whether linker supports -z ]LD_ZFLAG[],
-               []cv_zflag[], [_SXE_CHECK_LD_ZFLAG(LD_ZFLAG)])
+       SXE_CHECK_LINKER_FLAGS([-z ]LD_ZFLAG[])
+
+dnl Use the check that actually calls the compiler/linker to examine the flags
+dnl    AC_CACHE_CHECK([whether linker supports -z ]LD_ZFLAG[],
+dnl            []cv_zflag[], [_SXE_CHECK_LD_ZFLAG(LD_ZFLAG)])
 
        popdef([cv_zflag])
        popdef([LD_ZFLAG])
@@ -40,12 +76,9 @@ AC_DEFUN([_SXE_CHECK_LD_ZFLAG], [dnl
        popdef([LD_ZFLAG])
 ])dnl _SXE_CHECK_LD_ZFLAG
 
-AC_DEFUN([SXE_CHECK_LD_NOCOMBRELOC], [dnl
-       SXE_CHECK_LD_ZFLAG([nocombreloc])
-])dnl SXE_CHECK_LD_NOCOMBRELOC
-
+AC_DEFUN([SXE_CHECK_LDFLAGS], [dnl
+       AC_REQUIRE([SXE_CHECK_COMPILER_XFLAG])
 
-AC_DEFUN([SXE_CHECK_LINKER_FLAGS], [dnl
        ## relocation
        SXE_CHECK_LD_ZFLAG([combreloc])
        SXE_CHECK_LD_ZFLAG([nocombreloc])
@@ -57,7 +90,26 @@ AC_DEFUN([SXE_CHECK_LINKER_FLAGS], [dnl
        ## binding policy
        SXE_CHECK_LD_ZFLAG([lazy])
        SXE_CHECK_LD_ZFLAG([now])
-])dnl SXE_CHECK_LINKER_FLAGS
+
+       LDFLAGS="${ldflags} ${ac_cv_env_LDFLAGS_value}"
+       AC_MSG_CHECKING([for preferred LDFLAGS])
+       AC_MSG_RESULT([${LDFLAGS}])
+
+       AC_MSG_NOTICE([
+If you wish to ADD your own flags you want to stop here and rerun the
+configure script like so:
+  configure LDFLAGS=<to-be-added-flags>
+
+You can always override the determined LDFLAGS, partially or totally,
+using
+  make -C <directory> LDFLAGS=<your-own-flags> [target]
+or
+  make LDFLAGS=<your-own-flags> [target]
+respectively
+
+NOTE: -C <directory> option is not available on all systems
+               ])
+])dnl SXE_CHECK_LDFLAGS
 
 AC_DEFUN([SXE_PREPEND_LINKER_FLAG], [dnl
        ## a convenience function to add such linker flags to variables
index f78f723..744a6d4 100644 (file)
@@ -41,6 +41,8 @@ sxesrcdir = $(top_srcdir)/src
 bldsrcdir = $(top_builddir)/src
 sxelispdir = $(abs_top_srcdir)/lisp
 bldlispdir = $(abs_top_builddir)/lisp
+sxelwlibdir = $(top_srcdir)/src/ui/lwlib
+bldlwlibdir = $(top_builddir)/src/ui/lwlib
 
 sitemodule_DATA = 
 
@@ -63,7 +65,14 @@ CLEANFILES = auto-autoloads.el* stage1 stage2
 
 SXEMACS = $(top_builddir)/src/sxemacs
 BITCH = $(SXEMACS) -batch
-BITCHENV = EMACSPACKAGEPATH= SOURCE_TREE_ROOT=$(abs_top_srcdir) BUILD_TREE_ROOT=$(abs_top_builddir)
+SXE_DYLD_PATH = $(bldsrcdir):$(bldsrcdir)/$(LT_OBJDIR):$(bldlwlibdir):$(bldlwlibdir)/$(LT_OBJDIR):$(DESTDIR)$(libdir)
+BATCHENV = DYLD_LIBRARY_PATH=$(SXE_DYLD_PATH):$$DYLD_LIBRARY_PATH:$(DYLD_LIBRARY_PATH) \
+       LD_LIBRARY_PATH=$(SXE_DYLD_PATH):$$LD_LIBRARY_PATH:$(LD_LIBRARY_PATH) \
+       SHLIB_PATH=$(SXE_DYLD_PATH):$$SHLIB_PATH:$(SHLIB_PATH)
+BITCHENV = $(BATCHENV) \
+       EMACSPACKAGEPATH= \
+       SOURCE_TREE_ROOT=$(abs_top_srcdir) \
+       BUILD_TREE_ROOT=$(abs_top_builddir)
 BATCH = $(BITCHENV) $(BITCH)
 PUREBATCH = $(BITCHENV) $(PITCH)
 
@@ -73,7 +82,8 @@ auto-autoloads.el: $(SXEMACS)
 
 SUFFIXES = .el .elc
 .el.elc: $(SXEMACS)
-       $(BATCH) -vanilla -l bytecomp -f batch-byte-compile-one-file-here $<
+       $(BATCHENV) $(BATCH) -vanilla -l bytecomp \
+               -f batch-byte-compile-one-file-here $<
 
 #stage1: all-am
 #      @touch $@
index efe979d..161483c 100644 (file)
@@ -50,7 +50,7 @@ headerdir = $(includedir)/$(instvarsepdir)
 AM_CFLAGS = $(dll_cflags) -DIMA_MODULE -DUSE_SXEMACS_CONFIG_H
 AM_CPPFLAGS = -I$(srcdir) -I$(builddir)  -I$(top_srcdir)/src \
        -I$(top_builddir)/src $(SXEMACS_INCLUDES) $(c_switch_all)
-AM_LDFLAGS = -module
+AM_LDFLAGS = -module $(XCCLDFLAGS)
 
 ## all the mods
 module_LTLIBRARIES =
index 767952e..947df24 100644 (file)
@@ -50,7 +50,7 @@ headerdir = $(includedir)/$(instvarsepdir)
 AM_CFLAGS = $(dll_cflags) -DIMA_MODULE
 AM_CPPFLAGS = -I$(srcdir) -I$(builddir)  -I$(top_srcdir)/src \
        -I$(top_builddir)/src $(SXEMACS_INCLUDES) $(c_switch_all)
-AM_LDFLAGS = -module
+AM_LDFLAGS = -module $(XCCLDFLAGS)
 AM_YFLAGS = -d
 
 ## all the mods
index 3b4d1a9..723b877 100644 (file)
@@ -50,7 +50,7 @@ headerdir = $(includedir)/$(instvarsepdir)
 AM_CFLAGS = $(dll_cflags) -DIMA_MODULE -DUSE_SXEMACS_CONFIG_H
 AM_CPPFLAGS = -I$(srcdir) -I$(builddir)  -I$(top_srcdir)/src \
        -I$(top_builddir)/src $(SXEMACS_INCLUDES) $(c_switch_all)
-AM_LDFLAGS = -module
+AM_LDFLAGS = -module $(XCCLDFLAGS)
 
 ## custom rules
 SXEMACS = $(top_builddir)/src/sxemacs
index bbe77ed..9515554 100644 (file)
@@ -19,7 +19,7 @@ eldap_ell_DEPENDENCIES = eldap_i.o eldap_i.c
 eldap_ell_CPPFLAGS = @SXEMACS_INCLUDES@
 eldap_ell_LINK = $(CCLD) --mod-output=$@
 eldap_ell_LDADD = eldap_i.o
-eldap_ell_LDFLAGS = @LDFLAGS@
+eldap_ell_LDFLAGS = @LDFLAGS@ $(XCCLDFLAGS)
 
 top_builddir = @top_builddir@
 top_build_prefix = $(top_builddir)/
index cf63347..4571923 100644 (file)
@@ -35,8 +35,8 @@ abs_top_builddir = @abs_top_builddir@
 abs_top_srcdir = @abs_top_srcdir@
 
 AM_CFLAGS = -Demacs $(OPENSSL_CFLAGS) -DUSE_SXEMACS_CONFIG_H -DXTSTRINGDEFINES
-AM_CPPFLAGS = -I$(srcdir) -I$(builddir) -I$(top_builddir) $(c_switch_general) $(LTDLINCL)
-AM_LDFLAGS = $(OPENSSL_LDFLAGS) $(ENT_LDFLAGS) $(LIBLTDL)
+AM_CPPFLAGS = -I$(srcdir) -I$(builddir) -I$(top_builddir) $(c_switch_system) $(LTDLINCL)
+AM_LDFLAGS = $(OPENSSL_LDFLAGS) $(ENT_LDFLAGS) $(LIBLTDL) $(XCCLDFLAGS)
 
 headerdir = $(includedir)/$(instvarsepdir)
 sheaderdir = $(headerdir)/s
@@ -247,9 +247,10 @@ AALFILE = $(bldlispdir)/auto-autoloads.el
 AALCFILE = $(bldlispdir)/auto-autoloads.elc
 BITCH = $(SXEMACS) -batch
 SXE_DYLD_PATH = $(bldsrcdir):$(bldsrcdir)/$(LT_OBJDIR):$(bldlwlibdir):$(bldlwlibdir)/$(LT_OBJDIR):$(DESTDIR)$(libdir)
-BITCHENV = DYLD_LIBRARY_PATH=$(SXE_DYLD_PATH):$$DYLD_LIBRARY_PATH:$(DYLD_LIBRARY_PATH) \
+BATCHENV = DYLD_LIBRARY_PATH=$(SXE_DYLD_PATH):$$DYLD_LIBRARY_PATH:$(DYLD_LIBRARY_PATH) \
        LD_LIBRARY_PATH=$(SXE_DYLD_PATH):$$LD_LIBRARY_PATH:$(LD_LIBRARY_PATH) \
-       SHLIB_PATH=$(SXE_DYLD_PATH):$$SHLIB_PATH:$(SHLIB_PATH) \
+       SHLIB_PATH=$(SXE_DYLD_PATH):$$SHLIB_PATH:$(SHLIB_PATH)
+BITCHENV = $(BATCHENV) \
        EMACSDEBUGPATHS=1 EMACSPACKAGEPATH= \
        SOURCE_TREE_ROOT=$(sxe_srcdir) \
        BUILD_TREE_ROOT=$(sxe_blddir)
@@ -339,6 +340,7 @@ sxemacs.dmp: $(SXEMACS) $(archlib_DATA) $(bldlispdir)/update-elc.stamp
                        (cd $(LT_OBJDIR); \
                        $(LN_S) -f ../$@ $@); \
                fi; \
+               $(BATCHENV) \
                SOURCE_TREE_ROOT= BUILD_TREE_ROOT= \
                        $(BITCH) -f list-load-path-shadows; \
        fi
index 689144b..5729cda 100644 (file)
@@ -59,7 +59,7 @@ libsxelw_Xt_la_DEPENDENCIES = $(lwlib_objs:.o=.lo)
 libsxelw_Xt_la_LIBADD = $(lwlib_objs:.o=.lo) \
        $(X_LIBS) $(ld_libs_window_system)
 libsxelw_Xt_la_CPPFLAGS = $(AM_CPPFLAGS)
-libsxelw_Xt_la_LDFLAGS = $(AM_LDFLAGS) $(lib_gcc)
+libsxelw_Xt_la_LDFLAGS = $(AM_LDFLAGS) $(lib_gcc) $(XCCLDFLAGS)
 if WITH_BDWGC
 libsxelw_Xt_la_CPPFLAGS += $(BDWGC_CPPFLAGS)
 libsxelw_Xt_la_LDFLAGS += $(BDWGC_LDFLAGS) $(BDWGC_LIBS)
index 58a2a37..ee2a3eb 100644 (file)
@@ -37,6 +37,8 @@ LC_ALL=C
 
 sxesrcdir = $(top_srcdir)/src
 bldsrcdir = $(top_builddir)/src
+sxelwlibdir = $(top_srcdir)/src/ui/lwlib
+bldlwlibdir = $(top_builddir)/src/ui/lwlib
 
 misc_tests = frame.el glyph-test.el gutter-test.el                     \
        redisplay-tests.el reproduce-bugs.el
@@ -72,32 +74,37 @@ EXTRA_DIST = $(misc_tests) $(gtk_tests) $(mule_tests)               \
 CLEANFILES = stage1 stage2
 
 
+SXE_DYLD_PATH = $(bldsrcdir):$(bldsrcdir)/$(LT_OBJDIR):$(bldlwlibdir):$(bldlwlibdir)/$(LT_OBJDIR):$(DESTDIR)$(libdir)
+BATCHENV = DYLD_LIBRARY_PATH=$(SXE_DYLD_PATH):$$DYLD_LIBRARY_PATH:$(DYLD_LIBRARY_PATH) \
+       LD_LIBRARY_PATH=$(SXE_DYLD_PATH):$$LD_LIBRARY_PATH:$(LD_LIBRARY_PATH) \
+       SHLIB_PATH=$(SXE_DYLD_PATH):$$SHLIB_PATH:$(SHLIB_PATH)
 ### Produces strange banner
 SXEMACS = $(bldsrcdir)/sxemacs
 SXEDMP = $(SXEMACS).dmp
 testdir = $(srcdir)
 testautomdir = $(testdir)/automated
-tests_environment = $(SXEMACS) -batch -l ${testautomdir}/test-harness.el \
-       -f batch-test-emacs $(testautomdir)
+tests_environment = $(BATCHENV) \
+       $(SXEMACS) -batch -l ${testautomdir}/test-harness.el \
+               -f batch-test-emacs $(testautomdir)
 
 ## Use our former check target
 check-am: $(SXEMACS) $(SXEDMP)
        $(tests_environment)
 
 check-formats: $(SXEMACS) $(SXEDMP)
-       $(SXEMACS) -l ${testautomdir}/test-harness.el \
+       $(BATCHENV) $(SXEMACS) -l ${testautomdir}/test-harness.el \
        -f batch-test-emacs $(testautomdir)/format-tests.el
 
 check-map: $(SXEMACS) $(SXEDMP)
-       $(SXEMACS) -l ${testautomdir}/test-harness.el \
+       $(BATCHENV) $(SXEMACS) -l ${testautomdir}/test-harness.el \
        -f batch-test-emacs $(testautomdir)/map-tests.el
 
 check-skiplists: $(SXEMACS) $(SXEDMP)
-       $(SXEMACS) -l ${testautomdir}/test-harness.el \
+       $(BATCHENV) $(SXEMACS) -l ${testautomdir}/test-harness.el \
        -f batch-test-emacs $(testautomdir)/skiplist-tests.el
 
 check-%: $(SXEMACS) $(SXEDMP)
-       $(SXEMACS) -l ${testautomdir}/test-harness.el \
+       $(BATCHENV) $(SXEMACS) -l ${testautomdir}/test-harness.el \
        -f batch-test-emacs $(testautomdir)/$*-tests.el