1 /*
2  * Information about the build environment
3  * Bruno Haible 2004-2008, 2016-2017
4  * Sam Steingold 2004-2009, 2016
5  */
6 
7 #include "lispbibl.c"
8 
9 #include "cflags.h"
10 
11 #if defined(GNU_READLINE)
12 #include <readline/readline.h>
13 #endif
14 
15 #if defined(DYNAMIC_FFI)
16 #include <avcall.h>
17 #endif
18 
19 /* Returns a multiline string containing some info about the flags with which
20    the executable was built. */
built_flags(void)21 global object built_flags (void) {
22   var const char * part1 =
23     /* string concatenation done by the C compiler */
24     CC
25     " " CFLAGS
26     " " CLFLAGS
27     " " LIBS
28     " " X_LIBS "\n"
29     "SAFETY=" STRINGIFY(SAFETY)
30   #ifdef TYPECODES
31     " TYPECODES"
32   #endif
33   #ifdef HEAPCODES
34     " HEAPCODES"
35    #ifdef ONE_FREE_BIT_HEAPCODES
36     " ONE_FREE_BIT_HEAPCODES"
37    #endif
38    #ifdef KERNELVOID32_HEAPCODES
39     " KERNELVOID32_HEAPCODES"
40    #endif
41    #ifdef GENERIC64_HEAPCODES
42     " GENERIC64_HEAPCODES"
43    #endif
44   #endif
45   #ifdef WIDE
46    #if defined(WIDE_HARD)
47     " WIDE_HARD"
48    #elif defined(WIDE_SOFT)
49     " WIDE_SOFT"
50    #else
51     " WIDE"
52    #endif
53   #endif
54   #ifdef GENERATIONAL_GC
55     " GENERATIONAL_GC"
56   #endif
57   #ifdef SPVW_BLOCKS
58     " SPVW_BLOCKS"
59   #endif
60   #ifdef SPVW_PAGES
61     " SPVW_PAGES"
62   #endif
63   #ifdef SPVW_MIXED
64     " SPVW_MIXED"
65   #endif
66   #ifdef SPVW_PURE
67     " SPVW_PURE"
68   #endif
69   #ifdef SINGLEMAP_MEMORY
70     " SINGLEMAP_MEMORY"
71   #endif
72   #ifdef TRIVIALMAP_MEMORY
73     " TRIVIALMAP_MEMORY"
74   #endif
75     ;
76   var uintL count = 1;
77   pushSTACK(ascii_to_string(part1));
78  #ifdef LIBSIGSEGV_VERSION
79   var char libsigsegv_ver[BUFSIZ];
80   sprintf(libsigsegv_ver, "\nlibsigsegv %d.%d",
81           LIBSIGSEGV_VERSION >> 8, LIBSIGSEGV_VERSION & 0xff);
82   pushSTACK(ascii_to_string(libsigsegv_ver)); count++;
83  #endif
84  #ifdef _LIBICONV_VERSION
85   var char libiconv_ver[BUFSIZ];
86   sprintf(libiconv_ver, "\nlibiconv %d.%d",
87           _LIBICONV_VERSION >> 8, _LIBICONV_VERSION & 0xff);
88   pushSTACK(ascii_to_string(libiconv_ver)); count++;
89  #endif
90  #ifdef RL_VERSION_MAJOR
91   var char libreadline_ver[BUFSIZ];
92   sprintf(libreadline_ver, "\nlibreadline %d.%d",
93           RL_VERSION_MAJOR,RL_VERSION_MINOR);
94   pushSTACK(ascii_to_string(libreadline_ver)); count++;
95  #endif
96  #ifdef LIBFFCALL_VERSION
97   var char libffcall_ver[BUFSIZ];
98   sprintf(libffcall_ver, "\nlibffcall %d.%d",
99           LIBFFCALL_VERSION >> 8, LIBFFCALL_VERSION & 0xff);
100   pushSTACK(ascii_to_string(libffcall_ver)); count++;
101  #endif
102   return count == 1 ? (object)popSTACK() : string_concat(count);
103 }
104