<commit_before># -------------------------------------------------------------
# PETSc
# -------------------------------------------------------------
AC_DEFUN([CONFIGURE_PETSC],
[
  AC_ARG_ENABLE(petsc,
                AS_HELP_STRING([--disable-petsc],
                               [build without PETSc iterative solver suppport]),
                [case "${enableval}" in
                  yes)  enablepetsc=yes ;;
                   no)  enablepetsc=no ;;
                    *)  AC_MSG_ERROR(bad value ${enableval} for --enable-petsc) ;;
                 esac],
                [enablepetsc=$enableoptional])

  # Trump --enable-petsc with --disable-mpi
  if (test "x$enablempi" = xno); then
    enablepetsc=no
  fi

  AC_ARG_VAR([PETSC_DIR],  [path to PETSc installation])
  AC_ARG_VAR([PETSC_ARCH], [PETSc build architecture])

  if (test "$enablepetsc" !=  no) ; then
    # AC_REQUIRE:
    # If the M4 macro AC_PROG_F77 has not already been called, call
    # it (without any arguments). Make sure to quote AC_PROG_F77 with
    # square brackets. AC_PROG_F77 must have been defined using
    # AC_DEFUN or else contain a call to AC_PROVIDE to indicate
    # that it has been called.
    AC_REQUIRE([AC_PROG_F77])

    # If the user doesn't have any PETSC directory specified, let's check to
    # see if it's installed via Ubuntu module
    if (test "x$PETSC_DIR" = x); then
      AC_PATH_PROG(PETSCARCH, petscarch)
      if (test "x$PETSCARCH" != x); then
        export PETSC_DIR=/usr/lib/petsc
        export PETSC_ARCH=`$PETSCARCH`
        if (test -d $PETSC_DIR); then
          AC_MSG_RESULT([using system-provided PETSC_DIR $PETSC_DIR])
          AC_MSG_RESULT([using system-provided PETSC_ARCH $PETSC_ARCH])
        fi
      fi
    fi

    # Let's use a C compiler for the AC_CHECK_HEADER test, although this is
    # not strictly necessary...
    AC_LANG_PUSH(C)
    AC_CHECK_HEADER($PETSC_DIR/include/petscversion.h,
                    [enablepetsc=yes],
                    [enablepetsc=no])
    AC_LANG_POP

    # Grab PETSc version and substitute into Makefile.
    # If version 2.x, also check that PETSC_ARCH is set
    # This if-test used to be: if (test -r $PETSC_DIR/include/petsc.h) ; then
    if (test "$enablepetsc" !=  no) ; then
      # Some tricks to discover the version of petsc.
      # You have to have grep and sed for this to work.
      petscmajor=`grep "define PETSC_VERSION_MAJOR" $PETSC_DIR/include/petscversion.h | sed -e "s/#define PETSC_VERSION_MAJOR[ ]*//g"`
      petscminor=`grep "define PETSC_VERSION_MINOR" $PETSC_DIR/include/petscversion.h | sed -e "s/#define PETSC_VERSION_MINOR[ ]*//g"`
      petscsubminor=`grep "define PETSC_VERSION_SUBMINOR" $PETSC_DIR/include/petscversion.h | sed -e "s/#define PETSC_VERSION_SUBMINOR[ ]*//g"`
      petscrelease=`grep "define PETSC_VERSION_RELEASE" $PETSC_DIR/include/petscversion.h | sed -e "s/#define PETSC_VERSION_RELEASE[ ]*//g"`
      petscversion=$petscmajor.$petscminor.$petscsubminor
      petscmajorminor=$petscmajor.$petscminor.x

      AC_SUBST(petscversion)
      AC_SUBST(petscmajor)
      AC_SUBST(petscmajorminor)

      AC_DEFINE_UNQUOTED(DETECTED_PETSC_VERSION_MAJOR, [$petscmajor],
        [PETSc's major version number, as detected by petsc.m4])

      AC_DEFINE_UNQUOTED(DETECTED_PETSC_VERSION_MINOR, [$petscminor],
        [PETSc's minor version number, as detected by petsc.m4])

      AC_DEFINE_UNQUOTED(DETECTED_PETSC_VERSION_SUBMINOR, [$petscsubminor],
        [PETSc's subminor version number, as detected by petsc.m4])

      AC_DEFINE_UNQUOTED(DETECTED_PETSC_VERSION_RELEASE, [$petscrelease],
        [PETSc release (1) or petsc-dev (0), as detected by petsc.m4])

      if test $petscmajor = 2; then
        if test "x$PETSC_ARCH" = x ; then
          enablepetsc=no
          AC_MSG_RESULT([<<< PETSc 2.x detected and "\$PETSC_ARCH" not set.  PETSc disabled. >>>])
          # PETSc config failed.  We will try MPI at the end of this function.
        fi
      fi

      # Determine if PETSc has been built with debugging enabled.
      # Note that this token will appear as LIBMESH_PETSC_USE_DEBUG in
      # our header, so it won't collide with PETSc's.  We look for
      # petscconf.h in both $PETSC_DIR/include and
      # $PETSC_DIR/$PETSC_ARCH/include, since it can appear in either.
      petsc_use_debug=`cat ${PETSC_DIR}/include/petscconf.h ${PETSC_DIR}/${PETSC_ARCH}/include/petscconf.h 2>/dev/null | grep -c PETSC_USE_DEBUG`

      # It is safe to test the value of $petsc_use_debug, it is
      # guaranteed to be either 0 or nonzero.
      if (test $petsc_use_debug -gt 0) ; then
        AC_DEFINE(PETSC_USE_DEBUG, 1, [Flag indicating whether or not PETSc was configured with debugging enabled])
      fi
    else # petscversion.h was not readable
        enablepetsc=no
    fi




    # If we haven't been disabled yet, carry on!
    if (test $enablepetsc != no) ; then

        AC_SUBST(PETSC_ARCH) # Note: may be empty...
        AC_SUBST(PETSC_DIR)

        # Check for snoopable MPI
        if (test -r $PETSC_DIR/bmake/$PETSC_ARCH/petscconf) ; then           # 2.3.x
          PETSC_MPI=`grep MPIEXEC $PETSC_DIR/bmake/$PETSC_ARCH/petscconf | grep -v mpiexec.uni`

        elif (test -r $PETSC_DIR/$PETSC_ARCH/conf/petscvariables) ; then # 3.0.x
          PETSC_MPI=`grep MPIEXEC $PETSC_DIR/$PETSC_ARCH/conf/petscvariables | grep -v mpiexec.uni`
        elif (test -r $PETSC_DIR/conf/petscvariables) ; then # 3.0.x
          PETSC_MPI=`grep MPIEXEC $PETSC_DIR/conf/petscvariables | grep -v mpiexec.uni`

        elif (test -r $PETSC_DIR/$PETSC_ARCH/lib/petsc/conf/petscvariables) ; then # 3.6.x
          PETSC_MPI=`grep MPIEXEC $PETSC_DIR/$PETSC_ARCH/lib/petsc/conf/petscvariables | grep -v mpiexec.uni`
        elif (test -r $PETSC_DIR/lib/petsc/conf/petscvariables) ; then # 3.6.x
          PETSC_MPI=`grep MPIEXEC $PETSC_DIR/lib/petsc/conf/petscvariables | grep -v mpiexec.uni`
        fi

        # If we couldn't snoop MPI from PETSc, fall back on ACX_MPI.
        if test "x$PETSC_MPI" != x ; then
          AC_DEFINE(HAVE_MPI, 1, [Flag indicating whether or not MPI is available])<commit_msg>Add configure test for PETSc index size mismatch.<commit_after># -------------------------------------------------------------
# PETSc
# -------------------------------------------------------------
AC_DEFUN([CONFIGURE_PETSC],
[
  AC_ARG_ENABLE(petsc,
                AS_HELP_STRING([--disable-petsc],
                               [build without PETSc iterative solver suppport]),
                [case "${enableval}" in
                  yes)  enablepetsc=yes ;;
                   no)  enablepetsc=no ;;
                    *)  AC_MSG_ERROR(bad value ${enableval} for --enable-petsc) ;;
                 esac],
                [enablepetsc=$enableoptional])

  # Trump --enable-petsc with --disable-mpi
  if (test "x$enablempi" = xno); then
    enablepetsc=no
  fi

  AC_ARG_VAR([PETSC_DIR],  [path to PETSc installation])
  AC_ARG_VAR([PETSC_ARCH], [PETSc build architecture])

  if (test "$enablepetsc" !=  no) ; then
    # AC_REQUIRE:
    # If the M4 macro AC_PROG_F77 has not already been called, call
    # it (without any arguments). Make sure to quote AC_PROG_F77 with
    # square brackets. AC_PROG_F77 must have been defined using
    # AC_DEFUN or else contain a call to AC_PROVIDE to indicate
    # that it has been called.
    AC_REQUIRE([AC_PROG_F77])

    # If the user doesn't have any PETSC directory specified, let's check to
    # see if it's installed via Ubuntu module
    if (test "x$PETSC_DIR" = x); then
      AC_PATH_PROG(PETSCARCH, petscarch)
      if (test "x$PETSCARCH" != x); then
        export PETSC_DIR=/usr/lib/petsc
        export PETSC_ARCH=`$PETSCARCH`
        if (test -d $PETSC_DIR); then
          AC_MSG_RESULT([using system-provided PETSC_DIR $PETSC_DIR])
          AC_MSG_RESULT([using system-provided PETSC_ARCH $PETSC_ARCH])
        fi
      fi
    fi

    # Let's use a C compiler for the AC_CHECK_HEADER test, although this is
    # not strictly necessary...
    AC_LANG_PUSH(C)
    AC_CHECK_HEADER($PETSC_DIR/include/petscversion.h,
                    [enablepetsc=yes],
                    [enablepetsc=no])
    AC_LANG_POP

    # Grab PETSc version and substitute into Makefile.
    # If version 2.x, also check that PETSC_ARCH is set
    # This if-test used to be: if (test -r $PETSC_DIR/include/petsc.h) ; then
    if (test "$enablepetsc" !=  no) ; then
      # Some tricks to discover the version of petsc.
      # You have to have grep and sed for this to work.
      petscmajor=`grep "define PETSC_VERSION_MAJOR" $PETSC_DIR/include/petscversion.h | sed -e "s/#define PETSC_VERSION_MAJOR[ ]*//g"`
      petscminor=`grep "define PETSC_VERSION_MINOR" $PETSC_DIR/include/petscversion.h | sed -e "s/#define PETSC_VERSION_MINOR[ ]*//g"`
      petscsubminor=`grep "define PETSC_VERSION_SUBMINOR" $PETSC_DIR/include/petscversion.h | sed -e "s/#define PETSC_VERSION_SUBMINOR[ ]*//g"`
      petscrelease=`grep "define PETSC_VERSION_RELEASE" $PETSC_DIR/include/petscversion.h | sed -e "s/#define PETSC_VERSION_RELEASE[ ]*//g"`
      petscversion=$petscmajor.$petscminor.$petscsubminor
      petscmajorminor=$petscmajor.$petscminor.x

      AC_SUBST(petscversion)
      AC_SUBST(petscmajor)
      AC_SUBST(petscmajorminor)

      AC_DEFINE_UNQUOTED(DETECTED_PETSC_VERSION_MAJOR, [$petscmajor],
        [PETSc's major version number, as detected by petsc.m4])

      AC_DEFINE_UNQUOTED(DETECTED_PETSC_VERSION_MINOR, [$petscminor],
        [PETSc's minor version number, as detected by petsc.m4])

      AC_DEFINE_UNQUOTED(DETECTED_PETSC_VERSION_SUBMINOR, [$petscsubminor],
        [PETSc's subminor version number, as detected by petsc.m4])

      AC_DEFINE_UNQUOTED(DETECTED_PETSC_VERSION_RELEASE, [$petscrelease],
        [PETSc release (1) or petsc-dev (0), as detected by petsc.m4])

      if test $petscmajor = 2; then
        if test "x$PETSC_ARCH" = x ; then
          enablepetsc=no
          AC_MSG_RESULT([<<< PETSc 2.x detected and "\$PETSC_ARCH" not set.  PETSc disabled. >>>])
          # PETSc config failed.  We will try MPI at the end of this function.
        fi
      fi

      # Determine if PETSc has been built with debugging enabled.
      # Note that this token will appear as LIBMESH_PETSC_USE_DEBUG in
      # our header, so it won't collide with PETSc's.  We look for
      # petscconf.h in both $PETSC_DIR/include and
      # $PETSC_DIR/$PETSC_ARCH/include, since it can appear in either.
      petsc_use_debug=`cat ${PETSC_DIR}/include/petscconf.h ${PETSC_DIR}/${PETSC_ARCH}/include/petscconf.h 2>/dev/null | grep -c PETSC_USE_DEBUG`

      # It is safe to test the value of $petsc_use_debug, it is
      # guaranteed to be either 0 or nonzero.
      if (test $petsc_use_debug -gt 0) ; then
        AC_DEFINE(PETSC_USE_DEBUG, 1, [Flag indicating whether or not PETSc was configured with debugging enabled])
      fi
    else # petscversion.h was not readable
        enablepetsc=no
    fi

    # If PETSc is using 64-bit indices, make sure that
    # $dof_bytes==8, or else print an informative message and
    # disable PETSc.
    if (test $enablepetsc != no) ; then
      petsc_use_64bit_indices=`cat ${PETSC_DIR}/include/petscconf.h ${PETSC_DIR}/${PETSC_ARCH}/include/petscconf.h 2>/dev/null | grep -c PETSC_USE_64BIT_INDICES`

      if (test $petsc_use_64bit_indices -gt 0) ; then
        if (test $dof_bytes != 8) ; then
          AC_MSG_RESULT([<<< PETSc is using 64-bit indices, you must configure libmesh with --with-dof-id-bytes=8. >>>])
          enablepetsc=no
        fi
      fi
    fi


    # If we haven't been disabled yet, carry on!
    if (test $enablepetsc != no) ; then

        AC_SUBST(PETSC_ARCH) # Note: may be empty...
        AC_SUBST(PETSC_DIR)

        # Check for snoopable MPI
        if (test -r $PETSC_DIR/bmake/$PETSC_ARCH/petscconf) ; then           # 2.3.x
          PETSC_MPI=`grep MPIEXEC $PETSC_DIR/bmake/$PETSC_ARCH/petscconf | grep -v mpiexec.uni`

        elif (test -r $PETSC_DIR/$PETSC_ARCH/conf/petscvariables) ; then # 3.0.x
          PETSC_MPI=`grep MPIEXEC $PETSC_DIR/$PETSC_ARCH/conf/petscvariables | grep -v mpiexec.uni`
        elif (test -r $PETSC_DIR/conf/petscvariables) ; then # 3.0.x
          PETSC_MPI=`grep MPIEXEC $PETSC_DIR/conf/petscvariables | grep -v mpiexec.uni`

        elif (test -r $PETSC_DIR/$PETSC_ARCH/lib/petsc/conf/petscvariables) ; then # 3.6.x
          PETSC_MPI=`grep MPIEXEC $PETSC_DIR/$PETSC_ARCH/lib/petsc/conf/petscvariables | grep -v mpiexec.uni`
        elif (test -r $PETSC_DIR/lib/petsc/conf/petscvariables) ; then # 3.6.x
          PETSC_MPI=`grep MPIEXEC $PETSC_DIR/lib/petsc/conf/petscvariables | grep -v mpiexec.uni`
        fi

        # If we couldn't snoop MPI from PETSc, fall back on ACX_MPI.
        if test "x$PETSC_MPI" != x ; then
          AC_DEFINE(HAVE_MPI, 1, [Flag indicating whether or not MPI is available])
{'fraction_non_alphanumeric': 0.11759244932693795, 'fraction_numerical': 0.00626643973386972, 'mean_word_length': 2.5798947659927998, 'pattern_counts': {'":': 0, '<': 12, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1587276', 'n_tokens_mistral': 4770, 'n_tokens_neox': 4343, 'n_words': 1142}