Sunday, December 04, 2011

GNU autoconf usage

Reference 〔轉〕使用 GNU autotools 改造一個軟件項目

Reference 使用GNU Autotools【轉貼】
Following is the conclusion:

Example 1
1. Write a code (hello.c) and Makefile.
2. Run "autoscan" to produce "configure.scan"
3. Rename "configure.scan" to "configure.ac"
4. Run "autoconf" (according to "configure.ac" to produce "configure")
5. Rename "Makefile" to "Makefile.in" (Run "configure" will base "Makefile.in" to produce "Makefile")
6. Run "./configure" and "make"

Example 2 (let code portable)
1. Write "Makefile.in"
2. Run "autoscan"
3. Rename "configure.scan" to "configure.ac"
4. Run "autoheader"
5. Run "autoconf"
6. Run "./configure"
7. Check "config.h", if necessary, modified source code and back to step 2.
8. Run "make"

Example 3 (Use 『automake』)
1. Write code, Create "Makefile.am"
2. Run "autoscan"
3. Rename "configure.scan" to "configure.ac"
4. Modified "configure.ac" to add MACRO for "automake"
5. Run "aclocal"
6. Create documents necessary for "automake"
7. Run "automake" (automake -a)
8. Run "autoheader"
9. Run "autoconf"
10. Run "./configure"
11. Check "config.h", if necessary, modified source code and back to step 2.
12. Run "make"

No comments: