aboutsummaryrefslogtreecommitdiff
path: root/configure.ac
blob: b316a7e7f3c6d0334791e65c77699c46998ec0c6 (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
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
#   Copyright (C) 2008, 2010, 2011 Google Inc.
#
# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# General Public License for more details.
#

AC_INIT(android-tools,2.0)
AC_PREREQ(2.59)

AC_CONFIG_FILES([Makefile])

AC_CANONICAL_SYSTEM

# Get 'install' or 'install-sh' and its variants.
AC_PROG_INSTALL

# We only allow the following 3 targets:
# 1. arm-linux-androideabi (primary target)
# 2. arm-eabi (for Android kernel)
# 3. arm-newlib-eabi (for gcc testing)
# 4. i[3456]86-*-linux-gnu, x86-*-linux-gnu, i[3456]86-*-linux-android, x86-*-linux-android (for x86 targets)
# 5. mips*-*-linux* (for mips targets)

GDB_TARGET=$target
case $target in
  arm-unknown-linux-androideabi | arm-unknown-eabi)
    BUILD_ANDROID_GCC=yes
    GDB_TARGET=arm-elf-linux
    ;;
  arm-newlib-elf)
    BUILD_ANDROID_GCC=no
    ;;
  i[[3456]]86-*-linux-gnu | x86_64-*-linux-gnu | i[[3456]]86-*-linux-android | x86_64-*-linux-android)
    BUILD_ANDROID_GCC=yes
    ;;
  mips*-*-linux*)
    BUILD_ANDROID_GCC=yes
    ;;
  *)
    AC_MSG_ERROR(Unsupported target $target.);
esac
AC_SUBST(BUILD_ANDROID_GCC)
AC_SUBST(GDB_TARGET)
AC_ARG_PROGRAM

# TOPLEVEL_CONFIGURE_ARGUMENTS lifted from top-level configure.ac in gcc.

# Export original configure arguments for use by sub-configures.
# Quote arguments with shell meta charatcers.
TOPLEVEL_CONFIGURE_ARGUMENTS=
TOPLEVEL_NO_GOLD_CONFIGURE_ARGUMENTS=

set -- "$progname" "$@"
for ac_arg
do
  case "$ac_arg" in
  *" "*|*"	"*|*[[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\']]*)
    ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"`
    # if the argument is of the form -foo=baz, quote the baz part only
    ac_arg=`echo "'$ac_arg'" | sed "s/^'\([[-a-zA-Z0-9]]*=\)/\\1'/"` ;;
  *) ;;
  esac
  # Add the quoted argument to the list.
  TOPLEVEL_CONFIGURE_ARGUMENTS="$TOPLEVEL_CONFIGURE_ARGUMENTS $ac_arg"
done
if test "$silent" = yes; then
  TOPLEVEL_CONFIGURE_ARGUMENTS="$TOPLEVEL_CONFIGURE_ARGUMENTS --silent"
fi
# Remove the initial space we just introduced and, as these will be
# expanded by make, quote '$'.
TOPLEVEL_CONFIGURE_ARGUMENTS=`echo "x$TOPLEVEL_CONFIGURE_ARGUMENTS" | sed -e 's/^x *//' -e 's,\\$,$$,g'`
AC_SUBST(TOPLEVEL_CONFIGURE_ARGUMENTS)

# Base args.  Strip norecursion, cache-file, srcdir, host, build,
# target, nonopt, and variable assignments.  These are the ones we
# might not want to pass down to subconfigures.  Also strip
# program-prefix, program-suffix, and program-transform-name, so that
# we can pass down a consistent program-transform-name.
baseargs=
keep_next=no
skip_next=no
enable_gold=
enable_ld_default=
eval "set -- $ac_configure_args"
for ac_arg
do
  if test X"$skip_next" = X"yes"; then
    skip_next=no
    continue
  fi
  if test X"$keep_next" = X"yes"; then
    case $ac_arg in
      *\'*)
	ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
    esac
    baseargs="$baseargs '$ac_arg'"
    keep_next=no
    continue
  fi

  # Handle separated arguments.  Based on the logic generated by
  # autoconf 2.59.
  case $ac_arg in
    *=* | --config-cache | -C | -disable-* | --disable-* \
      | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \
      | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \
      | -with-* | --with-* | -without-* | --without-* | --x)
      separate_arg=no
      ;;
    -*)
      separate_arg=yes
      ;;
    *)
      separate_arg=no
      ;;
  esac

  case "$ac_arg" in
    --no*)
      continue
      ;;
    --c* | \
    --sr* | \
    --ho* | \
    --bu* | \
    --t* | \
    --program-* | \
    -cache_file* | \
    -srcdir* | \
    -host* | \
    -build* | \
    -target* | \
    -program-prefix* | \
    -program-suffix* | \
    -program-transform-name* )
      skip_next=$separate_arg
      continue
      ;;
    -*)
      # Strip argument from --enable-gold=*, since our binutils and
      # gcc-4.6 take different arguments for dual linker support. We will
      # pass --enable-gold=both/gold to binutils and --enable-gold=default
      # gcc-4.6 if dual linker is needed.
      case "$ac_arg" in
        --enable-gold | --enable-gold=* )
          enable_gold="$ac_arg"
          ac_arg="--enable-gold"
          ;;
        --disable-gold )
          enable_gold=
          ;;
        --enable-ld=default )
          enable_ld_default=yes
          ;;
        --disable-ld )
          enable_ld_default=
          ;;
      esac

      # An option.  Add it.
      case $ac_arg in
	*\'*)
	  ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
      esac
      baseargs="$baseargs '$ac_arg'"
      keep_next=$separate_arg
      ;;
    *)
      # Either a variable assignment, or a nonopt (triplet).  Don't
      # pass it down; let the Makefile handle this.
      continue
      ;;
  esac
