Ran last commit from the wrong directory and didn't catch most of the
modified files.
diff --git a/scripts/configure b/scripts/configure
index 5841a66..ba4f0c8 100755
--- a/scripts/configure
+++ b/scripts/configure
@@ -587,7 +587,6 @@
 ac_subst_vars='LTLIBOBJS
 LIBOBJS
 EF_STYLE
-MAGIC
 pkgpyexecdir
 pyexecdir
 pkgpythondir
@@ -597,15 +596,19 @@
 PYTHON_PREFIX
 PYTHON_VERSION
 PYTHON
+XSCHEM_PATH
+SKY130_ML_XX_HD_PATH
+OSU_PATH
+MAGIC
 QFLOW_DISABLED
 OPENLANE_DISABLED
 NETGEN_DISABLED
 MAGIC_DISABLED
 KLAYOUT_DISABLED
-SKY130_LINK_TARGETS
 SKY130_DIST_PATH
 SKY130_LOCAL_PATH
 SKY130_SOURCE_PATH
+SKY130_LINK_TARGETS
 target_alias
 host_alias
 build_alias
@@ -647,7 +650,7 @@
 ac_subst_files=''
 ac_user_opts='
 enable_option_checking
-with_sky130_source
+enable_sky130_pdk
 with_sky130_local_path
 with_sky130_dist_path
 with_sky130_link_targets
@@ -656,6 +659,9 @@
 enable_netgen
 enable_openlane
 enable_qflow
+enable_osu_lib
+enable_alpha_lib
+enable_xschem
 with_ef_style
 '
       ac_precious_vars='build_alias
@@ -1271,6 +1277,37 @@
   --disable-option-checking  ignore unrecognized --enable/--with options
   --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
   --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
+  --enable-sky130-pdk=[/path/to/sky130/] --disable-sky130-pdk
+                          "location of the source files for the sky130 (pdks
+                          with a pdk_url file can automatically download them
+                          if the path is omitted)"
+  --enable-klayout
+                Enable or disable klayout [default=enabled]
+
+
+  --enable-magic
+                Enable or disable magic [default=enabled]
+
+
+  --enable-netgen
+                Enable or disable netgen [default=enabled]
+
+
+  --enable-openlane
+                Enable or disable openlane [default=enabled]
+
+
+  --enable-qflow
+                Enable or disable qflow [default=enabled]
+
+
+  --enable-osu-lib[=path] Install osu. If path is omitted, it'll be
+                          downloaded. [default=disabled]
+  --enable-alpha-lib[=path]
+                          Install sky130_ml_xx_hd. If path is omitted, it'll be
+                          downloaded. [default=disabled]
+  --enable-xschem[=path]  Install xschem. If path is omitted, it'll be
+                          downloaded. [default=disabled]
   --enable-klayout --disable-klayout
                           Enable or disable klayout [default=enabled]
   --enable-magic --disable-magic
@@ -1285,12 +1322,10 @@
 Optional Packages:
   --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
   --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
-  --with-sky130-source=/path/to/sky130/source
-                          "location of the source files for sky130"
-  --with-sky130-local-path=/path/to/install/pdks
-                          "run-time location of the PDKs"
-  --with-sky130-dist-path=/path/to/install/pdks
-                          "staging location to install the PDKs for
+  --with-sky130-local-path=/path/to/install/sky130
+                          "run-time location of the PDK"
+  --with-sky130-dist-path=/path/to/install/sky130
+                          "staging location to install the PDK for
                           distribution (optional)"
   --with-sky130-link-targets=none|source
                           "make symbolic links to existing files
@@ -1736,10 +1771,14 @@
 # detect PDKs based on directories that include Makefile.in files
 
 
+# define tools
 # define tools to install setup files for.  This does not imply that the tools are
 # available on the system;  just that open_pdks will install the setup files for them.
+## DO NOT INCLUDE XSCHEM IN THE TOOL LIST. XSCHEM CAN BE INSTALLED IN THE CONFIG SCRIPT
 
 
+mkdir -p ../pdks
+
 # check for the source and install paths for each PDK.
 
 
@@ -1747,31 +1786,102 @@
 $as_echo "$as_me: Found technology directories: sky130" >&6;}
 
 
-    # --with-pdk-source=PDK_SOURCE_PATH
+
+    # --enable-pdk-[pdk]=/path/to/pdk
 
 
-        SKY130_SOURCE_PATH_=""
 
