Python 3.12 no longer has distutils
In graphviz's configure.ac, it uses distutils.sysconfig to determine the Python platform library directory. With Python 3.12, distutils will be removed, so this logic will no longer work:
PYTHON_INSTALL_DIR="`$PYTHON -c 'from distutils import sysconfig; print(sysconfig.get_python_lib(1,0))'`"
...
PYTHON3_INSTALL_DIR="`$PYTHON3 -c 'from distutils import sysconfig; print(sysconfig.get_python_lib(1,0))'`"
The replacement function in Python 3.12 (works in older Python3 as well) is to use get_path() from sysconfig (not to be confused with distutils.sysconfig):
PYTHON3_INSTALL_DIR="`$PYTHON3 -c 'import sysconfig; print(sysconfig.get_path("platlib"))'`"
I'm not entirely sure what to do about the PYTHON_INSTALL_DIR call. Presumably, that is to catch python2 cases, but on systems which are only Python3 (e.g. all current versions of Fedora), that gets invoked by python3 and needs to be changed as well... but for older systems, there might need to be some logic in there to use the old distutils function if python2 is detected.