--- a/src/h/internal.h
+++ b/src/h/internal.h
@@ -419,7 +419,11 @@
 #endif /* ECL_THREADS */
 
 #ifdef ECL_THREADS
-# include <ecl/atomic_ops.h>
+# ifdef ECL_LIBATOMIC_OPS_H
+#  include <ecl/atomic_ops.h>
+# else
+#  include <atomic_ops.h>
+# endif
 #else
 # define AO_load(x) (x)
 # define AO_store(x,y) ((x)=(y))