add missing scconfig files

This commit is contained in:
Stefan Frederik 2021-04-18 13:55:57 +02:00
parent 33280beb9c
commit 7d65c5e3fd
3 changed files with 200 additions and 0 deletions

View File

@ -0,0 +1,50 @@
/*
scconfig - mujs lib detection
Copyright (C) 2021 Tibor Palinkas
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Project page: http://repo.hu/projects/scconfig
Contact via email: scconfig [at] igor2.repo.hu
*/
#include "scripts.h"
#include <unistd.h>
int find_script_mujs(const char *name, int logdepth, int fatal)
{
char *test_c =
NL "#include <stdio.h>"
NL "#include <mujs.h>"
NL "int main() {"
NL " js_State *J = js_newstate(NULL, NULL, JS_STRICT);\n"
NL " if (J != NULL)"
NL " puts(\"OK\");"
NL " return 0;"
NL "}"
NL;
require("cc/cc", logdepth, fatal);
report("Checking for mujs... ");
logprintf(logdepth, "find_mujs: trying to find mujs...\n");
logdepth++;
/* Look at the standard place */
if (try_icl(logdepth, "libs/script/mujs", test_c, NULL, NULL, "-lmujs -lm")) return 0;
return try_fail(logdepth, "libs/script/mujs");
}

View File

@ -0,0 +1,49 @@
/*
scconfig - picol detection
Copyright (C) 2021 Tibor Palinkas
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Project page: http://repo.hu/projects/scconfig
Contact via email: scconfig [at] igor2.repo.hu
*/
#include "scripts.h"
#include <unistd.h>
int find_script_picol(const char *name, int logdepth, int fatal)
{
char *test_c =
NL "#define PICOL_IMPLEMENTATION"
NL "#include \"picol.h\""
NL "int main() {"
NL " picolInterp *interp = picolCreateInterp();"
NL " picolEval(interp, \"puts {OK}\");"
NL " picolFreeInterp(interp);"
NL " return 0;"
NL "}"
NL;
require("cc/cc", logdepth, fatal);
report("Checking for picol... ");
logprintf(logdepth, "find_picol: trying to find picol...\n");
logdepth++;
/* Look at the standard places: /usr/include and /usr/local/include and whatever the C compiler sees fit */
if (try_icl(logdepth, "libs/script/picol", test_c, NULL, NULL, "")) return 0;
return try_fail(logdepth, "libs/script/picol");
}

View File

@ -0,0 +1,101 @@
/*
scconfig - welltype lib detection
Copyright (C) 2021 Tibor Palinkas
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Project page: http://repo.hu/projects/scconfig
Contact via email: scconfig [at] igor2.repo.hu
*/
#include "scripts.h"
#include <unistd.h>
#define SAVE_VER(name) \
next = ver; \
while(*next != ' ') next++; \
*next = '\0'; \
put("libs/script/welltype/ver/" name, ver); \
ver = next + 1; \
while(*ver == ' ') ver++;
static int accept_wt_res(char *ver)
{
char *next;
if (!strncmp(ver, "OK ", 3) == 0)
return 0;
ver += 3;
SAVE_VER("compacted");
SAVE_VER("major");
SAVE_VER("minor");
SAVE_VER("build");
SAVE_VER("revsn");
return 1;
}
int find_script_welltype(const char *name, int logdepth, int fatal)
{
/* The test script compares runtime lib version to compile time header
version and accepts proposed compilation flags only if they match */
char *test_c =
NL "#include <stdio.h>"
NL "#include <wtruntime/version.h>"
NL "int main() {"
NL " wt_u32 ver = wtrGetSuiteVersion();"
NL " if (ver == WTR_VERSION)"
NL " printf(\"OK %lu %d %d %d %d \", ver, WT_GETMAJOR(ver), WT_GETMINOR(ver), WT_GETBUILD(ver), WT_GETREVSN(ver));"
NL " return 0;"
NL "}"
NL;
require("cc/cc", logdepth, fatal);
report("Checking for welltype... ");
logprintf(logdepth, "find_welltype: trying to find welltype...\n");
logdepth++;
/* Look at some standard places */
if (try_icl_(logdepth, "libs/script/welltype", test_c, NULL, NULL, "-lwtruntime", 1, accept_wt_res)) return 0;
return try_fail(logdepth, "libs/script/welltype");
}
int find_script_wtc(const char *name, int logdepth, int fatal)
{
char cmd[] = "wtc --version";
char *out = NULL;
int ret = 1;
report("Checking for welltype wtc... ");
logprintf(logdepth, "find_welltype wtc: trying to find welltype wtc...\n");
logdepth++;
run_shell(logdepth, cmd, &out);
if ((out != NULL) && (strncmp(out, "Welltype compiler v", 19) == 0)) {
put("libs/script/welltype/wtc/presents", strue);
put("libs/script/welltype/wtc/cmd", "wtc");
report("OK (wtc)\n");
ret = 0;
}
else
report("not found\n");
free(out);
return ret;
}