Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

* configure.in: Add header, structure member, and function checks as

	  Android doesn't provide all the headers, structure members, and 
	  functions that a "full" Linux distro includes.
	* support/dirent.c, support/grp.c, support/macros.c, support/pwd.c, 
	  support/signal.c, support/sys-statvfs.c, support/sys-time.c,
	  support/unistd.c: Add #if HAVE_XXX checks for functions which aren't
	  provided on Android.

svn path=/trunk/mono/; revision=155753
  • Loading branch information...
commit 34977c6415b49165f2fcfa3632025733e530fe41 1 parent 0b02929
Jonathan Pryor authored
View
6 ChangeLog
@@ -1,3 +1,9 @@
+2010-04-19 Jonathan Pryor <jpryor@novell.com>
+
+ * configure.in: Add header, structure member, and function checks as
+ Android doesn't provide all the headers, structure members, and
+ functions that a "full" Linux distro includes.
+
2010-04-19 Zoltan Varga <vargaz@gmail.com>
* configure.in: Add a --enable-minimal=normalization option to disable support
View
27 configure.in
@@ -1633,6 +1633,7 @@ if test x$target_win32 = xno; then
dnl *** Checks for MonoPosixHelper ***
dnl **********************************
AC_CHECK_HEADERS(checklist.h)
+ AC_CHECK_HEADERS(pathconf.h)
AC_CHECK_HEADERS(fstab.h)
AC_CHECK_HEADERS(attr/xattr.h)
AC_CHECK_HEADERS(sys/extattr.h)
@@ -1644,13 +1645,15 @@ if test x$target_win32 = xno; then
AC_CHECK_HEADERS(sys/mman.h)
AC_CHECK_HEADERS(sys/param.h)
AC_CHECK_HEADERS(sys/mount.h)
+ AC_CHECK_FUNCS(confstr)
+ AC_CHECK_FUNCS(seekdir telldir)
AC_CHECK_FUNCS(getdomainname)
AC_CHECK_FUNCS(setdomainname)
- AC_CHECK_FUNCS(fgetgrent)
- AC_CHECK_FUNCS(fgetpwent)
- AC_CHECK_FUNCS(fgetpwent)
+ AC_CHECK_FUNCS(endgrent getgrent fgetgrent setgrent)
+ AC_CHECK_FUNCS(setgroups)
+ AC_CHECK_FUNCS(endpwent getpwent fgetpwent setpwent)
AC_CHECK_FUNCS(getfsstat)
- AC_CHECK_FUNCS(lutimes)
+ AC_CHECK_FUNCS(lutimes futimes)
AC_CHECK_FUNCS(mremap)
AC_CHECK_FUNCS(remap_file_pages)
AC_CHECK_FUNCS(posix_fadvise)
@@ -1658,7 +1661,8 @@ if test x$target_win32 = xno; then
AC_CHECK_FUNCS(posix_madvise)
AC_CHECK_FUNCS(vsnprintf)
AC_CHECK_FUNCS(sendfile)
- AC_CHECK_FUNCS(sethostid)
+ AC_CHECK_FUNCS(gethostid sethostid)
+ AC_CHECK_FUNCS(sethostname)
AC_CHECK_FUNCS(statfs)
AC_CHECK_FUNCS(fstatfs)
AC_CHECK_FUNCS(statvfs)
@@ -1666,6 +1670,11 @@ if test x$target_win32 = xno; then
AC_CHECK_FUNCS(stime)
AC_CHECK_FUNCS(strerror_r)
AC_CHECK_FUNCS(ttyname_r)
+ AC_CHECK_FUNCS(psignal)
+ AC_CHECK_FUNCS(getlogin_r)
+ AC_CHECK_FUNCS(lockf)
+ AC_CHECK_FUNCS(swab)
+ AC_CHECK_FUNCS(setusershell endusershell)
AC_CHECK_SIZEOF(size_t)
AC_CHECK_TYPES([blksize_t], [AC_DEFINE(HAVE_BLKSIZE_T)], ,
[#include <sys/types.h>
@@ -1701,6 +1710,14 @@ if test x$target_win32 = xno; then
[struct dirent.d_off, struct dirent.d_reclen, struct dirent.d_type],,,
[#include <sys/types.h>
#include <dirent.h>])
+ AC_CHECK_MEMBERS(
+ [struct passwd.pw_gecos],,,
+ [#include <sys/types.h>
+ #include <pwd.h>])
+ AC_CHECK_MEMBERS(
+ [struct statfs.f_flags],,,
+ [#include <sys/types.h>
+ #include <sys/vfs.h>])
dnl Favour xattr through glibc, but use libattr if we have to
AC_CHECK_FUNC(lsetxattr, ,
View
6 support/ChangeLog
@@ -1,3 +1,9 @@
+2010-04-19 Jonathan Pryor <jpryor@novell.com>
+
+ * dirent.c, grp.c, macros.c, pwd.c, signal.c, sys-statvfs.c, sys-time.c,
+ unistd.c: Add #if HAVE_XXX checks for functions which aren't
+ provided on Android.
+
2010-04-15 Jonathan Pryor <jpryor@novell.com>
* Makefile.am: Revert previous linkage against libmono.so, as lupus
View
4 support/dirent.c
@@ -29,6 +29,7 @@
G_BEGIN_DECLS
+#if HAVE_SEEKDIR
gint32
Mono_Posix_Syscall_seekdir (void *dir, mph_off_t offset)
{
@@ -38,12 +39,15 @@ Mono_Posix_Syscall_seekdir (void *dir, mph_off_t offset)
return 0;
}
+#endif /* def HAVE_SEEKDIR */
+#if HAVE_TELLDIR
mph_off_t
Mono_Posix_Syscall_telldir (void *dir)
{
return telldir ((DIR*) dir);
}
+#endif /* def HAVE_TELLDIR */
static void
copy_dirent (struct Mono_Posix_Syscall__Dirent *to, struct dirent *from)
View
8 support/grp.c
@@ -226,6 +226,7 @@ Mono_Posix_Syscall_getgrgid_r (mph_gid_t gid,
}
#endif /* ndef HAVE_GETGRGID_R */
+#if HAVE_GETGRENT
gint32
Mono_Posix_Syscall_getgrent (struct Mono_Posix_Syscall__Group *grbuf)
{
@@ -247,6 +248,7 @@ Mono_Posix_Syscall_getgrent (struct Mono_Posix_Syscall__Group *grbuf)
}
return 0;
}
+#endif /* def HAVE_GETGRENT */
#ifdef HAVE_FGETGRENT
gint32
@@ -272,13 +274,16 @@ Mono_Posix_Syscall_fgetgrent (void *stream, struct Mono_Posix_Syscall__Group *gr
}
#endif /* ndef HAVE_FGETGRENT */
+#if HAVE_SETGROUPS
gint32
Mono_Posix_Syscall_setgroups (mph_size_t size, mph_gid_t *list)
{
mph_return_if_size_t_overflow (size);
return setgroups ((size_t) size, list);
}
+#endif /* def HAVE_SETGROUPS */
+#if HAVE_SETGRENT
int
Mono_Posix_Syscall_setgrent (void)
{
@@ -289,13 +294,16 @@ Mono_Posix_Syscall_setgrent (void)
mph_return_if_val_in_list5(errno, EIO, EMFILE, ENFILE, ENOMEM, ERANGE);
return 0;
}
+#endif /* def HAVE_SETGRENT */
+#if HAVE_ENDGRENT
int
Mono_Posix_Syscall_endgrent (void)
{
endgrent();
return 0;
}
+#endif /* def HAVE_ENDGRENT */
G_END_DECLS
View
3  support/macros.c
@@ -99,6 +99,7 @@ char *helper_Mono_Posix_readdir(void *dir) {
return strdup (e->d_name);
}
+#if HAVE_GETPWNAM_R
int helper_Mono_Posix_getpwnamuid (int mode, char *in_name, int in_uid,
char **account,
char **password,
@@ -145,3 +146,5 @@ int helper_Mono_Posix_getpwnamuid (int mode, char *in_name, int in_uid,
return 0;
}
+#endif /* def HAVE_GETPWNAM_R */
+
View
10 support/pwd.c
@@ -22,7 +22,9 @@ static const mph_string_offset_t
passwd_offsets[] = {
MPH_STRING_OFFSET (struct passwd, pw_name, MPH_STRING_OFFSET_PTR),
MPH_STRING_OFFSET (struct passwd, pw_passwd, MPH_STRING_OFFSET_PTR),
+#if HAVE_STRUCT_PASSWD_PW_GECOS
MPH_STRING_OFFSET (struct passwd, pw_gecos, MPH_STRING_OFFSET_PTR),
+#endif /* def HAVE_STRUCT_PASSWD_PW_GECOS */
MPH_STRING_OFFSET (struct passwd, pw_dir, MPH_STRING_OFFSET_PTR),
MPH_STRING_OFFSET (struct passwd, pw_shell, MPH_STRING_OFFSET_PTR)
};
@@ -31,7 +33,9 @@ static const mph_string_offset_t
mph_passwd_offsets[] = {
MPH_STRING_OFFSET (struct Mono_Posix_Syscall__Passwd, pw_name, MPH_STRING_OFFSET_PTR),
MPH_STRING_OFFSET (struct Mono_Posix_Syscall__Passwd, pw_passwd, MPH_STRING_OFFSET_PTR),
+#if HAVE_STRUCT_PASSWD_PW_GECOS
MPH_STRING_OFFSET (struct Mono_Posix_Syscall__Passwd, pw_gecos, MPH_STRING_OFFSET_PTR),
+#endif /* def HAVE_STRUCT_PASSWD_PW_GECOS */
MPH_STRING_OFFSET (struct Mono_Posix_Syscall__Passwd, pw_dir, MPH_STRING_OFFSET_PTR),
MPH_STRING_OFFSET (struct Mono_Posix_Syscall__Passwd, pw_shell, MPH_STRING_OFFSET_PTR)
};
@@ -187,6 +191,7 @@ Mono_Posix_Syscall_getpwuid_r (mph_uid_t uid,
}
#endif /* ndef HAVE_GETPWUID_R */
+#if HAVE_GETPWENT
gint32
Mono_Posix_Syscall_getpwent (struct Mono_Posix_Syscall__Passwd *pwbuf)
{
@@ -208,6 +213,7 @@ Mono_Posix_Syscall_getpwent (struct Mono_Posix_Syscall__Passwd *pwbuf)
}
return 0;
}
+#endif /* def HAVE_GETPWENT */
#ifdef HAVE_FGETPWENT
gint32
@@ -233,6 +239,7 @@ Mono_Posix_Syscall_fgetpwent (void *stream, struct Mono_Posix_Syscall__Passwd *p
}
#endif /* ndef HAVE_FGETPWENT */
+#if HAVE_SETPWENT
int
Mono_Posix_Syscall_setpwent (void)
{
@@ -243,7 +250,9 @@ Mono_Posix_Syscall_setpwent (void)
mph_return_if_val_in_list5(errno, EIO, EMFILE, ENFILE, ENOMEM, ERANGE);
return 0;
}
+#endif /* def HAVE_SETPWENT */
+#if HAVE_ENDPWENT
int
Mono_Posix_Syscall_endpwent (void)
{
@@ -253,6 +262,7 @@ Mono_Posix_Syscall_endpwent (void)
return -1;
return 0;
}
+#endif /* def HAVE_ENDPWENT */
G_END_DECLS
View
2  support/signal.c
@@ -120,6 +120,7 @@ int Mono_Posix_FromRealTimeSignum (int offset, int *r)
#define mph_int_set(p,o,n) do { *(p) = n; } while (0)
#endif
+#if HAVE_PSIGNAL
int
Mono_Posix_Syscall_psignal (int sig, const char* s)
{
@@ -127,6 +128,7 @@ Mono_Posix_Syscall_psignal (int sig, const char* s)
psignal (sig, s);
return errno == 0 ? 0 : -1;
}
+#endif /* def HAVE_PSIGNAL */
#define NUM_SIGNALS 64
static signal_info signals[NUM_SIGNALS];
View
10 support/sys-statvfs.c
@@ -14,8 +14,14 @@
#include "mph.h"
#include "map.h"
+#ifdef HAVE_PATHCONF_H
+#include <pathconf.h>
+#endif
+
#ifdef HAVE_SYS_STATVFS_H
#include <sys/statvfs.h>
+#elif defined (HAVE_STATFS) || defined (HAVE_FSTATFS)
+#include <sys/vfs.h>
#endif /* def HAVE_SYS_STATVFS_H */
#ifdef HAVE_GETFSSTAT
@@ -142,8 +148,10 @@ Mono_Posix_ToStatvfs (void *_from, struct Mono_Posix_Statvfs *to)
// so this shouldn't lose anything.
memcpy (&to->f_fsid, &from->f_fsid, sizeof(to->f_fsid));
+#if HAVE_STRUCT_STATFS_F_FLAGS
if (Mono_Posix_ToMountFlags (from->f_flags, &to->f_flag) != 0)
return -1;
+#endif /* def HAVE_STRUCT_STATFS_F_FLAGS */
return 0;
}
@@ -165,9 +173,11 @@ Mono_Posix_FromStatvfs (struct Mono_Posix_Statvfs *from, void *_to)
// so this shouldn't lose anything.
memcpy (&to->f_fsid, &from->f_fsid, sizeof(to->f_fsid));
+#if HAVE_STRUCT_STATFS_F_FLAGS
if (Mono_Posix_FromMountFlags (from->f_flag, &flag) != 0)
return -1;
to->f_flags = flag;
+#endif /* def HAVE_STRUCT_STATFS_F_FLAGS */
return 0;
}
View
2  support/sys-time.c
@@ -124,6 +124,7 @@ Mono_Posix_Syscall_lutimes(const char *filename, struct Mono_Posix_Timeval *tv)
}
#endif /* def HAVE_LUTIMES */
+#if HAVE_FUTIMES
gint32
Mono_Posix_Syscall_futimes(int fd, struct Mono_Posix_Timeval *tv)
{
@@ -134,6 +135,7 @@ Mono_Posix_Syscall_futimes(int fd, struct Mono_Posix_Timeval *tv)
return futimes (fd, ptv);
}
+#endif /* def HAVE_FUTIMES */
G_END_DECLS
View
21 support/unistd.c
@@ -116,6 +116,7 @@ Mono_Posix_Syscall_sysconf (int name, int defaultError)
return sysconf (name);
}
+#if HAVE_CONFSTR
mph_size_t
Mono_Posix_Syscall_confstr (int name, char *buf, mph_size_t len)
{
@@ -124,6 +125,7 @@ Mono_Posix_Syscall_confstr (int name, char *buf, mph_size_t len)
return -1;
return confstr (name, buf, (size_t) len);
}
+#endif /* def HAVE_CONFSTR */
#ifdef HAVE_TTYNAME_R
gint32
@@ -145,12 +147,14 @@ Mono_Posix_Syscall_readlink (const char *path, char *buf, mph_size_t len)
return r;
}
+#if HAVE_GETLOGIN_R
gint32
Mono_Posix_Syscall_getlogin_r (char *buf, mph_size_t len)
{
mph_return_if_size_t_overflow (len);
return getlogin_r (buf, (size_t) len);
}
+#endif /* def HAVE_GETLOGIN_R */
gint32
Mono_Posix_Syscall_gethostname (char *buf, mph_size_t len)
@@ -159,18 +163,22 @@ Mono_Posix_Syscall_gethostname (char *buf, mph_size_t len)
return gethostname (buf, (size_t) len);
}
+#if HAVE_SETHOSTNAME
gint32
Mono_Posix_Syscall_sethostname (const char *name, mph_size_t len)
{
mph_return_if_size_t_overflow (len);
return sethostname (name, (size_t) len);
}
+#endif /* def HAVE_SETHOSTNAME */
+#if HAVE_GETHOSTID
gint64
Mono_Posix_Syscall_gethostid (void)
{
return gethostid ();
}
+#endif /* def HAVE_GETHOSTID */
#ifdef HAVE_SETHOSTID
gint32
@@ -204,12 +212,17 @@ Mono_Posix_Syscall_setdomainname (const char *name, mph_size_t len)
}
#endif /* def HAVE_SETDOMAINNAME */
+/* Android implements truncate, but doesn't declare it.
+ * Result is a warning during compilation, so skip it.
+ */
+#ifndef PLATFORM_ANDROID
gint32
Mono_Posix_Syscall_truncate (const char *path, mph_off_t length)
{
mph_return_if_off_t_overflow (length);
return truncate (path, (off_t) length);
}
+#endif
gint32
Mono_Posix_Syscall_ftruncate (int fd, mph_off_t length)
@@ -218,6 +231,7 @@ Mono_Posix_Syscall_ftruncate (int fd, mph_off_t length)
return ftruncate (fd, (off_t) length);
}
+#if HAVE_LOCKF
gint32
Mono_Posix_Syscall_lockf (int fd, int cmd, mph_off_t len)
{
@@ -226,7 +240,9 @@ Mono_Posix_Syscall_lockf (int fd, int cmd, mph_off_t len)
return -1;
return lockf (fd, cmd, (off_t) len);
}
+#endif /* def HAVE_LOCKF */
+#if HAVE_SWAB
int
Mono_Posix_Syscall_swab (void *from, void *to, mph_ssize_t n)
{
@@ -235,20 +251,25 @@ Mono_Posix_Syscall_swab (void *from, void *to, mph_ssize_t n)
swab (from, to, (ssize_t) n);
return 0;
}
+#endif /* def HAVE_SWAB */
+#if HAVE_SETUSERSHELL
int
Mono_Posix_Syscall_setusershell (void)
{
setusershell ();
return 0;
}
+#endif /* def HAVE_SETUSERSHELL */
+#if HAVE_ENDUSERSHELL
int
Mono_Posix_Syscall_endusershell (void)
{
endusershell ();
return 0;
}
+#endif /* def HAVE_ENDUSERSHELL */
int
Mono_Posix_Syscall_sync (void)
Please sign in to comment.
Something went wrong with that request. Please try again.