[PATCH] #ifdef code cleanup

Andreas Schneider asn at samba.org
Thu Nov 22 08:30:02 UTC 2018


Hi,

attached is a patchset which cleans up checking for config.h defines 
correctly.

Please review. Push if OK.



Thanks,


	Andreas


-- 
Andreas Schneider                      asn at samba.org
Samba Team                             www.samba.org
GPG-ID:     8DFF53E18F2ABC8D8F3C92237EE0FC4DCC014E3D
-------------- next part --------------
>From f8738ac482646bec026c76d7d933534b56bbadcc Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Tue, 20 Nov 2018 12:01:32 +0100
Subject: [PATCH 01/32] lib:replace: Check if HAVE_DECL_ENVIRON is defined
 first

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 lib/replace/replace.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lib/replace/replace.h b/lib/replace/replace.h
index 732a8226858..a6cafc10d66 100644
--- a/lib/replace/replace.h
+++ b/lib/replace/replace.h
@@ -272,6 +272,7 @@ char *rep_strndup(const char *s, size_t n);
 size_t rep_strnlen(const char *s, size_t n);
 #endif
 
+#if defined(HAVE_DECL_ENVIRON)
 #if !HAVE_DECL_ENVIRON
 #ifdef __APPLE__
 #include <crt_externs.h>
@@ -280,6 +281,7 @@ size_t rep_strnlen(const char *s, size_t n);
 extern char **environ;
 #endif
 #endif
+#endif /* defined(HAVE_DECL_ENVIRON) */
 
 #ifndef HAVE_SETENV
 #define setenv rep_setenv
-- 
2.19.1


>From 37539d1d3501fbdd5a91a0ed3c1c6d133d8d74e9 Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Tue, 20 Nov 2018 12:06:13 +0100
Subject: [PATCH 02/32] s3: Remove unsused MMAP_BLACKLIST ifdef checks

This doesn't get defined by anything.

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 lib/replace/replace.h      | 4 ----
 source3/include/includes.h | 7 -------
 source3/param/loadparm.c   | 4 ----
 3 files changed, 15 deletions(-)

diff --git a/lib/replace/replace.h b/lib/replace/replace.h
index a6cafc10d66..ece71b74107 100644
--- a/lib/replace/replace.h
+++ b/lib/replace/replace.h
@@ -832,10 +832,6 @@ typedef unsigned long long ptrdiff_t ;
  */
 #define PTR_DIFF(p1,p2) ((ptrdiff_t)(((const char *)(p1)) - (const char *)(p2)))
 
-#if MMAP_BLACKLIST
-#undef HAVE_MMAP
-#endif
-
 #ifdef __COMPAR_FN_T
 #define QSORT_CAST (__compar_fn_t)
 #endif
diff --git a/source3/include/includes.h b/source3/include/includes.h
index 9c47c342bba..032776003a3 100644
--- a/source3/include/includes.h
+++ b/source3/include/includes.h
@@ -362,13 +362,6 @@ char *talloc_asprintf_strupper_m(TALLOC_CTX *t, const char *fmt, ...) PRINTF_ATT
 #endif
 #define FALSE __ERROR__XX__DONT_USE_FALSE
 
-/* If we have blacklisted mmap() try to avoid using it accidentally by
-   undefining the HAVE_MMAP symbol. */
-
-#ifdef MMAP_BLACKLIST
-#undef HAVE_MMAP
-#endif
-
 void dump_core(void) _NORETURN_;
 void exit_server(const char *const reason) _NORETURN_;
 void exit_server_cleanly(const char *const reason) _NORETURN_;
diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c
index 495683083cb..65ac095da46 100644
--- a/source3/param/loadparm.c
+++ b/source3/param/loadparm.c
@@ -712,11 +712,7 @@ static void init_globals(struct loadparm_context *lp_ctx, bool reinit_globals)
 	Globals.oplock_break_wait_time = 0;	/* By Default, 0 msecs. */
 	Globals.enhanced_browsing = true;
 	Globals.lock_spin_time = WINDOWS_MINIMUM_LOCK_TIMEOUT_MS; /* msec. */
-#ifdef MMAP_BLACKLIST
-	Globals.use_mmap = false;
-#else
 	Globals.use_mmap = true;
-#endif
 	Globals.unicode = true;
 	Globals.unix_extensions = true;
 	Globals.reset_on_zero_vc = false;
-- 
2.19.1


>From 4dd1dc2287559dc0536a3ae59d7dd2727b986974 Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Tue, 20 Nov 2018 12:09:31 +0100
Subject: [PATCH 03/32] wafsamba: Do not always set _FORTIFY_SOURCE=2

This requires to be compiled with optimization (-O).

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 buildtools/wafsamba/samba_autoconf.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/buildtools/wafsamba/samba_autoconf.py b/buildtools/wafsamba/samba_autoconf.py
index 5f203fc7d36..58800d24351 100644
--- a/buildtools/wafsamba/samba_autoconf.py
+++ b/buildtools/wafsamba/samba_autoconf.py
@@ -703,7 +703,7 @@ def SAMBA_CONFIG_H(conf, path=None):
                                     mandatory=False,
                                     msg='Checking if compiler accepts %s' % (stack_protect_flag))
         if flag_supported:
-            conf.ADD_CFLAGS('-Wp,-D_FORTIFY_SOURCE=2 %s' % (stack_protect_flag))
+            conf.ADD_CFLAGS('%s' % (stack_protect_flag))
             break
 
     flag_supported = conf.check(fragment='''
-- 
2.19.1


>From f9475dbcfe1c65c48f108ab15bc65c845719a474 Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Tue, 20 Nov 2018 12:11:43 +0100
Subject: [PATCH 04/32] autobuild: Add _FORTIFY_SOURCE=2 to the -O3 build

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 script/autobuild.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/script/autobuild.py b/script/autobuild.py
index e025a2c1920..9bd48523dbd 100755
--- a/script/autobuild.py
+++ b/script/autobuild.py
@@ -195,7 +195,7 @@ tasks = {
 
     # test build with -O3 -- catches extra warnings and bugs, tests the ad_dc environments
     "samba-o3": [("random-sleep", "script/random-sleep.sh 60 600", "text/plain"),
-                   ("configure", "ADDITIONAL_CFLAGS='-O3' ./configure.developer --with-selftest-prefix=./bin/ab --abi-check-disable" + samba_configure_params, "text/plain"),
+                   ("configure", "ADDITIONAL_CFLAGS='-O3 -Wp,-D_FORTIFY_SOURCE=2' ./configure.developer --with-selftest-prefix=./bin/ab --abi-check-disable" + samba_configure_params, "text/plain"),
                    ("make", "make -j", "text/plain"),
                    ("test", "make quicktest FAIL_IMMEDIATELY=1 "
                     "TESTS='${PY3_ONLY}"
-- 
2.19.1


>From d1abbd3f6c96932ab2a488f78930573eb5a9b65d Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Tue, 20 Nov 2018 13:55:49 +0100
Subject: [PATCH 05/32] ctdb: Use #ifdef instead of #if for config.h
 definitions

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 ctdb/common/system.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/ctdb/common/system.c b/ctdb/common/system.c
index 51149edbaf5..ab1941124d7 100644
--- a/ctdb/common/system.c
+++ b/ctdb/common/system.c
@@ -33,11 +33,11 @@
 #include "common/logging.h"
 #include "common/system.h"
 
-#if HAVE_SCHED_H
+#ifdef HAVE_SCHED_H
 #include <sched.h>
 #endif
 
-#if HAVE_PROCINFO_H
+#ifdef HAVE_PROCINFO_H
 #include <procinfo.h>
 #endif
 
@@ -49,7 +49,7 @@
 bool set_scheduler(void)
 {
 #ifdef _AIX_
-#if HAVE_THREAD_SETSCHED
+#ifdef HAVE_THREAD_SETSCHED
 	struct thrdentry64 te;
 	tid64_t ti;
 
@@ -68,7 +68,7 @@ bool set_scheduler(void)
 	}
 #endif
 #else /* no AIX */
-#if HAVE_SCHED_SETSCHEDULER
+#ifdef HAVE_SCHED_SETSCHEDULER
 	struct sched_param p;
 
 	p.sched_priority = 1;
@@ -92,7 +92,7 @@ bool set_scheduler(void)
 void reset_scheduler(void)
 {
 #ifdef _AIX_
-#if HAVE_THREAD_SETSCHED
+#ifdef HAVE_THREAD_SETSCHED
 	struct thrdentry64 te;
 	tid64_t ti;
 
@@ -105,7 +105,7 @@ void reset_scheduler(void)
 	}
 #endif
 #else /* no AIX */
-#if HAVE_SCHED_SETSCHEDULER
+#ifdef HAVE_SCHED_SETSCHEDULER
 	struct sched_param p;
 
 	p.sched_priority = 0;
-- 
2.19.1


>From 2c2eb9a3d897f5fbbb82011de1e1e001b1e0880a Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Tue, 20 Nov 2018 13:57:13 +0100
Subject: [PATCH 06/32] krb5_wrap: Use #ifdef instead of #if for config.h
 definitions

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 lib/krb5_wrap/gss_samba.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/krb5_wrap/gss_samba.c b/lib/krb5_wrap/gss_samba.c
index 860f44482a6..2a99661ddee 100644
--- a/lib/krb5_wrap/gss_samba.c
+++ b/lib/krb5_wrap/gss_samba.c
@@ -61,7 +61,7 @@ uint32_t smb_gss_krb5_import_cred(uint32_t *minor_status, krb5_context ctx,
 {
 	uint32_t major_status = 0;
 
-#if HAVE_GSS_ACQUIRE_CRED_FROM
+#ifdef HAVE_GSS_ACQUIRE_CRED_FROM
 	uint32_t minor = 0;
 	gss_key_value_element_desc ccache_element = {
 		.key = "ccache",
-- 
2.19.1


>From 037bb41f1296ca94a42a3fa40610388497e4b9ee Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Tue, 20 Nov 2018 13:57:48 +0100
Subject: [PATCH 07/32] replace: Use #ifdef instead of #if for config.h
 definitions

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 lib/replace/getifaddrs.c      | 2 +-
 lib/replace/system/dir.h      | 4 ++--
 lib/replace/system/filesys.h  | 8 ++++----
 lib/replace/system/gssapi.h   | 4 ++--
 lib/replace/system/kerberos.h | 4 ++--
 5 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/lib/replace/getifaddrs.c b/lib/replace/getifaddrs.c
index 9e377e5edc0..a55ef7e30fe 100644
--- a/lib/replace/getifaddrs.c
+++ b/lib/replace/getifaddrs.c
@@ -73,7 +73,7 @@ static struct sockaddr *sockaddr_dup(struct sockaddr *sa)
 }
 #endif
 
-#if HAVE_IFACE_IFCONF
+#ifdef HAVE_IFACE_IFCONF
 
 /* this works for Linux 2.2, Solaris 2.5, SunOS4, HPUX 10.20, OSF1
    V4.0, Ultrix 4.4, SCO Unix 3.2, IRIX 6.4 and FreeBSD 3.2.
diff --git a/lib/replace/system/dir.h b/lib/replace/system/dir.h
index 0955b193958..497b5a7c0fa 100644
--- a/lib/replace/system/dir.h
+++ b/lib/replace/system/dir.h
@@ -25,7 +25,7 @@
    License along with this library; if not, see <http://www.gnu.org/licenses/>.
 */
 
-#if HAVE_DIRENT_H
+#ifdef HAVE_DIRENT_H
 # include <dirent.h>
 # define NAMLEN(dirent) strlen((dirent)->d_name)
 #else
@@ -46,7 +46,7 @@
 #define mkdir(dir, mode) mkdir(dir)
 #endif
 
-#if HAVE_LIBGEN_H
+#ifdef HAVE_LIBGEN_H
 # include <libgen.h>
 #endif
 
diff --git a/lib/replace/system/filesys.h b/lib/replace/system/filesys.h
index faa94c73f26..b9ce41a4b38 100644
--- a/lib/replace/system/filesys.h
+++ b/lib/replace/system/filesys.h
@@ -115,16 +115,16 @@
 #define VXFS_QUOTA
 #endif
 
-#if HAVE_SYS_ATTRIBUTES_H
+#if defined(HAVE_SYS_ATTRIBUTES_H)
 #include <sys/attributes.h>
-#elif HAVE_ATTR_ATTRIBUTES_H
+#elif defined(HAVE_ATTR_ATTRIBUTES_H)
 #include <attr/attributes.h>
 #endif
 
 /* mutually exclusive (SuSE 8.2) */
-#if HAVE_ATTR_XATTR_H
+#if defined(HAVE_ATTR_XATTR_H)
 #include <attr/xattr.h>
-#elif HAVE_SYS_XATTR_H
+#elif defined(HAVE_SYS_XATTR_H)
 #include <sys/xattr.h>
 #endif
 
diff --git a/lib/replace/system/gssapi.h b/lib/replace/system/gssapi.h
index 6386c7b21a3..9e68dcc1c88 100644
--- a/lib/replace/system/gssapi.h
+++ b/lib/replace/system/gssapi.h
@@ -39,11 +39,11 @@
 #include <gssapi.h>
 #endif
 
-#if HAVE_GSSAPI_GSSAPI_KRB5_H
+#ifdef HAVE_GSSAPI_GSSAPI_KRB5_H
 #include <gssapi/gssapi_krb5.h>
 #endif
 
-#if HAVE_GSSAPI_GSSAPI_SPNEGO_H
+#ifdef HAVE_GSSAPI_GSSAPI_SPNEGO_H
 #include <gssapi/gssapi_spnego.h>
 #elif HAVE_GSSAPI_SPNEGO_H
 #include <gssapi_spnego.h>
diff --git a/lib/replace/system/kerberos.h b/lib/replace/system/kerberos.h
index 636ce0f2e0b..ebd8657e612 100644
--- a/lib/replace/system/kerberos.h
+++ b/lib/replace/system/kerberos.h
@@ -29,11 +29,11 @@
 
 #ifdef HAVE_KRB5
 
-#if HAVE_KRB5_H
+#ifdef HAVE_KRB5_H
 #include <krb5.h>
 #endif
 
-#if HAVE_COM_ERR_H
+#ifdef HAVE_COM_ERR_H
 #include <com_err.h>
 #endif
 
-- 
2.19.1


>From 15524feb8a88db7231cd7355d5d33544cdf1c0c8 Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Tue, 20 Nov 2018 14:00:39 +0100
Subject: [PATCH 08/32] tdb: Use #ifdef instead of #if for config.h definitions

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 lib/tdb/common/io.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/tdb/common/io.c b/lib/tdb/common/io.c
index 94b316331c1..df460176159 100644
--- a/lib/tdb/common/io.c
+++ b/lib/tdb/common/io.c
@@ -96,7 +96,7 @@ static int tdb_ftruncate(struct tdb_context *tdb, off_t length)
 	return ret;
 }
 
-#if HAVE_POSIX_FALLOCATE
+#ifdef HAVE_POSIX_FALLOCATE
 static int tdb_posix_fallocate(struct tdb_context *tdb, off_t offset,
 			       off_t len)
 {
@@ -413,7 +413,7 @@ static int tdb_expand_file(struct tdb_context *tdb, tdb_off_t size, tdb_off_t ad
 		return -1;
 	}
 
-#if HAVE_POSIX_FALLOCATE
+#ifdef HAVE_POSIX_FALLOCATE
 	ret = tdb_posix_fallocate(tdb, size, addition);
 	if (ret == 0) {
 		return 0;
-- 
2.19.1


>From 6dfd09bc34aff0501d4b368737cd2affaa2e1c7c Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Tue, 20 Nov 2018 14:01:20 +0100
Subject: [PATCH 09/32] lib:util: Use #ifdef instead of #if for config.h
 definitions

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 lib/util/charset/charset_macosxfs.c | 4 ++--
 lib/util/charset/tests/iconv.c      | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/util/charset/charset_macosxfs.c b/lib/util/charset/charset_macosxfs.c
index 24e21fd6d2c..97a366a1532 100644
--- a/lib/util/charset/charset_macosxfs.c
+++ b/lib/util/charset/charset_macosxfs.c
@@ -43,11 +43,11 @@
 /*
  * See if autoconf has found us the internal headers in some form.
  */
-#if HAVE_COREFOUNDATION_CFSTRINGENCODINGCONVERTER_H
+#if defined(HAVE_COREFOUNDATION_CFSTRINGENCODINGCONVERTER_H)
 #	include <CoreFoundation/CFStringEncodingConverter.h>
 #	include <CoreFoundation/CFUnicodePrecomposition.h>
 #	define USE_INTERNAL_API 1
-#elif HAVE_CFSTRINGENCODINGCONVERTER_H
+#elif defined(HAVE_CFSTRINGENCODINGCONVERTER_H)
 #	include <CFStringEncodingConverter.h>
 #	include <CFUnicodePrecomposition.h>
 #	define USE_INTERNAL_API 1
diff --git a/lib/util/charset/tests/iconv.c b/lib/util/charset/tests/iconv.c
index 30161d3d8ed..3733c3c6b66 100644
--- a/lib/util/charset/tests/iconv.c
+++ b/lib/util/charset/tests/iconv.c
@@ -30,7 +30,7 @@
 #include "torture/local/proto.h"
 #include "talloc.h"
 
-#if HAVE_NATIVE_ICONV
+#ifdef HAVE_NATIVE_ICONV
 
 static bool iconv_untestable(struct torture_context *tctx)
 {
-- 
2.19.1


>From dd9c85507d527a9b21d45e855be834c1030970a4 Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Wed, 21 Nov 2018 18:24:59 +0100
Subject: [PATCH 10/32] lib:util: Avoid name confusion with config.h

The HAVE_* is normally used for config.h definitions, so rename it to
USE_ASM_BYTEORDER.

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 lib/util/byteorder.h | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/lib/util/byteorder.h b/lib/util/byteorder.h
index 77afba58cbd..8656035693d 100644
--- a/lib/util/byteorder.h
+++ b/lib/util/byteorder.h
@@ -118,9 +118,9 @@ static __inline__ void st_le32(uint32_t *addr, const uint32_t val)
 {
 	__asm__ ("stwbrx %1,0,%2" : "=m" (*addr) : "r" (val), "r" (addr));
 }
-#define HAVE_ASM_BYTEORDER 1
+#define USE_ASM_BYTEORDER 1
 #else
-#define HAVE_ASM_BYTEORDER 0
+#define USE_ASM_BYTEORDER 0
 #endif
 
 #define CVAL(buf,pos) ((unsigned int)(((const uint8_t *)(buf))[pos]))
@@ -128,7 +128,7 @@ static __inline__ void st_le32(uint32_t *addr, const uint32_t val)
 #define PVAL(buf,pos) (CVAL(buf,pos))
 #define SCVAL(buf,pos,val) (CVAL_NC(buf,pos) = (val))
 
-#if HAVE_ASM_BYTEORDER
+#if USE_ASM_BYTEORDER
 
 #define  _PTRPOS(buf,pos) (((const uint8_t *)(buf))+(pos))
 #define SVAL(buf,pos) ld_le16((const uint16_t *)_PTRPOS(buf,pos))
@@ -140,7 +140,7 @@ static __inline__ void st_le32(uint32_t *addr, const uint32_t val)
 #define SSVALS(buf,pos,val) SSVAL((buf),(pos),((int16_t)(val)))
 #define SIVALS(buf,pos,val) SIVAL((buf),(pos),((int32_t)(val)))
 
-#else /* not HAVE_ASM_BYTEORDER */
+#else /* not USE_ASM_BYTEORDER */
 
 #define SVAL(buf,pos) (PVAL(buf,pos)|PVAL(buf,(pos)+1)<<8)
 #define IVAL(buf,pos) (SVAL(buf,pos)|SVAL(buf,(pos)+2)<<16)
@@ -153,7 +153,7 @@ static __inline__ void st_le32(uint32_t *addr, const uint32_t val)
 #define SSVALS(buf,pos,val) SSVALX((buf),(pos),((int16_t)(val)))
 #define SIVALS(buf,pos,val) SIVALX((buf),(pos),((int32_t)(val)))
 
-#endif /* not HAVE_ASM_BYTEORDER */
+#endif /* not USE_ASM_BYTEORDER */
 
 /* 64 bit macros */
 #define BVAL(p, ofs) (IVAL(p,ofs) | (((uint64_t)IVAL(p,(ofs)+4)) << 32))
-- 
2.19.1


>From 5090ee021e2a75addcf2f417cb2c6ab4ca30bdf2 Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Tue, 20 Nov 2018 14:05:39 +0100
Subject: [PATCH 11/32] libcli:smb: Use #ifdef instead of #if for config.h
 definitions

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 libcli/smb/smb_seal.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libcli/smb/smb_seal.c b/libcli/smb/smb_seal.c
index f4f804c9473..079744cd68e 100644
--- a/libcli/smb/smb_seal.c
+++ b/libcli/smb/smb_seal.c
@@ -19,7 +19,7 @@
 
 #include "includes.h"
 #include "smb_common.h"
-#if HAVE_KRB5
+#ifdef HAVE_KRB5
 #include "lib/krb5_wrap/krb5_samba.h"
 #endif
 #include "auth/gensec/gensec.h"
-- 
2.19.1


>From 6f1ac7e5bbfa3df51ea6363bdd6839ec0cfeb853 Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Tue, 20 Nov 2018 14:06:21 +0100
Subject: [PATCH 12/32] libcli:smbreadline: Use #ifdef instead of #if for
 config.h definitions

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 libcli/smbreadline/smbreadline.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/libcli/smbreadline/smbreadline.c b/libcli/smbreadline/smbreadline.c
index 1a0f61c2cfe..6929209be20 100644
--- a/libcli/smbreadline/smbreadline.c
+++ b/libcli/smbreadline/smbreadline.c
@@ -47,7 +47,7 @@
 
 static bool smb_rl_done;
 
-#if HAVE_LIBREADLINE
+#ifdef HAVE_LIBREADLINE
 /*
  * MacOS/X does not have rl_done in readline.h, but
  * readline.so has it
@@ -58,7 +58,7 @@ extern int rl_done;
 void smb_readline_done(void)
 {
 	smb_rl_done = true;
-#if HAVE_LIBREADLINE
+#ifdef HAVE_LIBREADLINE
 	rl_done = 1;
 #endif
 }
@@ -122,7 +122,7 @@ char *smb_readline(const char *prompt, void (*callback)(void),
 		return smb_readline_replacement(NULL, callback, completion_fn);
 	}
 
-#if HAVE_LIBREADLINE
+#ifdef HAVE_LIBREADLINE
 
 	/* Aargh!  Readline does bizzare things with the terminal width
 	that mucks up expect(1).  Set CLI_NO_READLINE in the environment
@@ -145,7 +145,7 @@ char *smb_readline(const char *prompt, void (*callback)(void),
 		rl_basic_word_break_characters = " \t\n";
 	}
 
-#if HAVE_DECL_RL_EVENT_HOOK
+#ifdef HAVE_DECL_RL_EVENT_HOOK
 	if (callback)
 		rl_event_hook = (rl_hook_func_t *)callback;
 #endif
-- 
2.19.1


>From 9835b026cceb673b7cf1332c09d2735cd708bb2d Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Tue, 20 Nov 2018 14:06:48 +0100
Subject: [PATCH 13/32] krb5_plugin: Use #ifdef instead of #if for config.h
 definitions

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 nsswitch/krb5_plugin/winbind_krb5_localauth.c | 2 +-
 nsswitch/krb5_plugin/winbind_krb5_locator.c   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/nsswitch/krb5_plugin/winbind_krb5_localauth.c b/nsswitch/krb5_plugin/winbind_krb5_localauth.c
index e27bd6c6c54..f87b19abed6 100644
--- a/nsswitch/krb5_plugin/winbind_krb5_localauth.c
+++ b/nsswitch/krb5_plugin/winbind_krb5_localauth.c
@@ -22,7 +22,7 @@
 #include "replace.h"
 #include <krb5/localauth_plugin.h>
 #include <wbclient.h>
-#if HAVE_COM_ERR_H
+#ifdef HAVE_COM_ERR_H
 #include <com_err.h>
 #endif
 
diff --git a/nsswitch/krb5_plugin/winbind_krb5_locator.c b/nsswitch/krb5_plugin/winbind_krb5_locator.c
index 91a2d64d84c..518c871b248 100644
--- a/nsswitch/krb5_plugin/winbind_krb5_locator.c
+++ b/nsswitch/krb5_plugin/winbind_krb5_locator.c
@@ -26,7 +26,7 @@
 
 #if defined(HAVE_KRB5) && defined(HAVE_KRB5_LOCATE_PLUGIN_H)
 
-#if HAVE_COM_ERR_H
+#ifdef HAVE_COM_ERR_H
 #include <com_err.h>
 #endif
 
-- 
2.19.1


>From 879d786c4c72e89863c892746907f4ec2f7cc5f4 Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Tue, 20 Nov 2018 14:07:39 +0100
Subject: [PATCH 14/32] wbclient: Use #ifdef instead of #if for config.h
 definitions

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 nsswitch/wb_common.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/nsswitch/wb_common.c b/nsswitch/wb_common.c
index f2672fb1298..ba1138c4549 100644
--- a/nsswitch/wb_common.c
+++ b/nsswitch/wb_common.c
@@ -27,7 +27,7 @@
 #include "system/select.h"
 #include "winbind_client.h"
 
-#if HAVE_PTHREAD_H
+#ifdef HAVE_PTHREAD_H
 #include <pthread.h>
 #endif
 
@@ -41,7 +41,7 @@ struct winbindd_context {
 	pid_t our_pid;		/* calling process pid */
 };
 
-#if HAVE_PTHREAD
+#ifdef HAVE_PTHREAD
 static pthread_mutex_t wb_global_ctx_mutex = PTHREAD_MUTEX_INITIALIZER;
 #endif
 
@@ -53,7 +53,7 @@ static struct winbindd_context *get_wb_global_ctx(void)
 		.our_pid = 0
 	};
 
-#if HAVE_PTHREAD
+#ifdef HAVE_PTHREAD
 	pthread_mutex_lock(&wb_global_ctx_mutex);
 #endif
 	return &wb_global_ctx;
@@ -61,7 +61,7 @@ static struct winbindd_context *get_wb_global_ctx(void)
 
 static void put_wb_global_ctx(void)
 {
-#if HAVE_PTHREAD
+#ifdef HAVE_PTHREAD
 	pthread_mutex_unlock(&wb_global_ctx_mutex);
 #endif
 	return;
@@ -149,7 +149,7 @@ static void winbind_close_sock(struct winbindd_context *ctx)
 
 /* Destructor for global context to ensure fd is closed */
 
-#if HAVE_DESTRUCTOR_ATTRIBUTE
+#ifdef HAVE_DESTRUCTOR_ATTRIBUTE
 __attribute__((destructor))
 #endif
 static void winbind_destructor(void)
-- 
2.19.1


>From 8f007d36e83a0b3baabf3acef30c3a9c7d0ff070 Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Tue, 20 Nov 2018 14:08:05 +0100
Subject: [PATCH 15/32] wins: Use #ifdef instead of #if for config.h
 definitions

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 nsswitch/wins.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/nsswitch/wins.c b/nsswitch/wins.c
index ddbbb03d844..371ab78d2f8 100644
--- a/nsswitch/wins.c
+++ b/nsswitch/wins.c
@@ -27,11 +27,11 @@
 #include <ns_daemon.h>
 #endif
 
-#if HAVE_PTHREAD_H
+#ifdef HAVE_PTHREAD_H
 #include <pthread.h>
 #endif
 
-#if HAVE_PTHREAD
+#ifdef HAVE_PTHREAD
 static pthread_mutex_t wins_nss_mutex = PTHREAD_MUTEX_INITIALIZER;
 #endif
 
@@ -251,7 +251,7 @@ _nss_wins_gethostbyname_r(const char *hostname,
 	size_t namelen;
 	int rc;
 
-#if HAVE_PTHREAD
+#ifdef HAVE_PTHREAD
 	pthread_mutex_lock(&wins_nss_mutex);
 #endif
 
@@ -353,7 +353,7 @@ _nss_wins_gethostbyname_r(const char *hostname,
 
   out:
 
-#if HAVE_PTHREAD
+#ifdef HAVE_PTHREAD
 	pthread_mutex_unlock(&wins_nss_mutex);
 #endif
 	return nss_status;
-- 
2.19.1


>From 0371745fa66e73881779751f857ec4f5324e927f Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Tue, 20 Nov 2018 14:08:31 +0100
Subject: [PATCH 16/32] nss_winbind: Use #ifdef instead of #if for config.h
 definitions

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 nsswitch/winbind_nss_linux.c | 52 ++++++++++++++++++------------------
 1 file changed, 26 insertions(+), 26 deletions(-)

diff --git a/nsswitch/winbind_nss_linux.c b/nsswitch/winbind_nss_linux.c
index c7443e505bf..4ab10b90f4f 100644
--- a/nsswitch/winbind_nss_linux.c
+++ b/nsswitch/winbind_nss_linux.c
@@ -21,11 +21,11 @@
 
 #include "winbind_client.h"
 
-#if HAVE_PTHREAD_H
+#ifdef HAVE_PTHREAD_H
 #include <pthread.h>
 #endif
 
-#if HAVE_PTHREAD
+#ifdef HAVE_PTHREAD
 static pthread_mutex_t winbind_nss_mutex = PTHREAD_MUTEX_INITIALIZER;
 #endif
 
@@ -243,11 +243,11 @@ static NSS_STATUS fill_pwent(struct passwd *result,
 	/* The struct passwd for Solaris has some extra fields which must
 	   be initialised or nscd crashes. */
 
-#if HAVE_PASSWD_PW_COMMENT
+#ifdef HAVE_PASSWD_PW_COMMENT
 	result->pw_comment = "";
 #endif
 
-#if HAVE_PASSWD_PW_AGE
+#ifdef HAVE_PASSWD_PW_AGE
 	result->pw_age = "";
 #endif
 
@@ -369,7 +369,7 @@ _nss_winbind_setpwent(void)
 	fprintf(stderr, "[%5d]: setpwent\n", getpid());
 #endif
 
-#if HAVE_PTHREAD
+#ifdef HAVE_PTHREAD
 	pthread_mutex_lock(&winbind_nss_mutex);
 #endif
 
@@ -385,7 +385,7 @@ _nss_winbind_setpwent(void)
 		nss_err_str(ret), ret);
 #endif
 
-#if HAVE_PTHREAD
+#ifdef HAVE_PTHREAD
 	pthread_mutex_unlock(&winbind_nss_mutex);
 #endif
 	return ret;
@@ -401,7 +401,7 @@ _nss_winbind_endpwent(void)
 	fprintf(stderr, "[%5d]: endpwent\n", getpid());
 #endif
 
-#if HAVE_PTHREAD
+#ifdef HAVE_PTHREAD
 	pthread_mutex_lock(&winbind_nss_mutex);
 #endif
 
@@ -417,7 +417,7 @@ _nss_winbind_endpwent(void)
 		nss_err_str(ret), ret);
 #endif
 
-#if HAVE_PTHREAD
+#ifdef HAVE_PTHREAD
 	pthread_mutex_unlock(&winbind_nss_mutex);
 #endif
 
@@ -438,7 +438,7 @@ _nss_winbind_getpwent_r(struct passwd *result, char *buffer,
 	fprintf(stderr, "[%5d]: getpwent\n", getpid());
 #endif
 
-#if HAVE_PTHREAD
+#ifdef HAVE_PTHREAD
 	pthread_mutex_lock(&winbind_nss_mutex);
 #endif
 
@@ -514,7 +514,7 @@ _nss_winbind_getpwent_r(struct passwd *result, char *buffer,
 		nss_err_str(ret), ret);
 #endif
 
-#if HAVE_PTHREAD
+#ifdef HAVE_PTHREAD
 	pthread_mutex_unlock(&winbind_nss_mutex);
 #endif
 	return ret;
@@ -535,7 +535,7 @@ _nss_winbind_getpwuid_r(uid_t uid, struct passwd *result, char *buffer,
 	fprintf(stderr, "[%5d]: getpwuid_r %d\n", getpid(), (unsigned int)uid);
 #endif
 
-#if HAVE_PTHREAD
+#ifdef HAVE_PTHREAD
 	pthread_mutex_lock(&winbind_nss_mutex);
 #endif
 
@@ -587,7 +587,7 @@ _nss_winbind_getpwuid_r(uid_t uid, struct passwd *result, char *buffer,
 		(unsigned int)uid, nss_err_str(ret), ret);
 #endif
 
-#if HAVE_PTHREAD
+#ifdef HAVE_PTHREAD
 	pthread_mutex_unlock(&winbind_nss_mutex);
 #endif
 
@@ -608,7 +608,7 @@ _nss_winbind_getpwnam_r(const char *name, struct passwd *result, char *buffer,
 	fprintf(stderr, "[%5d]: getpwnam_r %s\n", getpid(), name);
 #endif
 
-#if HAVE_PTHREAD
+#ifdef HAVE_PTHREAD
 	pthread_mutex_lock(&winbind_nss_mutex);
 #endif
 
@@ -663,7 +663,7 @@ _nss_winbind_getpwnam_r(const char *name, struct passwd *result, char *buffer,
 		name, nss_err_str(ret), ret);
 #endif
 
-#if HAVE_PTHREAD
+#ifdef HAVE_PTHREAD
 	pthread_mutex_unlock(&winbind_nss_mutex);
 #endif
 
@@ -689,7 +689,7 @@ _nss_winbind_setgrent(void)
 	fprintf(stderr, "[%5d]: setgrent\n", getpid());
 #endif
 
-#if HAVE_PTHREAD
+#ifdef HAVE_PTHREAD
 	pthread_mutex_lock(&winbind_nss_mutex);
 #endif
 
@@ -705,7 +705,7 @@ _nss_winbind_setgrent(void)
 		nss_err_str(ret), ret);
 #endif
 
-#if HAVE_PTHREAD
+#ifdef HAVE_PTHREAD
 	pthread_mutex_unlock(&winbind_nss_mutex);
 #endif
 
@@ -722,7 +722,7 @@ _nss_winbind_endgrent(void)
 	fprintf(stderr, "[%5d]: endgrent\n", getpid());
 #endif
 
-#if HAVE_PTHREAD
+#ifdef HAVE_PTHREAD
 	pthread_mutex_lock(&winbind_nss_mutex);
 #endif
 
@@ -738,7 +738,7 @@ _nss_winbind_endgrent(void)
 		nss_err_str(ret), ret);
 #endif
 
-#if HAVE_PTHREAD
+#ifdef HAVE_PTHREAD
 	pthread_mutex_unlock(&winbind_nss_mutex);
 #endif
 
@@ -761,7 +761,7 @@ winbind_getgrent(enum winbindd_cmd cmd,
 	fprintf(stderr, "[%5d]: getgrent\n", getpid());
 #endif
 
-#if HAVE_PTHREAD
+#ifdef HAVE_PTHREAD
 	pthread_mutex_lock(&winbind_nss_mutex);
 #endif
 
@@ -846,7 +846,7 @@ winbind_getgrent(enum winbindd_cmd cmd,
 		nss_err_str(ret), ret);
 #endif
 
-#if HAVE_PTHREAD
+#ifdef HAVE_PTHREAD
 	pthread_mutex_unlock(&winbind_nss_mutex);
 #endif
 
@@ -884,7 +884,7 @@ _nss_winbind_getgrnam_r(const char *name,
 	fprintf(stderr, "[%5d]: getgrnam %s\n", getpid(), name);
 #endif
 
-#if HAVE_PTHREAD
+#ifdef HAVE_PTHREAD
 	pthread_mutex_lock(&winbind_nss_mutex);
 #endif
 
@@ -944,7 +944,7 @@ _nss_winbind_getgrnam_r(const char *name,
 		name, nss_err_str(ret), ret);
 #endif
 
-#if HAVE_PTHREAD
+#ifdef HAVE_PTHREAD
 	pthread_mutex_unlock(&winbind_nss_mutex);
 #endif
 
@@ -967,7 +967,7 @@ _nss_winbind_getgrgid_r(gid_t gid,
 	fprintf(stderr, "[%5d]: getgrgid %d\n", getpid(), gid);
 #endif
 
-#if HAVE_PTHREAD
+#ifdef HAVE_PTHREAD
 	pthread_mutex_lock(&winbind_nss_mutex);
 #endif
 
@@ -1025,7 +1025,7 @@ _nss_winbind_getgrgid_r(gid_t gid,
 		(unsigned int)gid, nss_err_str(ret), ret);
 #endif
 
-#if HAVE_PTHREAD
+#ifdef HAVE_PTHREAD
 	pthread_mutex_unlock(&winbind_nss_mutex);
 #endif
 	return ret;
@@ -1048,7 +1048,7 @@ _nss_winbind_initgroups_dyn(const char *user, gid_t group, long int *start,
 		user, group);
 #endif
 
-#if HAVE_PTHREAD
+#ifdef HAVE_PTHREAD
 	pthread_mutex_lock(&winbind_nss_mutex);
 #endif
 
@@ -1140,7 +1140,7 @@ _nss_winbind_initgroups_dyn(const char *user, gid_t group, long int *start,
 		user, nss_err_str(ret), ret);
 #endif
 
-#if HAVE_PTHREAD
+#ifdef HAVE_PTHREAD
 	pthread_mutex_unlock(&winbind_nss_mutex);
 #endif
 
-- 
2.19.1


>From daa664e3ad9bf5356fb057f61253155e64a484d2 Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Tue, 20 Nov 2018 14:10:36 +0100
Subject: [PATCH 17/32] s3:auth: Use #ifdef instead of #if for config.h
 definitions

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 source3/auth/pampass.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/source3/auth/pampass.c b/source3/auth/pampass.c
index 8cb894482ae..785a0c45b4f 100644
--- a/source3/auth/pampass.c
+++ b/source3/auth/pampass.c
@@ -488,7 +488,7 @@ static bool smb_pam_start(pam_handle_t **pamh, const char *user, const char *rho
 		return False;
 	}
 
-#if HAVE_PAM_RHOST
+#ifdef HAVE_PAM_RHOST
 	DEBUG(4,("smb_pam_start: PAM: setting rhost to: %s\n", rhost));
 	pam_error = pam_set_item(*pamh, PAM_RHOST, rhost);
 	if(!smb_pam_error_handler(*pamh, pam_error, "set rhost failed", 0)) {
@@ -497,7 +497,7 @@ static bool smb_pam_start(pam_handle_t **pamh, const char *user, const char *rho
 		return False;
 	}
 #endif
-#if HAVE_PAM_TTY
+#ifdef HAVE_PAM_TTY
 	DEBUG(4,("smb_pam_start: PAM: setting tty\n"));
 	pam_error = pam_set_item(*pamh, PAM_TTY, "samba");
 	if (!smb_pam_error_handler(*pamh, pam_error, "set tty failed", 0)) {
@@ -642,7 +642,7 @@ static bool smb_internal_pam_session(pam_handle_t *pamh, const char *user, const
 {
 	int pam_error;
 
-#if HAVE_PAM_TTY
+#ifdef HAVE_PAM_TTY
 	DEBUG(4,("smb_internal_pam_session: PAM: tty set to: %s\n", tty));
 	pam_error = pam_set_item(pamh, PAM_TTY, tty);
 	if (!smb_pam_error_handler(pamh, pam_error, "set tty failed", 0))
-- 
2.19.1


>From 33228294eef4a0dcd720f3f55efb15836ab9eca7 Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Tue, 20 Nov 2018 14:11:39 +0100
Subject: [PATCH 18/32] s3:ldap: Use #ifdef instead of #if for config.h
 definitions

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 source3/include/smb_ldap.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/source3/include/smb_ldap.h b/source3/include/smb_ldap.h
index 19e4be5a316..57866382884 100644
--- a/source3/include/smb_ldap.h
+++ b/source3/include/smb_ldap.h
@@ -23,7 +23,7 @@
 #ifndef _SMB_LDAP_H
 #define _SMB_LDAP_H
 
-#if HAVE_LBER_H
+#ifdef HAVE_LBER_H
 #include <lber.h>
 #if defined(HPUX) && !defined(_LBER_TYPES_H)
 /* Define ber_tag_t and ber_int_t for using
@@ -39,7 +39,7 @@ typedef int ber_int_t;
 #endif
 #endif /* HAVE_LBER_H */
 
-#if HAVE_LDAP_H
+#ifdef HAVE_LDAP_H
 #include <ldap.h>
 #ifndef LDAP_CONST
 #define LDAP_CONST const
-- 
2.19.1


>From 2b2ccf7a1e0028a2133ed7bbcf416cc85068d076 Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Tue, 20 Nov 2018 14:12:23 +0100
Subject: [PATCH 19/32] s3:include: Use #ifdef instead of #if for config.h
 definitions

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 source3/include/includes.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/source3/include/includes.h b/source3/include/includes.h
index 032776003a3..acd0788ff4d 100644
--- a/source3/include/includes.h
+++ b/source3/include/includes.h
@@ -76,7 +76,7 @@
 #undef HAVE_LDAP
 #endif
 
-#if HAVE_SYS_ATTRIBUTES_H
+#ifdef HAVE_SYS_ATTRIBUTES_H
 #include <sys/attributes.h>
 #endif
 
@@ -92,17 +92,17 @@
 #include <sys/uio.h>
 #endif
 
-#if HAVE_LANGINFO_H
+#ifdef HAVE_LANGINFO_H
 #include <langinfo.h>
 #endif
 
-#if HAVE_NETGROUP_H
+#ifdef HAVE_NETGROUP_H
 #include <netgroup.h>
 #endif
 
 /* Special macros that are no-ops except when run under Valgrind on
  * x86.  They've moved a little bit from valgrind 1.0.4 to 1.9.4 */
-#if HAVE_VALGRIND_MEMCHECK_H
+#ifdef HAVE_VALGRIND_MEMCHECK_H
         /* memcheck.h includes valgrind.h */
 #include <valgrind/memcheck.h>
 #elif HAVE_VALGRIND_H
-- 
2.19.1


>From 7bd9a9b291daa4efc2abd922b2709a023ee50bbe Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Tue, 20 Nov 2018 14:12:49 +0100
Subject: [PATCH 20/32] s3:lib: Use #ifdef instead of #if for config.h
 definitions

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 source3/lib/addrchange.c | 2 +-
 source3/lib/system.c     | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/source3/lib/addrchange.c b/source3/lib/addrchange.c
index 9a628f7f6c2..719b8702789 100644
--- a/source3/lib/addrchange.c
+++ b/source3/lib/addrchange.c
@@ -20,7 +20,7 @@
 #include "lib/addrchange.h"
 #include "../lib/util/tevent_ntstatus.h"
 
-#if HAVE_LINUX_RTNETLINK_H
+#ifdef HAVE_LINUX_RTNETLINK_H
 
 #include "asm/types.h"
 #include "linux/netlink.h"
diff --git a/source3/lib/system.c b/source3/lib/system.c
index 507d4a9af93..00dd21ccbd6 100644
--- a/source3/lib/system.c
+++ b/source3/lib/system.c
@@ -509,7 +509,7 @@ int sys_fallocate(int fd, uint32_t mode, off_t offset, off_t len)
 #endif	/* HAVE_LINUX_FALLOCATE */
 }
 
-#if HAVE_KERNEL_SHARE_MODES
+#ifdef HAVE_KERNEL_SHARE_MODES
 #ifndef LOCK_MAND
 #define LOCK_MAND	32	/* This is a mandatory flock */
 #define LOCK_READ	64	/* ... Which allows concurrent read operations */
@@ -524,7 +524,7 @@ int sys_fallocate(int fd, uint32_t mode, off_t offset, off_t len)
 
 void kernel_flock(int fd, uint32_t share_mode, uint32_t access_mask)
 {
-#if HAVE_KERNEL_SHARE_MODES
+#ifdef HAVE_KERNEL_SHARE_MODES
 	int kernel_mode = 0;
 	if (share_mode == FILE_SHARE_WRITE) {
 		kernel_mode = LOCK_MAND|LOCK_WRITE;
-- 
2.19.1


>From ec3b3a08b2d236fc95dccbb9e3350dbf53417ff0 Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Tue, 20 Nov 2018 14:14:07 +0100
Subject: [PATCH 21/32] s3:libads: Use #ifdef instead of #if for config.h
 definitions

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 source3/libads/ads_struct.c | 2 +-
 source3/libads/kerberos.c   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/source3/libads/ads_struct.c b/source3/libads/ads_struct.c
index 0dc7b11d400..3ab682c0e38 100644
--- a/source3/libads/ads_struct.c
+++ b/source3/libads/ads_struct.c
@@ -184,7 +184,7 @@ void ads_destroy(ADS_STRUCT **ads)
 		bool is_mine;
 
 		is_mine = (*ads)->is_mine;
-#if HAVE_LDAP
+#ifdef HAVE_LDAP
 		ads_disconnect(*ads);
 #endif
 		SAFE_FREE((*ads)->server.realm);
diff --git a/source3/libads/kerberos.c b/source3/libads/kerberos.c
index 58f38cdc55d..5df2493ead2 100644
--- a/source3/libads/kerberos.c
+++ b/source3/libads/kerberos.c
@@ -59,7 +59,7 @@ kerb_prompter(krb5_context ctx, void *data,
 		 * version have looping detection and return with a proper error code.
 		 */
 
-#if HAVE_KRB5_PROMPT_TYPE /* Heimdal */
+#if defined(HAVE_KRB5_PROMPT_TYPE) /* Heimdal */
 		 if (prompts[0].type == KRB5_PROMPT_TYPE_NEW_PASSWORD &&
 		     prompts[1].type == KRB5_PROMPT_TYPE_NEW_PASSWORD_AGAIN) {
 			/*
-- 
2.19.1


>From 0dce417f90d97c18aa3fd051c3ffac6b2f703975 Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Tue, 20 Nov 2018 15:53:23 +0100
Subject: [PATCH 22/32] s3:libsmb: Use #ifdef instead of #if for config.h
 definitions

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 source3/libsmb/libsmb_stat.c | 8 ++++----
 source3/libsmb/pylibsmb.c    | 2 +-
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/source3/libsmb/libsmb_stat.c b/source3/libsmb/libsmb_stat.c
index 4191ad6d215..f8b35bdb9ea 100644
--- a/source3/libsmb/libsmb_stat.c
+++ b/source3/libsmb/libsmb_stat.c
@@ -412,7 +412,7 @@ SMBC_fstatvfs_ctx(SMBCCTX *context,
                         /* ... then provide it */
                         st->f_bsize =
                                 (unsigned long) bytes_per_sector;
-#if HAVE_FRSIZE
+#ifdef HAVE_FRSIZE
                         st->f_frsize =
                                 (unsigned long) sectors_per_allocation_unit;
 #endif
@@ -459,7 +459,7 @@ SMBC_fstatvfs_ctx(SMBCCTX *context,
                                 (fsfilcnt_t) total_file_nodes;
                         st->f_ffree =
                                 (fsfilcnt_t) free_file_nodes;
-#if HAVE_FSID_INT
+#ifdef HAVE_FSID_INT
                         st->f_fsid =
                                 (unsigned long) fs_identifier;
 #endif
@@ -489,9 +489,9 @@ SMBC_fstatvfs_ctx(SMBCCTX *context,
                 flags |= SMBC_VFS_FEATURE_DFS;
         }
 
-#if HAVE_STATVFS_F_FLAG
+#if defined(HAVE_STATVFS_F_FLAG)
         st->f_flag = flags;
-#elif HAVE_STATVFS_F_FLAGS
+#elif defined(HAVE_STATVFS_F_FLAGS)
         st->f_flags = flags;
 #endif
 
diff --git a/source3/libsmb/pylibsmb.c b/source3/libsmb/pylibsmb.c
index 311820c7d66..99e5587cae7 100644
--- a/source3/libsmb/pylibsmb.c
+++ b/source3/libsmb/pylibsmb.c
@@ -88,7 +88,7 @@ struct py_cli_state {
 	struct py_tevent_cond *oplock_cond;
 };
 
-#if HAVE_PTHREAD
+#ifdef HAVE_PTHREAD
 
 #include <pthread.h>
 
-- 
2.19.1


>From e7f0001cf6069a9e08f849c7104f2ecd9c94b3d7 Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Tue, 20 Nov 2018 15:54:28 +0100
Subject: [PATCH 23/32] s3:modules: Use #ifdef instead of #if for config.h
 definitions

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 source3/modules/getdate.c    | 6 +++---
 source3/modules/getdate.y    | 6 +++---
 source3/modules/vfs_commit.c | 4 ++--
 source3/modules/vfs_zfsacl.c | 2 +-
 4 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/source3/modules/getdate.c b/source3/modules/getdate.c
index ccc9b10e6f7..10e46789ccf 100644
--- a/source3/modules/getdate.c
+++ b/source3/modules/getdate.c
@@ -109,7 +109,7 @@
 #include <ctype.h>
 #include <string.h>
 
-#if HAVE_STDLIB_H
+#ifdef HAVE_STDLIB_H
 # include <stdlib.h> /* for `free'; used by Bison 1.27 */
 #endif
 
@@ -2535,7 +2535,7 @@ get_date (const char *p, const time_t *now)
   pc.local_zones_seen = 0;
   pc.zones_seen = 0;
 
-#if HAVE_STRUCT_TM_TM_ZONE
+#ifdef HAVE_STRUCT_TM_TM_ZONE
   pc.local_time_zone_table[0].name = tmp->tm_zone;
   pc.local_time_zone_table[0].type = tLOCAL_ZONE;
   pc.local_time_zone_table[0].value = tmp->tm_isdst;
@@ -2563,7 +2563,7 @@ get_date (const char *p, const time_t *now)
       }
   }
 #else
-#if HAVE_TZNAME
+#ifdef HAVE_TZNAME
   {
 # ifndef tzname
     extern char *tzname[];
diff --git a/source3/modules/getdate.y b/source3/modules/getdate.y
index 3ac9f26abfc..90b54a865cc 100644
--- a/source3/modules/getdate.y
+++ b/source3/modules/getdate.y
@@ -44,7 +44,7 @@
 #include <ctype.h>
 #include <string.h>
 
-#if HAVE_STDLIB_H
+#ifdef HAVE_STDLIB_H
 # include <stdlib.h> /* for `free'; used by Bison 1.27 */
 #endif
 
@@ -911,7 +911,7 @@ get_date (const char *p, const time_t *now)
   pc.local_zones_seen = 0;
   pc.zones_seen = 0;
 
-#if HAVE_STRUCT_TM_TM_ZONE
+#ifdef HAVE_STRUCT_TM_TM_ZONE
   pc.local_time_zone_table[0].name = tmp->tm_zone;
   pc.local_time_zone_table[0].type = tLOCAL_ZONE;
   pc.local_time_zone_table[0].value = tmp->tm_isdst;
@@ -939,7 +939,7 @@ get_date (const char *p, const time_t *now)
       }
   }
 #else
-#if HAVE_TZNAME
+#ifdef HAVE_TZNAME
   {
 # ifndef tzname
     extern char *tzname[];
diff --git a/source3/modules/vfs_commit.c b/source3/modules/vfs_commit.c
index a11f9e2f131..408c90c46a0 100644
--- a/source3/modules/vfs_commit.c
+++ b/source3/modules/vfs_commit.c
@@ -86,9 +86,9 @@ static int commit_do(
 		("%s: flushing %lu dirty bytes\n",
 		 MODULE, (unsigned long)c->dbytes));
 
-#if HAVE_FDATASYNC
+#if defined(HAVE_FDATASYNC)
         result = fdatasync(fd);
-#elif HAVE_FSYNC
+#elif defined(HAVE_FSYNC)
         result = fsync(fd);
 #else
 	DEBUG(0, ("%s: WARNING: no commit support on this platform\n",
diff --git a/source3/modules/vfs_zfsacl.c b/source3/modules/vfs_zfsacl.c
index 43e41f95c1a..2c5d82ae207 100644
--- a/source3/modules/vfs_zfsacl.c
+++ b/source3/modules/vfs_zfsacl.c
@@ -27,7 +27,7 @@
 #include "smbd/smbd.h"
 #include "nfs4_acls.h"
 
-#if HAVE_FREEBSD_SUNACL_H
+#ifdef HAVE_FREEBSD_SUNACL_H
 #include "sunacl.h"
 #endif
 
-- 
2.19.1


>From 751f30dfd377347f48e44b6e00774ee475b22e8f Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Tue, 20 Nov 2018 15:55:43 +0100
Subject: [PATCH 24/32] s3:nmbd: Use #ifdef instead of #if for config.h
 definitions

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 source3/nmbd/nmbd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/source3/nmbd/nmbd.c b/source3/nmbd/nmbd.c
index fa2bfbb287a..9d6cac99a63 100644
--- a/source3/nmbd/nmbd.c
+++ b/source3/nmbd/nmbd.c
@@ -957,7 +957,7 @@ static bool open_sockets(bool isdaemon, int port)
 		become_daemon(Fork, no_process_group, log_stdout);
 	}
 
-#if HAVE_SETPGID
+#ifdef HAVE_SETPGID
 	/*
 	 * If we're interactive we want to set our own process group for 
 	 * signal management.
-- 
2.19.1


>From f2f9453153958bb029de334889d38aad259e38a1 Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Tue, 20 Nov 2018 15:56:14 +0100
Subject: [PATCH 25/32] s3:rpc_server: Use #ifdef instead of #if for config.h
 definitions

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 source3/rpc_server/rpc_sock_helper.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/source3/rpc_server/rpc_sock_helper.c b/source3/rpc_server/rpc_sock_helper.c
index 7aced6302e9..392005d8a78 100644
--- a/source3/rpc_server/rpc_sock_helper.c
+++ b/source3/rpc_server/rpc_sock_helper.c
@@ -105,7 +105,7 @@ NTSTATUS rpc_create_tcpip_sockets(const struct ndr_interface_table *iface,
 		const char *sock_ptr;
 		char *sock_tok;
 
-#if HAVE_IPV6
+#ifdef HAVE_IPV6
 		sock_addr = "::,0.0.0.0";
 #else
 		sock_addr = "0.0.0.0";
@@ -226,7 +226,7 @@ NTSTATUS rpc_setup_tcpip_sockets(struct tevent_context *ev_ctx,
 		const char *sock_ptr;
 		char *sock_tok;
 
-#if HAVE_IPV6
+#ifdef HAVE_IPV6
 		sock_addr = "::,0.0.0.0";
 #else
 		sock_addr = "0.0.0.0";
-- 
2.19.1


>From ed2f5cdfd60412e260e4647aa3ef87e748cf2e66 Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Tue, 20 Nov 2018 15:57:09 +0100
Subject: [PATCH 26/32] s3:smbd: Use #ifdef instead of #if for config.h
 definitions

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 source3/smbd/oplock.c       | 2 +-
 source3/smbd/oplock_linux.c | 2 +-
 source3/smbd/server.c       | 6 +++---
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/source3/smbd/oplock.c b/source3/smbd/oplock.c
index a7ac8464891..426b9e7faea 100644
--- a/source3/smbd/oplock.c
+++ b/source3/smbd/oplock.c
@@ -1449,7 +1449,7 @@ void init_kernel_oplocks(struct smbd_server_connection *sconn)
 
 	/* only initialize once */
 	if (koplocks == NULL) {
-#if HAVE_KERNEL_OPLOCKS_LINUX
+#ifdef HAVE_KERNEL_OPLOCKS_LINUX
 		koplocks = linux_init_kernel_oplocks(sconn);
 #endif
 		sconn->oplocks.kernel_ops = koplocks;
diff --git a/source3/smbd/oplock_linux.c b/source3/smbd/oplock_linux.c
index f5afdd81abd..76760ff0346 100644
--- a/source3/smbd/oplock_linux.c
+++ b/source3/smbd/oplock_linux.c
@@ -23,7 +23,7 @@
 #include "smbd/smbd.h"
 #include "smbd/globals.h"
 
-#if HAVE_KERNEL_OPLOCKS_LINUX
+#ifdef HAVE_KERNEL_OPLOCKS_LINUX
 
 #ifndef F_SETLEASE
 #define F_SETLEASE	1024
diff --git a/source3/smbd/server.c b/source3/smbd/server.c
index ab7803258c8..68cd1d7bd54 100644
--- a/source3/smbd/server.c
+++ b/source3/smbd/server.c
@@ -181,7 +181,7 @@ static void msg_inject_fault(struct messaging_context *msg,
 		return;
 	}
 
-#if HAVE_STRSIGNAL
+#ifdef HAVE_STRSIGNAL
 	DEBUG(0, ("Process %s requested injection of signal %d (%s)\n",
 		  server_id_str_buf(src, &tmp), sig, strsignal(sig)));
 #else
@@ -1218,7 +1218,7 @@ static bool open_sockets_smbd(struct smbd_parent_context *parent,
 		char *sock_tok;
 		const char *sock_ptr;
 
-#if HAVE_IPV6
+#ifdef HAVE_IPV6
 		sock_addr = "::,0.0.0.0";
 #else
 		sock_addr = "0.0.0.0";
@@ -1843,7 +1843,7 @@ extern void build_options(bool screen);
 		become_daemon(Fork, no_process_group, log_stdout);
 	}
 
-#if HAVE_SETPGID
+#ifdef HAVE_SETPGID
 	/*
 	 * If we're interactive we want to set our own process group for
 	 * signal management.
-- 
2.19.1


>From 34c5e27cd05ec0f0e6e99d0740dac26a268fe2a3 Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Tue, 20 Nov 2018 15:57:51 +0100
Subject: [PATCH 27/32] s3:utils: Use #ifdef instead of #if for config.h
 definitions

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 source3/utils/ntlm_auth.c  | 2 +-
 source3/utils/smbcontrol.c | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/source3/utils/ntlm_auth.c b/source3/utils/ntlm_auth.c
index b8014ec1034..629f5e5dd6b 100644
--- a/source3/utils/ntlm_auth.c
+++ b/source3/utils/ntlm_auth.c
@@ -49,7 +49,7 @@
 #include "lib/util/base64.h"
 #include "cmdline_contexts.h"
 
-#if HAVE_KRB5
+#ifdef HAVE_KRB5
 #include "auth/kerberos/pac_utils.h"
 #endif
 
diff --git a/source3/utils/smbcontrol.c b/source3/utils/smbcontrol.c
index 597bab6450d..866217c248b 100644
--- a/source3/utils/smbcontrol.c
+++ b/source3/utils/smbcontrol.c
@@ -37,15 +37,15 @@
 #include "serverid.h"
 #include "cmdline_contexts.h"
 
-#if HAVE_LIBUNWIND_H
+#ifdef HAVE_LIBUNWIND_H
 #include <libunwind.h>
 #endif
 
-#if HAVE_LIBUNWIND_PTRACE_H
+#ifdef HAVE_LIBUNWIND_PTRACE_H
 #include <libunwind-ptrace.h>
 #endif
 
-#if HAVE_SYS_PTRACE_H
+#ifdef HAVE_SYS_PTRACE_H
 #include <sys/ptrace.h>
 #endif
 
-- 
2.19.1


>From aa092d98f529064475920e0fda6bb0ede128faf5 Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Tue, 20 Nov 2018 15:58:28 +0100
Subject: [PATCH 28/32] s3:winbindd: Use #ifdef instead of #if for config.h
 definitions

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 source3/winbindd/winbindd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/source3/winbindd/winbindd.c b/source3/winbindd/winbindd.c
index d2c005bc8ff..e6e8dc78fc8 100644
--- a/source3/winbindd/winbindd.c
+++ b/source3/winbindd/winbindd.c
@@ -1832,7 +1832,7 @@ int main(int argc, const char **argv)
 
 	pidfile_create(lp_pid_directory(), "winbindd");
 
-#if HAVE_SETPGID
+#ifdef HAVE_SETPGID
 	/*
 	 * If we're interactive we want to set our own process group for
 	 * signal management.
-- 
2.19.1


>From 7957cae5717798b1f90e500434d1495f52543360 Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Wed, 21 Nov 2018 11:33:51 +0100
Subject: [PATCH 29/32] s4:lib: Use #ifdef instead of #if for config.h
 definitions

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 source4/lib/socket/socket.c    | 2 +-
 source4/lib/socket/socket_ip.c | 2 +-
 source4/lib/tls/tlscert.c      | 4 ++--
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/source4/lib/socket/socket.c b/source4/lib/socket/socket.c
index 98f796e3fed..d7535bf357a 100644
--- a/source4/lib/socket/socket.c
+++ b/source4/lib/socket/socket.c
@@ -619,7 +619,7 @@ _PUBLIC_ const struct socket_ops *socket_getops_byname(const char *family, enum
 		return socket_ipv4_ops(type);
 	}
 
-#if HAVE_IPV6
+#ifdef HAVE_IPV6
 	if (strcmp("ipv6", family) == 0) {
 		return socket_ipv6_ops(type);
 	}
diff --git a/source4/lib/socket/socket_ip.c b/source4/lib/socket/socket_ip.c
index e0aa5da07cb..fd109a3eacd 100644
--- a/source4/lib/socket/socket_ip.c
+++ b/source4/lib/socket/socket_ip.c
@@ -557,7 +557,7 @@ _PUBLIC_ const struct socket_ops *socket_ipv4_ops(enum socket_type type)
 	return &ipv4_ops;
 }
 
-#if HAVE_IPV6
+#ifdef HAVE_IPV6
 
 static struct in6_addr interpret_addr6(const char *name)
 {
diff --git a/source4/lib/tls/tlscert.c b/source4/lib/tls/tlscert.c
index 2273ef74f32..db87cb7fe15 100644
--- a/source4/lib/tls/tlscert.c
+++ b/source4/lib/tls/tlscert.c
@@ -103,7 +103,7 @@ void tls_cert_generate(TALLOC_CTX *mem_ctx,
 	TLSCHECK(gnutls_x509_crt_set_key_usage(cacrt, GNUTLS_KEY_KEY_CERT_SIGN | GNUTLS_KEY_CRL_SIGN));
 	TLSCHECK(gnutls_x509_crt_set_version(cacrt, 3));
 	TLSCHECK(gnutls_x509_crt_get_key_id(cacrt, 0, keyid, &keyidsize));
-#if HAVE_GNUTLS_X509_CRT_SET_SUBJECT_KEY_ID
+#ifdef HAVE_GNUTLS_X509_CRT_SET_SUBJECT_KEY_ID
 	TLSCHECK(gnutls_x509_crt_set_subject_key_id(cacrt, keyid, keyidsize));
 #endif
 	TLSCHECK(gnutls_x509_crt_sign2(cacrt, cacrt, cakey,
@@ -130,7 +130,7 @@ void tls_cert_generate(TALLOC_CTX *mem_ctx,
 #endif
 	TLSCHECK(gnutls_x509_crt_set_version(crt, 3));
 	TLSCHECK(gnutls_x509_crt_get_key_id(crt, 0, keyid, &keyidsize));
-#if HAVE_GNUTLS_X509_CRT_SET_SUBJECT_KEY_ID
+#ifdef HAVE_GNUTLS_X509_CRT_SET_SUBJECT_KEY_ID
 	TLSCHECK(gnutls_x509_crt_set_subject_key_id(crt, keyid, keyidsize));
 #endif
 	TLSCHECK(gnutls_x509_crt_sign2(crt, crt, key,
-- 
2.19.1


>From 8419939b6301a6ad07e9ca5f453083e95e1eb957 Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Wed, 21 Nov 2018 11:36:23 +0100
Subject: [PATCH 30/32] s4:ntvfs: Use #ifdef instead of #if for config.h
 definitions

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 source4/ntvfs/posix/pvfs_read.c  | 2 +-
 source4/ntvfs/posix/pvfs_write.c | 2 +-
 source4/ntvfs/posix/vfs_posix.c  | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/source4/ntvfs/posix/pvfs_read.c b/source4/ntvfs/posix/pvfs_read.c
index f60b721e418..23cbe458ed6 100644
--- a/source4/ntvfs/posix/pvfs_read.c
+++ b/source4/ntvfs/posix/pvfs_read.c
@@ -76,7 +76,7 @@ NTSTATUS pvfs_read(struct ntvfs_module_context *ntvfs,
 		ret = pvfs_stream_read(pvfs, f->handle, 
 				       rd->readx.out.data, maxcnt, rd->readx.in.offset);
 	} else {
-#if HAVE_LINUX_AIO
+#ifdef HAVE_LINUX_AIO
 		/* possibly try an aio read */
 		if ((req->async_states->state & NTVFS_ASYNC_STATE_MAY_ASYNC) &&
 		    (pvfs->flags & PVFS_FLAG_LINUX_AIO)) {
diff --git a/source4/ntvfs/posix/pvfs_write.c b/source4/ntvfs/posix/pvfs_write.c
index 544e254300b..e4725ec579f 100644
--- a/source4/ntvfs/posix/pvfs_write.c
+++ b/source4/ntvfs/posix/pvfs_write.c
@@ -124,7 +124,7 @@ NTSTATUS pvfs_write(struct ntvfs_module_context *ntvfs,
 					wr->writex.in.count,
 					wr->writex.in.offset);
 	} else {
-#if HAVE_LINUX_AIO
+#ifdef HAVE_LINUX_AIO
 		/* possibly try an aio write */
 		if ((req->async_states->state & NTVFS_ASYNC_STATE_MAY_ASYNC) &&
 		    (pvfs->flags & PVFS_FLAG_LINUX_AIO)) {
diff --git a/source4/ntvfs/posix/vfs_posix.c b/source4/ntvfs/posix/vfs_posix.c
index 4133723c50a..df5637486d3 100644
--- a/source4/ntvfs/posix/vfs_posix.c
+++ b/source4/ntvfs/posix/vfs_posix.c
@@ -92,7 +92,7 @@ static void pvfs_setup_options(struct pvfs_state *pvfs)
 							PVFS_SEARCH_INACTIVITY,
 							PVFS_SEARCH_INACTIVITY_DEFAULT);
 
-#if HAVE_XATTR_SUPPORT
+#ifdef HAVE_XATTR_SUPPORT
 	if (share_bool_option(scfg, PVFS_XATTR, PVFS_XATTR_DEFAULT))
 		pvfs->flags |= PVFS_FLAG_XATTR_ENABLE;
 #endif
-- 
2.19.1


>From ac713fa6723ce43bf6230f0e6eda6b0e6d37f638 Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Wed, 21 Nov 2018 11:37:26 +0100
Subject: [PATCH 31/32] s4:smbd: Use #ifdef instead of #if for config.h
 definitions

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 source4/smbd/process_prefork.c  | 2 +-
 source4/smbd/process_standard.c | 2 +-
 source4/smbd/server.c           | 6 +++---
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/source4/smbd/process_prefork.c b/source4/smbd/process_prefork.c
index 016385c762c..86be3384925 100644
--- a/source4/smbd/process_prefork.c
+++ b/source4/smbd/process_prefork.c
@@ -50,7 +50,7 @@ static void sigterm_signal_handler(struct tevent_context *ev,
 				int signum, int count, void *siginfo,
 				void *private_data)
 {
-#if HAVE_GETPGRP
+#ifdef HAVE_GETPGRP
 	if (getpgrp() == getpid()) {
 		/*
 		 * We're the process group leader, send
diff --git a/source4/smbd/process_standard.c b/source4/smbd/process_standard.c
index 91dfa9753c5..841bb545fe3 100644
--- a/source4/smbd/process_standard.c
+++ b/source4/smbd/process_standard.c
@@ -68,7 +68,7 @@ static void sigterm_signal_handler(struct tevent_context *ev,
 				int signum, int count, void *siginfo,
 				void *private_data)
 {
-#if HAVE_GETPGRP
+#ifdef HAVE_GETPGRP
 	if (getpgrp() == getpid()) {
 		/*
 		 * We're the process group leader, send
diff --git a/source4/smbd/server.c b/source4/smbd/server.c
index 5eca0b9e869..57e05dccade 100644
--- a/source4/smbd/server.c
+++ b/source4/smbd/server.c
@@ -128,7 +128,7 @@ static void sig_hup(int sig)
 
 static void sig_term(int sig)
 {
-#if HAVE_GETPGRP
+#ifdef HAVE_GETPGRP
 	if (getpgrp() == getpid()) {
 		/*
 		 * We're the process group leader, send
@@ -198,7 +198,7 @@ static void server_stdin_handler(struct tevent_context *event_ctx,
 	if (read(0, &c, 1) == 0) {
 		DBG_ERR("%s: EOF on stdin - PID %d terminating\n",
 			state->binary_name, (int)getpid());
-#if HAVE_GETPGRP
+#ifdef HAVE_GETPGRP
 		if (getpgrp() == getpid()) {
 			DBG_ERR("Sending SIGTERM from pid %d\n",
 				(int)getpid());
@@ -594,7 +594,7 @@ static int binary_smbd_main(const char *binary_name,
 		stdin_event_flags = 0;
 	}
 
-#if HAVE_SETPGID
+#ifdef HAVE_SETPGID
 	/*
 	 * If we're interactive we want to set our own process group for
 	 * signal management, unless --no-process-group specified.
-- 
2.19.1


>From f77d0b3ed3e0b5e492891fca7ffb02f1fb1c9baf Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Wed, 21 Nov 2018 11:38:24 +0100
Subject: [PATCH 32/32] s4:torture: Use #ifdef instead of #if for config.h
 definitions

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 source4/torture/shell.c       | 2 +-
 source4/torture/smb2/oplock.c | 2 +-
 source4/torture/smbtorture.c  | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/source4/torture/shell.c b/source4/torture/shell.c
index 5a4eb5c1d6a..195149a0a6a 100644
--- a/source4/torture/shell.c
+++ b/source4/torture/shell.c
@@ -119,7 +119,7 @@ void torture_shell(struct torture_context *tctx)
 		if (cline == NULL)
 			return;
 
-#if HAVE_ADD_HISTORY
+#ifdef HAVE_ADD_HISTORY
 		add_history(cline);
 #endif
 
diff --git a/source4/torture/smb2/oplock.c b/source4/torture/smb2/oplock.c
index 8bbb641ea72..143078a37d1 100644
--- a/source4/torture/smb2/oplock.c
+++ b/source4/torture/smb2/oplock.c
@@ -4792,7 +4792,7 @@ done:
 	return ret;
 }
 
-#if HAVE_KERNEL_OPLOCKS_LINUX
+#ifdef HAVE_KERNEL_OPLOCKS_LINUX
 
 #ifndef F_SETLEASE
 #define F_SETLEASE      1024
diff --git a/source4/torture/smbtorture.c b/source4/torture/smbtorture.c
index dcce7328647..15eb81b7fea 100644
--- a/source4/torture/smbtorture.c
+++ b/source4/torture/smbtorture.c
@@ -34,7 +34,7 @@
 #include "param/param.h"
 #include "lib/util/samba_modules.h"
 
-#if HAVE_READLINE_HISTORY_H
+#ifdef HAVE_READLINE_HISTORY_H
 #include <readline/history.h>
 #endif
 
-- 
2.19.1



More information about the samba-technical mailing list