modular/require.ss
#lang scheme/base

(require (for-syntax scheme/base))

(provide require-macro)

(define-for-syntax (expand-require stx)
  (syntax-case stx ()
    [(_ mod ...)
     (begin
       (for ([m (syntax->list #'(mod ...))])
         (unless (string? (syntax-e m))
           (raise-syntax-error
            #f "expected a filename (string literal)"
            stx m)))
       (syntax/loc stx
         (begin
           (require mod ...)
           (provide (all-from-out mod ...)))))]))

(define-syntax require-macro expand-require)