[PATCH] Fix build on HP-UX 11.11

Mikulas Patocka mikulas at artax.karlin.mff.cuni.cz
Fri Dec 7 01:10:39 UTC 2012


Hi

Fix build on HP-UX 11.11

HP-UX 11.11 doesn't have strtoll, but it has strtoimax. strtoimax is
defined as a preprocessor macro, not as a function.

This patch fixes build: it adds checks for two function strtoll and
strtoimax and uses them if detected.


BTW. in ./src/vfs/fish/fish.c and ./lib/vfs/parse_ls_vga.c there is a 
detection for atoll and if atoll is not found, atof is used. Shouldn't 
strtoll (or strtoimax) be used instead of atof?


Mikulas

Index: mc-4.8.6/configure.ac
===================================================================
--- mc-4.8.6.orig/configure.ac
+++ mc-4.8.6/configure.ac
@@ -190,6 +190,8 @@ dnl Check for functions
 dnl ############################################################################
 
 AC_CHECK_FUNCS([\
+	strtoll \
+	strtoimax \
 	atoll \
 	isascii \
 	statfs sysconf \
Index: mc-4.8.6/lib/global.h
===================================================================
--- mc-4.8.6.orig/lib/global.h
+++ mc-4.8.6/lib/global.h
@@ -55,6 +55,16 @@
 #include <unix.h>
 #endif
 
+/* HP-UX 11.11 doesn't have strtoll. But it has strtoimax defined as a macro */
+#include <stdlib.h>
+#ifndef HAVE_STRTOLL
+#if defined(HAVE_STRTOIMAX) || defined(strtoimax)
+#define strtoll strtoimax
+#else
+#define strtoll strtol
+#endif
+#endif
+
 #include <glib.h>
 #include "glibcompat.h"
 



More information about the mc-devel mailing list