Richard W.M. Jones
2017-Mar-01 12:20 UTC
[Libguestfs] [PATCH libguestfs] Use AC_HEADER_MAJOR to find definitions of major, minor, makedev.
Note this requires either the following fix in autoconf: http://git.savannah.gnu.org/cgit/autoconf.git/commit/?id=e17a30e98 OR gnulib sys_types module plus gnulib commit a512e041120e9012e69afa2f5c3adc196ec4999a (any gnulib more recent than Sep 2016) which corrects the AC_HEADER_MAJOR macro in a similar way. --- bootstrap | 1 + cat/ls.c | 7 +++++++ daemon/mknod.c | 6 ++++++ diff/diff.c | 7 +++++++ lib/fuse.c | 6 ++++++ m4/guestfs_libraries.m4 | 3 +++ mllib/unix_utils-c.c | 8 +++++++- p2v/main.c | 6 ++++++ 8 files changed, 43 insertions(+), 1 deletion(-) diff --git a/bootstrap b/bootstrap index 037d07e..faa10a3 100755 --- a/bootstrap +++ b/bootstrap @@ -92,6 +92,7 @@ strerror strndup symlinkat sys_select +sys_types sys_wait vasprintf vc-list-files diff --git a/cat/ls.c b/cat/ls.c index e0b5ff8..7568a5f 100644 --- a/cat/ls.c +++ b/cat/ls.c @@ -31,7 +31,14 @@ #include <assert.h> #include <time.h> #include <libintl.h> + +#if MAJOR_IN_MKDEV +#include <sys/mkdev.h> +#elif MAJOR_IN_SYSMACROS #include <sys/sysmacros.h> +#else +#include <sys/types.h> +#endif #include "human.h" #include "getprogname.h" diff --git a/daemon/mknod.c b/daemon/mknod.c index f8640ea..35dad15 100644 --- a/daemon/mknod.c +++ b/daemon/mknod.c @@ -25,7 +25,13 @@ #include <fcntl.h> #include <sys/types.h> #include <sys/stat.h> + +#if MAJOR_IN_MKDEV +#include <sys/mkdev.h> +#elif MAJOR_IN_SYSMACROS #include <sys/sysmacros.h> +/* else it's in sys/types.h, included above */ +#endif #include "guestfs_protocol.h" #include "daemon.h" diff --git a/diff/diff.c b/diff/diff.c index fc31ad3..8c045ad 100644 --- a/diff/diff.c +++ b/diff/diff.c @@ -32,7 +32,14 @@ #include <time.h> #include <libintl.h> #include <sys/wait.h> + +#if MAJOR_IN_MKDEV +#include <sys/mkdev.h> +#elif MAJOR_IN_SYSMACROS #include <sys/sysmacros.h> +#else +#include <sys/types.h> +#endif #include "c-ctype.h" #include "human.h" diff --git a/lib/fuse.c b/lib/fuse.c index 98bbc8d..7f80c49 100644 --- a/lib/fuse.c +++ b/lib/fuse.c @@ -26,7 +26,13 @@ #include <sys/wait.h> #include <string.h> #include <libintl.h> + +#if MAJOR_IN_MKDEV +#include <sys/mkdev.h> +#elif MAJOR_IN_SYSMACROS #include <sys/sysmacros.h> +/* else it's in sys/types.h, included above */ +#endif #if HAVE_FUSE /* See <attr/xattr.h> */ diff --git a/m4/guestfs_libraries.m4 b/m4/guestfs_libraries.m4 index 0882d27..c265b29 100644 --- a/m4/guestfs_libraries.m4 +++ b/m4/guestfs_libraries.m4 @@ -82,6 +82,9 @@ AC_CHECK_FUNCS([\ statvfs \ sync]) +dnl Which header file defines major, minor, makedev. +AC_HEADER_MAJOR + dnl Check for UNIX_PATH_MAX, creating a custom one if not available. AC_MSG_CHECKING([for UNIX_PATH_MAX]) AC_COMPILE_IFELSE([ diff --git a/mllib/unix_utils-c.c b/mllib/unix_utils-c.c index 1a4c3d7..f5aaaf6 100644 --- a/mllib/unix_utils-c.c +++ b/mllib/unix_utils-c.c @@ -27,9 +27,15 @@ #include <fnmatch.h> #include <errno.h> #include <sys/types.h> -#include <sys/sysmacros.h> #include <sys/statvfs.h> +#if MAJOR_IN_MKDEV +#include <sys/mkdev.h> +#elif MAJOR_IN_SYSMACROS +#include <sys/sysmacros.h> +/* else it's in sys/types.h, included above */ +#endif + #include <caml/alloc.h> #include <caml/fail.h> #include <caml/memory.h> diff --git a/p2v/main.c b/p2v/main.c index 42d3bbb..af14240 100644 --- a/p2v/main.c +++ b/p2v/main.c @@ -32,7 +32,13 @@ #include <libintl.h> #include <sys/types.h> #include <sys/stat.h> + +#if MAJOR_IN_MKDEV +#include <sys/mkdev.h> +#elif MAJOR_IN_SYSMACROS #include <sys/sysmacros.h> +/* else it's in sys/types.h, included above */ +#endif /* errors in <gtk.h> */ #pragma GCC diagnostic push -- 2.9.3
Pino Toscano
2017-Mar-03 14:45 UTC
[Libguestfs] [PATCH libguestfs] Use AC_HEADER_MAJOR to find definitions of major, minor, makedev.
On Wednesday, 1 March 2017 13:20:02 CET Richard W.M. Jones wrote:> Note this requires either the following fix in autoconf: > > http://git.savannah.gnu.org/cgit/autoconf.git/commit/?id=e17a30e98 > > OR gnulib sys_types module plus gnulib > commit a512e041120e9012e69afa2f5c3adc196ec4999a (any gnulib more > recent than Sep 2016) which corrects the AC_HEADER_MAJOR macro in a > similar way. > ---Theoretically LGTM -- OTOH, couldn't the common #if..etc chain be put in some common headers, e.g. guestfs-internal-all.h? Or a simple guestfs-internal-majorminor.h or so. Thanks, -- Pino Toscano -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: This is a digitally signed message part. URL: <http://listman.redhat.com/archives/libguestfs/attachments/20170303/25e9639e/attachment.sig>
Richard W.M. Jones
2017-Mar-03 15:03 UTC
Re: [Libguestfs] [PATCH libguestfs] Use AC_HEADER_MAJOR to find definitions of major, minor, makedev.
On Fri, Mar 03, 2017 at 03:45:30PM +0100, Pino Toscano wrote:> On Wednesday, 1 March 2017 13:20:02 CET Richard W.M. Jones wrote: > > Note this requires either the following fix in autoconf: > > > > http://git.savannah.gnu.org/cgit/autoconf.git/commit/?id=e17a30e98 > > > > OR gnulib sys_types module plus gnulib > > commit a512e041120e9012e69afa2f5c3adc196ec4999a (any gnulib more > > recent than Sep 2016) which corrects the AC_HEADER_MAJOR macro in a > > similar way. > > --- > > Theoretically LGTM -- OTOH, couldn't the common #if..etc chain be put > in some common headers, e.g. guestfs-internal-all.h? Or a simple > guestfs-internal-majorminor.h or so.IMO it'd be better if the AC_HEADER_MAJOR macro wasn't so stupid. For example it could expand into the name of the header file. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-builder quickly builds VMs from scratch http://libguestfs.org/virt-builder.1.html
Seemingly Similar Threads
- [PATCH supermin 0/2] Use AC_HEADER_MAJOR to find definitions of major, minor, makedev.
- Re: [PATCH libguestfs] Use AC_HEADER_MAJOR to find definitions of major, minor, makedev.
- [PATCH v2 2/2] builder: Choose better weights in the planner.
- [Bug 1893] New: Interix fails build due to makedev() as wrong macro name
- Re: [PATCH v2 2/2] builder: Choose better weights in the planner.