diff --git a/setup.py b/setup.py index 617c07d..7994e38 100644 --- a/setup.py +++ b/setup.py @@ -38,6 +38,13 @@ except ImportError: # Use a provided libarchive else default to hard-coded path. libarchivePrefix = environ.get('LIBARCHIVE_PREFIX') +if libarchivePrefix is None: + import pathlib + for i in [ '/usr', '/usr/local', '/opt/local' ]: + libdir = pathlib.Path(i) / 'lib' + if list(libdir.glob('libarchive.*')): + libarchivePrefix = i + break if libarchivePrefix: includePath = libarchivePrefix + '/include'