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>
This commit is contained in:
parent
4be68b0312
commit
d829a7c5cb
36
configure.ac
36
configure.ac
|
@ -213,31 +213,14 @@ AC_CHECK_FUNC([dlopen], [],
|
||||||
AC_SUBST(DLOPEN_LIBS)
|
AC_SUBST(DLOPEN_LIBS)
|
||||||
|
|
||||||
dnl Checks for library functions.
|
dnl Checks for library functions.
|
||||||
AC_CHECK_FUNCS([vsnprintf walkcontext backtrace \
|
AC_CHECK_FUNCS([backtrace ffs \
|
||||||
getzoneid shmctl64 strcasestr ffs vasprintf])
|
getdtablesize getifaddrs getpeereid getpeerucred getzoneid \
|
||||||
AC_CHECK_FUNCS([strndup], [HAVE_STRNDUP=yes], [HAVE_STRNDUP=no])
|
mmap shmctl64 strncasecmp vasprintf vsnprintf walkcontext])
|
||||||
AM_CONDITIONAL(NEED_STRNDUP, [test x$HAVE_STRNDUP = xno])
|
AC_REPLACE_FUNCS([strcasecmp strcasestr strlcat strlcpy strndup])
|
||||||
dnl Old HAS_* names used in os/*.c.
|
|
||||||
AC_CHECK_FUNC([getdtablesize],
|
|
||||||
AC_DEFINE(HAS_GETDTABLESIZE, 1, [Have the 'getdtablesize' function.]))
|
|
||||||
AC_CHECK_FUNC([getifaddrs],
|
|
||||||
AC_DEFINE(HAS_GETIFADDRS, 1, [Have the 'getifaddrs' function.]))
|
|
||||||
AC_CHECK_FUNC([getpeereid],
|
|
||||||
AC_DEFINE(HAS_GETPEEREID, 1, [Have the 'getpeereid' function.]))
|
|
||||||
AC_CHECK_FUNC([getpeerucred],
|
|
||||||
AC_DEFINE(HAS_GETPEERUCRED, 1, [Have the 'getpeerucred' function.]))
|
|
||||||
AC_CHECK_FUNC([strlcat], HAVE_STRLCAT=yes, HAVE_STRLCAT=no)
|
|
||||||
AM_CONDITIONAL(NEED_STRLCAT, [test x$HAVE_STRLCAT = xno])
|
|
||||||
AC_CHECK_FUNC([strlcpy], AC_DEFINE(HAS_STRLCPY, 1, [Have the 'strlcpy' function]))
|
|
||||||
|
|
||||||
AM_CONDITIONAL(NEED_VSNPRINTF, [test x$HAVE_VSNPRINTF = xno])
|
dnl Find the math libary, then check for cbrt function in it.
|
||||||
|
|
||||||
dnl Check for mmap support for Xvfb
|
|
||||||
AC_CHECK_FUNC([mmap], AC_DEFINE(HAS_MMAP, 1, [Have the 'mmap' function.]))
|
|
||||||
|
|
||||||
dnl Find the math libary
|
|
||||||
AC_CHECK_LIB(m, sqrt)
|
AC_CHECK_LIB(m, sqrt)
|
||||||
AC_CHECK_LIB(m, cbrt, AC_DEFINE(HAVE_CBRT, 1, [Have the 'cbrt' function]))
|
AC_CHECK_FUNCS([cbrt])
|
||||||
|
|
||||||
AC_CHECK_HEADERS([ndbm.h dbm.h rpcsvc/dbm.h])
|
AC_CHECK_HEADERS([ndbm.h dbm.h rpcsvc/dbm.h])
|
||||||
|
|
||||||
|
@ -1238,13 +1221,6 @@ XKB_LIB='$(top_builddir)/xkb/libxkb.la'
|
||||||
XKB_STUB_LIB='$(top_builddir)/xkb/libxkbstubs.la'
|
XKB_STUB_LIB='$(top_builddir)/xkb/libxkbstubs.la'
|
||||||
REQUIRED_MODULES="$REQUIRED_MODULES xkbfile"
|
REQUIRED_MODULES="$REQUIRED_MODULES xkbfile"
|
||||||
|
|
||||||
AC_CHECK_FUNC(strcasecmp, [], AC_DEFINE([NEED_STRCASECMP], 1,
|
|
||||||
[Do not have 'strcasecmp'.]))
|
|
||||||
AC_CHECK_FUNC(strncasecmp, [], AC_DEFINE([NEED_STRNCASECMP], 1,
|
|
||||||
[Do not have 'strncasecmp'.]))
|
|
||||||
AC_CHECK_FUNC(strcasestr, [], AC_DEFINE([NEED_STRCASESTR], 1,
|
|
||||||
[Do not have 'strcasestr'.]))
|
|
||||||
|
|
||||||
PKG_CHECK_MODULES([XDMCP], [xdmcp], [have_libxdmcp="yes"], [have_libxdmcp="no"])
|
PKG_CHECK_MODULES([XDMCP], [xdmcp], [have_libxdmcp="yes"], [have_libxdmcp="no"])
|
||||||
if test "x$have_libxdmcp" = xyes; then
|
if test "x$have_libxdmcp" = xyes; then
|
||||||
AC_CHECK_LIB(Xdmcp, XdmcpWrap, [have_xdmcpwrap="yes"], [have_xdmcpwrap="no"], [$XDMCP_LIBS])
|
AC_CHECK_LIB(Xdmcp, XdmcpWrap, [have_xdmcpwrap="yes"], [have_xdmcpwrap="no"], [$XDMCP_LIBS])
|
||||||
|
|
|
@ -21,10 +21,7 @@ BUILT_SOURCES = parser.c parser.h scanner.c
|
||||||
MAINTAINERCLEANFILES = $(BUILT_SOURCES)
|
MAINTAINERCLEANFILES = $(BUILT_SOURCES)
|
||||||
|
|
||||||
libdmxconfig_a_SOURCES = $(LIBSRCS)
|
libdmxconfig_a_SOURCES = $(LIBSRCS)
|
||||||
|
|
||||||
if NEED_STRLCAT
|
|
||||||
libdmxconfig_a_SOURCES += $(top_srcdir)/os/strlcpy.c
|
libdmxconfig_a_SOURCES += $(top_srcdir)/os/strlcpy.c
|
||||||
endif
|
|
||||||
|
|
||||||
if GLX
|
if GLX
|
||||||
GLX_DEFS = @GL_CFLAGS@
|
GLX_DEFS = @GL_CFLAGS@
|
||||||
|
|
|
@ -48,12 +48,12 @@ from The Open Group.
|
||||||
#include "mipointer.h"
|
#include "mipointer.h"
|
||||||
#include "micmap.h"
|
#include "micmap.h"
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#ifdef HAS_MMAP
|
#ifdef HAVE_MMAP
|
||||||
#include <sys/mman.h>
|
#include <sys/mman.h>
|
||||||
#ifndef MAP_FILE
|
#ifndef MAP_FILE
|
||||||
#define MAP_FILE 0
|
#define MAP_FILE 0
|
||||||
#endif
|
#endif
|
||||||
#endif /* HAS_MMAP */
|
#endif /* HAVE_MMAP */
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#ifndef WIN32
|
#ifndef WIN32
|
||||||
|
@ -93,7 +93,7 @@ typedef struct
|
||||||
unsigned int lineBias;
|
unsigned int lineBias;
|
||||||
CloseScreenProcPtr closeScreen;
|
CloseScreenProcPtr closeScreen;
|
||||||
|
|
||||||
#ifdef HAS_MMAP
|
#ifdef HAVE_MMAP
|
||||||
int mmap_fd;
|
int mmap_fd;
|
||||||
char mmap_file[MAXPATHLEN];
|
char mmap_file[MAXPATHLEN];
|
||||||
#endif
|
#endif
|
||||||
|
@ -114,7 +114,7 @@ static vfbScreenInfo defaultScreenInfo = {
|
||||||
.lineBias = VFB_DEFAULT_LINEBIAS,
|
.lineBias = VFB_DEFAULT_LINEBIAS,
|
||||||
};
|
};
|
||||||
static Bool vfbPixmapDepths[33];
|
static Bool vfbPixmapDepths[33];
|
||||||
#ifdef HAS_MMAP
|
#ifdef HAVE_MMAP
|
||||||
static char *pfbdir = NULL;
|
static char *pfbdir = NULL;
|
||||||
#endif
|
#endif
|
||||||
typedef enum { NORMAL_MEMORY_FB, SHARED_MEMORY_FB, MMAPPED_FILE_FB } fbMemType;
|
typedef enum { NORMAL_MEMORY_FB, SHARED_MEMORY_FB, MMAPPED_FILE_FB } fbMemType;
|
||||||
|
@ -158,7 +158,7 @@ ddxGiveUp(enum ExitCode error)
|
||||||
|
|
||||||
switch (fbmemtype)
|
switch (fbmemtype)
|
||||||
{
|
{
|
||||||
#ifdef HAS_MMAP
|
#ifdef HAVE_MMAP
|
||||||
case MMAPPED_FILE_FB:
|
case MMAPPED_FILE_FB:
|
||||||
for (i = 0; i < vfbNumScreens; i++)
|
for (i = 0; i < vfbNumScreens; i++)
|
||||||
{
|
{
|
||||||
|
@ -170,10 +170,10 @@ ddxGiveUp(enum ExitCode error)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
#else /* HAS_MMAP */
|
#else /* HAVE_MMAP */
|
||||||
case MMAPPED_FILE_FB:
|
case MMAPPED_FILE_FB:
|
||||||
break;
|
break;
|
||||||
#endif /* HAS_MMAP */
|
#endif /* HAVE_MMAP */
|
||||||
|
|
||||||
#ifdef HAS_SHM
|
#ifdef HAS_SHM
|
||||||
case SHARED_MEMORY_FB:
|
case SHARED_MEMORY_FB:
|
||||||
|
@ -241,7 +241,7 @@ ddxUseMsg(void)
|
||||||
ErrorF("-blackpixel n pixel value for black\n");
|
ErrorF("-blackpixel n pixel value for black\n");
|
||||||
ErrorF("-whitepixel n pixel value for white\n");
|
ErrorF("-whitepixel n pixel value for white\n");
|
||||||
|
|
||||||
#ifdef HAS_MMAP
|
#ifdef HAVE_MMAP
|
||||||
ErrorF("-fbdir directory put framebuffers in mmap'ed files in directory\n");
|
ErrorF("-fbdir directory put framebuffers in mmap'ed files in directory\n");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -370,7 +370,7 @@ ddxProcessArgument(int argc, char *argv[], int i)
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAS_MMAP
|
#ifdef HAVE_MMAP
|
||||||
if (strcmp (argv[i], "-fbdir") == 0) /* -fbdir directory */
|
if (strcmp (argv[i], "-fbdir") == 0) /* -fbdir directory */
|
||||||
{
|
{
|
||||||
CHECK_FOR_REQUIRED_ARGUMENTS(1);
|
CHECK_FOR_REQUIRED_ARGUMENTS(1);
|
||||||
|
@ -378,7 +378,7 @@ ddxProcessArgument(int argc, char *argv[], int i)
|
||||||
fbmemtype = MMAPPED_FILE_FB;
|
fbmemtype = MMAPPED_FILE_FB;
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
#endif /* HAS_MMAP */
|
#endif /* HAVE_MMAP */
|
||||||
|
|
||||||
#ifdef HAS_SHM
|
#ifdef HAS_SHM
|
||||||
if (strcmp (argv[i], "-shmem") == 0) /* -shmem */
|
if (strcmp (argv[i], "-shmem") == 0) /* -shmem */
|
||||||
|
@ -523,7 +523,7 @@ vfbSaveScreen(ScreenPtr pScreen, int on)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAS_MMAP
|
#ifdef HAVE_MMAP
|
||||||
|
|
||||||
/* this flushes any changes to the screens out to the mmapped file */
|
/* this flushes any changes to the screens out to the mmapped file */
|
||||||
static void
|
static void
|
||||||
|
@ -608,7 +608,7 @@ vfbAllocateMmappedFramebuffer(vfbScreenInfoPtr pvfb)
|
||||||
pvfb->pXWDHeader = NULL;
|
pvfb->pXWDHeader = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* HAS_MMAP */
|
#endif /* HAVE_MMAP */
|
||||||
|
|
||||||
|
|
||||||
#ifdef HAS_SHM
|
#ifdef HAS_SHM
|
||||||
|
@ -672,7 +672,7 @@ vfbAllocateFramebufferMemory(vfbScreenInfoPtr pvfb)
|
||||||
pvfb->pXWDHeader = NULL;
|
pvfb->pXWDHeader = NULL;
|
||||||
switch (fbmemtype)
|
switch (fbmemtype)
|
||||||
{
|
{
|
||||||
#ifdef HAS_MMAP
|
#ifdef HAVE_MMAP
|
||||||
case MMAPPED_FILE_FB: vfbAllocateMmappedFramebuffer(pvfb); break;
|
case MMAPPED_FILE_FB: vfbAllocateMmappedFramebuffer(pvfb); break;
|
||||||
#else
|
#else
|
||||||
case MMAPPED_FILE_FB: break;
|
case MMAPPED_FILE_FB: break;
|
||||||
|
|
|
@ -143,12 +143,12 @@
|
||||||
#undef HANDLE
|
#undef HANDLE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAS_MMAP
|
#ifdef HAVE_MMAP
|
||||||
#include <sys/mman.h>
|
#include <sys/mman.h>
|
||||||
#ifndef MAP_FILE
|
#ifndef MAP_FILE
|
||||||
#define MAP_FILE 0
|
#define MAP_FILE 0
|
||||||
#endif /* MAP_FILE */
|
#endif /* MAP_FILE */
|
||||||
#endif /* HAS_MMAP */
|
#endif /* HAVE_MMAP */
|
||||||
|
|
||||||
#include <X11/X.h>
|
#include <X11/X.h>
|
||||||
#include <X11/Xproto.h>
|
#include <X11/Xproto.h>
|
||||||
|
|
|
@ -51,27 +51,9 @@
|
||||||
/* Support XDM-AUTH*-1 */
|
/* Support XDM-AUTH*-1 */
|
||||||
#undef HASXDMAUTH
|
#undef HASXDMAUTH
|
||||||
|
|
||||||
/* Define to 1 if you have the `getdtablesize' function. */
|
|
||||||
#undef HAS_GETDTABLESIZE
|
|
||||||
|
|
||||||
/* Define to 1 if you have the `getifaddrs' function. */
|
|
||||||
#undef HAS_GETIFADDRS
|
|
||||||
|
|
||||||
/* Define to 1 if you have the `getpeereid' function. */
|
|
||||||
#undef HAS_GETPEEREID
|
|
||||||
|
|
||||||
/* Define to 1 if you have the `getpeerucred' function. */
|
|
||||||
#undef HAS_GETPEERUCRED
|
|
||||||
|
|
||||||
/* Define to 1 if you have the `mmap' function. */
|
|
||||||
#undef HAS_MMAP
|
|
||||||
|
|
||||||
/* Support SHM */
|
/* Support SHM */
|
||||||
#undef HAS_SHM
|
#undef HAS_SHM
|
||||||
|
|
||||||
/* Have the 'strlcpy' function */
|
|
||||||
#undef HAS_STRLCPY
|
|
||||||
|
|
||||||
/* Define to 1 if you have the <asm/mtrr.h> header file. */
|
/* Define to 1 if you have the <asm/mtrr.h> header file. */
|
||||||
#undef HAVE_ASM_MTRR_H
|
#undef HAVE_ASM_MTRR_H
|
||||||
|
|
||||||
|
@ -81,7 +63,7 @@
|
||||||
/* Define to 1 if you have the <byteswap.h> header file. */
|
/* Define to 1 if you have the <byteswap.h> header file. */
|
||||||
#undef HAVE_BYTESWAP_H
|
#undef HAVE_BYTESWAP_H
|
||||||
|
|
||||||
/* Define to 1 if you have cbrt */
|
/* Define to 1 if you have the `cbrt' function. */
|
||||||
#undef HAVE_CBRT
|
#undef HAVE_CBRT
|
||||||
|
|
||||||
/* Define to 1 if you have the <dbm.h> header file. */
|
/* Define to 1 if you have the <dbm.h> header file. */
|
||||||
|
@ -100,6 +82,21 @@
|
||||||
/* Define to 1 if you have the <fcntl.h> header file. */
|
/* Define to 1 if you have the <fcntl.h> header file. */
|
||||||
#undef HAVE_FCNTL_H
|
#undef HAVE_FCNTL_H
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `ffs' function. */
|
||||||
|
#undef HAVE_FFS
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `getdtablesize' function. */
|
||||||
|
#undef HAVE_GETDTABLESIZE
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `getifaddrs' function. */
|
||||||
|
#undef HAVE_GETIFADDRS
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `getpeereid' function. */
|
||||||
|
#undef HAVE_GETPEEREID
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `getpeerucred' function. */
|
||||||
|
#undef HAVE_GETPEERUCRED
|
||||||
|
|
||||||
/* Define to 1 if you have the `getzoneid' function. */
|
/* Define to 1 if you have the `getzoneid' function. */
|
||||||
#undef HAVE_GETZONEID
|
#undef HAVE_GETZONEID
|
||||||
|
|
||||||
|
@ -133,6 +130,9 @@
|
||||||
/* Define to 1 if you have the <linux/fb.h> header file. */
|
/* Define to 1 if you have the <linux/fb.h> header file. */
|
||||||
#undef HAVE_LINUX_FB_H
|
#undef HAVE_LINUX_FB_H
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `mmap' function. */
|
||||||
|
#undef HAVE_MMAP
|
||||||
|
|
||||||
/* Define to 1 if you have the <ndbm.h> header file. */
|
/* Define to 1 if you have the <ndbm.h> header file. */
|
||||||
#undef HAVE_NDBM_H
|
#undef HAVE_NDBM_H
|
||||||
|
|
||||||
|
@ -163,6 +163,21 @@
|
||||||
/* Define to 1 if you have the <stdlib.h> header file. */
|
/* Define to 1 if you have the <stdlib.h> header file. */
|
||||||
#undef HAVE_STDLIB_H
|
#undef HAVE_STDLIB_H
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `strcasecmp' function. */
|
||||||
|
#undef HAVE_STRCASECMP
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `strcasestr' function. */
|
||||||
|
#undef HAVE_STRCASESTR
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `strncasecmp' function. */
|
||||||
|
#undef HAVE_STRNCASECMP
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `strlcat' function. */
|
||||||
|
#undef HAVE_STRLCAT
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `strlcpy' function. */
|
||||||
|
#undef HAVE_STRLCPY
|
||||||
|
|
||||||
/* Define to 1 if you have the <strings.h> header file. */
|
/* Define to 1 if you have the <strings.h> header file. */
|
||||||
#undef HAVE_STRINGS_H
|
#undef HAVE_STRINGS_H
|
||||||
|
|
||||||
|
@ -402,18 +417,6 @@
|
||||||
/* Define to 64-bit byteswap macro */
|
/* Define to 64-bit byteswap macro */
|
||||||
#undef bswap_64
|
#undef bswap_64
|
||||||
|
|
||||||
/* Need the strcasecmp function. */
|
|
||||||
#undef NEED_STRCASECMP
|
|
||||||
|
|
||||||
/* Need the strncasecmp function. */
|
|
||||||
#undef NEED_STRNCASECMP
|
|
||||||
|
|
||||||
/* Need the strcasestr function. */
|
|
||||||
#undef NEED_STRCASESTR
|
|
||||||
|
|
||||||
/* Define to 1 if you have the `ffs' function. */
|
|
||||||
#undef HAVE_FFS
|
|
||||||
|
|
||||||
/* The compiler supported TLS storage class, prefering initial-exec if tls_model is supported */
|
/* The compiler supported TLS storage class, prefering initial-exec if tls_model is supported */
|
||||||
#undef TLS
|
#undef TLS
|
||||||
|
|
||||||
|
|
|
@ -472,22 +472,22 @@ extern _X_EXPORT void ddxGiveUp(enum ExitCode error);
|
||||||
extern _X_EXPORT int TimeSinceLastInputEvent(void);
|
extern _X_EXPORT int TimeSinceLastInputEvent(void);
|
||||||
|
|
||||||
/* strcasecmp.c */
|
/* strcasecmp.c */
|
||||||
#if NEED_STRCASECMP
|
#ifndef HAVE_STRCASECMP
|
||||||
#define strcasecmp xstrcasecmp
|
#define strcasecmp xstrcasecmp
|
||||||
extern _X_EXPORT int xstrcasecmp(const char *s1, const char *s2);
|
extern _X_EXPORT int xstrcasecmp(const char *s1, const char *s2);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if NEED_STRNCASECMP
|
#ifndef HAVE_STRNCASECMP
|
||||||
#define strncasecmp xstrncasecmp
|
#define strncasecmp xstrncasecmp
|
||||||
extern _X_EXPORT int xstrncasecmp(const char *s1, const char *s2, size_t n);
|
extern _X_EXPORT int xstrncasecmp(const char *s1, const char *s2, size_t n);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if NEED_STRCASESTR
|
#ifndef HAVE_STRCASESTR
|
||||||
#define strcasestr xstrcasestr
|
#define strcasestr xstrcasestr
|
||||||
extern _X_EXPORT char *xstrcasestr(const char *s, const char *find);
|
extern _X_EXPORT char *xstrcasestr(const char *s, const char *find);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef HAS_STRLCPY
|
#ifndef HAVE_STRLCPY
|
||||||
extern _X_EXPORT size_t strlcpy(char *dst, const char *src, size_t siz);
|
extern _X_EXPORT size_t strlcpy(char *dst, const char *src, size_t siz);
|
||||||
extern _X_EXPORT size_t strlcat(char *dst, const char *src, size_t siz);
|
extern _X_EXPORT size_t strlcat(char *dst, const char *src, size_t siz);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -29,7 +29,4 @@
|
||||||
/* XKB output dir for compiled keymaps. */
|
/* XKB output dir for compiled keymaps. */
|
||||||
#undef XKM_OUTPUT_DIR
|
#undef XKM_OUTPUT_DIR
|
||||||
|
|
||||||
/* Do not have `strcasecmp'. */
|
|
||||||
#undef NEED_STRCASECMP
|
|
||||||
|
|
||||||
#endif /* _XKB_CONFIG_H_ */
|
#endif /* _XKB_CONFIG_H_ */
|
||||||
|
|
|
@ -63,7 +63,7 @@ SOFTWARE.
|
||||||
#include <X11/Xmd.h>
|
#include <X11/Xmd.h>
|
||||||
#include "servermd.h"
|
#include "servermd.h"
|
||||||
|
|
||||||
#ifndef HAS_FFS
|
#ifndef HAVE_FFS
|
||||||
extern int ffs(int);
|
extern int ffs(int);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,6 @@ AM_CFLAGS = $(DIX_CFLAGS) $(SHA1_CFLAGS)
|
||||||
|
|
||||||
SECURERPC_SRCS = rpcauth.c
|
SECURERPC_SRCS = rpcauth.c
|
||||||
XDMCP_SRCS = xdmcp.c
|
XDMCP_SRCS = xdmcp.c
|
||||||
STRLCAT_SRCS = strlcat.c strlcpy.c
|
|
||||||
XORG_SRCS = log.c
|
XORG_SRCS = log.c
|
||||||
|
|
||||||
libos_la_SOURCES = \
|
libos_la_SOURCES = \
|
||||||
|
@ -20,14 +19,12 @@ libos_la_SOURCES = \
|
||||||
osdep.h \
|
osdep.h \
|
||||||
osinit.c \
|
osinit.c \
|
||||||
utils.c \
|
utils.c \
|
||||||
strcasecmp.c \
|
|
||||||
strcasestr.c \
|
|
||||||
xdmauth.c \
|
xdmauth.c \
|
||||||
xsha1.c \
|
xsha1.c \
|
||||||
xstrans.c \
|
xstrans.c \
|
||||||
xprintf.c \
|
xprintf.c \
|
||||||
$(XORG_SRCS)
|
$(XORG_SRCS)
|
||||||
libos_la_LIBADD = @SHA1_LIBS@ $(DLOPEN_LIBS)
|
libos_la_LIBADD = @SHA1_LIBS@ $(DLOPEN_LIBS) $(LTLIBOBJS)
|
||||||
|
|
||||||
if SECURE_RPC
|
if SECURE_RPC
|
||||||
libos_la_SOURCES += $(SECURERPC_SRCS)
|
libos_la_SOURCES += $(SECURERPC_SRCS)
|
||||||
|
@ -37,16 +34,7 @@ if XDMCP
|
||||||
libos_la_SOURCES += $(XDMCP_SRCS)
|
libos_la_SOURCES += $(XDMCP_SRCS)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if NEED_STRLCAT
|
EXTRA_DIST = $(SECURERPC_SRCS) $(XDMCP_SRCS)
|
||||||
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)
|
|
||||||
|
|
||||||
if SPECIAL_DTRACE_OBJECTS
|
if SPECIAL_DTRACE_OBJECTS
|
||||||
# Generate dtrace object code for probes in libos & libdix
|
# Generate dtrace object code for probes in libos & libdix
|
||||||
|
|
28
os/access.c
28
os/access.c
|
@ -106,7 +106,7 @@ SOFTWARE.
|
||||||
#include <netinet/in.h>
|
#include <netinet/in.h>
|
||||||
#endif /* TCPCONN || STREAMSCONN */
|
#endif /* TCPCONN || STREAMSCONN */
|
||||||
|
|
||||||
#ifdef HAS_GETPEERUCRED
|
#ifdef HAVE_GETPEERUCRED
|
||||||
# include <ucred.h>
|
# include <ucred.h>
|
||||||
# ifdef sun
|
# ifdef sun
|
||||||
# include <zone.h>
|
# include <zone.h>
|
||||||
|
@ -146,7 +146,7 @@ SOFTWARE.
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAS_GETIFADDRS
|
#ifdef HAVE_GETIFADDRS
|
||||||
#include <ifaddrs.h>
|
#include <ifaddrs.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -495,7 +495,7 @@ in6_fillscopeid(struct sockaddr_in6 *sin6)
|
||||||
void
|
void
|
||||||
DefineSelf (int fd)
|
DefineSelf (int fd)
|
||||||
{
|
{
|
||||||
#ifndef HAS_GETIFADDRS
|
#ifndef HAVE_GETIFADDRS
|
||||||
char *cp, *cplim;
|
char *cp, *cplim;
|
||||||
# ifdef USE_SIOCGLIFCONF
|
# ifdef USE_SIOCGLIFCONF
|
||||||
struct sockaddr_storage buf[16];
|
struct sockaddr_storage buf[16];
|
||||||
|
@ -510,7 +510,7 @@ DefineSelf (int fd)
|
||||||
register struct ifreq *ifr;
|
register struct ifreq *ifr;
|
||||||
# endif
|
# endif
|
||||||
void * bufptr = buf;
|
void * bufptr = buf;
|
||||||
#else /* HAS_GETIFADDRS */
|
#else /* HAVE_GETIFADDRS */
|
||||||
struct ifaddrs * ifap, *ifr;
|
struct ifaddrs * ifap, *ifr;
|
||||||
#endif
|
#endif
|
||||||
int len;
|
int len;
|
||||||
|
@ -518,7 +518,7 @@ DefineSelf (int fd)
|
||||||
int family;
|
int family;
|
||||||
register HOST *host;
|
register HOST *host;
|
||||||
|
|
||||||
#ifndef HAS_GETIFADDRS
|
#ifndef HAVE_GETIFADDRS
|
||||||
|
|
||||||
len = sizeof(buf);
|
len = sizeof(buf);
|
||||||
|
|
||||||
|
@ -689,7 +689,7 @@ DefineSelf (int fd)
|
||||||
}
|
}
|
||||||
if (bufptr != buf)
|
if (bufptr != buf)
|
||||||
free(bufptr);
|
free(bufptr);
|
||||||
#else /* HAS_GETIFADDRS */
|
#else /* HAVE_GETIFADDRS */
|
||||||
if (getifaddrs(&ifap) < 0) {
|
if (getifaddrs(&ifap) < 0) {
|
||||||
ErrorF("Warning: getifaddrs returns %s\n", strerror(errno));
|
ErrorF("Warning: getifaddrs returns %s\n", strerror(errno));
|
||||||
return;
|
return;
|
||||||
|
@ -777,7 +777,7 @@ DefineSelf (int fd)
|
||||||
|
|
||||||
} /* for */
|
} /* for */
|
||||||
freeifaddrs(ifap);
|
freeifaddrs(ifap);
|
||||||
#endif /* HAS_GETIFADDRS */
|
#endif /* HAVE_GETIFADDRS */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* add something of FamilyLocalHost
|
* add something of FamilyLocalHost
|
||||||
|
@ -798,7 +798,7 @@ DefineSelf (int fd)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* hpux && !HAS_IFREQ */
|
#endif /* hpux && !HAVE_IFREQ */
|
||||||
|
|
||||||
#ifdef XDMCP
|
#ifdef XDMCP
|
||||||
void
|
void
|
||||||
|
@ -1091,14 +1091,14 @@ LocalClientCred(ClientPtr client, int *pUid, int *pGid)
|
||||||
int
|
int
|
||||||
GetLocalClientCreds(ClientPtr client, LocalClientCredRec **lccp)
|
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;
|
int fd;
|
||||||
XtransConnInfo ci;
|
XtransConnInfo ci;
|
||||||
LocalClientCredRec *lcc;
|
LocalClientCredRec *lcc;
|
||||||
#ifdef HAS_GETPEEREID
|
#ifdef HAVE_GETPEEREID
|
||||||
uid_t uid;
|
uid_t uid;
|
||||||
gid_t gid;
|
gid_t gid;
|
||||||
#elif defined(HAS_GETPEERUCRED)
|
#elif defined(HAVE_GETPEERUCRED)
|
||||||
ucred_t *peercred = NULL;
|
ucred_t *peercred = NULL;
|
||||||
const gid_t *gids;
|
const gid_t *gids;
|
||||||
#elif defined(SO_PEERCRED)
|
#elif defined(SO_PEERCRED)
|
||||||
|
@ -1109,7 +1109,7 @@ GetLocalClientCreds(ClientPtr client, LocalClientCredRec **lccp)
|
||||||
if (client == NULL)
|
if (client == NULL)
|
||||||
return -1;
|
return -1;
|
||||||
ci = ((OsCommPtr)client->osPrivate)->trans_conn;
|
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
|
/* Most implementations can only determine peer credentials for Unix
|
||||||
* domain sockets - Solaris getpeerucred can work with a bit more, so
|
* 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
|
* 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;
|
lcc = *lccp;
|
||||||
|
|
||||||
fd = _XSERVTransGetConnectionNumber(ci);
|
fd = _XSERVTransGetConnectionNumber(ci);
|
||||||
#ifdef HAS_GETPEEREID
|
#ifdef HAVE_GETPEEREID
|
||||||
if (getpeereid(fd, &uid, &gid) == -1) {
|
if (getpeereid(fd, &uid, &gid) == -1) {
|
||||||
FreeLocalClientCreds(lcc);
|
FreeLocalClientCreds(lcc);
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -1134,7 +1134,7 @@ GetLocalClientCreds(ClientPtr client, LocalClientCredRec **lccp)
|
||||||
lcc->egid = gid;
|
lcc->egid = gid;
|
||||||
lcc->fieldsSet = LCC_UID_SET | LCC_GID_SET;
|
lcc->fieldsSet = LCC_UID_SET | LCC_GID_SET;
|
||||||
return 0;
|
return 0;
|
||||||
#elif defined(HAS_GETPEERUCRED)
|
#elif defined(HAVE_GETPEERUCRED)
|
||||||
if (getpeerucred(fd, &peercred) < 0) {
|
if (getpeerucred(fd, &peercred) < 0) {
|
||||||
FreeLocalClientCreds(lcc);
|
FreeLocalClientCreds(lcc);
|
||||||
return -1;
|
return -1;
|
||||||
|
|
|
@ -114,7 +114,7 @@ SOFTWARE.
|
||||||
#define Pid_t pid_t
|
#define Pid_t pid_t
|
||||||
|
|
||||||
|
|
||||||
#ifdef HAS_GETPEERUCRED
|
#ifdef HAVE_GETPEERUCRED
|
||||||
# include <ucred.h>
|
# include <ucred.h>
|
||||||
# include <zone.h>
|
# include <zone.h>
|
||||||
#endif
|
#endif
|
||||||
|
@ -122,7 +122,7 @@ SOFTWARE.
|
||||||
#ifdef XSERVER_DTRACE
|
#ifdef XSERVER_DTRACE
|
||||||
# include <sys/types.h>
|
# include <sys/types.h>
|
||||||
typedef const char *string;
|
typedef const char *string;
|
||||||
# ifndef HAS_GETPEERUCRED
|
# ifndef HAVE_GETPEERUCRED
|
||||||
# define zoneid_t int
|
# define zoneid_t int
|
||||||
# endif
|
# endif
|
||||||
# include "../dix/Xserver-dtrace.h"
|
# include "../dix/Xserver-dtrace.h"
|
||||||
|
@ -282,7 +282,7 @@ InitConnectionLimits(void)
|
||||||
lastfdesc = sysconf(_SC_OPEN_MAX) - 1;
|
lastfdesc = sysconf(_SC_OPEN_MAX) - 1;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAS_GETDTABLESIZE
|
#ifdef HAVE_GETDTABLESIZE
|
||||||
if (lastfdesc < 0)
|
if (lastfdesc < 0)
|
||||||
lastfdesc = getdtablesize() - 1;
|
lastfdesc = getdtablesize() - 1;
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -103,12 +103,6 @@ SOFTWARE.
|
||||||
/* MAXSELECT is the number of fds that select() can handle */
|
/* MAXSELECT is the number of fds that select() can handle */
|
||||||
#define MAXSELECT (sizeof(fd_set) * NBBY)
|
#define MAXSELECT (sizeof(fd_set) * NBBY)
|
||||||
|
|
||||||
#ifndef HAS_GETDTABLESIZE
|
|
||||||
#if !defined(SVR4) && !defined(SYSV)
|
|
||||||
#define HAS_GETDTABLESIZE
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
|
|
||||||
#if defined(XDMCP) || defined(HASXDMAUTH)
|
#if defined(XDMCP) || defined(HASXDMAUTH)
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include "dix.h"
|
#include "dix.h"
|
||||||
|
|
||||||
#ifdef NEED_STRCASECMP
|
#ifndef HAVE_STRCASECMP
|
||||||
int
|
int
|
||||||
xstrcasecmp(const char *str1, const char *str2)
|
xstrcasecmp(const char *str1, const char *str2)
|
||||||
{
|
{
|
||||||
|
@ -50,7 +50,7 @@ xstrcasecmp(const char *str1, const char *str2)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef NEED_STRNCASECMP
|
#ifndef HAVE_STRNCASECMP
|
||||||
int
|
int
|
||||||
xstrncasecmp(const char *s1, const char *s2, size_t n)
|
xstrncasecmp(const char *s1, const char *s2, size_t n)
|
||||||
{
|
{
|
||||||
|
|
|
@ -41,7 +41,7 @@
|
||||||
/*
|
/*
|
||||||
* Find the first occurrence of find in s, ignore case.
|
* Find the first occurrence of find in s, ignore case.
|
||||||
*/
|
*/
|
||||||
#ifdef NEED_STRCASESTR
|
#ifndef HAVE_STRCASESTR
|
||||||
char *
|
char *
|
||||||
xstrcasestr(const char *s, const char *find)
|
xstrcasestr(const char *s, const char *find)
|
||||||
{
|
{
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "os.h"
|
#include "os.h"
|
||||||
|
|
||||||
|
#ifndef HAVE_STRLCPY
|
||||||
/*
|
/*
|
||||||
* Copy src to string dst of size siz. At most siz-1 characters
|
* Copy src to string dst of size siz. At most siz-1 characters
|
||||||
* will be copied. Always NUL terminates (unless siz == 0).
|
* 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 */
|
return s - src - 1; /* count does not include NUL */
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue