jart / hiptext

Turn images into text better than caca/aalib
Apache License 2.0
763 stars 44 forks source link

Alias the `sig_t` type to `sighandler_t` on Macs #24

Closed fish2000 closed 9 years ago

fish2000 commented 9 years ago

… apparently the Apple/BSD signal.h interface is exactly the same as what’s on Linux, except for this. The codebase as it stands, on master at HEAD, errors out during make like so:

asio-otus:hiptext[master]$ make
c++ -g -O3 -std=c++11 -Wall -Wextra -fno-exceptions -fno-rtti -MD  -march=native -c -o hiptext.o hiptext.cc
c++ -g -O3 -std=c++11 -Wall -Wextra -fno-exceptions -fno-rtti -MD  -march=native -c -o artiste.o artiste.cc
artiste.cc:165:3: error: unknown type name 'sighandler_t'
  sighandler_t old_handler = signal(SIGINT, OnCtrlC);
  ^
1 error generated.
make: *** [artiste.o] Error 1

… but if I include the one alias per the PR, hiptext builds OK (with both Apple Clang 6.2 something and also LLVM Clang, somewhat recent HEAD from the 3.7 branch) and but then everything runs completely as advertised in every way thereafter:

screen shot 2015-08-08 at 12 19 33 pm

Yes!

jart commented 9 years ago

According to the signal man page, this is defined on Linux if _BSD_SOURCE is defined. But what's strange is if I change the code to just use sig_t it compiles fine either way, even if I don't define that. But who knows if that would be the case on other setups. So your change is probably the safest bet.

fish2000 commented 9 years ago

Weird – good to know re: signal platform quirks. Glad it works either way. Yes!