88
88
* keeps trying them until out of probes or one returns good (non-zero) value
91
char cmnd[2048], res[2048], osname[128], targ[512];
92
char *cmnd, *res, *frm, *targ;
97
98
asmd = (asmd0 > ASM_None && asmd0 < NASMD) ? asmd0 : gas_x86_32;
98
99
OS = (OS0 > OSOther && OS0 < NOS) ? OS0 : OSLinux;
100
101
strlowcpy(osname, osnam[OSFreeBSD]);
102
else if (OSIsWin(OS))
103
strcpy(osname, "win");
102
105
strlowcpy(osname, osnam[OS]);
108
i = strlen(targ0) + 24;
109
targ = malloc(sizeof(char)*i);
104
111
sprintf(targ, "atlrun=atlas_runX targ=%s", targ0);
115
targ = malloc(sizeof(char));
108
121
* If Assembler right or unspecified, try x86 probe
110
123
if (asmd == gas_x86_32 || asmd == gas_x86_64)
112
sprintf(cmnd, "make IRunArchInfo_x86 MYFLAGS=\"-DATL_OS_%s -DATL_%s\" args=\"%s\" %s | fgrep '%s'",
113
osnam[OS], ASMNAM[asmd], flag, targ, find);
114
if (!CmndOneLine(NULL, cmnd, res))
125
frm = "make IRunArchInfo_x86 MYFLAGS=\"-DATL_OS_%s -DATL_%s\" args=\"%s\" %s | fgrep '%s'";
126
i = strlen(frm) + strlen(osnam[OS]) + strlen(ASMNAM[asmd]) + strlen(flag)
127
+ strlen(targ) + strlen(find) + 1;
128
cmnd = malloc(sizeof(char)*i);
130
sprintf(cmnd, frm, osnam[OS], ASMNAM[asmd], flag, targ, find);
131
res = atlsys_1L(NULL, cmnd, 0, 0);
116
134
iret = GetFirstInt(res);
117
135
*sure = GetLastInt(res);
121
141
* If that didn't work, try OS-specific probe
125
sprintf(cmnd, "make IRunArchInfo_%s MYFLAGS=\"-DATL_OS_%s -DATL_%s\" args=\"%s\" %s | fgrep '%s'",
126
osname, osnam[OS], ASMNAM[asmd], flag, targ, find);
127
if (!CmndOneLine(NULL, cmnd, res))
145
frm = "make IRunArchInfo_%s MYFLAGS=\"-DATL_OS_%s -DATL_%s\" args=\"%s\" %s | fgrep '%s'";
146
i = 1 + strlen(frm) + strlen(osname) + 3+strlen(osnam[OS]) +
147
strlen(ASMNAM[asmd]) + strlen(flag) + strlen(targ) + strlen(find);
148
cmnd = malloc(sizeof(char)*i);
150
sprintf(cmnd, frm, osname, osnam[OS], ASMNAM[asmd], flag, targ, find);
151
res = atlsys_1L(NULL, cmnd, 0, 0);
129
154
iret = GetFirstInt(res);
130
155
*sure = GetLastInt(res);
143
char cmnd[2048], res[2048], osname[128], targ[512];
171
char *cmnd, *res, *targ;
172
char *frm="make IRunArchInfo_%s MYFLAGS=\"-m64 -DATL_OS_%s -DATL_%s\" args=\"%s\" %s | fgrep '%s'";
145
174
enum ASMDIA asmd;
149
178
asmd = (asmd0 > ASM_None && asmd0 < NASMD) ? asmd0 : gas_x86_32;
150
179
OS = (OS0 > OSOther && OS0 < NOS) ? OS0 : OSLinux;
152
strlowcpy(osname, osnam[OSFreeBSD]);
154
strlowcpy(osname, osnam[OS]);
180
i = (OS == OSOSX) ? OSFreeBSD : OS;
181
assert(strlen(osnam[i]) < 128);
182
strlowcpy(osname, osnam[i]);
185
i = strlen(targ0) + 24;
186
targ = malloc(sizeof(char)*i);
156
188
sprintf(targ, "atlrun=atlas_runX targ=%s", targ0);
192
targ = malloc(sizeof(char));
160
198
* Try OS-specific probe, compiling with -m64 (assumes gcc workalike)
162
sprintf(cmnd, "make IRunArchInfo_%s MYFLAGS=\"-m64 -DATL_OS_%s -DATL_%s\" args=\"%s\" %s | fgrep '%s'",
163
osname, osnam[OS], ASMNAM[asmd], flag, targ, find);
164
if (!CmndOneLine(NULL, cmnd, res))
200
i = 1 + strlen(frm) + strlen(osnam) + strlen(osnam[OS]) +
201
strlen(ASMNAM[asmd]) + strlen(flag) + strlen(targ) + strlen(find);
202
cmnd = malloc(i*sizeof(char));
204
sprintf(cmnd, frm, osname, osnam[OS], ASMNAM[asmd], flag, targ, find);
206
res = atlsys_1L(NULL, cmnd, 0, 0);
166
210
iret = GetFirstInt(res);
167
211
*sure = GetLastInt(res);
172
main(int nargs, char **args)
217
int main(int nargs, char **args)
174
219
int flags, CacheLevel, osname[128], sure, bits, i, j;