Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Handling whitespaces in file names using autotools

How do I tell automake to use a file with whitespaces in its name? This doesn't seem to work.

bin_PROGRAMS = prog
prog_SOURCES = "a file.c" "another file.c"
like image 944
Hristo Venev Avatar asked Oct 14 '12 15:10

Hristo Venev


People also ask

Should you use spaces in filenames?

Don't start or end your filename with a space, period, hyphen, or underline. Keep your filenames to a reasonable length and be sure they are under 31 characters. Most operating systems are case sensitive; always use lowercase. Avoid using spaces and underscores; use a hyphen instead.

Why shouldn't you have spaces in file names?

Avoid spaces Spaces are not supported by all operating systems or by command line applications. A space in a filename can cause errors when loading a file or when transferring files between computers. Common replacements for spaces in a filenames are dashes (-) or underscores (_).

Can Java file name have spaces?

Java per se handles spaces in filenames just fine with no escaping or anything. You may be trying to access a file the user running the jvm don't have access to.

Why Should spaces be avoided in Linux filenames?

Length. A file system may limit the length a file can have. This was even more serious during the days when MS-DOS was limited to 8.3 filenames. So, leaving out spaces enabled you to put more meaningful characters into the name.


1 Answers

You can't. (Surprisingly, this is the only extremely serious fault in Automake in my opinion, but people hardly ever complain about it.)

I once worked around installing data files with spaces in their names, by renaming the files in the source tree so that they didn't have spaces, then renaming them to their spaceful names in install-data-hook. (link)

That, however, has no bearing on your problem, to which my answer is still: you can't. As far as I know, prog_SOURCES is just a shell variable. A specially-named one, sure, but once Automake finds it, it simply separates it on spaces. Spaces are spaces, whether they're escaped, quoted, or plain. They should have designed it so that you could escape spaces, but I'm sure they won't change it now because it would cause widespread Automake breakage.

like image 183
ptomato Avatar answered Oct 12 '22 00:10

ptomato