Blame cmake/modules/TestForStandardHeaderwait.cmake

Packit Service df60bb
# cmake/modules/CheckHEADER_SYS_WAIT.cmake
Packit Service df60bb
#
Packit Service df60bb
# Copyright (C) 2006  Alan W. Irwin
Packit Service df60bb
#
Packit Service df60bb
# This file is part of PLplot.
Packit Service df60bb
#
Packit Service df60bb
# PLplot is free software; you can redistribute it and/or modify
Packit Service df60bb
# it under the terms of the GNU Library General Public License as published
Packit Service df60bb
# by the Free Software Foundation; version 2 of the License.
Packit Service df60bb
#
Packit Service df60bb
# PLplot is distributed in the hope that it will be useful,
Packit Service df60bb
# but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit Service df60bb
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Packit Service df60bb
# GNU Library General Public License for more details.
Packit Service df60bb
#
Packit Service df60bb
# You should have received a copy of the GNU Library General Public License
Packit Service df60bb
# along with the file PLplot; if not, write to the Free Software
Packit Service df60bb
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
Packit Service df60bb
Packit Service df60bb
#
Packit Service df60bb
# - Check for sys/wait.h that is POSIX.1 compatible following autotools
Packit Service df60bb
#   AC_HEADER_SYS_WAIT
Packit Service df60bb
Packit Service df60bb
include(CheckCSourceCompiles)
Packit Service df60bb
Packit Service df60bb
set(_CHECK_HEADER_SYS_WAIT_SOURCE_CODE "
Packit Service df60bb
#include <sys/types.h>
Packit Service df60bb
#include <sys/wait.h>
Packit Service df60bb
#ifndef WEXITSTATUS
Packit Service df60bb
# define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8)
Packit Service df60bb
#endif
Packit Service df60bb
#ifndef WIFEXITED
Packit Service df60bb
# define WIFEXITED(stat_val) (((stat_val) & 255) == 0)
Packit Service df60bb
#endif
Packit Service df60bb
int
Packit Service df60bb
main ()
Packit Service df60bb
{
Packit Service df60bb
  int s;
Packit Service df60bb
  wait (&s);
Packit Service df60bb
  s = WIFEXITED (s) ? WEXITSTATUS (s) : 1;
Packit Service df60bb
  ;
Packit Service df60bb
  return 0;
Packit Service df60bb
}
Packit Service df60bb
")
Packit Service df60bb
check_c_source_compiles(
Packit Service df60bb
"${_CHECK_HEADER_SYS_WAIT_SOURCE_CODE}"
Packit Service df60bb
HAVE_SYS_WAIT_H)