From 0584c108dbf6072d28b97ca3dcd70ef25ff4359c Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Wed, 13 Sep 2006 09:47:41 +0000 Subject: r18450: - autogenerate the OBJ_FILES for LIBREPLACE - remove samba specific stuff from libreplace - and include the readdir replacement stuff in the standalone builds metze (This used to be commit 3cac61152ef9a32313d7f7e5d38651f03a31f251) --- source4/lib/replace/config.mk | 29 ----------------------------- source4/lib/replace/configure.ac | 12 ++++-------- source4/lib/replace/libreplace.m4 | 16 +++++++++------- source4/lib/replace/repdir/config.m4 | 29 +++++++++++++++++------------ source4/lib/replace/samba.m4 | 23 +++++++++++++++++++++++ 5 files changed, 53 insertions(+), 56 deletions(-) delete mode 100644 source4/lib/replace/config.mk create mode 100644 source4/lib/replace/samba.m4 (limited to 'source4/lib/replace') 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]) -- cgit