diff options
author | Laurent Bercot <ska-skaware@skarnet.org> | 2019-02-19 16:23:24 +0000 |
---|---|---|
committer | Laurent Bercot <ska-skaware@skarnet.org> | 2019-02-19 16:23:24 +0000 |
commit | ff9333d473adb4ae1de2d9323394073793627823 (patch) | |
tree | 24780fca6ab8c57e5d8c5d98b61362af33bef4b8 /configure | |
parent | 15eda3d33f9e1160d438d370acd442ef3dbba63f (diff) | |
download | skalibs-ff9333d473adb4ae1de2d9323394073793627823.tar.gz skalibs-ff9333d473adb4ae1de2d9323394073793627823.tar.xz skalibs-ff9333d473adb4ae1de2d9323394073793627823.zip |
Add skalibs/posixishard.h
This will break things. It's a known issue. Patches to other packages will come later, to adapt them to the new API. To work around brokenness, there needs to be *two* different headers: 1. one to be used before including system headers, that maximizes visibility by enabling system-dependent feature test macros (that will be tested by system headers) 2. one to be used after including system headers, that performs preprocessor tests and defines. skalibs/nonposix.h is the first one. Previously, there was no second one, and the tests were scattered all over. There was a strnlen declaration in skalibs/posixplz.h (which serves a totally different function: declaring things that should be in POSIX, but *are not*, i.e. working around problems in the standard, instead of problems in systems failing to respect the standard), a build-time sysdep for error.h, #defines for MSG_NOSIGNAL, etc. etc. skalibs/posixishard.h now is the second one, and centralizes all the tests. As a result, the eproto sysdep is unnecessary and has been removed. skalibs/error.h is now a static header, it is not built anymore.
Diffstat (limited to 'configure')
-rwxr-xr-x | configure | 42 |
1 files changed, 30 insertions, 12 deletions
diff --git a/configure b/configure index 289caf2..984e77e 100755 --- a/configure +++ b/configure @@ -144,15 +144,16 @@ choose () { esac fi rm -f try$name.o try$name + echo "#undef ${package_macro_name}_HAS$macro" >> $sysdeps/sysdeps.h if $r ; then echo "$name: yes" >> $sysdeps/sysdeps echo "#define ${package_macro_name}_HAS$macro" >> $sysdeps/sysdeps.h echo " ... yes" else echo "$name: no" >> $sysdeps/sysdeps - echo "#undef ${package_macro_name}_HAS$macro" >> $sysdeps/sysdeps.h echo " ... no" fi + echo >> $sysdeps/sysdeps.h } trytypes () { @@ -161,18 +162,21 @@ trytypes () { ./output-types >> $sysdeps/sysdeps ./output-types | grep -F sizeof | while read key value ; do caps=$(echo $key | sed s/:\$// | tr a-z A-Z) - echo "#define ${package_macro_name}_${caps} $value" >> $sysdeps/sysdeps.h - done + echo "#undef ${package_macro_name}_${caps}" + echo "#define ${package_macro_name}_${caps} $value" + echo + done >> $sysdeps/sysdeps.h ./output-types | grep -F signed | while read key value ; do caps=$(echo $key | sed s/:\$// | tr a-z A-Z) + echo "#undef ${package_macro_name}_HASUN${caps}" + echo "#undef ${package_macro_name}_HAS${caps}" if test $value = yes ; then echo "#define ${package_macro_name}_HAS${caps}" - echo "#undef ${package_macro_name}_HASUN${caps}" else - echo "#undef ${package_macro_name}_HAS${caps}" echo "#define ${package_macro_name}_HASUN${caps}" - fi >> $sysdeps/sysdeps.h - done + fi + echo + done >> $sysdeps/sysdeps.h rm -f output-types echo " ... done" } @@ -443,7 +447,14 @@ else #ifndef SYSDEPS_H #define SYSDEPS_H +#undef SKALIBS_TARGET #define SKALIBS_TARGET "$target" + +#undef SKALIBS_BSD_SUCKS +#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__bsdi__) || defined(__DragonFly__) +# define SKALIBS_BSD_SUCKS +#endif + EOF exec 3>&1 @@ -462,43 +473,51 @@ EOF fi echo "$sysclock_lib" > $sysdeps/sysclock.lib echo "$tainnow_lib" > $sysdeps/tainnow.lib + echo "#undef ${package_macro_name}_HASCLOCKRT" >> $sysdeps/sysdeps.h if $hasclock ; then echo 'clockrt: yes' >> $sysdeps/sysdeps echo "#define ${package_macro_name}_HASCLOCKRT" >> $sysdeps/sysdeps.h + echo >> $sysdeps/sysdeps.h choose cl clockmon CLOCKMON CLOCK_MONOTONIC $sysclock_lib else echo 'clockrt: no' >> $sysdeps/sysdeps - echo "#undef ${package_macro_name}_HASCLOCKRT" >> $sysdeps/sysdeps.h + echo >> $sysdeps/sysdeps.h fi hasspawn=true spawn_lib=`trylibs posixspawn 'posix_spawn()' -lrt` || hasspawn=false echo "$spawn_lib" > $sysdeps/spawn.lib + echo "#undef ${package_macro_name}_HASPOSIXSPAWN" >> $sysdeps/sysdeps.h if $hasspawn ; then echo 'posixspawn: yes' >> $sysdeps/sysdeps echo "#define ${package_macro_name}_HASPOSIXSPAWN" >> $sysdeps/sysdeps.h else echo 'posixspawn: no' >> $sysdeps/sysdeps - echo "#undef ${package_macro_name}_HASPOSIXSPAWN" >> $sysdeps/sysdeps.h fi + echo >> $sysdeps/sysdeps.h hastimer=true timer_lib=`trylibs timer 'timer_create()' -lrt` || hastimer=false echo "$timer_lib" > $sysdeps/timer.lib + echo "#undef ${package_macro_name}_HASTIMER" >> $sysdeps/sysdeps.h if $hastimer ; then echo 'timer: yes' >> $sysdeps/sysdeps echo "#define ${package_macro_name}_HASTIMER" >> $sysdeps/sysdeps.h else echo 'timer: no' >> $sysdeps/sysdeps - echo "#undef ${package_macro_name}_HASTIMER" >> $sysdeps/sysdeps.h fi + echo >> $sysdeps/sysdeps.h exec 3>&- echo "Checking system endianness..." $CC_AUTO $CPPFLAGS_AUTO $CPPFLAGS $CPPFLAGS_POST $CFLAGS_AUTO $CFLAGS $CFLAGS_POST $LDFLAGS_AUTO $LDFLAGS $LDFLAGS_POST -o tryendianness src/sysdeps/tryendianness.c endianness=$(./tryendianness) || fail "$0: unable to determine endianness" echo "endianness: $endianness" >> $sysdeps/sysdeps - echo "#define ${package_macro_name}_ENDIANNESS \"$endianness\"" >> $sysdeps/sysdeps.h + { + echo "#undef ${package_macro_name}_ENDIANNESS" + echo "#define ${package_macro_name}_ENDIANNESS \"$endianness\"" + echo + } >> $sysdeps/sysdeps.h echo " ... $endianness" rm -f tryendianness @@ -508,7 +527,6 @@ EOF choose c cmsgcloexec CMSGCLOEXEC 'MSG_CMSG_CLOEXEC' choose clr devurandom DEVURANDOM '/dev/urandom' choose cl dirfd DIRFD 'dirfd()' - choose c eproto EPROTO EPROTO choose cl eventfd EVENTFD 'eventfd()' choose cl flock FLOCK 'flock()' choose cl getpeereid GETPEEREID 'getpeereid()' |