done
# Remove the initial space we just introduced and, as these will be
# expanded by make, quote '$'.
baseargs=`echo "x$baseargs" | sed -e 's/^x *//' -e 's,\\$,$$,g'`

# Add in --program-transform-name, after --program-prefix and
# --program-suffix have been applied to it.  Autoconf has already
# doubled dollar signs and backslashes in program_transform_name; we want
# the backslashes un-doubled, and then the entire thing wrapped in single
# quotes, because this will be expanded first by make and then by the shell.
# Also, because we want to override the logic in subdir configure scripts to
# choose program_transform_name, replace any s,x,x, with s,y,y,.
sed -e "s,\\\\\\\\,\\\\,g; s,','\\\\'',g; s/s,x,x,/s,y,y,/" <<EOF_SED > conftestsed.out
${program_transform_name}
EOF_SED
gcc_transform_name=`cat conftestsed.out`
rm -f conftestsed.out
baseargs="$baseargs --program-transform-name='${gcc_transform_name}'"
if test "$silent" = yes; then
  baseargs="$baseargs --silent"
fi

AC_SUBST(baseargs)
AC_SUBST(enable_gold)
AC_SUBST(enable_ld_default)

# Strip --with-sysroot, which is really "target" sysroot, from baseargs
# to form host_baseargs for building host libraries.  Passing target
# --with-sysroot is detrimantal (*1). Invent a new option
# --with-host-sysroot if needed in the future.
# Note that baseargs are quoted.
#
# (*1) path dependency_libs= in .libs/libgmpxx.lai has '=' prefix!
#
host_baseargs=
for ac_arg in $baseargs
do
  case $ac_arg in
  \'--with-sysroot=*\' )
    ;;
  *)
    host_baseargs="$host_baseargs $ac_arg"
    ;;
  esac
done

AC_SUBST(host_baseargs)

ENABLE_GRAPHITE=no
AC_ARG_ENABLE([graphite],
              AC_HELP_STRING([--enable-graphite],
                             [Enable Graphite optimization @<:@default=no@:>@]))
graphite=yes
if test x${enableval} != xyes; then
  graphite=no
fi
if test "$GCC_MIN_VERSION_4_5_0" == "no"; then
  graphite=no
fi
ENABLE_GRAPHITE=$graphite
AC_SUBST(ENABLE_GRAPHITE)

# package to source path
case $srcdir in
 /* | [A-Za-z]:*) package_to_srcdir=$srcdir ;;
 *) package_to_srcdir=../$srcdir ;;
esac
AC_SUBST(package_to_srcdir)
#
# Specify tool component versions
#

# macro to check that we have a package. A package x exists if any one
# of the following exists (x is in the format of "tool-version"):
# 1. tool/x
# 2. tool/x.tar.gz
# 3. tool/x.tgz
# 4. tool/x.tar.bz2
m4_pattern_allow([^AC_MSG_ERROR$])
AC_DEFUN([ANDROID_CHECK_PACKAGE],
[x=$1; tool=$(echo "$x" | sed -e 's/-.*//'); version=$(echo "$x" | sed -e 's/[[^-]]*-//'); \
if test \( ! -d $srcdir/../$tool/$1 \) -a \( x"$version" != x"none"  \) ; then
  if test -f $srcdir/../$tool/$1.tar ; then
    mkdir -p temp-src && tar -C temp-src -xf $srcdir/../$tool/$1.tar
  elif test -f $srcdir/../$tool/$1.tar.gz ; then
    mkdir -p temp-src && tar -C temp-src -xzf $srcdir/../$tool/$1.tar.gz
  elif test -f $srcdir/../$tool/$1.tgz ; then
    mkdir -p temp-src && tar -C temp-src -xzf $srcdir/../$tool/$1.tgz
  elif test -f $srcdir/../$tool/$1.tar.bz2 ; then
    mkdir -p temp-src && tar -C temp-src -xjf $srcdir/../$tool/$1.tar.bz2
  elif test -f $srcdir/../tarballs/$1.tar ; then
    mkdir -p temp-src && tar -C temp-src -xf $srcdir/../tarballs/$1.tar
  elif test -f $srcdir/../tarballs/$1.tar.gz ; then
    mkdir -p temp-src && tar -C temp-src -xzf $srcdir/../tarballs/$1.tar.gz
  elif test -f $srcdir/../tarballs/$1.tgz ; then
    mkdir -p temp-src && tar -C temp-src -xzf $srcdir/../tarballs/$1.tgz
  elif test -f $srcdir/../tarballs/$1.tar.bz2 ; then
    mkdir -p temp-src && tar -C temp-src -xjf $srcdir/../tarballs/$1.tar.bz2
  else
    AC_MSG_ERROR('package $1 does not exist.')
  fi
fi ])

# binutils version (default is 2.17)
AC_MSG_CHECKING([target binutils version to build])
AC_ARG_WITH([binutils-version],
  [  --with-binutils-version=VERSION
                          use binutils-VERSION (default is 2.17)],
  [if test x"$withval" != x ; then
     BINUTILS_VERSION="$withval"
   fi],
[BINUTILS_VERSION="2.17"])
AC_MSG_RESULT($BINUTILS_VERSION)
AC_SUBST(BINUTILS_VERSION)
ANDROID_CHECK_PACKAGE(binutils-${BINUTILS_VERSION})

m4_pattern_allow(AM_INIT_AUTOMAKE)
# macro to find binutils version for dual linker support.
# For binutils-2.21 and up, add --enable-gold=default,
# else add --enable-gold=both/gold.
AC_DEFUN([FIND_BINUTILS_VERSION],
[binutils_version_file="${srcdir}/../binutils/$1/bfd/configure.in"
if test -f "${binutils_version_file}"; then
  binutils_version_num=`grep AM_INIT_AUTOMAKE ${binutils_version_file} | \
                        sed -n "s/[AM_INIT_AUTOMAKE][[^,]]*,*\([[^)]]*\))/\1/p"`
  BINUTILS_MAJOR=`echo $binutils_version_num | sed -e "s/[[^0-9]].*//"`
  BINUTILS_MINOR=`echo $binutils_version_num | \
                  sed  -e "s/^[[0-9]]*\.//" -e "s/[[^0-9]].*//"`
  if test "$BINUTILS_MAJOR" -gt 2 -o \
          \( "$BINUTILS_MAJOR" -eq 2 -a "$BINUTILS_MINOR" -ge 21 \); then
    $2_MIN_VERSION_2_21="yes"
  else
    $2_MIN_VERSION_2_21="no"
  fi
else
  # No configure file found. assume yes.
  $2_MIN_VERSION_2_21="yes"
fi ])

