add missing scconfig/src/tty/ dir
This commit is contained in:
parent
9c750b5044
commit
cb2eddfc81
|
|
@ -0,0 +1,2 @@
|
|||
deps_tty_init();
|
||||
|
||||
|
|
@ -0,0 +1 @@
|
|||
void deps_tty_init();
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
TTY_CFLAGS = -DPLUGIN_TTY
|
||||
TTY_OBJS = \
|
||||
$(BIN)/tty/find_ncurses.o \
|
||||
$(BIN)/tty/find_slang.o \
|
||||
$(BIN)/tty/find_gpm.o \
|
||||
$(BIN)/tty/find_pty.o \
|
||||
$(BIN)/tty/find_ioctl.o \
|
||||
$(BIN)/tty/find_term.o \
|
||||
$(BIN)/tty/find_readline.o \
|
||||
$(BIN)/tty/tty.o
|
||||
|
||||
$(BIN)/tty/find_ncurses.o: $(SRC)/tty/find_ncurses.c
|
||||
$(CC) $(CFLAGS) -c $(SRC)/tty/find_ncurses.c -o $(BIN)/tty/find_ncurses.o
|
||||
|
||||
$(BIN)/tty/find_slang.o: $(SRC)/tty/find_slang.c
|
||||
$(CC) $(CFLAGS) -c $(SRC)/tty/find_slang.c -o $(BIN)/tty/find_slang.o
|
||||
|
||||
$(BIN)/tty/tty.o: $(SRC)/tty/tty.c
|
||||
$(CC) $(CFLAGS) -c $(SRC)/tty/tty.c -o $(BIN)/tty/tty.o
|
||||
|
||||
$(BIN)/tty/find_gpm.o: $(SRC)/tty/find_gpm.c
|
||||
$(CC) $(CFLAGS) -c $(SRC)/tty/find_gpm.c -o $(BIN)/tty/find_gpm.o
|
||||
|
||||
$(BIN)/tty/find_pty.o: $(SRC)/tty/find_pty.c
|
||||
$(CC) $(CFLAGS) -c $(SRC)/tty/find_pty.c -o $(BIN)/tty/find_pty.o
|
||||
|
||||
$(BIN)/tty/find_ioctl.o: $(SRC)/tty/find_ioctl.c
|
||||
$(CC) $(CFLAGS) -c $(SRC)/tty/find_ioctl.c -o $(BIN)/tty/find_ioctl.o
|
||||
|
||||
$(BIN)/tty/find_term.o: $(SRC)/tty/find_term.c
|
||||
$(CC) $(CFLAGS) -c $(SRC)/tty/find_term.c -o $(BIN)/tty/find_term.o
|
||||
|
||||
$(BIN)/tty/find_readline.o: $(SRC)/tty/find_readline.c
|
||||
$(CC) $(CFLAGS) -c $(SRC)/tty/find_readline.c -o $(BIN)/tty/find_readline.o
|
||||
|
||||
|
|
@ -0,0 +1,86 @@
|
|||
/*
|
||||
scconfig - tty lib detection - ncurses
|
||||
Copyright (C) 2017 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 (email and IRC): http://igor2.repo.hu/contact.html
|
||||
*/
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
#include "libs.h"
|
||||
#include "log.h"
|
||||
#include "db.h"
|
||||
#include "dep.h"
|
||||
|
||||
int find_gpm(const char *name, int logdepth, int fatal)
|
||||
{
|
||||
const char *node = "libs/tty/gpm";
|
||||
const char *test_c =
|
||||
NL "#include <stdio.h>"
|
||||
NL "int main()"
|
||||
NL "{"
|
||||
NL " Gpm_Connect conn;"
|
||||
NL " conn.eventMask = ~GPM_MOVE;"
|
||||
NL " conn.defaultMask = GPM_MOVE;"
|
||||
NL " conn.minMod = conn.maxMod = 0;"
|
||||
NL " Gpm_Open(&conn, 0);"
|
||||
NL " puts(\"OK\");"
|
||||
NL " return 0;"
|
||||
NL "}"
|
||||
NL;
|
||||
if (require("cc/cc", logdepth, fatal))
|
||||
return 1;
|
||||
|
||||
report("Checking for gpm... ");
|
||||
logprintf(logdepth, "find_gpm:\n");
|
||||
logdepth++;
|
||||
|
||||
{
|
||||
char *cflags = NULL, *ldflags = NULL;
|
||||
/* rely on pkgconfig when available */
|
||||
if (run_pkg_config(logdepth, "gpm", &cflags, &ldflags) == 0) {
|
||||
if (try_icl(logdepth, node, test_c, "#include <gpm.h>", cflags, ldflags) != 0) {
|
||||
free(cflags);
|
||||
free(ldflags);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
free(cflags);
|
||||
free(ldflags);
|
||||
}
|
||||
|
||||
{
|
||||
char **incs, *incs_arr[] = {"#include <gpm.h>", NULL } ;
|
||||
char **cflags, *cflags_arr[] = {"", NULL};
|
||||
char **ldflags, *ldflags_arr[] = {"-lgpm", NULL};
|
||||
|
||||
/* fall back on guessing */
|
||||
for(incs = incs_arr; *incs != NULL; incs++) {
|
||||
for(cflags = cflags_arr; *cflags != NULL; cflags++) {
|
||||
for(ldflags = ldflags_arr; *ldflags != NULL; ldflags++) {
|
||||
if (try_icl(logdepth, node, test_c, *incs, *cflags, *ldflags) != 0) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return try_fail(logdepth, node);
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1 @@
|
|||
int find_gpm(const char *name, int logdepth, int fatal);
|
||||
|
|
@ -0,0 +1,78 @@
|
|||
/*
|
||||
scconfig - tty lib detection - termios
|
||||
Copyright (C) 2017 Tibor Palinkas
|
||||
Copyright (C) 2018 Aron Barath
|
||||
|
||||
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 (email and IRC): http://igor2.repo.hu/contact.html
|
||||
*/
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
#include "libs.h"
|
||||
#include "log.h"
|
||||
#include "db.h"
|
||||
#include "dep.h"
|
||||
|
||||
int find_tty_ioctl(const char *name, int logdepth, int fatal)
|
||||
{
|
||||
char node[128];
|
||||
char* nodeend;
|
||||
const char *test_c_template =
|
||||
NL "#include <stdio.h>"
|
||||
NL "int main()"
|
||||
NL "{"
|
||||
NL " %s buf;"
|
||||
NL " if (sizeof(buf) > 0 && %s > 0) {"
|
||||
NL " puts(\"OK\");"
|
||||
NL " return 0;"
|
||||
NL " }"
|
||||
NL " return 1;"
|
||||
NL "}"
|
||||
NL;
|
||||
char test_c[1024];
|
||||
const char **ioc, *ioctls[] = {"TIOCGWINSZ", "TCGETA", "TIOCGETP", NULL};
|
||||
const char **typ, *types[] = {"struct winsize", "struct termio", "struct sgttyb", NULL};
|
||||
const char **inc, *includes[] = {"#include <sys/ioctl.h>", "#include <termios.h>\n#include <sys/ioctl.h>", "#include <termio.h>\n#include <sys/ioctl.h>", NULL } ;
|
||||
|
||||
if (require("cc/cc", logdepth, fatal))
|
||||
return 1;
|
||||
|
||||
strcpy(node, "libs/tty/ioctl/");
|
||||
nodeend = node + strlen(node);
|
||||
|
||||
report("Checking for TTY ioctls...\n");
|
||||
logprintf(logdepth, "find_tty_ioctl:\n");
|
||||
logdepth++;
|
||||
|
||||
for(ioc = ioctls, typ = types; *ioc != NULL; ++ioc, ++typ) {
|
||||
report(" %s... ", *ioc);
|
||||
strcpy(nodeend, *ioc);
|
||||
sprintf(test_c, test_c_template, *typ, *ioc);
|
||||
for(inc = includes; *inc != NULL; ++inc) {
|
||||
if (try_icl(logdepth, node, test_c, *inc, NULL, NULL)) {
|
||||
goto next_ioc;
|
||||
}
|
||||
}
|
||||
strcat(nodeend, "/presents");
|
||||
put(node, sfalse);
|
||||
report("not found\n");
|
||||
next_ioc:;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -0,0 +1 @@
|
|||
int find_tty_ioctl(const char *name, int logdepth, int fatal);
|
||||
|
|
@ -0,0 +1,244 @@
|
|||
/*
|
||||
scconfig - tty lib detection - ncurses
|
||||
Copyright (C) 2017 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 (email and IRC): http://igor2.repo.hu/contact.html
|
||||
*/
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
#include "libs.h"
|
||||
#include "log.h"
|
||||
#include "db.h"
|
||||
#include "dep.h"
|
||||
|
||||
/* Need to look for a unique string because ncurses may write arbitrary
|
||||
terminal control sequences to stdout during initialization */
|
||||
|
||||
#define SAFE_OK "{{{scconfig:OK}}}"
|
||||
|
||||
int end_ok(char *stdout_str)
|
||||
{
|
||||
return (strstr(stdout_str, SAFE_OK) != NULL);
|
||||
}
|
||||
|
||||
static const char *nucrses_test_c =
|
||||
NL "#include <stdlib.h>"
|
||||
NL "#include <stdio.h>"
|
||||
NL "int main()"
|
||||
NL "{"
|
||||
NL " WINDOW *mainwin = initscr();"
|
||||
NL " endwin();"
|
||||
NL " if (mainwin != NULL)"
|
||||
NL " puts(\"" SAFE_OK "\");"
|
||||
NL " return 0;"
|
||||
NL "}"
|
||||
NL;
|
||||
|
||||
|
||||
int find_ncurses(const char *name, int logdepth, int fatal)
|
||||
{
|
||||
const char *node = "libs/tty/ncurses";
|
||||
const char *inc = "#include <curses.h>";
|
||||
|
||||
if (require("cc/cc", logdepth, fatal))
|
||||
return 1;
|
||||
|
||||
report("Checking for ncurses... ");
|
||||
logprintf(logdepth, "find_ncurses:\n");
|
||||
logdepth++;
|
||||
|
||||
{
|
||||
char *cflags = NULL, *ldflags = NULL;
|
||||
/* rely on pkgconfig when available */
|
||||
if (run_pkg_config(logdepth, "ncurses", &cflags, &ldflags) == 0) {
|
||||
if (try_icl_(logdepth, node, nucrses_test_c, inc, cflags, ldflags, 1, end_ok) != 0) {
|
||||
free(cflags);
|
||||
free(ldflags);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
free(cflags);
|
||||
free(ldflags);
|
||||
}
|
||||
|
||||
{
|
||||
char **cflags, *cflags_arr[] = {"", NULL};
|
||||
char **ldflags, *ldflags_arr[] = {"-lncurses", NULL};
|
||||
|
||||
/* fall back on guessing */
|
||||
for(cflags = cflags_arr; *cflags != NULL; cflags++) {
|
||||
for(ldflags = ldflags_arr; *ldflags != NULL; ldflags++) {
|
||||
if (try_icl_(logdepth, node, nucrses_test_c, inc, *cflags, *ldflags, 1, end_ok) != 0) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return try_fail(logdepth, node);
|
||||
}
|
||||
|
||||
int find_ncursesw(const char *name, int logdepth, int fatal)
|
||||
{
|
||||
const char *node = "libs/tty/ncursesw";
|
||||
const char *inc = "#include <ncursesw/curses.h>";
|
||||
|
||||
if (require("cc/cc", logdepth, fatal))
|
||||
return 1;
|
||||
|
||||
report("Checking for ncursesw... ");
|
||||
logprintf(logdepth, "find_ncursesw:\n");
|
||||
logdepth++;
|
||||
|
||||
{
|
||||
char *cflags = NULL, *ldflags = NULL;
|
||||
/* rely on pkgconfig when available */
|
||||
if (run_pkg_config(logdepth, "ncursesw", &cflags, &ldflags) == 0) {
|
||||
if (try_icl_(logdepth, node, nucrses_test_c, inc, cflags, ldflags, 1, end_ok) != 0) {
|
||||
free(cflags);
|
||||
free(ldflags);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
free(cflags);
|
||||
free(ldflags);
|
||||
}
|
||||
|
||||
{
|
||||
char **cflags, *cflags_arr[] = {"", NULL};
|
||||
char **ldflags, *ldflags_arr[] = {"-lncursesw", NULL};
|
||||
|
||||
/* fall back on guessing */
|
||||
for(cflags = cflags_arr; *cflags != NULL; cflags++) {
|
||||
for(ldflags = ldflags_arr; *ldflags != NULL; ldflags++) {
|
||||
if (try_icl_(logdepth, node, nucrses_test_c, inc, *cflags, *ldflags, 1, end_ok) != 0) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return try_fail(logdepth, node);
|
||||
}
|
||||
|
||||
|
||||
int find_ncurses_escdelay(const char *name, int logdepth, int fatal)
|
||||
{
|
||||
const char *node = "libs/tty/ncurses/escdelay";
|
||||
const char *test_c =
|
||||
NL "#include <stdlib.h>"
|
||||
NL "#include <stdio.h>"
|
||||
NL "int main()"
|
||||
NL "{"
|
||||
NL " if (ESCDELAY >= 0)"
|
||||
NL " puts(\"OK\");"
|
||||
NL " return 0;"
|
||||
NL "}"
|
||||
NL;
|
||||
|
||||
if (require("cc/cc", logdepth, fatal) || require("libs/tty/ncurses/presents", logdepth, fatal))
|
||||
return 1;
|
||||
|
||||
report("Checking for ncurses ESCDELAY... ");
|
||||
logprintf(logdepth, "find_ncurses ESCDELAY:\n");
|
||||
logdepth++;
|
||||
|
||||
if (try_icl(logdepth, node, test_c, get("libs/tty/ncurses/includes"), get("libs/tty/ncurses/cflags"), get("libs/tty/ncurses/ldflags")) != 0)
|
||||
return 0;
|
||||
|
||||
return try_fail(logdepth, node);
|
||||
}
|
||||
|
||||
|
||||
int find_ncurses_cur_term(const char *name, int logdepth, int fatal)
|
||||
{
|
||||
const char *node = "libs/tty/ncurses/cur_term";
|
||||
char *inc, *inc1;
|
||||
const char *test_c =
|
||||
NL "#include <stdlib.h>"
|
||||
NL "#include <stdio.h>"
|
||||
NL "int main()"
|
||||
NL "{"
|
||||
NL " if (&cur_term != NULL)"
|
||||
NL " puts(\"OK\");"
|
||||
NL " return 0;"
|
||||
NL "}"
|
||||
NL;
|
||||
|
||||
if (require("cc/cc", logdepth, fatal) || require("libs/tty/ncurses/presents", logdepth, fatal))
|
||||
return 1;
|
||||
|
||||
report("Checking for ncurses cur_term... ");
|
||||
logprintf(logdepth, "find_ncurses cur_term:\n");
|
||||
logdepth++;
|
||||
|
||||
if (try_icl(logdepth, node, test_c, get("libs/tty/ncurses/includes"), get("libs/tty/ncurses/cflags"), get("libs/tty/ncurses/ldflags")) != 0)
|
||||
return 0;
|
||||
|
||||
inc1 = str_subsn(get("libs/tty/ncurses/includes"));
|
||||
|
||||
inc = str_concat("\n", inc1, "#include <ncurses/term.h>", NULL);
|
||||
if (try_icl(logdepth, node, test_c, inc, get("libs/tty/ncurses/cflags"), get("libs/tty/ncurses/ldflags")) != 0) {
|
||||
free(inc);
|
||||
free(inc1);
|
||||
return 0;
|
||||
}
|
||||
free(inc);
|
||||
|
||||
inc = str_concat("\n", inc1, "#include <term.h>", NULL);
|
||||
if (try_icl(logdepth, node, test_c, inc, get("libs/tty/ncurses/cflags"), get("libs/tty/ncurses/ldflags")) != 0) {
|
||||
free(inc);
|
||||
free(inc1);
|
||||
return 0;
|
||||
}
|
||||
free(inc);
|
||||
|
||||
free(inc1);
|
||||
return try_fail(logdepth, node);
|
||||
}
|
||||
|
||||
|
||||
int find_ncurses_resizeterm(const char *name, int logdepth, int fatal)
|
||||
{
|
||||
const char *node = "libs/tty/ncurses/resizeterm";
|
||||
const char *test_c =
|
||||
NL "#include <stdlib.h>"
|
||||
NL "#include <stdio.h>"
|
||||
NL "int main()"
|
||||
NL "{"
|
||||
NL " if (0) resizeterm(80, 25);"
|
||||
NL " if (resizeterm != NULL)"
|
||||
NL " puts(\"OK\");"
|
||||
NL " return 0;"
|
||||
NL "}"
|
||||
NL;
|
||||
|
||||
if (require("cc/cc", logdepth, fatal) || require("libs/tty/ncurses/presents", logdepth, fatal))
|
||||
return 1;
|
||||
|
||||
report("Checking for ncurses resizeterm... ");
|
||||
logprintf(logdepth, "find_ncurses resizeterm:\n");
|
||||
logdepth++;
|
||||
|
||||
if (try_icl(logdepth, node, test_c, get("libs/tty/ncurses/includes"), get("libs/tty/ncurses/cflags"), get("libs/tty/ncurses/ldflags")) != 0)
|
||||
return 0;
|
||||
|
||||
return try_fail(logdepth, node);
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
int find_ncurses(const char *name, int logdepth, int fatal);
|
||||
int find_ncursesw(const char *name, int logdepth, int fatal);
|
||||
int find_ncurses_escdelay(const char *name, int logdepth, int fatal);
|
||||
int find_ncurses_cur_term(const char *name, int logdepth, int fatal);
|
||||
int find_ncurses_resizeterm(const char *name, int logdepth, int fatal);
|
||||
|
|
@ -0,0 +1,110 @@
|
|||
/*
|
||||
scconfig - tty lib detection - ncurses
|
||||
Copyright (C) 2017 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 (email and IRC): http://igor2.repo.hu/contact.html
|
||||
*/
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
#include "libs.h"
|
||||
#include "log.h"
|
||||
#include "db.h"
|
||||
#include "dep.h"
|
||||
|
||||
int find_grantpt(const char *name, int logdepth, int fatal)
|
||||
{
|
||||
const char *node = "libs/tty/grantpt";
|
||||
const char *test_c =
|
||||
NL "#include <stdio.h>"
|
||||
NL "int main()"
|
||||
NL "{"
|
||||
NL " if (grantpt(-1) == -1)"
|
||||
NL " puts(\"OK\");"
|
||||
NL " return 0;"
|
||||
NL "}"
|
||||
NL;
|
||||
if (require("cc/cc", logdepth, fatal))
|
||||
return 1;
|
||||
|
||||
report("Checking for grantpt... ");
|
||||
logprintf(logdepth, "find_grantpt:\n");
|
||||
logdepth++;
|
||||
|
||||
{
|
||||
char **incs, *incs_arr[] = {"#include <stdlib.h>", NULL } ;
|
||||
char **cflags, *cflags_arr[] = {"", NULL};
|
||||
char **ldflags, *ldflags_arr[] = {"", NULL};
|
||||
|
||||
/* fall back on guessing */
|
||||
for(incs = incs_arr; *incs != NULL; incs++) {
|
||||
for(cflags = cflags_arr; *cflags != NULL; cflags++) {
|
||||
for(ldflags = ldflags_arr; *ldflags != NULL; ldflags++) {
|
||||
if (try_icl(logdepth, node, test_c, *incs, *cflags, *ldflags) != 0) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return try_fail(logdepth, node);
|
||||
}
|
||||
|
||||
|
||||
int find_posix_openpt(const char *name, int logdepth, int fatal)
|
||||
{
|
||||
const char *node = "libs/tty/posix_openpt";
|
||||
const char *test_c =
|
||||
NL "#include <stdlib.h>"
|
||||
NL "#include <fcntl.h>"
|
||||
NL "#include <stdio.h>"
|
||||
NL "int main()"
|
||||
NL "{"
|
||||
NL " if (posix_openpt(0) >= 0)"
|
||||
NL " puts(\"OK\");"
|
||||
NL " return 0;"
|
||||
NL "}"
|
||||
NL;
|
||||
if (require("cc/cc", logdepth, fatal))
|
||||
return 1;
|
||||
|
||||
report("Checking for posix_openpt... ");
|
||||
logprintf(logdepth, "find_posix_openpt:\n");
|
||||
logdepth++;
|
||||
|
||||
{
|
||||
char **incs, *incs_arr[] = {"", "#define _XOPEN_SOURCE 600", NULL } ;
|
||||
char **cflags, *cflags_arr[] = {"", NULL};
|
||||
char **ldflags, *ldflags_arr[] = {"", NULL};
|
||||
|
||||
/* fall back on guessing */
|
||||
for(incs = incs_arr; *incs != NULL; incs++) {
|
||||
for(cflags = cflags_arr; *cflags != NULL; cflags++) {
|
||||
for(ldflags = ldflags_arr; *ldflags != NULL; ldflags++) {
|
||||
if (try_icl(logdepth, node, test_c, *incs, *cflags, *ldflags) != 0) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return try_fail(logdepth, node);
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
int find_grantpt(const char *name, int logdepth, int fatal);
|
||||
int find_posix_openpt(const char *name, int logdepth, int fatal);
|
||||
|
|
@ -0,0 +1,107 @@
|
|||
/*
|
||||
scconfig - tty lib detection - readline
|
||||
Copyright (C) 2017 Tibor Palinkas
|
||||
Copyright (C) 2018 Aron Barath
|
||||
|
||||
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 (email and IRC): http://igor2.repo.hu/contact.html
|
||||
*/
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
#include "libs.h"
|
||||
#include "log.h"
|
||||
#include "db.h"
|
||||
#include "dep.h"
|
||||
|
||||
int find_tty_readline(const char *name, int logdepth, int fatal)
|
||||
{
|
||||
const char *node = "libs/tty/readline";
|
||||
const char *test_c =
|
||||
NL "int my_puts(const char* s);"
|
||||
NL "int main()"
|
||||
NL "{"
|
||||
NL " if (rl_set_prompt(\"x\") == 0)"
|
||||
NL " my_puts(\"OK\");"
|
||||
NL " return 0;"
|
||||
NL "}"
|
||||
NL "#include <stdio.h>"
|
||||
NL "int my_puts(const char* s) {"
|
||||
NL " puts(s);"
|
||||
NL "}"
|
||||
NL;
|
||||
const char **ldflag, *ldflags[] = {"-lreadline", NULL };
|
||||
const char **inc, *includes[] = {"#include <readline/readline.h>", "#include <stdio.h>\n#include <readline/readline.h>", NULL };
|
||||
|
||||
if (require("cc/cc", logdepth, fatal))
|
||||
return try_fail(logdepth, node);
|
||||
|
||||
report("Checking for readline library... ");
|
||||
logprintf(logdepth, "find_tty_readline: check for readline library\n");
|
||||
logdepth++;
|
||||
|
||||
for(ldflag = ldflags; *ldflag != NULL; ++ldflag) {
|
||||
for(inc = includes; *inc != NULL; ++inc) {
|
||||
if (try_icl(logdepth, node, test_c, *inc, NULL, *ldflag)) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return try_fail(logdepth, node);
|
||||
}
|
||||
|
||||
int find_tty_history(const char *name, int logdepth, int fatal)
|
||||
{
|
||||
const char *node = "libs/tty/history";
|
||||
const char *test_c =
|
||||
NL "int my_puts(const char* s);"
|
||||
NL "int main()"
|
||||
NL "{"
|
||||
NL " HIST_ENTRY **list;"
|
||||
NL " using_history();"
|
||||
NL " add_history(\"thing\");"
|
||||
NL " list = history_list();"
|
||||
NL " if (list != NULL && (*list) != NULL)"
|
||||
NL " my_puts(\"OK\");"
|
||||
NL " return 0;"
|
||||
NL "}"
|
||||
NL "#include <stdio.h>"
|
||||
NL "int my_puts(const char* s) {"
|
||||
NL " puts(s);"
|
||||
NL "}"
|
||||
NL;
|
||||
const char **ldflag, *ldflags[] = {"-lhistory", NULL };
|
||||
const char **inc, *includes[] = {"#include <readline/history.h>", "#include <stdio.h>\n#include <readline/history.h>", NULL };
|
||||
|
||||
if (require("cc/cc", logdepth, fatal))
|
||||
return try_fail(logdepth, node);
|
||||
|
||||
report("Checking for history library... ");
|
||||
logprintf(logdepth, "find_tty_history: check for history library\n");
|
||||
logdepth++;
|
||||
|
||||
for(ldflag = ldflags; *ldflag != NULL; ++ldflag) {
|
||||
for(inc = includes; *inc != NULL; ++inc) {
|
||||
if (try_icl(logdepth, node, test_c, *inc, NULL, *ldflag)) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return try_fail(logdepth, node);
|
||||
}
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
int find_tty_readline(const char *name, int logdepth, int fatal);
|
||||
int find_tty_history(const char *name, int logdepth, int fatal);
|
||||
|
|
@ -0,0 +1,87 @@
|
|||
/*
|
||||
scconfig - tty lib detection - slang
|
||||
Copyright (C) 2017 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 (email and IRC): http://igor2.repo.hu/contact.html
|
||||
*/
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
#include "libs.h"
|
||||
#include "log.h"
|
||||
#include "db.h"
|
||||
#include "dep.h"
|
||||
|
||||
int find_slang(const char *name, int logdepth, int fatal)
|
||||
{
|
||||
const char *node = "libs/tty/slang";
|
||||
const char *test_c =
|
||||
NL "#include <stdio.h>"
|
||||
NL "#include <slang.h>"
|
||||
NL "int main()"
|
||||
NL "{"
|
||||
NL " if (SLtt_initialize(\"this should not work\") == 0)"
|
||||
NL " puts(\"SLtt_initialize() does not fail on invalid term string\");"
|
||||
NL " else if (SLtt_initialize(\"vt100\") != 0)"
|
||||
NL " puts(\"SLtt_initialize() fails to init on vt100\");"
|
||||
NL " else"
|
||||
NL " puts(\"OK\");"
|
||||
NL " return 0;"
|
||||
NL "}"
|
||||
NL;
|
||||
if (require("cc/cc", logdepth, fatal))
|
||||
return 1;
|
||||
|
||||
report("Checking for slang... ");
|
||||
logprintf(logdepth, "find_slang:\n");
|
||||
logdepth++;
|
||||
|
||||
{
|
||||
char *cflags = NULL, *ldflags = NULL;
|
||||
/* rely on pkgconfig when available */
|
||||
if (run_pkg_config(logdepth, "slang", &cflags, &ldflags) == 0) {
|
||||
if (try_icl(logdepth, node, test_c, "#include <slang.h>", cflags, ldflags) != 0) {
|
||||
free(cflags);
|
||||
free(ldflags);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
free(cflags);
|
||||
free(ldflags);
|
||||
}
|
||||
|
||||
{
|
||||
char **incs, *incs_arr[] = {"#include <slang.h>", "#include <slang/slang.h>", NULL } ;
|
||||
char **cflags, *cflags_arr[] = {"", NULL};
|
||||
char **ldflags, *ldflags_arr[] = {"-lslang", NULL};
|
||||
|
||||
/* fall back on guessing */
|
||||
for(incs = incs_arr; *incs != NULL; incs++) {
|
||||
for(cflags = cflags_arr; *cflags != NULL; cflags++) {
|
||||
for(ldflags = ldflags_arr; *ldflags != NULL; ldflags++) {
|
||||
if (try_icl(logdepth, node, test_c, *incs, *cflags, *ldflags) != 0) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return try_fail(logdepth, node);
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1 @@
|
|||
int find_slang(const char *name, int logdepth, int fatal);
|
||||
|
|
@ -0,0 +1,101 @@
|
|||
/*
|
||||
scconfig - tty lib detection - terminal related functionality
|
||||
Copyright (C) 2017 Tibor Palinkas
|
||||
Copyright (C) 2018 Aron Barath
|
||||
|
||||
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 (email and IRC): http://igor2.repo.hu/contact.html
|
||||
*/
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
#include "libs.h"
|
||||
#include "log.h"
|
||||
#include "db.h"
|
||||
#include "dep.h"
|
||||
|
||||
int find_tty_cfmakeraw(const char *name, int logdepth, int fatal)
|
||||
{
|
||||
const char *key = "libs/tty/cfmakeraw";
|
||||
const char *test_c =
|
||||
NL "#include <stdio.h>"
|
||||
NL "int main()"
|
||||
NL "{"
|
||||
NL " struct termios t;"
|
||||
NL no_implicit(void, "cfmakeraw", "cfmakeraw")
|
||||
NL " cfmakeraw(&t);"
|
||||
NL " puts(\"OK\");"
|
||||
NL " return 0;"
|
||||
NL "}"
|
||||
NL;
|
||||
const char **inc;
|
||||
const char *incs[] = {
|
||||
"#include <termios.h>",
|
||||
"#include <termios.h>\n#include <unistd.h>",
|
||||
"#define _DEFAULT_SOURCE\n#define _BSD_SOURCE\n#include <termios.h>",
|
||||
"#define _DEFAULT_SOURCE\n#define _BSD_SOURCE\n#include <termios.h>\n#include <unistd.h>",
|
||||
NULL
|
||||
};
|
||||
|
||||
require("cc/cc", logdepth, fatal);
|
||||
|
||||
report("Checking for cfmakeraw()... ");
|
||||
logprintf(logdepth, "find_tty_cfmakeraw: trying to find cfmakeraw()...\n");
|
||||
logdepth++;
|
||||
|
||||
for (inc = incs; *inc != NULL; ++inc )
|
||||
if (try_icl(logdepth, key, test_c, *inc, NULL, NULL))
|
||||
return 0;
|
||||
|
||||
return try_fail(logdepth, key);
|
||||
}
|
||||
|
||||
int find_tty_cfsetspeed(const char *name, int logdepth, int fatal)
|
||||
{
|
||||
const char *key = "libs/tty/cfsetspeed";
|
||||
const char *test_c =
|
||||
NL "#include <stdio.h>"
|
||||
NL "int main()"
|
||||
NL "{"
|
||||
NL " struct termios t;"
|
||||
NL no_implicit(int, "cfsetspeed", "cfsetspeed")
|
||||
NL " if (cfsetspeed(&t, B9600) == 0)"
|
||||
NL " puts(\"OK\");"
|
||||
NL " return 0;"
|
||||
NL "}"
|
||||
NL;
|
||||
const char **inc;
|
||||
const char *incs[] = {
|
||||
"#include <termios.h>",
|
||||
"#include <termios.h>\n#include <unistd.h>",
|
||||
"#define _DEFAULT_SOURCE\n#define _BSD_SOURCE\n#include <termios.h>",
|
||||
"#define _DEFAULT_SOURCE\n#define _BSD_SOURCE\n#include <termios.h>\n#include <unistd.h>",
|
||||
NULL
|
||||
};
|
||||
|
||||
require("cc/cc", logdepth, fatal);
|
||||
|
||||
report("Checking for cfsetspeed()... ");
|
||||
logprintf(logdepth, "find_tty_cfsetspeed: trying to find cfsetspeed()...\n");
|
||||
logdepth++;
|
||||
|
||||
for (inc = incs; *inc != NULL; ++inc )
|
||||
if (try_icl(logdepth, key, test_c, *inc, NULL, NULL))
|
||||
return 0;
|
||||
|
||||
return try_fail(logdepth, key);
|
||||
}
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
int find_tty_cfmakeraw(const char *name, int logdepth, int fatal);
|
||||
int find_tty_cfsetspeed(const char *name, int logdepth, int fatal);
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
#include "libs.h"
|
||||
#include "log.h"
|
||||
#include "db.h"
|
||||
#include "dep.h"
|
||||
|
||||
#include "find_ncurses.h"
|
||||
#include "find_slang.h"
|
||||
#include "find_gpm.h"
|
||||
#include "find_pty.h"
|
||||
#include "find_ioctl.h"
|
||||
#include "find_term.h"
|
||||
#include "find_readline.h"
|
||||
|
||||
void deps_tty_init()
|
||||
{
|
||||
dep_add("libs/tty/slang/*", find_slang);
|
||||
|
||||
dep_add("libs/tty/gpm/*", find_gpm);
|
||||
|
||||
dep_add("libs/tty/grantpt/*", find_grantpt);
|
||||
dep_add("libs/tty/posix_openpt/*", find_posix_openpt);
|
||||
|
||||
dep_add("libs/tty/ncurses/escdelay/*", find_ncurses_escdelay);
|
||||
dep_add("libs/tty/ncurses/cur_term/*", find_ncurses_cur_term);
|
||||
dep_add("libs/tty/ncurses/resizeterm/*",find_ncurses_resizeterm);
|
||||
dep_add("libs/tty/ncurses/*", find_ncurses);
|
||||
dep_add("libs/tty/ncursesw/*", find_ncursesw);
|
||||
|
||||
dep_add("libs/tty/ioctl/*", find_tty_ioctl);
|
||||
|
||||
dep_add("libs/tty/cfmakeraw/*", find_tty_cfmakeraw);
|
||||
dep_add("libs/tty/cfsetspeed/*", find_tty_cfsetspeed);
|
||||
|
||||
dep_add("libs/tty/readline/*", find_tty_readline);
|
||||
dep_add("libs/tty/history/*", find_tty_history);
|
||||
}
|
||||
Loading…
Reference in New Issue