autotools configure.ac error checking perl module - perl-module

In my configure.ac, I want to check in this perl module exiftool (http://search.cpan.org/~exiftool/Image-ExifTool-10.20/lib/Image/ExifTool.pod) exists as:
AX_PROG_PERL_MODULES( Image::ExifTool, ,)
But this is giving error:
./configure: line 4071: syntax error near unexpected token `Image::ExifTool,'
./configure: line 4071: `AX_PROG_PERL_MODULES( Image::ExifTool, ,)'
What is going wrong here?
For reference, here is my complete configure.ac
AC_INIT([mkbib], [0.1],[],[mkbib])
AM_INIT_AUTOMAKE([1.9.6 dist-bzip2 subdir-objects])
AM_PATH_PYTHON([3.0])
AM_PATH_GTK_3_0([3.4.0],,AC_MSG_ERROR([Gtk+ 3.0.0 or higher required.]))
AX_PROG_PERL_MODULES( Image::ExifTool, ,)
GLIB_GSETTINGS
AC_CONFIG_FILES([Makefile
data/Makefile
data/mkbib.desktop
data/icons/Makefile
data/icons/hicolor/Makefile
data/icons/hicolor/48x48/Makefile
data/icons/hicolor/48x48/apps/Makefile
data/icons/hicolor/scalable/Makefile
data/icons/hicolor/scalable/apps/Makefile
data/ui/Makefile
])
AC_OUTPUT

You don't have a definition of AX_PROG_PERL_MODULES in your project. This comes from the Autoconf archive, rather than base autoconf (thus the AX_ prefix.) You probably want to download the .m4 (and any of its dependencies) and add it to your m4/ directory, then run something along the lines of autoreconf -is -I m4.
You can dig further into the external macro usage on my Autotools MYthbuster if you're interested, but the gist of it is that.

Related

Attempting to compile through MacOS Terminal: "No such file or directory"

I'm trying to compile this project from DTU. This project requires that PETSc be installed.
I have installed PETSc to /Users/hornymoose/petsc-3.13.3/
I have extracted the zip from GitHub to /Users/hornymoose/dtu
The DTU project's makefile has the following lines:
include ${PETSC_DIR}/lib/petsc/conf/variables
include ${PETSC_DIR}/lib/petsc/conf/rules
include ${PETSC_DIR}/lib/petsc/conf/test
In these lines, {PETSC_DIR} is to be substituted with the user's PETSc installation directory. Thus, I changed these lines to:
include $/Users/hornymoose/petsc-3.13.3/lib/petsc/conf/variables
include $/Users/hornymoose/petsc-3.13.3/lib/petsc/conf/rules
include $/Users/hornymoose/petsc-3.13.3/lib/petsc/conf/test
To compile the code, I write make topopt in Terminal. Doing so yields:
makefile:13: Users/hornymoose/petsc-3.13.3/lib/petsc/conf/variables: No such file or directory
makefile:14: Users/hornymoose/petsc-3.13.3/lib/petsc/conf/rules: No such file or directory
makefile:15: Users/hornymoose/petsc-3.13.3/lib/petsc/conf/test: No such file or directory
make: *** No rule to make target `Users/jhutopopt/petsc-3.13.3/lib/petsc/conf/test'. Stop.
I have gone back and manually checked that Users/hornymoose/petsc-3.13.3/lib/petsc/conf/variables, ...rules, and ...test definitely exist and do not have errors.
Why am I receiving this error? Am I indicating the directory incorrectly in my makefile? Is the syntax in the makefile incorrect?
I'm sure there is a simple solution, I'm just very new to working with Terminal in MacOS. Thank you in advance!
There is a $ in the paths:
include $/Users/hornymoose/petsc-3.13.3/lib/petsc/conf/variables
^
This causes the / to be treated as a variable, and expanded to nothing because was never set. Run make with option --warn-undefined-variables to get a warning on that sort of thing. Perhaps already obvious at this point, but the correct line would be:
include /Users/hornymoose/petsc-3.13.3/lib/petsc/conf/variables
Rather than manually substituting the PETSC_DIR in the makefile you can provide it through an environment variable (assuming PETSc makefiles aren't bad):
export PETSC_DIR=/Users/hornymoose/petsc-3.13.3
make topopt
...or:
PETSC_DIR=/Users/hornymoose/petsc-3.13.3 make topopt
...or pass its value to the make invocation:
make topopt PETSC_DIR=/Users/hornymoose/petsc-3.13.3

Gnulib config.h missing error

I'm trying to port libisofs to Windows. My environment is MSYS2 with mingw-w64-i686 toolchain installed.
I've used gnulib for missing headers with
gnulib-tool --import command:
$ ../gnulib/gnulib-tool --import fnmatch
I've done all steps in instruction:
Don't forget to
- add "lib/Makefile" to AC_CONFIG_FILES in ./configure.ac,
- mention "lib" in SUBDIRS in Makefile.am,
- mention "-I m4" in ACLOCAL_AMFLAGS in Makefile.am,
- mention "m4/gnulib-cache.m4" in EXTRA_DIST in Makefile.am,
- invoke gl_EARLY in ./configure.ac, right after AC_PROG_CC,
- invoke gl_INIT in ./configure.ac.
Altough, there was no AC_PROG_CC in configure.ac, so I've added gl_EARLY after AM_PROG_CC_C_O
And there was no SUBDIRS variable in Makefile.am so I've added it manually at the bottom, as so:
SUBDIRS = lib
All configurations I've made as so:
autoreconf -i
automake --add-missing
autoconf
./configure
After running make I recieve error:
hard-locale.c:19:10: fatal error: config.h: No such file or directory
#include <config.h>
As I understand that file must be created by ./configure, but I don't understand why compiler doesn't find it.
configure.ac: https://pastebin.com/JbWRqjEv
Makefile.am: https://pastebin.com/V6ZBq8Vd
All outputs: https://pastebin.com/WFu5aJU7
Gnulib assumes that your configure.ac file contains
AC_CONFIG_HEADERS([config.h])
Without it, every compiler command invocation is more than 1000 characters long, due to the many -D options; this is not practical for development.

Include mpi to make file

I am trying to include MPI compiler to my makefile. The makefile is already prepared such that I only need to include the address of the MPI compiler in a a separate env file. However doing so does not work. I can get the cpp file to run manually by typing:
mpicxx Demo_00.cpp -o aprogram
./aprogram
I test where the mpi compiler is located using:
which mpicxx
/usr/bin/mpicxx
In the env file the corresponding line is:
MPICXX=/usr/bin/mpicxx
However, when I try to 'make' he cpp file I get the following error:
make Demo_00
g++ Demo_00.cpp -o Demo_00
Demo_00.cpp:2:17: fatal error: mpi.h: No such file or directory
compilation terminated.
make: *** [Demo_00] Error 1
The cpp file is in the same folder as the env file and the makefile.
I am not quite sure how to identify the error.
Thank you for your help,
Tartaglia
If you want to change the name of the C++ compiler, you have to change the variable CXX. That's the default variable make uses when it wants to compile C++ code.
This line in your log file:
g++ Demo_00.cpp -o Demo_00
says that you are using g++ compiler instead of mpixx.
Usually in makefiles compiler definition is at the beginnig of the file and looks like this:
CC=g++
just change it to mpixx
CC=mpixx
Thank you all for your responses, I took a closer look into the makefile I thought I was using and it turns out, as you have already suggested, I was not using it at all. The makefile was only able to execute one specific cpp file with one specific name. So whenever I typed in make *.cpp I was using the standard make as you already pointed out.
Thanks again for your help.

Missing separator in Makefile

So here's the thing.
I'm trying to build pngwriter. In the makefile there's a line saying:
include make.include
The file make.include has the function to specify the platform used via a symlink, it has just one line:
make.include.linux
(there's a file in the same directory called make.include.linux which has some necessary settings. And by the way, I'm doing this on Windows with MinGW)
in the msys shell, when I do make, it says:
make.include:1: *** missing separator. Stop.
I've looked at other missing separator posts and they're about spaces/tabs, which I think it's not the case here. I've searched about makefiles, symlinks, separators and could solve it.
Please help!
EDIT! OK, so make.include.linux isn't a command, it's a file whose contents need to be included in the original makefile. The make.include should be, as I read, a symlink to make.include.linux.
What you have there isn't valid make syntax. Commands can only be run as part of a target recipe. In your case it seems like what you want is:
all:
make.include.linux
Assuming that make.include.linux is a command, and not something else. Make sure the indentation is a tab character.

Autoreconf stops with "non-POSIX variable name"

I created a Makefile.in where I read the content out of a file and pass it to CFLAGS. Calling ./configure ... the Makefile will be generated an all works well.
Makefile.in:
...
MY_REVISION_FILE=my-revision.txt
MY_REVISION=$(shell cat $(top_srcdir)/$(MY_REVISION_FILE))
AM_CFLAGS = -I$(EXTRAS_INCLUDE_DIR) -I$(top_srcdir) -DMY_REVISION=$(MY_REVISION)
...
The problem arises once I moved the Makefile.in code into Makefile.am to allow the auto generation of Makefile.in. There calling autoreconf -i --force stops with the following error:
server/Makefile.am:9: cat $(top_srcdir: non-POSIX variable name
server/Makefile.am:9: (probably a GNU make extension)
autoreconf: automake failed with exit status: 1
This problem hunts me now since quite some time. I searched everywhere but did not find anything that could help me finding a solution for that. In short, the only thing I need is a way to get an uninterpreted text such as "$(shell cat $(top_srcdir)/$(MY_REVISION_FILE))" copied from Makefile.am to Makefile.in
Any idea?
Thanks,
Oliver
As it says, the problem is you're using a GNUism in your Makefile.am, when it's only meant to contain portable Makefile code.
Either rewrite your code so it's portable (you should use AM_CPPFLAGS because you're passing flags to the preprocessor, not the compiler):
AM_CPPFLAGS = -I$(EXTRAS_INCLUDE_DIR) -I$(top_srcdir) -DMY_REVISION=`cat $(top_srcdir)/$(MY_REVISION_FILE)`
If you don't want to invoke cat on every compile, you could find the value in configure.ac and either AC_SUBST it into Makefile or AC_DEFINE it so it goes into config.h.
Or if you want to be non-portable (ಠ_ಠ), you can take -Werror out of your AM_INIT_AUTOMAKE or AUTOMAKE_OPTIONS, or add -Wno-portability.
After long testing back and forth I decided to use AC_SUBST.
My solution might not be the cleanest but it works for me.
In configure.ac I added the following line
AC_SUBST([DOLLAR_SIGN],[$])
In the Makefile.am I changed my previous line into
MY_REVISION=#DOLLAR_SIGN#(shell cat $(SRC_DIR)/$(MY_REVISION_FILE))
And it works.
Again, thanks for your help.

Resources