summaryrefslogtreecommitdiff
path: root/project/config/cfgdefs.sh
blob: 6510abd2c0a7be88db435895a3ddb444f6e71f72 (plain)
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
# in projects where [ $mb_use_custom_cfgdefs = yes ],
# cfgdefs.sh is invoked from within ./configure via
# . $mb_project_dir/project/cfgdefs.sh

# a successful return from cfgdefs.sh will be followed
# by a second invocation of the config_copy() function,
# reflecting any changes to common config variables
# made by cfgdefs.sh.

# finally, cfgdefs.sh may update the contents of the
# config-time generated cfgdefs.mk.


# sofort's config test framework
. "$mb_project_dir/sofort/cfgtest/cfgtest.sh"


# slibtool now provides a mechanism to specifiy the
# preferred ar(1), as(1), nm(1), and ranlib(1) to be
# invoked by slibtool(1) when used for native builds
# and when no other tool had been specified. These
# configure arguments only affect slibtool's runtime
# tool choices, and the configure arguments below
# accordingly refer to the preferred "host" (rather
# than "native") tools.

_mb_quotes='\"'

for arg ; do
	case "$arg" in
		--with-preferred-host-ar=*)
                        slbt_preferred_host_ar=${_mb_quotes}${arg#*=}${_mb_quotes}
			;;

		--with-preferred-host-as=*)
                        slbt_preferred_host_as=${_mb_quotes}${arg#*=}${_mb_quotes}
			;;

		--with-preferred-host-nm=*)
                        slbt_preferred_host_nm=${_mb_quotes}${arg#*=}${_mb_quotes}
			;;

		--with-preferred-host-ranlib=*)
                        slbt_preferred_host_ranlib=${_mb_quotes}${arg#*=}${_mb_quotes}
			;;
		*)
			error_msg ${arg#}: "unsupported config argument."
			exit 2
	esac
done


cfgdefs_output_custom_defs()
{
	if [ $mb_cfgtest_cfgtype = 'host' ]; then
		cfgtest_cflags_append -DSLBT_PREFERRED_HOST_AR=${slbt_preferred_host_ar:-0}
		cfgtest_cflags_append -DSLBT_PREFERRED_HOST_AS=${slbt_preferred_host_as:-0}
		cfgtest_cflags_append -DSLBT_PREFERRED_HOST_NM=${slbt_preferred_host_nm:-0}
		cfgtest_cflags_append -DSLBT_PREFERRED_HOST_RANLIB=${slbt_preferred_host_ranlib:-0}
	fi
}


cfgdefs_perform_common_tests()
{
	# headers
	cfgtest_header_presence 'sys/syscall.h'
}


cfgdefs_perform_target_tests()
{
	# init
	cfgtest_newline
	cfgtest_host_section

	# common tests
	cfgdefs_perform_common_tests

	# pretty cfgdefs.mk
	cfgtest_newline
}

# strict: some tests might fail
set +e

# target-specific tests
cfgdefs_perform_target_tests

# strict: restore mode
set -e

# cfgdefs.in --> cfgdefs.mk
cfgdefs_output_custom_defs

# all done
return 0