[MOAB-dev] r2052 - in MOAB/trunk: . tools/mbzoltan

kraftche at mcs.anl.gov kraftche at mcs.anl.gov
Fri Aug 29 11:51:46 CDT 2008


Author: kraftche
Date: 2008-08-29 11:51:46 -0500 (Fri, 29 Aug 2008)
New Revision: 2052

Modified:
   MOAB/trunk/configure.in
   MOAB/trunk/tools/mbzoltan/Makefile.am
Log:
Overhaul Zoltan configuration/detection:
  - require no options if Zoltan and Parmetis are in default search path
  - require --with-zoltan-arch only when necessary to disambiguate between
     mulitple Obj_$ARCH directories.
  - detect whether or not Zoltan requires Parmetis (don't require Parmetis
     if Zoltan doesn't.)
     
This problably needs more work.  Zoltan can also optionally depend on 
other libraries (e.g. PaToH and Nemesis) that we don't handle.





Modified: MOAB/trunk/configure.in
===================================================================
--- MOAB/trunk/configure.in	2008-08-29 03:21:07 UTC (rev 2051)
+++ MOAB/trunk/configure.in	2008-08-29 16:51:46 UTC (rev 2052)
@@ -285,53 +285,99 @@
 #                           Zoltan
 ################################################################################
 if test $ENABLE_mbzoltan = yes; then
-  AC_ARG_WITH([zoltan], 
-   [AC_HELP_STRING([--with-zoltan=DIR],[Specify directory containing Zoltan])],
-   [ZOLTAN_DIR="$withval"
-    DISTCHECK_CONFIGURE_FLAGS="$DISTCHECK_CONFIGURE_FLAGS --with-zoltan=\"${withval}\""
-   ],[ZOLTAN_DIR=unknown])
-  AC_ARG_WITH([zoltan-arch],
-   [AC_HELP_STRING([--with-zoltan-arch=OS],[Specify zoltan architecture])],
-   [ZOLTAN_ARCH="$withval"],[ZOLTAN_ARCH=unknown])
-  case "x$ZOLTAN_DIR" in
-    xno|x)
-      ZOLTAN_MISSING=yes
-      ;;
-    xyes)
-      AC_MSG_ERROR([--enable-mbzoltan requires an argument])
-      ;;
-  esac
   if test "x$WITH_MPI" = "xno"; then
-     AC_MSG_ERROR([--enable-mbzoltan requires --with-mpi too!])
+     AC_MSG_ERROR([--enable-mbzoltan requires MPI, try specifying --with-mpi])
   fi
-  if ! test -d "$ZOLTAN_DIR"; then
-    AC_MSG_WARN([$ZOLTAN_DIR : not a directory.])
-  fi
-  AC_CHECK_FILES([${ZOLTAN_DIR}/include/zoltan.h],
-                [], [AC_MSG_WARN([$ZOLTAN_DIR : not a valid zoltan source]); ZOLTAN_MISSING=yes])
+  
 
-  ZOLTAN_INCLUDES="-I${ZOLTAN_DIR}/include"
-  ZOLTAN_LIBS="-L${ZOLTAN_DIR}/Obj_${ZOLTAN_ARCH} -lzoltan"
+  ZOLTAN_LIB_FLAGS=
+  ZOLTAN_INC_FLAGS=
+  ZOLTAN_LIBS=
+  ZOLTAN_ARCH=
+  ZOLTAN_DIR=
 
-  AC_ARG_WITH(parmetis, 
-  [AC_HELP_STRING([--with-parmetis=DIR], [Specify directory containing parmetis library])],
-  [PARMETIS_DIR=$withval], [PARMETIS_DIR=])
-  case "x$PARMETIS_DIR" in
-    xno|x)
-      PARMETIS_MISSING=yes
-      ;;
-    xyes)
-      AC_MSG_ERROR([--with-parmetis requires an argument])
-      ;;
-  esac
-  if test -d "$PARMETIS_DIR"; then
-    ZOLTAN_LIBS="$ZOLTAN_LIBS -L$PARMETIS_DIR -lparmetis -lmetis"
-  fi
+  AC_ARG_WITH( [zoltan], 
+               [AC_HELP_STRING([--with-zoltan=DIR],[Specify Zoltan build directory])],
+               [if test "xyes" = "$withval"; then 
+                  AC_MSG_WARN([Ingoring --with-zoltan flag w/out value])
+                elif test -d $withval/$include; then
+                  ZOLTAN_INC_FLAGS="$ZOLTAN_INC_FLAGS -I$withval/include"
+                  ZOLTAN_DIR="$withval"
+                else
+                  AC_MSG_ERROR("$withval/include : not a directory")
+                fi
+                DISTCHECK_CONFIGURE_FLAGS="$DISTCHECK_CONFIGURE_FLAGS --with-zoltan=\"${withval}\""
+               ])
 
