From: Chaz Chandler Date: Wed, 4 Aug 2010 18:17:03 +0000 (-0700) Subject: autoconf detection of label support X-Git-Tag: openafs-devel-1_5_76~6 X-Git-Url: http://git.openafs.org/?p=openafs.git;a=commitdiff_plain;h=e8bb948db17d7e4f734b9785f6f1b09c7efebde9 autoconf detection of label support 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 Tested-by: Derrick Brashear --- diff --git a/acinclude.m4 b/acinclude.m4 index 9effae9..5478a22 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -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) +]) + ]) diff --git a/src/afs/afs_dcache.c b/src/afs/afs_dcache.c index ea708f4..e37c812 100644 --- a/src/afs/afs_dcache.c +++ b/src/afs/afs_dcache.c @@ -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, diff --git a/src/afs/afs_fetchstore.c b/src/afs/afs_fetchstore.c index 15206fa..ffe6f1c 100644 --- a/src/afs/afs_fetchstore.c +++ b/src/afs/afs_fetchstore.c @@ -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, diff --git a/src/rx/xdr_len.c b/src/rx/xdr_len.c index 7a55daa..8e2c4cb 100644 --- a/src/rx/xdr_len.c +++ b/src/rx/xdr_len.c @@ -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, diff --git a/src/rx/xdr_mem.c b/src/rx/xdr_mem.c index 475ea03..18ea3db 100644 --- a/src/rx/xdr_mem.c +++ b/src/rx/xdr_mem.c @@ -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, diff --git a/src/rx/xdr_rx.c b/src/rx/xdr_rx.c index 85e3ba2..500888a 100644 --- a/src/rx/xdr_rx.c +++ b/src/rx/xdr_rx.c @@ -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 */