--srcdir=DIR:源碼目錄(通常無需設定)--program-prefix=PREFIX:程式名加前綴(如 --program-prefix=g → gtar)--program-suffix=SUFFIX:程式名加後綴--program-transform-name=PROGRAM:sed 腳本轉換程式名| 參數 | 含義 | 預設行為 |
|---|---|---|
--build=BUILD | **構建平台**(編譯發生的機器) | 默認取 --host 值 |
--host=HOST | **目標執行平台**(程式運行的機器) | 自動執行 config.guess 檢測 |
--target=TARGET | **目標平台**(編譯器/工具鏈面向的平台) | 默認使用 --host 值 |
交叉編譯關鍵在 --host:
./configure --host=arm-linux → ARM 平台交叉編譯./configure --host=mipsel-linux → MIPS 小端序交叉編譯--disable-FEATURE:禁用預設啟用特性(如 --disable-gui)--enable-FEATURE[=ARG]:啟用預設禁用特性(如 --enable-buffers=128)--enable-FEATURE=no ≡ --disable-FEATURE--with-PACKAGE[=ARG]:指定已安裝依賴路徑(如 --with-tcl=/usr/local --with-tk=/usr/local)--without-PACKAGE:禁止與系統庫交互(如 --without-gnu-ld)--with-PACKAGE=no ≡ --without-PACKAGE--x-includes=DIR:X11 頭文件目錄--x-libraries=DIR:X11 庫文件目錄原因:configure 測試程式無法在宿主機運行。解決:使用**快取文件**。
ac_cv_have_abstract_sockets)echo ac_cv_have_abstract_sockets=yes > arm-linux.cache./configure --host=arm-linux --cache-file=arm-linux.cache/sbin/init 3.pc 檔案目錄,讓 pkg-config 正確找庫-I/-L 指明頭文件/庫路徑./configure --help(不同專案可能用 --cross-prefix、--cross-compile 等不同參數)