FIND_BINUTILS_VERSION(binutils-${BINUTILS_VERSION},[BINUTILS])
AC_SUBST(BINUTILS_MIN_VERSION_2_21)

# gold binutils version (default is the same version as the main
# binutils package).
GOLD_VERSION="$BINUTILS_VERSION"
AC_MSG_CHECKING([target gold binutils version to build])
AC_ARG_WITH([gold-version],
  [  --with-gold-version=VERSION
                          use binutils-VERSION for gold (default is the main binutils version)],
  [if test x"$withval" != x ; then
     GOLD_VERSION="$withval"
   fi])
AC_MSG_RESULT($GOLD_VERSION)
AC_SUBST(GOLD_VERSION)

# Skip check if we are using the main binutils for gold.
GOLD_MIN_VERSION_2_21="$BINUTILS_MIN_VERSION_2_21"
if test x"$GOLD_VERSION" != x"$BINUTILS_VERSION" ; then
  ANDROID_CHECK_PACKAGE(binutils-${GOLD_VERSION})
  FIND_BINUTILS_VERSION(binutils-${GOLD_VERSION},[GOLD])
fi
AC_SUBST(GOLD_MIN_VERSION_2_21)

# gcc version (default is 4.2.1)
AC_MSG_CHECKING([target gcc version to build])
AC_ARG_WITH([gcc-version],
  [  --with-gcc-version=VERSION
                          use gcc-VERSION (default is 4.2.1)],
  [if test x"$withval" != x ; then
     GCC_VERSION="$withval"
   fi],
[GCC_VERSION="4.2.1"])
AC_MSG_RESULT($GCC_VERSION)
AC_SUBST(GCC_VERSION)
ANDROID_CHECK_PACKAGE(gcc-${GCC_VERSION})

# figure out if we need to build gmp and mpfr for gcc 4.3.0+ 
gcc_version_file="${srcdir}/../gcc/gcc-${GCC_VERSION}/gcc/BASE-VER"
if test -f "${gcc_version_file}"; then
  GCC_MAJOR=`head -n 1 $gcc_version_file | sed  -e "s/[[^0-9]].*//"`
  GCC_MINOR=`head -n 1 $gcc_version_file | \
	    sed  -e "s/^[[0-9]]*\.//" -e "s/[[^0-9]].*//"`
  if test "$GCC_MAJOR" -gt 4 -o \
          \( "$GCC_MAJOR" -eq 4 -a "$GCC_MINOR" -ge 3 \) ; then
    GCC_MIN_VERSION_4_3_0="yes"
  else
    GCC_MIN_VERSION_4_3_0="no"
  fi
  if test "$GCC_MAJOR" -gt 4 -o \
              \( "$GCC_MAJOR" -eq 4 -a "$GCC_MINOR" -ge 5 \) ; then
    GCC_MIN_VERSION_4_5_0="yes"
  else
    GCC_MIN_VERSION_4_5_0="no"
  fi
  if test "$GCC_MAJOR" -gt 4 -o \
              \( "$GCC_MAJOR" -eq 4 -a "$GCC_MINOR" -ge 8 \) ; then
    GCC_MIN_VERSION_4_8_0="yes"
  else
    GCC_MIN_VERSION_4_8_0="no"
  fi
else
  # No version file, assume it is trunk
  GCC_MIN_VERSION_4_3_0="yes"
  GCC_MIN_VERSION_4_5_0="yes"
  GCC_MIN_VERSION_4_8_0="yes"
fi
AC_SUBST(GCC_MIN_VERSION_4_3_0)
AC_SUBST(GCC_MIN_VERSION_4_5_0)
AC_SUBST(GCC_MIN_VERSION_4_8_0)

