summaryrefslogtreecommitdiff
path: root/configure
diff options
context:
space:
mode:
authorOri Bernstein <ori@Oris-Mac-mini.local>2016-12-20 20:48:27 -0800
committerOri Bernstein <ori@Oris-Mac-mini.local>2016-12-20 20:48:27 -0800
commit28284f54c9ac36296ad3c820e779c24fcfc6f550 (patch)
treefb660c3d94646282cf4fd6cef72f5cf4fef8eeb2 /configure
parenta7039f62015b0c17a38c8241107ac6d2518e586d (diff)
downloadmc-28284f54c9ac36296ad3c820e779c24fcfc6f550.tar.gz
Fix warnings on OSX, refactor ./configure
By default, OSX builds for the current OS, but we tell it to link for 10.6 and up. This mismatch will sometimes cause warnings. This exports an environment variable in order to fix that annoyance, as well as cleaning up the way we pass round the flags to do it.
Diffstat (limited to 'configure')
-rwxr-xr-xconfigure71
1 files changed, 42 insertions, 29 deletions
diff --git a/configure b/configure
index f069ba4..bc7585f 100755
--- a/configure
+++ b/configure
@@ -36,57 +36,44 @@ done
OS=`uname`
MACH=`uname -m`
-echo export INST_ROOT=$prefix > config.mk
+rm -f config.mk
+rm -f config.h
+rm -f mbld/config.myr
+rm -f configvar_cache
-echo '#define Instroot "'$prefix'"' > config.h
-echo '#define Asmcmd {"as", "-g", "-o", NULL}' >> config.h
-echo '#define Objsuffix ".o"' >> config.h
-echo 'export SYSCLASS=posixy' >> config.mk
+echo export INST_ROOT=$prefix >> config.mk
-# mbld mbld/config.myr
-echo "pkg config = " > mbld/config.myr
-echo "const Instroot = \"$prefix\"" >> mbld/config.myr
-echo "const Objsuffix = \".o\"" >> mbld/config.myr
-echo "const Arcmd = [\"ar\", \"-rcs\"]" >> mbld/config.myr
-echo "const Ascmd = [\"as\", \"-g\"]" >> mbld/config.myr
-echo "const Directlib = false" >> mbld/config.myr
-echo "const Runtime = \"_myrrt.o\"" >> mbld/config.myr
-# paths to install to
-echo "const Manpath = \"share/man/man\"" >> mbld/config.myr
-echo "const Sharepath = \"share\"" >> mbld/config.myr
-echo "const Binpath = \"bin\"" >> mbld/config.myr
-echo "const Libpath = \"lib/myr\"" >> mbld/config.myr
+echo "pkg config = " >> mbld/config.myr
+
+symprefix='""'
+defaultasm='Gnugaself'
+sysinit=''
case $OS in
*Linux*)
- echo '#define Symprefix ""' >> config.h
- echo '#define Defaultasm Gnugaself' >> config.h
echo 'export SYS=linux' >> config.mk
echo 'const Sys = "Linux"' >> mbld/config.myr
echo 'const Linkcmd = ["ld", "-o"]' >> mbld/config.myr
;;
*Darwin*)
- echo '#define Symprefix "_"' >> config.h
- echo '#define Defaultasm Gnugasmacho' >> config.h
+ symprefix='"_"'
+ defaultasm=Gnugasmacho
+ sysinit='setenv("MACOSX_DEPLOYMENT_TARGET", "10.6", 0)'
echo 'export SYS=osx' >> config.mk
+ echo 'const Sys = "OSX"' >> mbld/config.myr
echo 'const Linkcmd = ["ld", ' \
'"-pagezero_size", "0x100000000",' \
'"-macosx_version_min", "10.6",'\
'"-o"]' >> mbld/config.myr
- echo 'const Sys = "OSX"' >> mbld/config.myr
;;
*FreeBSD*)
- echo '#define Symprefix ""' >> config.h
- echo '#define Defaultasm Gnugaself' >> config.h
echo 'export SYS=freebsd' >> config.mk
- echo 'const Linkcmd = ["ld", "-o"]' >> mbld/config.myr
echo 'const Sys = "FreeBSD"' >> mbld/config.myr
+ echo 'const Linkcmd = ["ld", "-o"]' >> mbld/config.myr
;;
*OpenBSD*)
- echo '#define Symprefix ""' >> config.h
- echo '#define Defaultasm Gnugaself' >> config.h
echo 'export SYS=openbsd' >> config.mk
- echo 'const Linkcmd = ["ld", "-static", "-nopie", "-o"]' >> mbld/config.myr
echo 'const Sys = "OpenBSD"' >> mbld/config.myr
+ echo 'const Linkcmd = ["ld", "-static", "-nopie", "-o"]' >> mbld/config.myr
;;
*)
echo ''
@@ -99,6 +86,30 @@ case $OS in
;;
esac
+# config.h
+echo '#define Instroot "'$prefix'"' >> config.h
+echo '#define Asmcmd {"as", "-g", "-o", NULL}' >> config.h
+echo '#define Objsuffix ".o"' >> config.h
+echo 'export SYSCLASS=posixy' >> config.mk
+echo '#define Symprefix' $symprefix >> config.h
+echo '#define Defaultasm' $defaultasm >> config.h
+echo '#define Sysinit ' $sysinit >> config.h
+
+# mbld mbld/config.myr
+echo "const Instroot = \"$prefix\"" >> mbld/config.myr
+echo "const Objsuffix = \".o\"" >> mbld/config.myr
+echo "const Arcmd = [\"ar\", \"-rcs\"]" >> mbld/config.myr
+echo "const Ascmd = [\"as\", \"-g\"]" >> mbld/config.myr
+echo "const Directlib = false" >> mbld/config.myr
+echo "const Runtime = \"_myrrt.o\"" >> mbld/config.myr
+
+# paths to install to
+echo "const Manpath = \"share/man/man\"" >> mbld/config.myr
+echo "const Sharepath = \"share\"" >> mbld/config.myr
+echo "const Binpath = \"bin\"" >> mbld/config.myr
+echo "const Libpath = \"lib/myr\"" >> mbld/config.myr
+
+
case $MACH in
*x86_64* | *amd64*)
echo 'export ARCH=x64' >> config.mk
@@ -110,7 +121,9 @@ case $MACH in
echo 'Unknown arch '$MACH
echo 'Cannot build'
echo '********************************'
+ ;;
esac
+
echo ';;' >> mbld/config.myr
echo "prefix=$prefix" > configvar_cache