-# Check whether --with-sky130-source was given.
-if test "${with_sky130_source+set}" = set; then :
-  withval=$with_sky130_source; SKY130_SOURCE_PATH_=$withval
+        SKY130_SOURCE_PATH=""
+        SKY130_LOCAL_PATH=""
+        SKY130_DIST_PATH=""
+        SKY130_LINK_TARGETS="none"
+
+        pdk_get() {
+            { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ../sky130/pdk_url" >&5
+$as_echo_n "checking for ../sky130/pdk_url... " >&6; }
+if ${ac_cv_file____sky130_pdk_url+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  test "$cross_compiling" = yes &&
+  as_fn_error $? "cannot check for file existence when cross compiling" "$LINENO" 5
+if test -r "../sky130/pdk_url"; then
+  ac_cv_file____sky130_pdk_url=yes
+else
+  ac_cv_file____sky130_pdk_url=no
+fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_file____sky130_pdk_url" >&5
+$as_echo "$ac_cv_file____sky130_pdk_url" >&6; }
+if test "x$ac_cv_file____sky130_pdk_url" = xyes; then :
+
+                { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ../pdks/sky130" >&5
+$as_echo_n "checking for ../pdks/sky130... " >&6; }
+if ${ac_cv_file____pdks_sky130+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  test "$cross_compiling" = yes &&
+  as_fn_error $? "cannot check for file existence when cross compiling" "$LINENO" 5
+if test -r "../pdks/sky130"; then
+  ac_cv_file____pdks_sky130=yes
+else
+  ac_cv_file____pdks_sky130=no
+fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_file____pdks_sky130" >&5
+$as_echo "$ac_cv_file____pdks_sky130" >&6; }
+if test "x$ac_cv_file____pdks_sky130" = xyes; then :
+
+                    echo "Using pre-existing sky130 download..."
+
+else
+
+                    mkdir -p ../pdks/sky130
+                    sh dl $(cat "../sky130/pdk_get") ../pdks/sky130.tar.gz;
+                    (echo "Extracting sky130" && cd ../pdks && tar -xf sky130.tar.gz --strip-components 1 -C ../pdks/sky130)
 
 fi
 
+                export SKY130_SOURCE_PATH=../pdks/sky130
 
-	# Require this argument
-        { $as_echo "$as_me:${as_lineno-$LINENO}: Checking whether source path is specified for 'sky130'" >&5
-$as_echo "$as_me: Checking whether source path is specified for 'sky130'" >&6;}
-        if test "x$SKY130_SOURCE_PATH_" == "x" ; then
-	   as_fn_error $? "Option --with-sky130-source=<path> not specified!" "$LINENO" 5
-	fi
+else
 
-	SKY130_SOURCE_PATH=`readlink -f $SKY130_SOURCE_PATH_`
+                as_fn_error $? "PDK sky130 cannot be automatically downloaded and requires a path." "$LINENO" 5
 
-        # basic check that the PDK exists there (the path must exist in any case)
-        { $as_echo "$as_me:${as_lineno-$LINENO}: Checking specified path for 'sky130' at $SKY130_SOURCE_PATH" >&5
+fi
+
+        }
+
+        # Check whether --enable-sky130-sky130 was given.
+if test "${enable_sky130_pdk+set}" = set; then :
+  enableval=$enable_sky130_pdk;
+                if test "$enableval" == "yes" -o "$enableval" == "YES"; then
+                    pdk_get
+                elif test "$enableval" == "no" -o "$enableval" == "NO"; then
+                    echo "Disabling sky130..."
+                else
+                    export SKY130_SOURCE_PATH=$enableval
+                fi
+
+else
+
+                pdk_get
+
+
+fi
+
+	    # # Require this argument
+        # AC_MSG_NOTICE([Checking whether source path is specified for 'pdk'])
+        # if test "x$[]pdkvar[]_SOURCE_PATH" == "x" ; then
+        #     AC_MSG_ERROR([Option --with-pdk-source=<path> not specified!])
+        # fi
+
+        if [ "$SKY130_SOURCE_PATH" != "" ]; then
+            SKY130_SOURCE_PATH=`readlink -f $SKY130_SOURCE_PATH`
+
+            # basic check that the PDK exists there (the path must exist in any case)
+            { $as_echo "$as_me:${as_lineno-$LINENO}: Checking specified path for 'sky130' at $SKY130_SOURCE_PATH" >&5
 $as_echo "$as_me: Checking specified path for 'sky130' at $SKY130_SOURCE_PATH" >&6;}
-        as_ac_File=`$as_echo "ac_cv_file_$SKY130_SOURCE_PATH" | $as_tr_sh`
+            as_ac_File=`$as_echo "ac_cv_file_$SKY130_SOURCE_PATH" | $as_tr_sh`
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $SKY130_SOURCE_PATH" >&5
 $as_echo_n "checking for $SKY130_SOURCE_PATH... " >&6; }
 if eval \${$as_ac_File+:} false; then :
