3 * Copyright 1998,1999 The OpenLDAP Foundation, Redwood City, California, USA
6 * Redistribution and use in source and binary forms are permitted only
7 * as authorized by the OpenLDAP Public License. A copy of this
8 * license is available at http://www.OpenLDAP.org/license.html or
9 * in file LICENSE in the top-level directory of the distribution.
16 # include <sys/types.h>
23 /* crypt() may be defined in a separate include file */
31 extern char* getpass LDAP_P((const char *getpass));
34 /* getopt() defines may be in separate include file */
38 #elif !defined(HAVE_GETOPT)
39 /* no getopt, assume we need getopt-compat.h */
40 # include <getopt-compat.h>
43 /* assume we need to declare these externs */
45 extern int optind, opterr, optopt;
49 extern char *tempnam(const char *tmpdir, const char *prefix);
52 extern char *mktemp(char *);
55 /* use _POSIX_VERSION for POSIX.1 code */
57 /* Setup file locking macros */
58 #if defined (HAVE_LOCKF) && defined (F_LOCK) && defined (F_ULOCK)
59 # define ldap_lockf(x) lockf(fileno(x),F_LOCK, 0)
60 # define ldap_unlockf(x) lockf(fileno(x),F_ULOCK, 0)
61 #elif defined (HAVE_FCNTL_H) && defined (F_WRLCK) && defined (F_UNLCK)
62 # ifndef NEED_FCNTL_LOCKING
63 # define NEED_FCNTL_LOCKING
65 # include <lutil_lockf.h>
66 # define ldap_lockf(x) lutil_ldap_lockf(x)
67 # define ldap_unlockf(x) lutil_ldap_unlockf(x)
68 #elif defined (HAVE_FLOCK) && defined (LOCK_EX) && defined (LOCK_UN)
70 # include <sys/file.h>
72 # define ldap_lockf(x) flock(fileno(x),LOCK_EX)
73 # define ldap_unlockf(x) flock(fileno(x),LOCK_UN)
75 #error no_suitable_locking_found
78 #endif /* _AC_UNISTD_H */