The Configure option configuration parameter in Linux is detailed

Source: Internet
Author: User
Tags config

Software installation in a Linux environment, it is not an easy thing to do; If you compile from the source code after the installation, of course, the matter is more complex; now the tutorials for installing a variety of software are very common; but million change, the basic knowledge of a solid grasp, the installation of a variety of software problems will be solved. Configure script Configuration tool is one of the basics, it is the basic application of autoconf tools.

Compared with some skills, configure appears to be based on some, of course, the use and learning to appear boring some, of course, to become a master, on the basis of familiarity can not be beyond oh.

For this I have reproduced a detailed introduction about the configuration of the Configure option. For your reference the ' configure ' script has a large number of command-line options. These options may change for different packages, but many of the basic options will not change. Take the ' –help ' option to perform ' Configure ' The script can see all the options available. Although many options are rarely used, it is useful to know that they exist when you configure a package for special needs. The following is a brief introduction to each option:

–cache-file=file

' Configure ' will test the presence of features (or bug!) on your system. To speed up subsequent configurations, the test results are stored in a cache file. When configure a complex source tree with a ' configure ' script in each subtree, a good cache file presence can be a great help.

–help

Output help information. Even experienced users occasionally need to use the ' –help ' option because a complex project contains additional options. For example, the ' configure ' script in the GCC package contains options that allow you to control whether the GNU assembler is generated and used in GCC.

–no-create

A primary function in ' configure ' produces an output file. This option prevents ' configure ' from generating this file. You can think of this as a drill (dry run), although the cache is still rewritten.

–quiet

–silent

When ' configure ' carried out his tests, will output a brief message telling the user what is being done. This is because ' configure ' may be slower, without which the user will be thrown aside to wonder what is happening. Using either of these options will throw you aside. . These two words are more interesting, the original text is this: If there was no such output, the user would to left wondering what is happening. By using this option, too can is left wondering!)

–version

Prints the version number of the autoconf used to produce the ' configure ' script.

–prefix=prefix (Location of file installation)

' –prefix ' is the most commonly used option. The system makes the ' Makefile ' to see the parameters passed with this option, and when a package is installed, it can completely relocate the independent part of his structure. For example, when installing a package, such as Emacs, the following command will cause Emacs Lisp file to be installed to "/opt/gnu/share":

$./configure–prefix=/opt/gnu/share

–exec-prefix=eprefix

Similar to the ' –prefix ' option, but he is used to set the installation location of a structure-dependent file. A compiled ' emacs ' binary file is one such file. If this option is not set, the default option value is set to the same as the ' –prefix ' option value.

–bindir=dir

Specifies the location where the binaries are installed. The binaries here are defined as programs that can be executed directly by the user.

-sbindir=dir

Specifies the location where the super binaries are installed. This is a few programs that are typically executed only by Superuser.

–libexecdir=dir (Package directory, program invocation)

Specifies the location where executable support files are installed. In contrast to binary files, these files are never executed directly by the user, but can be executed by the binary file mentioned above.

–datadir=dir

Specifies the location where common data files are installed.

–sysconfdir=dir (/etc configuration file directory)

Specifies the location of the installation of read-only data to be used on a single machine.

–sharedstatedir=dir

Specifies the installation location for writable data that can be shared on multiple machines.

–localstatedir=dir

Specifies the location where writable data can be installed only for stand-alone use.

–libdir=dir (library file directory)

Specifies the location where the library files are installed.

–includedir=dir

Specifies the location where the C header file is installed. Other languages such as C + + header files can also use this option.

–oldincludedir=dir

Specifies the installation location of the C header file that is installed for the compiler outside of GCC.

–infodir=dir

Specifies the location where the info format document is installed. Info is the document format used by the GNU project.

–mandir=dir (installation directory for help documents)

Specifies the location where the man page is installed.

–srcdir=dir

This option has no effect on the installation. He will tell ' configure ' the location of the source code. In general, you don't have to specify this option because the ' configure ' script is in the same directory as the source file.

–program-prefix=prefix

Specifies the prefix to be added to the name of the installed program. For example, using ' –program-prefix=g ' to configure a program named ' Tar ' will cause the installed program to be named ' Gtar '. When used with other installation options, this option is only when he is ' Makefile.in ' file will not work until it is used.

–program-suffix=suffix

Specifies the suffix that will be added to the name of the program you are installing.

–program-transform-name=program

