简体   繁体   中英

How to specify makeargs in configure script?

while building how to give include paths and library paths in configure script with --makeargs= ? I mean what is the syntax for makeargs.

You set these flags either in the environment or on the ./configure command line. There are three variables to set:

  • CPPFLAGS is flags for the C preprocessor. Include flags ( -I ) go here, as do -D definitions.
  • CFLAGS are flags for the C compiler. Optimisation flags and machine-specific flags go here.
  • LDFLAGS are for the linker. -L flags go here.

You can set them in the evironment:

$ export CPPFLAGS='-I/foo/bar/baz/include'
$ export LDFLAGS='-L/foo/bar/baz/lib'
$ ./configure

Or you can set them on the command line:

$ ./configure CFLAGS='-I/foo/bar/baz/include' LDFLAGS='-L/foo/bar/baz/lib'

Generally it's safer to use two macros instead of one. One for include directives and one for linking directives:

AC_ARG_WITH(cflags,
[  --with-cflags=CFLAGS            use CFLAGS as compile time arguments.],
    [CFLAGS=$with_cflags; export CFLAGS])

AC_ARG_WITH(ldflags,
[  --with-ldflags=LDFLAGS          use LDFLAGS as link time arguments to ld.],
    [LDFLAGS=$with_ldflags; export LDFLAGS])

Then ./configure --with-cflags="-I/path/one -I/path/two" --with-ldflags="-L/path/other" work.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM