Browse Source

Improve ACL detection for CMake build

Fix hidden visibility in posixacladdons

Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
pull/1/head
Slávek Banko 4 years ago
parent
commit
6ebff39751
4 changed files with 24 additions and 16 deletions
  1. 15
    3
      CMakeLists.txt
  2. 0
    4
      tdeio/CMakeLists.txt
  3. 4
    6
      tdeio/tdeio/CMakeLists.txt
  4. 5
    3
      tdeio/tdeio/posixacladdons.cpp

+ 15
- 3
CMakeLists.txt View File

@@ -243,11 +243,23 @@ if( HAVE_SYS_TIME_H AND HAVE_TIME_H )
243 243
 endif( HAVE_SYS_TIME_H AND HAVE_TIME_H )
244 244
 
245 245
 if( HAVE_SYS_ACL_H )
246
-  set( USE_POSIX_ACL 1 )
246
+  check_include_file( "acl/libacl.h" HAVE_ACL_LIBACL_H )
247
+  if( HAVE_ACL_LIBACL_H )
248
+    check_library_exists( acl acl_init "" HAVE_ACL_INIT )
249
+    if( HAVE_ACL_INIT AND HAVE_SYS_XATTR_H )
250
+      set( USE_POSIX_ACL 1 )
251
+      set( HAVE_NON_POSIX_ACL_EXTENSIONS 1 )
252
+      set( ACL_LIBRARIES acl attr )
253
+    endif( HAVE_ACL_INIT AND HAVE_SYS_XATTR_H )
254
+  else( HAVE_ACL_LIBACL_H )
255
+    check_library_exists( c acl_init "" HAVE_ACL_INIT )
256
+    if( HAVE_ACL_INIT )
257
+      set( USE_POSIX_ACL 1 )
258
+      set( ACL_LIBRARIES c )
259
+    endif( HAVE_ACL_INIT )
260
+  endif( HAVE_ACL_LIBACL_H )
247 261
 endif( HAVE_SYS_ACL_H )
248 262
 
249
-check_include_file( "acl/libacl.h" HAVE_NON_POSIX_ACL_EXTENSIONS )
250
-
251 263
 check_include_file( "valgrind/memcheck.h" HAVE_VALGRIND_MEMCHECK_H )
252 264
 check_include_file( "values.h" HAVE_VALUES_H )
253 265
 check_include_file( "X11/extensions/shape.h" HAVE_X11_EXTENSIONS_SHAPE_H )

+ 0
- 4
tdeio/CMakeLists.txt View File

@@ -55,10 +55,6 @@ if( HAVE_ELFICON )
55 55
   set( ELFICON_STATIC_LIB tdelficon-static )
56 56
 endif( HAVE_ELFICON )
57 57
 
58
-if( HAVE_NON_POSIX_ACL_EXTENSIONS )
59
-  set( ACL_LIBRARIES acl )
60
-endif( HAVE_NON_POSIX_ACL_EXTENSIONS )
61
-
62 58
 
63 59
 ##### libtdeio ####################################
64 60
 

+ 4
- 6
tdeio/tdeio/CMakeLists.txt View File

@@ -49,10 +49,9 @@ install( FILES
49 49
     kremoteencoding.h kmimetypechooser.h
50 50
   DESTINATION ${INCLUDE_INSTALL_DIR} )
51 51
 
52
-# FIXME seems that ACL is no longer optional
53
-#if( USE_POSIX_ACL )
52
+if( USE_POSIX_ACL )
54 53
   install( FILES kacl.h DESTINATION ${INCLUDE_INSTALL_DIR} )
55
-#endif( USE_POSIX_ACL )
54
+endif( USE_POSIX_ACL )
56 55
 
57 56
 install( FILES
58 57
     connection.h slaveinterface.h slave.h slaveconfig.h
@@ -111,10 +110,9 @@ set( ${target}_SRCS
111 110
   dataprotocol.cpp
112 111
 )
113 112
 
114
-# FIXME seems that ACL is no longer optional
115
-#if( USE_POSIX_ACL )
113
+if( USE_POSIX_ACL )
116 114
   set( ${target}_SRCS ${${target}_SRCS} kacl.cpp posixacladdons.cpp )
117
-#endif( USE_POSIX_ACL )
115
+endif( USE_POSIX_ACL )
118 116
 
119 117
 tde_add_library( ${target} STATIC_PIC AUTOMOC
120 118
   SOURCES ${${target}_SRCS}

+ 5
- 3
tdeio/tdeio/posixacladdons.cpp View File

@@ -21,6 +21,8 @@
21 21
 
22 22
 #if defined(USE_POSIX_ACL) && !defined(HAVE_NON_POSIX_ACL_EXTENSIONS)
23 23
 
24
+#include <kdemacros.h>
25
+
24 26
 #include <errno.h>
25 27
 #include <sys/stat.h>
26 28
 
@@ -61,7 +63,7 @@ protected:
61 63
     }
62 64
 };
63 65
 
64
-int acl_cmp(acl_t acl1, acl_t acl2)
66
+KDE_EXPORT int acl_cmp(acl_t acl1, acl_t acl2)
65 67
 {
66 68
     if ( !acl1 || !acl2 )
67 69
         return -1;
@@ -127,7 +129,7 @@ int acl_cmp(acl_t acl1, acl_t acl2)
127 129
     return 0;
128 130
 }
129 131
 
130
-acl_t acl_from_mode(mode_t mode)
132
+KDE_EXPORT acl_t acl_from_mode(mode_t mode)
131 133
 {
132 134
     acl_t newACL = acl_init( 3 );
133 135
     acl_entry_t entry;
@@ -178,7 +180,7 @@ acl_t acl_from_mode(mode_t mode)
178 180
     return newACL;
179 181
 }
180 182
 
181
-int acl_equiv_mode(acl_t acl, mode_t *mode_p)
183
+KDE_EXPORT int acl_equiv_mode(acl_t acl, mode_t *mode_p)
182 184
 {
183 185
     acl_entry_t entry;
184 186
     acl_tag_t tag;

Loading…
Cancel
Save