summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
Diffstat (limited to 'source4')
-rw-r--r--source4/build/m4/check_ld.m4196
-rw-r--r--source4/build/m4/rewrite.m4241
-rw-r--r--source4/configure.in5
-rw-r--r--source4/include/system/config.m443
-rw-r--r--source4/lib/appweb/config.m41
-rw-r--r--source4/lib/charset/util_unistr.c2
-rw-r--r--source4/lib/netif/config.m42
-rw-r--r--source4/lib/replace/config.m43
-rw-r--r--source4/lib/replace/replace.c1
-rw-r--r--source4/main.mk1
-rw-r--r--source4/nsswitch/config.m41
11 files changed, 252 insertions, 244 deletions
diff --git a/source4/build/m4/check_ld.m4 b/source4/build/m4/check_ld.m4
index 3840459894..b98c2dab3c 100644
--- a/source4/build/m4/check_ld.m4
+++ b/source4/build/m4/check_ld.m4
@@ -1,6 +1,7 @@
dnl SMB Build Environment LD Checks
dnl -------------------------------------------------------
dnl Copyright (C) Stefan (metze) Metzmacher 2004
+dnl Copyright (C) Jelmer Vernooij 2006
dnl Released under the GNU GPL
dnl -------------------------------------------------------
dnl
@@ -8,3 +9,198 @@ dnl Check if we use GNU ld
AC_PATH_PROG(LD, ld)
AC_PROG_LD_GNU
AC_PATH_PROG(AR, ar)
+
+AC_SUBST(SHLIBEXT)
+AC_SUBST(LDSHFLAGS)
+AC_SUBST(SONAMEFLAG)
+AC_SUBST(DYNEXP)
+AC_SUBST(PICFLAG)
+
+AC_SUBST(BLDSHARED)
+# Assume non-shared by default and override below
+BLDSHARED="false"
+
+# these are the defaults, good for lots of systems
+DYNEXP=
+HOST_OS="$host_os"
+LDSHFLAGS="-shared"
+SONAMEFLAG=""
+SHLD="\${CC}"
+PICFLAG=""
+PICSUFFIX="po"
+SHLIBEXT="so"
+
+AC_MSG_CHECKING([ability to build shared libraries])
+
+# and these are for particular systems
+case "$host_os" in
+ *linux*) AC_DEFINE(LINUX,1,[Whether the host os is linux])
+ BLDSHARED="true"
+ LDSHFLAGS="-shared"
+ DYNEXP="-Wl,--export-dynamic"
+ PICFLAG="-fPIC"
+ SONAMEFLAG="-Wl,-soname="
+ AC_DEFINE(STAT_ST_BLOCKSIZE,512)
+ ;;
+ *solaris*) AC_DEFINE(SUNOS5,1,[Whether the host os is solaris])
+ BLDSHARED="true"
+ LDSHFLAGS="-G"
+ if test "${GCC}" = "yes"; then
+ PICFLAG="-fPIC"
+ if test "${ac_cv_prog_gnu_ld}" = "yes"; then
+ DYNEXP="-Wl,-E"
+ fi
+ else
+ PICFLAG="-KPIC"
+ ## ${CFLAGS} added for building 64-bit shared
+ ## libs using Sun's Compiler
+ LDSHFLAGS="-G \${CFLAGS}"
+ PICSUFFIX="po.o"
+ fi
+ AC_DEFINE(STAT_ST_BLOCKSIZE,512,[The size of a block])
+ ;;
+ *sunos*) AC_DEFINE(SUNOS4,1,[Whether the host os is sunos4])
+ BLDSHARED="true"
+ LDSHFLAGS="-G"
+ PICFLAG="-KPIC" # Is this correct for SunOS
+ AC_DEFINE(STAT_ST_BLOCKSIZE,512)
+ ;;
+ *netbsd* | *freebsd*) BLDSHARED="true"
+ LDSHFLAGS="-shared"
+ DYNEXP="-Wl,--export-dynamic"
+ PICFLAG="-fPIC -DPIC"
+ AC_DEFINE(STAT_ST_BLOCKSIZE,512,[The size of a block])
+ ;;
+ *openbsd*) BLDSHARED="true"
+ LDSHFLAGS="-shared"
+ DYNEXP="-Wl,-Bdynamic"
+ PICFLAG="-fPIC"
+ AC_DEFINE(STAT_ST_BLOCKSIZE,512,[The size of a block])
+ ;;
+ *irix*) AC_DEFINE(IRIX,1,[Whether the host os is irix])
+ ATTEMPT_WRAP32_BUILD=yes
+ BLDSHARED="true"
+ LDSHFLAGS="-set_version sgi1.0 -shared"
+ SONAMEFLAG="-soname "
+ SHLD="\${LD}"
+ if test "${GCC}" = "yes"; then
+ PICFLAG="-fPIC"
+ else
+ PICFLAG="-KPIC"
+ fi
+ AC_DEFINE(STAT_ST_BLOCKSIZE,512,[The size of a block])
+ ;;
+ *aix*) AC_DEFINE(AIX,1,[Whether the host os is aix])
+ BLDSHARED="true"
+ LDSHFLAGS="-Wl,-bexpall,-bM:SRE,-bnoentry,-berok"
+ DYNEXP="-Wl,-brtl,-bexpall,-bbigtoc"
+ PICFLAG="-O2"
+ if test "${GCC}" != "yes"; then
+ ## for funky AIX compiler using strncpy()
+ CFLAGS="$CFLAGS -D_LINUX_SOURCE_COMPAT -qmaxmem=32000"
+ fi
+
+ AC_DEFINE(STAT_ST_BLOCKSIZE,DEV_BSIZE,[The size of a block])
+ ;;
+ *hpux*) AC_DEFINE(HPUX,1,[Whether the host os is HPUX])
+ SHLIBEXT="sl"
+ # Use special PIC flags for the native HP-UX compiler.
+ if test $ac_cv_prog_cc_Ae = yes; then
+ BLDSHARED="true"
+ SHLD="/usr/bin/ld"
+ LDSHFLAGS="-B symbolic -b -z"
+ SONAMEFLAG="+h "
+ PICFLAG="+z"
+ fi
+ DYNEXP="-Wl,-E"
+ AC_DEFINE(STAT_ST_BLOCKSIZE,8192,[The size of a block])
+ ;;
+ *qnx*) AC_DEFINE(QNX,1,[Whether the host os is qnx])
+ AC_DEFINE(STAT_ST_BLOCKSIZE,512)
+ ;;
+ *osf*) AC_DEFINE(OSF1,1,[Whether the host os is osf1])
+ BLDSHARED="true"
+ LDSHFLAGS="-shared"
+ SONAMEFLAG="-Wl,-soname,"
+ PICFLAG="-fPIC"
+ AC_DEFINE(STAT_ST_BLOCKSIZE,512)
+ ;;
+ *sco*) AC_DEFINE(SCO,1,[Whether the host os is sco unix])
+ AC_DEFINE(STAT_ST_BLOCKSIZE,512)
+ ;;
+ *unixware*) AC_DEFINE(UNIXWARE,1,[Whether the host os is unixware])
+ BLDSHARED="true"
+ LDSHFLAGS="-shared"
+ SONAMEFLAG="-Wl,-soname,"
+ PICFLAG="-KPIC"
+ AC_DEFINE(STAT_ST_BLOCKSIZE,512)
+ ;;
+ *next2*) AC_DEFINE(NEXT2,1,[Whether the host os is NeXT v2])
+ AC_DEFINE(STAT_ST_BLOCKSIZE,512)
+ ;;
+ *dgux*) AC_CHECK_PROG( ROFF, groff, [groff -etpsR -Tascii -man])
+ AC_DEFINE(STAT_ST_BLOCKSIZE,512)
+ ;;
+ *sysv4*) AC_DEFINE(SYSV,1,[Whether this is a system V system])
+ case "$host" in
+ *-univel-*) if [ test "$GCC" != yes ]; then
+ AC_DEFINE(HAVE_MEMSET,1,[Whether memset() is available])
+ fi
+ LDSHFLAGS="-G"
+ DYNEXP="-Bexport"
+ ;;
+ *mips-sni-sysv4*) AC_DEFINE(RELIANTUNIX,1,[Whether the host os is reliantunix]);;
+ esac
+ AC_DEFINE(STAT_ST_BLOCKSIZE,512)
+ ;;
+
+ *sysv5*) AC_DEFINE(SYSV,1,[Whether this is a system V system])
+ if [ test "$GCC" != yes ]; then
+ AC_DEFINE(HAVE_MEMSET,1,[Whether memset() is available])
+ fi
+ LDSHFLAGS="-G"
+ AC_DEFINE(STAT_ST_BLOCKSIZE,512)
+ ;;
+ *-vms)
+ BLDSHARED="false"
+ LDSHFLAGS=""
+ ;;
+ *vos*) AC_DEFINE(STAT_ST_BLOCKSIZE,4096)
+ BLDSHARED="false"
+ LDSHFLAGS=""
+ ;;
+ *)
+ AC_DEFINE(STAT_ST_BLOCKSIZE,512)
+ ;;
+esac
+AC_MSG_RESULT($BLDSHARED)
+AC_MSG_CHECKING([linker flags for shared libraries])
+AC_MSG_RESULT([$LDSHFLAGS])
+AC_MSG_CHECKING([compiler flags for position-independent code])
+AC_MSG_RESULT([$PICFLAGS])
+
+#######################################################
+# test whether building a shared library actually works
+if test $BLDSHARED = true; then
+AC_CACHE_CHECK([whether building shared libraries actually works],
+ [ac_cv_shlib_works],[
+ ac_cv_shlib_works=no
+ # try building a trivial shared library
+ if test "$PICSUFFIX" = "po"; then
+ $CC $CPPFLAGS $CFLAGS $PICFLAG -c -o shlib.po ${srcdir-.}/build/tests/shlib.c &&
+ $CC $CPPFLAGS $CFLAGS `eval echo $LDSHFLAGS` -o shlib.so shlib.po &&
+ ac_cv_shlib_works=yes
+ else
+ $CC $CPPFLAGS $CFLAGS $PICFLAG -c -o shlib.$PICSUFFIX ${srcdir-.}/build/tests/shlib.c &&
+ mv shlib.$PICSUFFIX shlib.po &&
+ $CC $CPPFLAGS $CFLAGS `eval echo $LDSHFLAGS` -o shlib.so shlib.po &&
+ ac_cv_shlib_works=yes
+ fi
+ rm -f shlib.so shlib.po
+])
+if test $ac_cv_shlib_works = no; then
+ BLDSHARED=false
+fi
+fi
+
+
diff --git a/source4/build/m4/rewrite.m4 b/source4/build/m4/rewrite.m4
index deac542e2b..cca933b8da 100644
--- a/source4/build/m4/rewrite.m4
+++ b/source4/build/m4/rewrite.m4
@@ -1,12 +1,6 @@
dnl Checks for programs.
dnl Unique-to-Samba variables we'll be playing with.
-AC_SUBST(SHLIBEXT)
-AC_SUBST(LDSHFLAGS)
-AC_SUBST(SONAMEFLAG)
-AC_SUBST(DYNEXP)
-AC_SUBST(PICFLAG)
-
AC_SYS_LARGEFILE
#
@@ -46,21 +40,7 @@ case "$host_os" in
esac
-
-AC_HEADER_DIRENT
-AC_HEADER_TIME
-AC_HEADER_SYS_WAIT
-AC_CHECK_HEADERS(sys/select.h fcntl.h sys/fcntl.h sys/time.h stdarg.h)
-AC_CHECK_HEADERS(utime.h grp.h sys/id.h limits.h compat.h math.h)
-AC_CHECK_HEADERS(ctype.h sys/wait.h sys/resource.h sys/ioctl.h sys/ipc.h sys/mode.h)
-AC_CHECK_HEADERS(sys/mman.h sys/filio.h sys/priv.h sys/shm.h string.h strings.h stdlib.h)
-AC_CHECK_HEADERS(sys/fs/s5param.h sys/filsys.h termios.h termio.h)
-AC_CHECK_HEADERS(fnmatch.h pwd.h sys/termio.h sys/time.h)
-AC_CHECK_HEADERS(locale.h shadow.h)
-AC_CHECK_HEADERS(nss.h nss_common.h ns_api.h sys/security.h)
-AC_CHECK_HEADERS(sys/acl.h)
-
-AC_CHECK_HEADERS(sys/capability.h)
+AC_CHECK_HEADERS(stdarg.h string.h )
AC_TYPE_SIGNAL
@@ -76,20 +56,6 @@ AC_CHECK_TYPE(loff_t,off_t)
AC_CHECK_TYPE(offset_t,loff_t)
AC_CHECK_TYPES(long long)
-
-AC_CACHE_CHECK([for sig_atomic_t type],samba_cv_sig_atomic_t, [
- AC_TRY_COMPILE([
-#include <sys/types.h>
-#if STDC_HEADERS
-#include <stdlib.h>
-#include <stddef.h>
-#endif
-#include <signal.h>],[sig_atomic_t i = 0],
- samba_cv_sig_atomic_t=yes,samba_cv_sig_atomic_t=no)])
-if test x"$samba_cv_sig_atomic_t" = x"yes"; then
- AC_DEFINE(HAVE_SIG_ATOMIC_T_TYPE,1,[Whether we have the atomic_t variable type])
-fi
-
AC_FUNC_MEMCMP
AC_CHECK_FUNCS(setsid pipe crypt16 getauthuid)
@@ -97,193 +63,6 @@ AC_CHECK_FUNCS(strftime sigprocmask sigblock sigaction)
AC_CHECK_FUNCS(setgroups sysconf getpwanam srandom random srand rand usleep)
AC_CHECK_FUNCS(backtrace setbuffer)
-AC_SUBST(BLDSHARED)
-# Assume non-shared by default and override below
-BLDSHARED="false"
-
-# these are the defaults, good for lots of systems
-DYNEXP=
-HOST_OS="$host_os"
-LDSHFLAGS="-shared"
-SONAMEFLAG=""
-SHLD="\${CC}"
-PICFLAG=""
-PICSUFFIX="po"
-SHLIBEXT="so"
-
-AC_MSG_CHECKING([ability to build shared libraries])
-
-# and these are for particular systems
-case "$host_os" in
- *linux*) AC_DEFINE(LINUX,1,[Whether the host os is linux])
- BLDSHARED="true"
- LDSHFLAGS="-shared"
- DYNEXP="-Wl,--export-dynamic"
- PICFLAG="-fPIC"
- SONAMEFLAG="-Wl,-soname="
- AC_DEFINE(STAT_ST_BLOCKSIZE,512)
- ;;
- *solaris*) AC_DEFINE(SUNOS5,1,[Whether the host os is solaris])
- BLDSHARED="true"
- LDSHFLAGS="-G"
- if test "${GCC}" = "yes"; then
- PICFLAG="-fPIC"
- if test "${ac_cv_prog_gnu_ld}" = "yes"; then
- DYNEXP="-Wl,-E"
- fi
- else
- PICFLAG="-KPIC"
- ## ${CFLAGS} added for building 64-bit shared
- ## libs using Sun's Compiler
- LDSHFLAGS="-G \${CFLAGS}"
- PICSUFFIX="po.o"
- fi
- AC_DEFINE(STAT_ST_BLOCKSIZE,512,[The size of a block])
- ;;
- *sunos*) AC_DEFINE(SUNOS4,1,[Whether the host os is sunos4])
- BLDSHARED="true"
- LDSHFLAGS="-G"
- PICFLAG="-KPIC" # Is this correct for SunOS
- AC_DEFINE(STAT_ST_BLOCKSIZE,512)
- ;;
- *netbsd* | *freebsd*) BLDSHARED="true"
- LDSHFLAGS="-shared"
- DYNEXP="-Wl,--export-dynamic"
- PICFLAG="-fPIC -DPIC"
- AC_DEFINE(STAT_ST_BLOCKSIZE,512,[The size of a block])
- ;;
- *openbsd*) BLDSHARED="true"
- LDSHFLAGS="-shared"
- DYNEXP="-Wl,-Bdynamic"
- PICFLAG="-fPIC"
- AC_DEFINE(STAT_ST_BLOCKSIZE,512,[The size of a block])
- ;;
- *irix*) AC_DEFINE(IRIX,1,[Whether the host os is irix])
- ATTEMPT_WRAP32_BUILD=yes
- BLDSHARED="true"
- LDSHFLAGS="-set_version sgi1.0 -shared"
- SONAMEFLAG="-soname "
- SHLD="\${LD}"
- if test "${GCC}" = "yes"; then
- PICFLAG="-fPIC"
- else
- PICFLAG="-KPIC"
- fi
- AC_DEFINE(STAT_ST_BLOCKSIZE,512,[The size of a block])
- ;;
- *aix*) AC_DEFINE(AIX,1,[Whether the host os is aix])
- BLDSHARED="true"
- LDSHFLAGS="-Wl,-bexpall,-bM:SRE,-bnoentry,-berok"
- DYNEXP="-Wl,-brtl,-bexpall,-bbigtoc"
- PICFLAG="-O2"
- if test "${GCC}" != "yes"; then
- ## for funky AIX compiler using strncpy()
- CFLAGS="$CFLAGS -D_LINUX_SOURCE_COMPAT -qmaxmem=32000"
- fi
-
- AC_DEFINE(STAT_ST_BLOCKSIZE,DEV_BSIZE,[The size of a block])
- ;;
- *hpux*) AC_DEFINE(HPUX,1,[Whether the host os is HPUX])
- SHLIBEXT="sl"
- # Use special PIC flags for the native HP-UX compiler.
- if test $ac_cv_prog_cc_Ae = yes; then
- BLDSHARED="true"
- SHLD="/usr/bin/ld"
- LDSHFLAGS="-B symbolic -b -z"
- SONAMEFLAG="+h "
- PICFLAG="+z"
- fi
- DYNEXP="-Wl,-E"
- AC_DEFINE(STAT_ST_BLOCKSIZE,8192,[The size of a block])
- ;;
- *qnx*) AC_DEFINE(QNX,1,[Whether the host os is qnx])
- AC_DEFINE(STAT_ST_BLOCKSIZE,512)
- ;;
- *osf*) AC_DEFINE(OSF1,1,[Whether the host os is osf1])
- BLDSHARED="true"
- LDSHFLAGS="-shared"
- SONAMEFLAG="-Wl,-soname,"
- PICFLAG="-fPIC"
- AC_DEFINE(STAT_ST_BLOCKSIZE,512)
- ;;
- *sco*) AC_DEFINE(SCO,1,[Whether the host os is sco unix])
- AC_DEFINE(STAT_ST_BLOCKSIZE,512)
- ;;
- *unixware*) AC_DEFINE(UNIXWARE,1,[Whether the host os is unixware])
- BLDSHARED="true"
- LDSHFLAGS="-shared"
- SONAMEFLAG="-Wl,-soname,"
- PICFLAG="-KPIC"
- AC_DEFINE(STAT_ST_BLOCKSIZE,512)
- ;;
- *next2*) AC_DEFINE(NEXT2,1,[Whether the host os is NeXT v2])
- AC_DEFINE(STAT_ST_BLOCKSIZE,512)
- ;;
- *dgux*) AC_CHECK_PROG( ROFF, groff, [groff -etpsR -Tascii -man])
- AC_DEFINE(STAT_ST_BLOCKSIZE,512)
- ;;
- *sysv4*) AC_DEFINE(SYSV,1,[Whether this is a system V system])
- case "$host" in
- *-univel-*) if [ test "$GCC" != yes ]; then
- AC_DEFINE(HAVE_MEMSET,1,[Whether memset() is available])
- fi
- LDSHFLAGS="-G"
- DYNEXP="-Bexport"
- ;;
- *mips-sni-sysv4*) AC_DEFINE(RELIANTUNIX,1,[Whether the host os is reliantunix]);;
- esac
- AC_DEFINE(STAT_ST_BLOCKSIZE,512)
- ;;
-
- *sysv5*) AC_DEFINE(SYSV,1,[Whether this is a system V system])
- if [ test "$GCC" != yes ]; then
- AC_DEFINE(HAVE_MEMSET,1,[Whether memset() is available])
- fi
- LDSHFLAGS="-G"
- AC_DEFINE(STAT_ST_BLOCKSIZE,512)
- ;;
- *-vms)
- BLDSHARED="false"
- LDSHFLAGS=""
- ;;
- *vos*) AC_DEFINE(STAT_ST_BLOCKSIZE,4096)
- BLDSHARED="false"
- LDSHFLAGS=""
- ;;
- *)
- AC_DEFINE(STAT_ST_BLOCKSIZE,512)
- ;;
-esac
-AC_MSG_RESULT($BLDSHARED)
-AC_MSG_CHECKING([linker flags for shared libraries])
-AC_MSG_RESULT([$LDSHFLAGS])
-AC_MSG_CHECKING([compiler flags for position-independent code])
-AC_MSG_RESULT([$PICFLAGS])
-
-#######################################################
-# test whether building a shared library actually works
-if test $BLDSHARED = true; then
-AC_CACHE_CHECK([whether building shared libraries actually works],
- [ac_cv_shlib_works],[
- ac_cv_shlib_works=no
- # try building a trivial shared library
- if test "$PICSUFFIX" = "po"; then
- $CC $CPPFLAGS $CFLAGS $PICFLAG -c -o shlib.po ${srcdir-.}/build/tests/shlib.c &&
- $CC $CPPFLAGS $CFLAGS `eval echo $LDSHFLAGS` -o shlib.so shlib.po &&
- ac_cv_shlib_works=yes
- else
- $CC $CPPFLAGS $CFLAGS $PICFLAG -c -o shlib.$PICSUFFIX ${srcdir-.}/build/tests/shlib.c &&
- mv shlib.$PICSUFFIX shlib.po &&
- $CC $CPPFLAGS $CFLAGS `eval echo $LDSHFLAGS` -o shlib.so shlib.po &&
- ac_cv_shlib_works=yes
- fi
- rm -f shlib.so shlib.po
-])
-if test $ac_cv_shlib_works = no; then
- BLDSHARED=false
-fi
-fi
-
AC_CACHE_CHECK([for Linux kernel oplocks],samba_cv_HAVE_KERNEL_OPLOCKS_LINUX,[
AC_TRY_RUN([
#include <sys/types.h>
@@ -369,24 +148,6 @@ if test x"$samba_cv_HAVE_MMAP" = x"yes"; then
AC_DEFINE(HAVE_MMAP,1,[Whether mmap works])
fi
-case "$host_os" in
-*linux*)
-AC_CACHE_CHECK([for broken RedHat 7.2 system header files],samba_cv_BROKEN_REDHAT_7_SYSTEM_HEADERS,[
-AC_TRY_COMPILE([
-#ifdef HAVE_SYS_VFS_H
-#include <sys/vfs.h>
-#endif
-#ifdef HAVE_SYS_CAPABILITY_H
-#include <sys/capability.h>
-#endif
-],[int i;],
- samba_cv_BROKEN_REDHAT_7_SYSTEM_HEADERS=no,samba_cv_BROKEN_REDHAT_7_SYSTEM_HEADERS=yes)])
-if test x"$samba_cv_BROKEN_REDHAT_7_SYSTEM_HEADERS" = x"yes"; then
- AC_DEFINE(BROKEN_REDHAT_7_SYSTEM_HEADERS,1,[Broken RedHat 7.2 system header files])
-fi
-;;
-esac
-
AC_CACHE_CHECK([for O_DIRECT flag to open(2)],samba_cv_HAVE_OPEN_O_DIRECT,[
AC_TRY_COMPILE([
#include <unistd.h>
diff --git a/source4/configure.in b/source4/configure.in
index 1dedd148f5..bec62f5b0a 100644
--- a/source4/configure.in
+++ b/source4/configure.in
@@ -11,10 +11,11 @@ AC_CONFIG_HEADER(include/config_tmp.h)
# Configuration rules.
sinclude(build/m4/env.m4)
-sinclude(build/m4/rewrite.m4)
sinclude(lib/replace/config.m4)
sinclude(lib/replace/win32/config.m4)
sinclude(lib/replace/repdir/config.m4)
+sinclude(include/system/config.m4)
+sinclude(build/m4/rewrite.m4)
sinclude(heimdal_build/config.m4)
sinclude(lib/util/fsusage.m4)
sinclude(lib/util/capability.m4)
@@ -45,6 +46,8 @@ sinclude(web_server/config.m4)
sinclude(auth/config.m4)
sinclude(kdc/config.m4)
sinclude(ntvfs/sysdep/config.m4)
+sinclude(lib/appweb/config.m4)
+sinclude(nsswitch/config.m4)
AC_ARG_ENABLE(dso,
[ --enable-dso Enable building internal libraries as DSO's (experimental)],
diff --git a/source4/include/system/config.m4 b/source4/include/system/config.m4
new file mode 100644
index 0000000000..2c62b571e0
--- /dev/null
+++ b/source4/include/system/config.m4
@@ -0,0 +1,43 @@
+# filesys
+AC_HEADER_DIRENT
+AC_CHECK_HEADERS(fcntl.h sys/fcntl.h sys/acl.h sys/resource.h sys/ioctl.h sys/mode.h sys/filio.h sys/fs/s5param.h sys/filsys.h )
+
+# select
+AC_CHECK_HEADERS(sys/select.h)
+
+# time
+AC_CHECK_HEADERS(sys/time.h utime.h)
+AC_HEADER_TIME
+
+# wait
+AC_HEADER_SYS_WAIT
+AC_CACHE_CHECK([for sig_atomic_t type],samba_cv_sig_atomic_t, [
+ AC_TRY_COMPILE([
+#include <sys/types.h>
+#if STDC_HEADERS
+#include <stdlib.h>
+#include <stddef.h>
+#endif
+#include <signal.h>],[sig_atomic_t i = 0],
+ samba_cv_sig_atomic_t=yes,samba_cv_sig_atomic_t=no)])
+if test x"$samba_cv_sig_atomic_t" = x"yes"; then
+ AC_DEFINE(HAVE_SIG_ATOMIC_T_TYPE,1,[Whether we have the atomic_t variable type])
+fi
+
+# capability
+AC_CHECK_HEADERS(sys/capability.h)
+
+# passwd
+AC_CHECK_HEADERS(grp.h sys/id.h compat.h shadow.h sys/priv.h pwd.h sys/security.h)
+
+# iconv
+AC_CHECK_HEADERS(ctype.h locale.h)
+
+# glob
+AC_CHECK_HEADERS(fnmatch.h)
+
+# shmem
+AC_CHECK_HEADERS(sys/ipc.h sys/mman.h sys/shm.h )
+
+# terminal
+AC_CHECK_HEADERS(termios.h termio.h sys/termio.h )
diff --git a/source4/lib/appweb/config.m4 b/source4/lib/appweb/config.m4
new file mode 100644
index 0000000000..69b4048c4a
--- /dev/null
+++ b/source4/lib/appweb/config.m4
@@ -0,0 +1 @@
+AC_CHECK_HEADERS(math.h)
diff --git a/source4/lib/charset/util_unistr.c b/source4/lib/charset/util_unistr.c
index f55e390856..1eb198d6f9 100644
--- a/source4/lib/charset/util_unistr.c
+++ b/source4/lib/charset/util_unistr.c
@@ -268,7 +268,7 @@ _PUBLIC_ BOOL strcsequal_w(const char *s1,const char *s2)
**/
_PUBLIC_ void string_replace_w(char *s, char oldc, char newc)
{
- while (*s) {
+ for (; s && *s; s++) {
size_t size;
codepoint_t c = next_codepoint(s, &size);
if (c == oldc) {
diff --git a/source4/lib/netif/config.m4 b/source4/lib/netif/config.m4
index 76d1bfa9d5..9880440f21 100644
--- a/source4/lib/netif/config.m4
+++ b/source4/lib/netif/config.m4
@@ -1,4 +1,4 @@
-AC_CHECK_HEADERS(arpa/inet.h net/if.h netdb.h netinet/in.h)
+AC_CHECK_HEADERS(arpa/inet.h net/if.h netdb.h netinet/in.h sys/time.h)
AC_CHECK_HEADERS(netinet/ip.h netinet/tcp.h netinet/in_systm.h netinet/in_ip.h)
##################
diff --git a/source4/lib/replace/config.m4 b/source4/lib/replace/config.m4
index bf46bdcc58..12e3607bb4 100644
--- a/source4/lib/replace/config.m4
+++ b/source4/lib/replace/config.m4
@@ -81,6 +81,7 @@ AC_HAVE_DECL(vasprintf, [#include <stdio.h>])
AC_HAVE_DECL(vsnprintf, [#include <stdio.h>])
AC_HAVE_DECL(snprintf, [#include <stdio.h>])
AC_CHECK_FUNCS(snprintf vsnprintf asprintf vasprintf)
+AC_CHECK_HEADERS(strings.h)
AC_CACHE_CHECK([for C99 vsnprintf],samba_cv_HAVE_C99_VSNPRINTF,[
AC_TRY_RUN([
@@ -177,4 +178,4 @@ else
fi
fi
-AC_CHECK_HEADERS([sys/param.h])
+AC_CHECK_HEADERS([sys/param.h limits.h])
diff --git a/source4/lib/replace/replace.c b/source4/lib/replace/replace.c
index 5d3ef52987..90f05d6c90 100644
--- a/source4/lib/replace/replace.c
+++ b/source4/lib/replace/replace.c
@@ -22,6 +22,7 @@
#include "system/wait.h"
#include "system/time.h"
#include "system/network.h"
+#include "system/filesys.h"
#include "system/iconv.h"
void replace_dummy(void);
diff --git a/source4/main.mk b/source4/main.mk
index 13a39d8e78..b47428bdf5 100644
--- a/source4/main.mk
+++ b/source4/main.mk
@@ -233,6 +233,7 @@ clean:: clean_pch
@echo Removing libraries
@-rm -f $(STATIC_LIBRARIES) $(SHARED_LIBRARIES)
@-rm -f bin/*.$(SHLIBEXT)*
+ @-rm -f bin/*.a
@echo Removing modules
@-rm -f bin/modules/*/*.$(SHLIBEXT)
@-rm -f bin/*_init_module.c
diff --git a/source4/nsswitch/config.m4 b/source4/nsswitch/config.m4
new file mode 100644
index 0000000000..ab8e2b988f
--- /dev/null
+++ b/source4/nsswitch/config.m4
@@ -0,0 +1 @@
+AC_CHECK_HEADERS(nss.h nss_common.h ns_api.h )