#!/bin/sh
#
# Has-File-Locking.sh
#		Check for file locking support
#
# Author	Stuart Herbert
#		(stuart@gnqs.org)
#
# Copyright	(c) 1998 Stuart Herbert
#		Released under v2 of the GNU GPL

. $GSLIB

F_TEST_TYPE POSIX1
F_ECHO_RESULT "Support for file locking ..."

F_COMPILE_SCRIPT link 01.c

case $? in
	0)	F_ECHO_LN "via fcntl()"
		F_DEFINE_BOOLEAN GPORT_HAS_FCNTL_LOCKING 1
		F_TEST_PASSED
		;;
	*)	F_ECHO_LN "not via fcntl()"
		F_DEFINE_BOOLEAN GPORT_HAS_FCNTL_LOCKING 0
		F_TEST_FAILED
		;;
esac

F_TEST_TYPE BSD43
F_ECHO_RESULT
F_COMPILE_SCRIPT link 02.c

case $? in
	0)	F_ECHO_LN "via flock()"
		F_DEFINE_BOOLEAN GPORT_HAS_FLOCK_LOCKING 1
		F_TEST_PASSED
		;;
	*)	F_ECHO_LN "not via flock()"
		F_DEFINE_BOOLEAN GPORT_HAS_FLOCK_LOCKING 0
		F_TEST_FAILED
		;;
esac