# newlib version (default is 1.16.0)
# newlib is only used for arm-newlib-eabi for testing
if test x$target == xarm-newlib-elf ; then 
AC_MSG_CHECKING([target newlib version to build])
AC_ARG_WITH([newlib-version],
  [  --with-newlib-version=VERSION
                          use newlib-VERSION (default is 1.16.0)],
  [if test x"$withval" != x ; then
     NEWLIB_VERSION="$withval"
   fi],
[NEWLIB_VERSION="1.16.0"])
AC_MSG_RESULT($NEWLIB_VERSION)
AC_SUBST(NEWLIB_VERSION)
ANDROID_CHECK_PACKAGE(newlib-${NEWLIB_VERSION})
fi

if test "$GCC_MIN_VERSION_4_3_0" == "yes"; then
# gmp version (default is 4.2.2)
# gmp is only used for gcc version higher than 4.3.0
AC_MSG_CHECKING([gmp version])
AC_ARG_WITH([gmp-version],
  [  --with-gmp-version=VERSION
                          use gmp-VERSION (default is 4.2.2)],
  [if test x"$withval" != x ; then
     GMP_VERSION="$withval"
   fi],
[GMP_VERSION="4.2.2"])
AC_MSG_RESULT($GMP_VERSION)
ANDROID_CHECK_PACKAGE(gmp-${GMP_VERSION})

# mpfr version (default is 2.3.0)
# mpfr is only used for gcc version higher than 4.3.0
AC_MSG_CHECKING([mpfr version])
AC_ARG_WITH([mpfr-version],
  [  --with-mpfr-version=VERSION
                          use mpfr-VERSION (default is 2.3.0)],
  [if test x"$withval" != x ; then
     MPFR_VERSION="$withval"
   fi],
[MPFR_VERSION="2.3.0"])
AC_MSG_RESULT($MPFR_VERSION)
ANDROID_CHECK_PACKAGE(mpfr-${MPFR_VERSION})

fi
AC_SUBST(GMP_VERSION)
AC_SUBST(MPFR_VERSION)

if test "$GCC_MIN_VERSION_4_5_0" == "yes"; then
# mpc version (default is 0.8.1)
# mpc is only used for gcc version higher than 4.5.0
AC_MSG_CHECKING([mpc version])
AC_ARG_WITH([mpc-version],
  [  --with-mpc-version=VERSION
                          use mpc-VERSION (default is 0.8.1)],
  [if test x"$withval" != x; then
     MPC_VERSION="$withval"
   fi],
[MPC_VERSION="0.8.1"])
AC_MSG_RESULT($MPC_VERSION)
ANDROID_CHECK_PACKAGE(mpc-${MPC_VERSION})
fi
AC_SUBST(MPC_VERSION)

if test "$ENABLE_GRAPHITE" == "yes"; then
# ppl version (default is 0.11.2)
# ppl is only used for gcc 4.5 and 4.6 with graphite optimization.
AC_MSG_CHECKING([ppl version])
AC_ARG_WITH([ppl-version],
  [  --with-ppl-version=VERSION
                         use ppl-VERSION (default is 0.11.2)],
  [if test x"$withval" != x ; then
     PPL_VERSION="$withval"
   fi],
[PPL_VERSION="0.11.2"])
AC_MSG_RESULT($PPL_VERSION)
ANDROID_CHECK_PACKAGE(ppl-${PPL_VERSION})
fi
AC_SUBST(PPL_VERSION)

if test "$ENABLE_GRAPHITE" == "yes"; then
# cloog-ppl or cloog version (default is 0.15.9)
# cloog is only used for gcc 4.5+ with graphite optimization.
AC_MSG_CHECKING([cloog version])
AC_ARG_WITH([cloog-version],
  [  --with-cloog-version=VERSION
                           use cloog-VERSION (default is 0.15.9)],
  [if test x"$withval" != x ; then
     CLOOG_VERSION="$withval"
   fi],
[CLOOG_VERSION="0.15.9"])
AC_MSG_RESULT($CLOOG_VERSION)
case $CLOOG_VERSION in
  0.15*)
    # CLooG/PPL relies on the PPL for version 0.15.x
    CLOOG_VERSION="ppl-$CLOOG_VERSION"
    ;;
  0.16*|0.17*|0.18*)
    # CLooG 0.16+ has its own embedded polyhedral library
    CLOOG_BACKEND="--enable-cloog-backend=isl"
    ;;
  *)
    AC_MSG_ERROR(Unsupported cloog version);
