diff options
author | Alan Coopersmith <alan.coopersmith@oracle.com> | 2011-11-30 22:20:09 -0800 |
---|---|---|
committer | Alan Coopersmith <alan.coopersmith@oracle.com> | 2011-12-05 14:32:45 -0800 |
commit | d829a7c5cb42c979b58f3547136df5b05d906423 (patch) | |
tree | 8ba5b6e2788f9bca49d51bb743dd0f211a91fb9f /os | |
parent | 4be68b03128e958d2a6dc1b7feb3587329b9561b (diff) |
Move to autoconf standard function name checks & defines
Replace multiple methods of checking for functions with AC_CHECK_FUNCS
Replace multiple methods of selecting fallback funcs with AC_REPLACE_FUNCS
Replace HAS_* and NEED_* #defines with autogenerated HAVE_*
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Mikhail Gusarov <dottedmag@dottedmag.net>
Reviewed-by: Gaetan Nadon <memsize@videotron.ca>
Diffstat (limited to 'os')
-rw-r--r-- | os/Makefile.am | 16 | ||||
-rw-r--r-- | os/access.c | 28 | ||||
-rw-r--r-- | os/connection.c | 6 | ||||
-rw-r--r-- | os/osdep.h | 6 | ||||
-rw-r--r-- | os/strcasecmp.c | 4 | ||||
-rw-r--r-- | os/strcasestr.c | 2 | ||||
-rw-r--r-- | os/strlcpy.c | 2 |
7 files changed, 24 insertions, 40 deletions
diff --git a/os/Makefile.am b/os/Makefile.am index 8dd809531..88914852f 100644 --- a/os/Makefile.am +++ b/os/Makefile.am @@ -4,7 +4,6 @@ AM_CFLAGS = $(DIX_CFLAGS) $(SHA1_CFLAGS) SECURERPC_SRCS = rpcauth.c XDMCP_SRCS = xdmcp.c -STRLCAT_SRCS = strlcat.c strlcpy.c XORG_SRCS = log.c libos_la_SOURCES = \ @@ -20,14 +19,12 @@ libos_la_SOURCES = \ osdep.h \ osinit.c \ utils.c \ - strcasecmp.c \ - strcasestr.c \ xdmauth.c \ xsha1.c \ xstrans.c \ xprintf.c \ $(XORG_SRCS) -libos_la_LIBADD = @SHA1_LIBS@ $(DLOPEN_LIBS) +libos_la_LIBADD = @SHA1_LIBS@ $(DLOPEN_LIBS) $(LTLIBOBJS) if SECURE_RPC libos_la_SOURCES += $(SECURERPC_SRCS) @@ -37,16 +34,7 @@ if XDMCP libos_la_SOURCES += $(XDMCP_SRCS) endif -if NEED_STRLCAT -libos_la_SOURCES += $(STRLCAT_SRCS) -endif - -if NEED_STRNDUP -libos_la_SOURCES += $(STRNDUP_SRCS) -endif - -EXTRA_DIST = $(SECURERPC_SRCS) $(INTERNALMALLOC_SRCS) \ - $(XDMCP_SRCS) $(STRLCAT_SRCS) +EXTRA_DIST = $(SECURERPC_SRCS) $(XDMCP_SRCS) if SPECIAL_DTRACE_OBJECTS # Generate dtrace object code for probes in libos & libdix diff --git a/os/access.c b/os/access.c index 159894007..0800c7f73 100644 --- a/os/access.c +++ b/os/access.c @@ -106,7 +106,7 @@ SOFTWARE. #include <netinet/in.h> #endif /* TCPCONN || STREAMSCONN */ -#ifdef HAS_GETPEERUCRED +#ifdef HAVE_GETPEERUCRED # include <ucred.h> # ifdef sun # include <zone.h> @@ -146,7 +146,7 @@ SOFTWARE. #endif #endif -#ifdef HAS_GETIFADDRS +#ifdef HAVE_GETIFADDRS #include <ifaddrs.h> #endif @@ -495,7 +495,7 @@ in6_fillscopeid(struct sockaddr_in6 *sin6) void DefineSelf (int fd) { -#ifndef HAS_GETIFADDRS +#ifndef HAVE_GETIFADDRS char *cp, *cplim; # ifdef USE_SIOCGLIFCONF struct sockaddr_storage buf[16]; @@ -510,7 +510,7 @@ DefineSelf (int fd) register struct ifreq *ifr; # endif void * bufptr = buf; -#else /* HAS_GETIFADDRS */ +#else /* HAVE_GETIFADDRS */ struct ifaddrs * ifap, *ifr; #endif int len; @@ -518,7 +518,7 @@ DefineSelf (int fd) int family; register HOST *host; -#ifndef HAS_GETIFADDRS +#ifndef HAVE_GETIFADDRS len = sizeof(buf); @@ -689,7 +689,7 @@ DefineSelf (int fd) } if (bufptr != buf) free(bufptr); -#else /* HAS_GETIFADDRS */ +#else /* HAVE_GETIFADDRS */ if (getifaddrs(&ifap) < 0) { ErrorF("Warning: getifaddrs returns %s\n", strerror(errno)); return; @@ -777,7 +777,7 @@ DefineSelf (int fd) } /* for */ freeifaddrs(ifap); -#endif /* HAS_GETIFADDRS */ +#endif /* HAVE_GETIFADDRS */ /* * add something of FamilyLocalHost @@ -798,7 +798,7 @@ DefineSelf (int fd) } } } -#endif /* hpux && !HAS_IFREQ */ +#endif /* hpux && !HAVE_IFREQ */ #ifdef XDMCP void @@ -1091,14 +1091,14 @@ LocalClientCred(ClientPtr client, int *pUid, int *pGid) int GetLocalClientCreds(ClientPtr client, LocalClientCredRec **lccp) { -#if defined(HAS_GETPEEREID) || defined(HAS_GETPEERUCRED) || defined(SO_PEERCRED) +#if defined(HAVE_GETPEEREID) || defined(HAVE_GETPEERUCRED) || defined(SO_PEERCRED) int fd; XtransConnInfo ci; LocalClientCredRec *lcc; -#ifdef HAS_GETPEEREID +#ifdef HAVE_GETPEEREID uid_t uid; gid_t gid; -#elif defined(HAS_GETPEERUCRED) +#elif defined(HAVE_GETPEERUCRED) ucred_t *peercred = NULL; const gid_t *gids; #elif defined(SO_PEERCRED) @@ -1109,7 +1109,7 @@ GetLocalClientCreds(ClientPtr client, LocalClientCredRec **lccp) if (client == NULL) return -1; ci = ((OsCommPtr)client->osPrivate)->trans_conn; -#if !(defined(sun) && defined(HAS_GETPEERUCRED)) +#if !(defined(sun) && defined(HAVE_GETPEERUCRED)) /* Most implementations can only determine peer credentials for Unix * domain sockets - Solaris getpeerucred can work with a bit more, so * we just let it tell us if the connection type is supported or not @@ -1125,7 +1125,7 @@ GetLocalClientCreds(ClientPtr client, LocalClientCredRec **lccp) lcc = *lccp; fd = _XSERVTransGetConnectionNumber(ci); -#ifdef HAS_GETPEEREID +#ifdef HAVE_GETPEEREID if (getpeereid(fd, &uid, &gid) == -1) { FreeLocalClientCreds(lcc); return -1; @@ -1134,7 +1134,7 @@ GetLocalClientCreds(ClientPtr client, LocalClientCredRec **lccp) lcc->egid = gid; lcc->fieldsSet = LCC_UID_SET | LCC_GID_SET; return 0; -#elif defined(HAS_GETPEERUCRED) +#elif defined(HAVE_GETPEERUCRED) if (getpeerucred(fd, &peercred) < 0) { FreeLocalClientCreds(lcc); return -1; diff --git a/os/connection.c b/os/connection.c index c5fc5a07e..6f480deb6 100644 --- a/os/connection.c +++ b/os/connection.c @@ -114,7 +114,7 @@ SOFTWARE. #define Pid_t pid_t -#ifdef HAS_GETPEERUCRED +#ifdef HAVE_GETPEERUCRED # include <ucred.h> # include <zone.h> #endif @@ -122,7 +122,7 @@ SOFTWARE. #ifdef XSERVER_DTRACE # include <sys/types.h> typedef const char *string; -# ifndef HAS_GETPEERUCRED +# ifndef HAVE_GETPEERUCRED # define zoneid_t int # endif # include "../dix/Xserver-dtrace.h" @@ -282,7 +282,7 @@ InitConnectionLimits(void) lastfdesc = sysconf(_SC_OPEN_MAX) - 1; #endif -#ifdef HAS_GETDTABLESIZE +#ifdef HAVE_GETDTABLESIZE if (lastfdesc < 0) lastfdesc = getdtablesize() - 1; #endif diff --git a/os/osdep.h b/os/osdep.h index 087e36d06..72bd7d762 100644 --- a/os/osdep.h +++ b/os/osdep.h @@ -103,12 +103,6 @@ SOFTWARE. /* MAXSELECT is the number of fds that select() can handle */ #define MAXSELECT (sizeof(fd_set) * NBBY) -#ifndef HAS_GETDTABLESIZE -#if !defined(SVR4) && !defined(SYSV) -#define HAS_GETDTABLESIZE -#endif -#endif - #include <stddef.h> #if defined(XDMCP) || defined(HASXDMAUTH) diff --git a/os/strcasecmp.c b/os/strcasecmp.c index ad6da6a10..cf100baf4 100644 --- a/os/strcasecmp.c +++ b/os/strcasecmp.c @@ -34,7 +34,7 @@ #include <ctype.h> #include "dix.h" -#ifdef NEED_STRCASECMP +#ifndef HAVE_STRCASECMP int xstrcasecmp(const char *str1, const char *str2) { @@ -50,7 +50,7 @@ xstrcasecmp(const char *str1, const char *str2) } #endif -#ifdef NEED_STRNCASECMP +#ifndef HAVE_STRNCASECMP int xstrncasecmp(const char *s1, const char *s2, size_t n) { diff --git a/os/strcasestr.c b/os/strcasestr.c index f89b2f2dc..a20a6cc33 100644 --- a/os/strcasestr.c +++ b/os/strcasestr.c @@ -41,7 +41,7 @@ /* * Find the first occurrence of find in s, ignore case. */ -#ifdef NEED_STRCASESTR +#ifndef HAVE_STRCASESTR char * xstrcasestr(const char *s, const char *find) { diff --git a/os/strlcpy.c b/os/strlcpy.c index 2e55b2e63..7ffb64cd6 100644 --- a/os/strlcpy.c +++ b/os/strlcpy.c @@ -22,6 +22,7 @@ #include <string.h> #include "os.h" +#ifndef HAVE_STRLCPY /* * Copy src to string dst of size siz. At most siz-1 characters * will be copied. Always NUL terminates (unless siz == 0). @@ -52,3 +53,4 @@ strlcpy(char *dst, const char *src, size_t siz) return s - src - 1; /* count does not include NUL */ } +#endif |