#6 Portability improvements
Merged 2 years ago by andyp. Opened 2 years ago by andyp.

file modified
+8 -7
@@ -1,7 +1,7 @@ 

  

  # Process this file with autoconf to produce a configure script.

  

- AC_PREREQ([2.63])

+ AC_PREREQ([2.69])

  AC_INIT([gfs2-utils], [3.4.1.1.dev], [cluster-devel@redhat.com])

  AM_INIT_AUTOMAKE([-Wno-portability])

  AM_SILENT_RULES([yes])
@@ -13,13 +13,13 @@ 

  AC_CONFIG_HEADERS([make/clusterautoconfig.h])

  

  AC_CANONICAL_HOST

- AC_PROG_LIBTOOL

+ LT_INIT

  

  AC_LANG([C])

  

  #i18n support

  AM_GNU_GETTEXT([external])

- AM_GNU_GETTEXT_VERSION([0.18])

+ AM_GNU_GETTEXT_VERSION([0.19])

  

  # Sanitize path

  
@@ -61,7 +61,7 @@ 

  AC_PROG_LN_S

  AC_PROG_INSTALL

  AC_PROG_MAKE_SET

- AC_PROG_LEX

+ AC_PROG_LEX([noyywrap])

  test "$LEX" != "flex" && AC_MSG_ERROR([flex not found])

  AC_CHECK_PROG([YACC], [bison], [bison -y])

  test x"$YACC" = x && AC_MSG_ERROR([bison not found])
@@ -91,15 +91,16 @@ 

  

  # local options

  AC_ARG_ENABLE([debug],

- 	AC_HELP_STRING([--enable-debug],[enable debug build [default=no]]),

+ 	AS_HELP_STRING([--enable-debug],[enable debug build [default=no]]),

  	[], [enable_debug="no"])

  AC_ARG_ENABLE([gcov],

- 	AC_HELP_STRING([--enable-gcov],[enable coverage instrumentation [default=no]]),

+ 	AS_HELP_STRING([--enable-gcov],[enable coverage instrumentation [default=no]]),

  	[], [enable_gcov="no"])

  AC_ARG_ENABLE([gprof],

- 	AC_HELP_STRING([--enable-gprof],[enable profiling instrumentation [default=no]]),

+ 	AS_HELP_STRING([--enable-gprof],[enable profiling instrumentation [default=no]]),

  	[], [enable_gprof="no"])

  

+ AC_CHECK_FUNCS([on_exit])

  

  # We use the Check framework for unit tests

  PKG_CHECK_MODULES([check], [check >= 0.10.0],

@@ -9,6 +9,7 @@ 

  

  gfs2_convert_LDADD = \

  	$(top_builddir)/gfs2/libgfs2/libgfs2.la \

+ 	$(LTLIBINTL) \

  	$(uuid_LIBS)

  

  if HAVE_CHECK

file modified
+1
@@ -38,6 +38,7 @@ 

  

  fsck_gfs2_LDADD = \

  	$(top_builddir)/gfs2/libgfs2/libgfs2.la \

+ 	$(LTLIBINTL) \

  	$(uuid_LIBS)

  

  if HAVE_CHECK

file modified
+15
@@ -258,10 +258,21 @@ 

  	return 0;

  }

  

+ /*

+  * on_exit() is non-standard but useful for reporting the exit status if it's

+  * available.

+  */

+ #ifdef HAVE_ON_EXIT

  static void exitlog(int status, void *unused)

  {

  	syslog(LOG_INFO, "exit: %d", status);

  }

+ #else

+ static void exitlog(void)

+ {

+ 	syslog(LOG_INFO, "exit.");

+ }

+ #endif

  

  static void startlog(int argc, char **argv)

  {
@@ -304,7 +315,11 @@ 

  

  	openlog("fsck.gfs2", LOG_CONS|LOG_PID, LOG_USER);

  	startlog(argc - 1, &argv[1]);

+ #ifdef HAVE_ON_EXIT

  	on_exit(exitlog, NULL);

+ #else

+ 	atexit(exitlog);

+ #endif

  

  	memset(sdp, 0, sizeof(*sdp));

  

file modified
-1
@@ -3,7 +3,6 @@ 

  #include <stdlib.h>

  #include <stdio.h>

  #include <unistd.h>

- #include <sys/queue.h>

  #include <errno.h>

  #include <limits.h>

  #include <ctype.h>

file modified
+6 -2
@@ -17,7 +17,9 @@ 

  #include "osi_list.h"

  #include "osi_tree.h"

  

- __BEGIN_DECLS

+ #ifdef  __cplusplus

+ extern "C" {

+ #endif

  

  #if __BYTE_ORDER == __BIG_ENDIAN

  
@@ -795,6 +797,8 @@ 

  extern void lgfs2_leaf_in(struct lgfs2_leaf *lf, void *lfp);

  extern void lgfs2_leaf_out(struct lgfs2_leaf *lf, void *lfp);

  

- __END_DECLS

+ #ifdef  __cplusplus

+ }

+ #endif

  

  #endif /* __LIBGFS2_DOT_H__ */

file modified
+3
@@ -29,6 +29,7 @@ 

  	$(uuid_CFLAGS)

  mkfs_gfs2_LDADD	= \

  	$(top_builddir)/gfs2/libgfs2/libgfs2.la \

+ 	$(LTLIBINTL) \

  	$(blkid_LIBS) \

  	$(uuid_LIBS)

  
@@ -40,6 +41,7 @@ 

  gfs2_grow_CFLAGS = $(blkid_CFLAGS)

  gfs2_grow_LDADD = \

  	$(top_builddir)/gfs2/libgfs2/libgfs2.la \

+ 	$(LTLIBINTL) \

  	$(blkid_LIBS) \

  	$(uuid_LIBS)

  
@@ -50,6 +52,7 @@ 

  gfs2_jadd_CPPFLAGS = $(COMMON_CPPFLAGS)

  gfs2_jadd_LDADD = \

  	$(top_builddir)/gfs2/libgfs2/libgfs2.la \

+ 	$(LTLIBINTL) \

  	$(uuid_LIBS)

  

  if HAVE_CHECK

file modified
+1 -1
@@ -45,7 +45,7 @@ 

  

  static int discard_blocks(int fd, uint64_t start, uint64_t len)

  {

- 	__uint64_t range[2] = { start, len };

+ 	uint64_t range[2] = { start, len };

  

  	if (ioctl(fd, BLKDISCARD, &range) < 0)

  		return errno;

file modified
+1 -1
@@ -667,7 +667,7 @@ 

  		return -1;

  	}

  	if (S_ISLNK(lnkstat.st_mode)) {

- 		abspath = canonicalize_file_name(path);

+ 		abspath = realpath(path, NULL);

  		if (abspath == NULL) {

  			perror(_("Could not find the absolute path of the device"));

  			return -1;

file modified
+1
@@ -15,6 +15,7 @@ 

  	$(uuid_CFLAGS)

  tunegfs2_LDADD = \

  	$(top_builddir)/gfs2/libgfs2/libgfs2.la \

+ 	$(LTLIBINTL) \

  	$(uuid_LIBS)

  

  if HAVE_CHECK

Portability improvements based on compiling against musl libc on Alpine Linux.

We will still need to replace two rpmatch() calls to fully fix the build against musl but this gets us most of the way there.

Pull-Request has been merged by andyp

2 years ago