1ba340e45Schristos /* Declare the environ system variable. 2*e663ba6eSchristos Copyright (C) 2015-2024 Free Software Foundation, Inc. 3ba340e45Schristos 4ba340e45Schristos This file is part of the libiberty library. 5ba340e45Schristos Libiberty is free software; you can redistribute it and/or 6ba340e45Schristos modify it under the terms of the GNU Library General Public 7ba340e45Schristos License as published by the Free Software Foundation; either 8ba340e45Schristos version 2 of the License, or (at your option) any later version. 9ba340e45Schristos 10ba340e45Schristos Libiberty is distributed in the hope that it will be useful, 11ba340e45Schristos but WITHOUT ANY WARRANTY; without even the implied warranty of 12ba340e45Schristos MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13ba340e45Schristos Library General Public License for more details. 14ba340e45Schristos 15ba340e45Schristos You should have received a copy of the GNU Library General Public 16ba340e45Schristos License along with libiberty; see the file COPYING.LIB. If not, 17ba340e45Schristos write to the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor, 18ba340e45Schristos Boston, MA 02110-1301, USA. */ 19ba340e45Schristos 20ba340e45Schristos /* On OSX, the environ variable can be used directly in the code of an 21ba340e45Schristos executable, but cannot be used in the code of a shared library (such as 22ba340e45Schristos GCC's liblto_plugin, which links in libiberty code). Instead, the 23ba340e45Schristos function _NSGetEnviron can be called to get the address of environ. */ 24ba340e45Schristos 25ba340e45Schristos #ifndef HAVE_ENVIRON_DECL 26ba340e45Schristos # ifdef __APPLE__ 27ba340e45Schristos # include <crt_externs.h> 28ba340e45Schristos # define environ (*_NSGetEnviron ()) 29ba340e45Schristos # else 30796c32c9Schristos # ifndef environ 31ba340e45Schristos extern char **environ; 32ba340e45Schristos # endif 33796c32c9Schristos # endif 34ba340e45Schristos # define HAVE_ENVIRON_DECL 35ba340e45Schristos #endif 36