1*a53f50b9Schristosdnl ###################################################################### 2*a53f50b9Schristosdnl AC_HOST_MACROS: define HOST_CPU, HOST_VENDOR, and HOST_OS 3*a53f50b9SchristosAC_DEFUN([AMU_HOST_MACROS], 4*a53f50b9Schristos[ 5*a53f50b9Schristos# these are defined already by the macro 'CANONICAL_HOST' 6*a53f50b9Schristos AC_MSG_CHECKING([host cpu]) 7*a53f50b9Schristos AC_DEFINE_UNQUOTED(HOST_CPU, "$host_cpu") 8*a53f50b9Schristos AC_MSG_RESULT($host_cpu) 9*a53f50b9Schristos 10*a53f50b9Schristos AC_MSG_CHECKING([vendor]) 11*a53f50b9Schristos AC_DEFINE_UNQUOTED(HOST_VENDOR, "$host_vendor") 12*a53f50b9Schristos AC_MSG_RESULT($host_vendor) 13*a53f50b9Schristos 14*a53f50b9Schristos# if vendor is apple, then check values in /usr/bin/sw_vers 15*a53f50b9Schristos if test "${host_vendor}" = "apple" 16*a53f50b9Schristos then 17*a53f50b9Schristos pn=`sw_vers -productName 2>/dev/null` 18*a53f50b9Schristos pv=`sw_vers -productVersion 2>/dev/null` 19*a53f50b9Schristos if test -n "${pn}" && test -n "${pv}" 20*a53f50b9Schristos then 21*a53f50b9Schristos host_os_name=`echo ${pn} | tr -d ' ' | tr '[A-Z]' '[a-z]'` 22*a53f50b9Schristos host_os_version="${pv}" 23*a53f50b9Schristos host_os="${host_os_name}-${host_os_version}" 24*a53f50b9Schristos fi 25*a53f50b9Schristos fi 26*a53f50b9Schristos 27*a53f50b9Schristos AC_MSG_CHECKING([host full OS name and version]) 28*a53f50b9Schristos # normalize some host OS names 29*a53f50b9Schristos case ${host_os} in 30*a53f50b9Schristos # linux is linux is linux, regardless of RMS. 31*a53f50b9Schristos linux-gnu* | lignux* ) host_os=linux ;; 32*a53f50b9Schristos # NetBSD systems today are elf, so no need to distinguish 33*a53f50b9Schristos netbsdelf* ) host_os=`echo ${host_os} | sed 's/^netbsdelf/netbsd/'`;; 34*a53f50b9Schristos esac 35*a53f50b9Schristos AC_DEFINE_UNQUOTED(HOST_OS, "$host_os") 36*a53f50b9Schristos AC_MSG_RESULT($host_os) 37*a53f50b9Schristos 38*a53f50b9Schristos# break host_os into host_os_name and host_os_version 39*a53f50b9Schristos AC_MSG_CHECKING([host OS name]) 40*a53f50b9Schristos host_os_name=`echo $host_os | sed 's/\..*//g'` 41*a53f50b9Schristos # normalize some OS names 42*a53f50b9Schristos case ${host_os_name} in 43*a53f50b9Schristos # linux is linux is linux, regardless of RMS. 44*a53f50b9Schristos linux-gnu* | lignux* ) host_os_name=linux ;; 45*a53f50b9Schristos # all NetBSD systems today should just show up as "netbsd" 46*a53f50b9Schristos netbsd* ) host_os_name=netbsd;; 47*a53f50b9Schristos esac 48*a53f50b9Schristos AC_DEFINE_UNQUOTED(HOST_OS_NAME, "$host_os_name") 49*a53f50b9Schristos AC_MSG_RESULT($host_os_name) 50*a53f50b9Schristos 51*a53f50b9Schristos# parse out the OS version of the host 52*a53f50b9Schristos AC_MSG_CHECKING([host OS version]) 53*a53f50b9Schristos host_os_version=`echo $host_os | sed 's/^[[^0-9]]*//g'` 54*a53f50b9Schristos if test -z "$host_os_version" 55*a53f50b9Schristos then 56*a53f50b9Schristos host_os_version=`(uname -r) 2>/dev/null` || host_os_version=unknown 57*a53f50b9Schristos fi 58*a53f50b9Schristos case ${host_os_version} in 59*a53f50b9Schristos # fixes for some OS versions (solaris used to be here) 60*a53f50b9Schristos * ) # do nothing for now 61*a53f50b9Schristos ;; 62*a53f50b9Schristos esac 63*a53f50b9Schristos AC_DEFINE_UNQUOTED(HOST_OS_VERSION, "$host_os_version") 64*a53f50b9Schristos AC_MSG_RESULT($host_os_version) 65*a53f50b9Schristos 66*a53f50b9Schristos# figure out host architecture (different than CPU) 67*a53f50b9Schristos AC_MSG_CHECKING([host OS architecture]) 68*a53f50b9Schristos host_arch=`(uname -m) 2>/dev/null` || host_arch=unknown 69*a53f50b9Schristos # normalize some names 70*a53f50b9Schristos case ${host_arch} in 71*a53f50b9Schristos sun4* ) host_arch=sun4 ;; 72*a53f50b9Schristos sun3x ) host_arch=sun3 ;; 73*a53f50b9Schristos sun ) host_arch=`(arch) 2>/dev/null` || host_arch=unknown ;; 74*a53f50b9Schristos i?86 ) host_arch=i386 ;; # all x86 should show up as i386 75*a53f50b9Schristos Power*Macintosh ) host_arch=powerpc ;; 76*a53f50b9Schristos esac 77*a53f50b9Schristos AC_DEFINE_UNQUOTED(HOST_ARCH, "$host_arch") 78*a53f50b9Schristos AC_MSG_RESULT($host_arch) 79*a53f50b9Schristos 80*a53f50b9Schristos# figure out (linux) distribution, if any 81*a53f50b9Schristos AC_MSG_CHECKING([OS system distribution]) 82*a53f50b9Schristos ac_config_distro=`$SHELL $ac_aux_dir/config.guess.long | cut -d'-' -f4-` 83*a53f50b9Schristos if test -z "$ac_config_distro" 84*a53f50b9Schristos then 85*a53f50b9Schristos ac_config_distro="none" 86*a53f50b9Schristos fi 87*a53f50b9Schristos AC_DEFINE_UNQUOTED(DISTRO_NAME, "$ac_config_distro") 88*a53f50b9Schristos AC_MSG_RESULT($ac_config_distro) 89*a53f50b9Schristos 90*a53f50b9Schristos# figure out host name 91*a53f50b9Schristos AC_MSG_CHECKING([host name]) 92*a53f50b9Schristos host_name=`(hostname || uname -n) 2>/dev/null` || host_name=unknown 93*a53f50b9Schristos AC_DEFINE_UNQUOTED(HOST_NAME, "$host_name") 94*a53f50b9Schristos AC_MSG_RESULT($host_name) 95*a53f50b9Schristos 96*a53f50b9Schristos# figure out user name 97*a53f50b9Schristos AC_MSG_CHECKING([user name]) 98*a53f50b9Schristos if test -n "$USER" 99*a53f50b9Schristos then 100*a53f50b9Schristos user_name="$USER" 101*a53f50b9Schristos else 102*a53f50b9Schristos if test -n "$LOGNAME" 103*a53f50b9Schristos then 104*a53f50b9Schristos user_name="$LOGNAME" 105*a53f50b9Schristos else 106*a53f50b9Schristos user_name=`(whoami) 2>/dev/null` || user_name=unknown 107*a53f50b9Schristos fi 108*a53f50b9Schristos fi 109*a53f50b9Schristos AC_DEFINE_UNQUOTED(USER_NAME, "$user_name") 110*a53f50b9Schristos AC_MSG_RESULT($user_name) 111*a53f50b9Schristos 112*a53f50b9Schristos# figure out configuration date 113*a53f50b9Schristos AC_MSG_CHECKING([configuration date]) 114*a53f50b9Schristos config_date=`(date) 2>/dev/null` || config_date=unknown_date 115*a53f50b9Schristos AC_DEFINE_UNQUOTED(CONFIG_DATE, "$config_date") 116*a53f50b9Schristos AC_MSG_RESULT($config_date) 117*a53f50b9Schristos 118*a53f50b9Schristos]) 119*a53f50b9Schristosdnl ====================================================================== 120