The program here is a sed script. When an application is installed, his name will go through ' sed-e ' to produce the name of the installation.

–build=build

Specifies the system platform for package installation. If not specified, the default value will be the value of the ' –host ' option.

–host=host

Specifies the system platform on which the software runs. If not specified, will run ' config.guess ' to detect.

–target=garget

Specifies the system platform to which the software targets (target to). This works primarily in programming language tools such as compilers and assembler contexts. If not specified, the value of the ' –host ' option will be used by default.

–disable-feature

Some packages can choose this option to provide compile-time configuration for large options, such as using the Kerberos authentication system or an experimental compiler optimal configuration. If the default is to provide these features, you can use ' –disable-feature ' to disable it, here ' FEATURE ' is the name of the feature. For example:

The code is as follows:

$./configure–disable-gui

-ENABLE-FEATURE[=ARG] (System parameter configuration, completed at compile time)

Conversely, some software packages may provide some properties that are prohibited by default and can be used using ' –enable-feature '. Here ' FEATURE ' is the name of the feature. An attribute may accept an optional parameter. For example:

The code is as follows:

$./configure–enable-buffers=128

' –enable-feature=no ' is synonymous with the ' –disable-feature ' mentioned above.

–with-package[=arg]

In the free software community, there are excellent traditions for using existing packages and libraries. When you configure a source tree with ' Configure ', you can provide information about other packages that have been installed. For example, a BLT device toolkit that relies on Tcl and TK. To configure BLT, you may need to give ' configure ' Provide some information about where we put Tcl and TK:

The code is as follows:

$./configure–with-tcl=/usr/local–with-tk=/usr/local

' –with-package=no ' is synonymous with the ' –without-package ' that will be mentioned below.

–without-package

Sometimes you may not want to let your package and system already have soft

Package interaction. For example, you may not want your new compiler to use the GNU ld. You can do this by using this option:

The code is as follows:

$./configure–without-gnu-ld

–x-includes=dir

This option is a special case of the ' –with-package ' option. When Autoconf was first developed, it was popular to use ' configure ' as a workaround for Imake to make software that runs on X. ' The –x-includes ' option provides a way to indicate to the ' configure ' script the directory that contains the X11 header file.

–x-libraries=dir

Similarly, the ' –x-libraries ' option provides a way to indicate to the ' configure ' script the directory containing the X11 library.

Running ' Configure ' in the source tree is both unnecessary and bad. A good ' Makefile ' produced by ' Configure ' can build a software package that belongs to another tree. The benefits of building derived files in a separate source-independent tree are obvious: derived files , such as the target file, will be messy scattered in the source tree. This also makes it very difficult to construct the same target file on another different system or with different configuration options. Three trees are recommended: a source tree, a tree of construction, a tree of installation (install Tree). Here is a very close example of using this method to construct the GNU malloc package:

The code is as follows:

$ Gtar ZXF mmalloc-1.0.tar.gz

$ mkdir Build && CD Build

$ .. /mmalloc-1.0/configure

Creating cache./config.cache

Checking for gcc ... gcc

Checking whether the C compiler (GCC) works ... yes

Checking whether the C compiler (GCC) is a cross-compiler ... no

Checking whether we are using GNU C ... yes

Checking whether GCC accepts-g ... yes

Checking for a BSD compatible install .../usr/bin/install-c

Checking host system Type ... I586-pc-linux-gnu

Checking build system Type ... I586-pc-linux-gnu

Checking for ar ... ar

Checking for ranlib ... ranlib

Checking to run the C preprocessor ... gcc-e

Checking for unistd.h ... yes

Checking for getpagesize ... yes

Checking for working mmap ... yes

Checking for limits.h ... yes

Checking for stddef.h ... yes

Updating cache. /config.cache

Creating./config.status

This tree is configured so that the following can continue to build and install this package to the default location '/usr/local ':

The code is as follows:

$ make all && make install

How does a package complete uninstall after compiling the source code installation??

If the original source is still there, a lot of source makefile have written uninstall rules, directly in souce make uninstall is feasible, but encountered unscrupulous authors did not write, That sentence to see Makefile install part of what he has done, and then deleted one by one.

If the source is gone ... then be depressed.

So far, I have been able to make uninstall ...

(Because always accidentally loading the wrong place, the result is make Uninstall&&make clean, and then configure ...)

Related Article

E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

Learn more >

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Learn more >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.