Fix configure in non-X environment.
commit358b5a9fbc9d602eccc52eb23b19e6767bc675e3
authorMaxim Salov <max.salov@gmail.com>
Mon, 3 Dec 2012 12:10:31 +0000 (3 12:10 +0000)
committerPeter TB Brett <peter@peter-b.co.uk>
Mon, 3 Dec 2012 12:10:31 +0000 (3 12:10 +0000)
tree9c127f6fca95a9d12d246b9fd1548c5eaf8b9679
parent2eb0dc8b7725a3b6ef52cedd48ab631471893516
Fix configure in non-X environment.

When building xgsch2pcb in non-X environment configure script fails
on gtk python module check.

Example :
$ DISPLAY="" ./configure
...snip...
checking for python module gtk... no
configure: error: python module gtk is required

$ DISPLAY="" python -c "import gtk"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/lib64/python2.7/site-packages/gtk-2.0/gtk/__init__.py", line 64, in <module>
    _init()
  File "/usr/lib64/python2.7/site-packages/gtk-2.0/gtk/__init__.py", line 52, in _init
    _gtk.init_check()
RuntimeError: could not open display

Module is found, but it tries to open display and fails.

To distinguish runtime errors from import errors, I've tried such
construction:
$ python -c "import gtk" 2>&1 | grep -q 'ImportError'

But logic exit code is inverted.

Also same reason prevents configure script from getting gtk+
version. So I introduced new --disable-x option to turn that check
off.

Closes-bug: lp-1054241
configure.ac