0

I use GNU Autotools in order to build/configure my mini application.

Here is my configure.ac:

AC_INIT([Tutorial Program], [1.0])
AM_INIT_AUTOMAKE
AC_PROG_CXX

AC_SUBST([GENERAL_INCD], ["-I../Src"])
AC_SUBST([GENERAL_LIBD], ["-L../../Lib"])

AC_SUBST([SOLCPP_LIBS], ["-lsolcpp -lcfsqp"])

AC_SUBST([FFTWPP_INCD], ["-I../fftw++-1.09"]) 
AC_SUBST([FFTWPP_LIBS], ["../fftw++-1.09/fftw++.o"]) 

PKG_CHECK_MODULES([GSL], [gsl])
PKG_CHECK_MODULES([FFTW3], [fftw3])

AC_CONFIG_FILES([Makefile])
AC_OUTPUT

And here is my Makefile.am:

bin_PROGRAMS = test1        
test1_SOURCES = test1.cpp
test1_CPPFLAGS = $(GENERAL_INCD) $(FFTWPP_INCD) $(GSL_CFLAGS) $(FFTW3_CFLAGS)
test1_LDFLAGS=  $(GENERAL_LIBD) $(FFTWPP_LIBS) $(SOLCPP_LIBS) $(GSL_LIBS) $(FFTW3_LIBS)

The problem is when I run ./configure and then make, it tries to do:

g++  -g -O2 -L../../Lib ../fftw++-1.09/fftw++.o -lsolcpp -lcfsqp -lgsl -lgslcblas -lm   -lfftw3 -lm    -o test1 test1-test1.o  
test1-test1.o

Although the correct expected command is the following one:

g++ -O2 test1-test1.o -o test1 -L../../Lib -lsolcpp -lcfsqp ../fftw++-1.09/fftw++.o -lgsl -lgslcblas -lm   -lfftw3 -lm

How to change configure.ac and Makefile.am ?

Thank you very much

odysseasg
  • 121
  • 1
  • 8

1 Answers1

0

It appears that you just want ../fftw++-1.09/fftw++.o to come after -lsolcpp -lcfsqp in which case you merely need to list FFTWPP_LIBS after SOLCPP_LIBS:

test1_LDFLAGS = $(GENERAL_LIBD) $(SOLCPP_LIBS) $(FFTWPP_LIBS) $(GSL_LIBS) $(FFTW3_LIBS)
William Pursell
  • 204,365
  • 48
  • 270
  • 300