Linux學習篇之---Configure script(配置指令碼),---configurescript

來源:互聯網
上載者:User

Linux學習篇之---Configure script(配置指令碼),---configurescript

Configure script(配置指令碼)

From Wikipedia, the free encyclopedia

源於維基百科全書


A Configure script is an executable script designed to aid in developing a program to be run on a wide number of different computers. It matches the libraries on the user's computer, with those required by the program, just before compiling it from its source code.

配置指令碼是旨在協助開發的程式能夠運行在不同電腦上的可執行指令碼。在配置指令碼所屬的原始碼編譯之前,配置指令碼在使用者電腦上匹配程式運行所需的庫檔案。

As a common practice, all configure scripts are named "configure". Usually, configure scripts are written for the Bourne shell, but they may be written for execution in any desired shell.

作為慣例,所有的配置指令碼都被命名為“configure”。配置指令碼通常是用Bourne shell指令碼編寫的,但是配置指令碼也可以由任何其他版本的shell指令碼語言編寫來用來執行。

Usage(用法)

Obtaining software directly from the source code (a standard procedure on Unix computers) generally involves the following three steps: configuring the makefile, compiling the code, and finally installing the executable in the appropriate places. A configure script accomplishes the first of these steps. Using configure scripts is an automated method of generating makefiles before compilation to tailor the software to the system on which the executable is to be compiled and run. The final executable software is most commonly obtained by executing the following commands in a shell that is currently pointing to the directory containing the source code:

直接由源碼產生軟體(在Unix電腦上標準流程)通常涉及以下三步驟:配置makefile檔案,編譯代碼,最終將可執行程式安裝在合適的地方。配置指令碼用來完成三步中的第一步。編譯出與系統有良好相容性的軟體之前,用配置指令碼產生makefile檔案是一個自動化的方法。在源檔案目錄下執行包含以下命令的shell指令碼將會最終產生可啟動並執行軟體。

One must type ./configure (dot slash configure) rather than simply configure to indicate to the shell that the script is in ".", i.e. the current directory. By default, for security reasons, Unix operating systems do not search the current directory for executables so one must give the full path explicitly to avoid an error.[1]

必須在configure之前加上點號和斜杠./configure這種格式用來告訴shell程式configure指令碼所在的位置,比如在目前的目錄。預設情況下,處於安全考慮,Unix作業系統不會在目前的目錄下搜尋可執行檔,所以為了避免錯誤發生必須給出完整的路徑。

Upon its completion, configure prints a report to config.log. Running ./configure --help gives a list of command line arguments, for enabling or disabling additional features such as:

一旦配置指令碼運行完成,它會在config.log中列印一份報告。運行./configure --help會得到一個命令列參數列表,用來使能額外的功能可以這樣:

The first line includes the mpfr and gmp libraries. The second line tells make to install the final version in /home/myname/apps. Note that if you have a space character in your argument, you will need to enclose the text in quotation marks as shown on the first line. The INSTALL file contains instructions should the prescribed steps fail.

第一行包含mpfr庫檔案和gmp庫檔案。第二行是說在路徑/home/myname/apps下安裝最終版本。注意,如果在你的參數之間有一個空格,你需要如第一行所示將常值內容包含在雙引號內。如果安裝檔案中包含安裝指令,那麼標準步驟將不會成功。

Generating configure(產生configure)

Software developers simplify the challenge of cross-platform software development by using GNU's Autotools.[2] These scripts query the system on which they run for: environment settings, platform architecture, and the existence and location of required build and runtime dependencies. They store the gathered information in configure.ac or (the now deprecated) configure.in to be read by configure during the installation phase.

軟體開發人員通過利用GNU下的Autotools工具使跨平台軟體開發的難度降低。指令碼在系統上查詢:系統設定,平台架構,build和runtime所需的依賴關係的存在性和位置。收集的資訊將被儲存在configure.ac檔案或configure.in(現在已經被廢棄)被configure在安裝階段使用。

Dependency checking(依賴關係檢測)

In new development, library dependency checking has been done in great part using pkg-config via the m4 macro, PKG_CHECK_MODULES. Before pkg-config's gained popularity, separate m4 macros were created to locate files known to be included in the distribution of libraries depended upon.

最新進展,庫檔案依賴檢測大多數情況下已經可以通過pkg-config軟體中的m4宏和PKG_CHECK_MODULES模組完成。在pkg-config得到普及之前,單獨的m4宏被建立在linux發行版的依賴庫中用來定位檔案。

History(曆史)

The first program to come with a Configure script was rn by Larry Wall in 1984. Notable for its wry and jocular running commentary, that script was written entirely by hand and still survives as part of the build system of the trn program.
第一個有配置指令碼的程式是由拉裡·沃爾在1984年開發的rn。令人感到諷刺的是,這個指令碼是完全手工編寫的,並且現在仍然作為貸款程式編譯系統的一部分而存在。

Since then, an ecosystem of programs has grown up to automate the creation of Configure scripts as far as possible, of which the most common is the GNU Autoconf system described above.

從那以後,程式的生態系統已經升級為儘可能像以上提到的GNU Autoconf系統那樣自動產生配置指令碼。





聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.