I have a project that uses automake to create the configure
and all related files (I'm using autoreconf
command to make all this stuff). So, I'm trying to set some conditional files to compile when the project is compiling for macOS (OS X), Windows or Linux. But it fails with the following:
$ autoreconf -i ..
src/Makefile.am:30: error: LINUX does not appear in AM_CONDITIONAL
autoreconf: automake failed with exit status: 1
And the part containing the error in that Makefile.am
is the following:
if OSX
butt_SOURCES += CurrentTrackOSX.h CurrentTrackOSX.m
endif
if LINUX
butt_SOURCES += currentTrack.h currentTrackLinux.cpp
endif
if WINDOWS
butt_SOURCES += currentTrack.h currentTrack.cpp
endif
My question is, how can I check if the OS is Linux? And if it's possible, is there a better way to check the OS in automake?
automake
does not createconfigure
and has nothing to do with it at all.automake
createsMakefile.in
based on the templateMakefile.am
.autoreconf
to make all the stuff, and I don't know the exact name for it. And for this files in special, I only need the standard C library. On OS X needs AppleScript, that is only available there. And on Windows is directly unsupported (is a stub function). So I only need to check if is Linux because C library is common on all Linux.