Commit graph

12 commits

Author SHA1 Message Date
Avery Pennarun
1ff5262124 redoconf/configure.sh: use "cmp -s" to silence output.
Eliminates this warning:
    $ mkdir out
    $ ../configure
    $ ../configure --prefix=/usr
    cmp: EOF on _flags after byte 33

Reported-by: compufreak@gmail.com
2019-05-15 14:12:26 -07:00
Avery Pennarun
e24e045a07 docs/cookbook/redoconf-simple: a simple redoconf C++ project.
This is a little simpler than the docs/cookbook/c project, which
doesn't actually have a doc yet because there was too much to explain.
I think I might make that a follow-on cookbook chapter, for people who
have read this simple one.

I think this doc is maybe a little too long; I intended it to be
"here's what you do to get started" but it turned into "here's what you
do to get started, and why it works, in excruciating detail." Not quite
sure how to fix.

(Also updated some other parts of the docs to refer to redoconf as a
real thing now instead of a "maybe someone should write this" thing.)
2019-03-06 03:05:04 -05:00
Avery Pennarun
1a3c11f220 redoconf: a stub rc_include() now sources ./redoconf.rc automatically.
This lets us remove the awkward ". ./redoconf.rc" line from zillions
of .od scripts, without paying the price of *always* including that
whole file every time default.do.sh is used.
2019-03-02 04:24:58 -05:00
Avery Pennarun
49f85f2156 redoconf: assorted minor fixes.
- libqt4.rc: add detection of the 'moc' command in $MOC.
- libssl.rc: add detection script for openssl.
- default.do.sh: provide a die() function to all .od files.  It's just
  too useful to not have it (I haven't converted everything to it yet).
- When building out/x/y.z, match against $S/default.z.od and
  $S/default.od if they exist.
- *.list files (lists of source/object files to include in a binary)
  can now contain *.o files in addition to *.c, *.cc, etc.
- rename compile() to _compile() to avoid polluting the namespace for
  scripts called from default.do.sh.
- When building a .so file in the top level directory, no need to
  make a symlink of it into the top level directory.
- link.od and link-shlib.od forgot to make use of the $xLIBS variable.
2019-03-02 04:12:25 -05:00
Avery Pennarun
88250334da redoconf: move -Wl,-rpath flags to shlib.rc and add -Wl,-z,origin.
It was kind of ugly to have this kind of special flag directly in
link.od; now we detect whether it's available.  This also gives a
project the ability to override the flag in some other way if they
want.

As a result, rc/shlib.rc needs to be included in all.rc.od if you want
to create or link against shared libraries.

While we're here, also add -Wl,-z,origin on platforms where it works.
This is apparently needed for FreeBSD 8.0 at least, and probably other
platforms.

Reported-by: Wayne Scott <wsc9tt@gmail.com>
2019-03-01 13:55:22 -05:00
Avery Pennarun
1574b11598 Precompiled headers: supply "-x c-header" or "-x c++-header" if available.
Some older versions of gcc give "all.hpp: linker input file unused
because linking not done" otherwise, because they don't realize files
named *.hpp are headers.

Reported-by: Wayne Scott <wsc9tt@gmail.com>
2019-02-25 13:09:11 +00:00
Avery Pennarun
328d4ead7a Fix some build problems on MacOS X.
- Linking shared libraries needs slightly different options.

- We were trying to detect mach_time.h but needed to detect
  mach/mach_time.h instead.

While we're here, add a --disable-shared option to ./configure, which
is different from --enable-static.  --disable-shared does not build
*new* share libraries, but doesn't pass -static to the linker
(apparently there is no static linking posible on MacOS).
2019-02-24 22:29:19 -05:00
Avery Pennarun
017997c035 redoconf: posix.rc: fix abort when timespec is not available.
Now we define HAS_POSIX=1 if it works, and to blank otherwise, to be
consistent with other rc scripts, but it doesn't abort if we can't find
timespec.

Meanwhile, slightly clarify the error message in rc.sh.

Reported-by: Nathaniel Filardo <nwfilardo@gmail.com>
2019-02-23 21:00:26 -05:00
Avery Pennarun
bdb8d8a27d redoconf: better handling of required vs optional detectors.
CC.rc was the only "mandatory" detection, which was weird and
inconsistent.  Instead, make it optional like the others, and have it
set a HAVE_CC variable appropriately (and have CXX.rc work the same
way).  Then, add a default.required.rc.od that checks the HAVE_* for
any variable and aborts if it is not available.

This allows us to fix confusing behaviour in allconfig.do, which would
try every compiler on the system, but redo would print a (non-fatal)
error message (and prevent redo-stamp optimization) when CC.rc failed
for any non-working compilers.  Now CC.rc just politely reports that it
didn't find a compiler.  Then we change all.rc.od to make CC.rc
mandatory.

Reported-by: Nathaniel Filardo <nwfilardo@gmail.com>
2019-02-23 16:51:25 -05:00
Avery Pennarun
337e026ce3 redoconf: clock_gettime() detection needs to depend on -lrt.
More generally, default.func.rc.od wasn't super useful because you
couldn't specify either a header file or library dependencies.  Drop it
and make an explicit clock_gettime.rc.od.  As a bonus, this also checks
that CLOCK_MONOTONIC exists as expected.

Reported-by: Wayne Scott <wsc9tt@gmail.com>
2019-02-23 15:51:30 -05:00
Avery Pennarun
ea6a7135f1 redoconf: avoid sed -E in _objlist().
Turns out there's a less confusing way to do it using 'case' wildcards
instead.

Reported-by: Wayne Scott <wsc9tt@gmail.com>
2019-02-23 15:44:46 -05:00
Avery Pennarun
6dae51f4d2 Experimental new redoconf C/C++ build/autoconfiguration system.
To test it out, try this:
	./do -j10 build
	cd docs/cookbook/c
	redo -j10 test

It should detect all the compilers on your system and make three
separate builds for each one: normal, debug, and optimized.  Then it
tries to run a test program under each one.

If there are windows cross compilers and you also have 'wine'
installed, it'll try running the test program under wine as well.

redoconf currently has no documentation other than the example program.
We'll fix that later.
2019-02-23 06:52:25 -05:00