1#!/bin/sh
2
3echo '---------------------------------------------------------------------'
4echo 'SoftEther VPN for Unix'
5echo
6echo 'Copyright (c) Daiyuu Nobori.'
7echo 'Copyright (c) SoftEther VPN Project, University of Tsukuba, Japan.'
8echo 'Copyright (c) SoftEther Corporation.'
9echo 'Copyright (c) all contributors on SoftEther VPN project in GitHub.'
10echo
11echo 'License: The Apache License, Version 2.0'
12echo
13echo 'Read and understand README.TXT, LICENSE.TXT and WARNING.TXT before use.'
14echo '---------------------------------------------------------------------'
15echo
16
17echo 'Welcome to the corner-cutting configure script !'
18echo
19
20OS=""
21case "`uname -s`" in
22Linux)
23	OS="linux"
24	;;
25FreeBSD)
26	OS="freebsd"
27	;;
28SunOS)
29	OS="solaris"
30	;;
31Darwin)
32	OS="macos"
33	;;
34OpenBSD)
35	OS="openbsd"
36	;;
37*)
38	echo 'Select your operating system below:'
39	echo ' 1: Linux'
40	echo ' 2: FreeBSD'
41	echo ' 3: Solaris'
42	echo ' 4: Mac OS X'
43	echo ' 5: OpenBSD'
44	echo
45	echo -n 'Which is your operating system (1 - 5) ? : '
46	read TMP
47	echo
48	if test "$TMP" = "1"
49	then
50		OS="linux"
51	fi
52	if test "$TMP" = "2"
53	then
54		OS="freebsd"
55	fi
56	if test "$TMP" = "3"
57	then
58		OS="solaris"
59	fi
60	if test "$TMP" = "4"
61	then
62		OS="macos"
63	fi
64	if test "$TMP" = "5"
65	then
66		OS="openbsd"
67	fi
68
69	if test "$OS" = ""
70	then
71		echo "Wrong number."
72		exit 1
73	fi
74	;;
75esac
76
77NOBITS=""
78case "`uname -m`" in
79aarch*|arm*|arm*)
80	NOBITS="_nobits"
81	;;
82esac
83
84CPU=""
85case "`uname -m`" in
86x86_64|amd64|aarch64|arm64|armv8*|mips64|ppc64|sparc64|alpha|ia64)
87	CPU=64bit
88	;;
89i?86|x86pc|i86pc|armv4*|armv5*|armv6*|armv7*)
90	CPU=32bit
91	;;
92*)
93	echo 'Select your CPU bits below:'
94	echo ' 1: 32-bit'
95	echo ' 2: 64-bit'
96	echo
97	echo -n 'Which is the type of your CPU (1 - 2) ? : '
98	read TMP
99	echo
100	if test "$TMP" = "1"
101	then
102		CPU="32bit"
103	fi
104	if test "$TMP" = "2"
105	then
106		CPU="64bit"
107	fi
108
109	if test "$CPU" = ""
110	then
111		echo "Wrong number."
112		exit 1
113	fi
114	;;
115esac
116
117cp src/makefiles/${OS}_${CPU}${NOBITS}.mak Makefile
118
119echo "The Makefile is generated. Run 'make' to build SoftEther VPN."
120