build: Check if the compiler will optimize out functions
authorKai Blin <kai@samba.org>
Mon, 22 Mar 2010 21:58:43 +0000 (22:58 +0100)
committerAndrew Tridgell <tridge@samba.org>
Tue, 6 Apr 2010 10:27:03 +0000 (20:27 +1000)
source3/wscript

index e6f44f463daf012439873466c63fb90405b7aaf1..ef682c5e11974fcdc4aadc33d1cbac0f0de550e2 100644 (file)
@@ -152,6 +152,15 @@ main() {
                         headers='sys/types.h rpc/rpc.h',
                         msg="Checking for uint32 typedef included by rpc/rpc.h")
 
+    # Check if the compiler will optimize out functions
+    conf.CHECK_CODE('''
+if (0) {
+    this_function_does_not_exist();
+} else {
+    return 1;
+}''', 'HAVE_COMPILER_WILL_OPTIMIZE_OUT_FNS',
+        msg="Checking if the compiler will optimize out functions")
+
     # Look for CUPS
     conf.find_program('cups-config', var='CUPS_CONFIG')
     if conf.env.CUPS_CONFIG: