diff --git a/.github/workflows/jobs.yml b/.github/workflows/jobs.yml index 412b8ebdb..8b3780125 100644 --- a/.github/workflows/jobs.yml +++ b/.github/workflows/jobs.yml @@ -70,6 +70,27 @@ jobs: make all make check make distcheck + ubuntu_latest_autotools_install: + runs-on: ubuntu-latest + steps: + - name: Clone and check out repository code + uses: actions/checkout@v2 + with: + fetch-depth: 0 + ref: ${{github.event.pull_request.head.ref}} # Branch where changes are implemented. + repository: ${{github.event.pull_request.head.repo.full_name}} # Repo where changes are implemented. + - name: Check commit + run: | + git log -1 + - name: Update OS + run: sudo apt-get update + - name: Install apt-get dependencies + run: sudo apt-get install -y gfortran gcc g++ openmpi-bin libopenmpi-dev libblas-dev liblapack-dev automake autoconf pkg-config libtool + - name: Run job + run: | + ./bootstrap + ./configure + bash ./tstAutotoolsInstall.sh ubuntu_latest_cmake_python: runs-on: ubuntu-latest steps: diff --git a/.gitignore b/.gitignore index 61eca0459..e19b949a9 100644 --- a/.gitignore +++ b/.gitignore @@ -20,8 +20,7 @@ parpack.pc arpackSolver.pc arpackdef.h arpackicb.h -arpack-ng-config.cmake -arpack-ng-config-version.cmake +tstAutotoolsInstall.sh # Generated by `make` .dirstamp diff --git a/CHANGES b/CHANGES index 688b8410d..24d33613e 100644 --- a/CHANGES +++ b/CHANGES @@ -11,6 +11,7 @@ arpack-ng - 3.9.0 * Support for NAG's nagfor Fortran compiler [ Franck Houssen ] +* Test autotools pkg-config (*.pc files). * Test CMake find_package (*.cmake files). * [BUG FIX] autotools: ICB must be checked first (MPI changes compilers). * [BUG FIX] BLAS/LAPACK: allow suffixes in case BLAS/LAPACK can not provide ICB. diff --git a/CMakeLists.txt b/CMakeLists.txt index 0a978b72d..7bfde8c79 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -730,7 +730,7 @@ include(GNUInstallDirs) set(prefix ${CMAKE_INSTALL_PREFIX}) set(exec_prefix \${prefix}) set(libdir ${CMAKE_INSTALL_FULL_LIBDIR}) -set(includedir ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}/arpack-ng) +set(includedir ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}) set(PACKAGE_NAME ${PROJECT_NAME}) set(PACKAGE_VERSION ${arpack_ng_VERSION}) set(PACKAGE_URL "https://github.com/opencollab/arpack-ng/") @@ -753,16 +753,16 @@ foreach(lib ${LAPACK_LIBRARIES} ${MPI_Fortran_LIBRARIES}) endforeach() string(REPLACE ";" " " PARPACK_PC_LIBS_PRIVATE "${PARPACK_PC_LIBS_PRIVATE}") -configure_file(SRC/arpack.pc.in "${PROJECT_BINARY_DIR}/SRC/arpack${LIBSUFFIX}.pc" @ONLY) -configure_file(PARPACK/SRC/MPI/parpack.pc.in "${PROJECT_BINARY_DIR}/PARPACK/SRC/MPI/parpack${LIBSUFFIX}.pc" @ONLY) -configure_file(EXAMPLES/MATRIX_MARKET/arpackSolver.pc.in "${PROJECT_BINARY_DIR}/EXAMPLES/MATRIX_MARKET/arpackSolver.pc" @ONLY) +configure_file(pkg-config/arpack.pc.in "${PROJECT_BINARY_DIR}/arpack${LIBSUFFIX}.pc" @ONLY) +configure_file(pkg-config/parpack.pc.in "${PROJECT_BINARY_DIR}/parpack${LIBSUFFIX}.pc" @ONLY) +configure_file(pkg-config/arpackSolver.pc.in "${PROJECT_BINARY_DIR}/arpackSolver.pc" @ONLY) install(TARGETS arpack ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) -install(FILES "${PROJECT_BINARY_DIR}/SRC/arpack${LIBSUFFIX}.pc" +install(FILES "${PROJECT_BINARY_DIR}/arpack${LIBSUFFIX}.pc" DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) if (MPI) @@ -770,7 +770,7 @@ if (MPI) ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) - install(FILES "${PROJECT_BINARY_DIR}/PARPACK/SRC/MPI/parpack${LIBSUFFIX}.pc" + install(FILES "${PROJECT_BINARY_DIR}/parpack${LIBSUFFIX}.pc" DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) endif () @@ -783,7 +783,7 @@ if(ICB) endif() if (ICBEXMM) install(FILES EXAMPLES/MATRIX_MARKET/arpackSolver.hpp DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/arpack-ng) - install(FILES "${PROJECT_BINARY_DIR}/EXAMPLES/MATRIX_MARKET/arpackSolver.pc" DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) + install(FILES "${PROJECT_BINARY_DIR}/arpackSolver.pc" DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) endif() endif() diff --git a/EXAMPLES/MATRIX_MARKET/Makefile.am b/EXAMPLES/MATRIX_MARKET/Makefile.am index cc2b7cc5f..865bdfe13 100644 --- a/EXAMPLES/MATRIX_MARKET/Makefile.am +++ b/EXAMPLES/MATRIX_MARKET/Makefile.am @@ -1,8 +1,6 @@ LDADD = $(top_builddir)/SRC/libarpack$(LIBSUFFIX).la AM_CPPFLAGS = -I$(top_builddir) -I$(top_srcdir)/ICB $(EIGEN3_CFLAGS) -pkgincludedir = $(includedir)/arpack - EXTRA_DIST = README check_PROGRAMS = arpackmm @@ -14,7 +12,6 @@ arpackmm_SOURCES = arpackmm.cpp if ICBEXMM pkginclude_HEADERS = arpackSolver.hpp -pkgconfig_DATA = arpackSolver.pc endif CLEANFILES = \ diff --git a/ICB/Makefile.am b/ICB/Makefile.am index 94dc3768a..8587e08a9 100644 --- a/ICB/Makefile.am +++ b/ICB/Makefile.am @@ -1,7 +1,5 @@ AM_CPPFLAGS = -I$(top_builddir) -I$(top_srcdir) -pkgincludedir = $(includedir)/arpack - pkginclude_HEADERS = debug_c.h debug_c.hpp pkginclude_HEADERS += stat_c.h stat_c.hpp pkginclude_HEADERS += arpack.h arpack.hpp diff --git a/Makefile.am b/Makefile.am index 84bbf1265..5dc0e4126 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,6 +1,6 @@ ACLOCAL_AMFLAGS = -I m4 -pkgincludedir = $(includedir)/arpack +pkgincludedir = $(includedir)/arpack-ng pkginclude_HEADERS = debug.h stat.h debugF90.h statF90.h arpackdef.h AM_DISTCHECK_CONFIGURE_FLAGS = @@ -9,6 +9,7 @@ AM_DISTCHECK_CONFIGURE_FLAGS += --enable-mpi endif if ICB AM_DISTCHECK_CONFIGURE_FLAGS += --enable-icb +pkginclude_HEADERS += arpackicb.h endif if ICBEXMM AM_DISTCHECK_CONFIGURE_FLAGS += --enable-icb-exmm @@ -25,3 +26,8 @@ endif EXTRA_DIST = README.md PARPACK_CHANGES CHANGES DOCUMENTS VISUAL_STUDIO \ detect_arpack_bug.m4 CMakeLists.txt + +pkgconfig_DATA = arpack@LIBSUFFIX@.pc parpack@LIBSUFFIX@.pc arpackSolver@LIBSUFFIX@.pc + +# Due to the LIBSUFFIX, configure doesn't automatically clean this file: +DISTCLEANFILES = arpack@LIBSUFFIX@.pc parpack@LIBSUFFIX@.pc arpackSolver@LIBSUFFIX@.pc diff --git a/PARPACK/SRC/MPI/Makefile.am b/PARPACK/SRC/MPI/Makefile.am index 72b0a85d9..e5198d4f5 100644 --- a/PARPACK/SRC/MPI/Makefile.am +++ b/PARPACK/SRC/MPI/Makefile.am @@ -46,8 +46,3 @@ if ICB libparpack@LIBSUFFIX@_la_LIBADD += $(top_builddir)/ICB/libdbgicb.la $(top_builddir)/ICB/libstaicb.la libparpack@LIBSUFFIX@_la_CPPFLAGS = $(AM_CPPFLAGS) -I$(top_builddir) endif - -pkgconfig_DATA = parpack@LIBSUFFIX@.pc - -# Due to the LIBSUFFIX, configure doesn't automatically clean this file: -DISTCLEANFILES = parpack@LIBSUFFIX@.pc diff --git a/SRC/Makefile.am b/SRC/Makefile.am index 1eac0d763..c1be577a1 100644 --- a/SRC/Makefile.am +++ b/SRC/Makefile.am @@ -33,8 +33,3 @@ if ICB libarpack@LIBSUFFIX@_la_LIBADD += $(top_builddir)/ICB/libdbgicb.la $(top_builddir)/ICB/libstaicb.la libarpack@LIBSUFFIX@_la_CPPFLAGS = $(AM_CPPFLAGS) -I$(top_builddir) endif - -pkgconfig_DATA = arpack@LIBSUFFIX@.pc - -# Due to the LIBSUFFIX, configure doesn't automatically clean this file: -DISTCLEANFILES = arpack@LIBSUFFIX@.pc diff --git a/configure.ac b/configure.ac index 661d0406a..b5c58ee60 100644 --- a/configure.ac +++ b/configure.ac @@ -294,14 +294,19 @@ AM_CONDITIONAL([ICBEXMM], [test x"$enable_icb_exmm" != x"no"]) m4_ifdef([PKG_INSTALLDIR], [PKG_INSTALLDIR], [AC_SUBST([pkgconfigdir], [${libdir}/pkgconfig])]) AC_SUBST([ARPACK_PC_LIBS_PRIVATE], ["$LAPACK_LIBS $BLAS_LIBS"]) AC_SUBST([PARPACK_PC_LIBS_PRIVATE], ["$LAPACK_LIBS $BLAS_LIBS $MPI_Fortran_LIBS"]) + AC_CONFIG_FILES([ - SRC/arpack$LIBSUFFIX.pc:SRC/arpack.pc.in - PARPACK/SRC/MPI/parpack$LIBSUFFIX.pc:PARPACK/SRC/MPI/parpack.pc.in + arpack$LIBSUFFIX.pc:pkg-config/arpack.pc.in + parpack$LIBSUFFIX.pc:pkg-config/parpack.pc.in + arpackSolver$LIBSUFFIX.pc:pkg-config/arpackSolver.pc.in ], [], [LIBSUFFIX="$LIBSUFFIX"]) dnl We do NOT want arpackng*.cmake files to be created: @MPI@ can not be replaced. AC_CONFIG_FILES([ - EXAMPLES/MATRIX_MARKET/arpackSolver.pc + tstAutotoolsInstall.sh:pkg-config/tstAutotoolsInstall.sh.in +], [], [abs_top_builddir="$abs_top_builddir"]) + +AC_CONFIG_FILES([ arpackdef.h arpackicb.h Makefile diff --git a/SRC/arpack.pc.in b/pkg-config/arpack.pc.in similarity index 83% rename from SRC/arpack.pc.in rename to pkg-config/arpack.pc.in index 1c4883a70..437dbae99 100644 --- a/SRC/arpack.pc.in +++ b/pkg-config/arpack.pc.in @@ -1,6 +1,7 @@ prefix=@prefix@ +exec_prefix=@exec_prefix@ libdir=@libdir@ -includedir=@includedir@ +includedir=@includedir@/arpack-ng Name: @PACKAGE_NAME@ Description: Collection of Fortran77 subroutines designed to solve large scale eigenvalue problems diff --git a/EXAMPLES/MATRIX_MARKET/arpackSolver.pc.in b/pkg-config/arpackSolver.pc.in similarity index 100% rename from EXAMPLES/MATRIX_MARKET/arpackSolver.pc.in rename to pkg-config/arpackSolver.pc.in diff --git a/PARPACK/SRC/MPI/parpack.pc.in b/pkg-config/parpack.pc.in similarity index 84% rename from PARPACK/SRC/MPI/parpack.pc.in rename to pkg-config/parpack.pc.in index 3cff6cad4..e8a67e3c0 100644 --- a/PARPACK/SRC/MPI/parpack.pc.in +++ b/pkg-config/parpack.pc.in @@ -1,6 +1,7 @@ prefix=@prefix@ +exec_prefix=@exec_prefix@ libdir=@libdir@ -includedir=@includedir@ +includedir=@includedir@/arpack-ng Name: @PACKAGE_NAME@ Description: Collection of Fortran77 subroutines designed to solve large scale eigenvalue problems diff --git a/pkg-config/tstAutotoolsInstall.sh.in b/pkg-config/tstAutotoolsInstall.sh.in new file mode 100755 index 000000000..30c3041d4 --- /dev/null +++ b/pkg-config/tstAutotoolsInstall.sh.in @@ -0,0 +1,94 @@ +#!/bin/bash -eu +# Testing that PKG_CHECK_MODULES works. +# Note: this script must not be added to the test suite as it will change cmake options. + +# 1. Define temporary directory. + +export TMP_DIR="/tmp/tstAutotoolsInstall" +mkdir -p "${TMP_DIR}" + +# 2. Rerun cmake with prefix, install arpack-ng. +# Note: this script must not be added to the test suite as it will change cmake options. + +make clean +make distclean + +export PROJECT_SOURCE_DIR="$(pwd)" +export TMP_PREFIX="${TMP_DIR}/local" +./configure --prefix="${TMP_PREFIX}" --enable-mpi +make all install + +# 3. Setup environment for PKG_CHECK_MODULES to work (what you typically in module-environment files). + +cd "${TMP_DIR}" +export PKG_CONFIG_PATH="${TMP_PREFIX}/lib/pkgconfig" + +# 4. Create new cmake project, in temporary directory, with files from arpack-ng. + +mkdir -p tstAutotoolsInstall +cd tstAutotoolsInstall + +cp "${PROJECT_SOURCE_DIR}/EXAMPLES/BAND/dnband.f" . +cp "${PROJECT_SOURCE_DIR}/EXAMPLES/BAND/dnbdr1.f" . +cp "${PROJECT_SOURCE_DIR}/PARPACK/EXAMPLES/MPI/pdndrv1.f" . +cp -fr "${PROJECT_SOURCE_DIR}/m4" . + +echo "AC_PREREQ([2.68]) " > configure.ac +echo "AC_INIT([tstAutotoolsInstall], 1.0) " >> configure.ac +echo "AM_INIT_AUTOMAKE([foreign]) " >> configure.ac +echo "AC_CONFIG_MACRO_DIR([m4]) " >> configure.ac +echo " " >> configure.ac +echo "AC_PROG_FC " >> configure.ac +echo "AC_PROG_MKDIR_P " >> configure.ac +echo "AC_PROG_MAKE_SET " >> configure.ac +echo "PKG_PROG_PKG_CONFIG " >> configure.ac +echo " " >> configure.ac +echo "AX_BLAS([], [AC_MSG_ERROR([cannot find BLAS libraries])]) " >> configure.ac +echo "AC_SUBST([BLAS_LIBS]) " >> configure.ac +echo " " >> configure.ac +echo "AX_LAPACK([], [AC_MSG_ERROR([cannot find LAPACK libraries])]) " >> configure.ac +echo "AC_SUBST([LAPACK_LIBS]) " >> configure.ac +echo " " >> configure.ac +echo "AC_LANG_PUSH([Fortran 77]) " >> configure.ac +echo "AX_MPI([], AC_MSG_ERROR([could not compile a Fortran MPI test program]))" >> configure.ac +echo "F77=\$MPIF77 " >> configure.ac +echo "AC_SUBST([MPI_Fortran_LIBS]) " >> configure.ac +echo " " >> configure.ac +echo "PKG_CHECK_MODULES([ARPACK], [arpack]) " >> configure.ac +echo "AC_SUBST([ARPACK_CFLAGS]) " >> configure.ac +echo "AC_SUBST([ARPACK_LIBS]) " >> configure.ac +echo " " >> configure.ac +echo "PKG_CHECK_MODULES([PARPACK], [parpack]) " >> configure.ac +echo "AC_SUBST([PARPACK_CFLAGS]) " >> configure.ac +echo "AC_SUBST([PARPACK_LIBS]) " >> configure.ac +echo " " >> configure.ac +echo "LT_INIT " >> configure.ac +echo " " >> configure.ac +echo "AC_CONFIG_FILES([Makefile]) " >> configure.ac +echo "AC_OUTPUT " >> configure.ac + +echo "AUTOMAKE_OPTIONS = foreign " > Makefile.am +echo "ACLOCAL_AMFLAGS = -I m4 " >> Makefile.am +echo " " >> Makefile.am +echo "EXTRA_DIST = debug.h stat.h " >> Makefile.am +echo " " >> Makefile.am +echo "bin_PROGRAMS = dnbdr1 pdndrv1 " >> Makefile.am +echo " " >> Makefile.am +echo "dnbdr1_SOURCES = dnbdr1.f dnband.f " >> Makefile.am +echo "dnbdr1_FFLAGS = \$(ARPACK_CFLAGS) " >> Makefile.am +echo "dnbdr1_LDADD = \$(ARPACK_LIBS) \$(LAPACK_LIBS) \$(BLAS_LIBS) " >> Makefile.am +echo " " >> Makefile.am +echo "pdndrv1_SOURCES = pdndrv1.f dnband.f " >> Makefile.am +echo "pdndrv1_FFLAGS = \$(PARPACK_CFLAGS) \$(ARPACK_CFLAGS) " >> Makefile.am +echo "pdndrv1_LDADD = \$(PARPACK_LIBS) \$(ARPACK_LIBS) \$(LAPACK_LIBS) \$(BLAS_LIBS) \$(MPI_Fortran_LIBS)" >> Makefile.am + +# 5. Build and test this new project with cmake: for this to be possible, PKG_CHECK_MODULES must work. + +autoreconf --force --verbose --install + +./configure +make all + +./dnbdr1 +mpirun -n 2 ./pdndrv1 +