esac
AC_SUBST(CLOOG_BACKEND)
ANDROID_CHECK_PACKAGE(cloog-${CLOOG_VERSION})
fi
AC_SUBST(CLOOG_VERSION)

if test "$ENABLE_GRAPHITE" == "yes"; then
# isl version (default is 0.11.1)
# isl is only used for gcc 4.8+ with graphite optimization.
AC_MSG_CHECKING([isl version])
AC_ARG_WITH([isl-version],
  [  --with-isl-version=VERSION
                         use isl-VERSION (default is 0.11.1)],
  [if test x"$withval" != x ; then
     ISL_VERSION="$withval"
   fi],
[ISL_VERSION="0.11.1"])
AC_MSG_RESULT($ISL_VERSION)
ANDROID_CHECK_PACKAGE(isl-${ISL_VERSION})
fi
AC_SUBST(ISL_VERSION)

# gdb version (default is 6.6)
AC_MSG_CHECKING([target gdb version to build])
AC_ARG_WITH([gdb-version],
  [  --with-gdb-version=VERSION
                          use gdb-VERSION (default is 6.6)],
  [if test x"$withval" != x ; then
     GDB_VERSION="$withval"
   fi],
[GDB_VERSION="6.6"])
AC_MSG_RESULT($GDB_VERSION)
AC_SUBST(GDB_VERSION)
ANDROID_CHECK_PACKAGE(gdb-${GDB_VERSION})

# figure out if we need to build expat for gdb 7.2+
gdb_version_file="${srcdir}/../gdb/gdb-${GDB_VERSION}/gdb/version.in"
if test -f "${gdb_version_file}"; then
  GDB_MAJOR=`head -n 1 $gdb_version_file | sed  -e "s/[[^0-9]].*//"`
  GDB_MINOR=`head -n 1 $gdb_version_file | \
	    sed  -e "s/^[[0-9]]*\.//" -e "s/[[^0-9]].*//"`
  if test "$GDB_MAJOR" -gt 7 -o \
          \( "$GDB_MAJOR" -eq 7 -a "$GDB_MINOR" -ge 2 \) ; then
    GDB_MIN_VERSION_7_2="yes"
  else
    GDB_MIN_VERSION_7_2="no"
  fi
else
  # No version file, assume it is trunk
  GDB_MIN_VERSION_7_2="yes"
fi
AC_SUBST(GDB_MIN_VERSION_7_2)

if test "$GDB_MIN_VERSION_7_2" == "yes"; then
# expat version (default is 2.0.1)
# expat is only used for gdb version higher than 7.2
AC_MSG_CHECKING([expat version])
AC_ARG_WITH([expat-version],
  [  --with-expat-version=VERSION
                          use expat-VERSION (default is 2.0.1)],
  [if test x"$withval" != x ; then
     EXPAT_VERSION="$withval"
   fi],
[EXPAT_VERSION="2.0.1"])
AC_MSG_RESULT($EXPAT_VERSION)
ANDROID_CHECK_PACKAGE(expat-${EXPAT_VERSION})
fi
AC_SUBST(EXPAT_VERSION)

if test "$GDB_MIN_VERSION_7_2" == "yes"; then
AC_MSG_CHECKING([with python])
AC_ARG_WITH([python],
  [  --with-python=WITH_PYTHON
                          use python WITH_PYTHON)],
  [if test x"$withval" != x ; then
     WITH_PYTHON="$withval"
   fi],
[WITH_PYTHON=""])
AC_MSG_RESULT($WITH_PYTHON)
fi
AC_SUBST(WITH_PYTHON)

