From 2a98f9fcc39fb7e5bb61c02978fdfd7abce6b768 Mon Sep 17 00:00:00 2001
From: Gilles Gouaillardet <gilles@rist.or.jp>
Date: Thu, 14 Jul 2016 09:28:48 +0900
Subject: [PATCH] oshmem: replace header files in include/mpp with symlinks

This is a work around to avoit what looks like a CMake bug

Thanks Paul Kapinos for the report

Fixes open-mpi/ompi#1868
---
 oshmem/include/Makefile.am  | 13 +++++++++++--
 oshmem/include/mpp/shmem.fh | 11 -----------
 oshmem/include/mpp/shmem.h  | 16 ----------------
 3 files changed, 11 insertions(+), 29 deletions(-)
 delete mode 100644 oshmem/include/mpp/shmem.fh
 delete mode 100644 oshmem/include/mpp/shmem.h

diff --git a/oshmem/include/Makefile.am b/oshmem/include/Makefile.am
index cd239f4031..7532cfeda0 100644
--- a/oshmem/include/Makefile.am
+++ b/oshmem/include/Makefile.am
@@ -1,5 +1,7 @@
 # Copyright (c) 2013-2015 Mellanox Technologies, Inc.
 #                         All rights reserved.
+# Copyright (c) 2016      Research Organization for Information Science
+#                         and Technology (RIST). All rights reserved.
 # $COPYRIGHT$
 #
 # Additional copyrights may follow
@@ -22,9 +24,16 @@ include_HEADERS += shmem.fh \
         shmemx.h \
         shmem-compat.h
 
-nobase_include_HEADERS = mpp/shmem.h \
-                         mpp/shmem.fh
+# Create symlinks for the (now deprecated) files in $(includedir)/mpp directory
+install-exec-hook:
+	test -z "$(includedir)" || $(MKDIR_P) "$(DESTDIR)$(includedir)/mpp"
+	(cd $(DESTDIR)$(includedir)/mpp; rm -f shmem.h; $(LN_S) ../shmem.h shmem.h)
+	(cd $(DESTDIR)$(includedir)/mpp; rm -f shmem.fh; $(LN_S) ../shmem.fh shmem.fh)
 
+uninstall-local:
+	rm -f $(DESTDIR)/$(includedir)/mpp/shmem.h \
+	      $(DESTDIR)/$(includedir)/mpp/shmem.fh
+	
 # These files are always installed in $(includedir), but shouldn't be
 # shipped since they are generated by configure from their .in
 # counterparts (which AM automatically ships).
diff --git a/oshmem/include/mpp/shmem.fh b/oshmem/include/mpp/shmem.fh
deleted file mode 100644
index 2b06f34026..0000000000
--- a/oshmem/include/mpp/shmem.fh
+++ /dev/null
@@ -1,11 +0,0 @@
-!
-!   Copyright (c) 2013      Mellanox Technologies, Inc.
-!                           All rights reserved.
-!   $COPYRIGHT$
-!
-!   Additional copyrights may follow
-!
-!   $HEADER$
-!
-
-      include 'shmem.fh'
diff --git a/oshmem/include/mpp/shmem.h b/oshmem/include/mpp/shmem.h
deleted file mode 100644
index 3417da1508..0000000000
--- a/oshmem/include/mpp/shmem.h
+++ /dev/null
@@ -1,16 +0,0 @@
-/*
- * Copyright (c) 2013      Mellanox Technologies, Inc.
- *                         All rights reserved.
- * $COPYRIGHT$
- *
- * Additional copyrights may follow
- *
- * $HEADER$
- */
-
-#ifndef __MPP_SHMEM_H__
-#define __MPP_SHMEM_H__
-
-#include <shmem.h>
-
-#endif