Hi Assaf, > > It would be better to instead set LIB_SELINUX to > > "-lselinux -lpcre -lsepol -lpthread" (in the static case). > > This is a better solution, sadly I do not know how to > implement this in M4 (e.g. detecting a static build, > then deducing the required static libraries...).
I would not try do implement this by detecting a static build. I would try to do it by first trying to link only with '-lselinux', and if that fails, try with '-lselinux -lpcre -lsepol -lpthread'. Basically, replace AC_SEARCH_LIBS([setfilecon], [selinux], [test "$ac_cv_search_setfilecon" = "none required" || LIB_SELINUX=$ac_cv_search_setfilecon]) with two AC_LINK_IFELSE invocations. And with the function 'matchpathcon_init_prefix' instead of 'setfilecon', of course. Bruno