ports/166377: [PATCH] make net-mgmt/ettercap compile with clang
Niclas Zeising
zeising at daemonic.se
Sat Mar 24 18:10:07 UTC 2012
>Number: 166377
>Category: ports
>Synopsis: [PATCH] make net-mgmt/ettercap compile with clang
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-ports-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: update
>Submitter-Id: current-users
>Arrival-Date: Sat Mar 24 18:10:05 UTC 2012
>Closed-Date:
>Last-Modified:
>Originator: Niclas Zeising
>Release: FreeBSD 10.0-CURRENT amd64
>Organization:
>Environment:
System: FreeBSD gryphon.daemonic.se 10.0-CURRENT FreeBSD 10.0-CURRENT #0 r230424: Sat Jan 21 18:06:55 CET 2012 root at gryphon.daemonic.se:/usr/obj/usr/src/sys/GRYPHON amd64
>Description:
Currently, net-mgmt/ettercap does not compile with clang. This is due to bugs in the configure script. The configure script contains C code looking like this:
int main() {
int main(int argc, char *argv[] {
/* test code here */
return 0;
}
return 0;
}
This code is not accepted by clang (but accepted by gcc, for some reason).
>How-To-Repeat:
compile net-mgmt/ettercap with clang instead of gcc.
>Fix:
The files patch-aclocal.m4 and patch-acinclude.m4 contains fixes to the m4 files used to generate the configure script. They can be used by patching the corresponding files in work/ettercap and run ./autogen.sh. The patch-configure is the resulting changes to the configure script from this, and it also includes the changes already in the current patch file files/patch-configure.
To fix the port, either use the new patch-configure, or use the patched *.m4 files and run autogen.sh during make install. The latter suggestion has the drawbak of making ettercap require autoconf and automake.
--- patch-aclocal.m4 begins here ---
--- aclocal.m4.orig 2012-03-24 18:20:57.000000000 +0100
+++ aclocal.m4 2012-03-24 18:21:57.000000000 +0100
@@ -1118,7 +1118,7 @@
echo "$RANLIB libconftest.a" >&AS_MESSAGE_LOG_FD
$RANLIB libconftest.a 2>&AS_MESSAGE_LOG_FD
cat > conftest.c << _LT_EOF
-int main() { return 0;}
+int main(int argc, char *argv[]) { return 0;}
_LT_EOF
echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&AS_MESSAGE_LOG_FD
$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err
@@ -3826,7 +3826,7 @@
#ifdef __cplusplus
}
#endif
-int main(){nm_test_var='a';nm_test_func();return(0);}
+int main(int argc, char *argv[]){nm_test_var='a';nm_test_func();return(0);}
_LT_EOF
if AC_TRY_EVAL(ac_compile); then
@@ -5839,7 +5839,7 @@
lt_simple_compile_test_code="int some_variable = 0;"
# Code to be used in simple link tests
-lt_simple_link_test_code='int main(){return(0);}'
+lt_simple_link_test_code='int main(int argc, char *argv[]){return(0);}'
_LT_TAG_COMPILER
# Save the default compiler, since it gets overwritten when the other
@@ -8812,7 +8812,7 @@
[lt_cv_sys_symbol_underscore=no
cat > conftest.$ac_ext <<_LT_EOF
void nm_test_func(){}
-int main(){nm_test_func;return 0;}
+int main(int argc, char *argv[]){nm_test_func;return 0;}
_LT_EOF
if AC_TRY_EVAL(ac_compile); then
# Now try to grab the symbols.
--- patch-aclocal.m4 ends here ---
--- patch-acinclude.m4 begins here ---
--- acinclude.m4.orig 2012-03-24 18:22:51.000000000 +0100
+++ acinclude.m4 2012-03-24 18:23:49.000000000 +0100
@@ -56,11 +56,8 @@
#include <pthread.h>
],
[
- int main(int argc, char **argv)
- {
pthread_create(NULL, NULL, NULL, NULL);
return 0;
- }
],
[AC_MSG_RESULT(yes)],
[AC_MSG_RESULT(no)
@@ -182,7 +179,7 @@
AC_TRY_RUN([
#include <arpa/nameser.h>
- int main()
+ int main(int argc, char *argv[])
{
int i;
char *p = "\x01\x02\x03\x04";
@@ -214,13 +211,10 @@
#include <resolv.h>
],
[
- int main(int argc, char **argv)
- {
char *q;
char p[NS_MAXDNAME];
dn_expand(q, q, q, p, sizeof(p));
- }
],
[AC_MSG_RESULT(not needed)],
[AC_MSG_RESULT(needed)
@@ -239,13 +233,10 @@
#include <resolv.h>
],
[
- int main(int argc, char **argv)
- {
char *q;
char p[NS_MAXDNAME];
__dn_expand(q, q, q, p, sizeof(p));
- }
],
[AC_MSG_RESULT(not needed)],
[AC_MSG_RESULT(needed)
@@ -274,13 +265,10 @@
#include <resolv.h>
],
[
- int main(int argc, char **argv)
- {
char *q;
char p[NS_MAXDNAME];
__dn_expand(q, q, q, p, sizeof(p));
- }
],
[AC_MSG_RESULT(not needed)],
[AC_MSG_RESULT(needed)
--- patch-acinclude.m4 ends here ---
--- patch-configure begins here ---
--- configure.bak 2012-03-24 18:34:49.000000000 +0100
+++ configure 2012-03-24 18:35:47.000000000 +0100
@@ -15038,7 +15038,7 @@
#include <arpa/nameser.h>
- int main()
+ int main(int argc, char *argv[])
{
int i;
char *p = "\x01\x02\x03\x04";
@@ -15285,22 +15285,23 @@
return 0;
}
_ACEOF
-for ac_lib in '' c_r pthread; do
- if test -z "$ac_lib"; then
- ac_res="none required"
- else
- ac_res=-l$ac_lib
- LIBS="-l$ac_lib $ac_func_search_save_LIBS"
- fi
- if ac_fn_c_try_link "$LINENO"; then :
- ac_cv_search_pthread_create=$ac_res
-fi
-rm -f core conftest.err conftest.$ac_objext \
- conftest$ac_exeext
- if ${ac_cv_search_pthread_create+:} false; then :
- break
-fi
-done
+#for ac_lib in '' c_r pthread; do
+# if test -z "$ac_lib"; then
+# ac_res="none required"
+# else
+# ac_res=-l$ac_lib
+# LIBS="-l$ac_lib $ac_func_search_save_LIBS"
+# fi
+# if ac_fn_c_try_link "$LINENO"; then :
+# ac_cv_search_pthread_create=$ac_res
+#fi
+#rm -f core conftest.err conftest.$ac_objext \
+# conftest$ac_exeext
+# if ${ac_cv_search_pthread_create+:} false; then :
+# break
+#fi
+#done
+ac_cv_search_pthread_create=%%PTHREAD_LIBS%%
if ${ac_cv_search_pthread_create+:} false; then :
else
@@ -15376,10 +15377,10 @@
fi
elif test "$OS" = "MACOSX"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -pthread" >&5
-$as_echo_n "checking whether $CC accepts -pthread... " >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts %%PTHREAD_LIBS%%" >&5
+$as_echo_n "checking whether $CC accepts %%PTHREAD_LIBS%%... " >&6; }
LDFLAGS_store="$LDFLAGS"
- LDFLAGS="$LDFLAGS -pthread -fnested-functions"
+ LDFLAGS="$LDFLAGS %%PTHREAD_LIBS%% -fnested-functions"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
@@ -15389,11 +15390,8 @@
main ()
{
- int main(int argc, char **argv)
- {
pthread_create(NULL, NULL, NULL, NULL);
return 0;
- }
;
return 0;
@@ -15798,13 +15796,10 @@
main ()
{
- int main(int argc, char **argv)
- {
char *q;
char p[NS_MAXDNAME];
dn_expand(q, q, q, p, sizeof(p));
- }
;
return 0;
@@ -15900,13 +15895,10 @@
main ()
{
- int main(int argc, char **argv)
- {
char *q;
char p[NS_MAXDNAME];
__dn_expand(q, q, q, p, sizeof(p));
- }
;
return 0;
@@ -16379,14 +16371,14 @@
;;
no) { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
- DEBUG_FLAGS="-O2 -funroll-loops -fomit-frame-pointer -Wall"
+ DEBUG_FLAGS="-Wall"
ac_ec_debug=no
;;
esac
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
- DEBUG_FLAGS="-O2 -funroll-loops -fomit-frame-pointer -Wall"
+ DEBUG_FLAGS="-Wall"
ac_ec_debug=no
fi
@@ -16536,7 +16528,7 @@
OLDLDFLAGS="${LDFLAGS}"
OLDLIBS="${LIBS}"
- LDFLAGS="$PCAPLIB"
+ LDFLAGS="$LDFLAGS $PCAPLIB"
LIBS="$LIBS"
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for pcap_datalink_val_to_description in -lwpcap" >&5
$as_echo_n "checking for pcap_datalink_val_to_description in -lwpcap... " >&6; }
@@ -16994,6 +16986,14 @@
+if false; then
+ HAVE_PCRE_TRUE=
+ HAVE_PCRE_FALSE='#'
+else
+ HAVE_PCRE_TRUE='#'
+ HAVE_PCRE_FALSE=
+fi
+
ac_ec_pcre=no
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for libpcre" >&5
--- patch-configure ends here ---
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-ports-bugs
mailing list