summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Peach <jpeach@samba.org>2006-05-05 05:39:57 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 11:16:46 -0500
commit584ac985ec203f171367dec336ab8c828e31a442 (patch)
tree13855f12705ff0c8b7c9b48888bd873c45f64aed
parent78359305491f869af13622153bdf21cdb0cc2459 (diff)
downloadsamba-584ac985ec203f171367dec336ab8c828e31a442.tar.gz
samba-584ac985ec203f171367dec336ab8c828e31a442.tar.bz2
samba-584ac985ec203f171367dec336ab8c828e31a442.zip
r15448: New autoconf macro to test for sysconf variables.
(This used to be commit a19d4f2bb4aa94ab40e371efbad9f17e38e3bbc4)
-rw-r--r--source3/aclocal.m418
-rw-r--r--source3/client/smbspool.c1
-rw-r--r--source3/configure.in19
-rw-r--r--source3/tdb/spinlock.c10
4 files changed, 31 insertions, 17 deletions
diff --git a/source3/aclocal.m4 b/source3/aclocal.m4
index 91611233ca..67b7017a91 100644
--- a/source3/aclocal.m4
+++ b/source3/aclocal.m4
@@ -770,3 +770,21 @@ AC_DEFUN( [AC_TRY_RUN_STRICT],
old_LDFLAGS="";
export LDFLAGS;
])
+
+dnl SMB_CHECK_SYSCONF(varname)
+dnl Tests whether the sysconf(3) variable "varname" is available.
+AC_DEFUN([SMB_CHECK_SYSCONF],
+[
+ AC_CACHE_CHECK([for sysconf($1)],
+ samba_cv_SYSCONF$1,
+ [
+ AC_TRY_LINK([#include <unistd.h>],
+ [ return sysconf($1) == -1 ? 1 : 0; ],
+ [ samba_cv_SYSCONF$1=yes ],
+ [ samba_cv_SYSCONF$1=no ])
+ ])
+
+ if test x"$samba_cv_SYSCONF$1" = x"yes" ; then
+ AC_DEFINE(SYSCONF$1, 1, [Whether sysconf($1) is available])
+ fi
+])
diff --git a/source3/client/smbspool.c b/source3/client/smbspool.c
index af2f7e9180..20ce06a8da 100644
--- a/source3/client/smbspool.c
+++ b/source3/client/smbspool.c
@@ -23,7 +23,6 @@
#include "includes.h"
-#define PW_MAX_BUF_SIZE sysconf(_SC_GETPW_R_SIZE_MAX)
#define TICKET_CC_DIR "/tmp"
#define CC_PREFIX "krb5cc_" /* prefix of the ticket cache */
#define CC_MAX_FILE_LEN 24
diff --git a/source3/configure.in b/source3/configure.in
index fc5bad6dab..bf6841bdf4 100644
--- a/source3/configure.in
+++ b/source3/configure.in
@@ -2702,21 +2702,10 @@ if test x"$samba_cv_REPLACE_READDIR" = x"yes"; then
AC_DEFINE(REPLACE_READDIR,1,[replace readdir])
fi
-AC_CACHE_CHECK([for sysconf(_SC_NGROUPS_MAX)],samba_cv_SYSCONF_SC_NGROUPS_MAX,[
-AC_TRY_RUN([#include <unistd.h>
-main() { exit(sysconf(_SC_NGROUPS_MAX) == -1 ? 1 : 0); }],
-samba_cv_SYSCONF_SC_NGROUPS_MAX=yes,samba_cv_SYSCONF_SC_NGROUPS_MAX=no,samba_cv_SYSCONF_SC_NGROUPS_MAX=cross)])
-if test x"$samba_cv_SYSCONF_SC_NGROUPS_MAX" = x"yes"; then
- AC_DEFINE(SYSCONF_SC_NGROUPS_MAX,1,[Whether sysconf(_SC_NGROUPS_MAX) is available])
-fi
-
-AC_CACHE_CHECK([for sysconf(_SC_NPROC_ONLN)],samba_cv_SYSCONF_SC_NPROC_ONLN,[
-AC_TRY_RUN([#include <unistd.h>
-main() { exit(sysconf(_SC_NPROC_ONLN) == -1 ? 1 : 0); }],
-samba_cv_SYSCONF_SC_NPROC_ONLN=yes,samba_cv_SYSCONF_SC_NPROC_ONLN=no,samba_cv_SYSCONF_SC_NPROC_ONLN=cross)])
-if test x"$samba_cv_SYSCONF_SC_NPROC_ONLN" = x"yes"; then
- AC_DEFINE(SYSCONF_SC_NPROC_ONLN,1,[Whether sysconf(_SC_NPROC_ONLN) is available])
-fi
+SMB_CHECK_SYSCONF(_SC_NGROUPS_MAX)
+SMB_CHECK_SYSCONF(_SC_NPROC_ONLN)
+SMB_CHECK_SYSCONF(_SC_NPROCESSORS_ONLN)
+SMB_CHECK_SYSCONF(_SC_PAGESIZE)
AC_CACHE_CHECK([for root],samba_cv_HAVE_ROOT,[
AC_TRY_RUN([main() { exit(getuid() != 0); }],
diff --git a/source3/tdb/spinlock.c b/source3/tdb/spinlock.c
index a487ee2a10..e6abb3a0bc 100644
--- a/source3/tdb/spinlock.c
+++ b/source3/tdb/spinlock.c
@@ -268,8 +268,16 @@ static void yield_cpu(void)
static int this_is_smp(void)
{
-#if defined(HAVE_SYSCONF) && defined(SYSCONF_SC_NPROC_ONLN)
+#if defined(HAVE_SYSCONF)
+
+#if defined(SYSCONF_SC_NPROC_ONLN)
return (sysconf(_SC_NPROC_ONLN) > 1) ? 1 : 0;
+#elif defined(SYSCONF_SC_NPROCESSORS_ONLN)
+ return (sysconf(_SC_NPROCESSORS_ONLN) > 1) ? 1 : 0;
+#else
+ return 0;
+#endif
+
#else
return 0;
#endif