[geany/geany-plugins] 73ae49: waf: Fix the checks for openpty() on FreeBSD

Colomban Wendling git-noreply at xxxxx
Fri Apr 10 15:36:32 UTC 2015


Branch:      refs/heads/master
Author:      Colomban Wendling <ban at herbesfolles.org>
Committer:   Colomban Wendling <ban at herbesfolles.org>
Date:        Fri, 10 Apr 2015 15:36:32 UTC
Commit:      73ae49dc2bd21c96271a4ce141e1a37ed25c30b0
             https://github.com/geany/geany-plugins/commit/73ae49dc2bd21c96271a4ce141e1a37ed25c30b0

Log Message:
-----------
waf: Fix the checks for openpty() on FreeBSD


Modified Paths:
--------------
    build/wafutils.py
    debugger/wscript_configure
    scope/wscript_configure

Modified: build/wafutils.py
22 lines changed, 22 insertions(+), 0 deletions(-)
===================================================================
@@ -141,6 +141,28 @@ def check_c_header_cached(conf, **kw):
     return result
 
 
+def check_c_func_in_headers_cached(conf, header_names, mandatory=True, **kw):
+    """
+    Check for @function_name in any of @header_names.
+    Use like a conf.check_cc() for a lib, but pass a list of headers in
+    @header_names.
+
+    This checks for the headers firs with check_c_header_cached(), then
+    if this succeeded calls conf.check_cc() on it.
+    """
+
+    exception = None
+    for header in header_names:
+        try:
+            check_c_header_cached(conf, header_name=header)
+            return conf.check_cc(**dict(kw, header_name=header, mandatory=True))
+        except Exception as e:
+            exception = e
+    if mandatory:
+        raise exception
+    return None
+
+
 def check_cfg_cached(conf, **kw):
     # Works as conf.check_cfg() but tries to cache already checked packages
     package = kw.get('package')


Modified: debugger/wscript_configure
6 lines changed, 5 insertions(+), 1 deletions(-)
===================================================================
@@ -21,6 +21,7 @@
 # $Id: wscript_configure 1735 2010-11-09 17:03:40Z eht16 $
 
 from build.wafutils import check_cfg_cached
+from build.wafutils import check_c_func_in_headers_cached
 
 
 check_cfg_cached(conf,
@@ -29,4 +30,7 @@ check_cfg_cached(conf,
                  args='--cflags --libs')
 
 conf.check_cc(function_name='poll', header_name='poll.h')
-conf.check_cc(function_name='openpty', header_name='pty.h', lib='util', uselib_store='UTIL')
+check_c_func_in_headers_cached(conf,
+                               function_name='openpty',
+                               header_names=['util.h', 'pty.h', 'libutil.h'],
+                               lib='util', uselib_store='UTIL')


Modified: scope/wscript_configure
15 lines changed, 5 insertions(+), 10 deletions(-)
===================================================================
@@ -21,19 +21,14 @@
 # $Id: wscript_configure 1735 2010-11-09 17:03:40Z eht16 $
 
 from build.wafutils import check_cfg_cached, target_is_win32
+from build.wafutils import check_c_func_in_headers_cached
 
 if not target_is_win32(bld) :
 	check_cfg_cached(conf,
 			     package='vte',
 			     uselib_store='VTE',
 			     args='--cflags --libs')
-	try :
-		conf.check_cc(function_name='openpty',
-			      header_name='pty.h',
-			      lib='util',
-			      uselib_store='UTIL')
-	except :
-		conf.check_cc(function_name='openpty',
-			      header_name='util.h',
-			      lib='util',
-			      uselib_store='UTIL')
+	check_c_func_in_headers_cached(conf,
+	                               function_name='openpty',
+	                               header_names=['util.h', 'pty.h', 'libutil.h'],
+	                               lib='util', uselib_store='UTIL')



--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).


More information about the Plugins-Commits mailing list