Finally rid myself of the C preprocessor. Took a moderately-developed

preproc.py script from another project.  Had to further develop it to
get around the amazingly complicated preprocessor usage in the scmos
subdirectory.  Needed to add handling of parameterized definitions;
could not figure out how to align the syntax used in scmos/extract_template
with any consistent syntax.  Gave up and rewrote some of the contents of
extract_template to avoid the more ambiguous usage.  All of this is to
support a completely deprecated scmos.tech.  However, it does avoid both
the M4 and cpp preprocessors altogether.  Also did auto-detection of
python3 in the configure script for use of the preproc.py preprocessor,
and applied the same preprocessor to the macro definitions.
This commit is contained in:
Tim Edwards
2020-02-19 14:25:58 -05:00
parent 6049b7e00e
commit 2db6a6849a
15 changed files with 436 additions and 3577 deletions
+99 -125
View File
@@ -628,7 +628,7 @@ OA_LIBS
OA
MAGIC_REVISION
MAGIC_VERSION
SCPP
MSED
MCPP
LD_RUN_PATH
SHLIB_CFLAGS
@@ -672,12 +672,11 @@ X_LIBS
X_PRE_LIBS
X_CFLAGS
XMKMF
PYTHON3
CSH
GCORE
EGREP
GREP
PYTHON3
M4
RANLIB
INSTALL_DATA
INSTALL_SCRIPT
@@ -4038,114 +4037,6 @@ else
fi
for ac_prog in gm4 gnum4 m4
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_path_M4+:} false; then :
$as_echo_n "(cached) " >&6
else
case $M4 in
[\\/]* | ?:[\\/]*)
ac_cv_path_M4="$M4" # Let the user override the test with a path.
;;
*)
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_path_M4="$as_dir/$ac_word$ac_exec_ext"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
;;
esac
fi
M4=$ac_cv_path_M4
if test -n "$M4"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $M4" >&5
$as_echo "$M4" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
test -n "$M4" && break
done
test -n "$M4" || M4="no"
if test x$M4 = xno; then
as_fn_error $? "M4 is required" "$LINENO" 5
fi
# Extract the first word of "python3", so it can be a program name with args.
set dummy python3; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_path_PYTHON3+:} false; then :
$as_echo_n "(cached) " >&6
else
case $PYTHON3 in
[\\/]* | ?:[\\/]*)
ac_cv_path_PYTHON3="$PYTHON3" # Let the user override the test with a path.
;;
*)
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_path_PYTHON3="$as_dir/$ac_word$ac_exec_ext"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
test -z "$ac_cv_path_PYTHON3" && ac_cv_path_PYTHON3="no"
;;
esac
fi
PYTHON3=$ac_cv_path_PYTHON3
if test -n "$PYTHON3"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYTHON3" >&5
$as_echo "$PYTHON3" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
if test "x${PYTHON3}" == "x"; then
if test "$CPP" = "$CC -E" ; then
MCPP="$CPP -x c"
fi
else
MCPP="\${MAGICDIR}/scripts/preproc.py"
fi
if test "$CPP" = "$CC -E" ; then
SCPP="$CPP -x c"
else
SCPP="$CPP"
fi
#------------------------------------------------------------
# AC_PROG_LD - find the path to the GNU or non-GNU linker
@@ -5343,6 +5234,7 @@ use_libglu="-lGLU"
usingTcl=1
usingOA=0
usingCairo=1
usingPython3=1
# Extract the first word of "gcore", so it can be a program name with args.
@@ -5434,6 +5326,65 @@ if test "x${CSH}" = "x"; then
as_fn_error $? "cannot find /bin/csh---cannot compile!" "$LINENO" 5
fi
# Extract the first word of "python3", so it can be a program name with args.
set dummy python3; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_path_PYTHON3+:} false; then :
$as_echo_n "(cached) " >&6
else
case $PYTHON3 in
[\\/]* | ?:[\\/]*)
ac_cv_path_PYTHON3="$PYTHON3" # Let the user override the test with a path.
;;
*)
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_path_PYTHON3="$as_dir/$ac_word$ac_exec_ext"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
test -z "$ac_cv_path_PYTHON3" && ac_cv_path_PYTHON3="no"
;;
esac
fi
PYTHON3=$ac_cv_path_PYTHON3
if test -n "$PYTHON3"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYTHON3" >&5
$as_echo "$PYTHON3" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
if test "x${PYTHON3}" == "x"; then
usingPython3=
if test "$CPP" = "$CC -E" ; then
MCPP="$CPP -x c"
MSED="sed -e 's/\\/\\\\/'"
else
MCPP="$CPP"
MSED="sed -e 's/\\/\\\\/'"
fi
else
MCPP="\${MAGICDIR}/scripts/preproc.py -ccomm"
MSED="cat"
usingPython3=1
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for X" >&5
$as_echo_n "checking for X... " >&6; }
@@ -9470,6 +9421,19 @@ else
echo
fi
${ECHO_N} "Python3: "
if test $usingPython3 ; then
echo "yes"
else
echo "no"
echo
echo " Magic installation will use the gcc preprocessor for forming"
echo " the default SCMOS technology files and the macro definitions."
echo " This usually works, but in case of preprocessor failure, you"
echo " may need python3 installed."
echo
fi
${ECHO_N} "OpenGL: "
if test $usingOGL ; then
echo "yes"
@@ -9482,14 +9446,18 @@ if test $usingOGL ; then
else
echo "no"
echo
echo " OpenGL graphics are considerably better than the standard 8-bit"
echo " and 24-bit X11 graphics, provided that you have a video card and"
echo " driver supporting accelerated OpenGL graphics. If you get this"
echo " message, you may need to download OpenGL libraries and header"
echo " files, which are usually available from the video card manufacturer."
echo " Magic with un-accelerated OpenGL, such as using Mesa GL without"
echo " a supported graphics card, is usually a very bad combination."
echo
if test $usingCairo ; then
echo " Cairo graphics are available so OpenGL is purely optional."
else
echo " OpenGL graphics are considerably better than the standard 8-bit"
echo " and 24-bit X11 graphics, provided that you have a video card and"
echo " driver supporting accelerated OpenGL graphics. If you get this"
echo " message, you may need to download OpenGL libraries and header"
echo " files, which are usually available from the video card manufacturer."
echo " Magic with un-accelerated OpenGL, such as using Mesa GL without"
echo " a supported graphics card, is usually a very bad combination."
echo
fi
fi
${ECHO_N} "Cairo: "
@@ -9498,12 +9466,18 @@ if test $usingCairo ; then
else
echo "no"
echo
echo " Cairo graphics are considerably better than the standard 8-bit"
echo " and 24-bit X11 graphics, provided that you have a video card and"
echo " driver supporting hardware-accelerated graphics. If you get this"
echo " message, you may need to download Cairo and fontconfig libraries"
echo " and header files, which are usually found in package cairo-devel."
echo
if test $usingOGL ; then
echo " OpenGL graphics are available so Cairo is purely optional"
echo " unless there are issues with the video card driver's"
echo " implementation of OpenGL."
else
echo " Cairo graphics are considerably better than the standard 8-bit"
echo " and 24-bit X11 graphics, provided that you have a video card and"
echo " driver supporting hardware-accelerated graphics. If you get this"
echo " message, you may need to download Cairo and fontconfig libraries"
echo " and header files, which are usually found in package cairo-devel."
echo
fi
fi
if test $usingTcl ; then