. "$GRIMOIRE/FUNCTIONS" &&

config_query_option ACCEL_PPP_OPTS "Build version with debug information?" n \
                                   "-DCMAKE_BUILD_TYPE=Debug" \
                                   "-DCMAKE_BUILD_TYPE=Release" &&

# backport old driver config options
if list_find "$ACCEL_PPP_OPTS" "-DBUILD_DRIVER=TRUE"; then
  list_remove "ACCEL_PPP_OPTS" "-DBUILD_DRIVER=TRUE" &&
  list_add "ACCEL_PPP_OPTS" "-DBUILD_PPTP_DRIVER=TRUE"
fi &&

if list_find "$ACCEL_PPP_OPTS" "-DBUILD_DRIVER=FALSE"; then
  list_remove "ACCEL_PPP_OPTS" "-DBUILD_DRIVER=FALSE" &&
  list_add "ACCEL_PPP_OPTS" "-DBUILD_PPTP_DRIVER=FALSE"
fi &&

if is_version_less $(get_kernel_version) 2.6.37; then
  message "${MESSAGE_COLOR}Kernel version lower than 2.6.37 detected," &&
  message "forcing build of non-native pptp module...${DEFAULT_COLOR}" &&
  list_add ACCEL_PPP_OPTS "-DBUILD_PPTP_DRIVER=TRUE"
else
  config_query_option ACCEL_PPP_OPTS "Build pptp kernel module (replaced by native in new kernels)?" n \
                                     "-DBUILD_PPTP_DRIVER=TRUE" \
                                     "-DBUILD_PPTP_DRIVER=FALSE"
fi &&

config_query_option ACCEL_PPP_OPTS "Build ipoe (IP over Ethernet) kernel module?" n \
                                   "-DBUILD_IPOE_DRIVER=TRUE" \
                                   "-DBUILD_IPOE_DRIVER=FALSE"
