~ubuntu-branches/ubuntu/wily/ghdl/wily

« back to all changes in this revision

Viewing changes to gcc/gcc/gcc.c

  • Committer: Package Import Robot
  • Author(s): Matthias Klose
  • Date: 2011-09-30 09:16:02 UTC
  • Revision ID: package-import@ubuntu.com-20110930091602-usdap7ajgizmpvb1
Tags: 0.29+gcc4.3.4+dfsg-1ubuntu1
* Fix FTBFS on multiarch systems. LP: #770812.
* Don't build the package twice.

Show diffs side-by-side

added added

removed removed

Lines of Context:
160
160
 
161
161
static int print_multi_os_directory;
162
162
 
 
163
/* Flag saying to print the relative path we'd use to
 
164
   find multiarch libraries given the current compiler flags.  */
 
165
 
 
166
static int print_multiarch;
 
167
 
163
168
/* Flag saying to print the list of subdirectories and
164
169
   compiler flags used to select them in a standard form.  */
165
170
 
1149
1154
   {"--print-multi-lib", "-print-multi-lib", 0},
1150
1155
   {"--print-multi-directory", "-print-multi-directory", 0},
1151
1156
   {"--print-multi-os-directory", "-print-multi-os-directory", 0},
 
1157
   {"--print-multiarch", "-print-multiarch", 0},
1152
1158
   {"--print-prog-name", "-print-prog-name=", "aj"},
1153
1159
   {"--print-sysroot-headers-suffix", "-print-sysroot-headers-suffix", 0},
1154
1160
   {"--profile", "-p", 0},
1538
1544
   set_multilib_dir based on the compilation options.  */
1539
1545
 
1540
1546
static const char *multilib_os_dir;
 
1547
 
 
1548
/* Subdirectory to use for locating libraries in multiarch conventions.  Set by
 
1549
   set_multilib_dir based on the compilation options.  */
 
1550
 
 
1551
static const char *multiarch_dir;
1541
1552
 
1542
1553
/* Structure to keep track of the specs that have been defined so far.
1543
1554
   These are accessed using %(specname) or %[specname] in a compiler
2434
2445
  struct prefix_list *pl;
2435
2446
  const char *multi_dir = NULL;
2436
2447
  const char *multi_os_dir = NULL;
 
2448
  const char *multiarch_suffix = NULL;
2437
2449
  const char *multi_suffix;
2438
2450
  const char *just_multi_suffix;
2439
2451
  char *path = NULL;
2451
2463
    }
2452
2464
  if (do_multi && multilib_os_dir && strcmp (multilib_os_dir, ".") != 0)
2453
2465
    multi_os_dir = concat (multilib_os_dir, dir_separator_str, NULL);
 
2466
  if (multiarch_dir)
 
2467
    multiarch_suffix = concat (multiarch_dir, dir_separator_str, NULL);
2454
2468
 
2455
2469
  while (1)
2456
2470
    {
2457
2471
      size_t multi_dir_len = 0;
2458
2472
      size_t multi_os_dir_len = 0;
 
2473
      size_t multiarch_len = 0;
2459
2474
      size_t suffix_len;
2460
2475
      size_t just_suffix_len;
2461
2476
      size_t len;
2464
2479
        multi_dir_len = strlen (multi_dir);
2465
2480
      if (multi_os_dir)
2466
2481
        multi_os_dir_len = strlen (multi_os_dir);
 
2482
      if (multiarch_suffix)
 
2483
        multiarch_len = strlen (multiarch_suffix);
2467
2484
      suffix_len = strlen (multi_suffix);
2468
2485
      just_suffix_len = strlen (just_multi_suffix);
2469
2486
 
2470
2487
      if (path == NULL)
2471
2488
        {
2472
2489
          len = paths->max_len + extra_space + 1;
2473
 
          if (suffix_len > multi_os_dir_len)
2474
 
            len += suffix_len;
2475
 
          else
2476
 
            len += multi_os_dir_len;
 
2490
          len += MAX (MAX (suffix_len, multi_os_dir_len), multiarch_len);
2477
2491
          path = XNEWVEC (char, len);
2478
2492
        }
2479
2493
 
2502
2516
                break;
2503
2517
            }
2504
2518
 
 
2519
          /* Now try the multiarch path.  */
 
2520
          if (!skip_multi_dir
 
2521
              && !pl->require_machine_suffix && multiarch_dir)
 
