]> git.sesse.net Git - vlc/commitdiff
. suppression de quelques #define SYS_* (mais pas encore tous)
authorSam Hocevar <sam@videolan.org>
Fri, 10 Mar 2000 00:47:17 +0000 (00:47 +0000)
committerSam Hocevar <sam@videolan.org>
Fri, 10 Mar 2000 00:47:17 +0000 (00:47 +0000)
 . include/config.h devient include/config.h.in et config.h sera
  g�n�r� par ./configure. Le but est d'�viter les options -DFOO de gcc
 . suppression d'un 'Resources' qui trainait encore dans config.h

configure
configure.in
include/config.h.in [moved from include/config.h with 98% similarity]
include/defs.h.in
include/threads.h
src/interface/main.c
src/misc/mtime.c
src/misc/netutils.c
src/misc/plugins.c

index fd154ddd28c5a785e2a4c546a4f2cc08884932a7..242ebc72e520490e0346346b2e710f11c48f92ec 100755 (executable)
--- a/configure
+++ b/configure
@@ -2650,22 +2650,102 @@ else
 fi
 done
 
+for ac_hdr in dlfcn.h image.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:2658: checking for $ac_hdr" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 2663 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:2668: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=yes"
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+for ac_hdr in arpa/inet.h net/if.h netinet/in.h sys/socket.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:2698: checking for $ac_hdr" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 2703 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:2708: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=yes"
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
 
 for ac_hdr in cthreads.h pthread.h kernel/sheduler.h kernel/OS.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:2659: checking for $ac_hdr" >&5
+echo "configure:2739: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2664 "configure"
+#line 2744 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2669: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2749: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -2693,12 +2773,12 @@ done
 
 
 echo $ac_n "checking for working const""... $ac_c" 1>&6
-echo "configure:2697: checking for working const" >&5
+echo "configure:2777: checking for working const" >&5
 if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2702 "configure"
+#line 2782 "configure"
 #include "confdefs.h"
 
 int main() {
@@ -2747,7 +2827,7 @@ ccp = (char const *const *) p;
 
 ; return 0; }
 EOF
-if { (eval echo configure:2751: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2831: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_c_const=yes
 else
@@ -2768,12 +2848,12 @@ EOF
 fi
 
 echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
-echo "configure:2772: checking for ANSI C header files" >&5
+echo "configure:2852: checking for ANSI C header files" >&5
 if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2777 "configure"
+#line 2857 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 #include <stdarg.h>
@@ -2781,7 +2861,7 @@ else
 #include <float.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2785: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2865: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -2798,7 +2878,7 @@ rm -f conftest*
 if test $ac_cv_header_stdc = yes; then
   # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
 cat > conftest.$ac_ext <<EOF
-#line 2802 "configure"
+#line 2882 "configure"
 #include "confdefs.h"
 #include <string.h>
 EOF
@@ -2816,7 +2896,7 @@ fi
 if test $ac_cv_header_stdc = yes; then
   # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
 cat > conftest.$ac_ext <<EOF
-#line 2820 "configure"
+#line 2900 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 EOF
@@ -2837,7 +2917,7 @@ if test "$cross_compiling" = yes; then
   :
 else
   cat > conftest.$ac_ext <<EOF
-#line 2841 "configure"
+#line 2921 "configure"
 #include "confdefs.h"
 #include <ctype.h>
 #define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
@@ -2848,7 +2928,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);
 exit (0); }
 
 EOF
-if { (eval echo configure:2852: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:2932: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   :
 else
@@ -2872,12 +2952,12 @@ EOF
 fi
 
 echo $ac_n "checking for size_t""... $ac_c" 1>&6
-echo "configure:2876: checking for size_t" >&5
+echo "configure:2956: checking for size_t" >&5
 if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2881 "configure"
+#line 2961 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
@@ -2905,12 +2985,12 @@ EOF
 fi
 
 echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6
-echo "configure:2909: checking whether time.h and sys/time.h may both be included" >&5
+echo "configure:2989: checking whether time.h and sys/time.h may both be included" >&5
 if eval "test \"`echo '$''{'ac_cv_header_time'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2914 "configure"
+#line 2994 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/time.h>
@@ -2919,7 +2999,7 @@ int main() {
 struct tm *tp;
 ; return 0; }
 EOF
-if { (eval echo configure:2923: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3003: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_header_time=yes
 else
@@ -3041,7 +3121,7 @@ done
 ac_given_srcdir=$srcdir
 ac_given_INSTALL="$INSTALL"
 
-trap 'rm -fr `echo "Makefile include/defs.h" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
+trap 'rm -fr `echo "Makefile include/config.h include/defs.h" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
 EOF
 cat >> $CONFIG_STATUS <<EOF
 
@@ -3128,7 +3208,7 @@ EOF
 
 cat >> $CONFIG_STATUS <<EOF
 
-CONFIG_FILES=\${CONFIG_FILES-"Makefile"}
+CONFIG_FILES=\${CONFIG_FILES-"Makefile include/config.h"}
 EOF
 cat >> $CONFIG_STATUS <<\EOF
 for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then
index 971508d824cb67e5ffeed09101c816d49f97afc6..99d379855d93c75aa4f1d449b3cf5b1bb2168e25 100644 (file)
@@ -46,6 +46,8 @@ AC_SUBST(LIBOBJS)
 
 AC_CHECK_HEADERS(fcntl.h sys/ioctl.h sys/time.h unistd.h)
 AC_CHECK_HEADERS(sys/soundcard.h machine/soundcard.h)
+AC_CHECK_HEADERS(dlfcn.h image.h)
+AC_CHECK_HEADERS(arpa/inet.h net/if.h netinet/in.h sys/socket.h)
 
 dnl Check for threads library
 AC_CHECK_HEADERS(cthreads.h pthread.h kernel/sheduler.h kernel/OS.h)
@@ -55,5 +57,5 @@ AC_C_CONST
 AC_TYPE_SIZE_T
 AC_HEADER_TIME
 
-AC_OUTPUT([Makefile])
+AC_OUTPUT([Makefile include/config.h])
 
similarity index 98%
rename from include/config.h
rename to include/config.h.in
index 0f0dd3b6839f44a2e563bb25687f0705abe06785..6f6a30df950a5f643cd95f57786c8a26ca673869 100644 (file)
@@ -41,8 +41,8 @@
  *****************************************************************************/
 
 /* Program version and copyright message */
-#define COPYRIGHT_MESSAGE   "VideoLAN Client - version " PROGRAM_VERSION \
-                            " " PROGRAM_CODENAME " - (c)1996-2000 VideoLAN"
+#define COPYRIGHT_MESSAGE   "VideoLAN Client - version " @VLC_VERSION@ \
+                            " " @VLC_CODENAME@ " - (c)1996-2000 VideoLAN"
 
 /*****************************************************************************
  * General compilation options
 #define VOUT_GAMMA                      0.
 
 /* Default fonts */
-#define VOUT_DEFAULT_FONT               "Resources/default8x9.psf"
-#define VOUT_LARGE_FONT                 "Resources/default8x16.psf"
+#define VOUT_DEFAULT_FONT               "lib/default8x9.psf"
+#define VOUT_LARGE_FONT                 "lib/default8x16.psf"
 
 /*
  * Time settings
index 3036f121c49478f332e120f8177fba7731d33e84..53a6eb4f1a4f7c7bd9bf8e04bce2c7e18c5a8b85 100644 (file)
 /* Define if you have the usleep function.  */
 #undef HAVE_USLEEP
 
+/* Define if you have the <arpa/inet.h> header file.  */
+#undef HAVE_ARPA_INET_H
+
 /* Define if you have the <cthreads.h> header file.  */
 #undef HAVE_CTHREADS_H
 
+/* Define if you have the <dlfcn.h> header file.  */
+#undef HAVE_DLFCN_H
+
 /* Define if you have the <fcntl.h> header file.  */
 #undef HAVE_FCNTL_H
 
+/* Define if you have the <image.h> header file.  */
+#undef HAVE_IMAGE_H
+
 /* Define if you have the <kernel/OS.h> header file.  */
 #undef HAVE_KERNEL_OS_H
 
 /* Define if you have the <machine/soundcard.h> header file.  */
 #undef HAVE_MACHINE_SOUNDCARD_H
 
+/* Define if you have the <net/if.h> header file.  */
+#undef HAVE_NET_IF_H
+
+/* Define if you have the <netinet/in.h> header file.  */
+#undef HAVE_NETINET_IN_H
+
 /* Define if you have the <pthread.h> header file.  */
 #undef HAVE_PTHREAD_H
 
 /* Define if you have the <sys/ioctl.h> header file.  */
 #undef HAVE_SYS_IOCTL_H
 
+/* Define if you have the <sys/socket.h> header file.  */
+#undef HAVE_SYS_SOCKET_H
+
 /* Define if you have the <sys/soundcard.h> header file.  */
 #undef HAVE_SYS_SOUNDCARD_H
 
index 8c9f348db6a0ff72086c4838bfb424afc3cb2da6..777387fd7edecf9a1160d506add525e8663fdb12 100644 (file)
 
 #if defined(HAVE_PTHREAD_H)            /* pthreads (Linux & BSD for example) */
 #include <pthread.h>
+
 #elif defined(HAVE_CTHREADS_H)                                    /* GNUMach */
 #include <cthreads.h>
+
 #elif defined(HAVE_KERNEL_SHEDULER_H) && defined(HAVE_KERNEL_OS_H)   /* BeOS */
 #include <kernel/OS.h>
 #include <kernel/scheduler.h>
+
 #else
 #error no threads available on your system !
 #endif
@@ -200,11 +203,11 @@ static __inline__ void vlc_thread_join( vlc_thread_t thread )
 static __inline__ void lazy_init_mutex(vlc_mutex_t* p_mutex)
 {
     int32 v = atomic_or( &p_mutex->init, 1 );
-    if( 2000 == v ) // we're the first, so do the init
+    if( 2000 == v ) /* we're the first, so do the init */
     {
         vlc_mutex_init( p_mutex );
     }
-    else // we're not the first, so wait until the init is finished
+    else /* we're not the first, so wait until the init is finished */
     {
         while( p_mutex->init != 9999 ) snooze( 10000 );
     }
@@ -292,11 +295,11 @@ static __inline__ int vlc_mutex_unlock( vlc_mutex_t *p_mutex )
 static __inline__ void lazy_init_cond( vlc_cond_t* p_condvar )
 {
     int32 v = atomic_or( &p_condvar->init, 1 );
-    if( 2000 == v ) // we're the first, so do the init
+    if( 2000 == v ) /* we're the first, so do the init */
     {
         vlc_cond_init( p_condvar );
     }
-    else // we're not the first, so wait until the init is finished
+    else /* we're not the first, so wait until the init is finished */
     {
         while( p_condvar->init != 9999 ) snooze( 10000 );
     }
index 00c2510251d38d5cdd0904f7409bfaa87840641e..75dc3698aedc585a409ac64f6c95192332c32375 100644 (file)
@@ -578,7 +578,9 @@ static void SignalHandler( int i_signal )
 static int TestMMX( void )
 {
 /* FIXME: under beos, gcc does not support the foolowing inline assembly */ 
-#ifndef SYS_BEOS
+#ifdef SYS_BEOS
+    return( 1 );
+#else
 
     int i_reg, i_dummy = 0;
 
@@ -642,8 +644,6 @@ static int TestMMX( void )
 
     return( 1 );
 
-#else /* SYS_BEOS */
-    return( 1 );
-#endif /* SYS_BEOS */
+#endif
 }
 #endif
index 7c6e2e7174fc2ad77c8ad5fe63c6d211f51b2ea1..866aa7e4320b6db8067b28ce568e462d63d4f80c 100644 (file)
@@ -36,7 +36,7 @@
 #include <unistd.h>                                              /* select() */
 #include <sys/time.h>
 
-#ifdef SYS_BEOS
+#ifdef HAVE_KERNEL_OS_H
 #include <kernel/OS.h>
 #endif
 
@@ -70,8 +70,9 @@ char *mstrtime( char *psz_buffer, mtime_t date )
  *****************************************************************************/
 mtime_t mdate( void )
 {
-#ifdef SYS_BEOS
+#ifdef HAVE_KERNEL_OS_H
     return( real_time_clock_usecs() );
+    
 #else
     struct timeval tv_date;
 
@@ -80,6 +81,7 @@ mtime_t mdate( void )
      * here, since tv is a local variable. */
     gettimeofday( &tv_date, NULL );
     return( (mtime_t) tv_date.tv_sec * 1000000 + (mtime_t) tv_date.tv_usec );
+    
 #endif
 }
 
@@ -92,7 +94,8 @@ mtime_t mdate( void )
  *****************************************************************************/
 void mwait( mtime_t date )
 {
-#ifdef SYS_BEOS
+#ifdef HAVE_KERNEL_OS_H
+       
     mtime_t delay;
     
     delay = date - real_time_clock_usecs();
@@ -101,7 +104,7 @@ void mwait( mtime_t date )
         return;
     }
     snooze( delay );
-#else /* SYS_BEOS */
+#else
 
     struct timeval tv_date, tv_delay;
     mtime_t        delay;          /* delay in msec, signed to detect errors */
@@ -115,17 +118,18 @@ void mwait( mtime_t date )
     {
         return;
     }
-#ifndef usleep
+
+#ifdef HAVE_USLEEP
+    usleep( delay );
+#else
     tv_delay.tv_sec = delay / 1000000;
     tv_delay.tv_usec = delay % 1000000;
 
     /* see msleep() about select() errors */
     select( 0, NULL, NULL, NULL, &tv_delay );
-#else
-    usleep( delay );
 #endif
 
-#endif /* SYS_BEOS */
+#endif /* HAVE_KERNEL_OS_H */
 }
 
 /*****************************************************************************
@@ -135,11 +139,13 @@ void mwait( mtime_t date )
  *****************************************************************************/
 void msleep( mtime_t delay )
 {
-#ifdef SYS_BEOS
+#ifdef HAVE_KERNEL_OS_H
     snooze( delay );
-#else /* SYS_BEOS */
+#else
 
-#ifndef usleep
+#ifdef HAVE_USLEEP
+    usleep( delay );
+#else
     struct timeval tv_delay;
 
     tv_delay.tv_sec = delay / 1000000;
@@ -149,9 +155,7 @@ void msleep( mtime_t delay )
      * (i.e. when a signal is sent to the thread, or when memory is full), and
      * can be ingnored. */
     select( 0, NULL, NULL, NULL, &tv_delay );
-#else
-    usleep( delay );
 #endif
 
-#endif /* SYS_BEOS */
+#endif /* HAVE_KERNEL_OS_H */
 }
index 5175527412dd656f30363b7b2719aebf4fffa380..ede43fe7f8248a18ddc2572743ecf8ea92981ded 100644 (file)
 #include <errno.h>                                                /* errno() */
 #include <string.h>                                      /* bzero(), bcopy() */
 
-#ifdef SYS_BSD
-#include <netinet/in.h>                                    /* struct in_addr */
-#include <sys/socket.h>                                   /* struct sockaddr */
-#endif
-
-#if defined(SYS_LINUX) || defined(SYS_BSD) || defined(SYS_GNU)
+#include <netinet/in.h>                               /* BSD: struct in_addr */
+#include <sys/socket.h>                              /* BSD: struct sockaddr */
+#ifdef (HAVE_ARPA_INET_H)
 #include <arpa/inet.h>                           /* inet_ntoa(), inet_aton() */
 #endif
 
-
-#ifdef SYS_LINUX
+#if defined (HAVE_SYS_IOCTL_H) && defined(HAVE_NET_IF_H)
 #include <sys/ioctl.h>                                            /* ioctl() */
 #include <net/if.h>                            /* interface (arch-dependent) */
 #endif
@@ -78,10 +74,10 @@ int BuildInetAddr( struct sockaddr_in *p_sa_in, char *psz_in_addr, int i_port )
     }
     /* Try to convert address directly from in_addr - this will work if
      * psz_in_addr is dotted decimal. */
-#ifdef SYS_BEOS
-    else if( (p_sa_in->sin_addr.s_addr = inet_addr( psz_in_addr )) == -1 )
-#else
+#ifdef HAVE_ARPA_INET_H
     else if( !inet_aton( psz_in_addr, &p_sa_in->sin_addr) )
+#else
+    else if( (p_sa_in->sin_addr.s_addr = inet_addr( psz_in_addr )) == -1 )
 #endif
     {
         /* The convertion failed: the address is an host name, which needs
@@ -135,7 +131,7 @@ int ServerPort( char *psz_addr )
 int ReadIfConf(int i_sockfd, if_descr_t* p_ifdescr, char* psz_name)
 {
     int i_rc = 0;
-#ifdef SYS_LINUX
+#if defined (HAVE_SYS_IOCTL_H) && defined(HAVE_NET_IF_H)
     struct ifreq ifr_config;
 
     ASSERT(p_ifdescr);
@@ -216,7 +212,7 @@ int ReadIfConf(int i_sockfd, if_descr_t* p_ifdescr, char* psz_name)
                     psz_name, strerror(errno));
         return -1;
     }
-#endif /* SYS_LINUX */
+#endif
 
     return i_rc;
 }
@@ -231,17 +227,17 @@ int ReadIfConf(int i_sockfd, if_descr_t* p_ifdescr, char* psz_name)
  *****************************************************************************/
 int ReadNetConf(int i_sockfd, net_descr_t* p_net_descr)
 {
-#ifdef SYS_LINUX
+#if defined (HAVE_SYS_IOCTL_H) && defined(HAVE_NET_IF_H)
     struct ifreq* a_ifr_ifconf = NULL;
     struct ifreq* p_ifr_current_if;
     struct ifconf ifc_netconf;
 
     int i_if_number;
     int i_remaining;
-#endif /* SYS_LINUX */
+#endif
     int i_rc = 0;
 
-#ifdef SYS_LINUX
+#if defined (HAVE_SYS_IOCTL_H) && defined(HAVE_NET_IF_H)
     ASSERT(p_net_descr);
 
     /* Start by assuming we have few than 3 interfaces (i_if_number will
@@ -316,7 +312,7 @@ int ReadNetConf(int i_sockfd, net_descr_t* p_net_descr)
 
     /* Don't need the a_ifr_ifconf anymore */
     free( a_ifr_ifconf );
-#endif /* SYS_LINUX */
+#endif
 
     return i_rc;
 }
index b744b2f81b40f28ed9447709247ee0116faee512..77f71e015520d40c5e7f25866930a01c1eb1dc73 100644 (file)
 #include <stdlib.h>                                      /* free(), strtol() */
 #include <stdio.h>                                              /* sprintf() */
 
-#if defined(SYS_LINUX) || defined(SYS_BSD) || defined(SYS_GNU)
+#if defined(HAVE_DLFCN_H)                                /* Linux, BSD, Hurd */
 #include <dlfcn.h>                           /* dlopen(), dlsym(), dlclose() */
-#endif
 
-#ifdef SYS_BEOS
+#elif defined(HAVE_IMAGE_H)                                          /* BeOS */
 #include <image.h>
+
+#else
+#error no dynamic plugins available on your system !
 #endif
 
 #include "plugins.h"
@@ -53,19 +55,25 @@ int RequestPlugin ( plugin_id_t * p_plugin, char * psz_mask, char * psz_name )
     {
         psz_plugin = malloc( strlen(psz_plugin_path[i_count]) + i_length + 6 );
         sprintf( psz_plugin, "%s/%s_%s.so", psz_plugin_path[i_count], psz_mask, psz_name );
-#ifdef SYS_BEOS
-        *p_plugin = load_addon_image( psz_plugin );
-#else  /* SYS_BEOS */
+
+#if defined(HAVE_DLFCN_H)
         *p_plugin = dlopen( psz_plugin, RTLD_NOW | RTLD_GLOBAL );
-#endif /* SYS_BEOS */
+
+#elif defined(HAVE_IMAGE_H)
+        *p_plugin = load_addon_image( psz_plugin );
+
+#endif
+
         free( psz_plugin );
 
-#ifdef SYS_BEOS
-        if( *p_plugin >= 0 )
+#if defined(HAVE_DLFCN_H)
+       if( *p_plugin != NULL )
             return( 0 );
-#else
-        if( *p_plugin != NULL )
+
+#elif defined(HAVE_IMAGE_H)
+        if( *p_plugin >= 0 )
             return( 0 );
+
 #endif
     }
 
@@ -74,24 +82,28 @@ int RequestPlugin ( plugin_id_t * p_plugin, char * psz_mask, char * psz_name )
 
 void TrashPlugin ( plugin_id_t plugin )
 {
-#ifdef SYS_BEOS
-    unload_add_on( plugin );
-#else
+#if defined(HAVE_DLFCN_H)
     dlclose( plugin );
+
+#elif defined(HAVE_IMAGE_H)
+    unload_add_on( plugin );
+
 #endif
 }
 
 void * GetPluginFunction ( plugin_id_t plugin, char *psz_name )
 {
-#ifdef SYS_BEOS
+#if defined(HAVE_DLFCN_H)
+    return( dlsym(plugin, psz_name) );
+
+#elif defined(HAVE_IMAGE_H)
     void * p_func;
     
     if( get_image_symbol( plugin, psz_name, B_SYMBOL_TYPE_TEXT, &p_func ) )
         return( NULL );
     else
         return( p_func );    
-#else
-    return( dlsym(plugin, psz_name) );
+
 #endif
 }