And move the getopt sources to portability support directory.
split.c split.h \
display.c display.h \
report.c report.h \
- getopt.c getopt1.c getopt.h \
select.c select.h \
mtr-curses.h \
img/mtr_icon.xpm \
mtr-gtk.h
+if WITH_GETOPT
+mtr_SOURCES += \
+ portability/getopt.h \
+ portability/getopt.c \
+ portability/getopt1.c
+endif
+
if WITH_IPINFO
mtr_SOURCES += asn.c asn.h
endif
fcntl \
])
+AC_CHECK_FUNC([getopt_long], [with_getopt=no], [with_getopt=yes])
+AS_IF([test "x$with_getopt" = "xno"], [
+ AC_DEFINE([HAVE_GETOPT], [1], [Define if libc has getopt_long])
+])
+AM_CONDITIONAL([WITH_GETOPT], [test "x$with_getopt" = "xyes"])
+
AC_CHECK_LIB([m], [floor], [], [AC_MSG_ERROR([No math library found])])
# Find GTK
#include "mtr.h"
#include "mtr-curses.h"
-#include "getopt.h"
#include "display.h"
#include "dns.h"
#include "report.h"
#include "net.h"
#include "asn.h"
+#ifdef HAVE_GETOPT
+#include <getopt.h>
+#else
+#include "portability/getopt.h"
+#endif
#ifdef ENABLE_IPV6
#define DEFAULT_AF AF_UNSPEC