2522
            {
 
2523
              memcpy (path + len, multiarch_suffix, multiarch_len + 1);
 
2524
              ret = callback (path, callback_info);
 
2525
              if (ret)
 
2526
                break;
 
2527
            }
 
2528
 
2505
2529
          /* Now try the base path.  */
2506
2530
          if (!pl->require_machine_suffix
2507
2531
              && !(pl->os_multilib ? skip_multi_os_dir : skip_multi_dir))
3670
3694
        print_multi_directory = 1;
3671
3695
      else if (! strcmp (argv[i], "-print-multi-os-directory"))
3672
3696
        print_multi_os_directory = 1;
 
3697
      else if (! strcmp (argv[i], "-print-multiarch"))
 
3698
        print_multiarch = 1;
3673
3699
      else if (! strcmp (argv[i], "-print-sysroot-headers-suffix"))
3674
3700
        print_sysroot_headers_suffix = 1;
3675
3701
      else if (! strncmp (argv[i], "-Wa,", 4))
4101
4127
        ;
4102
4128
      else if (! strcmp (argv[i], "-print-multi-os-directory"))
4103
4129
        ;
 
4130
      else if (! strcmp (argv[i], "-print-multiarch"))
 
4131
        ;
4104
4132
      else if (! strcmp (argv[i], "-print-sysroot-headers-suffix"))
4105
4133
        ;
4106
4134
      else if (! strncmp (argv[i], "--sysroot=", strlen ("--sysroot=")))
4963
4991
                  do_spec_1 (" ", 0, NULL);
4964
4992
                }
4965
4993
 
 
4994
              if (multiarch_dir)
 
4995
                {
 
4996
                  do_spec_1 ("-imultiarch", 1, NULL);
 
4997
                  /* Make this a separate argument.  */
 
4998
                  do_spec_1 (" ", 0, NULL);
 
4999
                  do_spec_1 (multiarch_dir, 1, NULL);
 
5000
                  do_spec_1 (" ", 0, NULL);
 
5001
                }
 
5002
 
4966
5003
              if (gcc_exec_prefix)
4967
5004
                {
4968
5005
                  do_spec_1 ("-iprefix", 1, NULL);
6464
6501
      return (0);
6465
6502
    }
6466
6503
 
 
6504
  if (print_multiarch)
 
6505
    {
 
6506
      if (multiarch_dir == NULL)
 
6507
        printf ("\n");
 
6508
      else
 
6509
        printf ("%s\n", multiarch_dir);
 
6510
      return (0);
 
6511
    }
 
6512
 
6467
6513
  if (print_sysroot_headers_suffix)
6468
6514
    {
6469
6515
      if (*sysroot_hdrs_suffix_spec)
7442
7488
            q++;
7443
7489
          if (q < end)
7444
7490
            {
7445
 
              char *new_multilib_os_dir = XNEWVEC (char, end - q);
 
7491
              const char *q2 = q + 1;
 
7492
              char *new_multilib_os_dir;
 
7493
 
 
7494
              while (q2 < end && *q2 != ':')
 
7495
                q2++;
 
7496
              if (*q2 == ':')
 
7497
                end = q2;
 
7498
              new_multilib_os_dir = XNEWVEC (char, end - q);
7446
7499
              memcpy (new_multilib_os_dir, q + 1, end - q - 1);
7447
7500
              new_multilib_os_dir[end - q - 1] = '\0';
7448
7501
              multilib_os_dir = new_multilib_os_dir;
 
7502
 
 
7503
              end = this_path + this_path_len;
 
7504
              if (q2 < end && *q2 == ':')
 
7505
                {
 
7506
                  char *new_multiarch_dir = XNEWVEC (char, end - q2);
 
7507
                  memcpy (new_multiarch_dir, q2 + 1, end - q2 - 1);
 
7508
                  new_multiarch_dir[end - q2 - 1] = '\0';
 
7509
                  multiarch_dir = new_multiarch_dir;
 
7510
                }
7449
7511
              break;
7450
7512
            }
7451
7513
        }
7507
7569
      /* When --disable-multilib was used but target defines
7508
7570
         MULTILIB_OSDIRNAMES, entries starting with .: are there just
7509
7571
         to find multilib_os_dir, so skip them from output.  */
7510
 
      if (this_path[0] == '.' && this_path[1] == ':')
 
7572
      if (this_path[0] == '.' && this_path[1] == ':' && this_path[2] != '.' && this_path[3] != ':')
7511
7573
        skip = 1;
7512
7574
 
7513
7575
      /* Check for matches with the multilib_exclusions. We don't bother