summaryrefslogtreecommitdiffstats
path: root/configure
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2020-06-22 20:00:38 +0000
committerIngo Schwarze <schwarze@openbsd.org>2020-06-22 20:00:38 +0000
commit992351efb7c048f2feace7e85c00a1735739edcf (patch)
treeb53548bb95a750eb0ffdf178fea1584bf8e54ee5 /configure
parent23725517c855826c2ed76257c280b26e55e87c09 (diff)
downloadmandoc-992351efb7c048f2feace7e85c00a1735739edcf.tar.gz
Provide a real feature test for __attribute__().
Looking at version numbers like __GNUC__ is always a bad idea. Believe it or not, this even makes ./configure shorter by one line.
Diffstat (limited to 'configure')
-rwxr-xr-xconfigure7
1 files changed, 3 insertions, 4 deletions
diff --git a/configure b/configure
index 4eb61c0b..6f77484b 100755
--- a/configure
+++ b/configure
@@ -55,6 +55,7 @@ BUILD_CGI=0
BUILD_CATMAN=0
INSTALL_LIBMANDOC=0
+HAVE_ATTRIBUTE=
HAVE_CMSG=
HAVE_DIRENT_NAMLEN=
HAVE_EFTYPE=
@@ -294,6 +295,7 @@ fi
# --- tests for config.h ----------------------------------------------
# --- library functions ---
+runtest attribute ATTRIBUTE || true
runtest cmsg CMSG "" "-D_XPG4_2" || true
runtest dirent-namlen DIRENT_NAMLEN || true
runtest be32toh ENDIAN || true
@@ -422,10 +424,6 @@ cat << __HEREDOC__
#error "Do not use C++. See the INSTALL file."
#endif
-#if !defined(__GNUC__) || (__GNUC__ < 4)
-#define __attribute__(x)
-#endif
-
__HEREDOC__
[ ${NEED_GNU_SOURCE} -eq 0 ] || echo "#define _GNU_SOURCE"
@@ -447,6 +445,7 @@ echo "#define OSENUM ${OSENUM}"
[ -n "${OSNAME}" ] && echo "#define OSNAME \"${OSNAME}\""
[ -n "${UTF8_LOCALE}" ] && echo "#define UTF8_LOCALE \"${UTF8_LOCALE}\""
[ -n "${HOMEBREWDIR}" ] && echo "#define HOMEBREWDIR \"${HOMEBREWDIR}\""
+[ ${HAVE_ATTRIBUTE} -eq 0 ] && echo "#define __attribute__(x)"
[ ${HAVE_EFTYPE} -eq 0 ] && echo "#define EFTYPE EINVAL"
[ ${HAVE_O_DIRECTORY} -eq 0 ] && echo "#define O_DIRECTORY 0"
[ ${HAVE_PATH_MAX} -eq 0 ] && echo "#define PATH_MAX 4096"