diff options
-rw-r--r-- | source4/configure.ac | 5 | ||||
-rw-r--r-- | source4/lib/basic.mk | 1 | ||||
-rw-r--r-- | source4/lib/replace/config.mk | 29 | ||||
-rw-r--r-- | source4/lib/replace/configure.ac | 12 | ||||
-rw-r--r-- | source4/lib/replace/libreplace.m4 | 16 | ||||
-rw-r--r-- | source4/lib/replace/repdir/config.m4 | 29 | ||||
-rw-r--r-- | source4/lib/replace/samba.m4 | 23 |
7 files changed, 54 insertions, 61 deletions
diff --git a/source4/configure.ac b/source4/configure.ac index 1a00c97049..6c238aeb13 100644 --- a/source4/configure.ac +++ b/source4/configure.ac @@ -11,11 +11,8 @@ AC_CONFIG_HEADER(include/config_tmp.h) AC_DEFINE(CONFIG_H_IS_FROM_SAMBA,1,[Marker for samba's config.h]) # Configuration rules. -m4_include(lib/replace/libreplace.m4) +m4_include(lib/replace/samba.m4) m4_include(build/m4/env.m4) -SMB_EXT_LIB(DL, $LIBDL) -m4_include(lib/replace/win32/config.m4) -m4_include(lib/replace/repdir/config.m4) m4_include(lib/smbreadline/readline.m4) m4_include(heimdal_build/config.m4) m4_include(lib/util/fault.m4) diff --git a/source4/lib/basic.mk b/source4/lib/basic.mk index 145adfa3f0..b5a3a031eb 100644 --- a/source4/lib/basic.mk +++ b/source4/lib/basic.mk @@ -12,7 +12,6 @@ include events/config.mk include cmdline/config.mk include socket_wrapper/config.mk include appweb/config.mk -include replace/config.mk include stream/config.mk include util/config.mk include tdr/config.mk diff --git a/source4/lib/replace/config.mk b/source4/lib/replace/config.mk deleted file mode 100644 index 1e940b0a71..0000000000 --- a/source4/lib/replace/config.mk +++ /dev/null @@ -1,29 +0,0 @@ -############################## -# Start SUBSYSTEM REPLACE_READDIR -[SUBSYSTEM::REPLACE_READDIR] -OBJ_FILES = \ - repdir/repdir.o -# End SUBSYSTEM REPLACE_READDIR -############################## - -############################## -# Start SUBSYSTEM LIBREPLACE -[SUBSYSTEM::LIBREPLACE] -CFLAGS = -Ilib/replace -OBJ_FILES = replace.o \ - snprintf.o \ - dlfcn.o \ - getpass.o \ - timegm.o -PUBLIC_DEPENDENCIES = REPLACE_READDIR DL -# End SUBSYSTEM LIBREPLACE -############################## - -[SUBSYSTEM::LIBREPLACE_HOSTCC] -CFLAGS = -Ilib/replace -OBJ_FILES = replace.ho \ - snprintf.ho \ - dlfcn.ho \ - getpass.ho \ - timegm.ho - diff --git a/source4/lib/replace/configure.ac b/source4/lib/replace/configure.ac index aaf404e373..b506b791eb 100644 --- a/source4/lib/replace/configure.ac +++ b/source4/lib/replace/configure.ac @@ -1,16 +1,12 @@ -AC_DEFUN([SMB_EXT_LIB], [echo -n ""]) -AC_DEFUN([SMB_ENABLE], [echo -n ""]) - AC_PREREQ(2.50) -AC_INIT(dlfcn.c) -AC_CONFIG_SRCDIR([dlfcn.c]) +AC_INIT(replace.c) +AC_CONFIG_SRCDIR([replace.c]) AC_CONFIG_HEADER(config.h) +m4_include(libreplace.m4) + if test "$ac_cv_prog_gcc" = yes; then CFLAGS="$CFLAGS -Wall -Wshadow -Wstrict-prototypes -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings" fi -m4_include(libreplace.m4) -m4_include(win32/config.m4) -m4_include(repdir/config.m4) AC_OUTPUT(Makefile) diff --git a/source4/lib/replace/libreplace.m4 b/source4/lib/replace/libreplace.m4 index 202a60ff35..074dd1a1b4 100644 --- a/source4/lib/replace/libreplace.m4 +++ b/source4/lib/replace/libreplace.m4 @@ -236,13 +236,6 @@ if test x"$samba_cv_HAVE_C99_VSNPRINTF" = x"yes"; then fi -AC_CHECK_FUNCS([syslog memset setnetgrent getnetgrent endnetgrent memcpy],, - [AC_MSG_ERROR([Required function not found])]) - -m4_include(dlfcn.m4) -m4_include(getpass.m4) -m4_include(system/config.m4) - LIBREPLACE_C99_STRUCT_INIT(c99_struct_initialization=yes, c99_struct_initialization=no) @@ -344,3 +337,12 @@ AC_CACHE_CHECK([that the C compiler understands volatile],samba_cv_volatile, [ if test x"$samba_cv_volatile" = x"yes"; then AC_DEFINE(HAVE_VOLATILE, 1, [Whether the C compiler understands volatile]) fi + +m4_include(dlfcn.m4) +m4_include(getpass.m4) +m4_include(system/config.m4) +m4_include(win32/config.m4) +m4_include(repdir/config.m4) + +AC_CHECK_FUNCS([syslog memset setnetgrent getnetgrent endnetgrent memcpy],, + [AC_MSG_ERROR([Required function not found])]) diff --git a/source4/lib/replace/repdir/config.m4 b/source4/lib/replace/repdir/config.m4 index cc91f2a97a..eda8f42ba9 100644 --- a/source4/lib/replace/repdir/config.m4 +++ b/source4/lib/replace/repdir/config.m4 @@ -1,25 +1,30 @@ -AC_CACHE_CHECK([for broken readdir],samba_cv_HAVE_BROKEN_READDIR,[ +AC_CACHE_CHECK([for broken readdir],libreplace_READDIR_NEEDED,[ AC_TRY_RUN([ #define test_readdir_os2_delete main +#error #include "$libreplacedir/test/os2_delete.c"], - [samba_cv_HAVE_BROKEN_READDIR=no], - [samba_cv_HAVE_BROKEN_READDIR=yes], - [samba_cv_HAVE_BROKEN_READDIR="assuming not"]) + [libreplace_READDIR_NEEDED=no], + [libreplace_READDIR_NEEDED=yes], + [libreplace_READDIR_NEEDED="assuming not"]) ]) -if test x"$samba_cv_HAVE_BROKEN_READDIR" = x"yes"; then -AC_CACHE_CHECK([for replacing readdir],samba_cv_REPLACE_READDIR,[ +# +# try to replace with getdents() if needed +# +if test x"$libreplace_READDIR_NEEDED" = x"yes"; then +AC_CACHE_CHECK([for replacing readdir using getdents()],libreplace_READDIR_GETDENTS,[ AC_TRY_RUN([ +#include "confdefs.h" #include "$libreplacedir/repdir/repdir.c" #define test_readdir_os2_delete main #include "$libreplacedir/test/os2_delete.c"], - [samba_cv_REPLACE_READDIR=yes], - [samba_cv_REPLACE_READDIR=no]) + [libreplace_READDIR_GETDENTS=yes], + [libreplace_READDIR_GETDENTS=no]) ]) fi - -SMB_ENABLE(REPLACE_READDIR, NO) -if test x"$samba_cv_REPLACE_READDIR" = x"yes"; then +if test x"$libreplace_READDIR_GETDENTS" = x"yes"; then AC_DEFINE(REPLACE_READDIR,1,[replace readdir]) - SMB_ENABLE(REPLACE_READDIR, YES) + AC_DEFINE(REPLACE_READDIR_GETDENTS,1,[replace readdir using getdents()]) + LIBREPLACEOBJ="${LIBREPLACEOBJ} repdir/repdir.o" + libreplace_READDIR_NEEDED=no fi diff --git a/source4/lib/replace/samba.m4 b/source4/lib/replace/samba.m4 new file mode 100644 index 0000000000..c6c5e63b7f --- /dev/null +++ b/source4/lib/replace/samba.m4 @@ -0,0 +1,23 @@ +m4_include(lib/replace/libreplace.m4) + +SMB_EXT_LIB(LIBREPLACE_EXT, [${LIBDL}]) +SMB_ENABLE(LIBREPLACE_EXT) + +LIBREPLACE_DIR=`echo ${libreplacedir} |sed -e 's/^\.\///g'` + +LIBREPLACE_OBJS="" +for obj in ${LIBREPLACEOBJ}; do + LIBREPLACE_OBJS="${LIBREPLACE_OBJS} ${LIBREPLACE_DIR}/${obj}" +done + +SMB_SUBSYSTEM(LIBREPLACE, + [${LIBREPLACE_OBJS}], + [LIBREPLACE_EXT], + [-Ilib/replace]) + +LIBREPLACE_HOSTCC_OBJS=`echo ${LIBREPLACE_OBJS} |sed -e 's/\.o/\.ho/g'` + +SMB_SUBSYSTEM(LIBREPLACE_HOSTCC, + [${LIBREPLACE_HOSTCC_OBJS}], + [], + [-Ilib/replace]) |