@@ -1790,72 +1900,57 @@
 $as_echo "$ac_res" >&6; }
 if eval test \"x\$"$as_ac_File"\" = x"yes"; then :
 
-           { $as_echo "$as_me:${as_lineno-$LINENO}: 'sky130' source path found at $SKY130_SOURCE_PATH" >&5
+                { $as_echo "$as_me:${as_lineno-$LINENO}: 'sky130' source path found at $SKY130_SOURCE_PATH" >&5
 $as_echo "$as_me: 'sky130' source path found at $SKY130_SOURCE_PATH" >&6;}
 
 else
 
-           as_fn_error $? "Specified path for 'sky130' at $SKY130_SOURCE_PATH not found" "$LINENO" 5
+                as_fn_error $? "Specified path for 'sky130' at $SKY130_SOURCE_PATH not found" "$LINENO" 5
 
 fi
 
 
-
-
-
-    # --with-pdk-local-path=PDK_LOCAL_PATH
-
-
-        SKY130_LOCAL_PATH_=""
+            # --with-pdk-local-path=PDK_LOCAL_PATH
 
 # Check whether --with-sky130-local-path was given.
 if test "${with_sky130_local_path+set}" = set; then :
-  withval=$with_sky130_local_path; SKY130_LOCAL_PATH_=$withval
+  withval=$with_sky130_local_path; SKY130_LOCAL_PATH=$withval
 
 fi
 
-	# Require this argument
-        { $as_echo "$as_me:${as_lineno-$LINENO}: Checking whether local path is specified for 'sky130'" >&5
+
+            # Require this argument
+            { $as_echo "$as_me:${as_lineno-$LINENO}: Checking whether local path is specified for 'sky130'" >&5
 $as_echo "$as_me: Checking whether local path is specified for 'sky130'" >&6;}
-        if test "x$SKY130_LOCAL_PATH_" == "x" ; then
-	   as_fn_error $? "Option --with-sky130-local-path=<path> not specified!" "$LINENO" 5
-	   SKY130_LOCAL_PATH=""
-	else
-	   SKY130_LOCAL_PATH=`readlink -f $SKY130_LOCAL_PATH_`
-	fi
+            if test "x$SKY130_LOCAL_PATH" == "x" ; then
+                as_fn_error $? "Option --with-sky130-local-path=<path> not specified!" "$LINENO" 5
+                SKY130_LOCAL_PATH=""
+            else
+                SKY130_LOCAL_PATH=`readlink -f $SKY130_LOCAL_PATH`
+            fi
 
-
-
-    # --with-pdk-dist-path=PDK_DIST_PATH
-
-
-        SKY130_DIST_PATH_=""
+            # --with-pdk-dist-path=PDK_DIST_PATH
 
 # Check whether --with-sky130-dist-path was given.
 if test "${with_sky130_dist_path+set}" = set; then :
-  withval=$with_sky130_dist_path; SKY130_DIST_PATH_=$withval
+  withval=$with_sky130_dist_path; SKY130_DIST_PATH=$withval
 
 fi
 
-	# Require this argument
-        { $as_echo "$as_me:${as_lineno-$LINENO}: Checking whether distribution path is specified for 'sky130'" >&5
+
+
+            # "Require" this argument
+            { $as_echo "$as_me:${as_lineno-$LINENO}: Checking whether distribution path is specified for 'sky130'" >&5
 $as_echo "$as_me: Checking whether distribution path is specified for 'sky130'" >&6;}
-        if test "x$SKY130_DIST_PATH_" == "x" ; then
-	   { $as_echo "$as_me:${as_lineno-$LINENO}: Option --with-sky130-dist-path=<path> not specified.  Local install only.\"" >&5
-$as_echo "$as_me: Option --with-sky130-dist-path=<path> not specified.  Local install only.\"" >&6;}
-	   SKY130_DIST_PATH=""
-	else
-	   SKY130_DIST_PATH=`readlink -f $SKY130_DIST_PATH_`
-	fi
+            if test "x$SKY130_DIST_PATH" == "x" ; then
+                { $as_echo "$as_me:${as_lineno-$LINENO}: Option --with-sky130-dist-path=<path> not specified.  Local install only." >&5
+$as_echo "$as_me: Option --with-sky130-dist-path=<path> not specified.  Local install only." >&6;}
+                SKY130_DIST_PATH=""
+            else
+                SKY130_DIST_PATH=`readlink -f $SKY130_DIST_PATH`
+            fi
 
-
-
-    # --with-pdk-link-targets=PDK_LINK_TARGETS
-
-
-	# Default link_targets = "none"
-	SKY130_LINK_TARGETS="none"
-
+            # --with-pdk-link-targets=PDK_LINK_TARGETS
 
 # Check whether --with-sky130-link-targets was given.
 if test "${with_sky130_link_targets+set}" = set; then :
@@ -1864,8 +1959,377 @@
 fi
 
 
-        { $as_echo "$as_me:${as_lineno-$LINENO}: Link targets set to $SKY130_LINK_TARGETS" >&5
+            { $as_echo "$as_me:${as_lineno-$LINENO}: Link targets set to $SKY130_LINK_TARGETS" >&5
 $as_echo "$as_me: Link targets set to $SKY130_LINK_TARGETS" >&6;}
+        fi
+
+
+
+
+
+
+
+
+# Set variables for tool setups
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: Found tools: klayout magic netgen openlane qflow" >&5
+$as_echo "$as_me: Found tools: klayout magic netgen openlane qflow" >&6;}
+
+
+
+
+
+        KLAYOUT_DISABLED=0
+        # Check whether --enable-klayout was given.
+if test "${enable_klayout+set}" = set; then :
+  enableval=$enable_klayout;
+                if test "$enableval" == "no" -o "$enableval" == "NO"; then
+                    KLAYOUT_DISABLED=1
+                fi
+
+
+fi
+
+
+
+
+
+        MAGIC_DISABLED=0
+        # Check whether --enable-magic was given.
+if test "${enable_magic+set}" = set; then :
+  enableval=$enable_magic;
+                if test "$enableval" == "no" -o "$enableval" == "NO"; then
+                    MAGIC_DISABLED=1
+                fi
+
+
+fi
+
+
+
+
+
+        NETGEN_DISABLED=0
+        # Check whether --enable-netgen was given.
+if test "${enable_netgen+set}" = set; then :
+  enableval=$enable_netgen;
+                if test "$enableval" == "no" -o "$enableval" == "NO"; then
+                    NETGEN_DISABLED=1
+                fi
+
+
+fi
+
+
+
+
+
+        OPENLANE_DISABLED=0
+        # Check whether --enable-openlane was given.
+if test "${enable_openlane+set}" = set; then :
+  enableval=$enable_openlane;
+                if test "$enableval" == "no" -o "$enableval" == "NO"; then
+                    OPENLANE_DISABLED=1
+                fi
+
+
+fi
+
+
+
+
+
+        QFLOW_DISABLED=0
+        # Check whether --enable-qflow was given.
+if test "${enable_qflow+set}" = set; then :
+  enableval=$enable_qflow;
+                if test "$enableval" == "no" -o "$enableval" == "NO"; then
+                    QFLOW_DISABLED=1
+                fi
+
+
+fi
+
+
+
+
+
+# Magic
+# Extract the first word of "magic", so it can be a program name with args.
+set dummy magic; 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_MAGIC+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $MAGIC in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_MAGIC="$MAGIC" # 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_MAGIC="$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
+MAGIC=$ac_cv_path_MAGIC
+if test -n "$MAGIC"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC" >&5
+$as_echo "$MAGIC" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+if test -z "$MAGIC"; then
+   as_fn_error $? "You need 'magic' to generate the needed various cell views." "$LINENO" 5
+fi
+
+# Other installations (libraries or tools if applicable)
+mkdir -p ../libs
+mkdir -p ../tools
+
+
+
+
+
+
+
+
+
+    # echo target targetvar flag url location
+
+    OSU_PATH=""
+    OSU_GET() {
+        { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ../libs/osu" >&5
+$as_echo_n "checking for ../libs/osu... " >&6; }
+if ${ac_cv_file____libs_osu+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  test "$cross_compiling" = yes &&
+  as_fn_error $? "cannot check for file existence when cross compiling" "$LINENO" 5
+if test -r "../libs/osu"; then
+  ac_cv_file____libs_osu=yes
+else
+  ac_cv_file____libs_osu=no
+fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_file____libs_osu" >&5
+$as_echo "$ac_cv_file____libs_osu" >&6; }
+if test "x$ac_cv_file____libs_osu" = xyes; then :
+
+                echo "Using pre-existing osu download..."
+
+else
+
+                mkdir -p ../libs/osu
+                sh ./download.sh 'https://vlsiarch.ecen.okstate.edu/flows/MOSIS_SCMOS/osu_stdcells_v2.4/osu_stdcells_lib.v2.4.tar.gz' ../libs/osu.tar.gz
+                (echo "Extracting osu..." && cd ../libs && tar -xf osu.tar.gz --strip-components 1 -C ../libs/osu)
+
+
+fi
+
+        export OSU_PATH=../libs/osu
+    }
+
+    # Check whether --enable-osu-lib was given.
+if test "${enable_osu_lib+set}" = set; then :
+  enableval=$enable_osu_lib;
+            if test "$enableval" == "yes" -o "$enableval" == "YES"; then
+                OSU_GET
+                XSCHEM_INST=1
+            elif test "$enableval" == "no" -o "$enableval" == "NO"; then
+                echo "Disabling osu..."
+                XSCHEM_DISABLED=1
+            else
+                OSU_PATH=$enableval
+            fi
+            OSU_PATH=`readlink -f $OSU_PATH`
+
+fi
+
+
+
+
+
+
+
+
+
+
+
+
+
+    # echo target targetvar flag url location
+
+    SKY130_ML_XX_HD_PATH=""
+    SKY130_ML_XX_HD_GET() {
+        { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ../libs/sky130_ml_xx_hd" >&5
+$as_echo_n "checking for ../libs/sky130_ml_xx_hd... " >&6; }
+if ${ac_cv_file____libs_sky130_ml_xx_hd+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  test "$cross_compiling" = yes &&
+  as_fn_error $? "cannot check for file existence when cross compiling" "$LINENO" 5
+if test -r "../libs/sky130_ml_xx_hd"; then
+  ac_cv_file____libs_sky130_ml_xx_hd=yes
+else
+  ac_cv_file____libs_sky130_ml_xx_hd=no
+fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_file____libs_sky130_ml_xx_hd" >&5
+$as_echo "$ac_cv_file____libs_sky130_ml_xx_hd" >&6; }
+if test "x$ac_cv_file____libs_sky130_ml_xx_hd" = xyes; then :
+
+                echo "Using pre-existing sky130_ml_xx_hd download..."
+
+else
+
+                mkdir -p ../libs/sky130_ml_xx_hd
+                sh ./download.sh 'https://github.com/PaulSchulz/sky130_pschulz_xx_hd/archive/master.tar.gz' ../libs/sky130_ml_xx_hd.tar.gz
+                (echo "Extracting sky130_ml_xx_hd..." && cd ../libs && tar -xf sky130_ml_xx_hd.tar.gz --strip-components 1 -C ../libs/sky130_ml_xx_hd)
+
+
+fi
+
+        export SKY130_ML_XX_HD_PATH=../libs/sky130_ml_xx_hd
+    }
+
+    # Check whether --enable-alpha-lib was given.
+if test "${enable_alpha_lib+set}" = set; then :
+  enableval=$enable_alpha_lib;
+            if test "$enableval" == "yes" -o "$enableval" == "YES"; then
+                SKY130_ML_XX_HD_GET
+                XSCHEM_INST=1
+            elif test "$enableval" == "no" -o "$enableval" == "NO"; then
+                echo "Disabling sky130_ml_xx_hd..."
+                XSCHEM_DISABLED=1
+            else
+                SKY130_ML_XX_HD_PATH=$enableval
+            fi
+            SKY130_ML_XX_HD_PATH=`readlink -f $SKY130_ML_XX_HD_PATH`
+
+fi
+
+
+
+
+
+
+
+XSCHEM_DISABLED=0
+XSCHEM_INST=0
+
+
+
+
+
+
+
+    # echo target targetvar flag url location
+
+    XSCHEM_PATH=""
+    XSCHEM_GET() {
+        { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ../tools/xschem" >&5
+$as_echo_n "checking for ../tools/xschem... " >&6; }
+if ${ac_cv_file____tools_xschem+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  test "$cross_compiling" = yes &&
+  as_fn_error $? "cannot check for file existence when cross compiling" "$LINENO" 5
+if test -r "../tools/xschem"; then
+  ac_cv_file____tools_xschem=yes
+else
+  ac_cv_file____tools_xschem=no
+fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_file____tools_xschem" >&5
+$as_echo "$ac_cv_file____tools_xschem" >&6; }
+if test "x$ac_cv_file____tools_xschem" = xyes; then :
+
+                echo "Using pre-existing xschem download..."
+
+else
+
+                mkdir -p ../tools/xschem
+                sh ./download.sh 'https://github.com/StefanSchippers/xschem/archive/master.tar.gz' ../tools/xschem.tar.gz
+                (echo "Extracting xschem..." && cd ../tools && tar -xf xschem.tar.gz --strip-components 1 -C ../tools/xschem)
+
+
+fi
+
+        export XSCHEM_PATH=../tools/xschem
+    }
+
+    # Check whether --enable-xschem was given.
+if test "${enable_xschem+set}" = set; then :
+  enableval=$enable_xschem;
+            if test "$enableval" == "yes" -o "$enableval" == "YES"; then
+                XSCHEM_GET
+                XSCHEM_INST=1
+            elif test "$enableval" == "no" -o "$enableval" == "NO"; then
+                echo "Disabling xschem..."
+                XSCHEM_DISABLED=1
+            else
+                XSCHEM_PATH=$enableval
+            fi
+            XSCHEM_PATH=`readlink -f $XSCHEM_PATH`
+
+fi
+
+
+
+    if [ "$XSCHEM_INST" = 1 ]; then
+        { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ../tools/xschem-install" >&5
+$as_echo_n "checking for ../tools/xschem-install... " >&6; }
+if ${ac_cv_file____tools_xschem_install+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  test "$cross_compiling" = yes &&
+  as_fn_error $? "cannot check for file existence when cross compiling" "$LINENO" 5
+if test -r "../tools/xschem-install"; then
+  ac_cv_file____tools_xschem_install=yes
+else
+  ac_cv_file____tools_xschem_install=no
+fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_file____tools_xschem_install" >&5
+$as_echo "$ac_cv_file____tools_xschem_install" >&6; }
+if test "x$ac_cv_file____tools_xschem_install" = xyes; then :
+
+            echo "Using pre-existing xschem installation..."
+
+else
+
+            echo "---"
+            echo "Note: attempting to build xschem. Xschem requires all of Magic's dependencies and further, flex, bison and libxpm."
+            echo "Your build WILL fail if any of these are missing. You can choose to remove --enable-xschem or add a known installation path."
+            sleep 2
+            mkdir -p ../tools/xschem-install
+            XSCHEM_ABSOLUTE=`readlink -f ../tools/xschem-install`
+            (cd ../tools/xschem && ./configure --prefix=$XSCHEM_ABSOLUTE && make && make install)
+            XSCHEM_PATH=$XSCHEM_ABSOLUTE
+
+fi
+
+    fi
+
+
 
 
 
@@ -2238,60 +2702,16 @@
 	fi
 
 
-# Extract the first word of "magic", so it can be a program name with args.
-set dummy magic; 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_MAGIC+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  case $MAGIC in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_MAGIC="$MAGIC" # 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_MAGIC="$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
-MAGIC=$ac_cv_path_MAGIC
-if test -n "$MAGIC"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC" >&5
-$as_echo "$MAGIC" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-if test -z "$MAGIC"; then
-   as_fn_error $? "You need 'magic' to generate the needed various cell views" "$LINENO" 5
-fi
-
 # Check for "--with-ef-style"
 EF_STYLE=0
 
 # Check whether --with-ef-style was given.
 if test "${with_ef_style+set}" = set; then :
   withval=$with_ef_style;
-    pdks_ef_style=$withval
-    if test "$withval" == "yes" -o "$withval" == "YES"; then
-        EF_STYLE=1
-    fi
+        pdks_ef_style=$withval
+        if test "$withval" == "yes" -o "$withval" == "YES"; then
+            EF_STYLE=1
+        fi
 
 fi