  Systems described by an O(n) symmetrical $\phi^4$ Hamiltonian are considered
in a $d$-dimensional film geometry at their bulk critical points. The critical
Casimir forces between the film's boundary planes $\mathfrak{B}_j, j=1,2$, are
investigated as functions of film thickness $L$ for generic symmetry-preserving
boundary conditions $\partial_n\bm{\phi}=\mathring{c}_j\bm{\phi}$. The
$L$-dependent part of the reduced excess free energy per cross-sectional area
takes the scaling form $f_{\text{res}}\approx
D(c_1L^{\Phi/\nu},c_2L^{\Phi/\nu})/L^{d-1}$ when $d<4$, where $c_i$ are scaling
fields associated with the variables $\mathring{c}_i$, and $\Phi$ is a surface
crossover exponent. Explicit two-loop renormalization group results for the
function $D(\mathsf{c}_1,\mathsf{c}_2)$ at $d=4-\epsilon$ dimensions are
presented. These show that (i) the Casimir force can have either sign,
depending on $\mathsf{c}_1$ and $\mathsf{c}_2$, and (ii) for appropriate
choices of the enhancements $\mathring{c}_j$, crossovers from attraction to
repulsion and vice versa occur as $L$ increases.
