* Changes to allow correct build on Open BSD
pull/1/head
David J Vanecek 2012-08-02 10:37:17 -05:00 zatwierdzone przez David Freese
rodzic 07d5d89b5e
commit 9025bea6e7
13 zmienionych plików z 95 dodań i 20 usunięć

Wyświetl plik

@ -12,7 +12,7 @@ AC_DEFUN([AC_FLDIGI_DOCS], [
asciidoc_min=8.2.0
if test "x$ASCIIDOC" != "x"; then
AC_MSG_CHECKING([for asciidoc >= $asciidoc_min])
asciidoc_ver=$($ASCIIDOC --version | sed -n '1 { s/.* //; p }')
asciidoc_ver=$($ASCIIDOC --version | sed -n '1 s/.* //; p')
AX_COMPARE_VERSION([$asciidoc_ver], [ge], [$asciidoc_min],
[AC_MSG_RESULT([yes ($asciidoc_ver)])],
[AC_MSG_RESULT([no ($asciidoc_ver)]); ASCIIDOC=""])

Wyświetl plik

@ -19,7 +19,8 @@ AC_DEFUN([AC_FLDIGI_OSS], [
AC_DEFINE(USE_OSS, 0, [Defined if we are using OSS])
else
AC_CHECK_HEADER( [sys/soundcard.h], [ac_cv_oss=yes],
[AC_CHECK_HEADER([machine/soundcard.h], [ac_cv_oss=yes], [])] )
[AC_CHECK_HEADER([machine/soundcard.h], [ac_cv_oss=yes],
[AC_CHECK_HEADER([soundcard.h], [ac_cv_oss=yes], [])])])
if test "x$ac_cv_want_oss" = "xcheck"; then
if test "x$ac_cv_oss" = "xyes"; then
AC_DEFINE(USE_OSS, 1, [Defined if we are using OSS])

Wyświetl plik

@ -2091,7 +2091,10 @@ void ztimer(void* first_call)
Fl::repeat_timeout(1.0, ztimer);
struct tm tm;
gmtime_r(&tv.tv_sec, &tm);
time_t t_temp;
t_temp=(time_t)tv.tv_sec;
gmtime_r(&t_temp, &tm);
if (!strftime(ztbuf, sizeof(ztbuf), "%Y%m%d %H%M%S", &tm))
memset(ztbuf, 0, sizeof(ztbuf));
else

Wyświetl plik

@ -40,6 +40,14 @@
# define DEFAULT_PTTDEV "/dev/ttyd0"
# define DEFAULT_CWFSKPORT "/dev/ttyd1"
# define DEFAULT_HAMRIGDEVICE "/dev/ttyd0"
#elif defined(__NetBSD__)
# define DEFAULT_PTTDEV "/dev/tty00"
# define DEFAULT_CWFSKPORT "/dev/tty01"
# define DEFAULT_HAMRIGDEVICE "/dev/tty00"
#elif defined(__OpenBSD__)
# define DEFAULT_PTTDEV "/dev/tty00"
# define DEFAULT_CWFSKPORT "/dev/tty01"
# define DEFAULT_HAMRIGDEVICE "/dev/tty00"
#elif defined(__WOE32__)
# define DEFAULT_PTTDEV "COM1"
# define DEFAULT_CWFSKPORT "COM2"

Wyświetl plik

@ -32,7 +32,11 @@
#include <string>
#if USE_OSS
# if defined(__OpenBSD__)
# include <soundcard.h>
# else
# include <sys/soundcard.h>
# endif
#endif
class MixerException {

Wyświetl plik

@ -29,6 +29,9 @@
#ifndef __MINGW32__
# include <sys/socket.h>
# include <netdb.h>
# if defined(__OpenBSD__) && defined(nitems)
# undef nitems
# endif
# include <netinet/in.h>
#else
# include <winsock2.h>

Wyświetl plik

@ -970,6 +970,8 @@ out:
"/dev/usb/ttyUSB%u"
#elif defined(__FreeBSD__)
"/dev/ttyd%u"
#elif defined(__OpenBSD__) || defined(__NetBSD__)
"/dev/tty%2.2u"
#elif defined(__CYGWIN__)
"/dev/ttyS%u"
#elif defined(__MINGW32__)
@ -984,6 +986,8 @@ out:
# define TTY_MAX 255
#elif defined(__APPLE__)
glob_t gbuf;
#elif defined(__OpenBSD__) || defined(__NetBSD__)
# define TTY_MAX 4
#else
# define TTY_MAX 8
#endif

Wyświetl plik

@ -224,7 +224,12 @@ void loadBrowser(Fl_Widget *widget) {
}
w->add(LINE_SEP);
struct stat st;
# if defined(__OpenBSD__)
for (int i = 0; i < gbuf.gl_pathc; i++) {
# else
for (size_t i = 0; i < gbuf.gl_pathc; i++) {
# endif
if (!(stat(gbuf.gl_pathv[i], &st) == 0
&& S_ISREG(st.st_mode) && (st.st_mode & S_IXUSR)))
continue;

Wyświetl plik

@ -27,6 +27,9 @@
#ifndef __MINGW32__
# include <sys/socket.h>
# include <netdb.h>
# if defined(__OpenBSD__) && defined(nitems)
# undef nitems
# endif
# include <arpa/inet.h>
# include <netinet/in.h>
# include <sys/time.h>

Wyświetl plik

@ -22,6 +22,10 @@
#include <config.h>
#if defined(__OpenBSD__)
# include <sys/types.h>
#endif
#if !defined(__WOE32__) && !defined(__APPLE__)
# include <sys/ipc.h>
# include <sys/msg.h>

Wyświetl plik

@ -36,8 +36,12 @@
#include <sys/stat.h>
#include <errno.h>
#if USE_OSS
# include <sys/ioctl.h>
# include <sys/ioctl.h>
# if defined(__OpenBSD__)
# include <soundcard.h>
# else
# include <sys/soundcard.h>
# endif
#endif
#include <math.h>

Wyświetl plik

@ -45,8 +45,12 @@
#include <limits.h>
#if USE_OSS
# include <sys/ioctl.h>
# include <sys/ioctl.h>
# if defined(__OpenBSD__)
# include <soundcard.h>
# else
# include <sys/soundcard.h>
# endif
#endif
#include <math.h>

Wyświetl plik

@ -881,7 +881,7 @@ public:
/// Called when loading a file from the GUI, or indirectly from XML-RPC.
bool transmit_lock_acquire(const std::string & filnam, double delay = wefax::max_delay )
{
LOG_INFO("Sending %s delay=%f tid=%d", filnam.c_str(), delay, GET_THREAD_ID() );
LOG_INFO("Sending %s delay=%f tid=%d", filnam.c_str(), delay, (int)GET_THREAD_ID() );
guard_lock g( m_sync_tx_fil.mtxp() );
LOG_INFO("Locked");
if ( ! m_tx_fil.empty() )
@ -896,7 +896,7 @@ public:
/// Allows to send another file. Called by XML-RPC and the GUI.
void transmit_lock_release( const std::string & err_msg )
{
LOG_INFO("err_msg=%s tid=%d", err_msg.c_str(), GET_THREAD_ID() );
LOG_INFO("err_msg=%s tid=%d", err_msg.c_str(), (int)GET_THREAD_ID() );
guard_lock g( m_sync_tx_msg.mtxp() );
LOG_INFO("%s %s", m_tx_fil.c_str(), err_msg.c_str() );
if( m_tx_fil.empty() )
@ -1031,7 +1031,7 @@ public:
}
}
LOG_INFO("Shift: i=%d hist=%d", best_shift_idx, biggest_shift );
LOG_INFO("Shift: i=%d hist=%d", (int)best_shift_idx, (int)biggest_shift );
}
return best_shift_idx ;
}
@ -2491,19 +2491,9 @@ wefax::wefax(trx_mode wefax_mode) : modem()
// receive processing
//=====================================================================
#ifdef __linux__
#include <sys/timeb.h>
/// This must return the current time in seconds with high precision.
static double current_time(void)
{
struct timeb tmp_timb ;
ftime( &tmp_timb );
return (double)tmp_timb.time + tmp_timb.millitm / 1000.0 ;
}
#else
#if defined(__WIN32__) || defined(__APPLE__)
#include <ctime>
/// This is much less accurate.
static double current_time(void)
@ -2512,8 +2502,50 @@ static double current_time(void)
return clks * 1.0 / CLOCKS_PER_SEC;
}
#endif
#else
#if defined(HAVE_CLOCK_GETTIME)
#include <sys/time.h>
static double current_time(void)
{
// DJV/AB3NR
// Replace call to deprecated ftime() function with call to
// clock_gettime(2). clock_gettime(2) is POSIX.1 compliant.
// Replace ifdef __linux__ with autoconf generated guard.
// (Note __linux__ fails for *BSD, which all have better functions
// than the fallback Windows routine. Note, clock(2) on Unix systems
// returns CPU time used so far. It's not a "clock" in any generally
// accepted sense of the word.
//
// Check system call return codes and abort on failure.
// DJV/AB3NR
struct timespec ts;
double curtime;
// Do not know if CLOCK_MONOTONIC or CLOCK_REALTIME is appropriate. DJV
if(clock_gettime(CLOCK_REALTIME, &ts)!=0) {
LOG_PERROR("clock_gettime");
abort();
}
curtime= ts.tv_nsec*1e-09 + (double)ts.tv_sec;
return curtime;
}
#else
#include <ctime>
// This is much less accurate.
// Add compile time warning DJV/AB3NR
#warning imprecise clock() call in function current_time in wefax.cxx
static double current_time(void)
{
clock_t clks = clock();
return clks * 1.0 / CLOCKS_PER_SEC;
}
#endif // HAVE_CLOCK_GETTIME
#endif //__WIN32__
/// Callback continuously called by fldigi modem class.
int wefax::rx_process(const double *buf, int len)