source: psi/trunk/qcm/ghbnr.qcm@ 59

Last change on this file since 59 was 2, checked in by dmik, 19 years ago

Imported original Psi 0.10 sources from Affinix

File size: 810 bytes
Line 
1/*
2-----BEGIN QCMOD-----
3name: gethostbyname_r()
4-----END QCMOD-----
5*/
6class qc_ghbnr : public ConfObj
7{
8public:
9 qc_ghbnr(Conf *c) : ConfObj(c)
10 {
11 }
12
13 ~qc_ghbnr()
14 {
15 remove("ftest.c");
16 remove("ftest");
17 }
18
19 QString name() const { return "gethostbyname_r()"; }
20 QString shortname() const { return "ghbnr"; }
21
22 bool exec()
23 {
24 char *fdata =
25 "#include<netdb.h>\n"
26 "\n"
27 "int main()\n"
28 "{\n"
29 " gethostbyname_r(\"\", 0, 0, 0, 0, 0);\n"
30 " return 0;\n"
31 "}\n";
32
33 FILE *f;
34 f = fopen("ftest.c", "w");
35 if(!f)
36 return false;
37 fwrite(fdata, strlen(fdata), 1, f);
38 fclose(f);
39
40 QString str = conf->qvar("QMAKE_CC") + " ftest.c -o ftest";
41 int r = conf->doCommand(str);
42 if(r == 0) {
43 conf->addDefine("HAVE_GETHOSTBYNAME_R");
44 return true;
45 }
46 else
47 return false;
48 }
49};
Note: See TracBrowser for help on using the repository browser.