autoconf detection of label support
authorChaz Chandler <clc31@inbox.com>
Wed, 4 Aug 2010 18:17:03 +0000 (11:17 -0700)
committerDerrick Brashear <shadow@dementia.org>
Thu, 12 Aug 2010 22:07:21 +0000 (15:07 -0700)
acinclude.m4 now has struct label support detection and sets
HAVE_STRUCT_LABEL_SUPPORT in afsconfig.h.  Obviates complicated
ifdefs in various src/afs/ and src/rx/ files.  Must run regen.sh
to generate new configure and afsconfig.h.in, then configure will
detect label support and set afsconfig.h appropriately.  Not sure
what to do for Windows, but should be a step in the right
direction.

Fixes issue with compilation of libuafs on IRIX and sunpro by accurately
detecting label support.

Change-Id: I092eda47c4cfcc2517dc39f5e48b5038c413cb01
Change-Id: I2ff8449b28db645d9cfd27796b5f89e5c328a2b2
Reviewed-on: http://gerrit.openafs.org/2516
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

acinclude.m4
src/afs/afs_dcache.c
src/afs/afs_fetchstore.c
src/rx/xdr_len.c
src/rx/xdr_mem.c
src/rx/xdr_rx.c

index 9effae9..5478a22 100644 (file)
@@ -1390,4 +1390,22 @@ mkdir -p ${TOP_OBJDIR}/src/JAVA/libjafs
 dnl Check to see if crypt lives in a different library
 AC_CHECK_LIB(crypt, crypt, LIB_crypt="-lcrypt")
 AC_SUBST(LIB_crypt)
+
+dnl Check to see if the compiler support labels in structs
+AC_MSG_CHECKING(for label support in structs)
+AC_TRY_COMPILE([], [
+extern void osi_UFSOpen(void);
+struct labeltest {
+   void (*open) (void);
+};
+struct labeltest struct_labeltest = {
+   .open       = osi_UFSOpen,
+}
+],
+[AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_STRUCT_LABEL_SUPPORT, 1, [Define to 1 if your compiler supports labels in structs.])
+],
+[AC_MSG_RESULT(no)
+])
+
 ])
index ea708f4..e37c812 100644 (file)
@@ -100,7 +100,7 @@ afs_int32 afs_dcentries;    /*!< In-memory dcache entries */
 int dcacheDisabled = 0;
 
 struct afs_cacheOps afs_UfsCacheOps = {
-#if defined(__SUNPRO_C) || (defined(AFS_SGI_ENV) && !defined(__c99))
+#ifndef HAVE_STRUCT_LABEL_SUPPORT
     osi_UFSOpen,
     osi_UFSTruncate,
     afs_osi_Read,
@@ -126,7 +126,7 @@ struct afs_cacheOps afs_UfsCacheOps = {
 };
 
 struct afs_cacheOps afs_MemCacheOps = {
-#if defined(__SUNPRO_C) || (defined(AFS_SGI_ENV) && !defined(__c99))
+#ifndef HAVE_STRUCT_LABEL_SUPPORT
     afs_MemCacheOpen,
     afs_MemCacheTruncate,
     afs_MemReadBlk,
index 15206fa..ffe6f1c 100644 (file)
@@ -314,7 +314,7 @@ afs_GenericStoreProc(struct storeOps *ops, void *rock,
 
 static
 struct storeOps rxfs_storeUfsOps = {
-#if defined(__SUNPRO_C) || (defined(AFS_SGI_ENV) && !defined(__c99))
+#ifndef HAVE_STRUCT_LABEL_SUPPORT
     rxfs_storeUfsPrepare,
     rxfs_storeUfsRead,
     rxfs_storeUfsWrite,
@@ -341,7 +341,7 @@ struct storeOps rxfs_storeUfsOps = {
 
 static
 struct storeOps rxfs_storeMemOps = {
-#if defined(__SUNPRO_C) || (defined(AFS_SGI_ENV) && !defined(__c99))
+#ifndef HAVE_STRUCT_LABEL_SUPPORT
     rxfs_storeMemPrepare,
     rxfs_storeMemRead,
     rxfs_storeMemWrite,
index 7a55daa..8e2c4cb 100644 (file)
@@ -84,7 +84,7 @@ xdrlen_inline(XDR *xdrs, u_int len)
 }
 
 static struct xdr_ops xdrlen_ops = {
-#if defined(AFS_NT40_ENV) || defined(__SUNPRO_C) || (defined(AFS_SGI_ENV)  && !defined(__c99))
+#ifndef HAVE_STRUCT_LABEL_SUPPORT
 #ifdef AFS_XDR_64BITOPS
     NULL,
     NULL,
index 475ea03..18ea3db 100644 (file)
@@ -62,7 +62,7 @@ static afs_int32 *xdrmem_inline(XDR *, u_int);
 static void xdrmem_destroy(XDR *);
 
 static struct xdr_ops xdrmem_ops = {
-#if defined(AFS_NT40_ENV) || defined(__SUNPRO_C) || (defined(AFS_SGI_ENV)  && !defined(__c99))
+#ifndef HAVE_STRUCT_LABEL_SUPPORT
 #ifdef AFS_XDR_64BITOPS
     NULL,
     NULL,
index 85e3ba2..500888a 100644 (file)
@@ -80,7 +80,7 @@ static afs_int32 *xdrrx_inline(XDR *axdrs, u_int len);
  * Ops vector for stdio type XDR
  */
 static struct xdr_ops xdrrx_ops = {
-#if defined(AFS_NT40_ENV) || defined(__SUNPRO_C) || (defined(AFS_SGI_ENV)  && !defined(__c99))
+#ifndef HAVE_STRUCT_LABEL_SUPPORT
 #ifdef AFS_XDR_64BITOPS
     xdrrx_getint64,     /* deserialize an afs_int64 */
     xdrrx_putint64,     /* serialize an afs_int64 */