Browse Source

re-introduce check for proper inclusion of unistd.h

Nathalie Furmento 7 years ago
parent
commit
e7d791c573
2 changed files with 11 additions and 13 deletions
  1. 11 1
      Makefile.am
  2. 0 12
      configure.ac

+ 11 - 1
Makefile.am

@@ -1,7 +1,7 @@
 # StarPU --- Runtime system for heterogeneous multicore architectures.
 #
 # Copyright (C) 2009-2017  Université de Bordeaux
-# Copyright (C) 2010, 2011, 2012, 2013, 2015, 2016  CNRS
+# Copyright (C) 2010, 2011, 2012, 2013, 2015, 2016, 2017  CNRS
 # Copyright (C) 2014  INRIA
 # Copyright (C) 2016  Inria
 #
@@ -138,6 +138,16 @@ if STARPU_DEVEL
 		echo "Please do not use getenv, use starpu_getenv instead, which catches unsafe uses"; \
 		false ; \
 	fi
+# we count the number of files which include unistd.h
+# we count the number of files which properly include unistd.h i.e by first detecting if it's available
+# and then we check both numbers are the same ...a
+	@UNISTD_ALL_LINES=$(shell grep -B1 -rs "^#include <unistd.h>" $(srcdir)/src/ $(srcdir)/include/ $(srcdir)/mpi/src $(srcdir)/mpi/include  |grep -v dolib|grep -v -e "--" | tr '\012' '@' | sed 's/unistd.h>@/unistd.h>\n/g' | wc -l) ;\
+	UNISTD_CORRECT_LINES=$(shell grep -B1 -rs "^#include <unistd.h>" $(srcdir)/src/ $(srcdir)/include/ $(srcdir)/mpi/src $(srcdir)/mpi/include  |grep -v dolib|grep -v -e "--" | tr '\012' '@' | sed 's/unistd.h>@/unistd.h>\n/g' | grep '#ifdef .*HAVE_UNISTD_H.*:#include <unistd.h>' | wc -l) ;\
+	if test $$UNISTD_ALL_LINES -ne $$UNISTD_CORRECT_LINES ; \
+	then \
+		echo "Please do not unconditionally include unistd.h, it is not available on Windows, include config.h and test for HAVE_UNISTD_H" ; \
+		false ; \
+	fi
 endif
 
 if BUILD_STARPU_TOP

+ 0 - 12
configure.ac

@@ -3252,18 +3252,6 @@ AC_SUBST(SOCL_VENDORS)
 AC_CONFIG_FILES(tests/regression/regression.sh tests/regression/profiles tests/regression/profiles.build.only)
 AC_CONFIG_HEADER(src/common/config.h include/starpu_config.h gcc-plugin/include/starpu-gcc/config.h starpu-top/config.h)
 
-#AH_BOTTOM([
-##if defined(STARPU_DEVEL) && defined(BUILDING_STARPU)
-##  ifndef STARPU_CHECKED_UNISTD_H
-##    define STARPU_CHECKED_UNISTD_H
-##    ifdef _UNISTD_H
-##      define _UNISTD_H PLEASE_DONT_INCLUDE_IT
-##      error Please do not unconditionally include unistd.h, it is not available on Windows, include config.h and test for HAVE_UNISTD_H
-##    endif
-##  endif
-##endif
-#])
-
 SANITIZE=$(echo $CFLAGS | grep sanitize)
 AM_CONDITIONAL(STARPU_SANITIZE, test -n "$SANITIZE")