From 6b410d4f9700d51730e5df0603847aad28e6d80b Mon Sep 17 00:00:00 2001 From: =?utf8?q?Wilfried=20G=C3=B6esgens?= Date: Sat, 8 Sep 2007 22:17:13 +0000 Subject: [PATCH] * use AC_CHECK_FUNCS to check for flock() * if we find a Sun CC rather check dependencies with -xM instead of -M --- citadel/Makefile.in | 5 +++-- citadel/configure.ac | 14 +++++++++++++- citadel/control.c | 3 ++- citadel/mk_module_init.sh | 5 ++--- 4 files changed, 20 insertions(+), 7 deletions(-) diff --git a/citadel/Makefile.in b/citadel/Makefile.in index 77390db2a..dc864add2 100644 --- a/citadel/Makefile.in +++ b/citadel/Makefile.in @@ -20,6 +20,7 @@ DATA_DIR=@MAKE_DATA_DIR@ STATICDATA_DIR=@MAKE_STATICDATA_DIR@ DOC_DIR=@MAKE_DOC_DIR@ UTILBIN_DIR=@MAKE_UTILBIN_DIR@ +DEPEND_FLAG=@DEPEND_FLAG@ all: $(TARGETS) .SUFFIXES: .o .d .c @@ -87,7 +88,7 @@ CFLAGS=@CFLAGS@ -I ./include/ CPPFLAGS=@CPPFLAGS@ -I. -I ./include/ DATABASE=@DATABASE@ DEFS=@DEFS@ -LDFLAGS=@LDFLAGS@ -rdynamic +LDFLAGS=@LDFLAGS@ LIBS=@LIBS@ LIBOBJS=@LIBOBJS@ INSTALL=@INSTALL@ @@ -396,7 +397,7 @@ distclean: cleaner .c.d: @echo Checking dependencies for $< - @$(CC) -M $(CPPFLAGS) $< | sed -e 's!$*.o!$*.o $*/.o $@!' > $@ + @$(CC) $(DEPEND_FLAG) $(CPPFLAGS) $< | sed -e 's!$*.o!$*.o $*/.o $@!' > $@ @test -s $@ || rm -f $@ Makefile: $(srcdir)/Makefile.in config.status diff --git a/citadel/configure.ac b/citadel/configure.ac index fb370e35d..3dd88c4d9 100644 --- a/citadel/configure.ac +++ b/citadel/configure.ac @@ -244,6 +244,8 @@ dnl DEFS="$DEFS $PTHREAD_DEFS" dnl Checks for programs. AC_PROG_CC + + dnl Set up system-dependent compiler flags. if test "$GCC" = yes; then if test "$CC" = icc; then @@ -274,6 +276,15 @@ if test "x$enable_pie" = xyes; then fi fi +echo $CC snaothus--------------------- +AC_MSG_CHECKING([how to compile with POSIX threads]) + if test -n "`$CC -V 2>&1 |grep Sun`"; then + DEPEND_FLAG=-xM; + else + DEPEND_FLAG=-M + fi +AC_SUBST(DEPEND_FLAG) + AC_PROG_INSTALL AC_PROG_YACC missing_dir=`cd $ac_aux_dir && pwd` @@ -294,7 +305,7 @@ dnl Checks for libraries. dnl We want to test for the following in libc before checking for their dnl respective libraries, because some systems (like Irix) have both, and the dnl non-libc versions may be broken. -AC_CHECK_FUNCS(crypt gethostbyname connect ) +AC_CHECK_FUNCS(crypt gethostbyname connect flock) dnl disable backtrace if we don't want it. @@ -783,6 +794,7 @@ AC_CACHE_CHECK([the weather], ac_cv_weather, [ + AC_CACHE_CHECK([under the bed], ac_cv_under_the_bed, [ number=`date | cut -c 19` case $number in diff --git a/citadel/control.c b/citadel/control.c index 77205b10c..7dc74798b 100644 --- a/citadel/control.c +++ b/citadel/control.c @@ -56,11 +56,12 @@ FILE *control_fp = NULL; */ void lock_control(void) { -#ifndef BSD_GETPWUID +#ifdef HAVE_FLOCK /* * TODO: solaris manpages describe this function, but the headers * don't show it! */ + if (flock(fileno(control_fp), (LOCK_EX | LOCK_NB))) { lprintf(CTDL_EMERG, "citserver: unable to lock %s.\n", file_citadel_control); lprintf(CTDL_EMERG, "Is another citserver already running?\n"); diff --git a/citadel/mk_module_init.sh b/citadel/mk_module_init.sh index 8ffd36632..71d37c4ad 100755 --- a/citadel/mk_module_init.sh +++ b/citadel/mk_module_init.sh @@ -28,10 +28,9 @@ H_FILE="$CUR_DIR/modules_init.h" /usr/bin/printf "This version of echo $ECHO supports $MINUS_e $MINUS_E.\n" -cat <$C_FILE - -#start ofs the files which inturn removes any existing file +#start of the files which inturn removes any existing file # +cat <$C_FILE /* * $C_FILE * Auto generated by mk_modules_init.sh DO NOT EDIT THIS FILE -- 2.30.2