-  AC_SUBST(ZOLTAN_DIR)
+  AC_ARG_WITH([zoltan-arch],
+   [AC_HELP_STRING([--with-zoltan-arch=OS],[Specify zoltan architecture])],
+   [if test "xyes" = "x$withval"; then
+      AC_MSG_ERROR([--with-zoltan-arch flag requires a value])
+    elif test "x" = "x$ZOLTAN_DIR"; then
+      AC_MSG_WARN([Ingoring --with-zoltan-arch without --with-zoltan])
+    elif test -d "$ZOLTAN_DIR/Obj_$withval"; then
+      ZOLTAN_LIB_FLAGS="$ZOLTAN_LIB_FLAGS -L$ZOLTAN_DIR/Obj_$withval"
+    else
+      AC_MSG_ERROR("$ZOLTAN_DIR/Obj_$withval : not a directory")
+    fi],
+   [if test "x" != "x$ZOLTAN_DIR"; then
+      AC_MSG_WARN([Expect --with-zoltan-arch with --with-zoltan])
+      if test -d $ZOLTAN_DIR/lib; then
+        AC_MSG_WARN("Guessing '$ZOLTAN_DIR/lib'")
+        ZOLTAN_LIB_FLAGS="$ZOLTAN_LIB_FLAGS -L$ZOLTAN_DIR/lib"
+      else
+        # if only one Obj_$ARCH dir, then us it
+        found=no
+        for dir in $ZOLTAN_DIR/Obj_*; do
+          if test -d $dir; then
+            if test "xyes" = "x$found"; then
+              AC_MSG_ERROR("Multiple Zoltan Obj_$ARCH dirs.  --with-zoltan-arch required.")
+            fi
+            ZOLTAN_LIB_FLAGS="$ZOLTAN_LIB_FLAGS -L$dir"
+            found=yes
+          fi
+        done
+        if test "xno" = "x$found"; then
+          AC_MSG_ERROR('No Zoltan Obj_$ARCH dir found.  --with-zoltan-arch required.')
+        fi
+      fi
+    fi
+   ])
+
+  AC_ARG_WITH([parmetis], 
+              [AC_HELP_STRING([--with-parmetis=DIR], 
+                [Directory containing Parmetis library for Zoltan])],
+              [if test "xyes" = "$withval"; then 
+                 AC_MSG_WARN([Ingoring --with-parmetis flag w/out value])
+               elif test -d "$withval"; then
+                 ZOLTAN_LIB_FLAGS="$ZOLTAN_LIB_FLAGS -L$withval"
+               else
+                 AC_MSG_ERROR("$withval: not a directory")
+               fi]
+               DISTCHECK_CONFIGURE_FLAGS="$DISTCHECK_CONFIGURE_FLAGS --with-parmetis=\"${withval}\""
+             )
+
+  old_CPPFLAGS="$CPPFLAGS"
+  CPPFLAGS="$CPPFLAGS $ZOLTAN_INC_FLAGS -DMPICH_IGNORE_CXX_SEEK"
+  AC_LANG_PUSH([C++])
+  AC_CHECK_HEADER([zoltan_cpp.h],[],[AC_MSG_ERROR("mbzoltan requires zoltan")])
+  AC_LANG_POP([C++])
+  CPPFLAGS="$old_CPPFLAGS"
+  
+  old_LDFLAGS="$LDFLAGS"
+  LDFLAGS="$LDFLAGS $ZOLTAN_LIB_FLAGS"
+  AC_CHECK_LIB([zoltan],[Zoltan_LB_Partition],[ZOLTAN_LIBS='-lzoltan'],
+    [unset ac_cv_lib_zoltan_Zoltan_LB_Partition
+     AC_CHECK_LIB([zoltan],[Zoltan_LB_Partition],
+                  [ZOLTAN_LIBS="-lzoltan -lparmetis -lmetis"],
+                  [AC_MSG_ERROR("mbzoltan requires zoltan")],
+                  [-lparmetis -lmetis])])
+  LDFLAGS="$old_LDFLAGS"
+  
+
   AC_SUBST(ZOLTAN_LIBS)
-  AC_SUBST(ZOLTAN_INCLUDES)
-  AC_SUBST(ZOLTAN_ARCH)
+  AC_SUBST(ZOLTAN_LIB_FLAGS)
+  AC_SUBST(ZOLTAN_INC_FLAGS)
 fi
 
 ################################################################################

Modified: MOAB/trunk/tools/mbzoltan/Makefile.am
===================================================================
--- MOAB/trunk/tools/mbzoltan/Makefile.am	2008-08-29 03:21:07 UTC (rev 2051)
+++ MOAB/trunk/tools/mbzoltan/Makefile.am	2008-08-29 16:51:46 UTC (rev 2052)
@@ -1,9 +1,9 @@
 AUTOMAKE_OPTIONS = foreign
 DEFS = $(DEFINES) -DIS_BUILDING_MB
-INCLUDES += -I$(top_srcdir) -I$(top_builddir) $(ZOLTAN_INCLUDES)
+INCLUDES += -I$(top_srcdir) -I$(top_builddir) $(ZOLTAN_INC_FLAGS)
 bin_PROGRAMS = mbzoltan
 mbzoltan_SOURCES = MBZoltan.cpp MBZoltan.hpp main.cpp
-LDADD = $(top_builddir)/libMOAB.la $(ZOLTAN_LIBS)
+mbzoltan_LDADD = $(top_builddir)/libMOAB.la $(ZOLTAN_LIB_FLAGS) $(ZOLTAN_LIBS)
 mbzoltan_DEPENDENCIES = $(top_builddir)/libMOAB.la
 
 




More information about the moab-dev mailing list