Only define struct ucred if <sys/socket.h> does not provide it

This commit is contained in:
Andrew Bettison 2012-05-03 14:37:43 +09:30
parent 75e925a8b5
commit 490d9ef472
3 changed files with 8 additions and 4 deletions

View File

@ -79,7 +79,7 @@ LOCAL_CFLAGS += \
-DHAVE_ERRNO_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRINGS_H=1 -DHAVE_UNISTD_H=1 \
-DHAVE_STRING_H=1 -DHAVE_ARPA_INET_H=1 -DHAVE_SYS_SOCKET_H=1 \
-DHAVE_SYS_MMAN_H=1 -DHAVE_SYS_TIME_H=1 -DHAVE_POLL_H=1 -DHAVE_NETDB_H=1 \
-DHAVE_JNI_H=1 -DBYTE_ORDER=_BYTE_ORDER \
-DHAVE_JNI_H=1 -DHAVE_STRUCT_UCRED=1 -DBYTE_ORDER=_BYTE_ORDER \
-I$(NACL_INC) \
-I$(SQLITE3_INC)
LOCAL_LDLIBS := -L$(SYSROOT)/usr/lib -llog

View File

@ -37,6 +37,11 @@ dnl Math library functions for spandsp
AC_CHECK_HEADERS([math.h], [INSERT_MATH_HEADER="#include <math.h>"])
AC_CHECK_HEADERS([float.h])
dnl Math library functions for spandsp
AC_CHECK_MEMBER(struct ucred.uid,
[AC_DEFINE([HAVE_STRUCT_UCRED], 1)],,
[#include <sys/socket.h>])
dnl Check for a working Java compiler, keep going if unsuccessful.
dnl *** Kludge: override AC_MSG_ERROR because AC_PROG_JAVAC does not have
dnl *** [if-found] and [if-not-found] action parameters.

View File

@ -26,14 +26,13 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "serval.h"
#include <sys/stat.h>
/* Need a better way to do this! */
#ifndef ANDROID
#ifndef HAVE_STRUCT_UCRED
struct ucred {
pid_t pid;
uid_t uid;
gid_t gid;
};
#endif
#endif // HAVE_STRUCT_UCRED
/* really shouldn't need more than 2:
1 for rhizome