linux下,源码的安装之 ./configure –prefix –with解释
linux下,源码的安装一般由3个步骤组成:配置(configure)、编译(make)、安装(make install)。
过程中用到
./configure –prefix –with;其中–prefix指的是安装路径,–with指的是安装本文件所依赖的库文件
with:指定依赖
–with-依赖包名称=依赖包目录–with-apxs 是指定 apache 的配置程序路径,php编译程序会通过这个程序查找apache的相关路径
–with-libxml-dir 指向的是 libxml 的库路径
–with-gd 指静态编译gd库
–with-png-dir 指定 libpng 的路径
综上所述,带着-dir的一般是用于指定库文件路径,没有的话可能是启用某些特性或者指向某特定路径。
———–
安装httpd时,进行指定安装,用到./configure –prefix
具体解释:.表示当前目录。/是目录分隔符。合起来就是当前目录下指定安装路径。
如果不指定prefix,则可执行文件默认放在/usr/local/bin,库文件默认放在/usr/local/lib,配置文件默认放在/usr/local/etc。其它的资源文件放在/usr /local/share。
你要卸载这个程序,要么在原来的make目录下用一次make uninstall(前提是make文件指定过uninstall),要么去上述目录里面把相关的文件一个个手工删掉。
指定prefix,直接删掉一个文件夹就够了。
(把安装路径配置为根目录。你接下来运行make和make install后,就可以在根目录下找到所安装的文件。)
备注:
./configure的作用是检测系统配置,生成makefile文件,以便你可以用make和make install来编译和安装程序。
./configure是
源代码
安装的第一步,主要的作用是对即将安装的软件进行配置,检查当前的环境是否满足要安装软件的依赖关系,但并不是所有的tar包都是
源代码
的包,你先ls,看有没有configure或者makefile文件。
如果有configure,就./configure,有很多参数,看楼下的吧。如果系统环境合适,就会生成makefile,否则会报错。
如果有makefile,就直接make,然后make install。你还可以用rpm或者deb包来安装。而且现在的发行版都有自己的包管理器,比如apt或yum,一个命令就可以从源下载软件,还可以自动解决依赖问题。
configure详细命令参数:
$ ./configure -h
`configure’ configures python 3.7 to adapt to many kinds of systems.Usage: ./configure [OPTION]… [VAR=VALUE]…
To assign environment variables (e.g., CC, CFLAGS…), specify them as
VAR=VALUE. See below for descriptions of some of the useful variables.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]
–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/python]
–htmldir=DIR html documentation [DOCDIR]
–dvidir=DIR dvi documentation [DOCDIR]
–pdfdir=DIR pdf documentation [DOCDIR]
–psdir=DIR ps documentation [DOCDIR]System types:
–build=BUILD configure for building on BUILD [guessed]
–host=HOST cross-compile to build programs to run on HOST [BUILD]Optional Features:
–disable-option-checking ignore unrecognized –enable/–with options
–disable-FEATURE do not include FEATURE (same as –enable-FEATURE=no)
–enable-FEATURE[=ARG] include FEATURE [ARG=yes]
–enable-universalsdk[=SDKDIR]
Build fat binary against Mac OS X SDK
–enable-framework[=INSTALLDIR]
Build (MacOSX|Darwin) framework
–enable-shared disable/enable building shared python library
–enable-profiling enable C-level code profiling
–enable-optimizations Enable expensive, stable optimizations (PGO, etc).
Disabled by default.
–enable-loadable-sqlite-extensions
support loadable extensions in _sqlite module
–enable-ipv6 Enable ipv6 (with ipv4) support
–disable-ipv6 Disable ipv6 support
–enable-big-digits[=BITS]
use big digits for Python longs [[BITS=30]]Optional Packages:
–with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
–without-PACKAGE do not use PACKAGE (same as –with-PACKAGE=no)
–with-universal-archs=ARCH
select architectures for universal build (“32-bit”,
“64-bit”, “3-way”, “intel”, “intel-32”, “intel-64”,
or “all”)
–with-framework-name=FRAMEWORK
specify an alternate name of the framework built
with –enable-framework
–without-gcc never use gcc
–with-icc build with icc
–with-cxx-main=<compiler>
compile main() and link python executable with C++
compiler
–with-suffix=.exe set executable suffix
–with-pydebug build with Py_DEBUG defined
–with-assertions build with C assertions enabled
–with-lto Enable Link Time Optimization in any build. Disabled
by default.
–with-hash-algorithm=[fnv|siphash24]
select hash algorithm
–with-address-sanitizer
enable AddressSanitizer (asan)
–with-memory-sanitizer enable MemorySanitizer (msan)
–with-undefined-behavior-sanitizer
enable UndefinedBehaviorSanitizer (ubsan)
–with-libs=’lib1 …’ link against additional libs
–with-system-expat build pyexpat module using an installed expat
library
–with-system-ffi build _ctypes module using an installed ffi library
–with-system-libmpdec build _decimal module using an installed libmpdec
library
–with-decimal-contextvar
build _decimal module using a coroutine-local rather
than a thread-local context (default is yes)
–with-tcltk-includes=’-I…’
override search for Tcl and Tk include files
–with-tcltk-libs=’-L…’
override search for Tcl and Tk libs
–with-dbmliborder=db1:db2:…
order to check db backends for dbm. Valid value is a
colon separated string with the backend names
`ndbm’, `gdbm’ and `bdb’.
–with(out)-doc-strings disable/enable documentation strings
–with(out)-pymalloc disable/enable specialized mallocs
–with(out)-c-locale-coercion
disable/enable C locale coercion to a UTF-8 based
locale
–with-valgrind Enable Valgrind support
–with(out)-dtrace disable/enable DTrace support
–with-libm=STRING math library
–with-libc=STRING C library
–with(out)-computed-gotos
Use computed gotos in evaluation loop (enabled by
default on supported compilers)
–with(out)-ensurepip=[=upgrade]
“install” or “upgrade” using bundled pip
–with-openssl=DIR root of the OpenSSL directory
–with-ssl-default-suites=[python|openssl|STRING]
Override default cipher suites string, python: use
Python’s preferred selection (default), openssl:
leave OpenSSL’s defaults untouched, STRING: use a
custom string, PROTOCOL_SSLv2 ignores the settingSome influential environment variables:
MACHDEP name for machine-dependent library files
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 pathUse these variables to override the choices made by `configure’ or to help
it to find libraries and programs with nonstandard names/locations.