Porting apps and dealing with Haiku specifics in the configure file


#1

I was wondering if any folks here who port apps targeting Mac, Windows, GNU/Linux, etc… how they deal with managing Haiku specifics in the configure file? Even a configure file that includes BeOS stanzas??

I was working with some folks today and we were porting an app to Haiku and discovered issues where some libraries like openssl, libxml, zlib, etc… are not in the standard places that the configure expects them. We were able to overcome some of those differences by passing arguments using --with-* for the troubled libraries. However, we did run into an issue with sys/socket.h where it can’t be found, which forced us to start hacking the MakeFile affected to look for it where Haiku has it.

I guess I really just want to get some pointers from those who have experience in dealing with such issues when porting apps. We certainly don’t want to hack the configure file or resulting MakeFile(s) if we can handle the Haiku specifics in a better more sane way.

Any help is greatly appreciated :relaxed:


#2

The probably standard on UNIX-like systems to find installed libraries is using pkg-config.

Not found headers are usually the case when the configure script uses a hardcoded path /usr/include or so.


#3

libraries like openssl, libxml, zlib, etc… are not in the standard places

Issue is there is no such “standard”. There is Linux Base Standard, but it’s limited to Linux distro, which others OS not based on Linux don’t have to comply with.

An approach is to use a meta-build system like CMake and rely on pkg-info to get target specific BY relying I mean write (or adapt) cmake files to use it, as hardcoding is still possible there too and way too often done alas.

General approach is to stop assuming that includes are under /usr/include on every OS, that system libraries are always under /lib and /usr/lib, that maths API are always in libm, that clock_* are in librt and so on.

What is your build system currently? Autoconf ? Plain makefile ? Cmake ?
With autoconf, there is AC_CHECK_LIB and AC_SEARCH_LIBS that are handy.
With CMake, look at find_path, find_library, find_package documentation.

Haikuports is a good source of hints for porting stuffs, if you don’t know it already:


#4

I may take a look into the pkg-config thing and see if it will solve our problem. We’re going to put the app port on the back burner for now and working on something else that bears some fruit :slight_smile: