Question: I am trying to build using `./configure`.

I have

1. Three include directories

```
-I/path1/include
-I/path2/include
-I/path3/include

```
2. Two link directories

```
-L/path1/lib
-L/path2/lib

```
3. Two `-l` flag options

```
-ltensorflow
-lasan

```
4. Two compile flags

```
-O3
-g

```

How can I put all these flags effectively as options in `./configure`?

Answer: 
The canonical way to do this is to provide values for [various variables](https://www.gnu.org/savannah-checkouts/gnu/autoconf/manual/autoconf-2.70/html_node/Preset-Output-Variables.html) in the `./configure` invocation:

```
./configure CPPFLAGS="-I/path1/include -I/path2/include -I/path3/include" \
            CFLAGS="-O3 -g" \
            LDFLAGS="-L/path1/lib -L/path2/lib" \
            LIBS="-ltensorflow -lasan"

```

If the C++ compiler is used, specify `CXXFLAGS` instead of (or in addition to) `CFLAGS`.

These variables can also be set in the environment, but [recommended practice is to specify them as command-line arguments](https://www.gnu.org/savannah-checkouts/gnu/autoconf/manual/autoconf-2.70/html_node/Defining-Variables.html) so that their values will be stored for re-use. See [Forcing overrides when configuring a compile (e.g. CXXFLAGS, etc.)](https://unix.stackexchange.com/q/654153/86440) for details.

Note that in most cases it would be unusual to specify that many paths as flags; instead, I would expect to find `--with` options to tell the `configure` script where to find various dependencies. For example, `--with-tensorflow=/path/to/tensorflow` which would then result in the appropriate `-I` and `-L` flags being set. Run

```
./configure --help

```

to see what options are available.
```
export CFLAGS="-I/path1/include -I/path2/include -I/path3/include -O3 -g"
export CXXFLAGS=$CFLAGS
export LDFLAGS="-L/path1/lib -L/path2/lib -ltensorflow -lasan"
./configure && make

```