[gmx-users] building GROMACS 4.5.4 on Power6 with CMAKE

Mark Abraham Mark.Abraham at anu.edu.au
Fri Sep 9 16:40:11 CEST 2011


On 9/09/2011 10:01 PM, Marcin Zielinski wrote:
> Ok, giving -DGMX_ACCELERATE=Power6 results with:
>
> src/config.h
> /* Define to a macro mangling the given C identifier (in lower and upper
>    case), which must not contain underscores, for linking with 
> Fortran. */
> #define F77_FUNC(name,NAME)      name ##
>
> /* As F77_FUNC, but for C identifiers containing underscores. */
> #define F77_FUNC_(name,NAME)     name ##
>
> which, after issuing make, results with an error message at the very 
> beginning:
> "/home/grmcs454/gromacsdir/test-build/src/config.h", line 45.39: 
> 1506-210 (S) The ## operator requires two operands.
> "/home/grmcs454/gromacsdir/test-build/src/config.h", line 48.39: 
> 1506-210 (S) The ## operator requires two operands.
>
> I checked cmake/CMakeLists.txt and '##' are put explicitly therefor 
> they will be present with _
> afterwards or without it, thus giving this error every time You put 
> Power6 or Fortran option on.
> As far as I understand.

They make sense if $suffix is non-empty, but it can be empty, so it 
looks like someone didn't code this right. If the patch below works, let 
me know and I'll fix the source version.

Mark

diff --git a/CMakeLists.txt b/CMakeLists.txt
index f26734d..a59a1de 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -636,13 +636,24 @@ if(GMX_FORTRAN OR GMX_POWER6)
      if(prefix)
        set(prefix "${prefix} ##")
      endif(prefix)
+    if(suffix)
+      set(suffix "## ${suffix}")
+      if(extrasuffix)
+       set(extrasuffix "${suffix}${extrasuffix}")
+      endif(extrasuffix)
+    else(suffix)
+      if(extrasuffix)
+       # Don't know if this is needed, but it can't hurt
+       set(extrasuffix "## ${extrasuffix}")
+      endif(extrasuffix)
+    endif(suffix)

      if(isupper)
-        set(F77_FUNCDEF   "${prefix} NAME ## ${suffix}")
-        set(F77_FUNCDEF_  "${prefix} NAME ## ${suffix}${extrasuffix}")
+        set(F77_FUNCDEF   "${prefix} NAME ${suffix}")
+        set(F77_FUNCDEF_  "${prefix} NAME ${extrasuffix}")
      else(isupper)
-        set(F77_FUNCDEF   "${prefix} name ## ${suffix}")
-        set(F77_FUNCDEF_  "${prefix} name ## ${suffix}${extrasuffix}")
+        set(F77_FUNCDEF   "${prefix} name ${suffix}")
+        set(F77_FUNCDEF_  "${prefix} name ${extrasuffix}")
      endif(isupper)
  else(GMX_FORTRAN OR GMX_POWER6)
          set(F77_FUNCDEF   "name ## _")




More information about the gromacs.org_gmx-users mailing list