GuessConfig.sh 1.8 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13
#! /bin/sh

if [ -z "$NDB_TOP" ]
then
	echo "You have not set NDB_TOP. Exiting" 1>&2
	exit 1
fi

if [ -z "$NDB_SCI" ]
then
	NDB_SCI=N
fi

14 15 16 17 18
if [ -z "$NDB_SHM" ]
then
	NDB_SHM=N
fi

19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
os=`uname -s`
case $os in
Linux)
	NDB_OS=LINUX
	NDB_ARCH=x86
	NDB_COMPILER=GCC
	;;
Darwin)
	NDB_OS=MACOSX
	NDB_ARCH=POWERPC
	NDB_COMPILER=GCC
	;;
HP-UX)
	NDB_OS=HPUX
	NDB_ARCH=HPPA
	NDB_COMPILER=GCC
	;;
CYGWIN_NT-5.0)
	NDB_OS=WIN32
	NDB_ARCH=x86
	NDB_COMPILER=VC7
	;;
*)
	if [ "$os" = "SunOS" ] && [ `uname -r` = "5.6" ]
	then
		NDB_OS=OSE
		NDB_ARCH=PPC750
		NDB_COMPILER=DIAB
	else
		NDB_OS=SOLARIS
		NDB_ARCH=SPARC
		NDB_COMPILER=GCC
	fi;;
esac

if [ -z "$NDB_ODBC" ]
then
56
  NDB_ODBC=N
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77
fi


mch=`uname -m`
case $mch in
x86_64)
	NDB_ARCH=x86_64
	;;
*)
	;;
esac

if [ -f $NDB_TOP/config/Makefile ]
then
TERMCAP_LIB=`grep TERMCAP_LIB $NDB_TOP/config/Makefile | sed -e s,"TERMCAP_LIB.*=.*-l","",g`
fi
if [ "$TERMCAP_LIB" = "" ]
then
TERMCAP_LIB=termcap
fi

tomas@mc05.(none)'s avatar
tomas@mc05.(none) committed
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99
# defaults
NDB_VERSION=DEBUG
PACKAGE=
VERSION=

parse_arguments() {
  for arg do
    case "$arg" in
      -GCC)       NDB_COMPILER=GCC ;;
      -R)         NDB_VERSION=RELEASE ;;
      -D)         NDB_VERSION=DEBUG ;;
      --PACKAGE=*) PACKAGE=`echo "$arg" | sed -e "s;--PACKAGE=;;"` ;;
      --VERSION=*) VERSION=`echo "$arg" | sed -e "s;--VERSION=;;"` ;;
      *)
        echo "Unknown argument '$arg'"
        exit 1
        ;;
    esac
  done
}

parse_arguments "$@"
100 101 102 103 104 105

(
	echo "# This file was automatically generated `date`"
	echo "NDB_OS       := $NDB_OS"
	echo "NDB_ARCH     := $NDB_ARCH"
	echo "NDB_COMPILER := $NDB_COMPILER"
tomas@mc05.(none)'s avatar
tomas@mc05.(none) committed
106
	echo "NDB_VERSION  := $NDB_VERSION"
107
	echo "NDB_SCI      := $NDB_SCI"
mysqldev@mysql.com's avatar
mysqldev@mysql.com committed
108
	echo "NDB_SHM      := $NDB_SHM"
109 110
	echo "NDB_ODBC     := $NDB_ODBC"
	echo "TERMCAP_LIB  := $TERMCAP_LIB"
tomas@mc05.(none)'s avatar
tomas@mc05.(none) committed
111 112
	echo "PACKAGE      := $PACKAGE"
	echo "VERSION      := $VERSION"
113 114 115 116
) > $NDB_TOP/config/config.mk

exit 0