mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2025-02-03 09:44:24 -05:00
- remove conf.h hence remove conf.h.in as well, and modify
all files previously using conf.h - pass defs found into the Makefile instead - add parallel port enable to configure --enable-parallel vs. --enable-serial - use code (partially contributed by yours truly anyway) from cwdaemon to add parallel port support for *nix. I've not tested parallel port operation, it should match what cwdaemon does, which is convenient. git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/trunk@113 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
parent
ef6b6fcefc
commit
4b889cdf57
@ -5,10 +5,13 @@ CPPFLAGS = @CPPFLAGS@
|
||||
CFLAGS = @CFLAGS@
|
||||
# WSJT specific C flags
|
||||
CFLAGS += -DBIGSYM=1
|
||||
DEFS = @DEFS@
|
||||
CFLAGS += ${DEFS}
|
||||
CPPFLAGS += ${DEFS}
|
||||
|
||||
# WSJT specific Fortran flags
|
||||
#FFLAGS += -cpp -Wall -fbounds-check -ftrace=full -fno-second-underscore
|
||||
FFLAGS += -cpp -fno-second-underscore
|
||||
FFLAGS += -cpp -Wall -fbounds-check -ftrace=full -fno-second-underscore
|
||||
#FFLAGS += -cpp -fno-second-underscore
|
||||
# The default rules
|
||||
.c.o:
|
||||
${CC} ${CPPFLAGS} ${CFLAGS} -c -o ${<:.c=.o} $<
|
||||
|
65
conf.h.in
65
conf.h.in
@ -1,65 +0,0 @@
|
||||
/* setup.h.in. Generated from configure.ac by autoheader. */
|
||||
|
||||
/* Define to 1 if you have the ANSI C header files. */
|
||||
#undef STDC_HEADERS
|
||||
|
||||
/* Define to 1 if string.h may be included along with strings.h */
|
||||
#undef STRING_WITH_STRINGS
|
||||
|
||||
/* Define to 1 if your processor stores words with the most significant byte
|
||||
first (like Motorola and SPARC, unlike Intel and VAX). */
|
||||
#undef WORDS_BIGENDIAN
|
||||
|
||||
/* Enable GNU extensions on systems that have them. */
|
||||
#ifndef _GNU_SOURCE
|
||||
# undef _GNU_SOURCE
|
||||
#endif
|
||||
|
||||
/* This is needed to use strtok_r on Solaris. */
|
||||
#undef __EXTENSIONS__
|
||||
|
||||
|
||||
/* Define to `__inline__' or `__inline' if that's what the C compiler
|
||||
calls it, or to nothing if 'inline' is not supported under any name. */
|
||||
#ifndef __cplusplus
|
||||
#undef inline
|
||||
#endif
|
||||
|
||||
/* Define to `long long' if <sys/types.h> does not define. */
|
||||
#undef int64_t
|
||||
|
||||
/* If system does not define sa_family_t, define it here. */
|
||||
#undef sa_family_t
|
||||
|
||||
/* If we don't have a real socklen_t, unsigned int is good enough. */
|
||||
#undef socklen_t
|
||||
|
||||
/* If system does not define u_int16_t, define a usable substitute. */
|
||||
#undef u_int16_t
|
||||
|
||||
/* If system does not define u_int32_t, define to unsigned long int here. */
|
||||
#undef u_int32_t
|
||||
|
||||
/* Define to `unsigned long long' if <sys/types.h> does not define. */
|
||||
#undef uint64_t
|
||||
|
||||
/* Define if you have /usr/include/sys/param.h */
|
||||
#undef HAVE_SYS_PARAM_H
|
||||
|
||||
/* Define if you have asoundlib.h */
|
||||
#undef HAS_ASOUNDLIB_H
|
||||
|
||||
/* Define if you want to use ALSA */
|
||||
#undef USE_ALSA
|
||||
|
||||
/* Define if you have soundcard.h */
|
||||
#undef HAS_SOUNDCARD_H
|
||||
|
||||
/* Define if you want to use OSS */
|
||||
#undef USE_OSS
|
||||
|
||||
/* Define if you have portaudio.h */
|
||||
#undef HAS_PORTAUDIO_H
|
||||
|
||||
/* Define if you want to use PORTAUDIO */
|
||||
#undef USE_PORTAUDIO
|
418
configure
vendored
418
configure
vendored
@ -1,8 +1,8 @@
|
||||
#! /bin/sh
|
||||
# Guess values for system-dependent variables and create Makefiles.
|
||||
# Generated by GNU Autoconf 2.53 for wsjt 0.9.
|
||||
# Generated by GNU Autoconf 2.53 for wsjt 5.9.2.
|
||||
#
|
||||
# $Id: configure.ac 102 2006-01-14 16:15:50Z va3db $
|
||||
# $Id: configure.ac 110 2006-01-15 23:32:39Z va3db $
|
||||
#
|
||||
# Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002
|
||||
# Free Software Foundation, Inc.
|
||||
@ -256,8 +256,8 @@ SHELL=${CONFIG_SHELL-/bin/sh}
|
||||
# Identity of this package.
|
||||
PACKAGE_NAME='wsjt'
|
||||
PACKAGE_TARNAME='wsjt'
|
||||
PACKAGE_VERSION='0.9'
|
||||
PACKAGE_STRING='wsjt 0.9'
|
||||
PACKAGE_VERSION='5.9.2'
|
||||
PACKAGE_STRING='wsjt 5.9.2'
|
||||
PACKAGE_BUGREPORT=''
|
||||
|
||||
ac_default_prefix=/usr/local/
|
||||
@ -770,7 +770,7 @@ if test "$ac_init_help" = "long"; then
|
||||
# Omit some internal or obsolete options to make the list less imposing.
|
||||
# This message is too long to be a string in the A/UX 3.1 sh.
|
||||
cat <<_ACEOF
|
||||
\`configure' configures wsjt 0.9 to adapt to many kinds of systems.
|
||||
\`configure' configures wsjt 5.9.2 to adapt to many kinds of systems.
|
||||
|
||||
Usage: $0 [OPTION]... [VAR=VALUE]...
|
||||
|
||||
@ -827,7 +827,7 @@ fi
|
||||
|
||||
if test -n "$ac_init_help"; then
|
||||
case $ac_init_help in
|
||||
short | recursive ) echo "Configuration of wsjt 0.9:";;
|
||||
short | recursive ) echo "Configuration of wsjt 5.9.2:";;
|
||||
esac
|
||||
cat <<\_ACEOF
|
||||
|
||||
@ -839,6 +839,8 @@ Optional Features:
|
||||
--enable-alsa Force ALSA SOUNDCARD usage.
|
||||
--enable-oss Force OSS SOUND usage.
|
||||
--enable-portaudio Force PORTAUDIO SOUND usage.
|
||||
--enable-parallel Force PARALLEL port usage for ptt.
|
||||
--enable-serial Force SERIAL port usage for ptt.
|
||||
|
||||
Some influential environment variables:
|
||||
CC C compiler command
|
||||
@ -916,7 +918,7 @@ fi
|
||||
test -n "$ac_init_help" && exit 0
|
||||
if $ac_init_version; then
|
||||
cat <<\_ACEOF
|
||||
wsjt configure 0.9
|
||||
wsjt configure 5.9.2
|
||||
generated by GNU Autoconf 2.53
|
||||
|
||||
Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002
|
||||
@ -924,7 +926,7 @@ Free Software Foundation, Inc.
|
||||
This configure script is free software; the Free Software Foundation
|
||||
gives unlimited permission to copy, distribute and modify it.
|
||||
|
||||
$Id: configure.ac 102 2006-01-14 16:15:50Z va3db $
|
||||
$Id: configure.ac 110 2006-01-15 23:32:39Z va3db $
|
||||
_ACEOF
|
||||
exit 0
|
||||
fi
|
||||
@ -933,7 +935,7 @@ cat >&5 <<_ACEOF
|
||||
This file contains any messages produced by compilers while
|
||||
running configure, to aid debugging if configure makes a mistake.
|
||||
|
||||
It was created by wsjt $as_me 0.9, which was
|
||||
It was created by wsjt $as_me 5.9.2, which was
|
||||
generated by GNU Autoconf 2.53. Invocation command line was
|
||||
|
||||
$ $0 $@
|
||||
@ -1210,9 +1212,6 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
ac_config_headers="$ac_config_headers conf.h"
|
||||
|
||||
|
||||
|
||||
@ -2074,7 +2073,7 @@ fi
|
||||
|
||||
|
||||
# Provide some information about the compiler.
|
||||
echo "$as_me:2077:" \
|
||||
echo "$as_me:2076:" \
|
||||
"checking for Fortran 77 compiler version" >&5
|
||||
ac_compiler=`set X $ac_compile; echo $2`
|
||||
{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version </dev/null >&5\"") >&5
|
||||
@ -3332,6 +3331,7 @@ OS=`uname`
|
||||
OS="${OS}"
|
||||
|
||||
|
||||
|
||||
echo "$as_me:$LINENO: checking for ANSI C header files" >&5
|
||||
echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6
|
||||
if test "${ac_cv_header_stdc+set}" = set; then
|
||||
@ -3540,7 +3540,17 @@ done
|
||||
|
||||
|
||||
|
||||
for ac_header in inttypes.h stdint.h sys/resource.h sys/param.h errno.h sys/syslog.h stddef.h libgen.h sys/wait.h wait.h
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
for ac_header in inttypes.h stdint.h sys/resource.h sys/param.h errno.h \
|
||||
sys/syslog.h stddef.h libgen.h sys/wait.h wait.h stdio.h termios.h \
|
||||
sys/resource.h linux/ppdev.h dev/ppbus/ppi.h sys/stat.h fcntl.h sys/ioctl.h
|
||||
do
|
||||
as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
|
||||
if eval "test \"\${$as_ac_Header+set}\" = set"; then
|
||||
@ -3653,6 +3663,65 @@ fi
|
||||
|
||||
done
|
||||
|
||||
|
||||
echo "$as_me:$LINENO: checking whether time.h and sys/time.h may both be included" >&5
|
||||
echo $ECHO_N "checking whether time.h and sys/time.h may both be included... $ECHO_C" >&6
|
||||
if test "${ac_cv_header_time+set}" = set; then
|
||||
echo $ECHO_N "(cached) $ECHO_C" >&6
|
||||
else
|
||||
cat >conftest.$ac_ext <<_ACEOF
|
||||
#line $LINENO "configure"
|
||||
#include "confdefs.h"
|
||||
#include <sys/types.h>
|
||||
#include <sys/time.h>
|
||||
#include <time.h>
|
||||
|
||||
#ifdef F77_DUMMY_MAIN
|
||||
# ifdef __cplusplus
|
||||
extern "C"
|
||||
# endif
|
||||
int F77_DUMMY_MAIN() { return 1; }
|
||||
#endif
|
||||
int
|
||||
main ()
|
||||
{
|
||||
if ((struct tm *) 0)
|
||||
return 0;
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
rm -f conftest.$ac_objext
|
||||
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
|
||||
(eval $ac_compile) 2>&5
|
||||
ac_status=$?
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); } &&
|
||||
{ ac_try='test -s conftest.$ac_objext'
|
||||
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
||||
(eval $ac_try) 2>&5
|
||||
ac_status=$?
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); }; }; then
|
||||
ac_cv_header_time=yes
|
||||
else
|
||||
echo "$as_me: failed program was:" >&5
|
||||
cat conftest.$ac_ext >&5
|
||||
ac_cv_header_time=no
|
||||
fi
|
||||
rm -f conftest.$ac_objext conftest.$ac_ext
|
||||
fi
|
||||
echo "$as_me:$LINENO: result: $ac_cv_header_time" >&5
|
||||
echo "${ECHO_T}$ac_cv_header_time" >&6
|
||||
if test $ac_cv_header_time = yes; then
|
||||
|
||||
cat >>confdefs.h <<\_ACEOF
|
||||
#define TIME_WITH_SYS_TIME 1
|
||||
_ACEOF
|
||||
|
||||
fi
|
||||
|
||||
|
||||
if test "${ac_cv_header_sys_soundcard_h+set}" = set; then
|
||||
echo "$as_me:$LINENO: checking for sys/soundcard.h" >&5
|
||||
echo $ECHO_N "checking for sys/soundcard.h... $ECHO_C" >&6
|
||||
@ -5713,7 +5782,43 @@ else
|
||||
portaudio=no
|
||||
fi;
|
||||
|
||||
# Check whether --enable-parallel or --disable-parallel was given.
|
||||
if test "${enable_parallel+set}" = set; then
|
||||
enableval="$enable_parallel"
|
||||
parallel=$enableval
|
||||
else
|
||||
parallel=no
|
||||
fi;
|
||||
|
||||
# Check whether --enable-serial or --disable-serial was given.
|
||||
if test "${enable_serial+set}" = set; then
|
||||
enableval="$enable_serial"
|
||||
serial=$enableval
|
||||
else
|
||||
serial=no
|
||||
fi;
|
||||
|
||||
|
||||
|
||||
if test "$serial" != yes -a "$parallel" != yes; then
|
||||
serial=yes;
|
||||
fi
|
||||
|
||||
if test "$serial" = yes; then
|
||||
|
||||
cat >>confdefs.h <<\_ACEOF
|
||||
#define USE_SERIAL 1
|
||||
_ACEOF
|
||||
|
||||
fi
|
||||
|
||||
if test "$parallel" = yes; then
|
||||
|
||||
cat >>confdefs.h <<\_ACEOF
|
||||
#define USE_PARALLEL 1
|
||||
_ACEOF
|
||||
|
||||
fi
|
||||
|
||||
if test "$alsa" != yes -a "$oss" != yes -a "$portaudio" != yes; then
|
||||
if test $HAS_PORTAUDIO_H -eq 1; then
|
||||
@ -5732,8 +5837,6 @@ _ACEOF
|
||||
AUDIO="start_alsa.c"
|
||||
|
||||
LDFLAGS="${LDFLAGS} -lasound"
|
||||
CFLAGS="${CFLAGS} -DUSE_ALSA"
|
||||
CPPFLAGS="${CPPFLAGS} -DUSE_ALSA"
|
||||
fi
|
||||
|
||||
if test "$oss" = yes; then
|
||||
@ -5744,8 +5847,6 @@ _ACEOF
|
||||
|
||||
AUDIO="start_oss.c"
|
||||
|
||||
CFLAGS="${CFLAGS} -DUSE_OSS"
|
||||
CPPFLAGS="${CPPFLAGS} -DUSE_OSS"
|
||||
fi
|
||||
|
||||
if test "$portaudio" = yes; then
|
||||
@ -5757,8 +5858,6 @@ _ACEOF
|
||||
AUDIO="a2d.f90 jtaudio.c start_portaudio.c"
|
||||
|
||||
LDFLAGS="${LDFLAGS} -lportaudio -lsamplerate"
|
||||
CFLAGS="${CFLAGS} -DUSE_PORTAUDIO"
|
||||
CPPFLAGS="${CPPFLAGS} -DUSE_PORTAUDIO"
|
||||
fi
|
||||
|
||||
|
||||
@ -5827,8 +5926,7 @@ LDFLAGS="${LDFLAGS}"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
ac_config_files="$ac_config_files Makefile"
|
||||
cat >confcache <<\_ACEOF
|
||||
# This file is a shell script that caches the results of configure
|
||||
# tests run on this system so they can be shared between configure
|
||||
@ -5903,7 +6001,38 @@ s/^[^=]*=[ ]*$//;
|
||||
}'
|
||||
fi
|
||||
|
||||
DEFS=-DHAVE_CONFIG_H
|
||||
# Transform confdefs.h into DEFS.
|
||||
# Protect against shell expansion while executing Makefile rules.
|
||||
# Protect against Makefile macro expansion.
|
||||
#
|
||||
# If the first sed substitution is executed (which looks for macros that
|
||||
# take arguments), then we branch to the quote section. Otherwise,
|
||||
# look for a macro that doesn't take arguments.
|
||||
cat >confdef2opt.sed <<\_ACEOF
|
||||
t clear
|
||||
: clear
|
||||
s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\),-D\1=\2,g
|
||||
t quote
|
||||
s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\),-D\1=\2,g
|
||||
t quote
|
||||
d
|
||||
: quote
|
||||
s,[ `~#$^&*(){}\\|;'"<>?],\\&,g
|
||||
s,\[,\\&,g
|
||||
s,\],\\&,g
|
||||
s,\$,$$,g
|
||||
p
|
||||
_ACEOF
|
||||
# We use echo to avoid assuming a particular line-breaking character.
|
||||
# The extra dot is to prevent the shell from consuming trailing
|
||||
# line-breaks from the sub-command output. A line-break within
|
||||
# single-quotes doesn't work because, if this script is created in a
|
||||
# platform that uses two characters for line-breaks (e.g., DOS), tr
|
||||
# would break.
|
||||
ac_LF_and_DOT=`echo; echo .`
|
||||
DEFS=`sed -n -f confdef2opt.sed confdefs.h | tr "$ac_LF_and_DOT" ' .'`
|
||||
rm -f confdef2opt.sed
|
||||
|
||||
|
||||
|
||||
: ${CONFIG_STATUS=./config.status}
|
||||
@ -6154,7 +6283,7 @@ _ASBOX
|
||||
} >&5
|
||||
cat >&5 <<_CSEOF
|
||||
|
||||
This file was extended by wsjt $as_me 0.9, which was
|
||||
This file was extended by wsjt $as_me 5.9.2, which was
|
||||
generated by GNU Autoconf 2.53. Invocation command line was
|
||||
|
||||
CONFIG_FILES = $CONFIG_FILES
|
||||
@ -6199,21 +6328,16 @@ Usage: $0 [OPTIONS] [FILE]...
|
||||
--recheck update $as_me by reconfiguring in the same conditions
|
||||
--file=FILE[:TEMPLATE]
|
||||
instantiate the configuration file FILE
|
||||
--header=FILE[:TEMPLATE]
|
||||
instantiate the configuration header FILE
|
||||
|
||||
Configuration files:
|
||||
$config_files
|
||||
|
||||
Configuration headers:
|
||||
$config_headers
|
||||
|
||||
Report bugs to <bug-autoconf@gnu.org>."
|
||||
_ACEOF
|
||||
|
||||
cat >>$CONFIG_STATUS <<_ACEOF
|
||||
ac_cs_version="\\
|
||||
wsjt config.status 0.9
|
||||
wsjt config.status 5.9.2
|
||||
configured by $0, generated by GNU Autoconf 2.53,
|
||||
with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\"
|
||||
|
||||
@ -6301,7 +6425,7 @@ do
|
||||
case "$ac_config_target" in
|
||||
# Handling of arguments.
|
||||
"Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;;
|
||||
"conf.h" ) CONFIG_HEADERS="$CONFIG_HEADERS conf.h" ;;
|
||||
"Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;;
|
||||
*) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5
|
||||
echo "$as_me: error: invalid argument: $ac_config_target" >&2;}
|
||||
{ (exit 1); exit 1; }; };;
|
||||
@ -6314,7 +6438,6 @@ done
|
||||
# bizarre bug on SunOS 4.1.3.
|
||||
if $ac_need_defaults; then
|
||||
test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files
|
||||
test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers
|
||||
fi
|
||||
|
||||
# Create a temporary directory, and hook for its removal unless debugging.
|
||||
@ -6613,223 +6736,6 @@ s,@INSTALL@,$ac_INSTALL,;t t
|
||||
|
||||
done
|
||||
_ACEOF
|
||||
cat >>$CONFIG_STATUS <<\_ACEOF
|
||||
|
||||
#
|
||||
# CONFIG_HEADER section.
|
||||
#
|
||||
|
||||
# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where
|
||||
# NAME is the cpp macro being defined and VALUE is the value it is being given.
|
||||
#
|
||||
# ac_d sets the value in "#define NAME VALUE" lines.
|
||||
ac_dA='s,^\([ ]*\)#\([ ]*define[ ][ ]*\)'
|
||||
ac_dB='[ ].*$,\1#\2'
|
||||
ac_dC=' '
|
||||
ac_dD=',;t'
|
||||
# ac_u turns "#undef NAME" without trailing blanks into "#define NAME VALUE".
|
||||
ac_uA='s,^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)'
|
||||
ac_uB='$,\1#\2define\3'
|
||||
ac_uC=' '
|
||||
ac_uD=',;t'
|
||||
|
||||
for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue
|
||||
# Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
|
||||
case $ac_file in
|
||||
- | *:- | *:-:* ) # input from stdin
|
||||
cat >$tmp/stdin
|
||||
ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
|
||||
ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
|
||||
*:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
|
||||
ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
|
||||
* ) ac_file_in=$ac_file.in ;;
|
||||
esac
|
||||
|
||||
test x"$ac_file" != x- && { echo "$as_me:$LINENO: creating $ac_file" >&5
|
||||
echo "$as_me: creating $ac_file" >&6;}
|
||||
|
||||
# First look for the input files in the build tree, otherwise in the
|
||||
# src tree.
|
||||
ac_file_inputs=`IFS=:
|
||||
for f in $ac_file_in; do
|
||||
case $f in
|
||||
-) echo $tmp/stdin ;;
|
||||
[\\/$]*)
|
||||
# Absolute (can't be DOS-style, as IFS=:)
|
||||
test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
|
||||
echo "$as_me: error: cannot find input file: $f" >&2;}
|
||||
{ (exit 1); exit 1; }; }
|
||||
echo $f;;
|
||||
*) # Relative
|
||||
if test -f "$f"; then
|
||||
# Build tree
|
||||
echo $f
|
||||
elif test -f "$srcdir/$f"; then
|
||||
# Source tree
|
||||
echo $srcdir/$f
|
||||
else
|
||||
# /dev/null tree
|
||||
{ { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
|
||||
echo "$as_me: error: cannot find input file: $f" >&2;}
|
||||
{ (exit 1); exit 1; }; }
|
||||
fi;;
|
||||
esac
|
||||
done` || { (exit 1); exit 1; }
|
||||
# Remove the trailing spaces.
|
||||
sed 's/[ ]*$//' $ac_file_inputs >$tmp/in
|
||||
|
||||
_ACEOF
|
||||
|
||||
# Transform confdefs.h into two sed scripts, `conftest.defines' and
|
||||
# `conftest.undefs', that substitutes the proper values into
|
||||
# config.h.in to produce config.h. The first handles `#define'
|
||||
# templates, and the second `#undef' templates.
|
||||
# And first: Protect against being on the right side of a sed subst in
|
||||
# config.status. Protect against being in an unquoted here document
|
||||
# in config.status.
|
||||
rm -f conftest.defines conftest.undefs
|
||||
# Using a here document instead of a string reduces the quoting nightmare.
|
||||
# Putting comments in sed scripts is not portable.
|
||||
#
|
||||
# `end' is used to avoid that the second main sed command (meant for
|
||||
# 0-ary CPP macros) applies to n-ary macro definitions.
|
||||
# See the Autoconf documentation for `clear'.
|
||||
cat >confdef2sed.sed <<\_ACEOF
|
||||
s/[\\&,]/\\&/g
|
||||
s,[\\$`],\\&,g
|
||||
t clear
|
||||
: clear
|
||||
s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*\)\(([^)]*)\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1\2${ac_dC}\3${ac_dD},gp
|
||||
t end
|
||||
s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD},gp
|
||||
: end
|
||||
_ACEOF
|
||||
# If some macros were called several times there might be several times
|
||||
# the same #defines, which is useless. Nevertheless, we may not want to
|
||||
# sort them, since we want the *last* AC-DEFINE to be honored.
|
||||
uniq confdefs.h | sed -n -f confdef2sed.sed >conftest.defines
|
||||
sed 's/ac_d/ac_u/g' conftest.defines >conftest.undefs
|
||||
rm -f confdef2sed.sed
|
||||
|
||||
# This sed command replaces #undef with comments. This is necessary, for
|
||||
# example, in the case of _POSIX_SOURCE, which is predefined and required
|
||||
# on some systems where configure will not decide to define it.
|
||||
cat >>conftest.undefs <<\_ACEOF
|
||||
s,^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */,
|
||||
_ACEOF
|
||||
|
||||
# Break up conftest.defines because some shells have a limit on the size
|
||||
# of here documents, and old seds have small limits too (100 cmds).
|
||||
echo ' # Handle all the #define templates only if necessary.' >>$CONFIG_STATUS
|
||||
echo ' if egrep "^[ ]*#[ ]*define" $tmp/in >/dev/null; then' >>$CONFIG_STATUS
|
||||
echo ' # If there are no defines, we may have an empty if/fi' >>$CONFIG_STATUS
|
||||
echo ' :' >>$CONFIG_STATUS
|
||||
rm -f conftest.tail
|
||||
while grep . conftest.defines >/dev/null
|
||||
do
|
||||
# Write a limited-size here document to $tmp/defines.sed.
|
||||
echo ' cat >$tmp/defines.sed <<CEOF' >>$CONFIG_STATUS
|
||||
# Speed up: don't consider the non `#define' lines.
|
||||
echo '/^[ ]*#[ ]*define/!b' >>$CONFIG_STATUS
|
||||
# Work around the forget-to-reset-the-flag bug.
|
||||
echo 't clr' >>$CONFIG_STATUS
|
||||
echo ': clr' >>$CONFIG_STATUS
|
||||
sed ${ac_max_here_lines}q conftest.defines >>$CONFIG_STATUS
|
||||
echo 'CEOF
|
||||
sed -f $tmp/defines.sed $tmp/in >$tmp/out
|
||||
rm -f $tmp/in
|
||||
mv $tmp/out $tmp/in
|
||||
' >>$CONFIG_STATUS
|
||||
sed 1,${ac_max_here_lines}d conftest.defines >conftest.tail
|
||||
rm -f conftest.defines
|
||||
mv conftest.tail conftest.defines
|
||||
done
|
||||
rm -f conftest.defines
|
||||
echo ' fi # egrep' >>$CONFIG_STATUS
|
||||
echo >>$CONFIG_STATUS
|
||||
|
||||
# Break up conftest.undefs because some shells have a limit on the size
|
||||
# of here documents, and old seds have small limits too (100 cmds).
|
||||
echo ' # Handle all the #undef templates' >>$CONFIG_STATUS
|
||||
rm -f conftest.tail
|
||||
while grep . conftest.undefs >/dev/null
|
||||
do
|
||||
# Write a limited-size here document to $tmp/undefs.sed.
|
||||
echo ' cat >$tmp/undefs.sed <<CEOF' >>$CONFIG_STATUS
|
||||
# Speed up: don't consider the non `#undef'
|
||||
echo '/^[ ]*#[ ]*undef/!b' >>$CONFIG_STATUS
|
||||
# Work around the forget-to-reset-the-flag bug.
|
||||
echo 't clr' >>$CONFIG_STATUS
|
||||
echo ': clr' >>$CONFIG_STATUS
|
||||
sed ${ac_max_here_lines}q conftest.undefs >>$CONFIG_STATUS
|
||||
echo 'CEOF
|
||||
sed -f $tmp/undefs.sed $tmp/in >$tmp/out
|
||||
rm -f $tmp/in
|
||||
mv $tmp/out $tmp/in
|
||||
' >>$CONFIG_STATUS
|
||||
sed 1,${ac_max_here_lines}d conftest.undefs >conftest.tail
|
||||
rm -f conftest.undefs
|
||||
mv conftest.tail conftest.undefs
|
||||
done
|
||||
rm -f conftest.undefs
|
||||
|
||||
cat >>$CONFIG_STATUS <<\_ACEOF
|
||||
# Let's still pretend it is `configure' which instantiates (i.e., don't
|
||||
# use $as_me), people would be surprised to read:
|
||||
# /* config.h. Generated by config.status. */
|
||||
if test x"$ac_file" = x-; then
|
||||
echo "/* Generated by configure. */" >$tmp/config.h
|
||||
else
|
||||
echo "/* $ac_file. Generated by configure. */" >$tmp/config.h
|
||||
fi
|
||||
cat $tmp/in >>$tmp/config.h
|
||||
rm -f $tmp/in
|
||||
if test x"$ac_file" != x-; then
|
||||
if cmp -s $ac_file $tmp/config.h 2>/dev/null; then
|
||||
{ echo "$as_me:$LINENO: $ac_file is unchanged" >&5
|
||||
echo "$as_me: $ac_file is unchanged" >&6;}
|
||||
else
|
||||
ac_dir=`(dirname "$ac_file") 2>/dev/null ||
|
||||
$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
|
||||
X"$ac_file" : 'X\(//\)[^/]' \| \
|
||||
X"$ac_file" : 'X\(//\)$' \| \
|
||||
X"$ac_file" : 'X\(/\)' \| \
|
||||
. : '\(.\)' 2>/dev/null ||
|
||||
echo X"$ac_file" |
|
||||
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
|
||||
/^X\(\/\/\)[^/].*/{ s//\1/; q; }
|
||||
/^X\(\/\/\)$/{ s//\1/; q; }
|
||||
/^X\(\/\).*/{ s//\1/; q; }
|
||||
s/.*/./; q'`
|
||||
{ case "$ac_dir" in
|
||||
[\\/]* | ?:[\\/]* ) as_incr_dir=;;
|
||||
*) as_incr_dir=.;;
|
||||
esac
|
||||
as_dummy="$ac_dir"
|
||||
for as_mkdir_dir in `IFS='/\\'; set X $as_dummy; shift; echo "$@"`; do
|
||||
case $as_mkdir_dir in
|
||||
# Skip DOS drivespec
|
||||
?:) as_incr_dir=$as_mkdir_dir ;;
|
||||
*)
|
||||
as_incr_dir=$as_incr_dir/$as_mkdir_dir
|
||||
test -d "$as_incr_dir" ||
|
||||
mkdir "$as_incr_dir" ||
|
||||
{ { echo "$as_me:$LINENO: error: cannot create \"$ac_dir\"" >&5
|
||||
echo "$as_me: error: cannot create \"$ac_dir\"" >&2;}
|
||||
{ (exit 1); exit 1; }; }
|
||||
;;
|
||||
esac
|
||||
done; }
|
||||
|
||||
rm -f $ac_file
|
||||
mv $tmp/config.h $ac_file
|
||||
fi
|
||||
else
|
||||
cat $tmp/config.h
|
||||
rm -f $tmp/config.h
|
||||
fi
|
||||
done
|
||||
_ACEOF
|
||||
|
||||
cat >>$CONFIG_STATUS <<\_ACEOF
|
||||
|
||||
@ -6862,15 +6768,23 @@ echo
|
||||
echo
|
||||
|
||||
if test $portaudio == "yes"; then
|
||||
echo "Using portaudio";
|
||||
echo "Using portaudio.";
|
||||
fi
|
||||
|
||||
if test $alsa == "yes"; then
|
||||
echo "Using alsa";
|
||||
echo "Using alsa.";
|
||||
fi
|
||||
|
||||
if test $oss == "yes"; then
|
||||
echo "Using oss";
|
||||
echo "Using oss.";
|
||||
fi
|
||||
|
||||
if test $serial == "yes"; then
|
||||
echo "Using serial port for ptt.";
|
||||
fi
|
||||
|
||||
if test $parallel == "yes"; then
|
||||
echo "Using parallel port for ptt.";
|
||||
fi
|
||||
|
||||
echo
|
||||
|
56
configure.ac
56
configure.ac
@ -7,9 +7,7 @@ dnl AC_PREREQ(2.59)
|
||||
dnl Sneaky way to get an Id tag into the configure script
|
||||
AC_COPYRIGHT([$Id$])
|
||||
|
||||
AC_INIT([wsjt],[0.9])
|
||||
|
||||
AC_CONFIG_HEADER(conf.h)
|
||||
AC_INIT([wsjt],[5.9.2])
|
||||
|
||||
AC_PREFIX_DEFAULT(/usr/local/)
|
||||
|
||||
@ -96,9 +94,15 @@ OS=`uname`
|
||||
AC_SUBST(OS, "${OS}")
|
||||
|
||||
dnl Checks for header files.
|
||||
|
||||
AC_HEADER_STDC
|
||||
|
||||
AC_CHECK_HEADERS([inttypes.h stdint.h sys/resource.h sys/param.h errno.h sys/syslog.h stddef.h libgen.h sys/wait.h wait.h ])
|
||||
AC_CHECK_HEADERS([inttypes.h stdint.h sys/resource.h sys/param.h errno.h \
|
||||
sys/syslog.h stddef.h libgen.h sys/wait.h wait.h stdio.h termios.h \
|
||||
sys/resource.h linux/ppdev.h dev/ppbus/ppi.h sys/stat.h fcntl.h sys/ioctl.h ])
|
||||
|
||||
AC_HEADER_TIME
|
||||
|
||||
AC_CHECK_HEADER([sys/soundcard.h], [HAS_SOUNDCARD_H=1], [HAS_SOUNDCARD_H=0])
|
||||
AC_CHECK_HEADER([alsa/asoundlib.h], [HAS_ASOUNDLIB_H=1], [HAS_ASOUNDLIB_H=0])
|
||||
AC_CHECK_HEADER([portaudio.h], [HAS_PORTAUDIO_H=1], [HAS_PORTAUDIO_H=0])
|
||||
@ -217,12 +221,32 @@ AC_ARG_ENABLE(portaudio,
|
||||
AC_HELP_STRING([--enable-portaudio],[Force PORTAUDIO SOUND usage.]),
|
||||
[portaudio=$enableval], [portaudio=no])
|
||||
|
||||
AC_ARG_ENABLE(parallel,
|
||||
AC_HELP_STRING([--enable-parallel],[Force PARALLEL port usage for ptt.]),
|
||||
[parallel=$enableval], [parallel=no])
|
||||
|
||||
AC_ARG_ENABLE(serial,
|
||||
AC_HELP_STRING([--enable-serial],[Force SERIAL port usage for ptt.]),
|
||||
[serial=$enableval], [serial=no])
|
||||
|
||||
dnl now set conf.h,, CPPFLAGS and CFLAGS flags as needed
|
||||
dnl ====================================================
|
||||
|
||||
dnl set defaults
|
||||
dnl ============
|
||||
|
||||
if test "$serial" != yes -a "$parallel" != yes; then
|
||||
[serial=yes];
|
||||
fi
|
||||
|
||||
if test "$serial" = yes; then
|
||||
AC_DEFINE(USE_SERIAL, 1, [Define if you want Serial port used.])
|
||||
fi
|
||||
|
||||
if test "$parallel" = yes; then
|
||||
AC_DEFINE(USE_PARALLEL, 1, [Define if you want Serial port used.])
|
||||
fi
|
||||
|
||||
if test "$alsa" != yes -a "$oss" != yes -a "$portaudio" != yes; then
|
||||
if test $HAS_PORTAUDIO_H -eq 1; then
|
||||
[portaudio=yes];
|
||||
@ -235,23 +259,17 @@ if test "$alsa" = yes; then
|
||||
AC_DEFINE(USE_ALSA, 1, [Define if you want ALSA used.])
|
||||
AC_SUBST(AUDIO, "start_alsa.c")
|
||||
LDFLAGS="${LDFLAGS} -lasound"
|
||||
CFLAGS="${CFLAGS} -DUSE_ALSA"
|
||||
CPPFLAGS="${CPPFLAGS} -DUSE_ALSA"
|
||||
fi
|
||||
|
||||
if test "$oss" = yes; then
|
||||
AC_DEFINE(USE_OSS, 1, [Define if you want OSS used.])
|
||||
AC_SUBST(AUDIO, "start_oss.c")
|
||||
CFLAGS="${CFLAGS} -DUSE_OSS"
|
||||
CPPFLAGS="${CPPFLAGS} -DUSE_OSS"
|
||||
fi
|
||||
|
||||
if test "$portaudio" = yes; then
|
||||
AC_DEFINE(USE_PORTAUDIO, 1, [Define if you want PORTAUDIO used.])
|
||||
AC_SUBST(AUDIO, "a2d.f90 jtaudio.c start_portaudio.c")
|
||||
LDFLAGS="${LDFLAGS} -lportaudio -lsamplerate"
|
||||
CFLAGS="${CFLAGS} -DUSE_PORTAUDIO"
|
||||
CPPFLAGS="${CPPFLAGS} -DUSE_PORTAUDIO"
|
||||
fi
|
||||
|
||||
dnl set conf flags
|
||||
@ -302,24 +320,30 @@ AC_SUBST(CPPFLAGS, "${CPPFLAGS}")
|
||||
AC_SUBST(LDFLAGS, "${LDFLAGS}")
|
||||
AC_SUBST(CFLAGS)
|
||||
|
||||
|
||||
|
||||
AC_OUTPUT
|
||||
AC_OUTPUT([Makefile])
|
||||
dnl do summary
|
||||
|
||||
echo
|
||||
echo
|
||||
|
||||
if test $portaudio == "yes"; then
|
||||
echo "Using portaudio";
|
||||
echo "Using portaudio.";
|
||||
fi
|
||||
|
||||
if test $alsa == "yes"; then
|
||||
echo "Using alsa";
|
||||
echo "Using alsa.";
|
||||
fi
|
||||
|
||||
if test $oss == "yes"; then
|
||||
echo "Using oss";
|
||||
echo "Using oss.";
|
||||
fi
|
||||
|
||||
if test $serial == "yes"; then
|
||||
echo "Using serial port for ptt.";
|
||||
fi
|
||||
|
||||
if test $parallel == "yes"; then
|
||||
echo "Using parallel port for ptt.";
|
||||
fi
|
||||
|
||||
echo
|
||||
|
333
ptt_unix.c
333
ptt_unix.c
@ -1,17 +1,58 @@
|
||||
/*
|
||||
* WSJT is Copyright (c) 2001-2006 by Joseph H. Taylor, Jr., K1JT,
|
||||
* and is licensed under the GNU General Public License (GPL).
|
||||
*
|
||||
* Code used from cwdaemon for parallel port ptt only.
|
||||
*
|
||||
* cwdaemon - morse sounding daemon for the parallel or serial port
|
||||
* Copyright (C) 2002 -2005 Joop Stakenborg <pg4i@amsat.org>
|
||||
* and many authors, see the AUTHORS file.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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 Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include <unistd.h>
|
||||
#include <stdio.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include "conf.h" /* XXX Could use CFLAGS later instead --db */
|
||||
|
||||
#ifdef HAVE_SYS_PARAM_H
|
||||
#include <sys/param.h>
|
||||
# if HAVE_STDIO_H
|
||||
# include <stdio.h>
|
||||
#endif
|
||||
#if STDC_HEADERS
|
||||
# include <stdlib.h>
|
||||
# include <stddef.h>
|
||||
#else
|
||||
# if HAVE_STDLIB_H
|
||||
# include <stdlib.h>
|
||||
# endif
|
||||
#endif
|
||||
#if HAVE_UNISTD_H
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
#if HAVE_SYS_IOCTL_H
|
||||
# include <sys/ioctl.h>
|
||||
#endif
|
||||
#if HAVE_FCNTL_H
|
||||
# include <fcntl.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SYS_STAT_H
|
||||
# include <sys/stat.h>
|
||||
#endif
|
||||
#if (defined(__unix__) || defined(unix)) && !defined(USG)
|
||||
# include <sys/param.h>
|
||||
#endif
|
||||
|
||||
int fd; /* Used for both serial and parallel */
|
||||
|
||||
#ifdef USE_SERIAL
|
||||
|
||||
/* First cut, note that this only distinguishes Linux from BSDs,
|
||||
* it will be done better later on using configure. N.B. that OSX
|
||||
@ -33,7 +74,7 @@ ptt_(int *nport, int *ntx, int *iptt)
|
||||
{
|
||||
static int nopen=0;
|
||||
int control = TIOCM_RTS | TIOCM_DTR;
|
||||
int fd;
|
||||
|
||||
char s[TTYNAME_SIZE];
|
||||
|
||||
if(*nport < 0) {
|
||||
@ -68,3 +109,275 @@ ptt_(int *nport, int *ntx, int *iptt)
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef USE_PARALLEL
|
||||
|
||||
#ifdef HAVE_LINUX_PPDEV_H
|
||||
# include <linux/ppdev.h>
|
||||
# include <linux/parport.h>
|
||||
#endif
|
||||
#ifdef HAVE_DEV_PPBUS_PPI_H
|
||||
# include <dev/ppbus/ppi.h>
|
||||
# include <dev/ppbus/ppbconf.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_STAT_H
|
||||
# include <sys/stat.h>
|
||||
#endif
|
||||
#if (defined(__unix__) || defined(unix)) && !defined(USG)
|
||||
# include <sys/param.h>
|
||||
#endif
|
||||
|
||||
/* parport functions */
|
||||
|
||||
int lp_reset (int fd);
|
||||
int lp_ptt (int fd, int onoff);
|
||||
|
||||
/*
|
||||
* dev_is_parport(name): check to see whether 'name' is a parallel
|
||||
* port type character device. Returns non-zero if the device is
|
||||
* capable of use for a parallel port based keyer, and zero if it
|
||||
* is not. Unfortunately, this is platform specific.
|
||||
*/
|
||||
|
||||
#if defined(HAVE_LINUX_PPDEV_H) /* Linux (ppdev) */
|
||||
|
||||
int
|
||||
dev_is_parport(const char *fname)
|
||||
{
|
||||
char nm[MAXPATHLEN];
|
||||
struct stat st;
|
||||
int fd, m;
|
||||
|
||||
m = snprintf(nm, sizeof(nm), "/dev/%s", fname);
|
||||
if (m >= sizeof(nm))
|
||||
return (-1);
|
||||
if ((fd = open(nm, O_RDWR | O_NONBLOCK)) == -1)
|
||||
return (-1);
|
||||
if (fstat(fd, &st) == -1)
|
||||
goto out;
|
||||
if ((st.st_mode & S_IFMT) != S_IFCHR)
|
||||
goto out;
|
||||
if (ioctl(fd, PPGETMODE, &m) == -1)
|
||||
goto out;
|
||||
return (fd);
|
||||
out:
|
||||
close(fd);
|
||||
return (-1);
|
||||
}
|
||||
|
||||
#elif defined(HAVE_DEV_PPBUS_PPI_H) /* FreeBSD (ppbus/ppi) */
|
||||
|
||||
int
|
||||
dev_is_parport(const char *fname)
|
||||
{
|
||||
char nm[MAXPATHLEN];
|
||||
struct stat st;
|
||||
unsigned char c;
|
||||
int fd, m;
|
||||
|
||||
m = snprintf(nm, sizeof(nm), "/dev/%s", fname);
|
||||
if (m >= sizeof(nm))
|
||||
return (-1);
|
||||
if ((fd = open(nm, O_RDWR | O_NONBLOCK)) == -1)
|
||||
return (-1);
|
||||
if (fstat(fd, &st) == -1)
|
||||
goto out;
|
||||
if ((st.st_mode & S_IFMT) != S_IFCHR)
|
||||
goto out;
|
||||
if (ioctl(fd, PPISSTATUS, &c) == -1)
|
||||
goto out;
|
||||
return (fd);
|
||||
out:
|
||||
close(fd);
|
||||
return (-1);
|
||||
}
|
||||
|
||||
#else /* Fallback (nothing) */
|
||||
|
||||
int
|
||||
dev_is_parport(const char *fname)
|
||||
{
|
||||
return (-1);
|
||||
}
|
||||
|
||||
#endif
|
||||
/* Linux wrapper around PPFCONTROL */
|
||||
#ifdef HAVE_LINUX_PPDEV_H
|
||||
static void
|
||||
parport_control (int fd, unsigned char controlbits, int values)
|
||||
{
|
||||
struct ppdev_frob_struct frob;
|
||||
frob.mask = controlbits;
|
||||
frob.val = values;
|
||||
|
||||
if (ioctl (fd, PPFCONTROL, &frob) == -1)
|
||||
{
|
||||
fprintf(stderr, "Parallel port PPFCONTROL");
|
||||
exit (1);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/* FreeBSD wrapper around PPISCTRL */
|
||||
#ifdef HAVE_DEV_PPBUS_PPI_H
|
||||
static void
|
||||
parport_control (int fd, unsigned char controlbits, int values)
|
||||
{
|
||||
unsigned char val;
|
||||
|
||||
if (ioctl (fd, PPIGCTRL, &val) == -1)
|
||||
{
|
||||
fprintf(stderr, "Parallel port PPIGCTRL");
|
||||
exit (1);
|
||||
}
|
||||
|
||||
val &= ~controlbits;
|
||||
val |= values;
|
||||
|
||||
if (ioctl (fd, PPISCTRL, &val) == -1)
|
||||
{
|
||||
fprintf(stderr, "Parallel port PPISCTRL");
|
||||
exit (1);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/* open port and setup ppdev */
|
||||
int
|
||||
lp_init (int fd)
|
||||
{
|
||||
#ifdef HAVE_LINUX_PPDEV_H
|
||||
int mode;
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_LINUX_PPDEV_H
|
||||
mode = PARPORT_MODE_PCSPP;
|
||||
|
||||
if (ioctl (fd, PPSETMODE, &mode) == -1)
|
||||
{
|
||||
fprintf(stderr, "Setting parallel port mode");
|
||||
close (fd);
|
||||
exit (1);
|
||||
}
|
||||
|
||||
if (ioctl (fd, PPEXCL, NULL) == -1)
|
||||
{
|
||||
fprintf(stderr, "Parallel port %s is already in use", dev->desc);
|
||||
close (fd);
|
||||
exit (1);
|
||||
}
|
||||
if (ioctl (fd, PPCLAIM, NULL) == -1)
|
||||
{
|
||||
fprintf(stderr, "Claiming parallel port %s", dev->desc);
|
||||
debug ("HINT: did you unload the lp kernel module?");
|
||||
debug ("HINT: perhaps there is another cwdaemon running?");
|
||||
close (fd);
|
||||
exit (1);
|
||||
}
|
||||
|
||||
/* Enable CW & PTT - /STROBE bit (pin 1) */
|
||||
parport_control (fd, PARPORT_CONTROL_STROBE, PARPORT_CONTROL_STROBE);
|
||||
#endif
|
||||
#ifdef HAVE_DEV_PPBUS_PPI_H
|
||||
parport_control (fd, STROBE, STROBE);
|
||||
#endif
|
||||
lp_reset (fd);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* release ppdev and close port */
|
||||
int
|
||||
lp_free (int fd)
|
||||
{
|
||||
#ifdef HAVE_LINUX_PPDEV_H
|
||||
lp_reset (fd);
|
||||
|
||||
/* Disable CW & PTT - /STROBE bit (pin 1) */
|
||||
parport_control (fd, PARPORT_CONTROL_STROBE, 0);
|
||||
|
||||
ioctl (fd, PPRELEASE);
|
||||
#endif
|
||||
#ifdef HAVE_DEV_PPBUS_PPI_H
|
||||
/* Disable CW & PTT - /STROBE bit (pin 1) */
|
||||
parport_control (fd, STROBE, 0);
|
||||
#endif
|
||||
close (fd);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* set to a known state */
|
||||
int
|
||||
lp_reset (int fd)
|
||||
{
|
||||
#if defined (HAVE_LINUX_PPDEV_H) || defined (HAVE_DEV_PPBUS_PPI_H)
|
||||
lp_ptt (fd, 0);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* SSB PTT keying - /INIT bit (pin 16) (inverted) */
|
||||
int
|
||||
lp_ptt (int fd, int onoff)
|
||||
{
|
||||
#ifdef HAVE_LINUX_PPDEV_H
|
||||
if (onoff == 1)
|
||||
parport_control (fd, PARPORT_CONTROL_INIT,
|
||||
PARPORT_CONTROL_INIT);
|
||||
else
|
||||
parport_control (fd, PARPORT_CONTROL_INIT, 0);
|
||||
#endif
|
||||
#ifdef HAVE_DEV_PPBUS_PPI_H
|
||||
if (onoff == 1)
|
||||
parport_control (fd, nINIT,
|
||||
nINIT);
|
||||
else
|
||||
parport_control (fd, nINIT, 0);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* XXX I am totally unsure of this, LPNAME should come from
|
||||
* the WSJT.INI instead but for now this should work -- db
|
||||
*/
|
||||
#ifdef BSD
|
||||
#define LPNAME "/dev/lpt%d"
|
||||
#else
|
||||
#define LPNAME "/dev/lp%d"
|
||||
#endif
|
||||
#define LPNAME_SIZE (sizeof(LPNAME))
|
||||
|
||||
int
|
||||
ptt_(int *nport, int *ntx, int *iptt)
|
||||
{
|
||||
static int nopen=0;
|
||||
int fd;
|
||||
char s[LPNAME_SIZE];
|
||||
|
||||
if(*nport < 0) {
|
||||
*iptt=*ntx;
|
||||
return(0);
|
||||
}
|
||||
|
||||
if(*ntx && (!nopen)) {
|
||||
snprintf(s, LPNAME_SIZE, LPNAME, (*nport) - 1); /* Comport 1 == dev 0 */
|
||||
s[LPNAME_SIZE] = '\0';
|
||||
|
||||
if ((fd = dev_is_parport(s)) < 0) {
|
||||
fprintf(stderr, "Can't use %s.", s);
|
||||
return(1);
|
||||
}
|
||||
|
||||
if(*ntx && nopen) {
|
||||
lp_ptt(fd, 1);
|
||||
*iptt=1;
|
||||
} else {
|
||||
lp_ptt(fd, 0);
|
||||
close(fd);
|
||||
*iptt=0;
|
||||
nopen=0;
|
||||
}
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
#endif
|
||||
|
@ -4,7 +4,6 @@
|
||||
#include <alsa/asoundlib.h>
|
||||
#include <inttypes.h>
|
||||
#include <time.h>
|
||||
#include "conf.h"
|
||||
|
||||
#if 0
|
||||
#define ALSA_LOG
|
||||
|
@ -6,7 +6,6 @@
|
||||
#include <sys/time.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/soundcard.h>
|
||||
#include "conf.h"
|
||||
#include <string.h>
|
||||
|
||||
#define AUDIOBUFSIZE 4096
|
||||
|
@ -3,7 +3,6 @@
|
||||
#include <pthread.h>
|
||||
#include <inttypes.h>
|
||||
#include <time.h>
|
||||
#include "conf.h"
|
||||
|
||||
extern void decode1_(int *iarg);
|
||||
extern void a2d_(int *iarg);
|
||||
|
Loading…
Reference in New Issue
Block a user