File quantum_espresso_do_not_set_xlf_for_powerpc.patch of Package quantum-espresso

From: Michel Normand <normand@linux.vnet.ibm.com>
Subject: quantum espresso do not set xlf for powerpc
Date: Thu, 06 Aug 2015 18:56:52 +0200

There are two changes in this patch, specific to ppc/ppc64le:

1- do not set xlf for powerpc.
This probably need more discussion with upstream
but at least required to avoid ppc64/ppc64le build error:
===
[   74s] gfortran -fmessage-length=0 -grecord-gcc-switches -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables -g -x f95-cpp-input -D__XLF -D__GFORTRAN -D__STD_F95 -D__FFTW3   -I../include -I../iotk/src -I../ELPA/src -I. -c parser.f90
[   74s] f951: Warning: Nonexistent include directory '../ELPA/src' [-Wmissing-include-dirs]
[   74s] parser.f90:65:21:
[   74s] 
[   74s]      CHARACTER(LEN=1), AUTOMATIC             :: sep1, sep2    
[   74s]                      1
[   74s] Error: Invalid character in name at (1)
===

2- undef vector and pixel for cpp preprocessor
Required to avoid ppc64/ppc64le build error:
===
[  494s] cpp -P -C -traditional -D__FFTW3 -D__MPI -D__PARA  -I../include input_parameters.f90 -o input_parameters.F90 ; \
[  494s]  /usr/lib64/mpi/gcc/openmpi/bin/mpif90 -fmessage-length=0 -grecord-gcc-switches -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables -g -D__FFTW3 -D__MPI -D__PARA   -I../include -I../iotk/src -I../ELPA/src -I. -c input_parameters.F90 -o input_parameters.o
[  494s] input_parameters.f90:221:0: error: detected recursion whilst expanding macro "vector"
[  494s]            ! G-vector for polarization calculation ( related to lberry )
[  494s]  ^
===

Signed-off-by: Michel Normand <normand@linux.vnet.ibm.com>
---
 install/configure            |    8 ++++----
 install/configure.ac         |    8 ++++----
 install/m4/x_ac_qe_mpif90.m4 |    1 -
 3 files changed, 8 insertions(+), 9 deletions(-)

Index: espresso-5.1.2/install/configure
===================================================================
--- espresso-5.1.2.orig/install/configure
+++ espresso-5.1.2/install/configure
@@ -2268,7 +2268,6 @@ necsx )
 ppc64 )
         try_mpif90="mpxlf90_r mpf90_r mpif90"
         try_f90="xlf90_r $try_f90"
-        try_dflags="-D__XLF"
         try_arflags="ruv"
         ;;
 # PowerPC MareNostrum
@@ -5928,9 +5927,10 @@ if test "$cpp" = "" ; then cpp=$try_cpp;
 echo setting CPP... $cpp
 
 echo $ECHO_N "setting CPPFLAGS... $ECHO_C"
-case $cpp in
-        cpp)  try_cppflags="-P -C -traditional" ;;
-        fpp)  try_cppflags="-P -C "              ;;
+case "$arch:$cpp" in
+  ppc64:cpp)  try_cppflags="-P -C -traditional -Uvector -Upixel" ;;
+      *:cpp)  try_cppflags="-P -C -traditional" ;;
+      *:fpp)  try_cppflags="-P -C "              ;;
         *)    try_cppflags=""                ;;
 esac
 if test "$cppflags" = "" ; then cppflags=$try_cppflags ; fi
Index: espresso-5.1.2/install/configure.ac
===================================================================
--- espresso-5.1.2.orig/install/configure.ac
+++ espresso-5.1.2/install/configure.ac
@@ -284,7 +284,6 @@ necsx )
 ppc64 )
         try_mpif90="mpxlf90_r mpf90_r mpif90"
         try_f90="xlf90_r $try_f90"
-        try_dflags="-D__XLF"
         try_arflags="ruv"
         ;;
 # PowerPC MareNostrum
@@ -884,9 +883,10 @@ if test "$cpp" = "" ; then cpp=$try_cpp;
 echo setting CPP... $cpp
 
 echo $ECHO_N "setting CPPFLAGS... $ECHO_C"
-case $cpp in
-        cpp)  try_cppflags="-P -C -traditional" ;;
-        fpp)  try_cppflags="-P -C "              ;;
+case "$arch:$cpp" in
+  ppc64:cpp)  try_cppflags="-P -C -traditional -Uvector -Upixel" ;;
+      *:cpp)  try_cppflags="-P -C -traditional" ;;
+      *:fpp)  try_cppflags="-P -C "              ;;
         *)    try_cppflags=""                ;;
 esac
 if test "$cppflags" = "" ; then cppflags=$try_cppflags ; fi
Index: espresso-5.1.2/install/m4/x_ac_qe_mpif90.m4
===================================================================
--- espresso-5.1.2.orig/install/m4/x_ac_qe_mpif90.m4
+++ espresso-5.1.2/install/m4/x_ac_qe_mpif90.m4
@@ -64,7 +64,6 @@ necsx )
 ppc64 )
         try_mpif90="mpxlf90_r mpf90_r mpif90"
         try_f90="xlf90_r $try_f90"
-        try_dflags="-D__XLF"
         ;;
 # PowerPC MareNostrum
 ppc64-mn )
openSUSE Build Service is sponsored by