When compiling software from source code, there are 3 steps:
./configure make make
install
According to the relationship between the 3 commands in the software compiled from the source code under Linux, in these 3 steps, running the Configure script is a more important step, and the resulting makefile file is the basis for the next two steps.
Unlike the dpkg mechanism, the apt-get mechanism hardly allows us to customize the installation parameters, which gives us a lot of freedom from the source code compilation installation mechanism to customize the installation parameters, which is done by specifying the parameters when running the Configure script.
Each configure script can be configured with a different configuration parameter, which can be viewed by the following command:
./configure--help
Because different configure scripts have different configurable parameters, the next step is to describe only the configurable parameters that most configure scripts can use, not all configure scripts. The Configure script has many configurable parameters, followed by a description of the 3 most important configurable parameters: specifying configurable parameters to install to the directory, specifying configurable parameters for compiling link options, and configurable parameters that specify dependent lookup paths.
1. Specify configurable parameters for installation to directory
With the "./configure--help" command, you can find the configuration of the Configure script about installing to a directory as shown in Figure 1.
Figure 1
As you can see from Figure 1, to specify the installation to the directory yourself, you only need to configure the Prefix,eprefix 2 environment variables that correspond to the configurable parameters of the Configure script:
--prefix prefix
--exec-prefix eprefix
You can also specify the "--oldincludedir" parameter.
2. Specify the configurable parameters for the compile-link option sometimes you need to customize the compilation link options, such as non-standard. h file directory, non-standard library file directory, etc., which requires the use of cflags and ldflags environment variables.
3. Configurable parameters to specify dependent lookup paths
The Configure script checks to see if the current system environment has the required software dependencies installed, and most configure scripts check by using the "pkg-config" command to find out whether the corresponding PC files exist under the default directory, through the "Pkg_config_ PATH environment variable increases its own non-standard search directory.
Note that to use the "pkg-config" command, you first have to install the Pkgconfig software.
#!/bin/bash
installdir= "/home/dsl/bigdisk/testdisk/usr/local"
prefix= $INSTALLDIR
exec_prefix=$ INSTALLDIR
oldincludedir= $INSTALLDIR/oldinclude
dependency_path= $INSTALLDIR/lib/pkgconfig
./ Configure--prefix= $prefix--exec-prefix= $exec _prefix--oldincludedir= $oldincludedir pkg_config_path= $dependency _ Path cflags= "-i$installdir/include-i$installdir/include/apr-1-g-o2-pthread-dlinux-d_reentrant-d_gnu_source-d_ Largefile64_source "ldflags="-l$installdir/lib "