dnl Process this file with autoconf to produce a configure script. AC_INIT(fspclient,0.91.0,fsp-users@lists.sourceforge.net) AC_PREREQ(2.59) AC_CONFIG_SRCDIR(common/udp_io.c) AM_INIT_AUTOMAKE([dist-bzip2]) AM_MAINTAINER_MODE AC_CONFIG_HEADER(include/config.h) AC_ARG_WITH(lockprefix,AS_HELP_STRING([--with-lockprefix=path],[Set lock prefix path to (default /tmp/.FSPL)])) AC_ARG_WITH([locking],AS_HELP_STRING([--with-locking=none/semop/shmget/lockf/flock],[Set client locking type (default autodetected)])) AC_PROG_CC dnl If we're using gcc, enable some warnings dnl missing: -Wunreachable-code because it do not works AC_CACHE_CHECK(for additional compiler options, ac_cv_prog_gcc_flags, [ ac_cv_prog_gcc_flags="" if test "$GCC" = yes then echo "void dummy(void);" >configure-dummy.c echo "void dummy(void) {}" >>configure-dummy.c addopts= case `$CC --version` in *2.7*) ;; *) addopts="$addopts -Wpointer-arith" ;; esac for i in -Wall -W -Wstrict-prototypes -Wmissing-prototypes -Wshadow \ -Wbad-function-cast -Wcast-qual -Wcast-align -Wwrite-strings \ -Waggregate-return -Wmissing-declarations \ -Wmissing-format-attribute -Wnested-externs \ -fno-common -Wchar-subscripts -Wcomment \ -Wimplicit -Wsequence-point -Wreturn-type \ -Wfloat-equal $addopts -Wno-unused-parameter\ -Wno-system-headers -Wno-redundant-decls \ -Wmissing-noreturn -Wconversion -pedantic -Wlong-long -Wundef \ -Winline -Wunreachable-code do if $CC $i $ac_cv_prog_gcc_flags -c configure-dummy.c >/dev/null 2>&1 then ac_cv_prog_gcc_flags="$ac_cv_prog_gcc_flags $i" else echo "ignoring $i" fi done fi]) rm -f configure-dummy.c configure-dummy.o if test "${enable_maintainer_mode+set}" = set; then CFLAGS="-g3 -ggdb -O0 $ac_cv_prog_gcc_flags" AC_CHECK_LIB(efence,EF_Abort) fi AC_SUBST(CFLAGS) AC_PROG_CPP AC_AIX AC_DYNIX_SEQ if test -n "$SEQUENT"; then LIBS="-lsocket -linet -lnsl $LIBS" CC=cc GCC= fi AC_PROG_INSTALL AC_PROG_RANLIB AC_DIR_HEADER AC_STDC_HEADERS AC_UNISTD_H AC_XENIX_DIR AC_CHECK_HEADERS(string.h memory.h utime.h utimes.h unistd.h) AC_RETSIGTYPE AC_VFORK AC_CONST AC_INLINE AC_CHECK_FUNCS(putenv srandomdev) AC_CHECK_DECL(optreset, AC_DEFINE(HAVE_OPTRESET,1,[Define the following if your implementation of getopt have optreset variable]), ,[#include ]) AC_CHECK_FUNCS(flock lockf semop) AC_CHECK_TYPE(union semun, ,AC_DEFINE(_SEM_SEMUN_UNDEFINED,1,[Define if you do not have semun in sys/sem.h]), [#include #include #include ]) AC_CACHE_CHECK(for working shmget ,ac_cv_func_shmget, [LOCKPATH="conftestlock" AC_TRY_RUN([ #include #include #include #include #define LOCKPATH "$LOCKPATH" int main() { key_t ky; int sh; int rv; int fd; fd = open(LOCKPATH, O_RDWR | O_CREAT, 0666); if (fd < 0) return 1; rv = 0; ky = ftok(LOCKPATH, 2001); if (ky == (key_t)-1) rv = 1; else { struct shmid_ds smbuf; sh = shmget(ky, 1, IPC_CREAT | 0666); if (sh < 0) rv = 1; else shmctl(sh, IPC_RMID, &smbuf); } close(fd); return rv; }],ac_cv_func_shmget="yes",ac_cv_func_shmget="no") rm -f $LOCKPATH conftest.c ]) #Parse user locking choice if test "x$with_locking" = "xno" -o "x$with_locking" = "xnone" ; then AC_DEFINE(FSP_NOLOCKING,1,[Define if you do not want to use any locking]) AC_MSG_NOTICE(locking disabled by user) elif test "x$with_locking" = "xlockf" -a "x$ac_cv_func_lockf" = "xyes"; then AC_DEFINE(FSP_USE_LOCKF,1,[Define for lockf style locking]) elif test "x$with_locking" = "xsemop" -a "x$ac_cv_func_semop" = "xyes" -a "x$ac_cv_func_shmget" = "xyes";then AC_DEFINE(FSP_USE_SHAREMEM_AND_SEMOP,1,[Define for sharemem+semop locking]) elif test "x$with_locking" = "xshmget" -a "x$ac_cv_func_shmget" = "xyes" -a "x$ac_cv_func_lockf" = "xyes"; then AC_DEFINE(FSP_USE_SHAREMEM_AND_LOCKF,1,[Define for lockf locking]) elif test "x$with_locking" = "xflock" -a "x$ac_cv_func_flock" = "xyes"; then AC_DEFINE(FSP_USE_FLOCK,1,[Define for flock style locks]) #Autodetect locking elif test "x$ac_cv_func_semop" = "xyes" -a "x$ac_cv_func_shmget" = "xyes"; then AC_DEFINE(FSP_USE_SHAREMEM_AND_SEMOP,1) elif test "x$ac_cv_func_shmget" = "xyes" -a "x$ac_cv_func_lockf" = "xyes"; then AC_DEFINE(FSP_USE_SHAREMEM_AND_LOCKF,1) elif test "x$ac_cv_func_lockf" = "xyes"; then AC_DEFINE(FSP_USE_LOCKF,1) elif test "x$ac_cv_func_flock" = "xyes"; then AC_DEFINE(FSP_USE_FLOCK,1) else AC_DEFINE(FSP_NOLOCKING,1) AC_MSG_NOTICE([no suitable locking method detected]) fi #locking prefix if test "x$with_lockprefix" != "xno" -a "x$with_lockprefix" != "xyes" -a "x$with_lockprefix" != "x" ; then AC_DEFINE_UNQUOTED(FSP_KEY_PREFIX,"$with_lockprefix",[Key locking prefix]) fi AC_OUTPUT(Makefile common/Makefile bsd/Makefile client/Makefile client/remote/Makefile client/local/Makefile man/Makefile doc/Makefile include/Makefile)