Constructing houses, telescopes, and most other important projects requires shaping pieces to precise size, at perfect right angles, or to have flat surfaces. People today have all kinds of ways of accomplishing similar precision, but only because they have tools which were themselves made with impressive precision. Levels and rulers come from the factory, and if you tried to make your own perfectly straight or right-angled object from scratch, I couldn't imagine doing it. So how did people before industrial technology accomplish this?
The easiest way to check if something is "straight" is to just look. Humans can pretty much tell if something is not straight, to a certain point. Another easy way is to use a piece of string. If you pull their ends apart, it will provide you a "straight" reference which you can use to compare to other things. That way you can, for example, draw a line beside it on paper, or make a mold to build a straight object, or hammer down imperfections.
Talking about strings, you can make a square angle (on paper) with a string acting as compass. Use one end as the center of the circle and a pen in the other end.
See this image below. Already having a straight line (black line) as starting point, pick any two points (red dots) in the line. Then draw two circles (with compass, or string, or whatever you have like that) with a radius that makes them overlap (you can even use different radii!). Take the points where the circles touch (blue dots) and draw a line through them (blue line). There you have: a line that is in right angle to the original line. If you can draw that on paper, you can also carve the angle in a piece of wood (for example), comparing it to the drawing.
Always remember that there is not a single real perfect object. Perfection is reserved for abstractions. Real objects respect tolerances and Metrology, the science of measuring, makes it very clear that you simply can't know how perfect something is because "measuring" is always comparing to something that also has some tolerance. You can only try to reduce imperfections until you get to your technological limits or to your requirements. Luckily technology evolves through careful iteration and breakthroughs (only up to a certain point too!).
By the way, the latest version of the International System of Units (SI) tries very hard to make measurements absolute at least in conceptual terms, linking units to absolute values in physics. However, keep in mind that the instruments that will measure those values, and then be reference to other, simpler, instruments, will also have tolerances. Remember that it isn't just fabrication that affects an instrument, but ambient temperature, pressure, humidity, operator skills and all sorts of other factors.
Indeed, it is much easier to manufacture an arc of circle than a straight ruler.
When you rub two rulers against each other you obtain an arc of a circle (or a straight line) as their common edge. This is because the only curves of constant curvature are straight lines and circles. So nothing else will slide smoothly, without gaps.
But there is a simple way to obtain a straight line by a similar process. You need 3 rulers. When you rub rulers A and B against each other, their common edge becomes a circle (or a line). Suppose that the edge of A becomes convex and the edge of B concave. Then you rub A and B against ruler C, and repeat this process of rubbing each pair of the triple, until all three edges will slide against each other smoothly. The only possibility is that all three edges are straight lines.
The process is described in the book M. Berger, Geometry revealed (Springer 2009), on p. 270. He claims that perfect rulers are made by this process to this day.
Similar process can be used to make flat 2-dimensional surfaces. For example, it is used to make spherical lenses and mirrors. If two pieces of glass slide nicely against each other in all directions, then they must be spherical. There is no such simple method to make a parabolic mirror, for example.
Another pure mathematical method is based on the use of Paucellier-Lipkin inversor (this is a hinge mechanism, of which one of the points moves along a straight line). But for long time people thought that such a mechanism is impossible, until it was invented by Paucellier in 1864. (The legend says that Chebychev wept when he was shown a working model:-) Ref. Philip Davis, The Thread (Birkhauser, 1983).
To construct a right angle, you take three cords, one of which is three of whatever unit you use, the second four of it, and the third five. Put them together in a triangle and the angle between the three and the four ones will be a right angle. This was used for a long time in ancient Egypt and Babylon. (Alternatively, you can use some other of the Pythagorean triples. There are many ancient lists of them.)
Straight lines can likewise be measured with nothing more than a weight and a cord: the plumb bob, which was certainly in use in ancient Egypt.
From Quine's Quiddities, s.v. "Lines":
My own heart leaps up a little when I behold what radically dissimilar criteria all attest to one and the same trite trait, the straightness of a line. I think of four.
One way of testing straightness is by use of a taut string. This test recalls indeed the origin of our word line, Latin linea; it is related to linen and lint. Sailors use the word in its primary sense in calling their ropes lines. The same test is implicit in our word straight, which is idientical historically with stretched. To the Greeks, more effete, a line was grammē, something drawn. Still the taut string is what embodies Euclid's characterization of the line as the shortest path between two points.
A strikingly different and independent way of checking the straightness of a line is by sighting along it. If one speck blocks your view of another, your eye and the two specks are all in line.…
A third embodiment of straightness is the crease of a folded sheet of stiff cardboard. Here we have a manifestation of Euclid's proposition that planes intersect in a straight line.…
A fourth criterion of straightness is afforded by a sliding edge. Thus suppose we are testing the straightness of of a long mark on the floor. We pass a card along the line. If the mark and the edge of the card are both in fact straight, then we can preserve full contact of the edge of the card with the mark throughout the length of the mark. This test is not yet conclusive; the mark and the edge might be curved, rather, with an equal and constant curvature. But if we repeat the test passing the card along the other side of the mark, then the test is conclusive.… It would take quite a substantial chapter of geometry to show why the taut string, the crease, and the sliding edge all attest to the same simple quality. The remaining criterion, the line of sight, we leave in the lap of the physicist.
This doesn't directly answer your question of how people did measure straightness, but it gives you some ideas of how they could have.
There are quite a few methods. If you take three almost straight objects and grind pairs against each other, they will approach a straight edge. That is, given objects A, B, and C, you grind A and B against each other, then B and C, then C and A, etc. You need a material that is soft enough that it grinds away reasonably quickly, but is strong enough that it doesn't fall apart.
You can also use string to get a straight line, either by stretching it taut, or using it to suspend a weight. Given its high density, lead was often for the weight, and the Latin word for lead is "plumbum", giving us the term "plumb line".
For short distances, a crystal that cleaves along straight lines can be used.
There are good answers here. I would like to add that a great deal of pre-industrial construction is not straight at all. Cathedrals often have walls that bend or kink from one end to the other or became kinked or curved from top to bottom.
I once looked at an apartment in a building built shortly before 1500 (in England). The ceiling of the bedroom can only be described as wonky, being at least two feet lower in one corner than another and with no apparent even curvature across it.
The standards of some craftsmen were very high, eg, armorers. Nothing they did depended on having a straight line. Armor must be curved properly to deflect weapons.
Sometimes straightness and levelness are desirable but these were rarely necessary in the past. When they were the methods of using gravity with water or strings to make straight lines were well known to the building trades, as were methods of making a right angle.
The required standards of accuracy greatly increased with the advent of navigation across oceans and industrial standardization.
Mostly, gravity. To get things perfectly flat people would use water. a tube with 2 graduated cylinders on either end. Raise/lower one end until the water is at the same level in both cylinders and you have your level. In terms of getting things perfectly vertical, they would use (and we still use this today), a piece of string with a weight on the end. Once the weight has stopped moving you know that the point under the string is directly below the top point of the string. Things haven't really changed that much.
Just to add to the posts that talk of the need to define tolerance, two examples that I am fond of:
- The British surveys of northern India during the 19th century, when Mt. Everest was discovered, it was also discovered that a plumb bob in that region measurably misses the center of the earth due to the gravitational attraction of the Himalayas.
- Google "Palmdale Bulge". An apparent uplift north of Los Angeles during the 1970's detected by leveling lines- crews that went out with measured rods and accurately level sights to measure the elevation of the topography. After much controversy, and corrections for the curvature of sight lines caused by atmospheric density gradients caused by surface heating by the sun, the bulge largely disappeared.
As also discussed previously, these effects don't matter when you're building a house. And if you're trying to level a rice paddy, the water surface follows local gravity so variations in the gravitational field don't matter.
Since the beginning of time, people discovered that if you rub two stones together with some abrasives in between they form a flat surface. They also discovered that if you rub 2 stones together the surface may come concave, i.e we identical curvature on both stones. The solution is to use 3 stones. This method is still valid now and still in use for producing very flat surfaces for scientific and industrial applications.
Here are few references from google:
I'm surprised no one mentioned the Whitworth Three Plates Method, a process that were used to make surfaces very flat using gravity, which you can read about in great detail here: https://ericweinhoffer.com/blog/2017/7/30/the-whitworth-three-plates-method