summaryrefslogtreecommitdiff
path: root/build-0.3/c/configure
blob: 6281fa24814c5b3c196626f4c048e904458cbee3 (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
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
159
160
161
162
163
164
165
166
#! /usr/bin/env bash

# file      : build/c/configure
# author    : Boris Kolpackov <boris@codesynthesis.com>
# copyright : Copyright (c) 2004-2010 Code Synthesis Tools CC
# license   : GNU GPL v2; see accompanying LICENSE file

# $1  out file
# $2  origin of the c_pp_options make variable
# $3  origin of the c_options make variable
# $4  origin of the c_ld_options make variable
# $5  origin of the c_libs make variable
#
# bld_root     - build root
# project_name - project name
#

source $bld_root/dialog.bash

$echo
$echo
$echo "configuring '$project_name'"
$echo
$echo

$echo
$echo "Please select the C compiler you would like to use:"
$echo
$echo "(1) GNU C (gcc)"
$echo "(2) Intel C (icc)"
$echo "(3) Other C compiler"
$echo

id=`read_option "gnu intel generic" "gnu"`

if [ "$id" != "generic" ]; then

  $echo
  $echo "Would you like the C compiler to optimize generated code?"
  $echo

  optimize=`read_y_n y`


  $echo
  $echo "Would you like the C compiler to generate debug information?"
  $echo

  debug=`read_y_n y`

  $echo
  $echo "Embed dynamic library paths into executables (rpath)?"
  $echo

  rpath=`read_y_n y`

fi

# pp_options
#
if [ "$2" != "undefined" ]; then

  pp_options=$c_pp_options

  if [ "$pp_options" ]; then
    $echo
    $echo "Extra C preprocessor options: $pp_options"
    $echo
  fi
else

  $echo
  $echo "Please enter any extra C preprocessor options."
  $echo

  read -e -p "[]: " pp_options
fi


# options
#
if [ "$3" != "undefined" ]; then

  options=$c_options

  if [ "$options" ]; then
    $echo
    $echo "Extra C compiler options: $options"
    $echo
  fi
else

  $echo
  $echo "Please enter any extra C compiler options."
  $echo

  read -p "[]: " options
fi


# ld_options
#
if [ "$4" != "undefined" ]; then

  ld_options=$c_ld_options

  if [ "$ld_options" ]; then
    $echo
    $echo "Extra C linker options: $ld_options"
    $echo
  fi
else

  $echo
  $echo "Please enter any extra C linker options."
  $echo

  read -e -p "[]: " ld_options
fi


# libs
#
if [ "$5" != "undefined" ]; then

  libs=$c_libs

  if [ "$libs" ]; then
    $echo
    $echo "Extra C libraries: $libs"
    $echo
  fi
else

  $echo
  $echo "Please enter any extra C libraries."
  $echo

  read -e -p "[]: " libs
fi


# Extract -L paths from the ld options.
#
paths=

if [ "$ld_options" ]; then
  paths=`echo "$ld_options" | sed -e 's/-L *\([^ ]*\)/\\
-L\1\\
/g' | sed -e 's/^-L\([^ ]*\)$/\1/' -e t -e d`
  paths=`echo $paths | sed -e 's/ /:/g'`
fi

echo "c_id       := $id"             >$1

if [ "$id" != "generic" ]; then
  echo "c_optimize := $optimize"       >>$1
  echo "c_debug    := $debug"          >>$1
  echo "c_rpath    := $rpath"          >>$1
fi

echo "c_pp_extra_options := $pp_options" >>$1
echo "c_extra_options    := $options"    >>$1
echo "c_ld_extra_options := $ld_options" >>$1
echo "c_extra_libs       := $libs"       >>$1
echo "c_extra_lib_paths  := $paths"      >>$1