mirror of
https://github.com/znc/znc.git
synced 2026-05-18 07:15:54 +02:00
Make znc compile without getopt_long
If getopt_long() (GNU extension) isn't available, we use the plain old getopt() instead. This means that long options won't work, but at least this compiles. Tested on Solaris 9, but should also work on Irix. Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
+1
-1
@@ -164,7 +164,7 @@ if test "$POLL" = "yes"; then
|
||||
fi
|
||||
|
||||
AC_CHECK_LIB( gnugetopt, getopt_long,)
|
||||
AC_CHECK_FUNCS([lstat])
|
||||
AC_CHECK_FUNCS([lstat getopt_long])
|
||||
PKG_PROG_PKG_CONFIG()
|
||||
|
||||
# ----- Check for dlopen
|
||||
|
||||
@@ -7,9 +7,28 @@
|
||||
*/
|
||||
|
||||
#include "znc.h"
|
||||
#include <getopt.h>
|
||||
#include <sys/wait.h>
|
||||
|
||||
#ifdef HAVE_GETOPT_LONG
|
||||
#include <getopt.h>
|
||||
#else
|
||||
#define no_argument 0
|
||||
#define required_argument 1
|
||||
#define optional_argument 2
|
||||
|
||||
struct option {
|
||||
const char *a;
|
||||
int opt;
|
||||
int *flag;
|
||||
int val;
|
||||
};
|
||||
|
||||
static inline int getopt_long(int argc, char * const argv[], const char *optstring, const struct option *, int *)
|
||||
{
|
||||
return getopt(argc, argv, optstring);
|
||||
}
|
||||
#endif
|
||||
|
||||
static const struct option g_LongOpts[] = {
|
||||
{ "help", no_argument, 0, 'h' },
|
||||
{ "version", no_argument, 0, 'v' },
|
||||
|
||||
Reference in New Issue
Block a user