configure 配置参数说明

本文转载,原文地址:https://blog.csdn.net/xhoufei2010/article/details/82768995

 

configure 配置参数说明

 

1 说明

在linux 中,经常需要用到交叉编译,在ubuntu系统中,交叉编译可以运行在arm平台上的bin文件。对于大部分代码,
都有configure文件,让开发者进行配置,配置完毕之后自动生成makefile,然后进行编译。本文旨在说明configure中
常用的一些参数。

 

2 开发环境

软件环境: ubuntu 操作系统
编译工具链:arm-xilinx-linux-gnueabi
硬件平台:zynq7010

 

3 configure参数说明

3.1 查看configure 配置选项

在configure目录下,运行 --help命令,可以查看到configure的配置参数一共有哪些。

 

./configure --help

Defaults for the options are specified in brackets.

Configuration:
  -h, --help              display this help and exit
      --help=short        display options specific to this package
      --help=recursive    display the short help of all the included packages
  -V, --version           display version information and exit
  -q, --quiet, --silent   do not print `checking ...' messages
      --cache-file=FILE   cache test results in FILE [disabled]
  -C, --config-cache      alias for `--cache-file=config.cache'
  -n, --no-create         do not create output files
      --srcdir=DIR        find the sources in DIR [configure dir or `..']

Installation directories:
  --prefix=PREFIX         install architecture-independent files in PREFIX
                          [/usr/local]
  --exec-prefix=EPREFIX   install architecture-dependent files in EPREFIX
                          [PREFIX]

By default, `make install' will install all the files in
`/usr/local/bin', `/usr/local/lib' etc.  You can specify
an installation prefix other than `/usr/local' using `--prefix',
for instance `--prefix=$HOME'.

For better control, use the options below.

Fine tuning of the installation directories:
  --bindir=DIR            user executables [EPREFIX/bin]
  --sbindir=DIR           system admin executables [EPREFIX/sbin]
  --libexecdir=DIR        program executables [EPREFIX/libexec]
  --sysconfdir=DIR        read-only single-machine data [PREFIX/etc]
  --sharedstatedir=DIR    modifiable architecture-independent data [PREFIX/com]
  --localstatedir=DIR     modifiable single-machine data [PREFIX/var]
  --runstatedir=DIR       modifiable per-process data [LOCALSTATEDIR/run]
  --libdir=DIR            object code libraries [EPREFIX/lib]
  --includedir=DIR        C header files [PREFIX/include]
  --oldincludedir=DIR     C header files for non-gcc [/usr/include]
  --datarootdir=DIR       read-only arch.-independent data root [PREFIX/share]
  --datadir=DIR           read-only architecture-independent data [DATAROOTDIR]
  --infodir=DIR           info documentation [DATAROOTDIR/info]
  --localedir=DIR         locale-dependent data [DATAROOTDIR/locale]
  --mandir=DIR            man documentation [DATAROOTDIR/man]
  --docdir=DIR            documentation root [DATAROOTDIR/doc/cgminer]
  --htmldir=DIR           html documentation [DOCDIR]
  --dvidir=DIR            dvi documentation [DOCDIR]
  --pdfdir=DIR            pdf documentation [DOCDIR]
  --psdir=DIR             ps documentation [DOCDIR]

Program names:
  --program-prefix=PREFIX            prepend PREFIX to installed program names
  --program-suffix=SUFFIX            append SUFFIX to installed program names
  --program-transform-name=PROGRAM   run sed PROGRAM on installed program names

System types:
  --build=BUILD     configure for building on BUILD [guessed]
  --host=HOST       cross-compile to build programs to run on HOST [BUILD]
  --target=TARGET   configure for building compilers for TARGET [HOST]
  
Some influential environment variables:
  CC          C compiler command
  CFLAGS      C compiler flags
  LDFLAGS     linker flags, e.g. -L<lib dir> if you have libraries in a
              nonstandard directory <lib dir>
  LIBS        libraries to pass to the linker, e.g. -l<library>
  CPPFLAGS    (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if
              you have headers in a nonstandard directory <include dir>
  CPP         C preprocessor
  PKG_CONFIG  path to pkg-config utility
  PKG_CONFIG_PATH
              directories to add to pkg-config's search path
  PKG_CONFIG_LIBDIR
              path overriding pkg-config's built-in search path
  LIBUSB_CFLAGS
              C compiler flags for LIBUSB, overriding pkg-config
  LIBUSB_LIBS linker flags for LIBUSB, overriding pkg-config
  JANSSON_CFLAGS
              C compiler flags for JANSSON, overriding pkg-config
  JANSSON_LIBS
              linker flags for JANSSON, overriding pkg-config
  LIBCURL_CFLAGS
              C compiler flags for LIBCURL, overriding pkg-config
  LIBCURL_LIBS
              linker flags for LIBCURL, overriding pkg-config
  LIBSYSTEMD_CFLAGS
              C compiler flags for LIBSYSTEMD, overriding pkg-config
  LIBSYSTEMD_LIBS
              linker flags for LIBSYSTEMD, overriding pkg-config

Use these variables to override the choices made by `configure' or to help
it to find libraries and programs with nonstandard names/locations.

 

3.2 参数说明

3.2.1 build 参数

 --build=BUILD     configure for building on BUILD [guessed]

 

build: 执行代码编译的主机,正常的话就是你的主机系统。这个参数一般由config.guess来猜就可以。当然自己指定也可以。可以默认不写,默认为当前正在使用的ubuntu主机,如 i386-linux

 --build=i386-linux
 或者xilinx-arm的编译器主机
 --build=i686-pc-linux-gnu
 或者不写

 

3.2.2 host 参数

 --host=HOST       cross-compile to build programs to run on HOST [BUILD]

 

指定软件运行的系统平台.如果没有指定,将会运行`config.guess’来检测.–host 指定的是交叉编译工具链的前缀。如本位中采用的是arm-xilinx-linux-gnueabi 工具链,则参数配置为:

--host=arm-xilinx-linux-gnueabi

 

3.2.3 target 参数

  --target=TARGET   configure for building compilers for TARGET [HOST]

 

target: 这个选项只有在建立交叉编译环境的时候用到,正常编译和交叉编译都不会用到。他用build主机上的编译器,编译一个新的编译器(binutils, gcc,gdb等),这个新的编译器将来编译出来的其他程序将运行在target指定的系统上。
如果不编译新的编译器,这个参数可以不填,或者与 host的参数一致

--target=arm-xilinx-linux-gnueabi
或者不写 --target的参数

 

3.2.4 CC 编译器参数

CC          C compiler command

 

指定GCC 交叉编译器命令,如果配置了,则使用CC配置的编译器,如果不配置则默认为host对应的GCC工具
如配置了 --host=arm-xilinx-linux-gnueabi,则默认CC的编译器为 arm-xilinx-linux-gnueabi-gcc
这个参数如无特殊指定,可以忽略不写。

3.2.5 prefix 安装参数
该参数指定编译后,文件安装的目录。

 --program-prefix=PREFIX            prepend PREFIX to installed program names

 

不指定prefix,则可执行文件默认放在/usr/local/bin,库文件默认放在/usr/local/lib,配置文件默认放在/usr/local/etc。其他的资源文件放在/usr/local/share。你要卸载这个程序,要么在原来make目录下用make uninstall(前提是make文件指定过make uninstall),要么去上述文件中一个一个手动删除。如需指定make install 的目录,如 /home/tmp/test

--prefix=/home/tmp/test

 

3.3 编译参数示例

如编译 zynq平台下的程序,则配置如下即可

./configure  --host=arm-xilinx-linux-gnueabi --build=i686-pc-linux-gnu --target=arm-xilinx-linux-gnueabi CC=arm-xilinx-linux-gnueabi-gcc
或者
./configure --host=arm-xilinx-linux-gnueabi  --build=i386-linux
或者
./configure  --host=arm-xilinx-linux-gnueabi 
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
好的,以下是一份满足大部分场景的生产环境下Apache的./configure参数列表,以及每个参数的作用: ``` ./configure \ --enable-so \ --enable-rewrite=shared \ --enable-ssl=shared \ --with-ssl \ --with-pcre \ --with-zlib \ --with-libxml2 \ --with-crypto \ --with-mpm=prefork \ --prefix=/usr/local/apache2 \ --with-included-apr \ --enable-mods-shared=all ``` - `--enable-so`:启用动态共享对象(DSO)支持,这样可以在运行时加载模块,而不必重新编译Apache。 - `--enable-rewrite=shared`:启用mod_rewrite模块,并将其编译为动态共享对象。 - `--enable-ssl=shared`:启用mod_ssl模块,并将其编译为动态共享对象。 - `--with-ssl`:指定OpenSSL库的路径。 - `--with-pcre`:指定PCRE库的路径,用于支持正则表达式匹配。 - `--with-zlib`:指定Zlib库的路径,用于支持压缩和解压缩。 - `--with-libxml2`:指定libxml2库的路径,用于支持XML解析。 - `--with-crypto`:指定OpenSSL的crypto库的路径,用于支持加密和解密。 - `--with-mpm=prefork`:指定Apache所使用的多进程模型,这里选择了prefork,适用于大型站点。 - `--prefix=/usr/local/apache2`:指定安装路径。 - `--with-included-apr`:使用Apache Portable Runtime (APR)库,这是一个跨平台的库,提供了对操作系统底层的封装。 - `--enable-mods-shared=all`:启用所有可用的动态共享对象模块。 这些参数的选择基于一些常见的生产环境需求,如支持SSL、正则表达式、XML解析、加密和解密等。但具体的参数配置应该根据实际情况和需求进行调整。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值