Skip to content

Commit

Permalink
freebsd support (#2)
Browse files Browse the repository at this point in the history
* cmake support

* cmake support

* fix cmake

* freebsd fix

* freebsd fix

* freebsd fix
  • Loading branch information
askovpen authored Jan 8, 2020
1 parent 1b31ce4 commit d906c0d
Show file tree
Hide file tree
Showing 7 changed files with 145 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ Makefile
Makefile.in
aclocal.m4
autom4te.cache
compile
configure
config.cache
config.h
Expand Down
65 changes: 65 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
cmake_minimum_required(VERSION 2.8.6)

project (qico C)

include(CheckTypeSize)
include(CheckIncludeFiles)
include(CheckIncludeFile)
include(CheckSymbolExists)

include_directories(
${CMAKE_CURRENT_BINARY_DIR}
"src"
)

CHECK_TYPE_SIZE(char SIZEOF_CHAR)
CHECK_TYPE_SIZE(short SIZEOF_SHORT)
CHECK_TYPE_SIZE(int SIZEOF_INT)
CHECK_TYPE_SIZE(long SIZEOF_LONG)

CHECK_INCLUDE_FILES("stdarg.h;stdlib.h;stddef.h;string.h" STDC_HEADERS)
CHECK_INCLUDE_FILE("sys/types.h" HAVE_SYS_TYPES_H)
CHECK_INCLUDE_FILE("sys/time.h" HAVE_SYS_TIME_H)
CHECK_INCLUDE_FILE("stdlib.h" HAVE_STDLIB_H)
CHECK_INCLUDE_FILE("errno.h" HAVE_ERRNO_H)
CHECK_INCLUDE_FILE("netinet/in.h" HAVE_NETINET_IN_H)
CHECK_INCLUDE_FILE("netdb.h" HAVE_NETDB_H)
CHECK_INCLUDE_FILE("fcntl.h" HAVE_FCNTL_H)
CHECK_INCLUDE_FILE("utime.h" HAVE_UTIME_H)
CHECK_INCLUDE_FILE("syslog.h" HAVE_SYSLOG_H)
CHECK_INCLUDE_FILE("termios.h" HAVE_TERMIOS_H)
CHECK_INCLUDE_FILE("termio.h" HAVE_TERMIO_H)
CHECK_INCLUDE_FILE("unistd.h" HAVE_UNISTD_H)
CHECK_INCLUDE_FILE("dirent.h" HAVE_DIRENT_H)
CHECK_INCLUDE_FILE("sys/socket.h" HAVE_SYS_SOCKET_H)
check_include_file (sys/time.h HAVE_SYS_TIME_H)
check_include_file (time.h HAVE_TIME_H)
check_include_file (ncurses.h HAVE_NCURSES_H)
CHECK_INCLUDE_FILES("sys/time.h;time.h" TIME_WITH_SYS_TIME)
check_include_file (sys/stat.h HAVE_SYS_STAT_H)
check_include_file (arpa/inet.h HAVE_ARPA_INET_H)

check_symbol_exists(mvvline ncurses.h CURS_HAVE_MVVLINE)

set(DEFAULT_SPEED 9600 CACHE STRING "default modem speed" FORCE)
set(TCP_SPEED 115200 CACHE STRING "tcp speed" FORCE)
set(MAX_STRING 512 CACHE STRING "Maximum length of standard string" FORCE)
set(MAX_NODELIST 32 CACHE STRING "Maximum length of nodelist" FORCE)
set(CONFIG "/etc/qico.conf" CACHE STRING "specifies config filename" FORCE)
set(HAVE_SYSLOG_FAC_NAMES 1 CACHE STRING "have facility names" FORCE)
set(HAVE_SYSLOG_PRI_NAMES 1 CACHE STRING "have priority names" FORCE)
set(PACKAGE_NAME ${CMAKE_PROJECT_NAME})
set(PACKAGE_VERSION 0.59.2)

set (CURSES_NEED_WIDE TRUE)
include(FindCurses)
include(FindPerlLibs)
if (${PERLLIBS_FOUND})
set(WITH_PERL 1)
include_directories(${PERL_INCLUDE_PATH})
endif (${PERLLIBS_FOUND})
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.cmake.h ${CMAKE_CURRENT_BINARY_DIR}/config.h)

add_subdirectory(src)
#add_subdirectory(tests)

43 changes: 43 additions & 0 deletions config.cmake.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#cmakedefine SIZEOF_CHAR @SIZEOF_CHAR@
#cmakedefine SIZEOF_SHORT @SIZEOF_SHORT@
#cmakedefine SIZEOF_INT @SIZEOF_INT@
#cmakedefine SIZEOF_LONG @SIZEOF_LONG@

#define RETSIGTYPE void
#define WITH_BINKP 1

#cmakedefine STDC_HEADERS @STDC_HEADERS@
#cmakedefine HAVE_SYS_TYPES_H @HAVE_SYS_TYPES_H@
#cmakedefine HAVE_SYS_TIME_H @HAVE_SYS_TIME_H@
#cmakedefine HAVE_STDLIB_H @HAVE_STDLIB_H@
#cmakedefine HAVE_SYS_SOCKET_H @HAVE_SYS_SOCKET_H@
#cmakedefine HAVE_ERRNO_H @HAVE_ERRNO_H@
#cmakedefine HAVE_NETINET_IN_H @HAVE_NETINET_IN_H@
#cmakedefine HAVE_NETDB_H @HAVE_NETDB_H@
#cmakedefine HAVE_FCNTL_H @HAVE_FCNTL_H@
#cmakedefine HAVE_UTIME_H @HAVE_UTIME_H@
#cmakedefine HAVE_SYSLOG_H @HAVE_SYSLOG_H@
#cmakedefine HAVE_TERMIOS_H @HAVE_TERMIOS_H@
#cmakedefine HAVE_TERMIO_H @HAVE_TERMIO_H@
#cmakedefine HAVE_UNISTD_H @HAVE_UNISTD_H@
#cmakedefine HAVE_DIRENT_H @HAVE_DIRENT_H@
#cmakedefine HAVE_TIME_H @HAVE_TIME_H@
#cmakedefine HAVE_NCURSES_H @HAVE_NCURSES_H@
#cmakedefine HAVE_SYS_TIME_H @HAVE_SYS_TIME_H@
#cmakedefine HAVE_SYS_STAT_H @HAVE_SYS_STAT_H@
#cmakedefine HAVE_ARPA_INET_H @HAVE_ARPA_INET_H@
#cmakedefine TIME_WITH_SYS_TIME @TIME_WITH_SYS_TIME@

#cmakedefine HAVE_SYSLOG_FAC_NAMES @HAVE_SYSLOG_FAC_NAMES@
#cmakedefine HAVE_SYSLOG_PRI_NAMES @HAVE_SYSLOG_PRI_NAMES@
#cmakedefine CURS_HAVE_MVVLINE @CURS_HAVE_MVVLINE@

#cmakedefine TCP_SPEED @TCP_SPEED@
#cmakedefine DEFAULT_SPEED @DEFAULT_SPEED@
#cmakedefine MAX_STRING @MAX_STRING@
#cmakedefine MAX_NODELIST @MAX_NODELIST@
#cmakedefine CONFIG "@CONFIG@"
#cmakedefine PACKAGE_NAME "@PACKAGE_NAME@"
#cmakedefine PACKAGE_VERSION "@PACKAGE_VERSION@"

#cmakedefine WITH_PERL @WITH_PERL@
33 changes: 33 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
find_package(FLEX REQUIRED)

find_package(BISON REQUIRED)

if (${PERLLIBS_FOUND})
set(perl_SRC perl.c)
endif (${PERLLIBS_FOUND})

set(qico_SOURCES call.c clserv.c config.c crc.c daemon.c
emsi.c freq.c ftn.c globals.c hydra.c janus.c log.c
ls_zglue.c ls_zmodem.c ls_zreceive.c ls_zsend.c main.c md5q.c
modem.c nodelist.c outbound.c protfm.c qconf.c qipc.c
queue.c qslib.c session.c slists.c tcp.c tools.c tty.c
binkp.c ${perl_SRC}
)

set(qctl_SOURCES qctl.c clserv.c md5q.c qslib.c)

set(qcc_SOURCES qcc.c clserv.c md5q.c qslib.c)

flex_target(lexer flaglex.l "${CMAKE_CURRENT_BINARY_DIR}/flaglex.c")
bison_target(parser flagexp.y "${CMAKE_CURRENT_BINARY_DIR}/flaglexp.c")
add_executable(qico ${qico_SOURCES}
"${CMAKE_CURRENT_BINARY_DIR}/flaglex.c"
"${CMAKE_CURRENT_BINARY_DIR}/flaglexp.c"
)
if (${PERLLIBS_FOUND})
target_link_libraries(qico ${PERL_LIBRARY} -lpthread)
endif (${PERLLIBS_FOUND})

add_executable(qctl ${qctl_SOURCES})
add_executable(qcc ${qcc_SOURCES})
target_link_libraries(qcc ${CURSES_NCURSES_LIBRARY} ${CURSES_EXTRA_LIBRARY})
2 changes: 1 addition & 1 deletion src/modem.c
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ static int modem_send_str(char *cmd)

static int modem_get_str(char *buf, size_t nbytes, int timeout)
{
timer_t tout = timer_set( timeout );
time_t tout = timer_set( timeout );
int rc = ERROR, ch = 0, ptr = 0;

buf[0] = '\0';
Expand Down
2 changes: 1 addition & 1 deletion src/tty.c
Original file line number Diff line number Diff line change
Expand Up @@ -654,7 +654,7 @@ int tty_bufflush(int tsec)
int rc = OK, restsize = TX_BUF_SIZE - tty_tx_free - tty_tx_ptr;
boolean wd;
struct timeval tv;
timer_t tm;
time_t tm;

tm = timer_set( tsec );
while( TX_BUF_SIZE != tty_tx_free ) {
Expand Down
2 changes: 1 addition & 1 deletion src/tty.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
#if !defined( POSIX_TERMIOS ) && !defined( BSD_SGTTY ) && !defined( SYSV_TERMIO)
# if defined(linux) || defined(sunos4) || defined(_AIX) || defined(BSD) || \
defined(SVR4) || defined(solaris2) || defined(m88k) || defined(M_UNIX) ||\
defined(__sgi)
defined(__sgi) || defined(__FreeBSD__)
# define POSIX_TERMIOS
# else
# define SYSV_TERMIO
Expand Down

0 comments on commit d906c0d

Please sign in to comment.