+ if (binary == NULL)
+ {
+#if defined(HAVE_GEARMAND_BINARY)
+# if defined(GEARMAND_BINARY)
+ if (HAVE_GEARMAND_BINARY)
+ {
+ binary= GEARMAND_BINARY;
+ }
+# endif
+#endif
+ }
+
+ if (binary == NULL)
+ {
+ return NULL;
+ }
+
+ bool is_libtool_script= true;
+
+ if (binary[0] == '/')
+ {
+ is_libtool_script= false;
+ }
+
+ return new Gearmand(hostname, try_port, is_libtool_script, binary);