# For certain targets, with gdb 7.2+, the proper gdb target is 
# arm-linux-android.
if test "$GDB_MIN_VERSION_7_2" == "yes"; then
case $target in
  arm-unknown-linux-androideabi | arm-unknown-eabi)
    GDB_TARGET=arm-linux-android
    ;;
    *)
    ;;
esac
fi

# Sysroot location
AC_ARG_WITH([sysroot],
  [  --with-sysroot=DIR
                          use target sysroot in DIR],
  [if test x"$withval" != x ; then
     if test $build != $host ; then
       case "$withval" in
         "$prefix"|"${prefix%/}/"*)
           ;;
         *)
           AC_MSG_ERROR('Target sysroot must be a subdirectory of <prefix> for canadian cross build $prefix ; $withval')
           ;;
       esac
     fi

     sysroot="$withval"
   fi],
[if test $build != $host ; then
   AC_MSG_ERROR('Target sysroot is not set for canadian cross build')
 fi])
AC_SUBST(sysroot)

# Specify a location for mpc
AC_ARG_WITH(mpc, [  --with-mpc=PATH
                          specify prefix directory for installed MPC package.],
  [if test -d "$withval" ; then
     have_mpc="$withval"
     have_mpfr="$withval"
     have_gmp="$withval"
   elif test x"$withval" != x"no"; then
     AC_MSG_ERROR(invalid value for --with-mpc)
   else
     have_mpc=no
   fi],
  [have_mpc=no])
AC_SUBST(have_mpc)

# Specify a location for mpfr
AC_ARG_WITH(mpfr, [  --with-mpfr=PATH
                          specify prefix directory for installed MPFR package.],
  [if test -d "$withval" ; then
     have_mpfr="$withval"
     have_gmp="$withval"
   elif test x"$withval" != x"no"; then
     AC_MSG_ERROR(invalid value for --with-mpfr)
   else
     have_mpfr=no
   fi],
  [have_mpfr=no])
AC_SUBST(have_mpfr)

# Specify a location for gmp
AC_ARG_WITH(gmp, [  --with-gmp=PATH
                          specify prefix directory for the installed GMP package.],
  [if test -d "$withval" ; then
     have_gmp="$withval"
   elif test x"$withval" != x"no"; then
     AC_MSG_ERROR(invalid value for --with-gmp)
   else
     have_gmp=no
   fi],
  [have_gmp=no])
AC_SUBST(have_gmp)

# Specify a location for ppl
AC_ARG_WITH(ppl, [  --with-ppl=PATH
                          specify prefix directory for the installed PPL package.],
  [if test -d "$withval" ; then
     have_ppl="$withval"
   elif test x"$withval" != x"no"; then
     AC_MSG_ERROR(invalid value for --with-ppl)
   else
     have_ppl=no
   fi],
  [have_ppl=no])
AC_SUBST(have_ppl)

# Specify a location for cloog
AC_ARG_WITH(cloog, [  --with-cloog=PATH
                          specify prefix directory for the installed CLooG package.],
  [if test -d "$withval" ; then
     have_cloog="$withval"
   elif test x"$withval" != x"no"; then
     AC_MSG_ERROR(invalid value for --with-cloog)
   else
     have_cloog=no
   fi],
  [have_cloog=no])
AC_SUBST(have_cloog)

# Specify a location for isl
AC_ARG_WITH(isl, [  --with-isl=PATH
                          specify prefix directory for the installed ISL package.],
  [if test -d "$withval" ; then
     have_isl="$withval"
   elif test x"$withval" != x"no"; then
     AC_MSG_ERROR(invalid value for --with-isl)
   else
     have_isl=no
   fi],
  [have_isl=no])
AC_SUBST(have_isl)

# Specify a location for expat
AC_ARG_WITH(expat, [  --with-expat=PATH
                          specify prefix directory for the installed EXPAT package.],
  [if test -d "$withval" ; then
     have_expat="$withval"
   elif test x"$withval" != x"no"; then
     AC_MSG_ERROR(invalid value for --with-expat)
   else
     have_expat=no
   fi],
  [have_expat=no])
AC_SUBST(have_expat)

AC_OUTPUT