LIBDIR and LOCKDIR are dynamically configured too.
[jra/samba/.git] / source3 / smbd / build_options.c
1 /* 
2    Unix SMB/Netbios implementation.
3    Version 2.2
4    Build Options for Samba Suite
5    Copyright (C) Vance Lankhaar <vlankhaar@hotmail.com> 2001
6    Copyright (C) Andrew Bartlett <abartlet@samba.org> 2001
7    
8    This program is free software; you can redistribute it and/or modify
9    it under the terms of the GNU General Public License as published by
10    the Free Software Foundation; either version 2 of the License, or
11    (at your option) any later version.
12    
13    This program is distributed in the hope that it will be useful,
14    but WITHOUT ANY WARRANTY; without even the implied warranty of
15    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16    GNU General Public License for more details.
17    
18    You should have received a copy of the GNU General Public License
19    along with this program; if not, write to the Free Software
20    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 */
22
23 #include "includes.h"
24 #include "build_env.h"
25 #include "dynconfig.h"
26
27 static void output(BOOL screen, char *format, ...) PRINTF_ATTRIBUTE(2,3);
28
29 /*
30 #define OUTPUT(x) snprintf(outstring,sizeof(outstring),x); output(screen,outstring);
31 */
32 /****************************************************************************
33 helper function for build_options
34 ****************************************************************************/
35 static void output(BOOL screen, char *format, ...)
36 {
37        char *ptr;
38        va_list ap;
39        
40        va_start(ap, format);
41        vasprintf(&ptr,format,ap);
42        va_end(ap);
43
44        if (screen) {
45               d_printf("%s", ptr);
46        } else {
47                DEBUG(4,("%s", ptr));
48        }
49        
50        SAFE_FREE(ptr);
51 }
52
53 /****************************************************************************
54 options set at build time for the samba suite
55 ****************************************************************************/
56 void build_options(BOOL screen)
57 {
58        if ((DEBUGLEVEL < 4) && (!screen)) {
59                return;
60        }
61
62 #ifdef _BUILD_ENV_H
63        /* Output information about the build environment */
64        output(screen,"Build environment:\n");
65        output(screen,"   Built by:    %s@%s\n",BUILD_ENV_USER,BUILD_ENV_HOST);
66        output(screen,"   Built on:    %s\n",BUILD_ENV_DATE);
67
68        output(screen,"   Built using: %s\n",BUILD_ENV_COMPILER);
69        output(screen,"   Build host:  %s\n",BUILD_ENV_UNAME);
70        output(screen,"   SRCDIR:      %s\n",BUILD_ENV_SRCDIR);
71        output(screen,"   BUILDDIR:    %s\n",BUILD_ENV_BUILDDIR);
72
73        
74 #endif
75
76        /* Output various options (most correspond to --with options) */ 
77        output(screen,"\nBuild options:\n");
78 #ifdef WITH_SMBWRAPPER 
79        output(screen,"   WITH_SMBWRAPPER\n");
80 #endif
81 #ifdef WITH_AFS
82        output(screen,"   WITH_AFS\n");
83 #endif
84 #ifdef WITH_DFS
85        output(screen,"   WITH_DFS\n");
86 #endif
87 #ifdef KRB4_AUTH
88        output(screen,"   KRB4_AUTH");
89 #endif
90 #ifdef HAVE_KRB5
91        output(screen,"   HAVE_KRB5");
92 #endif
93 #ifdef WITH_AUTOMOUNT
94        output(screen,"   WITH_AUTOMOUNT\n");
95 #endif
96 #ifdef WITH_SMBMOUNT
97        output(screen,"   WITH_SMBMOUNT\n");
98 #endif
99 #ifdef WITH_PAM
100        output(screen,"   WITH_PAM\n");
101 #endif
102 #ifdef WITH_TDB_SAM
103        output(screen,"   WITH_TDB_SAM\n");
104 #endif
105 #ifdef WITH_LDAP_SAM
106        output(screen,"   WITH_LDAP_SAM\n");
107 #endif
108 #ifdef WITH_SMBPASSWD_SAM
109        output(screen,"   WITH_SMBPASSWD_SAM\n");
110 #endif
111 #ifdef WITH_NISPLUS_SAM
112        output(screen,"   WITH_NISPLUS_SAM\n");
113 #endif
114 #ifdef WITH_NISPLUS_HOME
115        output(screen,"   WITH_NISPLUS_HOME\n");
116 #endif
117 #ifdef WITH_SSL
118        output(screen,"   WITH_SSL\n");
119 #endif
120 #ifdef SSL_DIR
121        output(screen,"   SSL_DIR: %s\n",SSL_DIR);
122 #endif
123 #ifdef WITH_SYSLOG
124        output(screen,"   WITH_SYSLOG\n");
125 #endif
126 #ifdef WITH_PROFILE
127        output(screen,"   WITH_PROFILE\n");
128 #endif
129 #ifdef WITH_QUOTAS
130        output(screen,"   WITH_QUOTAS\n");
131 #endif
132 #ifdef WITH_MSDFS
133        output(screen,"   WITH_MSDFS\n");
134 #endif
135 #ifdef WITH_VFS
136        output(screen,"   WITH_VFS\n");
137 #endif
138 #ifdef USE_SPINLOCKS
139        output(screen,"   USE_SPINLOCKS\n");
140 #endif
141 #ifdef SPARC_SPINLOCKS
142        output(screen,"   SPARC_SPINLOCKS\n");
143 #endif
144 #ifdef INTEL_SPINLOCKS
145        output(screen,"   INTEL_SPINLOCKS\n");
146 #endif
147 #ifdef MIPS_SPINLOCKS
148        output(screen,"   MIPS_SPINLOCKS\n");
149 #endif
150 #ifdef POWERPC_SPINLOCKS
151        output(screen,"   POWERPC_SPINLOCKS\n");
152 #endif
153 #ifdef HAVE_UNIXWARE_ACLS
154        output(screen,"   HAVE_UNIXWARE_ACLS\n");
155 #endif
156 #ifdef HAVE_SOLARIS_ACLS
157        output(screen,"   HAVE_SOLARIS_ACLS\n");
158 #endif 
159 #ifdef HAVE_IRIX_ACLS
160        output(screen,"   HAVE_IRIX_ACLS\n");
161 #endif
162 #ifdef HAVE_AIX_ACLS
163        output(screen,"   HAVE_AIX_ACLS\n");
164 #endif
165 #ifdef HAVE_POSIX_ACLS
166        output(screen,"   HAVE_POSIX_ACLS\n");
167 #endif
168 #ifdef HAVE_TRU64_ACLS
169        output(screen,"   HAVE_TRU64_ACLS\n");
170 #endif
171
172 #ifdef HAVE_ACL_GET_PERM_NP
173        output(screen,"   HAVE_ACL_GET_PERM_NP\n");
174 #endif
175 #ifdef HAVE_NO_ACLS
176        output(screen,"   HAVE_NO_ACLS\n");
177 #endif
178 #ifdef HAVE_LIBREADLINE
179        output(screen,"   HAVE_LIBREADLINE\n"); 
180 #endif
181 #ifdef WITH_LIBICONV
182        output(screen,"   WITH_LIBICONV: %s\n",WITH_LIBICONV);
183 #endif
184
185
186        /* Output various paths to files and directories */
187        output(screen,"\nPaths:\n");
188        output(screen,"   CONFIGFILE: %s\n", dyn_CONFIGFILE);
189 #ifdef PRIVATE_DIR
190        output(screen,"   PRIVATE_DIR: %s\n",PRIVATE_DIR);
191 #endif
192 #ifdef LMHOSTSFILE
193        output(screen,"   LMHOSTSFILE: %s\n",LMHOSTSFILE);
194 #endif
195        output(screen,"   SBINDIR: %s\n", dyn_SBINDIR);
196        output(screen,"   BINDIR: %s\n", dyn_BINDIR);
197        output(screen,"   LOCKDIR: %s\n",dyn_LOCKDIR);
198 #ifdef DRIVERFILE
199        output(screen,"   DRIVERFILE: %s\n",DRIVERFILE);
200 #endif
201        output(screen,"   LOGFILEBASE: %s\n", dyn_LOGFILEBASE);
202 #ifdef FORMSFILE
203        output(screen,"   FORMSFILE: %s\n",FORMSFILE);
204 #endif
205 #ifdef NTDRIVERSDIR
206        output(screen,"   NTDRIVERSDIR: %s\n",NTDRIVERSDIR);
207 #endif 
208
209        /*Output various other options (most map to defines in the configure script*/
210        output(screen,"\nOther Build Options:\n");
211 #ifdef HAVE_VOLATILE
212        output(screen,"   HAVE_VOLATILE\n");
213 #endif
214 #ifdef HAVE_SHADOW_H
215        output(screen,"   HAVE_SHADOW_H\n");
216 #endif
217 #ifdef HAVE_CRYPT
218        output(screen,"   HAVE_CRYPT\n");
219 #endif
220 #ifdef USE_BOTH_CRYPT_CALLS
221        output(screen,"   USE_BOTH_CRYPT_CALLS\n");
222 #endif
223 #ifdef HAVE_TRUNCATED_SALT
224        output(screen,"   HAVE_TRUNCATED_SALT\n");
225 #endif
226 #ifdef HAVE_CUPS
227        output(screen,"   HAVE_CUPS\n");
228 #endif
229 #ifdef HAVE_CUPS_CUPS_H
230        output(screen,"   HAVE_CUPS_CUPS_H\n");
231 #endif
232 #ifdef HAVE_CUPS_LANGUAGE_H
233        output(screen,"   HAVE_CUPS_LANGUAGE_H\n");
234 #endif
235 #ifdef HAVE_LIBDL
236        output(screen,"   HAVE_LIBDL\n");
237 #endif
238 #ifdef HAVE_UNIXSOCKET
239        output(screen,"   HAVE_UNIXSOCKET\n");
240 #endif
241 #ifdef HAVE_SOCKLEN_T_TYPE
242        output(screen,"   HAVE_SOCKLEN_T_TYPE\n");
243 #endif
244 #ifdef HAVE_SIG_ATOMIC_T_TYPE
245        output(screen,"   HAVE_SIG_ATOMIC_T_TYPE\n");
246 #endif
247 #ifdef HAVE_SETRESUID
248        output(screen,"   HAVE_SETRESUID\n");
249 #endif
250 #ifdef HAVE_SETRESGID
251        output(screen,"   HAVE_SETRESGID\n");
252 #endif
253 #ifdef HAVE_CONNECT
254        output(screen,"   HAVE_CONNECT\n");
255 #endif
256 #ifdef HAVE_YP_GET_DEFAULT_DOMAIN
257        output(screen,"   HAVE_YP_GET_DEFAULT_DOMAIN\n");
258 #endif
259 #ifdef HAVE_STAT64
260        output(screen,"   HAVE_STAT64\n");
261 #endif
262 #ifdef HAVE_LSTAT64
263        output(screen,"   HAVE_LSTAT64\n");
264 #endif
265 #ifdef HAVE_FSTAT64
266        output(screen,"   HAVE_FSTAT64\n");
267 #endif
268 #ifdef HAVE_STRCASECMP
269        output(screen,"   HAVE_STRCASECMP\n");
270 #endif
271 #ifdef HAVE_MEMSET
272        output(screen,"   HAVE_MEMSET\n");
273 #endif
274 #ifdef HAVE_LONGLONG
275        output(screen,"   HAVE_LONGLONG\n");
276 #endif
277 #ifdef COMPILER_SUPPORTS_LL
278        output(screen,"   COMPILER_SUPPORTS_LL\n");
279 #endif
280 #ifdef SIZEOF_OFF_T
281        output(screen,"   SIZEOF_OFF_T: %d\n",SIZEOF_OFF_T);
282 #endif
283 #ifdef HAVE_OFF64_T
284        output(screen,"   HAVE_OFF64_T\n");
285 #endif
286 #ifdef SIZEOF_INO_T
287        output(screen,"   SIZEOF_INO_T: %d\n",SIZEOF_INO_T);
288 #endif
289 #ifdef HAVE_INO64_T
290        output(screen,"   HAVE_INO64_T\n");
291 #endif
292 #ifdef HAVE_STRUCT_DIRENT64
293        output(screen,"   HAVE_STRUCT_DIRENT64\n");
294 #endif
295 #ifdef HAVE_UNSIGNED_CHAR
296        output(screen,"   HAVE_UNSIGNED_CHAR\n");
297 #endif
298 #ifdef HAVE_SOCK_SIN_LEN
299        output(screen,"   HAVE_SOCK_SIN_LEN\n");
300 #endif
301 #ifdef SEEKDIR_RETURNS_VOID
302        output(screen,"   SEEKDIR_RETURNS_VOID\n");
303 #endif
304 #ifdef HAVE_FILE_MACRO
305        output(screen,"   HAVE_FILE_MACRO\n");
306 #endif
307 #ifdef HAVE_FUNCTION_MACRO
308        output(screen,"   HAVE_FUNCTION_MACRO\n");
309 #endif
310 #ifdef HAVE_GETTIMEOFDAY
311        output(screen,"   HAVE_GETTIMEOFDAY\n");
312 #endif
313 #ifdef HAVE_C99_VSNPRINTF
314        output(screen,"   HAVE_C99_VSNPRINTF\n");
315 #endif
316 #ifdef HAVE_BROKEN_READDIR
317        output(screen,"   HAVE_BROKEN_READDIR\n");
318 #endif
319 #ifdef HAVE_NATIVE_ICONV
320        output(screen,"   HAVE_NATIVE_ICONV\n");
321 #endif
322 #ifdef HAVE_KERNEL_OPLOCKS_LINUX
323        output(screen,"   HAVE_KERNEL_OPLOCKS_LINUX\n");
324 #endif
325 #ifdef HAVE_KERNEL_CHANGE_NOTIFY
326        output(screen,"   HAVE_KERNEL_CHANGE_NOTIFY\n");
327 #endif
328 #ifdef HAVE_KERNEL_SHARE_MODES
329        output(screen,"   HAVE_KERNEL_SHARE_MODES\n");
330 #endif
331 #ifdef HAVE_KERNEL_OPLOCKS_IRIX
332        output(screen,"   HAVE_KERNEL_OPLOCKS_IRIX\n");
333 #endif
334 #ifdef HAVE_IRIX_SPECIFIC_CAPABILITIES
335        output(screen,"   HAVE_IRIX_SPECIFIC_CAPABILITIES\n");
336 #endif
337 #ifdef HAVE_INT16_FROM_RPC_RPC_H
338        output(screen,"   HAVE_INT16_FROM_RPC_RPC_H\n");
339 #endif
340 #ifdef HAVE_UINT16_FROM_RPC_RPC_H
341        output(screen,"   HAVE_UINT16_FROM_RPC_RPC_H\n");
342 #endif
343 #ifdef HAVE_INT32_FROM_RPC_RPC_H
344        output(screen,"   HAVE_INT16_FROM_RPC_RPC_H\n");
345 #endif
346 #ifdef HAVE_UINT32_FROM_RPC_RPC_H
347        output(screen,"   HAVE_UINT32_FROM_RPC_RPC_H\n");
348 #endif
349 #ifdef HAVE_RPC_AUTH_ERROR_CONFLICT
350        output(screen,"   HAVE_RPC_AUTH_ERROR_CONFLICT\n");
351 #endif
352 #ifdef HAVE_FTRUNCATE_EXTEND
353        output(screen,"   HAVE_FTRUNCATE_EXTEND\n");
354 #endif
355 #ifdef HAVE_WORKING_AF_LOCAL
356        output(screen,"   HAVE_WORKING_AF_LOCAL\n");
357 #endif
358 #ifdef HAVE_BROKEN_GETGROUPS
359        output(screen,"   HAVE_BROKEN_GETGROUPS\n");
360 #endif
361 #ifdef REPLACE_GETPASS
362        output(screen,"   REPLACE_GETPASS\n");
363 #endif
364 #ifdef REPLACE_INET_NTOA
365        output(screen,"   REPLACE_INET_NTOA\n");
366 #endif
367 #ifdef HAVE_SECURE_MKSTEMP
368        output(screen,"   HAVE_SECURE_MKSTEMP\n");
369 #endif
370 #ifdef SYSCONF_SC_NGROUPS_MAX
371        output(screen,"   SYSCONF_SC_NGROUPS_MAX\n");
372 #endif
373 #ifdef HAVE_IFACE_AIX
374        output(screen,"   HAVE_IFACE_AIX\n");
375 #endif
376 #ifdef HAVE_IFACE_IFCONF
377        output(screen,"   HAVE_IFACE_IFCONF\n");
378 #endif
379 #ifdef HAVE_IFACE_IFREQ
380        output(screen,"   HAVE_IFACE_IFREQ\n");
381 #endif
382 #ifdef USE_SETRESUID
383        output(screen,"   USE_SETRESUID\n");
384 #endif
385 #ifdef USE_SETRESGID
386        output(screen,"   USE_SETREUID\n");
387 #endif
388 #ifdef USE_SETEUID
389        output(screen,"   USE_SETEUID\n");
390 #endif
391 #ifdef USE_SETUIDX
392        output(screen,"   USE_SETUIDX\n");
393 #endif
394 #ifdef HAVE_MMAP
395        output(screen,"   HAVE_MMAP\n");
396 #endif
397 #ifdef MMAP_BLACKLIST
398        output(screen,"   MMAP_BLACKLIST\n");
399 #endif
400 #ifdef FTRUNCATE_NEEDS_ROOT
401        output(screen,"   FTRUNCATE_NEEDS_ROOT\n");
402 #endif
403 #ifdef HAVE_FCNTL_LOCK
404        output(screen,"   HAVE_FCNTL_LOCK\n");
405 #endif
406 #ifdef HAVE_BROKEN_FCNTL64_LOCKS
407        output(screen,"   HAVE_BROKEN_FCNTL64_LOCKS\n");
408 #endif
409 #ifdef HAVE_STRUCT_FLOCK64
410        output(screen,"   HAVE_STRUCT_FLOCK64\n");
411 #endif
412 #ifdef BROKEN_NISPLUS_INCLUDE_FILES
413        output(screen,"   BROKEN_NISPLUS_INCLUDE_FILES\n");
414 #endif
415 #ifdef HAVE_LIBPAM
416        output(screen,"   HAVE_LIBPAM\n");
417 #endif
418 #ifdef STAT_STATVFS64
419        output(screen,"   STAT_STATVFS64\n");
420 #endif
421 #ifdef STAT_STATVFS
422        output(screen,"   STAT_STATVFS\n");
423 #endif
424 #ifdef STAT_STATFS3_OSF1
425        output(screen,"   STAT_STATFS3_OSF1\n");
426 #endif
427 #ifdef STAT_STATFS2_BSIZE
428        output(screen,"   STAT_STATFS2_BSIZE\n");
429 #endif
430 #ifdef STAT_STATFS4
431        output(screen,"   STAT_STATFS4\n");
432 #endif
433 #ifdef STAT_STATFS2_FSIZE
434        output(screen,"   STAT_STATFS2_FSIZE\n");
435 #endif
436 #ifdef STAT_STATFS2_FS_DATA
437        output(screen,"   STAT_STATFS2_FS_DATA\n");
438 #endif
439 #ifdef HAVE_EXPLICIT_LARGEFILE_SUPPORT
440        output(screen,"   HAVE_EXPLICIT_LARGEFILE_SUPPORT\n");
441 #endif
442
443 #ifdef WITH_UTMP
444        /* Output UTMP Stuff */
445        output(screen,"\nUTMP Related:\n");
446        output(screen,"   WITH_UTMP\n");
447
448 #ifdef HAVE_UTIMBUF
449        output(screen,"   HAVE_UTIMBUF\n");
450 #endif
451 #ifdef HAVE_UT_UT_NAME
452        output(screen,"   HAVE_UT_UT_NAME\n");
453 #endif
454 #ifdef HAVE_UT_UT_USER
455        output(screen,"   HAVE_UT_UT_USER\n");
456 #endif
457 #ifdef HAVE_UT_UT_ID
458        output(screen,"   HAVE_UT_UT_ID\n");
459 #endif
460 #ifdef HAVE_UT_UT_HOST
461        output(screen,"   HAVE_UT_UT_HOST\n");
462 #endif
463 #ifdef HAVE_UT_UT_TIME
464        output(screen,"   HAVE_UT_UT_TIME\n");
465 #endif
466 #ifdef HAVE_UT_UT_TV
467        output(screen,"   HAVE_UT_UT_TV\n");
468 #endif
469 #ifdef HAVE_UT_UT_TYPE
470        output(screen,"   HAVE_UT_UT_TYPE\n");
471 #endif
472 #ifdef HAVE_UT_UT_PID
473        output(screen,"   HAVE_UT_UT_PID\n");
474 #endif
475 #ifdef HAVE_UT_UT_EXIT
476        output(screen,"   HAVE_UT_UT_EXIT\n");
477 #endif
478 #ifdef HAVE_UT_UT_ADDR
479        output(screen,"   HAVE_UT_UT_ADDR\n");
480 #endif
481 #ifdef PUTUTLINE_RETURNS_UTMP
482        output(screen,"   PUTUTLINE_RETURNS_UTMP\n");
483 #endif
484 #ifdef HAVE_UX_UT_SYSLEN
485        output(screen,"   HAVE_UX_UT_SYSLEN\n");
486 #endif
487 #endif /* WITH_UTMP */
488
489        /* Output Build OS */
490        output(screen,"\nBuilt for host os:\n");
491 #ifdef LINUX
492        output(screen,"   LINUX\n");
493 #endif
494 #ifdef SUNOS5
495        output(screen,"   SUNOS5\n");
496 #endif
497 #ifdef SUNOS4
498        output(screen,"   SUNOS4\n");
499 #endif
500        /* BSD Isn't Defined in the configure script, but there is something about it in include/config.h.in (and I guess acconfig.h) */
501 #ifdef BSD
502        output(screen,"   BSD\n");
503 #endif
504 #ifdef IRIX
505        output(screen,"   IRIX\n");
506 #endif
507 #ifdef IRIX6
508        output(screen,"   IRIX6\n");
509 #endif
510 #ifdef AIX
511        output(screen,"   AIX\n");
512 #endif
513 #ifdef HPUX
514        output(screen,"   HPUX\n");
515 #endif
516 #ifdef QNX
517        output(screen,"   QNX\n");
518 #endif
519 #ifdef OSF1
520        output(screen,"   OSF1\n");
521 #endif
522 #ifdef SCO
523        output(screen,"   SCO\n");
524 #endif
525 #ifdef UNIXWARE
526        output(screen,"   UNIXWARE\n");
527 #endif
528 #ifdef NEXT2
529        output(screen,"   NEXT2\n");
530 #endif
531 #ifdef RELIANTUNIX
532        output(screen,"   RELIANTUNIX\n");
533 #endif
534
535        /* Output the sizes of the various types */
536        output(screen,"\nType sizes:\n");
537        output(screen,"   sizeof(char):    %d\n",sizeof(char));
538        output(screen,"   sizeof(int):     %d\n",sizeof(int));
539        output(screen,"   sizeof(long):    %d\n",sizeof(long));
540        output(screen,"   sizeof(uint8):   %d\n",sizeof(uint8));
541        output(screen,"   sizeof(uint16):  %d\n",sizeof(uint16));
542        output(screen,"   sizeof(uint32):  %d\n",sizeof(uint32));
543        output(screen,"   sizeof(short):   %d\n",sizeof(short));
544        output(screen,"   sizeof(void*):   %d\n",sizeof(void*));
545 }
546
547
548