-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigure.in
executable file
·159 lines (130 loc) · 5.03 KB
/
configure.in
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
dnl Gcanal is Linux build system to customize target OS.
dnl Copyright (C) [email protected]
dnl
dnl This program is free software; you can redistribute it and/or
dnl modify it under the terms of the GNU General Public License
dnl as published by the Free Software Foundation; either version 2
dnl of the License, or (at your option) any later version.
dnl
dnl This program is distributed in the hope that it will be useful,
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
dnl GNU General Public License for more details.
dnl
dnl You should have received a copy of the GNU General Public License
dnl along with this program; if not, write to the Free Software
dnl Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
dnl 02110-1301, USA.
dnl Authors
dnl Kui Shi [email protected] 01/08/2013
dnl Process this file with autoconf to produce a configure script.
AC_PREREQ(2.59)
AC_INIT(Gcanal, 0.1, [email protected])
AC_COPYRIGHT([GPLv2 [email protected]])
AC_CONFIG_MACRO_DIR([m4])
AM_INIT_AUTOMAKE
if test `pwd` = `cd $srcdir; pwd`; then
AC_MSG_ERROR([You must use a build directory separate from $srcdir.])
fi
TOP_SRC_DIR=`cd $srcdir; pwd`
AC_SUBST([TOP_SRC_DIR])
TOP_TEMPLATE_DIR=`cd $srcdir/template; pwd`
AC_SUBST([TOP_TEMPLATE_DIR])
TOP_BUILD_DIR=`readlink -f $PWD`
AC_SUBST([TOP_BUILD_DIR])
die() {
AC_MSG_ERROR([
** FATAL ERROR:
** $1
])
}
dnl check basic commands
GC_CHECK_PROG([echo])
GC_CHECK_PROG([cat])
GC_CHECK_PROG([touch])
GC_CHECK_PROG([gzip])
GC_CHECK_PROG([bzip2])
GC_CHECK_PROG([tar])
GC_CHECK_PROG([sed])
GC_CHECK_PROG([patch])
GC_CHECK_PROG([mkdir])
GC_CHECK_PROG([readlink])
GC_CHECK_PROG([find])
GC_CHECK_PROG([mv])
GC_CHECK_PROG([install])
GC_CHECK_PROG([rm])
GC_CHECK_PROG([chmod])
GC_CHECK_PROG([depmod])
GC_CHECK_PROG([cp])
GC_CHECK_PROG([rpm2cpio])
GC_CHECK_PROG([cpio])
GC_CHECK_PROG([gcc])
dnl set program variables
CHOWN="/bin/chown"
AC_SUBST([CHOWN])
MKNOD="/bin/mknod"
AC_SUBST([MKNOD])
TAR="/bin/tar"
AC_SUBST([TAR])
MV="/bin/mv"
AC_SUBST([MV])
FIND="/bin/find"
AC_SUBST([FIND])
CP="/bin/cp"
AC_SUBST([CP])
RM="/bin/rm"
AC_SUBST([RM])
dnl add configure option
dnl Specify product
AC_ARG_ENABLE([product],
AC_HELP_STRING([--enable-product=[koala, panda]],
[Use the specified product.]),
[ PRODUCT_NAME=$enableval ])
if test "x$PRODUCT_NAME" = "x"; then
die "--enable-product must be designated. Options: koala, panda"
fi
AC_SUBST([PRODUCT_NAME])
PRODUCT_DIR=$TOP_TEMPLATE_DIR/$PRODUCT_NAME
dnl config.sh define BUILD_ARCHES
dnl currently focus on x86_64
source $PRODUCT_DIR/config.sh
AC_MSG_NOTICE([Build target arch: $BUILD_ARCHES])
dnl process toolchain
AC_MSG_NOTICE([Process toolchain])
dnl start of BUILD_ARCHES loop
for arch in $BUILD_ARCHES
do
mkdir -p `pwd`/scripts
cp $PRODUCT_DIR/$arch/toolchain_var.mk `pwd`/scripts/toolchain_var_$arch.mk
cp $PRODUCT_DIR/$arch/toolchain_var.mk `pwd`/scripts/toolchain_var_$arch.sh
. `pwd`/scripts/toolchain_var_$arch.sh
mkdir -p `pwd`/host-cross/toolchain
gzip -dc $srcdir/toolchain/$arch/${arch}-plcm-linux-gnu.tgz | tar -xf - -C `pwd`/host-cross/toolchain
eval echo ${arch}_TOOLCHAIN=${arch}-plcm-linux-gnu >> config.${arch}
eval echo ${arch}_TARGET_TOOLCHAIN_TRIPLET=${arch}-plcm-linux-gnu >> config.${arch}
eval echo ${arch}_TOOLCHAIN_EXEC_PREFIX=`pwd`/host-cross/toolchain/\\\${${arch}_TOOLCHAIN} >> config.${arch}
eval echo ${arch}_TOOLCHAIN_BIN_DIR=$TOP_BUILD_DIR/host-cross/\\\${${arch}_TOOLCHAIN}/x86-linux >> config.${arch}
eval echo ${arch}_HOST_CROSS_SYSROOT_DIR=\\\${${arch}_TOOLCHAIN_BIN_DIR}/../sysroot >> config.${arch}
eval echo ${arch}_HOST_CROSS_INCLUDE_DIR=$HOST_CROSS_SYSROOT_DIR/usr/include >> config.${arch}
if test "$arch" = "x86_64"; then
eval echo ${arch}_HOST_CROSS_LIB_DIR=\\\${${arch}_HOST_CROSS_SYSROOT_DIR}/usr/lib64 >> config.${arch}
fi
eval echo ${arch}_HOST_CROSS_TOOLCHAIN_DIR=$TOP_BUILD_DIR/host-cross/toolchain >> config.${arch}
eval echo ${arch}_TARGET_CROSS_COMPILE=${arch}-target-linux-gnu >> config.${arch}
eval echo ${arch}_TARGET_ALT_CPU_MODE=${TARGET_ALT_CPU_MODE} >> config.${arch}
eval echo ${arch}_TARGET_FUNDAMENTAL_ASFLAG=\\\"${TARGET_FUNDAMENTAL_ASFLAG}\\\" >> config.${arch}
eval echo ${arch}_TARGET_FUNDAMENTAL_CFLAGS=\\\"${TARGET_FUNDAMENTAL_CFLAGS}\\\" >> config.${arch}
eval echo ${arch}_TARGET_ALTMODE_FUNDAMENTAL_CFLAGS=\\\"${TARGET_ALTMODE_FUNDAMENTAL_CFLAGS}\\\" >> config.${arch}
eval echo ${arch}_TARGET_ROOTFS_CFLAGS=\\\"${TARGET_ROOTFS_CFLAGS}\\\" >> config.${arch}
eval echo ${arch}_TARGET_FUNDAMENTAL_LDFLAGS=\\\"${TARGET_FUNDAMENTAL_LDFLAGS}\\\" >> config.${arch}
done
dnl end of BUILD_ARCHES loop
AC_CONFIG_FILES([Makefile
build-x86_64/Makefile
release/Makefile])
dnl Checks for programs.
dnl Checks for libraries.
dnl Checks for header files.
dnl Checks for typedefs, structures, and compiler characteristics.
dnl Checks for library functions.
AC_OUTPUT()