setup.py
changeset 6245 0d0939b2d272
parent 6241 a718e66836e8
child 6251 87053f0b0fad
--- a/setup.py	Thu Mar 13 17:39:30 2008 +0100
+++ b/setup.py	Thu Mar 13 19:50:03 2008 -0300
@@ -12,6 +12,7 @@
 import os
 from distutils.core import setup, Extension
 from distutils.command.install_data import install_data
+from distutils.ccompiler import new_compiler
 
 import mercurial.version
 
@@ -66,10 +67,13 @@
     ext_modules.append(Extension('mercurial.osutil', ['mercurial/osutil.c']))
 
     if sys.platform == 'linux2' and os.uname()[2] > '2.6':
-        # the inotify extension is only usable with Linux 2.6 kernels
-        ext_modules.append(Extension('hgext.inotify.linux._inotify',
-                                     ['hgext/inotify/linux/_inotify.c']))
-        packages.extend(['hgext.inotify', 'hgext.inotify.linux'])
+        # The inotify extension is only usable with Linux 2.6 kernels.
+        # You also need a reasonably recent C library.
+        cc = new_compiler()
+        if cc.has_function('inotify_add_watch'):
+            ext_modules.append(Extension('hgext.inotify.linux._inotify',
+                                         ['hgext/inotify/linux/_inotify.c']))
+            packages.extend(['hgext.inotify', 'hgext.inotify.linux'])
 except ImportError:
     pass