Repository: conan-io/conan-center-index

Issue:
[package] resiprocate/1.12.0: Error in autotools configuration
There are several errors in the recipe, especially in autotools configuration step.

https://github.com/conan-io/conan-center-index/blob/c68b60af3de84cf460c7512efce75290f1b395cb/recipes/resiprocate/all/conanfile.py#L50-L58

First, in the lines 54~57, values passed to each options are the inverse of what a consumer actually gave. For example, if `with_ssl` is true, then configuration option is passed as `--with-ssl=no`.

Second, the configure script of the project doesn't understand value assignments to the following options : ssl, mysql, postgresql. In other words, `--with-ssl=yes` and `--with-ssl=no` would make no difference in the configuration step and eventually the library is built with ssl feature on in both cases. You can check this out either from resiprocate project's [`configure.ac` file](https://github.com/resiprocate/resiprocate/blob/6b2756ba8516726cfb04e2b2fa5f4e3e67598a31/configure.ac#L113-L119), or from `configure` file autogenerated from `configure.ac` as below. 

```
# Check whether --with-ssl was given.
if test "${with_ssl+set}" = set; then :
  withval=$with_ssl;
cat >>confdefs.h <<_ACEOF
#define USE_SSL /**/
_ACEOF

 LIBSSL_LIBADD="-lssl -lcrypto"

  if true; then
  USE_SSL_TRUE=
  USE_SSL_FALSE='#'
else
  USE_SSL_TRUE='#'
  USE_SSL_FALSE=
fi

else
   LIBSSL_LIBADD=""

fi
```

And lastly, the project requires pthread, and the recipe didn't include that. When I turn off ssl, mysql, postgresql options, linking the library causes pthread missing error. I guess pthread happened to be secondary dependency from ssl or mysql or postgresql library, and that's why it worked when the options were on even though the recipe didn't explicitly include pthread. I suggest we add pthread in `cpp_info.system_libs`

I'm really thankful to those who had worked in this package. I didn't expect it to be on conan ever, but now it's so nice and easy to use. Happy holidays guys! 


Discussion:

Resolving patch:
diff --git a/recipes/resiprocate/all/conanfile.py b/recipes/resiprocate/all/conanfile.py
--- a/recipes/resiprocate/all/conanfile.py
+++ b/recipes/resiprocate/all/conanfile.py
@@ -29,13 +29,22 @@ class ResiprocateConan(ConanFile):
     def _source_subfolder(self):
         return "source_subfolder"
 
-    def requirements(self):
+    def config_options(self):
+        if self.settings.os == 'Windows':
+            del self.options.fPIC
+
+    def configure(self):
         if self.settings.os in ("Windows", "Macos"):
-            raise ConanInvalidConfiguration("reSIProcate is not support on {}.".format(self.settings.os))
+            # FIXME: Visual Studio project & Mac support seems available in resiprocate
+            raise ConanInvalidConfiguration("reSIProcate recipe does not currently support {}.".format(self.settings.os))
+        if self.options.shared:
+            del self.options.fPIC
+
+    def requirements(self):
         if self.options.with_ssl:
-            self.requires("openssl/1.1.1h")
+            self.requires("openssl/1.1.1i")
         if self.options.with_postgresql:
-            self.requires("libpq/11.5")
+            self.requires("libpq/11.9")
         if self.options.with_mysql:
             self.requires("libmysqlclient/8.0.17")
 
@@ -51,12 +60,17 @@ def _configure_autotools(self):
         configure_args = [
             "--enable-shared={}".format(yes_no(self.options.shared)),
             "--enable-static={}".format(yes_no(not self.options.shared)),
-            "--with-ssl={}".format(yes_no(not self.options.with_ssl)),
-            "--with-mysql={}".format(yes_no(not self.options.with_mysql)),
-            "--with-postgresql={}".format(yes_no(not self.options.with_postgresql)),
-            "--with-pic={}".format(yes_no(not self.options.fPIC))
+            "--with-pic={}".format(yes_no(self.options.get_safe("fPIC", True)))
         ]
 
+        # These options do not support yes/no
+        if self.options.with_ssl:
+            configure_args.append("--with-ssl")
+        if self.options.with_mysql:
+            configure_args.append("--with-mysql")
+        if self.options.with_postgresql:
+            configure_args.append("--with-postgresql")
+        
         self._autotools.configure(configure_dir=self._source_subfolder, args=configure_args)
         return self._autotools
 
@@ -73,6 +87,8 @@ def package(self):
 
     def package_info(self):
         self.cpp_info.libs = ["resip", "rutil", "dum", "resipares"]
+        if self.settings.os in ("Linux", "FreeBSD"):
+            self.cpp_info.system_libs = ["pthread"]
         bin_path = os.path.join(self.package_folder, "bin")
         self.output.info("Appending PATH environment variable: {}".format(bin_path))
         self.env_info.PATH.append(os.path.join(self.package_folder, "bin"))


Test patch: