aboutsummaryrefslogtreecommitdiff
path: root/libgloss/configure.ac
blob: 43e7916631e07aad93743ceb3a008d98ea28a697 (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
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
dnl Process this file with autoconf to produce a configure script.
AC_INIT([libgloss],[LIBGLOSS_VERSION])
AC_CONFIG_HEADER(config.h)

if test "${enable_shared}" = "yes" ; then
  AC_MSG_WARN([Shared libraries not supported for cross compiling, ignored])
fi

AC_CONFIG_AUX_DIR(..)

AC_PROG_INSTALL

AC_CANONICAL_SYSTEM
AM_INIT_AUTOMAKE([foreign no-dist no-define subdir-objects 1.15.1])
AM_MAINTAINER_MODE
AM_SILENT_RULES(yes)

if test -z "${with_multisubdir}"; then
  have_multisubdir=no
else
  have_multisubdir=yes
fi
AM_CONDITIONAL(HAVE_DOC, test x$have_multisubdir = xno)
AM_CONDITIONAL(HAVE_MULTISUBDIR, test x$have_multisubdir = xyes)

AC_NO_EXECUTABLES

dnl indicates whether to run configure within the testsuite subdirectory
config_testsuite=true

dnl indicates whether to run configure within the libnosys subdirectory
config_libnosys=true

host_makefile_frag=${srcdir}/config/default.mh
target_makefile_frag=${srcdir}/config/default.mt

case "${target}" in
  aarch64*-*-*)
	AC_CONFIG_SUBDIRS(aarch64)
	config_testsuite=true
	;;
  arc*-*-*)
	AC_CONFIG_FILES([arc/Makefile])
	subdirs="$subdirs arc"
	;;
  csky*-*-*)
	AC_CONFIG_FILES([csky/Makefile])
	subdirs="$subdirs csky"
	;;
  epiphany-*-*)
	AC_CONFIG_FILES([epiphany/Makefile])
	subdirs="$subdirs epiphany"
	config_testsuite=true
	;;
  i[[3456]]86-*-elf* | i[[3456]]86-*-coff*)
	AC_CONFIG_FILES([i386/Makefile])
	subdirs="$subdirs i386"
	;;
  m32r-*-*)
	AC_CONFIG_FILES([m32r/Makefile])
	subdirs="$subdirs m32r"
	;;
  m68hc11-*-* | m6811-*-* | m68hc12-*-* | m6812-*-*)
	AC_CONFIG_FILES([m68hc11/Makefile])
	subdirs="$subdirs m68hc11"
	;;
  nds32*-*-*)
	AC_CONFIG_FILES([nds32/Makefile])
	subdirs="$subdirs nds32"
	;;
  fido-*-* | m68*-*-*)
	AC_CONFIG_FILES([m68k/Makefile])
	subdirs="$subdirs m68k"
	;;
  hppa*-*-pro*)
	AC_CONFIG_FILES([pa/Makefile])
	subdirs="$subdirs pa"
	;;
  i960-*-coff)
	AC_CONFIG_FILES([i960/Makefile])
	subdirs="$subdirs i960"
	;;
  sparc-*leon*-elf* | sparc-*leon*-none*)
	AC_CONFIG_FILES([sparc_leon/Makefile])
	subdirs="$subdirs sparc_leon"
	;;
  sparclet-*-aout* | sparc-*-elf* | sparc64-*-elf* | sparc86x-*-* | sparclite-*-*)
	AC_CONFIG_FILES([sparc/Makefile])
	subdirs="$subdirs sparc"
	;;
  sh*-*-pe | mips*-*-pe | *arm*-wince-pe)
	config_wince=true
	;;
  mips*-*-*)
	AC_CONFIG_FILES([mips/Makefile])
	subdirs="$subdirs mips"
	target_makefile_frag=${srcdir}/config/mips.mt
	;;
  riscv*-*-*)
	AC_CONFIG_FILES([riscv/Makefile])
	subdirs="$subdirs riscv"
	;;
  powerpc-*-*|powerpcle-*-*)
	AC_CONFIG_FILES([rs6000/Makefile])
	subdirs="$subdirs rs6000"
	host_makefile_frag=${srcdir}/config/ppc.mh
	;;
  mn10200-*-*)
	AC_CONFIG_FILES([mn10200/Makefile])
	subdirs="$subdirs mn10200"
	target_makefile_frag=${srcdir}/config/mn10200.mt
	;;
  mn10300-*-*)
	AC_CONFIG_FILES([mn10300/Makefile])
	subdirs="$subdirs mn10300"
	target_makefile_frag=${srcdir}/config/mn10300.mt
	;;
  bfin-*-*)
	config_bfin=true
	;;
  cr16-*-*)
	AC_CONFIG_FILES([cr16/Makefile])
	subdirs="$subdirs cr16"
	;;
  cris-*-* | crisv32-*-*)
	AC_CONFIG_FILES([cris/Makefile])
	subdirs="$subdirs cris"
	;;
  crx-*-*)
	AC_CONFIG_FILES([crx/Makefile])
	subdirs="$subdirs crx"
	;;
  d30v-*-*)
	AC_CONFIG_FILES([d30v/Makefile])
	subdirs="$subdirs d30v"
	;;
  fr30-*-*)
	AC_CONFIG_FILES([fr30/Makefile])
	subdirs="$subdirs fr30"
	;;
  frv*-*-*)
	AC_CONFIG_FILES([frv/Makefile])
	subdirs="$subdirs frv"
	;;
  ft32*-*-*)
	AC_CONFIG_FILES([ft32/Makefile])
	subdirs="$subdirs ft32"
	;;
  lm32*-*-*)
	AC_CONFIG_FILES([lm32/Makefile])
	subdirs="$subdirs lm32"
	;;
  mcore-*-*)
	AC_CONFIG_FILES([mcore/Makefile])
	subdirs="$subdirs mcore"
	;;
  mep-*-*)
	AC_CONFIG_FILES([mep/Makefile])
	subdirs="$subdirs mep"
	;;
  moxie-*-*)
	AC_CONFIG_FILES([moxie/Makefile])
	subdirs="$subdirs moxie"
	;;
  microblaze*-*-*)
	AC_CONFIG_FILES([microblaze/Makefile])
	subdirs="$subdirs microblaze"
	;;
  mt-*-*)
	AC_CONFIG_FILES([mt/Makefile])
	subdirs="$subdirs mt"
	;;
  v850*-*-*)
	AC_CONFIG_FILES([v850/Makefile])
	subdirs="$subdirs v850"
	;;
  visium-*-*)
	AC_CONFIG_FILES([visium/Makefile])
	subdirs="$subdirs visium"
	config_testsuite=false
	;;
  xc16x-*-*)
	AC_CONFIG_FILES([xc16x/Makefile])
	subdirs="$subdirs xc16x"
	target_makefile_frag=${srcdir}/config/xc16x.mt
	;;
  xstormy16-*-*)
	AC_CONFIG_FILES([xstormy16/Makefile])
	subdirs="$subdirs xstormy16"
	;;
  m32c-*-*)
	AC_CONFIG_FILES([m32c/Makefile])
	subdirs="$subdirs m32c"
	;;
  msp430-*-elf*)
	AC_CONFIG_FILES([msp430/Makefile])
	subdirs="$subdirs msp430"
	config_libnosys=false
	;;
  rl78*-*-elf)
	AC_CONFIG_FILES([rl78/Makefile])
	subdirs="$subdirs rl78"
	;;
  rx*-*-elf)
	AC_CONFIG_FILES([rx/Makefile])
	subdirs="$subdirs rx"
	;;
  arm*-*-elf | arm*-*-coff | arm*-*-*)
	AC_CONFIG_SUBDIRS([arm])
	;;
  spu-*-elf)
	AC_CONFIG_FILES([spu/Makefile])
	subdirs="$subdirs spu"
	host_makefile_frag=${srcdir}/config/ppc.mh
	config_testsuite=false
	config_libnosys=false
	;;
  tic6x-*-*)
	AC_CONFIG_FILES([tic6x/Makefile])
	subdirs="$subdirs tic6x"
	config_testsuite=false
	;;
  iq2000-*-*)
	config_iq2000=true
	;;
  or1k-*-* | or1knd-*-* )
	AC_CONFIG_FILES([or1k/Makefile])
	subdirs="$subdirs or1k"
	;;
  pru-*-*)
	AC_CONFIG_FILES([pru/Makefile])
	subdirs="$subdirs pru"
	;;
  nios2-*-*)
	AC_CONFIG_FILES([nios2/Makefile])
	subdirs="$subdirs nios2"
	;;
esac

AM_CONDITIONAL(CONFIG_BFIN, test x$config_bfin = xtrue)
AM_CONDITIONAL(CONFIG_IQ2000, test x$config_iq2000 = xtrue)
AM_CONDITIONAL(CONFIG_WINCE, test x$config_wince = xtrue)

dnl For now, don't bother configuring testsuite
dnl
dnl if test "${config_testsuite}" = "true";
dnl   then AC_CONFIG_SUBDIRS([testsuite])
dnl fi

AM_CONDITIONAL(CONFIG_LIBNOSYS, test x$config_libnosys = xtrue)

AC_PROG_CC
AM_PROG_AS
AM_PROG_AR
LD=${LD-ld}
AC_SUBST(LD)
AC_PROG_RANLIB

AC_DEFINE(HAVE_GNU_LD, 1, [Using GNU LD])

AC_CACHE_CHECK([if target is ELF], libc_cv_is_elf, [dnl
  AC_PREPROC_IFELSE([AC_LANG_PROGRAM(
[[#ifndef __ELF__
# error "not ELF"
#endif
]])], [libc_cv_is_elf=yes], [libc_cv_is_elf=no])
])
if test "x${libc_cv_is_elf}" = "xyes"; then
  AC_DEFINE(HAVE_ELF, 1, [Using ELF format])
