Snial
Well-known member
First a recap: it's possible to use AirTalk to connect to miniVmac version 37 (beta) via a host system and magically it can see an AppleTalk connection on a physical classic Mac (i.e. one with a proper serial port, i.e. every Mac prior to the iMac G3/233). However, because of the coarse emulation granularity of miniVMac (basically it executes 68000 code in 1/60.15th of a second blocks), there's a lot of latency, which in turn has a real impact on performance at 1x speed. And this is explained in one of the AirTalk threads (not this one, but I haven't tracked down the right thread).
The PCE/macplus emulator has a much finer emulation granularity (it executes 1ms's worth of code at a time, and I've reduced that to 500µs on my PI 2; it could probably go about 3x lower on the PI 5 I'm using to write this); so that'd reduce the latency and improve AppleTalk performance, when running MacPlus emulation at 1x speed (i.e. for an authentic feel).
However, I've been having problems trying to get PCE/macplus to recognise support for this AppleTalk connection. PCE/macplus uses an autoconf generated configure script where you can pass setup options to generate a customised makefile. For example, if I do:
then my intention is that Linux's tcp connection (telnet) would be mapped to serial port 0 (modem) and appletalk/udp to serial port 1 (printer).
I know I could modify the makefile directly, but I'd like to do it properly, because otherwise if people grab my (future) fork, they'll just start by running configure and then it'll all get messed up and if someone added another feature properly the same problem would occur.
The trouble is, I can't get it to work. I've scoured the files I thought referenced --enable-char-tcp and duplicated it for --enable-char-aptk and as far as I can tell, all the relevant information is in the configure script itself. I've even added a dummy appletalk driver in ....MacEmuPce/src/drivers/char which duplicates tcp, but with the function names and appropriate file names for appletalk (aptk).
It all looks OK initially, the script generates a confdefs.h file containing:
So, PCE_ENABLE_CHAR_APTK is there, which would enable the compilation of the code in the .c files from make. Then it appears to generate another file called config.status which contains a whole pile of interwoven shell, sed and awk scripting, but the critical part is that it embeds a couple of arrays called D and S, which also contain flags for enabling CHAR_x drivers:
Then what the awk / sed script appears to do is checks these entries against some other list of features, and filters out the ones it can't possibly support in order to produce the file src/config.h and then it filters out PCE_ENABLE_CHAR_APTK to get:
And I've no idea where it gets this other list of features from in order to filter it out. Also, I'm like 99% ignorant of sed and awk - it all looks like BrainF*** to me. I'm wondering if there's someone else who knows enough about autoconf, configure or PCE/macplus who can tell me where it might be getting those other list of features from. I've attached the configure.sh.
The PCE/macplus emulator has a much finer emulation granularity (it executes 1ms's worth of code at a time, and I've reduced that to 500µs on my PI 2; it could probably go about 3x lower on the PI 5 I'm using to write this); so that'd reduce the latency and improve AppleTalk performance, when running MacPlus emulation at 1x speed (i.e. for an authentic feel).
However, I've been having problems trying to get PCE/macplus to recognise support for this AppleTalk connection. PCE/macplus uses an autoconf generated configure script where you can pass setup options to generate a customised makefile. For example, if I do:
./configure --with-sdl2 --enable-sound-sdl2 --enable-char-tcp --enable-char-aptk
then my intention is that Linux's tcp connection (telnet) would be mapped to serial port 0 (modem) and appletalk/udp to serial port 1 (printer).
I know I could modify the makefile directly, but I'd like to do it properly, because otherwise if people grab my (future) fork, they'll just start by running configure and then it'll all get messed up and if someone added another feature properly the same problem would occur.
The trouble is, I can't get it to work. I've scoured the files I thought referenced --enable-char-tcp and duplicated it for --enable-char-aptk and as far as I can tell, all the relevant information is in the configure script itself. I've even added a dummy appletalk driver in ....MacEmuPce/src/drivers/char which duplicates tcp, but with the function names and appropriate file names for appletalk (aptk).
It all looks OK initially, the script generates a confdefs.h file containing:
Code:
/* confdefs.h */
#define PACKAGE_NAME ""
#define PACKAGE_TARNAME ""
#define PACKAGE_VERSION ""
#define PACKAGE_STRING ""
#define PACKAGE_BUGREPORT ""
#define PACKAGE_URL ""
#define PCE_VERSION_MAJ 0
#define PCE_VERSION_MIN 2
#define PCE_VERSION_MIC 2
#define PCE_VERSION_STR "20220220-991c55d9"
#define PCE_HOST_LINUX 1
#define HAVE_STDIO_H 1
#define HAVE_STDLIB_H 1
#define HAVE_STRING_H 1
#define HAVE_INTTYPES_H 1
#define HAVE_STDINT_H 1
#define HAVE_STRINGS_H 1
#define HAVE_SYS_STAT_H 1
#define HAVE_SYS_TYPES_H 1
#define HAVE_UNISTD_H 1
#define STDC_HEADERS 1
#define HAVE_ARPA_INET_H 1
#define HAVE_FCNTL_H 1
#define HAVE_LINUX_IF_TUN_H 1
#define HAVE_LINUX_TCP_H 1
#define HAVE_LIMITS_H 1
#define HAVE_NETDB_H 1
#define HAVE_NETINET_IN_H 1
#define HAVE_POLL_H 1
#define HAVE_SYS_IOCTL_H 1
#define HAVE_SYS_POLL_H 1
#define HAVE_SYS_SOCKET_H 1
#define HAVE_SYS_SOUNDCARD_H 1
#define HAVE_SYS_STAT_H 1
#define HAVE_SYS_TIME_H 1
#define HAVE_SYS_TYPES_H 1
#define HAVE_TERMIOS_H 1
#define HAVE_UNISTD_H 1
#define HAVE_STDINT_H 1
#define HAVE_INTTYPES_H 1
#define HAVE_FSEEKO 1
#define HAVE_FTRUNCATE 1
#define HAVE_FUTIMES 1
#define HAVE_GETTIMEOFDAY 1
#define HAVE_NANOSLEEP 1
#define HAVE_SLEEP 1
#define HAVE_USLEEP 1
#define PCE_ENABLE_X11 1
#define PCE_ENABLE_SDL 1
#define PCE_ENABLE_SDL2 1
#define PCE_LARGE_FILE 1
#define PCE_BUILD_ATARIST 1
#define PCE_BUILD_CPM80 1
#define PCE_BUILD_IBMPC 1
#define PCE_BUILD_MACPLUS 1
#define PCE_BUILD_RC759 1
#define PCE_BUILD_SIM405 1
#define PCE_BUILD_SIMS32 1
#define PCE_BUILD_SIMARM 1
#define PCE_BUILD_VIC20 1
#define PCE_ENABLE_TUN 1
#define PCE_ENABLE_CHAR_POSIX 1
#define PCE_ENABLE_CHAR_PPP 1
#define PCE_ENABLE_CHAR_PTY 1
#define PCE_ENABLE_CHAR_SLIP 1
#define PCE_ENABLE_CHAR_TCP 1
#define PCE_ENABLE_CHAR_APTK 1
#define PCE_ENABLE_CHAR_TIOS 1
#define PCE_ENABLE_SOUND_OSS 1
#define PCE_DIR_ETC "NONE/etc"
#define PCE_DIR_DATA "NONE/share"
So, PCE_ENABLE_CHAR_APTK is there, which would enable the compilation of the code in the .c files from make. Then it appears to generate another file called config.status which contains a whole pile of interwoven shell, sed and awk scripting, but the critical part is that it embeds a couple of arrays called D and S, which also contain flags for enabling CHAR_x drivers:
Code:
echo 'BEGIN {' >"$ac_tmp/subs1.awk" &&
cat >>"$ac_tmp/subs1.awk" <<\_ACAWK &&
S["LTLIBOBJS"]=""
S["LIBOBJS"]=""
S["PCE_DIR_DATA"]="NONE/share"
S["PCE_DIR_ETC"]="NONE/etc"
S["PCE_READLINE_LIBS"]=""
S["PCE_ENABLE_READLINE"]="0"
S["PCE_ENABLE_SOUND_OSS"]="1"
S["PCE_ENABLE_CHAR_WINCOM"]="0"
S["PCE_ENABLE_CHAR_TIOS"]="1"
S["PCE_ENABLE_CHAR_APTK"]="1"
S["PCE_ENABLE_CHAR_TCP"]="1"
S["PCE_ENABLE_CHAR_SLIP"]="1"
S["PCE_ENABLE_CHAR_PTY"]="1"
S["PCE_ENABLE_CHAR_PPP"]="1"
S["PCE_ENABLE_CHAR_POSIX"]="1"
S["PCE_ENABLE_TUN"]="1"
S["PCE_BUILD_VIC20"]="1"
S["PCE_BUILD_SIMARM"]="1"
S["PCE_BUILD_SIMS32"]="1"
S["PCE_BUILD_SIM405"]="1"
S["PCE_BUILD_RC759"]="1"
S["PCE_BUILD_MACPLUS_ROM"]="0"
S["PCE_BUILD_MACPLUS"]="1"
S["PCE_BUILD_IBMPC_ROM"]="0"
S["PCE_BUILD_IBMPC"]="1"
S["PCE_BUILD_CPM80"]="1"
S["PCE_BUILD_ATARIST"]="1"
S["PCE_LARGE_FILE"]="1"
S["PCE_SDL_LIBS"]="-lSDL2"
S["PCE_SDL_CFLAGS"]="-I/usr/include/SDL2 -D_REENTRANT"
S["PCE_ENABLE_SDL2"]="1"
S["PCE_ENABLE_SDL1"]="0"
S["PCE_ENABLE_SDL"]="1"
S["PCE_X11_LIBS"]="-lX11"
S["PCE_X11_CFLAGS"]=""
S["PCE_ENABLE_X11"]="1"
S["CPP"]="gcc -E"
S["XMKMF"]=""
S["PCE_HAVE_INTTYPES_H"]="1"
S["PCE_HAVE_STDINT_H"]="1"
S["PCE_HAVE_IHEX"]="0"
S["IHEX"]=""
S["PCE_HAVE_NASM"]="0"
S["NASM"]=""
S["LN_S"]="ln -s"
S["SET_MAKE"]=""
S["RANLIB"]="ranlib"
S["AR"]="/usr/bin/ar"
S["INSTALL_DATA"]="${INSTALL} -m 644"
S["INSTALL_SCRIPT"]="${INSTALL}"
S["INSTALL_PROGRAM"]="${INSTALL}"
S["OBJEXT"]="o"
S["EXEEXT"]=""
S["ac_ct_CC"]="gcc"
S["CPPFLAGS"]=""
S["LDFLAGS"]=""
S["CFLAGS"]="-g -O2"
S["CC"]="gcc"
S["PCE_HOST_SPARC"]="0"
S["PCE_HOST_PPC"]="0"
S["PCE_HOST_IA32"]="0"
S["PCE_HOST_NETBSD"]="0"
S["PCE_HOST_SUNOS"]="0"
S["PCE_HOST_WINDOWS"]="0"
S["PCE_HOST_LINUX"]="1"
S["host_os"]="linux-gnu"
S["host_vendor"]="unknown"
S["host_cpu"]="aarch64"
S["host"]="aarch64-unknown-linux-gnu"
S["build_os"]="linux-gnu"
S["build_vendor"]="unknown"
S["build_cpu"]="aarch64"
S["build"]="aarch64-unknown-linux-gnu"
S["PCE_VERSION_STR"]="20220220-991c55d9"
S["PCE_VERSION_MIC"]="2"
S["PCE_VERSION_MIN"]="2"
S["PCE_VERSION_MAJ"]="0"
S["target_alias"]=""
S["host_alias"]=""
S["build_alias"]=""
S["LIBS"]=""
S["ECHO_T"]=""
S["ECHO_N"]="-n"
S["ECHO_C"]=""
S["DEFS"]="-DHAVE_CONFIG_H"
S["mandir"]="${datarootdir}/man"
S["localedir"]="${datarootdir}/locale"
S["libdir"]="${exec_prefix}/lib"
S["psdir"]="${docdir}"
S["pdfdir"]="${docdir}"
S["dvidir"]="${docdir}"
S["htmldir"]="${docdir}"
S["infodir"]="${datarootdir}/info"
S["docdir"]="${datarootdir}/doc/${PACKAGE}"
S["oldincludedir"]="/usr/include"
S["includedir"]="${prefix}/include"
S["runstatedir"]="${localstatedir}/run"
S["localstatedir"]="${prefix}/var"
S["sharedstatedir"]="${prefix}/com"
S["sysconfdir"]="${prefix}/etc"
S["datadir"]="${datarootdir}"
S["datarootdir"]="${prefix}/share"
S["libexecdir"]="${exec_prefix}/libexec"
S["sbindir"]="${exec_prefix}/sbin"
S["bindir"]="${exec_prefix}/bin"
S["program_transform_name"]="s,x,x,"
S["prefix"]="/usr/local"
S["exec_prefix"]="${prefix}"
S["PACKAGE_URL"]=""
S["PACKAGE_BUGREPORT"]=""
S["PACKAGE_STRING"]=""
S["PACKAGE_VERSION"]=""
S["PACKAGE_TARNAME"]=""
S["PACKAGE_NAME"]=""
S["PATH_SEPARATOR"]=":"
S["SHELL"]="/bin/bash"
_ACAWK
cat >>"$ac_tmp/subs1.awk" <<_ACAWK &&
for (key in S) S_is_set[key] = 1
FS = ""
}
{
line = $ 0
nfields = split(line, field, "@")
substed = 0
len = length(field[1])
for (i = 2; i < nfields; i++) {
key = field[i]
keylen = length(key)
if (S_is_set[key]) {
value = S[key]
line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3)
len += length(value) + length(field[++i])
substed = 1
} else
len += 1 + keylen
}
print line
}
_ACAWK
if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then
sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g"
else
cat
fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \
|| as_fn_error $? "could not setup config files machinery" "$LINENO" 5
fi # test -n "$CONFIG_FILES"
# Set up the scripts for CONFIG_HEADERS section.
# No need to generate them if there are no CONFIG_HEADERS.
# This happens for instance with `./config.status Makefile'.
if test -n "$CONFIG_HEADERS"; then
cat >"$ac_tmp/defines.awk" <<\_ACAWK ||
BEGIN {
D["PACKAGE_NAME"]=" \"\""
D["PACKAGE_TARNAME"]=" \"\""
D["PACKAGE_VERSION"]=" \"\""
D["PACKAGE_STRING"]=" \"\""
D["PACKAGE_BUGREPORT"]=" \"\""
D["PACKAGE_URL"]=" \"\""
D["PCE_VERSION_MAJ"]=" 0"
D["PCE_VERSION_MIN"]=" 2"
D["PCE_VERSION_MIC"]=" 2"
D["PCE_VERSION_STR"]=" \"20220220-991c55d9\""
D["PCE_HOST_LINUX"]=" 1"
D["HAVE_STDIO_H"]=" 1"
D["HAVE_STDLIB_H"]=" 1"
D["HAVE_STRING_H"]=" 1"
D["HAVE_INTTYPES_H"]=" 1"
D["HAVE_STDINT_H"]=" 1"
D["HAVE_STRINGS_H"]=" 1"
D["HAVE_SYS_STAT_H"]=" 1"
D["HAVE_SYS_TYPES_H"]=" 1"
D["HAVE_UNISTD_H"]=" 1"
D["STDC_HEADERS"]=" 1"
D["HAVE_ARPA_INET_H"]=" 1"
D["HAVE_FCNTL_H"]=" 1"
D["HAVE_LINUX_IF_TUN_H"]=" 1"
D["HAVE_LINUX_TCP_H"]=" 1"
D["HAVE_LIMITS_H"]=" 1"
D["HAVE_NETDB_H"]=" 1"
D["HAVE_NETINET_IN_H"]=" 1"
D["HAVE_POLL_H"]=" 1"
D["HAVE_SYS_IOCTL_H"]=" 1"
D["HAVE_SYS_POLL_H"]=" 1"
D["HAVE_SYS_SOCKET_H"]=" 1"
D["HAVE_SYS_SOUNDCARD_H"]=" 1"
D["HAVE_SYS_STAT_H"]=" 1"
D["HAVE_SYS_TIME_H"]=" 1"
D["HAVE_SYS_TYPES_H"]=" 1"
D["HAVE_TERMIOS_H"]=" 1"
D["HAVE_UNISTD_H"]=" 1"
D["HAVE_STDINT_H"]=" 1"
D["HAVE_INTTYPES_H"]=" 1"
D["HAVE_FSEEKO"]=" 1"
D["HAVE_FTRUNCATE"]=" 1"
D["HAVE_FUTIMES"]=" 1"
D["HAVE_GETTIMEOFDAY"]=" 1"
D["HAVE_NANOSLEEP"]=" 1"
D["HAVE_SLEEP"]=" 1"
D["HAVE_USLEEP"]=" 1"
D["PCE_ENABLE_X11"]=" 1"
D["PCE_ENABLE_SDL"]=" 1"
D["PCE_ENABLE_SDL2"]=" 1"
D["PCE_LARGE_FILE"]=" 1"
D["PCE_BUILD_ATARIST"]=" 1"
D["PCE_BUILD_CPM80"]=" 1"
D["PCE_BUILD_IBMPC"]=" 1"
D["PCE_BUILD_MACPLUS"]=" 1"
D["PCE_BUILD_RC759"]=" 1"
D["PCE_BUILD_SIM405"]=" 1"
D["PCE_BUILD_SIMS32"]=" 1"
D["PCE_BUILD_SIMARM"]=" 1"
D["PCE_BUILD_VIC20"]=" 1"
D["PCE_ENABLE_TUN"]=" 1"
D["PCE_ENABLE_CHAR_POSIX"]=" 1"
D["PCE_ENABLE_CHAR_PPP"]=" 1"
D["PCE_ENABLE_CHAR_PTY"]=" 1"
D["PCE_ENABLE_CHAR_SLIP"]=" 1"
D["PCE_ENABLE_CHAR_TCP"]=" 1"
D["PCE_ENABLE_CHAR_APTK"]=" 1"
D["PCE_ENABLE_CHAR_TIOS"]=" 1"
D["PCE_ENABLE_SOUND_OSS"]=" 1"
D["PCE_DIR_ETC"]=" \"NONE/etc\""
D["PCE_DIR_DATA"]=" \"NONE/share\""
Then what the awk / sed script appears to do is checks these entries against some other list of features, and filters out the ones it can't possibly support in order to produce the file src/config.h and then it filters out PCE_ENABLE_CHAR_APTK to get:
C:
/* src/config.h. Generated from config.h.in by configure. */
/*****************************************************************************
* pce *
*****************************************************************************/
/*****************************************************************************
* File name: src/config.h.in *
* Created: 2002-12-16 by Hampa Hug <hampa@hampa.ch> *
* Copyright: (C) 2002-2022 Hampa Hug <hampa@hampa.ch> *
*****************************************************************************/
/*****************************************************************************
* This program is free software. You can redistribute it and / or modify it *
* under the terms of the GNU General Public License version 2 as published *
* by the Free Software Foundation. *
* *
* 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 General *
* Public License for more details. *
*****************************************************************************/
#ifndef PCE_CONFIG_H
#define PCE_CONFIG_H 1
#ifndef _GNU_SOURCE
#define _GNU_SOURCE 1
#endif
#ifndef _NETBSD_SOURCE
#define _NETBSD_SOURCE 1
#endif
#define PCE_LARGE_FILE 1
#ifdef PCE_LARGE_FILE
#ifndef _FILE_OFFSET_BITS
#define _FILE_OFFSET_BITS 64
#endif
#endif
#define HAVE_FCNTL_H 1
#define HAVE_INTTYPES_H 1
#define HAVE_LIMITS_H 1
#define HAVE_STDINT_H 1
#define HAVE_TERMIOS_H 1
#define HAVE_UNISTD_H 1
#define HAVE_LINUX_IF_TUN_H 1
#define HAVE_LINUX_TCP_H 1
#define HAVE_SYS_IOCTL_H 1
#define HAVE_SYS_POLL_H 1
#define HAVE_SYS_SOCKET_H 1
#define HAVE_SYS_SOUNDCARD_H 1
#define HAVE_SYS_STAT_H 1
#define HAVE_SYS_TIME_H 1
#define HAVE_SYS_TYPES_H 1
#define HAVE_FSEEKO 1
#define HAVE_FTRUNCATE 1
#define HAVE_FUTIMES 1
#define HAVE_USLEEP 1
#define HAVE_NANOSLEEP 1
#define HAVE_SLEEP 1
#define HAVE_GETTIMEOFDAY 1
#define PCE_YEAR "2022"
#define PCE_VERSION_MAJ 0
#define PCE_VERSION_MIN 2
#define PCE_VERSION_MIC 2
#define PCE_VERSION_STR "20220220-991c55d9"
#define PCE_HOST_LINUX 1
/** #undef PCE_HOST_WINDOWS **/
/** #undef PCE_HOST_SUNOS **/
/** #undef PCE_HOST_NETBSD **/
/** #undef PCE_HOST_IA32 **/
/** #undef PCE_HOST_PPC **/
/** #undef PCE_HOST_SPARC **/
#define PCE_DIR_ETC "NONE/etc"
#define PCE_BUILD_IBMPC 1
#define PCE_ENABLE_X11 1
#define PCE_ENABLE_SDL 1
/** #undef PCE_ENABLE_SDL1 **/
#define PCE_ENABLE_SDL2 1
/** #undef PCE_ENABLE_READLINE **/
#define PCE_ENABLE_TUN 1
#define PCE_ENABLE_CHAR_POSIX 1
#define PCE_ENABLE_CHAR_PPP 1
#define PCE_ENABLE_CHAR_PTY 1
#define PCE_ENABLE_CHAR_SLIP 1
#define PCE_ENABLE_CHAR_TCP 1
#define PCE_ENABLE_CHAR_TIOS 1
/** #undef PCE_ENABLE_CHAR_WINCOM **/
#define PCE_ENABLE_SOUND_OSS 1
/* directory separator */
#define PCE_DIR_SEP '/'
#endif
And I've no idea where it gets this other list of features from in order to filter it out. Also, I'm like 99% ignorant of sed and awk - it all looks like BrainF*** to me. I'm wondering if there's someone else who knows enough about autoconf, configure or PCE/macplus who can tell me where it might be getting those other list of features from. I've attached the configure.sh.