utils/pmx/pmx-2.7.0/libf2c/f2c.h: define abs() macro only if not provided by C Standard Lib. The following macro #define abs(x) ((x) >= 0 ? (x) : -(x)) in defined utils/pmx/pmx-2.7.0/libf2c/f2c.h. However, abs() is a POSIX function prototyped in stdlib.h. So if f2c.h is pulled in before stdlib.h in any code, then the protoype is munged by the macro. This happens when building pmx with recent versions of uClibc. We correct this by falling back on defining abs() as a macro only if its not available as a function. Signed-off-by: Anthony G. Basile diff -Naur source.orig/utils/pmx/config.h.in source/utils/pmx/config.h.in --- source.orig/utils/pmx/config.h.in 1969-12-31 19:00:00.000000000 -0500 +++ source/utils/pmx/config.h.in 2015-02-18 16:30:44.635003304 -0500 @@ -0,0 +1,61 @@ +/* config.h.in. Generated from configure.ac by autoheader. */ + +/* Define to 1 if you have the `abs' function. */ +#undef HAVE_ABS + +/* Define to 1 if you have the header file. */ +#undef HAVE_INTTYPES_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_MEMORY_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDINT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDLIB_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRINGS_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRING_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_STAT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_TYPES_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_UNISTD_H + +/* Name of package */ +#undef PACKAGE + +/* Define to the address where bug reports for this package should be sent. */ +#undef PACKAGE_BUGREPORT + +/* Define to the full name of this package. */ +#undef PACKAGE_NAME + +/* Define to the full name and version of this package. */ +#undef PACKAGE_STRING + +/* Define to the one symbol short name of this package. */ +#undef PACKAGE_TARNAME + +/* Define to the home page for this package. */ +#undef PACKAGE_URL + +/* Define to the version of this package. */ +#undef PACKAGE_VERSION + +/* The size of `long long', as computed by sizeof. */ +#undef SIZEOF_LONG_LONG + +/* Define to 1 if you have the ANSI C header files. */ +#undef STDC_HEADERS + +/* Version number of package */ +#undef VERSION diff -Naur source.orig/utils/pmx/configure.ac source/utils/pmx/configure.ac --- source.orig/utils/pmx/configure.ac 2014-11-17 07:28:11.000000000 -0500 +++ source/utils/pmx/configure.ac 2015-02-18 16:30:39.893003633 -0500 @@ -12,6 +12,7 @@ AC_CONFIG_SRCDIR([pmx-]pmx_version[/pmxab.c]) AC_CONFIG_AUX_DIR([../../build-aux]) AC_CONFIG_MACRO_DIR([../../m4]) +AC_CONFIG_HEADERS([config.h]) KPSE_BASIC([pmx]) @@ -32,6 +33,7 @@ AC_PROG_LN_S AC_PROG_MAKE_SET AC_PROG_RANLIB +AC_CHECK_FUNCS([abs]) AC_SEARCH_LIBS([sqrt], [m]) diff -Naur source.orig/utils/pmx/pmx-2.7.0/libf2c/f2c.h source/utils/pmx/pmx-2.7.0/libf2c/f2c.h --- source.orig/utils/pmx/pmx-2.7.0/libf2c/f2c.h 2013-01-18 02:59:22.000000000 -0500 +++ source/utils/pmx/pmx-2.7.0/libf2c/f2c.h 2015-02-18 16:32:58.491994029 -0500 @@ -7,6 +7,8 @@ #ifndef F2C_INCLUDE #define F2C_INCLUDE +#include "config.h" + typedef long int integer; typedef unsigned long int uinteger; typedef char *address; @@ -162,7 +164,9 @@ }; typedef struct Namelist Namelist; +#ifndef HAVE_ABS #define abs(x) ((x) >= 0 ? (x) : -(x)) +#endif #define dabs(x) (doublereal)abs(x) #undef min #undef max