免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 2805 | 回复: 8

[C] 请问一个autoconf和编译器的问题 [复制链接]

论坛徽章:
0
发表于 2008-12-02 10:59 |显示全部楼层
10可用积分
我们原来的工程是在aix下使用gcc开发的,用autoconf+automake+libtools配置
现在要转移到xlc下,我应该怎么让autoconf自动使用xlc那一套东西而不是gcc的呢?,怎么修改configure.ac呢?

评分

参与人数 1信誉积分 -10 收起 理由
samon_fu -10 兄弟,你悬赏这么久也不评,是要抠你信 ...

查看全部评分

论坛徽章:
0
发表于 2008-12-02 11:29 |显示全部楼层
原帖由 picobsd 于 2008-12-2 10:59 发表
我们原来的工程是在aix下使用gcc开发的,用autoconf+automake+libtools配置
现在要转移到xlc下,我应该怎么让autoconf自动使用xlc那一套东西而不是gcc的呢?,怎么修改configure.ac呢?

不是有相应的宏可以修改的么?

论坛徽章:
0
发表于 2008-12-02 11:32 |显示全部楼层
没用过xlc

如果你是想好改变编译器,请使用变量 CC=XXXXXX

论坛徽章:
0
发表于 2008-12-02 11:34 |显示全部楼层
我就是想知道具体怎么改,就改CC就可以了阿,我把CC指向xlc的路径?
可是改了以后configure的时候他还找gcc

论坛徽章:
0
发表于 2008-12-02 11:34 |显示全部楼层
原帖由 alexhappy 于 2008-12-2 11:29 发表

不是有相应的宏可以修改的么?

对啊。。我也记得有定义 gcc 和 xlc 宏

论坛徽章:
0
发表于 2008-12-02 11:45 |显示全部楼层
就算你什么都不改
configure的时候,也有参数 CC=XXX可以指定编译器

论坛徽章:
0
发表于 2008-12-02 12:03 |显示全部楼层
原帖由 5毛党党员 于 2008-12-2 11:34 发表

对啊。。我也记得有定义 gcc 和 xlc 宏



兄弟能说具体点么,我刚接触autoconf,看着都头晕。。。

论坛徽章:
0
发表于 2008-12-02 12:09 |显示全部楼层
看看这个
  1. -- Macro: AC_PROG_CXX ([COMPILER-SEARCH-LIST])
  2.      Determine a C++ compiler to use.  Check whether the environment
  3.      variable `CXX' or `CCC' (in that order) is set; if so, then set
  4.      output variable `CXX' to its value.

  5.      Otherwise, if the macro is invoked without an argument, then
  6.      search for a C++ compiler under the likely names (first `g++' and
  7.      `c++' then other names).  If none of those checks succeed, then as
  8.      a last resort set `CXX' to `g++'.

  9.      This macro may, however, be invoked with an optional first argument
  10.      which, if specified, must be a blank-separated list of C++
  11.      compilers to search for.  This just gives the user an opportunity
  12.      to specify an alternative search list for the C++ compiler.  For
  13.      example, if you didn't like the default order, then you could
  14.      invoke `AC_PROG_CXX' like this:

  15.           AC_PROG_CXX([gcc cl KCC CC cxx cc++ xlC aCC c++ g++])

  16.      If using the GNU C++ compiler, set shell variable `GXX' to `yes'.
  17.      If output variable `CXXFLAGS' was not already set, set it to `-g
  18.      -O2' for the GNU C++ compiler (`-O2' on systems where G++ does not
  19.      accept `-g'), or `-g' for other compilers.

复制代码



这个宏也可以解决你的问题

论坛徽章:
0
发表于 2008-12-02 12:09 |显示全部楼层
configure.ac

编译器检查那一行
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP