dnl Hi AC_INIT(configure.in) VERSION="1.1.0" AC_SUBST(VERSION) # Gtk and PyGtk version requirements VERSION_GTK="(2,4,0)" VERSION_PYGTK="(2,4,0)" VERSION_PYTHON="(2,2,0)" # Is python version good? [py_prog=" import sys try: print \"Checking python version >= %d.%d.%d...\" % tuple($VERSION_PYTHON), if sys.version_info >= tuple($VERSION_PYTHON): print \"yes (%d.%d.%d)\" % sys.version_info[:3] sys.exit(0) except AttributeError: pass print \"no (%d.%d.%d)\" % sys.version_info[:3] sys.exit(1)"] # Is the gtk version good? [gtk_prog=" import sys import gtk try: print \"Checking GTK+ version >= %d.%d.%d...\" % tuple($VERSION_GTK), if gtk.gtk_version >= tuple($VERSION_GTK): print \"yes (%d.%d.%d)\" % gtk.gtk_version sys.exit(0) except AttributeError: pass print \"no (%d.%d.%d)\" % gtk.gtk_version sys.exit(1)"] # Is pygtk version good? [pygtk_prog=" import sys import gtk try: print \"Checking PyGTK version >= %d.%d.%d...\" % tuple($VERSION_PYGTK), if gtk.pygtk_version >= tuple($VERSION_PYGTK): print \"yes (%d.%d.%d)\" % gtk.pygtk_version sys.exit(0) except AttributeError: pass print \"no (%d.%d.%d)\" % gtk.pygtk_version sys.exit(1)"] dnl Check for a python version with the required modules PYTHON="python" modules="threading shelve re glob cPickle string socket cStringIO binascii mimify mimetypes mimetools time gtk gobject pango webbrowser" dnl User may specify preferred python version AC_ARG_WITH(python-version, [ --with-python-version Preferred python version, eg python2.2], PYTHON=$withval) dnl Check python exists AC_MSG_CHECKING([for $PYTHON]) if $PYTHON -c "print \"hello world\"" 1> /dev/null 2> /dev/null then AC_MSG_RESULT(yes) else AC_MSG_ERROR([Python binary '$PYTHON' not found]) fi dnl Check python version is good if $PYTHON -c "$py_prog" then true else AC_MSG_ERROR([Python version >= $VERSION_PYTHON required]) fi dnl Check gtk version is good if $PYTHON -c "$gtk_prog" then true else AC_MSG_ERROR([GTK+ version >= $VERSION_GTK required]) fi dnl Check pygtk version is good if $PYTHON -c "$pygtk_prog" then true else AC_MSG_ERROR([PyGTK version >= $VERSION_PYGTK required]) fi dnl Check for required modules for mod in $modules do AC_MSG_CHECKING([for python module $mod]) [prog=" import sys try: import $mod except ImportError: sys.exit(1) except: sys.exit(0) sys.exit(0)"] if $PYTHON -c "$prog" 1> /dev/null 2> /dev/null then AC_MSG_RESULT(yes) else AC_MSG_RESULT(no) AC_MSG_ERROR([Python module $mod missing]) fi done dnl Warn about some missing optional modules that pyne likes dnl but does not require. modules="gettext commands" for mod in $modules do AC_MSG_CHECKING([for python module $mod]) [prog=" import sys try: import $mod except ImportError: sys.exit(1) except: sys.exit(0) sys.exit(0)"] if $PYTHON -c "$prog" 1> /dev/null 2> /dev/null then AC_MSG_RESULT(yes) else AC_MSG_RESULT(no) AC_MSG_WARN([Missing optional python module \"$mod\". Pyne does not require this module but some functionality will be lost without it.]) fi done dnl We found this python version to be good :-) AC_SUBST(PYTHON) AC_OUTPUT([Makefile])