fi

AC_CACHE_CHECK([for .previous assembler directive],
	       libc_cv_asm_previous_directive, [dnl
  libc_cv_asm_previous_directive=no
  cat > conftest.s <<EOF
.section foo_section
.previous
EOF
  if AC_TRY_COMMAND(${CC-cc} -c $CFLAGS conftest.s 1>&AC_FD_CC); then
    libc_cv_asm_previous_directive=yes
  fi
  rm -f conftest*])
if test "x${libc_cv_asm_previous_directive}" = "xyes"; then
  AC_DEFINE(HAVE_ASM_PREVIOUS_DIRECTIVE, 1, [.previous directive allowed])
fi

AC_CACHE_CHECK([for .popsection assembler directive],
	       libc_cv_asm_popsection_directive, [dnl
  libc_cv_asm_popsection_directive=no
  cat > conftest.s <<EOF
.pushsection foo_section
.popsection
EOF
  if AC_TRY_COMMAND(${CC-cc} -c $CFLAGS conftest.s 1>&AC_FD_CC); then
    libc_cv_asm_popsection_directive=yes
  fi
  rm -f conftest*])
if test "x${libc_cv_asm_popsection_directive}" = "xyes"; then
  AC_DEFINE(HAVE_ASM_POPSECTION_DIRECTIVE, 1, [.pushsection/.popsection directives allowed])
fi

AC_CACHE_CHECK([for section attributes],
	       libc_cv_section_attributes, [dnl
  libc_cv_section_attributes=no
  cat > conftest.c <<EOF
int secttest __attribute__ ((section (".gnu.warning.secttest"))) = 10;
int main() {}
EOF
  if AC_TRY_COMMAND(${CC-cc} -c $CFLAGS conftest.c 1>&AC_FD_CC); then
    libc_cv_section_attributes=yes
  fi
  rm -f conftest*])
if test "x${libc_cv_section_attributes}" = "xyes"; then
  AC_DEFINE(HAVE_SECTION_ATTRIBUTES, 1, [support for section attributes])
fi

AC_CACHE_CHECK([for symbol prefix], libc_cv_symbol_prefix, [dnl
  cat > conftest.c <<\EOF
foo () { }
EOF
dnl
  libc_cv_symbol_prefix=''
  if AC_TRY_COMMAND([${CC-cc} -S conftest.c -o - | fgrep "\$foo" > /dev/null]); then
    libc_cv_symbol_prefix='$'
  else
    if AC_TRY_COMMAND([${CC-cc} -S conftest.c -o - | fgrep "_foo" > /dev/null]); then
      libc_cv_symbol_prefix=_
    fi
  fi
  rm -f conftest* ])
AC_DEFINE_UNQUOTED(__SYMBOL_PREFIX, "$libc_cv_symbol_prefix", [symbol prefix])

m4_include([i386/acinclude.m4])
m4_include([libnosys/acinclude.m4])
m4_include([m68k/acinclude.m4])
m4_include([mcore/acinclude.m4])
m4_include([mips/acinclude.m4])
m4_include([mn10300/acinclude.m4])
m4_include([moxie/acinclude.m4])

AC_CACHE_CHECK([for compiler search settings], libc_cv_compiler_isystem, [dnl
  for subdir in include include-fixed; do
    AS_IF([dir=`$CC -print-file-name=$subdir`], [dnl
      AS_IF([test -n "$dir"], [dnl
        libc_cv_compiler_isystem="$libc_cv_compiler_isystem -isystem $dir"
      ])
    ])
  done
])
CC="$CC -nostdinc $libc_cv_compiler_isystem"

dnl We have to assign the same value to other variables because autoconf
dnl doesn't provide a mechanism to substitute a replacement keyword with
dnl arbitrary data or pathnames.
dnl
host_makefile_frag_path=$host_makefile_frag
AC_SUBST(host_makefile_frag_path)
AC_SUBST_FILE(host_makefile_frag)
target_makefile_frag_path=$target_makefile_frag
AC_SUBST(target_makefile_frag_path)
AC_SUBST_FILE(target_makefile_frag)

dnl AM_ENABLE_MULTILIB only processes the top-level Makefile, but we want the
dnl multilib settings to propagate to all sub-Makefiles that we recurse into
dnl too.  This can go away if we ever get rid of sub-Makefiles and only use
dnl Automake + makefile include fragments.
AC_OUTPUT_COMMANDS([
for subdir in $subdirs; do
  case " $CONFIG_FILES " in
   *" $subdir/Makefile "*)
     ac_file=$subdir/Makefile . ${multi_basedir}/config-ml.in
     ;;
  esac
done], [subdirs="$subdirs"])

AM_ENABLE_MULTILIB(, ..)

AC_CONFIG_FILES([Makefile])
AC_OUTPUT