Store some path names in global variables initialized to configure
[ira/wip.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 #ifdef LOCKDIR
198        output(screen,"   LOCKDIR: %s\n",LOCKDIR);
199 #endif
200 #ifdef DRIVERFILE
201        output(screen,"   DRIVERFILE: %s\n",DRIVERFILE);
202 #endif
203        output(screen,"   LOGFILEBASE: %s\n", dyn_LOGFILEBASE);
204 #ifdef FORMSFILE
205        output(screen,"   FORMSFILE: %s\n",FORMSFILE);
206 #endif
207 #ifdef NTDRIVERSDIR
208        output(screen,"   NTDRIVERSDIR: %s\n",NTDRIVERSDIR);
209 #endif 
210
211        /*Output various other options (most map to defines in the configure script*/
212        output(screen,"\nOther Build Options:\n");
213 #ifdef HAVE_VOLATILE
214        output(screen,"   HAVE_VOLATILE\n");
215 #endif
216 #ifdef HAVE_SHADOW_H
217        output(screen,"   HAVE_SHADOW_H\n");
218 #endif
219 #ifdef HAVE_CRYPT
220        output(screen,"   HAVE_CRYPT\n");
221 #endif
222 #ifdef USE_BOTH_CRYPT_CALLS
223        output(screen,"   USE_BOTH_CRYPT_CALLS\n");
224 #endif
225 #ifdef HAVE_TRUNCATED_SALT
226        output(screen,"   HAVE_TRUNCATED_SALT\n");
227 #endif
228 #ifdef HAVE_CUPS
229        output(screen,"   HAVE_CUPS\n");
230 #endif
231 #ifdef HAVE_CUPS_CUPS_H
232        output(screen,"   HAVE_CUPS_CUPS_H\n");
233 #endif
234 #ifdef HAVE_CUPS_LANGUAGE_H
235        output(screen,"   HAVE_CUPS_LANGUAGE_H\n");
236 #endif
237 #ifdef HAVE_LIBDL
238        output(screen,"   HAVE_LIBDL\n");
239 #endif
240 #ifdef HAVE_UNIXSOCKET
241        output(screen,"   HAVE_UNIXSOCKET\n");
242 #endif
243 #ifdef HAVE_SOCKLEN_T_TYPE
244        output(screen,"   HAVE_SOCKLEN_T_TYPE\n");
245 #endif
246 #ifdef HAVE_SIG_ATOMIC_T_TYPE
247        output(screen,"   HAVE_SIG_ATOMIC_T_TYPE\n");
248 #endif
249 #ifdef HAVE_SETRESUID
250        output(screen,"   HAVE_SETRESUID\n");
251 #endif
252 #ifdef HAVE_SETRESGID
253        output(screen,"   HAVE_SETRESGID\n");
254 #endif
255 #ifdef HAVE_CONNECT
256        output(screen,"   HAVE_CONNECT\n");
257 #endif
258 #ifdef HAVE_YP_GET_DEFAULT_DOMAIN
259        output(screen,"   HAVE_YP_GET_DEFAULT_DOMAIN\n");
260 #endif
261 #ifdef HAVE_STAT64
262        output(screen,"   HAVE_STAT64\n");
263 #endif
264 #ifdef HAVE_LSTAT64
265        output(screen,"   HAVE_LSTAT64\n");
266 #endif
267 #ifdef HAVE_FSTAT64
268        output(screen,"   HAVE_FSTAT64\n");
269 #endif
270 #ifdef HAVE_STRCASECMP
271        output(screen,"   HAVE_STRCASECMP\n");
272 #endif
273 #ifdef HAVE_MEMSET
274        output(screen,"   HAVE_MEMSET\n");
275 #endif
276 #ifdef HAVE_LONGLONG
277        output(screen,"   HAVE_LONGLONG\n");
278 #endif
279 #ifdef COMPILER_SUPPORTS_LL
280        output(screen,"   COMPILER_SUPPORTS_LL\n");
281 #endif
282 #ifdef SIZEOF_OFF_T
283        output(screen,"   SIZEOF_OFF_T: %d\n",SIZEOF_OFF_T);
284 #endif
285 #ifdef HAVE_OFF64_T
286        output(screen,"   HAVE_OFF64_T\n");
287 #endif
288 #ifdef SIZEOF_INO_T
289        output(screen,"   SIZEOF_INO_T: %d\n",SIZEOF_INO_T);
290 #endif
291 #ifdef HAVE_INO64_T
292        output(screen,"   HAVE_INO64_T\n");
293 #endif
294 #ifdef HAVE_STRUCT_DIRENT64
295        output(screen,"   HAVE_STRUCT_DIRENT64\n");
296 #endif
297 #ifdef HAVE_UNSIGNED_CHAR
298        output(screen,"   HAVE_UNSIGNED_CHAR\n");
299 #endif
300 #ifdef HAVE_SOCK_SIN_LEN
301        output(screen,"   HAVE_SOCK_SIN_LEN\n");
302 #endif
303 #ifdef SEEKDIR_RETURNS_VOID
304        output(screen,"   SEEKDIR_RETURNS_VOID\n");
305 #endif
306 #ifdef HAVE_FILE_MACRO
307        output(screen,"   HAVE_FILE_MACRO\n");
308 #endif
309 #ifdef HAVE_FUNCTION_MACRO
310        output(screen,"   HAVE_FUNCTION_MACRO\n");
311 #endif
312 #ifdef HAVE_GETTIMEOFDAY
313        output(screen,"   HAVE_GETTIMEOFDAY\n");
314 #endif
315 #ifdef HAVE_C99_VSNPRINTF
316        output(screen,"   HAVE_C99_VSNPRINTF\n");
317 #endif
318 #ifdef HAVE_BROKEN_READDIR
319        output(screen,"   HAVE_BROKEN_READDIR\n");
320 #endif
321 #ifdef HAVE_NATIVE_ICONV
322        output(screen,"   HAVE_NATIVE_ICONV\n");
323 #endif
324 #ifdef HAVE_KERNEL_OPLOCKS_LINUX
325        output(screen,"   HAVE_KERNEL_OPLOCKS_LINUX\n");
326 #endif
327 #ifdef HAVE_KERNEL_CHANGE_NOTIFY
328        output(screen,"   HAVE_KERNEL_CHANGE_NOTIFY\n");
329 #endif
330 #ifdef HAVE_KERNEL_SHARE_MODES
331        output(screen,"   HAVE_KERNEL_SHARE_MODES\n");
332 #endif
333 #ifdef HAVE_KERNEL_OPLOCKS_IRIX
334        output(screen,"   HAVE_KERNEL_OPLOCKS_IRIX\n");
335 #endif
336 #ifdef HAVE_IRIX_SPECIFIC_CAPABILITIES
337        output(screen,"   HAVE_IRIX_SPECIFIC_CAPABILITIES\n");
338 #endif
339 #ifdef HAVE_INT16_FROM_RPC_RPC_H
340        output(screen,"   HAVE_INT16_FROM_RPC_RPC_H\n");
341 #endif
342 #ifdef HAVE_UINT16_FROM_RPC_RPC_H
343        output(screen,"   HAVE_UINT16_FROM_RPC_RPC_H\n");
344 #endif
345 #ifdef HAVE_INT32_FROM_RPC_RPC_H
346        output(screen,"   HAVE_INT16_FROM_RPC_RPC_H\n");
347 #endif
348 #ifdef HAVE_UINT32_FROM_RPC_RPC_H
349        output(screen,"   HAVE_UINT32_FROM_RPC_RPC_H\n");
350 #endif
351 #ifdef HAVE_RPC_AUTH_ERROR_CONFLICT
352        output(screen,"   HAVE_RPC_AUTH_ERROR_CONFLICT\n");
353 #endif
354 #ifdef HAVE_FTRUNCATE_EXTEND
355        output(screen,"   HAVE_FTRUNCATE_EXTEND\n");
356 #endif
357 #ifdef HAVE_WORKING_AF_LOCAL
358        output(screen,"   HAVE_WORKING_AF_LOCAL\n");
359 #endif
360 #ifdef HAVE_BROKEN_GETGROUPS
361        output(screen,"   HAVE_BROKEN_GETGROUPS\n");
362 #endif
363 #ifdef REPLACE_GETPASS
364        output(screen,"   REPLACE_GETPASS\n");
365 #endif
366 #ifdef REPLACE_INET_NTOA
367        output(screen,"   REPLACE_INET_NTOA\n");
368 #endif
369 #ifdef HAVE_SECURE_MKSTEMP
370        output(screen,"   HAVE_SECURE_MKSTEMP\n");
371 #endif
372 #ifdef SYSCONF_SC_NGROUPS_MAX
373        output(screen,"   SYSCONF_SC_NGROUPS_MAX\n");
374 #endif
375 #ifdef HAVE_IFACE_AIX
376        output(screen,"   HAVE_IFACE_AIX\n");
377 #endif
378 #ifdef HAVE_IFACE_IFCONF
379        output(screen,"   HAVE_IFACE_IFCONF\n");
380 #endif
381 #ifdef HAVE_IFACE_IFREQ
382        output(screen,"   HAVE_IFACE_IFREQ\n");
383 #endif
384 #ifdef USE_SETRESUID
385        output(screen,"   USE_SETRESUID\n");
386 #endif
387 #ifdef USE_SETRESGID
388        output(screen,"   USE_SETREUID\n");
389 #endif
390 #ifdef USE_SETEUID
391        output(screen,"   USE_SETEUID\n");
392 #endif
393 #ifdef USE_SETUIDX
394        output(screen,"   USE_SETUIDX\n");
395 #endif
396 #ifdef HAVE_MMAP
397        output(screen,"   HAVE_MMAP\n");
398 #endif
399 #ifdef MMAP_BLACKLIST
400        output(screen,"   MMAP_BLACKLIST\n");
401 #endif
402 #ifdef FTRUNCATE_NEEDS_ROOT
403        output(screen,"   FTRUNCATE_NEEDS_ROOT\n");
404 #endif
405 #ifdef HAVE_FCNTL_LOCK
406        output(screen,"   HAVE_FCNTL_LOCK\n");
407 #endif
408 #ifdef HAVE_BROKEN_FCNTL64_LOCKS
409        output(screen,"   HAVE_BROKEN_FCNTL64_LOCKS\n");
410 #endif
411 #ifdef HAVE_STRUCT_FLOCK64
412        output(screen,"   HAVE_STRUCT_FLOCK64\n");
413 #endif
414 #ifdef BROKEN_NISPLUS_INCLUDE_FILES
415        output(screen,"   BROKEN_NISPLUS_INCLUDE_FILES\n");
416 #endif
417 #ifdef HAVE_LIBPAM
418        output(screen,"   HAVE_LIBPAM\n");
419 #endif
420 #ifdef STAT_STATVFS64
421        output(screen,"   STAT_STATVFS64\n");
422 #endif
423 #ifdef STAT_STATVFS
424        output(screen,"   STAT_STATVFS\n");
425 #endif
426 #ifdef STAT_STATFS3_OSF1
427        output(screen,"   STAT_STATFS3_OSF1\n");
428 #endif
429 #ifdef STAT_STATFS2_BSIZE
430        output(screen,"   STAT_STATFS2_BSIZE\n");
431 #endif
432 #ifdef STAT_STATFS4
433        output(screen,"   STAT_STATFS4\n");
434 #endif
435 #ifdef STAT_STATFS2_FSIZE
436        output(screen,"   STAT_STATFS2_FSIZE\n");
437 #endif
438 #ifdef STAT_STATFS2_FS_DATA
439        output(screen,"   STAT_STATFS2_FS_DATA\n");
440 #endif
441 #ifdef HAVE_EXPLICIT_LARGEFILE_SUPPORT
442        output(screen,"   HAVE_EXPLICIT_LARGEFILE_SUPPORT\n");
443 #endif
444
445 #ifdef WITH_UTMP
446        /* Output UTMP Stuff */
447        output(screen,"\nUTMP Related:\n");
448        output(screen,"   WITH_UTMP\n");
449
450 #ifdef HAVE_UTIMBUF
451        output(screen,"   HAVE_UTIMBUF\n");
452 #endif
453 #ifdef HAVE_UT_UT_NAME
454        output(screen,"   HAVE_UT_UT_NAME\n");
455 #endif
456 #ifdef HAVE_UT_UT_USER
457        output(screen,"   HAVE_UT_UT_USER\n");
458 #endif
459 #ifdef HAVE_UT_UT_ID
460        output(screen,"   HAVE_UT_UT_ID\n");
461 #endif
462 #ifdef HAVE_UT_UT_HOST
463        output(screen,"   HAVE_UT_UT_HOST\n");
464 #endif
465 #ifdef HAVE_UT_UT_TIME
466        output(screen,"   HAVE_UT_UT_TIME\n");
467 #endif
468 #ifdef HAVE_UT_UT_TV
469        output(screen,"   HAVE_UT_UT_TV\n");
470 #endif
471 #ifdef HAVE_UT_UT_TYPE
472        output(screen,"   HAVE_UT_UT_TYPE\n");
473 #endif
474 #ifdef HAVE_UT_UT_PID
475        output(screen,"   HAVE_UT_UT_PID\n");
476 #endif
477 #ifdef HAVE_UT_UT_EXIT
478        output(screen,"   HAVE_UT_UT_EXIT\n");
479 #endif
480 #ifdef HAVE_UT_UT_ADDR
481        output(screen,"   HAVE_UT_UT_ADDR\n");
482 #endif
483 #ifdef PUTUTLINE_RETURNS_UTMP
484        output(screen,"   PUTUTLINE_RETURNS_UTMP\n");
485 #endif
486 #ifdef HAVE_UX_UT_SYSLEN
487        output(screen,"   HAVE_UX_UT_SYSLEN\n");
488 #endif
489 #endif /* WITH_UTMP */
490
491        /* Output Build OS */
492        output(screen,"\nBuilt for host os:\n");
493 #ifdef LINUX
494        output(screen,"   LINUX\n");
495 #endif
496 #ifdef SUNOS5
497        output(screen,"   SUNOS5\n");
498 #endif
499 #ifdef SUNOS4
500        output(screen,"   SUNOS4\n");
501 #endif
502        /* BSD Isn't Defined in the configure script, but there is something about it in include/config.h.in (and I guess acconfig.h) */
503 #ifdef BSD
504        output(screen,"   BSD\n");
505 #endif
506 #ifdef IRIX
507        output(screen,"   IRIX\n");
508 #endif
509 #ifdef IRIX6
510        output(screen,"   IRIX6\n");
511 #endif
512 #ifdef AIX
513        output(screen,"   AIX\n");
514 #endif
515 #ifdef HPUX
516        output(screen,"   HPUX\n");
517 #endif
518 #ifdef QNX
519        output(screen,"   QNX\n");
520 #endif
521 #ifdef OSF1
522        output(screen,"   OSF1\n");
523 #endif
524 #ifdef SCO
525        output(screen,"   SCO\n");
526 #endif
527 #ifdef UNIXWARE
528        output(screen,"   UNIXWARE\n");
529 #endif
530 #ifdef NEXT2
531        output(screen,"   NEXT2\n");
532 #endif
533 #ifdef RELIANTUNIX
534        output(screen,"   RELIANTUNIX\n");
535 #endif
536
537        /* Output the sizes of the various types */
538        output(screen,"\nType sizes:\n");
539        output(screen,"   sizeof(char):    %d\n",sizeof(char));
540        output(screen,"   sizeof(int):     %d\n",sizeof(int));
541        output(screen,"   sizeof(long):    %d\n",sizeof(long));
542        output(screen,"   sizeof(uint8):   %d\n",sizeof(uint8));
543        output(screen,"   sizeof(uint16):  %d\n",sizeof(uint16));
544        output(screen,"   sizeof(uint32):  %d\n",sizeof(uint32));
545        output(screen,"   sizeof(short):   %d\n",sizeof(short));
546        output(screen,"   sizeof(void*):   %d\n",sizeof(void*));
547 }
548
549
550