Debian Codegraph @

mklove/modules/configure.host

raw
1 #!/bin/bash
2 #
3 # Host OS support
4 # Sets:
5 # HOST
6 # BUILD
7 # TARGET
8
9 # FIXME: No need for this right now
10 #mkl_require host_linux
11 #mkl_require host_osx
12 #mkl_require host_cygwin
13
14 #mkl_option "Cross-compilation" "mk:HOST_OS" "--host-os=osname" "Host OS (linux,osx,cygwin,..)" "auto"
15
16
17 # autoconf compatibility - does nothing at this point
18 mkl_option "Cross-compilation" "mk:HOST" "--host=HOST" "Configure to build programs to run on HOST (no-op)"
19 mkl_option "Cross-compilation" "mk:BUILD" "--build=BUILD" "Configure for building on BUILD (no-op)"
20 mkl_option "Cross-compilation" "mk:TARGET" "--target=TARGET" "Configure for building cross-toolkits for platform TARGET (no-op)"
21
22
23 # Resolve the OS/distro at import time, rather than as a check,
24 # so that MKL_DISTRO is available to other modules at import time.
25 function resolve_distro {
26 solib_ext=.so
27
28 # Try lsb_release
29 local sys
30 sys=$(lsb_release -is 2>/dev/null)
31 if [[ $? -gt 0 ]]; then
32 # That didnt work, try uname.
33 local kn=$(uname -s)
34 case $kn in
35 Linux)
36 sys=Linux
37 solib_ext=.so
38
39 if [[ -f /etc/os-release ]]; then
40 eval $(grep ^ID= /etc/os-release)
41 if [[ -n $ID ]]; then
42 sys="$ID"
43 fi
44 elif [[ -f /etc/centos-release ]]; then
45 sys=centos
46 elif [[ -f /etc/alpine-release ]]; then
47 sys=alpine
48 fi
49 ;;
50 Darwin)
51 sys=osx
52 solib_ext=.dylib
53 ;;
54 CYGWIN*)
55 sys=Cygwin
56 solib_ext=.dll
57 ;;
58 *)
59 sys="$kn"
60 solib_ext=.so
61 ;;
62 esac
63 fi
64
65 # Convert to lower case
66 sys=$(echo $sys | tr '[:upper:]' '[:lower:]')
67 mkl_mkvar_set "distro" "MKL_DISTRO" "$sys"
68 mkl_allvar_set "distro" "SOLIB_EXT" "$solib_ext"
69 }
70
71 resolve_distro
72
73
74 function checks {
75 # Try to figure out what OS/distro we are running on.
76 mkl_check_begin "distro" "" "no-cache" "OS or distribution"
77
78 if [[ -z $MKL_DISTRO ]]; then
79 mkl_check_failed "distro" "" "ignore" ""
80 else
81 mkl_check_done "distro" "" "ignore" "ok" "$MKL_DISTRO"
82 fi
83 }
84
85 #function checks {
86 # mkl_check_begin "host" "HOST_OS" "no-cache" "host OS"
87 #
88 # #
89 # # If --host-os=.. was not specified then this is most likely not a
90 # # a cross-compilation and we can base the host-os on the native OS.
91 # #
92 # if [[ $HOST_OS != "auto" ]]; then
93 # mkl_check_done "host" "HOST_OS" "cont" "ok" "$HOST_OS"
94 # return 0
95 # fi
96 #
97 # kn=$(uname -s)
98 # case $kn in
99 # Linux)
100 # hostos=linux
101 # ;;
102 # Darwin)
103 # hostos=osx
104 # ;;
105 # CYGWIN*)
106 # hostos=cygwin
107 # ;;
108 # *)
109 # hostos="$(mkl_lower $kn)"
110 # mkl_err "Unknown host OS kernel name: $kn"
111 # mkl_err0 " Will attempt to load module host_$hostos anyway."
112 # mkl_err0 " Please consider writing a configure.host_$hostos"
113 # ;;
114 # esac
115 #
116 # if ! mkl_require --try "host_$hostos"; then
117 # # Module not found
118 # mkl_check_done "host" "HOST_OS" "cont" "failed" "$kn?"
119 # else
120 # # Module loaded
121 #
122 # if mkl_func_exists "host_${hostos}_setup" ; then
123 # "host_${hostos}_setup"
124 # fi
125 #
126 # mkl_check_done "host" "HOST_OS" "cont" "ok" "$hostos"
127 # fi
128 #
129 # # Set HOST_OS var even if probing failed.
130 # mkl_mkvar_set "host" "HOST_OS" "$hostos"
131 #}
132